auto-mode 0.21.0 → 1.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.
@@ -0,0 +1,11 @@
1
+ import { expect, test } from 'bun:test';
2
+ import { CLI_LIMITS } from './cli-limits.ts';
3
+
4
+ test('it stops the run after startup, three key commands, Jev and two judge calls at their limits', () => {
5
+ expect(CLI_LIMITS).toStrictEqual({
6
+ keyCommandMs: 5000,
7
+ jevMs: 5000,
8
+ judgeMs: 120_000,
9
+ evaluationMs: 5000 + 3 * 5000 + 5000 + 120_000 + 120_000,
10
+ });
11
+ });
@@ -0,0 +1,17 @@
1
+ const KEY_COMMAND_MS = 5000;
2
+ const JEV_MS = 5000;
3
+ const JUDGE_MS = 120_000;
4
+
5
+ // Node start, the config and scope reads, and the action log, none of which
6
+ // waits on the network.
7
+ const STARTUP_MS = 5000;
8
+
9
+ // The CLI stops each step of one `run` at its limit. The worst case runs Jev
10
+ // and the judge twice, on a named containment deny and on Jev's deny, each
11
+ // after its own key command.
12
+ export const CLI_LIMITS = {
13
+ keyCommandMs: KEY_COMMAND_MS,
14
+ jevMs: JEV_MS,
15
+ judgeMs: JUDGE_MS,
16
+ evaluationMs: STARTUP_MS + 3 * KEY_COMMAND_MS + JEV_MS + 2 * JUDGE_MS,
17
+ } as const;
@@ -1,3 +1,4 @@
1
+ import { CLI_LIMITS } from '../contract/cli-limits.ts';
1
2
  import type { ModScopeRecord } from '../contract/types.ts';
2
3
  import { buildActionRequest } from './build-action-request.ts';
3
4
  import { buildPromptContext } from './build-prompt-context.ts';
@@ -10,10 +11,6 @@ import type { ModOn, ModOptions, PromptContext } from './types.ts';
10
11
  // bounds at 5 seconds.
11
12
  const RECORD_TIMEOUT_MS = 8000;
12
13
 
13
- // Claude Code's own limit for one subprocess. The hook's budget stands still
14
- // while the subprocess runs, and the CLI bounds Jev and the judge by its config.
15
- const EVALUATION_TIMEOUT_MS = 600_000;
16
-
17
14
  export function register(on: ModOn, options: ModOptions): void {
18
15
  let sessionID: string | null = null;
19
16
 
@@ -156,7 +153,7 @@ export function register(on: ModOn, options: ModOptions): void {
156
153
  }
157
154
 
158
155
  const command = typeof options.command === 'string' ? options.command : 'auto-mode';
159
- const childTimeoutMs = EVALUATION_TIMEOUT_MS;
156
+ const childTimeoutMs = CLI_LIMITS.evaluationMs;
160
157
  const deadlineAt = Date.now() + childTimeoutMs - 500;
161
158
 
162
159
  $.ui.log(`${logPrefix} evaluator invoked`, { to: 'debug' });
@@ -1,6 +1,5 @@
1
- // Ambient modules cannot use relative import declarations for the host's test API,
2
- // and these signatures copy the host's own, which take a RegExp and a class.
3
- /* oxlint-disable typescript/consistent-type-imports, typescript/prefer-readonly-parameter-types */
1
+ // Ambient modules cannot use relative import declarations for the host's test API.
2
+ /* oxlint-disable typescript/consistent-type-imports */
4
3
  declare module 'claude-code/testing' {
5
4
  interface AsymmetricMatcher {
6
5
  readonly text: string;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "auto-mode",
3
- "version": "0.21.0",
3
+ "version": "1.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",
@@ -37,8 +37,7 @@
37
37
  "./eval": {
38
38
  "auto-mode-eval": "./src/eval/index.ts"
39
39
  },
40
- "./policy/classifier.md": "./policy/classifier.md",
41
- "./policy/rules.md": "./policy/rules.md"
40
+ "./secret-rules.json": "./dist/secret-rules.json"
42
41
  },
43
42
  "scripts": {
44
43
  "audit": "bun audit",