auto-mode 2.0.2 → 3.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-C-CQMndB.js → classify-edit-B660kX2I.js} +74 -72
- package/dist/cli.js +98 -98
- package/dist/{get-edit-fields-BtAvHIsq.js → find-edit-fields-CzkhPA4j.js} +3 -3
- package/dist/index.d.ts +2 -2
- package/dist/index.js +1 -1
- package/dist/{parse-action-request-CPpuEqFq.js → parse-action-request-CaQy7FA3.js} +1175 -406
- package/dist/{start-judge-server-D-zcMyFZ.js → start-judge-server-BlhDO_4A.js} +18 -18
- package/dist/start-judge-session-B-KYQG13.js +1 -0
- package/dist/{start-judge-session-DX3Oek85.js → start-judge-session-vxiG-kDp.js} +39 -39
- package/package.json +8 -7
- package/policy/judge.md +2 -0
- package/dist/start-judge-session-DOkwKT_N.js +0 -1
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { d as string, s as number, u as strictObject } from "./schemas-B_w83Dze.js";
|
|
2
|
-
import { t as startJudgeSession } from "./start-judge-session-
|
|
2
|
+
import { t as startJudgeSession } from "./start-judge-session-vxiG-kDp.js";
|
|
3
3
|
import { randomBytes } from "node:crypto";
|
|
4
4
|
import { chmod, mkdir, rename, rm, stat } from "node:fs/promises";
|
|
5
5
|
import { dirname, join } from "node:path";
|
|
@@ -68,20 +68,6 @@ async function startJudgeServer(options) {
|
|
|
68
68
|
stop
|
|
69
69
|
};
|
|
70
70
|
}
|
|
71
|
-
async function removeOwnSocket(socketPath, ino, onRemoved) {
|
|
72
|
-
const current = await stat(socketPath).catch(() => null);
|
|
73
|
-
if (ino !== null && current?.ino === ino) await rm(socketPath, { force: true });
|
|
74
|
-
onRemoved();
|
|
75
|
-
}
|
|
76
|
-
function startListening(server, socketPath) {
|
|
77
|
-
return new Promise((resolve, reject) => {
|
|
78
|
-
server.once("error", reject);
|
|
79
|
-
server.listen(socketPath, () => {
|
|
80
|
-
server.off("error", reject);
|
|
81
|
-
resolve();
|
|
82
|
-
});
|
|
83
|
-
});
|
|
84
|
-
}
|
|
85
71
|
function isAnswering(socketPath) {
|
|
86
72
|
return new Promise((resolve) => {
|
|
87
73
|
const probe = connect(socketPath);
|
|
@@ -94,6 +80,11 @@ function isAnswering(socketPath) {
|
|
|
94
80
|
});
|
|
95
81
|
});
|
|
96
82
|
}
|
|
83
|
+
async function removeOwnSocket(socketPath, ino, onRemoved) {
|
|
84
|
+
const current = await stat(socketPath).catch(() => null);
|
|
85
|
+
if (ino !== null && current?.ino === ino) await rm(socketPath, { force: true });
|
|
86
|
+
onRemoved();
|
|
87
|
+
}
|
|
97
88
|
const MAX_REQUEST_BYTES = 4194304;
|
|
98
89
|
async function runReview(socket, session) {
|
|
99
90
|
const controller = new AbortController();
|
|
@@ -155,9 +146,6 @@ function readLine(socket, maxBytes) {
|
|
|
155
146
|
socket.once("close", stopReading);
|
|
156
147
|
});
|
|
157
148
|
}
|
|
158
|
-
function writeResponse(socket, response) {
|
|
159
|
-
if (!socket.destroyed) socket.end(`${JSON.stringify(response)}\n`);
|
|
160
|
-
}
|
|
161
149
|
function parseJSON(text) {
|
|
162
150
|
try {
|
|
163
151
|
return JSON.parse(text);
|
|
@@ -165,5 +153,17 @@ function parseJSON(text) {
|
|
|
165
153
|
return null;
|
|
166
154
|
}
|
|
167
155
|
}
|
|
156
|
+
function writeResponse(socket, response) {
|
|
157
|
+
if (!socket.destroyed) socket.end(`${JSON.stringify(response)}\n`);
|
|
158
|
+
}
|
|
159
|
+
function startListening(server, socketPath) {
|
|
160
|
+
return new Promise((resolve, reject) => {
|
|
161
|
+
server.once("error", reject);
|
|
162
|
+
server.listen(socketPath, () => {
|
|
163
|
+
server.off("error", reject);
|
|
164
|
+
resolve();
|
|
165
|
+
});
|
|
166
|
+
});
|
|
167
|
+
}
|
|
168
168
|
//#endregion
|
|
169
169
|
export { startJudgeServer };
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export { t as startJudgeSession } from "./start-judge-session-vxiG-kDp.js";
|
|
@@ -37795,8 +37795,8 @@ function cWe(e, t) {
|
|
|
37795
37795
|
}), ST(n, e, o, i), n;
|
|
37796
37796
|
}
|
|
37797
37797
|
//#endregion
|
|
37798
|
-
//#region src/process/
|
|
37799
|
-
function
|
|
37798
|
+
//#region src/process/resolve-executable.ts
|
|
37799
|
+
function resolveExecutable(name, path) {
|
|
37800
37800
|
for (const directory of (path ?? "").split(delimiter)) {
|
|
37801
37801
|
if (directory === "" || !isAbsolute(directory)) continue;
|
|
37802
37802
|
const candidate = join(directory, name);
|
|
@@ -37897,37 +37897,10 @@ function startJudgeSession(env) {
|
|
|
37897
37897
|
stop
|
|
37898
37898
|
};
|
|
37899
37899
|
}
|
|
37900
|
-
function waitUnlessAborted(previous, signal) {
|
|
37901
|
-
return new Promise((resolve, reject) => {
|
|
37902
|
-
const onAbort = () => {
|
|
37903
|
-
reject(new DOMException("Judge review aborted", "AbortError"));
|
|
37904
|
-
};
|
|
37905
|
-
if (signal.aborted) {
|
|
37906
|
-
onAbort();
|
|
37907
|
-
return;
|
|
37908
|
-
}
|
|
37909
|
-
signal.addEventListener("abort", onAbort, { once: true });
|
|
37910
|
-
waitThenRelease(previous, () => {
|
|
37911
|
-
signal.removeEventListener("abort", onAbort);
|
|
37912
|
-
resolve();
|
|
37913
|
-
});
|
|
37914
|
-
});
|
|
37915
|
-
}
|
|
37916
|
-
async function waitThenRelease(previous, release) {
|
|
37917
|
-
await previous;
|
|
37918
|
-
release();
|
|
37919
|
-
}
|
|
37920
|
-
async function sendClear(send, stop) {
|
|
37921
|
-
try {
|
|
37922
|
-
await send("/clear");
|
|
37923
|
-
} catch {
|
|
37924
|
-
stop();
|
|
37925
|
-
}
|
|
37926
|
-
}
|
|
37927
37900
|
const MAX_LINE_BYTES = 1048576;
|
|
37928
37901
|
function startLiveProcess(model, system, key, env) {
|
|
37929
37902
|
const input = makeInputChannel();
|
|
37930
|
-
const executable =
|
|
37903
|
+
const executable = resolveExecutable("claude", env["PATH"]);
|
|
37931
37904
|
let waiter = null;
|
|
37932
37905
|
let closed = false;
|
|
37933
37906
|
if (executable === null) throw new Error("claude is not on the PATH");
|
|
@@ -38001,12 +37974,6 @@ function startLiveProcess(model, system, key, env) {
|
|
|
38001
37974
|
})
|
|
38002
37975
|
};
|
|
38003
37976
|
}
|
|
38004
|
-
async function readMessages(stream, onMessage, onEnd) {
|
|
38005
|
-
try {
|
|
38006
|
-
for await (const message of stream) onMessage(message);
|
|
38007
|
-
} catch {}
|
|
38008
|
-
onEnd();
|
|
38009
|
-
}
|
|
38010
37977
|
function makeInputChannel() {
|
|
38011
37978
|
const pending = [];
|
|
38012
37979
|
let wake = null;
|
|
@@ -38053,14 +38020,27 @@ async function* readPending(reader) {
|
|
|
38053
38020
|
await reader.waitForPush();
|
|
38054
38021
|
}
|
|
38055
38022
|
}
|
|
38056
|
-
function buildChildEnv(env) {
|
|
38057
|
-
return Object.fromEntries(Object.entries(env).filter(([name]) => !name.startsWith("ANTHROPIC_") && !PROVIDER_SWITCHES.has(name)));
|
|
38058
|
-
}
|
|
38059
38023
|
const PROVIDER_SWITCHES = /* @__PURE__ */ new Set([
|
|
38060
38024
|
"CLAUDE_CODE_USE_BEDROCK",
|
|
38061
38025
|
"CLAUDE_CODE_USE_VERTEX",
|
|
38062
38026
|
"CLAUDE_CODE_USE_FOUNDRY"
|
|
38063
38027
|
]);
|
|
38028
|
+
function buildChildEnv(env) {
|
|
38029
|
+
return Object.fromEntries(Object.entries(env).filter(([name]) => !name.startsWith("ANTHROPIC_") && !PROVIDER_SWITCHES.has(name)));
|
|
38030
|
+
}
|
|
38031
|
+
async function readMessages(stream, onMessage, onEnd) {
|
|
38032
|
+
try {
|
|
38033
|
+
for await (const message of stream) onMessage(message);
|
|
38034
|
+
} catch {}
|
|
38035
|
+
onEnd();
|
|
38036
|
+
}
|
|
38037
|
+
async function sendClear(send, stop) {
|
|
38038
|
+
try {
|
|
38039
|
+
await send("/clear");
|
|
38040
|
+
} catch {
|
|
38041
|
+
stop();
|
|
38042
|
+
}
|
|
38043
|
+
}
|
|
38064
38044
|
const MODEL_USAGE = record(string(), object({ outputTokens: number() }));
|
|
38065
38045
|
const SAFETY_STOPS = object({ safety_stops: number() });
|
|
38066
38046
|
function buildReply(result, fallbacks, requested, warm) {
|
|
@@ -38084,5 +38064,25 @@ function isFallbackReply(usage, stops) {
|
|
|
38084
38064
|
const entries = Object.values(usage ?? {});
|
|
38085
38065
|
return entries.some((entry) => entry.outputTokens === 0) && entries.some((entry) => entry.outputTokens > 0);
|
|
38086
38066
|
}
|
|
38067
|
+
function waitUnlessAborted(previous, signal) {
|
|
38068
|
+
return new Promise((resolve, reject) => {
|
|
38069
|
+
const onAbort = () => {
|
|
38070
|
+
reject(new DOMException("Judge review aborted", "AbortError"));
|
|
38071
|
+
};
|
|
38072
|
+
if (signal.aborted) {
|
|
38073
|
+
onAbort();
|
|
38074
|
+
return;
|
|
38075
|
+
}
|
|
38076
|
+
signal.addEventListener("abort", onAbort, { once: true });
|
|
38077
|
+
waitThenRelease(previous, () => {
|
|
38078
|
+
signal.removeEventListener("abort", onAbort);
|
|
38079
|
+
resolve();
|
|
38080
|
+
});
|
|
38081
|
+
});
|
|
38082
|
+
}
|
|
38083
|
+
async function waitThenRelease(previous, release) {
|
|
38084
|
+
await previous;
|
|
38085
|
+
release();
|
|
38086
|
+
}
|
|
38087
38087
|
//#endregion
|
|
38088
38088
|
export { startJudgeSession as t };
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "auto-mode",
|
|
3
|
-
"version": "
|
|
3
|
+
"version": "3.0.1",
|
|
4
4
|
"description": "A permission classifier library and Claude Code mod, so agents that are not Claude can run unattended",
|
|
5
5
|
"keywords": [
|
|
6
6
|
"agent",
|
|
@@ -64,10 +64,10 @@
|
|
|
64
64
|
"prepare": "bash scripts/link-evals-package.sh && (command -v git > /dev/null 2>&1 && lefthook install --force || true)",
|
|
65
65
|
"publint": "publint",
|
|
66
66
|
"test": "bun run build && bun --no-env-file test --conditions=auto-mode-eval",
|
|
67
|
-
"typecheck": "
|
|
67
|
+
"typecheck": "tsrs -p tsconfig.json --noEmit && tsrs -p evals/tsconfig.json --noEmit",
|
|
68
68
|
"check:artifact": "bun --no-env-file scripts/check-artifact.ts",
|
|
69
69
|
"check:claude-mod": "bun --no-env-file scripts/check-claude-mod.ts",
|
|
70
|
-
"files:branch": "bun scripts/
|
|
70
|
+
"files:branch": "bun scripts/read-branch-files.ts",
|
|
71
71
|
"lint:files": "oxlint --no-error-on-unmatched-pattern",
|
|
72
72
|
"test:related": "bun scripts/run-related-tests.ts"
|
|
73
73
|
},
|
|
@@ -79,10 +79,10 @@
|
|
|
79
79
|
"@tsconfig/strictest": "2.0.8",
|
|
80
80
|
"@types/bun": "1.4.2",
|
|
81
81
|
"@types/node": "26.6.5",
|
|
82
|
-
"@zgeoff/bun-test-extended": "0.2.
|
|
83
|
-
"@zgeoff/format-codemod": "0.
|
|
84
|
-
"@zgeoff/oxlint-config": "0.
|
|
85
|
-
"@zgeoff/skill-gate": "0.
|
|
82
|
+
"@zgeoff/bun-test-extended": "0.2.1",
|
|
83
|
+
"@zgeoff/format-codemod": "0.3.1",
|
|
84
|
+
"@zgeoff/oxlint-config": "0.6.1",
|
|
85
|
+
"@zgeoff/skill-gate": "0.2.4",
|
|
86
86
|
"gunshi": "1.0.0-rc.1",
|
|
87
87
|
"knip": "6.41.0",
|
|
88
88
|
"lefthook": "2.2.1",
|
|
@@ -96,6 +96,7 @@
|
|
|
96
96
|
"tiny-invariant": "1.3.3",
|
|
97
97
|
"ts-pattern": "5.9.0",
|
|
98
98
|
"tsdown": "0.23.1",
|
|
99
|
+
"tsrs": "0.18.0-ts7.1.0-dev.20260929",
|
|
99
100
|
"typescript": "7.0.2",
|
|
100
101
|
"zod": "4.6.6"
|
|
101
102
|
},
|
package/policy/judge.md
CHANGED
|
@@ -25,6 +25,8 @@ When neither reason clearly holds, confirm.
|
|
|
25
25
|
|
|
26
26
|
Always confirm a HARD BLOCK rule and a configured hard deny entry. Consent never clears one, and you cannot overturn one; your task for these is the reason only.
|
|
27
27
|
|
|
28
|
+
One exception applies only to a deny whose own evidence holds `"misreadMayClear": true`, which only a HARD BLOCK rule can hold. You may overturn that deny with the basis `misread` when the facts show that the action cannot cause the harm its rule describes and that no other rule covers the action. Otherwise confirm it. This exception changes nothing for any other deny.
|
|
29
|
+
|
|
28
30
|
Confirm a SOFT BLOCK rule when the last direct user message is missing, when it does not name both the operation and the target, and when the action reaches past what it names.
|
|
29
31
|
|
|
30
32
|
## The reason
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
export { t as startJudgeSession } from "./start-judge-session-DX3Oek85.js";
|