@agent-corpus/policy-manager 0.9.0 → 0.11.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.
Files changed (47) hide show
  1. package/README.md +126 -29
  2. package/dist/adapters.d.ts +3 -1
  3. package/dist/adapters.js +37 -18
  4. package/dist/classifier.d.ts +98 -0
  5. package/dist/classifier.js +343 -0
  6. package/dist/cli.js +66 -7
  7. package/dist/config.d.ts +2 -0
  8. package/dist/config.js +6 -2
  9. package/dist/evidence.d.ts +1 -0
  10. package/dist/evidence.js +60 -0
  11. package/dist/flow.d.ts +4 -0
  12. package/dist/flow.js +91 -18
  13. package/dist/gitalias.d.ts +13 -0
  14. package/dist/gitalias.js +33 -0
  15. package/dist/grants.d.ts +9 -9
  16. package/dist/grants.js +46 -30
  17. package/dist/hard.d.ts +63 -0
  18. package/dist/hard.js +1637 -0
  19. package/dist/helpers.d.ts +59 -0
  20. package/dist/helpers.js +304 -0
  21. package/dist/merged.d.ts +6 -0
  22. package/dist/merged.js +23 -0
  23. package/dist/nativerules.d.ts +44 -0
  24. package/dist/nativerules.js +653 -0
  25. package/dist/permissive.js +179 -7
  26. package/dist/policy.d.ts +12 -0
  27. package/dist/policy.js +228 -45
  28. package/dist/profile.d.ts +7 -0
  29. package/dist/profile.js +32 -1
  30. package/dist/prompt.d.ts +32 -0
  31. package/dist/prompt.js +334 -0
  32. package/dist/reads.d.ts +46 -0
  33. package/dist/reads.js +812 -0
  34. package/dist/replay.d.ts +42 -0
  35. package/dist/replay.js +174 -1
  36. package/dist/service.d.ts +12 -1
  37. package/dist/service.js +23 -6
  38. package/dist/session.d.ts +76 -13
  39. package/dist/session.js +373 -116
  40. package/dist/shell.d.ts +2 -0
  41. package/dist/shell.js +1 -1
  42. package/dist/shellscan.d.ts +58 -0
  43. package/dist/shellscan.js +395 -0
  44. package/dist/statepaths.d.ts +41 -0
  45. package/dist/statepaths.js +706 -0
  46. package/dist/types.d.ts +11 -1
  47. package/package.json +1 -1
package/dist/replay.d.ts CHANGED
@@ -1,4 +1,6 @@
1
1
  import { type Profile } from "./profile.js";
2
+ import { type SessionDependencies } from "./session.js";
3
+ import type { Decision, Request } from "./types.js";
2
4
  export interface ReplayReport {
3
5
  commands: number;
4
6
  approved: number;
@@ -17,4 +19,44 @@ export interface ReplayReport {
17
19
  * not executed. Output lists reasons and a first-line excerpt of examples, so keep reports local.
18
20
  */
19
21
  export declare function replayTranscripts(paths: string[], profile: Profile, files?: number): ReplayReport;
22
+ export interface ClassifiedReplay {
23
+ /** Unique commands read, newest first, until `limit` escalations were found. */
24
+ commands: number;
25
+ engineApproved: number;
26
+ escalations: number;
27
+ aiApproved: number;
28
+ userAllowApproved: number;
29
+ /** Left to the harness by the user's own deny or ask rule. */
30
+ userRuleNative: number;
31
+ /** Other decisions that leave the request to the harness (unlisted MCP tools and the like). */
32
+ otherNative: number;
33
+ stillAsk: number;
34
+ askReasons: Array<{
35
+ reason: string;
36
+ count: number;
37
+ examples: string[];
38
+ }>;
39
+ classifierRuns: number;
40
+ classifierErrors: Record<string, number>;
41
+ latencyMs: {
42
+ p50: number;
43
+ p95: number;
44
+ max: number;
45
+ };
46
+ }
47
+ /**
48
+ * Replays the newest `limit` escalations through the full hook decision: the engine, then the
49
+ * real AI classifier (the harness's own CLI, `concurrency` at a time), then the user's own
50
+ * permission rules. Each escalation gets a fresh session in a private temporary directory, seeded
51
+ * with the files its transcript wrote before it. Nothing is executed and no settings are changed.
52
+ */
53
+ export declare function replayClassified(paths: string[], profile: Profile, options?: {
54
+ limit?: number;
55
+ files?: number;
56
+ concurrency?: number;
57
+ harness?: Request["harness"];
58
+ deps?: SessionDependencies;
59
+ /** Called with each replayed escalation and its decision. */
60
+ onDecision?: (command: string, cwd: string, decision: Decision) => void;
61
+ }): Promise<ClassifiedReplay>;
20
62
  //# sourceMappingURL=replay.d.ts.map
package/dist/replay.js CHANGED
@@ -1,7 +1,10 @@
1
- import { readdirSync, readFileSync, statSync } from "node:fs";
1
+ import { mkdirSync, mkdtempSync, readdirSync, readFileSync, rmSync, statSync } from "node:fs";
2
+ import { tmpdir } from "node:os";
2
3
  import { join } from "node:path";
4
+ import { classifyWithCli } from "./classifier.js";
3
5
  import { evaluate } from "./policy.js";
4
6
  import { strictProfile } from "./profile.js";
7
+ import { PolicySession } from "./session.js";
5
8
  function transcriptFiles(paths, limit) {
6
9
  const files = [];
7
10
  const visit = (path) => {
@@ -86,4 +89,174 @@ export function replayTranscripts(paths, profile, files = 50) {
86
89
  .sort((a, b) => b.count - a.count);
87
90
  return report;
88
91
  }
92
+ /** Bash commands of the newest transcripts, newest first, each with what its session wrote before. */
93
+ function candidates(paths, files) {
94
+ const all = [];
95
+ for (const file of transcriptFiles(paths, files)) {
96
+ const created = [];
97
+ const found = [];
98
+ for (const line of readFileSync(file, "utf8").split("\n")) {
99
+ if (!line.includes('"tool_use"'))
100
+ continue;
101
+ let entry;
102
+ try {
103
+ entry = JSON.parse(line);
104
+ }
105
+ catch {
106
+ continue;
107
+ }
108
+ const content = entry.message?.content;
109
+ if (!Array.isArray(content))
110
+ continue;
111
+ for (const item of content) {
112
+ if (item.type !== "tool_use")
113
+ continue;
114
+ const input = (item.input ?? {});
115
+ if (item.name === "Write" && typeof input.file_path === "string") {
116
+ created.push(input.file_path);
117
+ if (created.length > 200)
118
+ created.shift();
119
+ }
120
+ if (item.name === "Bash" && typeof input.command === "string")
121
+ found.push({
122
+ cwd: entry.cwd ?? process.cwd(),
123
+ command: input.command,
124
+ created: [...created],
125
+ });
126
+ }
127
+ }
128
+ all.push(...found.reverse());
129
+ }
130
+ return all;
131
+ }
132
+ const percentile = (sorted, p) => sorted.length
133
+ ? sorted[Math.min(sorted.length - 1, Math.floor((p / 100) * sorted.length))]
134
+ : 0;
135
+ /**
136
+ * Replays the newest `limit` escalations through the full hook decision: the engine, then the
137
+ * real AI classifier (the harness's own CLI, `concurrency` at a time), then the user's own
138
+ * permission rules. Each escalation gets a fresh session in a private temporary directory, seeded
139
+ * with the files its transcript wrote before it. Nothing is executed and no settings are changed.
140
+ */
141
+ export async function replayClassified(paths, profile, options = {}) {
142
+ const limit = options.limit ?? 300;
143
+ const harness = options.harness ?? "claude";
144
+ const report = {
145
+ commands: 0,
146
+ engineApproved: 0,
147
+ escalations: 0,
148
+ aiApproved: 0,
149
+ userAllowApproved: 0,
150
+ userRuleNative: 0,
151
+ otherNative: 0,
152
+ stillAsk: 0,
153
+ askReasons: [],
154
+ classifierRuns: 0,
155
+ classifierErrors: {},
156
+ latencyMs: { p50: 0, p95: 0, max: 0 },
157
+ };
158
+ const seen = new Set();
159
+ const escalations = [];
160
+ for (const candidate of candidates(paths, options.files ?? 200)) {
161
+ if (escalations.length >= limit)
162
+ break;
163
+ const key = `${candidate.cwd}\0${candidate.command}`;
164
+ if (seen.has(key))
165
+ continue;
166
+ seen.add(key);
167
+ report.commands++;
168
+ const request = {
169
+ sessionId: "replay",
170
+ harness,
171
+ cwd: candidate.cwd,
172
+ tool: "Bash",
173
+ input: { command: candidate.command },
174
+ };
175
+ if (evaluate(request, undefined, profile).decision === "approve")
176
+ report.engineApproved++;
177
+ else
178
+ escalations.push(candidate);
179
+ }
180
+ report.escalations = escalations.length;
181
+ const latencies = [];
182
+ const base = options.deps?.classify;
183
+ const classify = async (cli, prompt, p) => {
184
+ const outcome = await (base ?? ((c, t, q) => classifyWithCli(c, t, q.classifier)))(cli, prompt, p);
185
+ report.classifierRuns++;
186
+ latencies.push(outcome.latencyMs);
187
+ if (!outcome.ok)
188
+ report.classifierErrors[outcome.reason] = (report.classifierErrors[outcome.reason] ?? 0) + 1;
189
+ return outcome;
190
+ };
191
+ const reasons = new Map();
192
+ const root = mkdtempSync(join(tmpdir(), "acp-replay-"));
193
+ try {
194
+ let next = 0;
195
+ const worker = async () => {
196
+ while (next < escalations.length) {
197
+ const index = next++;
198
+ const candidate = escalations[index];
199
+ const directory = join(root, String(index));
200
+ mkdirSync(directory, { mode: 0o700 });
201
+ const session = new PolicySession(directory, harness, "replay", profile, undefined, {
202
+ classify,
203
+ ...(options.deps?.nativeRules ? { nativeRules: options.deps.nativeRules } : {}),
204
+ });
205
+ for (const path of candidate.created)
206
+ session.noteCreated(path);
207
+ const decision = await session.decide({
208
+ sessionId: "replay",
209
+ harness,
210
+ cwd: candidate.cwd,
211
+ tool: "Bash",
212
+ input: { command: candidate.command },
213
+ }, "PreToolUse");
214
+ options.onDecision?.(candidate.command, candidate.cwd, decision);
215
+ if (decision.decision === "approve") {
216
+ if (decision.userAllowRule)
217
+ report.userAllowApproved++;
218
+ else if (decision.classification === "approved")
219
+ report.aiApproved++;
220
+ else
221
+ report.engineApproved++;
222
+ }
223
+ else if (decision.decision === "native") {
224
+ if (decision.userRule)
225
+ report.userRuleNative++;
226
+ else
227
+ report.otherNative++;
228
+ }
229
+ else {
230
+ report.stillAsk++;
231
+ const reason = decision.hard
232
+ ? `hard: ${decision.hard}`
233
+ : decision.ai
234
+ ? `classifier: ${decision.ai.category}, recoverable ${decision.ai.recoverable}, confidence ${decision.ai.confidence < 0.95 ? "< 0.95" : ">= 0.95"}`
235
+ : decision.fallbackReason
236
+ ? `no classification: ${decision.fallbackReason}`
237
+ : decision.reason;
238
+ const bucket = reasons.get(reason) ?? { count: 0, examples: [] };
239
+ bucket.count++;
240
+ if (bucket.examples.length < 3)
241
+ bucket.examples.push(candidate.command.split("\n")[0]?.slice(0, 100) ?? "");
242
+ reasons.set(reason, bucket);
243
+ }
244
+ }
245
+ };
246
+ await Promise.all(Array.from({ length: options.concurrency ?? 4 }, worker));
247
+ }
248
+ finally {
249
+ rmSync(root, { recursive: true, force: true });
250
+ }
251
+ report.askReasons = [...reasons]
252
+ .map(([reason, value]) => ({ reason, ...value }))
253
+ .sort((a, b) => b.count - a.count);
254
+ const sorted = latencies.sort((a, b) => a - b);
255
+ report.latencyMs = {
256
+ p50: percentile(sorted, 50),
257
+ p95: percentile(sorted, 95),
258
+ max: sorted.at(-1) ?? 0,
259
+ };
260
+ return report;
261
+ }
89
262
  //# sourceMappingURL=replay.js.map
package/dist/service.d.ts CHANGED
@@ -11,7 +11,18 @@ interface Message {
11
11
  confirm: boolean;
12
12
  session?: boolean;
13
13
  };
14
+ /** Claude Code's `permission_mode` for a PreToolUse: whether an ask reaches a person. */
15
+ permissionMode?: string;
16
+ /** Claude Code's `tool_use_id` for a PreToolUse or PostToolUse. */
17
+ toolUseId?: string;
18
+ /** A PostToolUseFailure's error text and interrupt flag, to tell a rejected prompt from a run. */
19
+ failure?: {
20
+ error?: string;
21
+ interrupted?: boolean;
22
+ };
14
23
  }
24
+ /** How long a hook waits for a review, which can include the AI classifier's run. */
25
+ export declare const REVIEW_TIMEOUT_MS = 40000;
15
26
  export declare function serve(harness: string, sessionId: string, cliPath?: string): Promise<void>;
16
27
  export declare function send(harness: string, sessionId: string, message: Omit<Message, "token">): Promise<unknown>;
17
28
  /**
@@ -26,7 +37,7 @@ export declare function latestHumanDecision(): Promise<{
26
37
  sessionId: string;
27
38
  } | undefined>;
28
39
  /** Sends to the service of an existing session directory (see `approve --last`). */
29
- export declare function sendTo(directory: string, message: Omit<Message, "token">): Promise<unknown>;
40
+ export declare function sendTo(directory: string, message: Omit<Message, "token">, timeoutMs?: number): Promise<unknown>;
30
41
  /**
31
42
  * Stops a session's service. A session with no service (it never started, already ended, or the
32
43
  * harness fired SessionEnd outside a real session such as `claude update`) is not an error:
package/dist/service.js CHANGED
@@ -7,6 +7,8 @@ import { audit, sessionDirectory, sessionDirectoryPath, sessionToken } from "./a
7
7
  import { hash, requestHash } from "./policy.js";
8
8
  import { loadProfile, strictProfile } from "./profile.js";
9
9
  import { GrantError, PolicySession } from "./session.js";
10
+ /** How long a hook waits for a review, which can include the AI classifier's run. */
11
+ export const REVIEW_TIMEOUT_MS = 40_000;
10
12
  function endpoint(directory) {
11
13
  return process.platform === "win32"
12
14
  ? `\\\\.\\pipe\\acp-${hash(directory).slice(0, 32)}`
@@ -27,7 +29,7 @@ export async function serve(harness, sessionId, cliPath) {
27
29
  socket.setTimeout(3000, () => socket.destroy());
28
30
  let data = "";
29
31
  socket.on("error", () => { });
30
- socket.on("data", (chunk) => {
32
+ socket.on("data", async (chunk) => {
31
33
  data += chunk.toString();
32
34
  if (data.length > 1024 * 1024) {
33
35
  socket.destroy();
@@ -58,6 +60,8 @@ export async function serve(harness, sessionId, cliPath) {
58
60
  : "invalid",
59
61
  });
60
62
  idle.refresh();
63
+ // A review can wait for the classifier; the connection stays open until it answers.
64
+ socket.setTimeout(REVIEW_TIMEOUT_MS + 5000);
61
65
  let result;
62
66
  if (message.action === "ping")
63
67
  result = { ready: true };
@@ -69,12 +73,25 @@ export async function serve(harness, sessionId, cliPath) {
69
73
  server.close();
70
74
  }
71
75
  else if (message.action === "review" && message.request)
72
- result = session.review(message.request, undefined, message.phase);
76
+ result = await session.decide(message.request, message.phase, typeof message.toolUseId === "string" ? message.toolUseId : undefined, typeof message.permissionMode === "string" ? message.permissionMode : undefined);
73
77
  else if (message.action === "classify" && message.classification)
74
78
  result = session.classify(message.classification);
75
79
  else if (message.action === "record" && message.report) {
76
80
  session.record(message.report);
77
- result = { recorded: true };
81
+ const answer = message.phase?.startsWith("PostToolUse") && message.report.event === "execution-result"
82
+ ? session.answered({
83
+ requestHash: message.report.requestHash,
84
+ phase: message.phase,
85
+ ...(typeof message.toolUseId === "string"
86
+ ? { toolUseId: message.toolUseId }
87
+ : {}),
88
+ ...(typeof message.failure?.error === "string"
89
+ ? { error: message.failure.error.slice(0, 2000) }
90
+ : {}),
91
+ ...(message.failure?.interrupted === true ? { interrupted: true } : {}),
92
+ })
93
+ : undefined;
94
+ result = { recorded: true, ...(answer ? { answer } : {}) };
78
95
  }
79
96
  else if (message.action === "grant" && message.grant) {
80
97
  try {
@@ -132,7 +149,7 @@ export async function serve(harness, sessionId, cliPath) {
132
149
  });
133
150
  }
134
151
  export function send(harness, sessionId, message) {
135
- return sendTo(sessionDirectory(harness, sessionId), message);
152
+ return sendTo(sessionDirectory(harness, sessionId), message, message.action === "review" ? REVIEW_TIMEOUT_MS : undefined);
136
153
  }
137
154
  /**
138
155
  * The newest request waiting for a person across this user's running policy services, for
@@ -176,11 +193,11 @@ export async function latestHumanDecision() {
176
193
  return best;
177
194
  }
178
195
  /** Sends to the service of an existing session directory (see `approve --last`). */
179
- export function sendTo(directory, message) {
196
+ export function sendTo(directory, message, timeoutMs = 4000) {
180
197
  return new Promise((resolve, reject) => {
181
198
  const socket = createConnection(endpoint(directory));
182
199
  let data = "";
183
- socket.setTimeout(4000, () => socket.destroy(new Error("Policy service timeout")));
200
+ socket.setTimeout(timeoutMs, () => socket.destroy(new Error("Policy service timeout")));
184
201
  socket.on("error", reject);
185
202
  socket.on("connect", () => socket.write(`${JSON.stringify({ ...message, token: sessionToken(directory) })}\n`));
186
203
  socket.on("data", (chunk) => {
package/dist/session.d.ts CHANGED
@@ -1,8 +1,12 @@
1
+ import { type ClassifierResult } from "./classifier.js";
2
+ import { APPROVE_GUARD } from "./hard.js";
3
+ import { type NativeMatch } from "./nativerules.js";
1
4
  import { type Profile } from "./profile.js";
2
5
  import { type Classification, type Decision, type OutcomeReport, type Request } from "./types.js";
3
- /** AI approvals per session; beyond this, ambiguous requests go to a human. */
4
- export declare const MAX_AI_APPROVALS = 50;
5
- export declare const APPROVE_GUARD = "Only the user may approve a request, by running approve in their own terminal";
6
+ export { APPROVE_GUARD };
7
+ /** Longest shell command checked at all; a longer one is asked at once, with no parsing. */
8
+ export declare const MAX_HOOK_COMMAND = 100000;
9
+ export declare const TOO_LONG_REASON = "Command is too long to check";
6
10
  /** How long after a human decision the user may still approve that exact request once. */
7
11
  export declare const GRANT_WINDOW_MS: number;
8
12
  /** What `approve` shows the user before a one-time grant: the request a person must decide. */
@@ -16,6 +20,21 @@ export interface GrantPreview {
16
20
  /** What a session approval would cover, when this request can be approved for the session. */
17
21
  sessionScope?: string;
18
22
  }
23
+ /** What the session runs to classify and to read the user's own rules. Replaceable in tests. */
24
+ export interface SessionDependencies {
25
+ classify?: (cli: Request["harness"], prompt: string | undefined, profile: Profile) => Promise<ClassifierResult>;
26
+ nativeRules?: (request: Request) => NativeMatch | undefined;
27
+ }
28
+ /** A tool-execution report from PostToolUse or PostToolUseFailure, for a pending harness prompt. */
29
+ export interface AskReport {
30
+ requestHash: string;
31
+ phase: string;
32
+ /** Claude Code's `tool_use_id`. Copilot sends none, so its prompts are matched by request. */
33
+ toolUseId?: string;
34
+ /** The failure text of a PostToolUseFailure, used only to tell a rejection from a run. */
35
+ error?: string;
36
+ interrupted?: boolean;
37
+ }
19
38
  /** A grant the service refuses; its message is safe to show the user. */
20
39
  export declare class GrantError extends Error {
21
40
  }
@@ -29,8 +48,6 @@ export declare class PolicySession {
29
48
  private cache;
30
49
  private pending;
31
50
  private states;
32
- /** Requests the AI approved, counted once each however often they are retried. */
33
- private approvedByAi;
34
51
  /** Files this session created, and the paths each approved request may create. */
35
52
  private created;
36
53
  private creating;
@@ -40,14 +57,19 @@ export declare class PolicySession {
40
57
  private grants;
41
58
  /** Session grants: hashes of a human rule and the scope the user approved it for. */
42
59
  private sessionGrants;
60
+ /** Harness prompts waiting for their answer, by `tool_use_id` (or `request:<hash>`). */
61
+ private asks;
62
+ /** Classifications running now, so concurrent hooks for one request share one CLI run. */
63
+ private running;
64
+ /** The classifier CLI is not installed: later requests go straight to a person. */
65
+ private classifierMissing;
66
+ private readonly deps;
43
67
  constructor(directory: string, harness: string, sessionId: string, profile?: Profile,
44
68
  /** This package's `cli.js`: the path in the record command the hook gives the model. */
45
- cliPath?: string | undefined);
69
+ cliPath?: string | undefined, deps?: SessionDependencies);
46
70
  /**
47
- * The record command the hook gives this session is approved before the policy runs: the
48
- * engine cannot always verify an installed CLI outside the repository or a here-string (strict
49
- * mode never can), so the round trip could not finish. Any other classification record, for
50
- * another session or CLI or with anything added, goes to a person.
71
+ * A command that runs a policy-manager `classify` record goes to a person: the hook classifies
72
+ * requests itself, and an agent that could record its own verdict could approve itself.
51
73
  */
52
74
  private classifyRecord;
53
75
  /**
@@ -67,6 +89,7 @@ export declare class PolicySession {
67
89
  harness: string;
68
90
  sessionId: string;
69
91
  } | undefined;
92
+ private addSessionGrant;
70
93
  /**
71
94
  * Looks up, and with `confirm` grants, a user approval of a request this session sent to a
72
95
  * person within the last GRANT_WINDOW_MS. Without `session` the next review of that exact
@@ -81,12 +104,52 @@ export declare class PolicySession {
81
104
  private state;
82
105
  private remember;
83
106
  /**
84
- * `phase` is the hook event. Only `PreToolUse` runs the classification flow: the first time an
85
- * ambiguous request arrives it is blocked with an instruction to classify and retry; the next
86
- * time, with no usable classification, a human is asked and the reason is recorded.
107
+ * The deterministic decision for a request, with any classification this session already has
108
+ * for it and the user's own grants applied. Synchronous: it never runs the classifier. A request
109
+ * that still needs one comes back `human` with `needsClassification`; `decide` runs it.
87
110
  */
88
111
  review(request: Request, ai?: Classification, phase?: string): Decision;
112
+ private judge;
113
+ private cacheKey;
114
+ /** Records a final decision: the person's queue, caches, pending creations and the audit log. */
115
+ private conclude;
116
+ /** Records, once, that an ambiguous request entered classification (for review-classifications). */
117
+ private noteRequested;
118
+ /** Runs (or joins) the classifier for a request, audits the run, and returns its result. */
119
+ private runClassifier;
120
+ /**
121
+ * The hook's decision. The deterministic engine approves what it can prove safe; otherwise the
122
+ * AI classifier is run synchronously and approves when `recoverable && confidence >= 0.95 &&
123
+ * category not in {sensitive, unknown}`; otherwise a person is asked. The user's own harness
124
+ * rules apply throughout: their deny or ask rule leaves the request to the harness (no
125
+ * decision), and their allow rule counts as the person's answer.
126
+ */
127
+ decide(request: Request, phase?: string, toolUseId?: string,
128
+ /** The harness's permission mode (Claude Code's `permission_mode`), when it reports one. */
129
+ permissionMode?: string): Promise<Decision>;
130
+ /**
131
+ * Marks an existing file as created by this session, for `replay`, which rebuilds what a past
132
+ * session created from its transcript. The service never calls it.
133
+ */
134
+ noteCreated(path: string): void;
135
+ private userRule;
136
+ /**
137
+ * The hook asked, so the harness prompts the person. Its PostToolUse for this exact tool call
138
+ * means they said yes, but only when the harness reports a permission mode in which an ask is
139
+ * really shown to a person: Claude Code's `default`, `acceptEdits` or `plan`. Under
140
+ * `bypassPermissions`, `dontAsk`, an auto mode, or with no mode reported (Copilot reports none,
141
+ * so `--allow-all`/`--yolo` cannot be told apart), nothing is remembered. Codex cannot ask.
142
+ */
143
+ private awaitAnswer;
144
+ /**
145
+ * PostToolUse (or PostToolUseFailure) for a tool call the harness asked the person about: they
146
+ * said yes. The answer is remembered like `approve --session`: the same rule for the same scope
147
+ * is approved for the rest of the session (a protected root, a humanPatterns entry, or the exact
148
+ * command for other rules); unknown, sensitive and destructive requests stay once-only.
149
+ */
150
+ answered(report: AskReport): "session" | "once" | "rejected" | undefined;
89
151
  record(report: OutcomeReport): void;
152
+ /** The compatibility `classify` command: a recorded classification for a pending request. */
90
153
  classify(classification: Classification): Decision;
91
154
  }
92
155
  //# sourceMappingURL=session.d.ts.map