steroids-cli 0.15.10 → 0.16.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/commands/sections-delete.d.ts +3 -0
- package/dist/commands/sections-delete.d.ts.map +1 -0
- package/dist/commands/sections-delete.js +96 -0
- package/dist/commands/sections-delete.js.map +1 -0
- package/dist/commands/sections.d.ts.map +1 -1
- package/dist/commands/sections.js +7 -0
- package/dist/commands/sections.js.map +1 -1
- package/dist/commands/tasks-reset.d.ts +1 -0
- package/dist/commands/tasks-reset.d.ts.map +1 -1
- package/dist/commands/tasks-reset.js +65 -0
- package/dist/commands/tasks-reset.js.map +1 -1
- package/dist/commands/tasks.d.ts.map +1 -1
- package/dist/commands/tasks.js +4 -0
- package/dist/commands/tasks.js.map +1 -1
- package/dist/database/queries.d.ts +13 -0
- package/dist/database/queries.d.ts.map +1 -1
- package/dist/database/queries.js +42 -0
- package/dist/database/queries.js.map +1 -1
- package/dist/monitor/loop.d.ts.map +1 -1
- package/dist/monitor/loop.js +7 -1
- package/dist/monitor/loop.js.map +1 -1
- package/dist/providers/claude.d.ts.map +1 -1
- package/dist/providers/claude.js +5 -23
- package/dist/providers/claude.js.map +1 -1
- package/dist/providers/interface.d.ts +17 -213
- package/dist/providers/interface.d.ts.map +1 -1
- package/dist/providers/interface.js +44 -32
- package/dist/providers/interface.js.map +1 -1
- package/dist/providers/provider-types.d.ts +114 -0
- package/dist/providers/provider-types.d.ts.map +1 -0
- package/dist/providers/provider-types.js +18 -0
- package/dist/providers/provider-types.js.map +1 -0
- package/package.json +1 -1
|
@@ -1,209 +1,6 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
*/
|
|
5
|
-
/**
|
|
6
|
-
* Options for invoking an AI provider
|
|
7
|
-
*/
|
|
8
|
-
export interface InvokeOptions {
|
|
9
|
-
/** Model identifier (e.g., 'claude-sonnet-4', 'gpt-4') */
|
|
10
|
-
model: string;
|
|
11
|
-
/** Timeout in milliseconds (default: 900000 = 15 minutes) */
|
|
12
|
-
timeout?: number;
|
|
13
|
-
/** Working directory for the invocation */
|
|
14
|
-
cwd?: string;
|
|
15
|
-
/** Path to prompt file (alternative to inline prompt) */
|
|
16
|
-
promptFile?: string;
|
|
17
|
-
/** Role for this invocation (orchestrator, coder, reviewer) */
|
|
18
|
-
role?: 'orchestrator' | 'coder' | 'reviewer';
|
|
19
|
-
/** Custom invocation template (e.g., "claude -p {prompt_file} --model {model}") */
|
|
20
|
-
invocationTemplate?: string;
|
|
21
|
-
/** Whether to stream output to stdout/stderr */
|
|
22
|
-
streamOutput?: boolean;
|
|
23
|
-
/**
|
|
24
|
-
* Optional activity callback for live monitoring.
|
|
25
|
-
* Providers should emit lightweight JSON-serializable events as work progresses.
|
|
26
|
-
*/
|
|
27
|
-
onActivity?: (activity: InvocationActivity) => void;
|
|
28
|
-
/** Resume a previous session instead of starting fresh */
|
|
29
|
-
resumeSessionId?: string;
|
|
30
|
-
}
|
|
31
|
-
/**
|
|
32
|
-
* Activity entry emitted during a provider invocation.
|
|
33
|
-
* Kept intentionally flexible (JSONL logger appends arbitrary fields).
|
|
34
|
-
*/
|
|
35
|
-
export type InvocationActivity = Record<string, unknown> & {
|
|
36
|
-
type: string;
|
|
37
|
-
};
|
|
38
|
-
/**
|
|
39
|
-
* Token usage information
|
|
40
|
-
*/
|
|
41
|
-
export interface TokenUsage {
|
|
42
|
-
/** Total input tokens */
|
|
43
|
-
inputTokens: number;
|
|
44
|
-
/** Total output tokens */
|
|
45
|
-
outputTokens: number;
|
|
46
|
-
/** Subset served from server-side cache (Codex, Gemini) */
|
|
47
|
-
cachedInputTokens?: number;
|
|
48
|
-
/** Tokens served from cache (Claude) */
|
|
49
|
-
cacheReadTokens?: number;
|
|
50
|
-
/** Tokens written to cache (Claude) */
|
|
51
|
-
cacheCreationTokens?: number;
|
|
52
|
-
/** Total cost for the invocation (Claude, Vibe) */
|
|
53
|
-
totalCostUsd?: number;
|
|
54
|
-
}
|
|
55
|
-
/**
|
|
56
|
-
* Error thrown when a provider fails to resume a session (e.g., session not found on disk/server)
|
|
57
|
-
*/
|
|
58
|
-
export declare class SessionNotFoundError extends Error {
|
|
59
|
-
constructor(message: string);
|
|
60
|
-
}
|
|
61
|
-
/**
|
|
62
|
-
* Result of an AI provider invocation
|
|
63
|
-
*/
|
|
64
|
-
export interface InvokeResult {
|
|
65
|
-
/** Whether the invocation succeeded (exit code 0) */
|
|
66
|
-
success: boolean;
|
|
67
|
-
/** Exit code from the CLI process */
|
|
68
|
-
exitCode: number;
|
|
69
|
-
/** Standard output from the process */
|
|
70
|
-
stdout: string;
|
|
71
|
-
/** Standard error from the process */
|
|
72
|
-
stderr: string;
|
|
73
|
-
/** Duration in milliseconds */
|
|
74
|
-
duration: number;
|
|
75
|
-
/** Whether the process was killed due to timeout */
|
|
76
|
-
timedOut: boolean;
|
|
77
|
-
/** Session ID from the provider CLI (if available) */
|
|
78
|
-
sessionId?: string;
|
|
79
|
-
/** Token usage statistics (if available) */
|
|
80
|
-
tokenUsage?: TokenUsage;
|
|
81
|
-
}
|
|
82
|
-
/**
|
|
83
|
-
* Error types that can be classified from provider output
|
|
84
|
-
*/
|
|
85
|
-
export type ProviderErrorType = 'rate_limit' | 'auth_error' | 'network_error' | 'model_not_found' | 'context_exceeded' | 'credit_exhaustion' | 'model_capability_error' | 'subprocess_hung' | 'safety_violation' | 'policy_violation' | 'invalid_prompt' | 'unknown';
|
|
86
|
-
/**
|
|
87
|
-
* Classified error from provider invocation
|
|
88
|
-
*/
|
|
89
|
-
export interface ProviderError {
|
|
90
|
-
/** Type of error */
|
|
91
|
-
type: ProviderErrorType;
|
|
92
|
-
/** Human-readable error message */
|
|
93
|
-
message: string;
|
|
94
|
-
/** Whether this error is retryable */
|
|
95
|
-
retryable: boolean;
|
|
96
|
-
/** Suggested retry delay in milliseconds */
|
|
97
|
-
retryAfterMs?: number;
|
|
98
|
-
}
|
|
99
|
-
/**
|
|
100
|
-
* Model information
|
|
101
|
-
*/
|
|
102
|
-
export interface ModelInfo {
|
|
103
|
-
/** Model identifier used for invocation */
|
|
104
|
-
id: string;
|
|
105
|
-
/** Human-readable name */
|
|
106
|
-
name: string;
|
|
107
|
-
/** Recommended role for this model */
|
|
108
|
-
recommendedFor?: ('orchestrator' | 'coder' | 'reviewer')[];
|
|
109
|
-
/** Whether this model supports streaming */
|
|
110
|
-
supportsStreaming?: boolean;
|
|
111
|
-
/** Maximum context window size in tokens */
|
|
112
|
-
contextWindow?: number;
|
|
113
|
-
}
|
|
114
|
-
/**
|
|
115
|
-
* AI Provider interface
|
|
116
|
-
* All providers must implement this interface
|
|
117
|
-
*/
|
|
118
|
-
export interface IAIProvider {
|
|
119
|
-
/** Provider name (e.g., 'claude', 'gemini', 'codex') */
|
|
120
|
-
readonly name: string;
|
|
121
|
-
/** Human-readable display name */
|
|
122
|
-
readonly displayName: string;
|
|
123
|
-
/**
|
|
124
|
-
* Invoke the provider with a prompt
|
|
125
|
-
* @param prompt The prompt text to send
|
|
126
|
-
* @param options Invocation options
|
|
127
|
-
* @returns Promise resolving to the invocation result
|
|
128
|
-
*/
|
|
129
|
-
invoke(prompt: string, options: InvokeOptions): Promise<InvokeResult>;
|
|
130
|
-
/**
|
|
131
|
-
* Resume a previous session with a new prompt
|
|
132
|
-
* @param sessionId The ID of the session to resume
|
|
133
|
-
* @param prompt The prompt text to send
|
|
134
|
-
* @param options Invocation options
|
|
135
|
-
* @returns Promise resolving to the invocation result
|
|
136
|
-
*/
|
|
137
|
-
resume(sessionId: string, prompt: string, options: InvokeOptions): Promise<InvokeResult>;
|
|
138
|
-
/**
|
|
139
|
-
* Initialize the provider (e.g., fetch dynamic models)
|
|
140
|
-
* @returns Promise resolving when initialization is complete
|
|
141
|
-
*/
|
|
142
|
-
initialize?(): Promise<void>;
|
|
143
|
-
/**
|
|
144
|
-
* Check if this provider is available (CLI installed and accessible)
|
|
145
|
-
* @returns Promise resolving to true if available
|
|
146
|
-
*/
|
|
147
|
-
isAvailable(): Promise<boolean>;
|
|
148
|
-
/**
|
|
149
|
-
* List available models for this provider
|
|
150
|
-
* @returns Array of model identifiers
|
|
151
|
-
*/
|
|
152
|
-
listModels(): string[];
|
|
153
|
-
/**
|
|
154
|
-
* Get detailed model information
|
|
155
|
-
* @returns Array of model info objects
|
|
156
|
-
*/
|
|
157
|
-
getModelInfo(): ModelInfo[];
|
|
158
|
-
/**
|
|
159
|
-
* Get the default model for a role
|
|
160
|
-
* @param role The role to get default model for
|
|
161
|
-
* @returns Default model ID or undefined
|
|
162
|
-
*/
|
|
163
|
-
getDefaultModel(role: 'orchestrator' | 'coder' | 'reviewer'): string | undefined;
|
|
164
|
-
/**
|
|
165
|
-
* Classify an error from stderr output
|
|
166
|
-
* @param exitCode The process exit code
|
|
167
|
-
* @param stderr The stderr output
|
|
168
|
-
* @returns Classified error or null if not an error
|
|
169
|
-
*/
|
|
170
|
-
classifyError(exitCode: number, stderr: string): ProviderError | null;
|
|
171
|
-
/**
|
|
172
|
-
* Classify a full invocation result, checking both stderr and stdout
|
|
173
|
-
* @param result The full invocation result
|
|
174
|
-
* @returns Classified error or null if successful
|
|
175
|
-
*/
|
|
176
|
-
classifyResult(result: InvokeResult): ProviderError | null;
|
|
177
|
-
/**
|
|
178
|
-
* Get the CLI path for this provider
|
|
179
|
-
* @returns Path to CLI executable or undefined if using default
|
|
180
|
-
*/
|
|
181
|
-
getCliPath(): string | undefined;
|
|
182
|
-
/**
|
|
183
|
-
* Set a custom CLI path
|
|
184
|
-
* @param path Path to CLI executable
|
|
185
|
-
*/
|
|
186
|
-
setCliPath(path: string): void;
|
|
187
|
-
/**
|
|
188
|
-
* Get the default invocation template
|
|
189
|
-
* @returns Default template with {prompt_file} and {model} placeholders
|
|
190
|
-
*/
|
|
191
|
-
getDefaultInvocationTemplate(): string;
|
|
192
|
-
/**
|
|
193
|
-
* Set a custom invocation template
|
|
194
|
-
* @param template Custom template with {prompt_file} and {model} placeholders
|
|
195
|
-
*/
|
|
196
|
-
setInvocationTemplate(template: string): void;
|
|
197
|
-
/**
|
|
198
|
-
* Get the current invocation template
|
|
199
|
-
* @returns Current template (custom or default)
|
|
200
|
-
*/
|
|
201
|
-
getInvocationTemplate(): string;
|
|
202
|
-
}
|
|
203
|
-
/**
|
|
204
|
-
* Base abstract class for AI providers
|
|
205
|
-
* Provides common functionality
|
|
206
|
-
*/
|
|
1
|
+
export type { InvokeOptions, InvocationActivity, TokenUsage, InvokeResult, ProviderErrorType, ProviderError, ModelInfo, IAIProvider, } from './provider-types.js';
|
|
2
|
+
export { SessionNotFoundError } from './provider-types.js';
|
|
3
|
+
import type { InvokeOptions, InvokeResult, ProviderError, ModelInfo, IAIProvider } from './provider-types.js';
|
|
207
4
|
export declare abstract class BaseAIProvider implements IAIProvider {
|
|
208
5
|
abstract readonly name: string;
|
|
209
6
|
abstract readonly displayName: string;
|
|
@@ -259,14 +56,21 @@ export declare abstract class BaseAIProvider implements IAIProvider {
|
|
|
259
56
|
*/
|
|
260
57
|
protected getSanitizedCliEnv(overrides?: NodeJS.ProcessEnv): NodeJS.ProcessEnv;
|
|
261
58
|
/**
|
|
262
|
-
* Set up
|
|
263
|
-
*
|
|
59
|
+
* Set up a minimal isolated home directory for a provider CLI.
|
|
60
|
+
*
|
|
61
|
+
* Only used by providers that store session state locally and need isolation
|
|
62
|
+
* between parallel invocations (Gemini, Codex). Providers that don't write
|
|
63
|
+
* local session state (Claude with -p flag, Mistral via VIBE_HOME) should
|
|
64
|
+
* NOT use this — they should run with the real HOME or a targeted env var.
|
|
65
|
+
*
|
|
66
|
+
* Creates a minimal dir with:
|
|
67
|
+
* - an isolated providerDir containing only auth-file symlinks
|
|
68
|
+
* - symlinks for .gitconfig, .ssh, and any extra rootFiles
|
|
264
69
|
*
|
|
265
|
-
* @param providerDir
|
|
266
|
-
* @param authFiles
|
|
267
|
-
* @param baseDir Optional pre-existing
|
|
268
|
-
* @param rootFiles
|
|
269
|
-
* @returns Path to the isolated home directory
|
|
70
|
+
* @param providerDir Provider-specific config/state dir (e.g. '.gemini', '.config/gcloud')
|
|
71
|
+
* @param authFiles Auth/config filenames to symlink into the isolated providerDir
|
|
72
|
+
* @param baseDir Optional pre-existing dir to use (e.g. per-project persistent home)
|
|
73
|
+
* @param rootFiles Extra HOME-root files to symlink (e.g. ['.npmrc'])
|
|
270
74
|
*/
|
|
271
75
|
protected setupIsolatedHome(providerDir: string, authFiles: string[], baseDir?: string, rootFiles?: string[]): string;
|
|
272
76
|
}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"interface.d.ts","sourceRoot":"","sources":["../../src/providers/interface.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"interface.d.ts","sourceRoot":"","sources":["../../src/providers/interface.ts"],"names":[],"mappings":"AAMA,YAAY,EACV,aAAa,EACb,kBAAkB,EAClB,UAAU,EACV,YAAY,EACZ,iBAAiB,EACjB,aAAa,EACb,SAAS,EACT,WAAW,GACZ,MAAM,qBAAqB,CAAC;AAC7B,OAAO,EAAE,oBAAoB,EAAE,MAAM,qBAAqB,CAAC;AAE3D,OAAO,KAAK,EACV,aAAa,EAEb,YAAY,EACZ,aAAa,EACb,SAAS,EACT,WAAW,EACZ,MAAM,qBAAqB,CAAC;AAI7B,8BAAsB,cAAe,YAAW,WAAW;IACzD,QAAQ,CAAC,QAAQ,CAAC,IAAI,EAAE,MAAM,CAAC;IAC/B,QAAQ,CAAC,QAAQ,CAAC,WAAW,EAAE,MAAM,CAAC;IAEtC,SAAS,CAAC,OAAO,EAAE,MAAM,GAAG,SAAS,CAAC;IACtC,SAAS,CAAC,kBAAkB,EAAE,MAAM,GAAG,SAAS,CAAC;IAEjD,QAAQ,CAAC,MAAM,CAAC,MAAM,EAAE,MAAM,EAAE,OAAO,EAAE,aAAa,GAAG,OAAO,CAAC,YAAY,CAAC;IAC9E,QAAQ,CAAC,WAAW,IAAI,OAAO,CAAC,OAAO,CAAC;IAExC;;;OAGG;IACG,UAA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5,9 @@ const node_fs_1 = require("node:fs");
|
|
|
5
5
|
const node_os_1 = require("node:os");
|
|
6
6
|
const node_path_1 = require("node:path");
|
|
7
7
|
const node_crypto_1 = require("node:crypto");
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
class SessionNotFoundError extends Error {
|
|
12
|
-
constructor(message) {
|
|
13
|
-
super(message);
|
|
14
|
-
this.name = 'SessionNotFoundError';
|
|
15
|
-
}
|
|
16
|
-
}
|
|
17
|
-
exports.SessionNotFoundError = SessionNotFoundError;
|
|
18
|
-
/**
|
|
19
|
-
* Base abstract class for AI providers
|
|
20
|
-
* Provides common functionality
|
|
21
|
-
*/
|
|
8
|
+
var provider_types_js_1 = require("./provider-types.js");
|
|
9
|
+
Object.defineProperty(exports, "SessionNotFoundError", { enumerable: true, get: function () { return provider_types_js_1.SessionNotFoundError; } });
|
|
10
|
+
// Re-export SessionNotFoundError is handled above via named export.
|
|
22
11
|
class BaseAIProvider {
|
|
23
12
|
cliPath;
|
|
24
13
|
invocationTemplate;
|
|
@@ -276,6 +265,20 @@ class BaseAIProvider {
|
|
|
276
265
|
env.PATH = [...realBinDirs, currentPath].join(':');
|
|
277
266
|
}
|
|
278
267
|
}
|
|
268
|
+
// Prevent git from invoking the macOS Keychain credential helper inside isolated
|
|
269
|
+
// home dirs. The real .gitconfig is symlinked in (so git finds it), but its
|
|
270
|
+
// credential.helper = osxkeychain setting causes macOS to show "Keychain Not
|
|
271
|
+
// Found" dialogs when the spawned process has no keychain session (e.g. when
|
|
272
|
+
// launched from launchd as a detached child). Override via git env vars so the
|
|
273
|
+
// helper is disabled for all child processes without touching the real gitconfig.
|
|
274
|
+
if (overrides?.HOME && overrides.HOME !== (0, node_os_1.homedir)()) {
|
|
275
|
+
env.GIT_TERMINAL_PROMPT = '0';
|
|
276
|
+
// GIT_CONFIG_COUNT/KEY/VALUE overrides take precedence over all gitconfig files
|
|
277
|
+
const existingCount = parseInt(env.GIT_CONFIG_COUNT ?? '0', 10);
|
|
278
|
+
env.GIT_CONFIG_COUNT = String(existingCount + 1);
|
|
279
|
+
env[`GIT_CONFIG_KEY_${existingCount}`] = 'credential.helper';
|
|
280
|
+
env[`GIT_CONFIG_VALUE_${existingCount}`] = '';
|
|
281
|
+
}
|
|
279
282
|
// Cap Node.js heap for child processes to prevent runaway memory consumption.
|
|
280
283
|
// Provider CLIs (Codex, Claude) spawn sub-processes (pnpm, tsc, etc.) that
|
|
281
284
|
// can each balloon to GBs and trigger massive macOS swap on constrained systems.
|
|
@@ -296,23 +299,32 @@ class BaseAIProvider {
|
|
|
296
299
|
return { ...env, ...cleanOverrides };
|
|
297
300
|
}
|
|
298
301
|
/**
|
|
299
|
-
* Set up
|
|
300
|
-
* Copies/symlinks essential auth files from the real home to the isolated one.
|
|
302
|
+
* Set up a minimal isolated home directory for a provider CLI.
|
|
301
303
|
*
|
|
302
|
-
*
|
|
303
|
-
*
|
|
304
|
-
*
|
|
305
|
-
*
|
|
306
|
-
*
|
|
304
|
+
* Only used by providers that store session state locally and need isolation
|
|
305
|
+
* between parallel invocations (Gemini, Codex). Providers that don't write
|
|
306
|
+
* local session state (Claude with -p flag, Mistral via VIBE_HOME) should
|
|
307
|
+
* NOT use this — they should run with the real HOME or a targeted env var.
|
|
308
|
+
*
|
|
309
|
+
* Creates a minimal dir with:
|
|
310
|
+
* - an isolated providerDir containing only auth-file symlinks
|
|
311
|
+
* - symlinks for .gitconfig, .ssh, and any extra rootFiles
|
|
312
|
+
*
|
|
313
|
+
* @param providerDir Provider-specific config/state dir (e.g. '.gemini', '.config/gcloud')
|
|
314
|
+
* @param authFiles Auth/config filenames to symlink into the isolated providerDir
|
|
315
|
+
* @param baseDir Optional pre-existing dir to use (e.g. per-project persistent home)
|
|
316
|
+
* @param rootFiles Extra HOME-root files to symlink (e.g. ['.npmrc'])
|
|
307
317
|
*/
|
|
308
318
|
setupIsolatedHome(providerDir, authFiles, baseDir, rootFiles) {
|
|
309
319
|
const uuid = (0, node_crypto_1.randomUUID)();
|
|
310
320
|
const isolatedHome = baseDir ?? (0, node_path_1.join)((0, node_os_1.tmpdir)(), `steroids-${this.name}-${uuid}`);
|
|
321
|
+
const realHome = (0, node_os_1.homedir)();
|
|
311
322
|
try {
|
|
312
323
|
if (!baseDir) {
|
|
313
324
|
(0, node_fs_1.mkdirSync)(isolatedHome, { recursive: true });
|
|
314
325
|
}
|
|
315
|
-
|
|
326
|
+
// Create isolated provider dir with auth-file symlinks
|
|
327
|
+
const realProviderPath = (0, node_path_1.join)(realHome, providerDir);
|
|
316
328
|
const isolatedProviderPath = (0, node_path_1.join)(isolatedHome, providerDir);
|
|
317
329
|
if ((0, node_fs_1.existsSync)(realProviderPath)) {
|
|
318
330
|
(0, node_fs_1.mkdirSync)(isolatedProviderPath, { recursive: true });
|
|
@@ -321,29 +333,29 @@ class BaseAIProvider {
|
|
|
321
333
|
const dest = (0, node_path_1.join)(isolatedProviderPath, file);
|
|
322
334
|
if ((0, node_fs_1.existsSync)(src)) {
|
|
323
335
|
try {
|
|
324
|
-
// Ensure parent directories exist for nested auth files (e.g. configurations/config_default)
|
|
325
336
|
(0, node_fs_1.mkdirSync)((0, node_path_1.dirname)(dest), { recursive: true });
|
|
326
337
|
(0, node_fs_1.symlinkSync)(src, dest);
|
|
327
338
|
}
|
|
328
339
|
catch {
|
|
329
|
-
// Fallback to copy if symlink fails
|
|
330
|
-
|
|
331
|
-
|
|
340
|
+
// Fallback to copy if symlink fails (e.g. cross-device)
|
|
341
|
+
try {
|
|
342
|
+
(0, node_fs_1.mkdirSync)((0, node_path_1.dirname)(dest), { recursive: true });
|
|
343
|
+
(0, node_fs_1.writeFileSync)(dest, (0, node_fs_1.readFileSync)(src));
|
|
344
|
+
}
|
|
345
|
+
catch { /* best effort */ }
|
|
332
346
|
}
|
|
333
347
|
}
|
|
334
348
|
}
|
|
335
349
|
}
|
|
336
|
-
//
|
|
350
|
+
// Essential HOME-root symlinks so git and SSH work from the isolated home
|
|
337
351
|
[...(rootFiles ?? []), '.gitconfig', '.ssh'].forEach(file => {
|
|
338
|
-
const src = (0, node_path_1.join)(
|
|
352
|
+
const src = (0, node_path_1.join)(realHome, file);
|
|
339
353
|
const dest = (0, node_path_1.join)(isolatedHome, file);
|
|
340
|
-
if ((0, node_fs_1.existsSync)(src)) {
|
|
354
|
+
if ((0, node_fs_1.existsSync)(src) && !(0, node_fs_1.existsSync)(dest)) {
|
|
341
355
|
try {
|
|
342
356
|
(0, node_fs_1.symlinkSync)(src, dest);
|
|
343
357
|
}
|
|
344
|
-
catch {
|
|
345
|
-
// Ignore failure for optional system files
|
|
346
|
-
}
|
|
358
|
+
catch { /* best effort */ }
|
|
347
359
|
}
|
|
348
360
|
});
|
|
349
361
|
}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"interface.js","sourceRoot":"","sources":["../../src/providers/interface.ts"],"names":[],"mappings":";;;AAAA,qCAA0F;AAC1F,qCAA0C;AAC1C,yCAA0C;AAC1C,6CAAyC;
|
|
1
|
+
{"version":3,"file":"interface.js","sourceRoot":"","sources":["../../src/providers/interface.ts"],"names":[],"mappings":";;;AAAA,qCAA0F;AAC1F,qCAA0C;AAC1C,yCAA0C;AAC1C,6CAAyC;AAazC,yDAA2D;AAAlD,yHAAA,oBAAoB,OAAA;AAY7B,oEAAoE;AACpE,MAAsB,cAAc;IAIxB,OAAO,CAAqB;IAC5B,kBAAkB,CAAqB;IAKjD;;;OAGG;IACH,KAAK,CAAC,UAAU;QACd,mBAAmB;IACrB,CAAC;IAED;;OAEG;IACH,KAAK,CAAC,MAAM,CAAC,SAAiB,EAAE,MAAc,EAAE,OAAsB;QACpE,OAAO,IAAI,CAAC,MAAM,CAAC,MAAM,EAAE,EAAE,GAAG,OAAO,EAAE,eAAe,EAAE,SAAS,EAAE,CAAC,CAAC;IACzE,CAAC;IAOD;;;OAGG;IACH,aAAa,CAAC,QAAgB,EAAE,MAAc;QAC5C,IAAI,QAAQ,KAAK,CAAC,EAAE,CAAC;YACn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ives in interface.ts (BaseAIProvider).
|
|
4
|
+
*/
|
|
5
|
+
export interface InvokeOptions {
|
|
6
|
+
/** Model identifier (e.g., 'claude-sonnet-4', 'gpt-4') */
|
|
7
|
+
model: string;
|
|
8
|
+
/** Timeout in milliseconds (default: 900000 = 15 minutes) */
|
|
9
|
+
timeout?: number;
|
|
10
|
+
/** Working directory for the invocation */
|
|
11
|
+
cwd?: string;
|
|
12
|
+
/** Path to prompt file (alternative to inline prompt) */
|
|
13
|
+
promptFile?: string;
|
|
14
|
+
/** Role for this invocation (orchestrator, coder, reviewer) */
|
|
15
|
+
role?: 'orchestrator' | 'coder' | 'reviewer';
|
|
16
|
+
/** Custom invocation template (e.g., "claude -p {prompt_file} --model {model}") */
|
|
17
|
+
invocationTemplate?: string;
|
|
18
|
+
/** Whether to stream output to stdout/stderr */
|
|
19
|
+
streamOutput?: boolean;
|
|
20
|
+
/**
|
|
21
|
+
* Optional activity callback for live monitoring.
|
|
22
|
+
* Providers should emit lightweight JSON-serializable events as work progresses.
|
|
23
|
+
*/
|
|
24
|
+
onActivity?: (activity: InvocationActivity) => void;
|
|
25
|
+
/** Resume a previous session instead of starting fresh */
|
|
26
|
+
resumeSessionId?: string;
|
|
27
|
+
}
|
|
28
|
+
/**
|
|
29
|
+
* Activity entry emitted during a provider invocation.
|
|
30
|
+
* Kept intentionally flexible (JSONL logger appends arbitrary fields).
|
|
31
|
+
*/
|
|
32
|
+
export type InvocationActivity = Record<string, unknown> & {
|
|
33
|
+
type: string;
|
|
34
|
+
};
|
|
35
|
+
export interface TokenUsage {
|
|
36
|
+
/** Total input tokens */
|
|
37
|
+
inputTokens: number;
|
|
38
|
+
/** Total output tokens */
|
|
39
|
+
outputTokens: number;
|
|
40
|
+
/** Subset served from server-side cache (Codex, Gemini) */
|
|
41
|
+
cachedInputTokens?: number;
|
|
42
|
+
/** Tokens served from cache (Claude) */
|
|
43
|
+
cacheReadTokens?: number;
|
|
44
|
+
/** Tokens written to cache (Claude) */
|
|
45
|
+
cacheCreationTokens?: number;
|
|
46
|
+
/** Total cost for the invocation (Claude, Vibe) */
|
|
47
|
+
totalCostUsd?: number;
|
|
48
|
+
}
|
|
49
|
+
/**
|
|
50
|
+
* Error thrown when a provider fails to resume a session (e.g., session not found on disk/server)
|
|
51
|
+
*/
|
|
52
|
+
export declare class SessionNotFoundError extends Error {
|
|
53
|
+
constructor(message: string);
|
|
54
|
+
}
|
|
55
|
+
export interface InvokeResult {
|
|
56
|
+
/** Whether the invocation succeeded (exit code 0) */
|
|
57
|
+
success: boolean;
|
|
58
|
+
/** Exit code from the CLI process */
|
|
59
|
+
exitCode: number;
|
|
60
|
+
/** Standard output from the process */
|
|
61
|
+
stdout: string;
|
|
62
|
+
/** Standard error from the process */
|
|
63
|
+
stderr: string;
|
|
64
|
+
/** Duration in milliseconds */
|
|
65
|
+
duration: number;
|
|
66
|
+
/** Whether the process was killed due to timeout */
|
|
67
|
+
timedOut: boolean;
|
|
68
|
+
/** Session ID from the provider CLI (if available) */
|
|
69
|
+
sessionId?: string;
|
|
70
|
+
/** Token usage statistics (if available) */
|
|
71
|
+
tokenUsage?: TokenUsage;
|
|
72
|
+
}
|
|
73
|
+
export type ProviderErrorType = 'rate_limit' | 'auth_error' | 'network_error' | 'model_not_found' | 'context_exceeded' | 'credit_exhaustion' | 'model_capability_error' | 'subprocess_hung' | 'safety_violation' | 'policy_violation' | 'invalid_prompt' | 'unknown';
|
|
74
|
+
export interface ProviderError {
|
|
75
|
+
/** Type of error */
|
|
76
|
+
type: ProviderErrorType;
|
|
77
|
+
/** Human-readable error message */
|
|
78
|
+
message: string;
|
|
79
|
+
/** Whether this error is retryable */
|
|
80
|
+
retryable: boolean;
|
|
81
|
+
/** Suggested retry delay in milliseconds */
|
|
82
|
+
retryAfterMs?: number;
|
|
83
|
+
}
|
|
84
|
+
export interface ModelInfo {
|
|
85
|
+
/** Model identifier used for invocation */
|
|
86
|
+
id: string;
|
|
87
|
+
/** Human-readable name */
|
|
88
|
+
name: string;
|
|
89
|
+
/** Recommended role for this model */
|
|
90
|
+
recommendedFor?: ('orchestrator' | 'coder' | 'reviewer')[];
|
|
91
|
+
/** Whether this model supports streaming */
|
|
92
|
+
supportsStreaming?: boolean;
|
|
93
|
+
/** Maximum context window size in tokens */
|
|
94
|
+
contextWindow?: number;
|
|
95
|
+
}
|
|
96
|
+
export interface IAIProvider {
|
|
97
|
+
readonly name: string;
|
|
98
|
+
readonly displayName: string;
|
|
99
|
+
invoke(prompt: string, options: InvokeOptions): Promise<InvokeResult>;
|
|
100
|
+
resume(sessionId: string, prompt: string, options: InvokeOptions): Promise<InvokeResult>;
|
|
101
|
+
initialize?(): Promise<void>;
|
|
102
|
+
isAvailable(): Promise<boolean>;
|
|
103
|
+
listModels(): string[];
|
|
104
|
+
getModelInfo(): ModelInfo[];
|
|
105
|
+
getDefaultModel(role: 'orchestrator' | 'coder' | 'reviewer'): string | undefined;
|
|
106
|
+
classifyError(exitCode: number, stderr: string): ProviderError | null;
|
|
107
|
+
classifyResult(result: InvokeResult): ProviderError | null;
|
|
108
|
+
getCliPath(): string | undefined;
|
|
109
|
+
setCliPath(path: string): void;
|
|
110
|
+
getDefaultInvocationTemplate(): string;
|
|
111
|
+
setInvocationTemplate(template: string): void;
|
|
112
|
+
getInvocationTemplate(): string;
|
|
113
|
+
}
|
|
114
|
+
//# sourceMappingURL=provider-types.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"provider-types.d.ts","sourceRoot":"","sources":["../../src/providers/provider-types.ts"],"names":[],"mappings":"AAAA;;;GAGG;AAEH,MAAM,WAAW,aAAa;IAC5B,0DAA0D;IAC1D,KAAK,EAAE,MAAM,CAAC;IACd,6DAA6D;IAC7D,OAAO,CAAC,EAAE,MAAM,CAAC;IACjB,2CAA2C;IAC3C,GAAG,CAAC,EAAE,MAAM,CAAC;IACb,yDAAyD;IACzD,UAAU,CAAC,EAAE,MAAM,CAAC;IACpB,+DAA+D;IAC/D,IAAI,CA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CAAC;IAC5B,eAAe,CAAC,IAAI,EAAE,cAAc,GAAG,OAAO,GAAG,UAAU,GAAG,MAAM,GAAG,SAAS,CAAC;IACjF,aAAa,CAAC,QAAQ,EAAE,MAAM,EAAE,MAAM,EAAE,MAAM,GAAG,aAAa,GAAG,IAAI,CAAC;IACtE,cAAc,CAAC,MAAM,EAAE,YAAY,GAAG,aAAa,GAAG,IAAI,CAAC;IAC3D,UAAU,IAAI,MAAM,GAAG,SAAS,CAAC;IACjC,UAAU,CAAC,IAAI,EAAE,MAAM,GAAG,IAAI,CAAC;IAC/B,4BAA4B,IAAI,MAAM,CAAC;IACvC,qBAAqB,CAAC,QAAQ,EAAE,MAAM,GAAG,IAAI,CAAC;IAC9C,qBAAqB,IAAI,MAAM,CAAC;CACjC"}
|
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
/**
|
|
3
|
+
* Shared types and interfaces for AI providers.
|
|
4
|
+
* Implementation lives in interface.ts (BaseAIProvider).
|
|
5
|
+
*/
|
|
6
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
7
|
+
exports.SessionNotFoundError = void 0;
|
|
8
|
+
/**
|
|
9
|
+
* Error thrown when a provider fails to resume a session (e.g., session not found on disk/server)
|
|
10
|
+
*/
|
|
11
|
+
class SessionNotFoundError extends Error {
|
|
12
|
+
constructor(message) {
|
|
13
|
+
super(message);
|
|
14
|
+
this.name = 'SessionNotFoundError';
|
|
15
|
+
}
|
|
16
|
+
}
|
|
17
|
+
exports.SessionNotFoundError = SessionNotFoundError;
|
|
18
|
+
//# sourceMappingURL=provider-types.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"provider-types.js","sourceRoot":"","sources":["../../src/providers/provider-types.ts"],"names":[],"mappings":";AAAA;;;GAGG;;;AA+CH;;GAEG;AACH,MAAa,oBAAqB,SAAQ,KAAK;IAC7C,YAAY,OAAe;QACzB,KAAK,CAAC,OAAO,CAAC,CAAC;QACf,IAAI,CAAC,IAAI,GAAG,sBAAsB,CAAC;IACrC,CAAC;CACF;AALD,oDAKC"}
|