auto-mode 2.0.0 → 2.0.2

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/index.d.ts CHANGED
@@ -39,6 +39,14 @@ interface JudgeDiagnostics {
39
39
  readonly elapsedMs: number;
40
40
  }
41
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
42
50
  //#region src/types.d.ts
43
51
  type DecidingStage = 'local' | 'containment' | 'bypass' | 'jev' | 'judge' | 'retry' | 'budget';
44
52
  interface DecisionRule {
@@ -65,6 +73,13 @@ interface HostEnvironment {
65
73
  readonly home: string;
66
74
  readonly scratchPaths?: readonly string[] | undefined;
67
75
  }
76
+ interface Runtime {
77
+ readonly host: Readonly<HostEnvironment>;
78
+ readonly now: () => number;
79
+ readonly timeout: (timeoutMs: number) => AbortSignal;
80
+ readonly fetch: (url: string, init: Readonly<RequestInit>) => Promise<Response>;
81
+ readonly findCheckout: CheckoutFinder;
82
+ }
68
83
  interface ClaudeRules {
69
84
  readonly environment: readonly string[];
70
85
  readonly allow: readonly string[];
@@ -80,9 +95,7 @@ interface EvaluationOptions {
80
95
  readonly deadlineAt?: number | undefined;
81
96
  readonly signal?: Readonly<AbortSignal> | undefined;
82
97
  readonly taskScope?: TaskScopeSummary | undefined;
83
- readonly host?: Readonly<HostEnvironment> | undefined;
84
- readonly now?: (() => number) | undefined;
85
- readonly timeout?: ((ms: number) => AbortSignal) | undefined;
98
+ readonly runtime: Readonly<Runtime>;
86
99
  }
87
100
  //#endregion
88
101
  //#region src/config/config.d.ts
@@ -104,7 +117,7 @@ type ScopeSourceKind = (typeof SCOPE_SOURCE_KINDS)[number];
104
117
  declare const SCOPE_SOURCE_KINDS: readonly ['cwd', 'session', 'globs', 'atc'];
105
118
  interface CaptureConfig {
106
119
  readonly enabled: boolean;
107
- readonly dir?: string | undefined;
120
+ readonly directory?: string | undefined;
108
121
  }
109
122
  interface Config {
110
123
  readonly provider: ProviderConfig;
@@ -121,15 +134,6 @@ interface Config {
121
134
  readonly capture?: CaptureConfig;
122
135
  readonly warnings?: readonly string[];
123
136
  }
124
- export declare function loadConfig(configPath?: string, host?: Readonly<HostEnvironment>): Promise<Config>;
125
- //#endregion
126
- //#region src/git/types.d.ts
127
- interface Checkout {
128
- readonly worktree: string;
129
- readonly gitDir: string;
130
- readonly commonDir: string;
131
- }
132
- type CheckoutFinder = (start: string, env: HostEnvironment['env']) => Promise<Checkout | null>;
133
137
  //#endregion
134
138
  //#region mods/auto-mode/contract/message-origins.d.ts
135
139
  declare const MESSAGE_ORIGINS: readonly ['composer', 'bridge', 'sdk'];
@@ -228,17 +232,23 @@ interface ActionOutcome {
228
232
  };
229
233
  readonly escalation?: boolean;
230
234
  }
231
- interface ClassifyOptions extends EvaluationOptions {
235
+ interface ClassifyOptions$1 extends EvaluationOptions {
232
236
  readonly localOnly?: boolean;
233
237
  readonly budget?: boolean;
234
238
  readonly actionLog?: boolean;
235
- readonly stderr?: Readonly<OutputStream> | undefined;
236
- readonly findCheckout?: CheckoutFinder | undefined;
239
+ readonly stderr: Readonly<OutputStream>;
237
240
  readonly judgeSession?: JudgeSession | undefined;
238
241
  }
239
- export declare function classifyAction(request: ActionRequest, config: Config, options?: ClassifyOptions): Promise<ActionOutcome>;
240
242
  //#endregion
241
243
  //#region src/request/parse-action-request.d.ts
242
244
  export declare function parseActionRequest(body: unknown): ParsedActionRequest | null;
243
245
  //#endregion
244
- export type { ActionOutcome, ActionRequest, ClassifyOptions, Config, Verdict };
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 { n as classifyAction, t as parseActionRequest, y as loadConfig } from "./parse-action-request-DtReuNOc.js";
1
+ import { b as loadConfig$1, i as classifyAction$1, n as readRuntime, r as readHostEnvironment, t as parseActionRequest } from "./parse-action-request-CPpuEqFq.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 };