auto-mode 2.0.1 → 3.0.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-DXP7XLGH.js → classify-edit-B660kX2I.js} +78 -76
- package/dist/cli.js +107 -107
- package/dist/{get-edit-fields-BtAvHIsq.js → find-edit-fields-CzkhPA4j.js} +3 -3
- package/dist/index.d.ts +4 -4
- package/dist/index.js +1 -1
- package/dist/{parse-action-request-neI2tNwd.js → parse-action-request-C55m5DlM.js} +362 -356
- package/dist/{schemas-Dc2424NY.js → schemas-B_w83Dze.js} +95 -48
- package/dist/{start-judge-server-CCSZbTwM.js → start-judge-server-BlhDO_4A.js} +19 -19
- package/dist/start-judge-session-B-KYQG13.js +1 -0
- package/dist/{start-judge-session-DjPX0007.js → start-judge-session-vxiG-kDp.js} +9284 -9152
- package/mods/auto-mode/hooks/register.ts +33 -33
- package/mods/auto-mode/hooks/testing.d.ts +3 -3
- package/package.json +19 -19
- package/dist/start-judge-session-B_DFN8Ji.js +0 -2
|
@@ -19,58 +19,58 @@ export function register(on: ModOn, options: ModOptions): void {
|
|
|
19
19
|
|
|
20
20
|
let prompts: PromptContext = buildPromptContext(null, { source: 'reload' });
|
|
21
21
|
|
|
22
|
-
on('classic.SessionStart', (_api,
|
|
23
|
-
if (
|
|
24
|
-
const isCompact =
|
|
22
|
+
on('classic.SessionStart', (_api, event, next) => {
|
|
23
|
+
if (event.agent_id === undefined) {
|
|
24
|
+
const isCompact = event.source === 'compact' && sessionID === event.session_id;
|
|
25
25
|
|
|
26
|
-
sessionID =
|
|
26
|
+
sessionID = event.session_id;
|
|
27
27
|
|
|
28
28
|
const previousPrompts = isCompact ? prompts : null;
|
|
29
29
|
|
|
30
|
-
prompts = buildPromptContext(previousPrompts, { source:
|
|
30
|
+
prompts = buildPromptContext(previousPrompts, { source: event.source ?? 'unknown' });
|
|
31
31
|
|
|
32
32
|
if (!isCompact) {
|
|
33
33
|
delegatedTasks.clear();
|
|
34
34
|
}
|
|
35
35
|
}
|
|
36
36
|
|
|
37
|
-
return next(
|
|
37
|
+
return next(event);
|
|
38
38
|
});
|
|
39
39
|
|
|
40
|
-
on('classic.UserPromptSubmit', (_api,
|
|
41
|
-
if (
|
|
42
|
-
sessionID =
|
|
40
|
+
on('classic.UserPromptSubmit', (_api, event, next) => {
|
|
41
|
+
if (event.agent_id === undefined) {
|
|
42
|
+
sessionID = event.session_id;
|
|
43
43
|
}
|
|
44
44
|
|
|
45
|
-
return next(
|
|
45
|
+
return next(event);
|
|
46
46
|
});
|
|
47
47
|
|
|
48
|
-
on('prompt.submit', (_api,
|
|
49
|
-
prompts = buildPromptContext(prompts,
|
|
48
|
+
on('prompt.submit', (_api, event, next) => {
|
|
49
|
+
prompts = buildPromptContext(prompts, event);
|
|
50
50
|
|
|
51
|
-
return next(
|
|
51
|
+
return next(event);
|
|
52
52
|
});
|
|
53
53
|
|
|
54
|
-
on('agent.spawn', async (_api,
|
|
55
|
-
const result = await next(
|
|
54
|
+
on('agent.spawn', async (_api, event, next) => {
|
|
55
|
+
const result = await next(event);
|
|
56
56
|
|
|
57
57
|
if (result.agentId !== undefined && !delegatedTasks.has(result.agentId)) {
|
|
58
|
-
delegatedTasks.set(result.agentId,
|
|
58
|
+
delegatedTasks.set(result.agentId, event.prompt);
|
|
59
59
|
}
|
|
60
60
|
|
|
61
61
|
return result;
|
|
62
62
|
});
|
|
63
63
|
|
|
64
|
-
on('tool.call', async ($,
|
|
65
|
-
if (
|
|
66
|
-
return next(
|
|
64
|
+
on('tool.call', async ($, event, next) => {
|
|
65
|
+
if (event.tool_use_id === undefined) {
|
|
66
|
+
return next(event);
|
|
67
67
|
}
|
|
68
68
|
|
|
69
|
-
activeCalls.set(
|
|
69
|
+
activeCalls.set(event.tool_use_id, event.agentId ?? null);
|
|
70
70
|
|
|
71
71
|
const command =
|
|
72
|
-
|
|
73
|
-
?
|
|
72
|
+
event.tool === 'Bash' && typeof event.command === 'string' && isScopeCommand(event.command)
|
|
73
|
+
? event.command
|
|
74
74
|
: null;
|
|
75
75
|
|
|
76
76
|
const startedAt = Date.now();
|
|
@@ -78,9 +78,9 @@ export function register(on: ModOn, options: ModOptions): void {
|
|
|
78
78
|
let result;
|
|
79
79
|
|
|
80
80
|
try {
|
|
81
|
-
result = await next(
|
|
81
|
+
result = await next(event);
|
|
82
82
|
} finally {
|
|
83
|
-
activeCalls.delete(
|
|
83
|
+
activeCalls.delete(event.tool_use_id);
|
|
84
84
|
}
|
|
85
85
|
|
|
86
86
|
if (command !== null && cwd !== null && sessionID !== null && result.deny === undefined) {
|
|
@@ -107,12 +107,12 @@ export function register(on: ModOn, options: ModOptions): void {
|
|
|
107
107
|
return result;
|
|
108
108
|
});
|
|
109
109
|
|
|
110
|
-
on('tool.check', async ($,
|
|
111
|
-
const decided = await next(
|
|
110
|
+
on('tool.check', async ($, event, next) => {
|
|
111
|
+
const decided = await next(event);
|
|
112
112
|
|
|
113
113
|
const actionID =
|
|
114
|
-
|
|
115
|
-
?
|
|
114
|
+
event.tool_use_id !== undefined && /^call_[\da-f]{24,32}$/u.test(event.tool_use_id)
|
|
115
|
+
? event.tool_use_id
|
|
116
116
|
: 'unavailable';
|
|
117
117
|
|
|
118
118
|
const logPrefix = `auto-mode action ${actionID}:`;
|
|
@@ -138,7 +138,7 @@ export function register(on: ModOn, options: ModOptions): void {
|
|
|
138
138
|
try {
|
|
139
139
|
const cwd = await $.session.cwd();
|
|
140
140
|
|
|
141
|
-
const agentID =
|
|
141
|
+
const agentID = event.tool_use_id === undefined ? null : activeCalls.get(event.tool_use_id);
|
|
142
142
|
|
|
143
143
|
if (agentID === undefined) {
|
|
144
144
|
$.ui.log(`${logPrefix} evaluation skipped; untracked tool call`, { to: 'debug' });
|
|
@@ -146,7 +146,7 @@ export function register(on: ModOn, options: ModOptions): void {
|
|
|
146
146
|
return decided;
|
|
147
147
|
}
|
|
148
148
|
|
|
149
|
-
if (!isToolInput(
|
|
149
|
+
if (!isToolInput(event.input)) {
|
|
150
150
|
$.ui.log(`${logPrefix} evaluation skipped; tool input is not an object`, { to: 'debug' });
|
|
151
151
|
|
|
152
152
|
return decided;
|
|
@@ -160,10 +160,10 @@ export function register(on: ModOn, options: ModOptions): void {
|
|
|
160
160
|
|
|
161
161
|
const request = buildActionRequest({
|
|
162
162
|
sessionID,
|
|
163
|
-
toolUseID:
|
|
163
|
+
toolUseID: event.tool_use_id,
|
|
164
164
|
cwd,
|
|
165
|
-
toolName:
|
|
166
|
-
toolInput:
|
|
165
|
+
toolName: event.tool,
|
|
166
|
+
toolInput: event.input,
|
|
167
167
|
agentID,
|
|
168
168
|
delegatedText: agentID === null ? undefined : delegatedTasks.get(agentID),
|
|
169
169
|
prompts,
|
|
@@ -57,10 +57,10 @@ declare module 'claude-code/testing' {
|
|
|
57
57
|
|
|
58
58
|
interface MockClock {
|
|
59
59
|
readonly now: () => number;
|
|
60
|
-
readonly advance: (
|
|
61
|
-
readonly set: (
|
|
60
|
+
readonly advance: (durationMs: number) => Promise<void>;
|
|
61
|
+
readonly set: (epochMs: number) => Promise<void>;
|
|
62
62
|
readonly settle: () => Promise<void>;
|
|
63
|
-
readonly sleep: (
|
|
63
|
+
readonly sleep: (durationMs: number) => Promise<void>;
|
|
64
64
|
}
|
|
65
65
|
|
|
66
66
|
interface MockClockOptions {
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "auto-mode",
|
|
3
|
-
"version": "
|
|
3
|
+
"version": "3.0.0",
|
|
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",
|
|
@@ -53,7 +53,6 @@
|
|
|
53
53
|
"eval:relay-consent": "bun --no-env-file --conditions=auto-mode-eval evals/runners/run-relay-consent-evaluation.ts",
|
|
54
54
|
"eval:second-judge": "bun --no-env-file --conditions=auto-mode-eval evals/runners/run-second-judge-evaluation.ts",
|
|
55
55
|
"eval:stale-consent": "bun --no-env-file --conditions=auto-mode-eval evals/runners/run-stale-consent-evaluation.ts",
|
|
56
|
-
"first-publish": "scripts/first-publish.sh",
|
|
57
56
|
"format": "oxfmt . && format-codemod --quiet .",
|
|
58
57
|
"format:check": "oxfmt --check . && format-codemod --check --quiet .",
|
|
59
58
|
"lint": "oxlint",
|
|
@@ -73,37 +72,38 @@
|
|
|
73
72
|
"test:related": "bun scripts/run-related-tests.ts"
|
|
74
73
|
},
|
|
75
74
|
"devDependencies": {
|
|
76
|
-
"@anthropic-ai/claude-agent-sdk": "0.3.
|
|
77
|
-
"@commitlint/cli": "21.2.
|
|
75
|
+
"@anthropic-ai/claude-agent-sdk": "0.3.296",
|
|
76
|
+
"@commitlint/cli": "21.2.3",
|
|
78
77
|
"@faker-js/faker": "10.6.0",
|
|
79
78
|
"@stylistic/eslint-plugin": "5.10.0",
|
|
80
79
|
"@tsconfig/strictest": "2.0.8",
|
|
81
|
-
"@types/bun": "1.
|
|
82
|
-
"@types/node": "26.5
|
|
83
|
-
"@zgeoff/bun-test-extended": "0.2.
|
|
84
|
-
"@zgeoff/format-codemod": "0.
|
|
85
|
-
"@zgeoff/oxlint-config": "0.
|
|
80
|
+
"@types/bun": "1.4.2",
|
|
81
|
+
"@types/node": "26.6.5",
|
|
82
|
+
"@zgeoff/bun-test-extended": "0.2.1",
|
|
83
|
+
"@zgeoff/format-codemod": "0.3.0",
|
|
84
|
+
"@zgeoff/oxlint-config": "0.6.1",
|
|
85
|
+
"@zgeoff/skill-gate": "0.2.2",
|
|
86
86
|
"gunshi": "1.0.0-rc.1",
|
|
87
|
-
"knip": "6.
|
|
88
|
-
"lefthook": "2.1
|
|
87
|
+
"knip": "6.41.0",
|
|
88
|
+
"lefthook": "2.2.1",
|
|
89
89
|
"mitata": "1.0.34",
|
|
90
90
|
"msw": "2.15.0",
|
|
91
|
-
"oxfmt": "0.
|
|
92
|
-
"oxlint": "1.
|
|
93
|
-
"oxlint-tsgolint": "7.0.
|
|
94
|
-
"publint": "0.3.
|
|
91
|
+
"oxfmt": "0.72.0",
|
|
92
|
+
"oxlint": "1.87.0",
|
|
93
|
+
"oxlint-tsgolint": "7.0.2004",
|
|
94
|
+
"publint": "0.3.25",
|
|
95
95
|
"re2js": "2.8.6",
|
|
96
96
|
"tiny-invariant": "1.3.3",
|
|
97
97
|
"ts-pattern": "5.9.0",
|
|
98
|
-
"tsdown": "0.23.
|
|
98
|
+
"tsdown": "0.23.1",
|
|
99
99
|
"typescript": "7.0.2",
|
|
100
|
-
"zod": "4.6.
|
|
100
|
+
"zod": "4.6.6"
|
|
101
101
|
},
|
|
102
102
|
"overrides": {
|
|
103
|
-
"smol-toml": "1.9.
|
|
103
|
+
"smol-toml": "1.9.1"
|
|
104
104
|
},
|
|
105
105
|
"engines": {
|
|
106
106
|
"node": ">=24"
|
|
107
107
|
},
|
|
108
|
-
"packageManager": "bun@1.3
|
|
108
|
+
"packageManager": "bun@1.4.3"
|
|
109
109
|
}
|