auto-mode 1.0.1 → 2.0.1
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/{classify-edit-B10-ua5i.js → classify-edit-DXP7XLGH.js} +10 -10
- package/dist/cli.js +2810 -73
- package/dist/index.d.ts +47 -18
- package/dist/index.js +13 -1
- package/dist/parse-action-request-neI2tNwd.js +5378 -0
- package/dist/{parse-action-request-BfkmQxEC.js → schemas-Dc2424NY.js} +83 -5238
- package/dist/start-judge-server-CCSZbTwM.js +169 -0
- package/dist/start-judge-session-B_DFN8Ji.js +2 -0
- package/dist/start-judge-session-DjPX0007.js +37956 -0
- package/package.json +5 -3
- package/policy/containment.md +3 -3
- package/policy/judge.md +5 -12
- package/policy/classifier.md +0 -282
package/dist/index.d.ts
CHANGED
|
@@ -4,10 +4,27 @@ interface DenialBudget {
|
|
|
4
4
|
readonly perSession: number;
|
|
5
5
|
}
|
|
6
6
|
//#endregion
|
|
7
|
+
//#region src/messages/anthropic-client.d.ts
|
|
8
|
+
interface ModelRequest {
|
|
9
|
+
readonly system: string;
|
|
10
|
+
readonly user: string;
|
|
11
|
+
}
|
|
12
|
+
//#endregion
|
|
7
13
|
//#region src/judge/types.d.ts
|
|
8
14
|
type OverturnBasis = 'consent' | 'misread';
|
|
9
15
|
type JudgeOverturns = 'consent' | 'any';
|
|
10
16
|
type JudgeStatus = 'confirmed' | 'overturned' | 'held' | 'failed';
|
|
17
|
+
interface JudgeMessageReply {
|
|
18
|
+
readonly text: string;
|
|
19
|
+
readonly model: string;
|
|
20
|
+
readonly safetyStops: number | null;
|
|
21
|
+
readonly fallback: boolean;
|
|
22
|
+
readonly warm: boolean | null;
|
|
23
|
+
}
|
|
24
|
+
interface JudgeSession {
|
|
25
|
+
readonly review: (model: string, request: Readonly<ModelRequest>, signal: Readonly<AbortSignal>) => Promise<JudgeMessageReply>;
|
|
26
|
+
readonly stop: () => void;
|
|
27
|
+
}
|
|
11
28
|
type JudgeFailure = 'credential' | 'policy' | 'request' | 'timeout' | 'unreadable';
|
|
12
29
|
interface JudgeDiagnostics {
|
|
13
30
|
readonly status: JudgeStatus;
|
|
@@ -16,13 +33,22 @@ interface JudgeDiagnostics {
|
|
|
16
33
|
readonly model: string;
|
|
17
34
|
readonly answeringModel: string | null;
|
|
18
35
|
readonly safetyStops: number | null;
|
|
36
|
+
readonly warm: boolean | null;
|
|
19
37
|
readonly rule: string;
|
|
20
38
|
readonly tier: 'hard' | 'soft';
|
|
21
39
|
readonly elapsedMs: number;
|
|
22
40
|
}
|
|
23
41
|
//#endregion
|
|
42
|
+
//#region src/git/types.d.ts
|
|
43
|
+
interface Checkout {
|
|
44
|
+
readonly worktree: string;
|
|
45
|
+
readonly gitDir: string;
|
|
46
|
+
readonly commonDir: string;
|
|
47
|
+
}
|
|
48
|
+
type CheckoutFinder = (start: string, env: HostEnvironment['env']) => Promise<Checkout | null>;
|
|
49
|
+
//#endregion
|
|
24
50
|
//#region src/types.d.ts
|
|
25
|
-
type DecidingStage = 'local' | 'containment' | 'bypass' | 'jev' | 'judge' | '
|
|
51
|
+
type DecidingStage = 'local' | 'containment' | 'bypass' | 'jev' | 'judge' | 'retry' | 'budget';
|
|
26
52
|
interface DecisionRule {
|
|
27
53
|
readonly name: string;
|
|
28
54
|
readonly tier: 'hard' | 'soft';
|
|
@@ -47,6 +73,13 @@ interface HostEnvironment {
|
|
|
47
73
|
readonly home: string;
|
|
48
74
|
readonly scratchPaths?: readonly string[] | undefined;
|
|
49
75
|
}
|
|
76
|
+
interface Runtime {
|
|
77
|
+
readonly host: Readonly<HostEnvironment>;
|
|
78
|
+
readonly now: () => number;
|
|
79
|
+
readonly timeout: (ms: number) => AbortSignal;
|
|
80
|
+
readonly fetch: (url: string, init: Readonly<RequestInit>) => Promise<Response>;
|
|
81
|
+
readonly findCheckout: CheckoutFinder;
|
|
82
|
+
}
|
|
50
83
|
interface ClaudeRules {
|
|
51
84
|
readonly environment: readonly string[];
|
|
52
85
|
readonly allow: readonly string[];
|
|
@@ -62,9 +95,7 @@ interface EvaluationOptions {
|
|
|
62
95
|
readonly deadlineAt?: number | undefined;
|
|
63
96
|
readonly signal?: Readonly<AbortSignal> | undefined;
|
|
64
97
|
readonly taskScope?: TaskScopeSummary | undefined;
|
|
65
|
-
readonly
|
|
66
|
-
readonly now?: (() => number) | undefined;
|
|
67
|
-
readonly timeout?: ((ms: number) => AbortSignal) | undefined;
|
|
98
|
+
readonly runtime: Readonly<Runtime>;
|
|
68
99
|
}
|
|
69
100
|
//#endregion
|
|
70
101
|
//#region src/config/config.d.ts
|
|
@@ -103,15 +134,6 @@ interface Config {
|
|
|
103
134
|
readonly capture?: CaptureConfig;
|
|
104
135
|
readonly warnings?: readonly string[];
|
|
105
136
|
}
|
|
106
|
-
export declare function loadConfig(configPath?: string, host?: Readonly<HostEnvironment>): Promise<Config>;
|
|
107
|
-
//#endregion
|
|
108
|
-
//#region src/git/types.d.ts
|
|
109
|
-
interface Checkout {
|
|
110
|
-
readonly worktree: string;
|
|
111
|
-
readonly gitDir: string;
|
|
112
|
-
readonly commonDir: string;
|
|
113
|
-
}
|
|
114
|
-
type CheckoutFinder = (start: string, env: HostEnvironment['env']) => Promise<Checkout | null>;
|
|
115
137
|
//#endregion
|
|
116
138
|
//#region mods/auto-mode/contract/message-origins.d.ts
|
|
117
139
|
declare const MESSAGE_ORIGINS: readonly ['composer', 'bridge', 'sdk'];
|
|
@@ -210,16 +232,23 @@ interface ActionOutcome {
|
|
|
210
232
|
};
|
|
211
233
|
readonly escalation?: boolean;
|
|
212
234
|
}
|
|
213
|
-
interface ClassifyOptions extends EvaluationOptions {
|
|
235
|
+
interface ClassifyOptions$1 extends EvaluationOptions {
|
|
214
236
|
readonly localOnly?: boolean;
|
|
215
237
|
readonly budget?: boolean;
|
|
216
238
|
readonly actionLog?: boolean;
|
|
217
|
-
readonly stderr
|
|
218
|
-
readonly
|
|
239
|
+
readonly stderr: Readonly<OutputStream>;
|
|
240
|
+
readonly judgeSession?: JudgeSession | undefined;
|
|
219
241
|
}
|
|
220
|
-
export declare function classifyAction(request: ActionRequest, config: Config, options?: ClassifyOptions): Promise<ActionOutcome>;
|
|
221
242
|
//#endregion
|
|
222
243
|
//#region src/request/parse-action-request.d.ts
|
|
223
244
|
export declare function parseActionRequest(body: unknown): ParsedActionRequest | null;
|
|
224
245
|
//#endregion
|
|
225
|
-
|
|
246
|
+
//#region src/index.d.ts
|
|
247
|
+
export interface ClassifyOptions extends Omit<ClassifyOptions$1, 'runtime' | 'stderr'> {
|
|
248
|
+
readonly runtime?: Readonly<Runtime> | undefined;
|
|
249
|
+
readonly stderr?: Readonly<OutputStream> | undefined;
|
|
250
|
+
}
|
|
251
|
+
export declare function classifyAction(request: ActionRequest, config: Config, options?: Readonly<ClassifyOptions>): Promise<ActionOutcome>;
|
|
252
|
+
export declare function loadConfig(configPath?: string, host?: Readonly<HostEnvironment>): Promise<Config>;
|
|
253
|
+
//#endregion
|
|
254
|
+
export type { ActionOutcome, ActionRequest, Config, Verdict };
|
package/dist/index.js
CHANGED
|
@@ -1,2 +1,14 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import { b as loadConfig$1, i as classifyAction$1, n as readRuntime, r as readHostEnvironment, t as parseActionRequest } from "./parse-action-request-neI2tNwd.js";
|
|
2
|
+
//#region src/index.ts
|
|
3
|
+
function classifyAction(request, config, options = {}) {
|
|
4
|
+
return classifyAction$1(request, config, {
|
|
5
|
+
...options,
|
|
6
|
+
runtime: options.runtime ?? readRuntime(),
|
|
7
|
+
stderr: options.stderr ?? process.stderr
|
|
8
|
+
});
|
|
9
|
+
}
|
|
10
|
+
function loadConfig(configPath, host = readHostEnvironment()) {
|
|
11
|
+
return loadConfig$1(configPath, host);
|
|
12
|
+
}
|
|
13
|
+
//#endregion
|
|
2
14
|
export { classifyAction, loadConfig, parseActionRequest };
|