auto-mode 0.11.0 → 0.13.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/classify-edit-D8GC6b91.js +17848 -0
- package/dist/cli.js +2 -2
- package/dist/get-edit-fields-BtAvHIsq.js +20 -0
- package/dist/index.d.ts +53 -44
- package/dist/index.js +1 -1
- package/dist/{render-verdict-BiGjYb1x.js → render-verdict-De8aTmg-.js} +591 -463
- package/package.json +2 -1
- package/policy/classifier.md +4 -1
- package/policy/decision.md +1 -1
package/dist/cli.js
CHANGED
|
@@ -1,8 +1,8 @@
|
|
|
1
1
|
#!/usr/bin/env node
|
|
2
|
-
import { D as string, E as strictObject, T as number, _ as
|
|
2
|
+
import { D as string, E as strictObject, T as number, _ as splitCommandWords, a as resolveSessionScopePath, b as DEFAULT_SCOPE_SOURCES, c as findCheckout, f as loadRepositoryContext, g as splitShellCommand, h as toRepositorySlug, i as resolveStateDir, m as loadPolicy, n as parseActionRequest, o as loadSessionScope, p as loadCheckoutRemotes, r as classifyAction, s as EMPTY_SESSION_SCOPE, t as renderVerdict, x as loadConfig, y as DEFAULT_DENIAL_BUDGET } from "./render-verdict-De8aTmg-.js";
|
|
3
3
|
import { appendFile, mkdir, open, readFile, rename, rm, stat, writeFile } from "node:fs/promises";
|
|
4
|
-
import { homedir } from "node:os";
|
|
5
4
|
import { dirname, isAbsolute, join, normalize } from "node:path";
|
|
5
|
+
import { homedir } from "node:os";
|
|
6
6
|
import { spawn } from "node:child_process";
|
|
7
7
|
import { createHash, randomUUID } from "node:crypto";
|
|
8
8
|
import { text } from "node:stream/consumers";
|
|
@@ -0,0 +1,20 @@
|
|
|
1
|
+
//#region src/bypass/get-edit-fields.ts
|
|
2
|
+
const EDIT_FIELDS = {
|
|
3
|
+
Edit: {
|
|
4
|
+
path: "file_path",
|
|
5
|
+
content: "new_string"
|
|
6
|
+
},
|
|
7
|
+
Write: {
|
|
8
|
+
path: "file_path",
|
|
9
|
+
content: "content"
|
|
10
|
+
},
|
|
11
|
+
NotebookEdit: {
|
|
12
|
+
path: "notebook_path",
|
|
13
|
+
content: "new_source"
|
|
14
|
+
}
|
|
15
|
+
};
|
|
16
|
+
function getEditFields(toolName) {
|
|
17
|
+
return EDIT_FIELDS[toolName] ?? null;
|
|
18
|
+
}
|
|
19
|
+
//#endregion
|
|
20
|
+
export { getEditFields as t };
|
package/dist/index.d.ts
CHANGED
|
@@ -4,49 +4,6 @@ interface DenialBudget {
|
|
|
4
4
|
readonly perSession: number;
|
|
5
5
|
}
|
|
6
6
|
//#endregion
|
|
7
|
-
//#region src/config/types.d.ts
|
|
8
|
-
interface EvaluationOptions {
|
|
9
|
-
readonly deadlineAt?: number | undefined;
|
|
10
|
-
readonly signal?: Readonly<AbortSignal> | undefined;
|
|
11
|
-
}
|
|
12
|
-
//#endregion
|
|
13
|
-
//#region src/config/presets.d.ts
|
|
14
|
-
export declare const PRESETS: Readonly<Record<string, ProviderConfig>>;
|
|
15
|
-
//#endregion
|
|
16
|
-
//#region src/config/config.d.ts
|
|
17
|
-
interface ProviderConfig {
|
|
18
|
-
readonly protocol?: 'messages' | 'system-one';
|
|
19
|
-
readonly baseURL: string;
|
|
20
|
-
readonly model: string;
|
|
21
|
-
readonly apiKeyEnv?: string | undefined;
|
|
22
|
-
readonly apiKeyCommand?: string | undefined;
|
|
23
|
-
readonly reasoning: boolean;
|
|
24
|
-
readonly maxTokens: number;
|
|
25
|
-
readonly timeoutMs: number;
|
|
26
|
-
}
|
|
27
|
-
interface ScopeSource {
|
|
28
|
-
readonly kind: ScopeSourceKind;
|
|
29
|
-
readonly paths?: readonly string[];
|
|
30
|
-
}
|
|
31
|
-
type ScopeSourceKind = (typeof SCOPE_SOURCE_KINDS)[number];
|
|
32
|
-
declare const SCOPE_SOURCE_KINDS: readonly ['cwd', 'session', 'globs', 'atc'];
|
|
33
|
-
interface Config {
|
|
34
|
-
readonly provider: ProviderConfig;
|
|
35
|
-
readonly judge?: ProviderConfig | null;
|
|
36
|
-
readonly scopeSources?: Readonly<Record<string, ScopeSource>>;
|
|
37
|
-
readonly classifierPath?: string | undefined;
|
|
38
|
-
readonly rulesPath?: string | undefined;
|
|
39
|
-
readonly onFailure: 'defer' | 'deny';
|
|
40
|
-
readonly claudeSettingsPath?: string | null | undefined;
|
|
41
|
-
readonly minConfidence?: number | undefined;
|
|
42
|
-
readonly denialBudget?: DenialBudget;
|
|
43
|
-
readonly warnings?: readonly string[];
|
|
44
|
-
}
|
|
45
|
-
export declare const DEFAULT_CONFIG: Config;
|
|
46
|
-
export declare function resolveConfigPath(): string;
|
|
47
|
-
export declare function loadConfig(path?: string): Promise<Config>;
|
|
48
|
-
export declare function resolveApiKey(provider: ProviderConfig, options?: EvaluationOptions): Promise<string | null>;
|
|
49
|
-
//#endregion
|
|
50
7
|
//#region src/request/types.d.ts
|
|
51
8
|
interface UserTask {
|
|
52
9
|
readonly text: string;
|
|
@@ -88,6 +45,14 @@ interface DecisionRule {
|
|
|
88
45
|
readonly source: 'shipped' | 'replacement' | 'configured';
|
|
89
46
|
readonly text: string;
|
|
90
47
|
}
|
|
48
|
+
interface TaskScopeSummary {
|
|
49
|
+
readonly worktrees: readonly string[];
|
|
50
|
+
readonly branches: readonly string[];
|
|
51
|
+
readonly pullRequests: readonly {
|
|
52
|
+
readonly repository: string;
|
|
53
|
+
readonly number: number;
|
|
54
|
+
}[];
|
|
55
|
+
}
|
|
91
56
|
interface DecisionAnswer {
|
|
92
57
|
readonly type: 'choice';
|
|
93
58
|
readonly choice: 'allow' | 'block' | 'ask';
|
|
@@ -114,8 +79,52 @@ interface DecisionDiagnostics {
|
|
|
114
79
|
}[];
|
|
115
80
|
}
|
|
116
81
|
//#endregion
|
|
82
|
+
//#region src/config/types.d.ts
|
|
83
|
+
interface EvaluationOptions {
|
|
84
|
+
readonly deadlineAt?: number | undefined;
|
|
85
|
+
readonly signal?: Readonly<AbortSignal> | undefined;
|
|
86
|
+
readonly taskScope?: TaskScopeSummary | undefined;
|
|
87
|
+
}
|
|
88
|
+
//#endregion
|
|
89
|
+
//#region src/config/presets.d.ts
|
|
90
|
+
export declare const PRESETS: Readonly<Record<string, ProviderConfig>>;
|
|
91
|
+
//#endregion
|
|
92
|
+
//#region src/config/config.d.ts
|
|
93
|
+
interface ProviderConfig {
|
|
94
|
+
readonly protocol?: 'messages' | 'system-one';
|
|
95
|
+
readonly baseURL: string;
|
|
96
|
+
readonly model: string;
|
|
97
|
+
readonly apiKeyEnv?: string | undefined;
|
|
98
|
+
readonly apiKeyCommand?: string | undefined;
|
|
99
|
+
readonly reasoning: boolean;
|
|
100
|
+
readonly maxTokens: number;
|
|
101
|
+
readonly timeoutMs: number;
|
|
102
|
+
}
|
|
103
|
+
interface ScopeSource {
|
|
104
|
+
readonly kind: ScopeSourceKind;
|
|
105
|
+
readonly paths?: readonly string[];
|
|
106
|
+
}
|
|
107
|
+
type ScopeSourceKind = (typeof SCOPE_SOURCE_KINDS)[number];
|
|
108
|
+
declare const SCOPE_SOURCE_KINDS: readonly ['cwd', 'session', 'globs', 'atc'];
|
|
109
|
+
interface Config {
|
|
110
|
+
readonly provider: ProviderConfig;
|
|
111
|
+
readonly judge?: ProviderConfig | null;
|
|
112
|
+
readonly scopeSources?: Readonly<Record<string, ScopeSource>>;
|
|
113
|
+
readonly classifierPath?: string | undefined;
|
|
114
|
+
readonly rulesPath?: string | undefined;
|
|
115
|
+
readonly onFailure: 'defer' | 'deny';
|
|
116
|
+
readonly claudeSettingsPath?: string | null | undefined;
|
|
117
|
+
readonly minConfidence?: number | undefined;
|
|
118
|
+
readonly denialBudget?: DenialBudget;
|
|
119
|
+
readonly warnings?: readonly string[];
|
|
120
|
+
}
|
|
121
|
+
export declare const DEFAULT_CONFIG: Config;
|
|
122
|
+
export declare function resolveConfigPath(): string;
|
|
123
|
+
export declare function loadConfig(path?: string): Promise<Config>;
|
|
124
|
+
export declare function resolveApiKey(provider: ProviderConfig, options?: EvaluationOptions): Promise<string | null>;
|
|
125
|
+
//#endregion
|
|
117
126
|
//#region src/classify-action.d.ts
|
|
118
|
-
type DecidingStage = 'local' | 'containment' | 'jev' | 'messages' | 'retry';
|
|
127
|
+
type DecidingStage = 'local' | 'containment' | 'bypass' | 'jev' | 'messages' | 'retry';
|
|
119
128
|
interface ActionOutcome {
|
|
120
129
|
readonly verdict: Verdict | null;
|
|
121
130
|
readonly decidingStage: DecidingStage;
|
package/dist/index.js
CHANGED
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
import { C as resolveConfigPath, S as resolveApiKey,
|
|
1
|
+
import { C as resolveConfigPath, S as resolveApiKey, d as parseModelVerdict, l as classifyLocally, m as loadPolicy, n as parseActionRequest, r as classifyAction, t as renderVerdict, u as classifyWithModel, v as DEFAULT_CONFIG, w as PRESETS, x as loadConfig } from "./render-verdict-De8aTmg-.js";
|
|
2
2
|
export { DEFAULT_CONFIG, PRESETS, classifyAction, classifyLocally, classifyWithModel, loadConfig, loadPolicy, parseActionRequest, parseModelVerdict, renderVerdict, resolveApiKey, resolveConfigPath };
|