steroids-api 0.2.7
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/API/src/index.d.ts +10 -0
- package/dist/API/src/index.d.ts.map +1 -0
- package/dist/API/src/index.js +130 -0
- package/dist/API/src/index.js.map +1 -0
- package/dist/API/src/routes/activity.d.ts +7 -0
- package/dist/API/src/routes/activity.d.ts.map +1 -0
- package/dist/API/src/routes/activity.js +252 -0
- package/dist/API/src/routes/activity.js.map +1 -0
- package/dist/API/src/routes/config.d.ts +7 -0
- package/dist/API/src/routes/config.d.ts.map +1 -0
- package/dist/API/src/routes/config.js +521 -0
- package/dist/API/src/routes/config.js.map +1 -0
- package/dist/API/src/routes/health.d.ts +7 -0
- package/dist/API/src/routes/health.d.ts.map +1 -0
- package/dist/API/src/routes/health.js +172 -0
- package/dist/API/src/routes/health.js.map +1 -0
- package/dist/API/src/routes/incidents.d.ts +7 -0
- package/dist/API/src/routes/incidents.d.ts.map +1 -0
- package/dist/API/src/routes/incidents.js +117 -0
- package/dist/API/src/routes/incidents.js.map +1 -0
- package/dist/API/src/routes/projects.d.ts +7 -0
- package/dist/API/src/routes/projects.d.ts.map +1 -0
- package/dist/API/src/routes/projects.js +398 -0
- package/dist/API/src/routes/projects.js.map +1 -0
- package/dist/API/src/routes/runners.d.ts +7 -0
- package/dist/API/src/routes/runners.d.ts.map +1 -0
- package/dist/API/src/routes/runners.js +242 -0
- package/dist/API/src/routes/runners.js.map +1 -0
- package/dist/API/src/routes/tasks.d.ts +7 -0
- package/dist/API/src/routes/tasks.d.ts.map +1 -0
- package/dist/API/src/routes/tasks.js +1007 -0
- package/dist/API/src/routes/tasks.js.map +1 -0
- package/dist/API/src/utils/validation.d.ts +22 -0
- package/dist/API/src/utils/validation.d.ts.map +1 -0
- package/dist/API/src/utils/validation.js +50 -0
- package/dist/API/src/utils/validation.js.map +1 -0
- package/dist/index.d.ts +10 -0
- package/dist/index.d.ts.map +1 -0
- package/dist/index.js +184 -0
- package/dist/index.js.map +1 -0
- package/dist/routes/activity.d.ts +7 -0
- package/dist/routes/activity.d.ts.map +1 -0
- package/dist/routes/activity.js +252 -0
- package/dist/routes/activity.js.map +1 -0
- package/dist/routes/config.d.ts +7 -0
- package/dist/routes/config.d.ts.map +1 -0
- package/dist/routes/config.js +647 -0
- package/dist/routes/config.js.map +1 -0
- package/dist/routes/credit-alerts.d.ts +2 -0
- package/dist/routes/credit-alerts.d.ts.map +1 -0
- package/dist/routes/credit-alerts.js +97 -0
- package/dist/routes/credit-alerts.js.map +1 -0
- package/dist/routes/health.d.ts +7 -0
- package/dist/routes/health.d.ts.map +1 -0
- package/dist/routes/health.js +200 -0
- package/dist/routes/health.js.map +1 -0
- package/dist/routes/incidents.d.ts +7 -0
- package/dist/routes/incidents.d.ts.map +1 -0
- package/dist/routes/incidents.js +117 -0
- package/dist/routes/incidents.js.map +1 -0
- package/dist/routes/projects.d.ts +7 -0
- package/dist/routes/projects.d.ts.map +1 -0
- package/dist/routes/projects.js +643 -0
- package/dist/routes/projects.js.map +1 -0
- package/dist/routes/runners.d.ts +7 -0
- package/dist/routes/runners.d.ts.map +1 -0
- package/dist/routes/runners.js +299 -0
- package/dist/routes/runners.js.map +1 -0
- package/dist/routes/skills.d.ts +3 -0
- package/dist/routes/skills.d.ts.map +1 -0
- package/dist/routes/skills.js +109 -0
- package/dist/routes/skills.js.map +1 -0
- package/dist/routes/storage.d.ts +7 -0
- package/dist/routes/storage.d.ts.map +1 -0
- package/dist/routes/storage.js +93 -0
- package/dist/routes/storage.js.map +1 -0
- package/dist/routes/tasks.d.ts +7 -0
- package/dist/routes/tasks.d.ts.map +1 -0
- package/dist/routes/tasks.js +1145 -0
- package/dist/routes/tasks.js.map +1 -0
- package/dist/src/cleanup/invocation-logs.d.ts +30 -0
- package/dist/src/cleanup/invocation-logs.d.ts.map +1 -0
- package/dist/src/cleanup/invocation-logs.js +66 -0
- package/dist/src/cleanup/invocation-logs.js.map +1 -0
- package/dist/src/commands/loop-phases.d.ts +11 -0
- package/dist/src/commands/loop-phases.d.ts.map +1 -0
- package/dist/src/commands/loop-phases.js +304 -0
- package/dist/src/commands/loop-phases.js.map +1 -0
- package/dist/src/config/loader.d.ts +160 -0
- package/dist/src/config/loader.d.ts.map +1 -0
- package/dist/src/config/loader.js +276 -0
- package/dist/src/config/loader.js.map +1 -0
- package/dist/src/database/connection.d.ts +35 -0
- package/dist/src/database/connection.d.ts.map +1 -0
- package/dist/src/database/connection.js +197 -0
- package/dist/src/database/connection.js.map +1 -0
- package/dist/src/database/queries.d.ts +220 -0
- package/dist/src/database/queries.d.ts.map +1 -0
- package/dist/src/database/queries.js +589 -0
- package/dist/src/database/queries.js.map +1 -0
- package/dist/src/database/schema.d.ts +8 -0
- package/dist/src/database/schema.d.ts.map +1 -0
- package/dist/src/database/schema.js +184 -0
- package/dist/src/database/schema.js.map +1 -0
- package/dist/src/git/push.d.ts +26 -0
- package/dist/src/git/push.d.ts.map +1 -0
- package/dist/src/git/push.js +91 -0
- package/dist/src/git/push.js.map +1 -0
- package/dist/src/git/status.d.ts +83 -0
- package/dist/src/git/status.d.ts.map +1 -0
- package/dist/src/git/status.js +315 -0
- package/dist/src/git/status.js.map +1 -0
- package/dist/src/health/stuck-task-detector.d.ts +131 -0
- package/dist/src/health/stuck-task-detector.d.ts.map +1 -0
- package/dist/src/health/stuck-task-detector.js +233 -0
- package/dist/src/health/stuck-task-detector.js.map +1 -0
- package/dist/src/health/stuck-task-recovery.d.ts +45 -0
- package/dist/src/health/stuck-task-recovery.d.ts.map +1 -0
- package/dist/src/health/stuck-task-recovery.js +309 -0
- package/dist/src/health/stuck-task-recovery.js.map +1 -0
- package/dist/src/index.d.ts +10 -0
- package/dist/src/index.d.ts.map +1 -0
- package/dist/src/index.js +130 -0
- package/dist/src/index.js.map +1 -0
- package/dist/src/locking/queries.d.ts +116 -0
- package/dist/src/locking/queries.d.ts.map +1 -0
- package/dist/src/locking/queries.js +232 -0
- package/dist/src/locking/queries.js.map +1 -0
- package/dist/src/locking/section-lock.d.ts +74 -0
- package/dist/src/locking/section-lock.d.ts.map +1 -0
- package/dist/src/locking/section-lock.js +196 -0
- package/dist/src/locking/section-lock.js.map +1 -0
- package/dist/src/locking/task-lock.d.ts +92 -0
- package/dist/src/locking/task-lock.d.ts.map +1 -0
- package/dist/src/locking/task-lock.js +233 -0
- package/dist/src/locking/task-lock.js.map +1 -0
- package/dist/src/migrations/index.d.ts +7 -0
- package/dist/src/migrations/index.d.ts.map +1 -0
- package/dist/src/migrations/index.js +9 -0
- package/dist/src/migrations/index.js.map +1 -0
- package/dist/src/migrations/manifest.d.ts +92 -0
- package/dist/src/migrations/manifest.d.ts.map +1 -0
- package/dist/src/migrations/manifest.js +255 -0
- package/dist/src/migrations/manifest.js.map +1 -0
- package/dist/src/migrations/runner.d.ts +84 -0
- package/dist/src/migrations/runner.d.ts.map +1 -0
- package/dist/src/migrations/runner.js +338 -0
- package/dist/src/migrations/runner.js.map +1 -0
- package/dist/src/orchestrator/coder.d.ts +32 -0
- package/dist/src/orchestrator/coder.d.ts.map +1 -0
- package/dist/src/orchestrator/coder.js +170 -0
- package/dist/src/orchestrator/coder.js.map +1 -0
- package/dist/src/orchestrator/coordinator.d.ts +28 -0
- package/dist/src/orchestrator/coordinator.d.ts.map +1 -0
- package/dist/src/orchestrator/coordinator.js +252 -0
- package/dist/src/orchestrator/coordinator.js.map +1 -0
- package/dist/src/orchestrator/fallback-handler.d.ts +24 -0
- package/dist/src/orchestrator/fallback-handler.d.ts.map +1 -0
- package/dist/src/orchestrator/fallback-handler.js +280 -0
- package/dist/src/orchestrator/fallback-handler.js.map +1 -0
- package/dist/src/orchestrator/invoke.d.ts +14 -0
- package/dist/src/orchestrator/invoke.d.ts.map +1 -0
- package/dist/src/orchestrator/invoke.js +76 -0
- package/dist/src/orchestrator/invoke.js.map +1 -0
- package/dist/src/orchestrator/post-coder.d.ts +10 -0
- package/dist/src/orchestrator/post-coder.d.ts.map +1 -0
- package/dist/src/orchestrator/post-coder.js +198 -0
- package/dist/src/orchestrator/post-coder.js.map +1 -0
- package/dist/src/orchestrator/post-reviewer.d.ts +10 -0
- package/dist/src/orchestrator/post-reviewer.d.ts.map +1 -0
- package/dist/src/orchestrator/post-reviewer.js +199 -0
- package/dist/src/orchestrator/post-reviewer.js.map +1 -0
- package/dist/src/orchestrator/reviewer.d.ts +35 -0
- package/dist/src/orchestrator/reviewer.d.ts.map +1 -0
- package/dist/src/orchestrator/reviewer.js +237 -0
- package/dist/src/orchestrator/reviewer.js.map +1 -0
- package/dist/src/orchestrator/schemas.d.ts +10 -0
- package/dist/src/orchestrator/schemas.d.ts.map +1 -0
- package/dist/src/orchestrator/schemas.js +81 -0
- package/dist/src/orchestrator/schemas.js.map +1 -0
- package/dist/src/orchestrator/task-selector.d.ts +102 -0
- package/dist/src/orchestrator/task-selector.d.ts.map +1 -0
- package/dist/src/orchestrator/task-selector.js +326 -0
- package/dist/src/orchestrator/task-selector.js.map +1 -0
- package/dist/src/orchestrator/types.d.ts +74 -0
- package/dist/src/orchestrator/types.d.ts.map +1 -0
- package/dist/src/orchestrator/types.js +5 -0
- package/dist/src/orchestrator/types.js.map +1 -0
- package/dist/src/prompts/coder.d.ts +36 -0
- package/dist/src/prompts/coder.d.ts.map +1 -0
- package/dist/src/prompts/coder.js +303 -0
- package/dist/src/prompts/coder.js.map +1 -0
- package/dist/src/prompts/prompt-helpers.d.ts +51 -0
- package/dist/src/prompts/prompt-helpers.d.ts.map +1 -0
- package/dist/src/prompts/prompt-helpers.js +299 -0
- package/dist/src/prompts/prompt-helpers.js.map +1 -0
- package/dist/src/prompts/reviewer.d.ts +40 -0
- package/dist/src/prompts/reviewer.d.ts.map +1 -0
- package/dist/src/prompts/reviewer.js +416 -0
- package/dist/src/prompts/reviewer.js.map +1 -0
- package/dist/src/providers/claude.d.ts +53 -0
- package/dist/src/providers/claude.d.ts.map +1 -0
- package/dist/src/providers/claude.js +227 -0
- package/dist/src/providers/claude.js.map +1 -0
- package/dist/src/providers/codex.d.ts +53 -0
- package/dist/src/providers/codex.d.ts.map +1 -0
- package/dist/src/providers/codex.js +253 -0
- package/dist/src/providers/codex.js.map +1 -0
- package/dist/src/providers/gemini.d.ts +58 -0
- package/dist/src/providers/gemini.d.ts.map +1 -0
- package/dist/src/providers/gemini.js +240 -0
- package/dist/src/providers/gemini.js.map +1 -0
- package/dist/src/providers/interface.d.ts +185 -0
- package/dist/src/providers/interface.d.ts.map +1 -0
- package/dist/src/providers/interface.js +92 -0
- package/dist/src/providers/interface.js.map +1 -0
- package/dist/src/providers/invocation-logger.d.ts +97 -0
- package/dist/src/providers/invocation-logger.d.ts.map +1 -0
- package/dist/src/providers/invocation-logger.js +378 -0
- package/dist/src/providers/invocation-logger.js.map +1 -0
- package/dist/src/providers/openai.d.ts +53 -0
- package/dist/src/providers/openai.d.ts.map +1 -0
- package/dist/src/providers/openai.js +230 -0
- package/dist/src/providers/openai.js.map +1 -0
- package/dist/src/providers/registry.d.ts +100 -0
- package/dist/src/providers/registry.d.ts.map +1 -0
- package/dist/src/providers/registry.js +170 -0
- package/dist/src/providers/registry.js.map +1 -0
- package/dist/src/routes/activity.d.ts +7 -0
- package/dist/src/routes/activity.d.ts.map +1 -0
- package/dist/src/routes/activity.js +252 -0
- package/dist/src/routes/activity.js.map +1 -0
- package/dist/src/routes/config.d.ts +7 -0
- package/dist/src/routes/config.d.ts.map +1 -0
- package/dist/src/routes/config.js +521 -0
- package/dist/src/routes/config.js.map +1 -0
- package/dist/src/routes/health.d.ts +7 -0
- package/dist/src/routes/health.d.ts.map +1 -0
- package/dist/src/routes/health.js +172 -0
- package/dist/src/routes/health.js.map +1 -0
- package/dist/src/routes/incidents.d.ts +7 -0
- package/dist/src/routes/incidents.d.ts.map +1 -0
- package/dist/src/routes/incidents.js +117 -0
- package/dist/src/routes/incidents.js.map +1 -0
- package/dist/src/routes/projects.d.ts +7 -0
- package/dist/src/routes/projects.d.ts.map +1 -0
- package/dist/src/routes/projects.js +398 -0
- package/dist/src/routes/projects.js.map +1 -0
- package/dist/src/routes/runners.d.ts +7 -0
- package/dist/src/routes/runners.d.ts.map +1 -0
- package/dist/src/routes/runners.js +242 -0
- package/dist/src/routes/runners.js.map +1 -0
- package/dist/src/routes/tasks.d.ts +7 -0
- package/dist/src/routes/tasks.d.ts.map +1 -0
- package/dist/src/routes/tasks.js +1007 -0
- package/dist/src/routes/tasks.js.map +1 -0
- package/dist/src/runners/activity-log.d.ts +65 -0
- package/dist/src/runners/activity-log.d.ts.map +1 -0
- package/dist/src/runners/activity-log.js +140 -0
- package/dist/src/runners/activity-log.js.map +1 -0
- package/dist/src/runners/cron.d.ts +30 -0
- package/dist/src/runners/cron.d.ts.map +1 -0
- package/dist/src/runners/cron.js +333 -0
- package/dist/src/runners/cron.js.map +1 -0
- package/dist/src/runners/daemon.d.ts +71 -0
- package/dist/src/runners/daemon.d.ts.map +1 -0
- package/dist/src/runners/daemon.js +233 -0
- package/dist/src/runners/daemon.js.map +1 -0
- package/dist/src/runners/global-db.d.ts +31 -0
- package/dist/src/runners/global-db.d.ts.map +1 -0
- package/dist/src/runners/global-db.js +220 -0
- package/dist/src/runners/global-db.js.map +1 -0
- package/dist/src/runners/hang-detector.d.ts +38 -0
- package/dist/src/runners/hang-detector.d.ts.map +1 -0
- package/dist/src/runners/hang-detector.js +130 -0
- package/dist/src/runners/hang-detector.js.map +1 -0
- package/dist/src/runners/heartbeat.d.ts +39 -0
- package/dist/src/runners/heartbeat.d.ts.map +1 -0
- package/dist/src/runners/heartbeat.js +71 -0
- package/dist/src/runners/heartbeat.js.map +1 -0
- package/dist/src/runners/lock.d.ts +47 -0
- package/dist/src/runners/lock.d.ts.map +1 -0
- package/dist/src/runners/lock.js +140 -0
- package/dist/src/runners/lock.js.map +1 -0
- package/dist/src/runners/orchestrator-loop.d.ts +20 -0
- package/dist/src/runners/orchestrator-loop.d.ts.map +1 -0
- package/dist/src/runners/orchestrator-loop.js +208 -0
- package/dist/src/runners/orchestrator-loop.js.map +1 -0
- package/dist/src/runners/projects.d.ts +96 -0
- package/dist/src/runners/projects.d.ts.map +1 -0
- package/dist/src/runners/projects.js +243 -0
- package/dist/src/runners/projects.js.map +1 -0
- package/dist/src/runners/wakeup.d.ts +37 -0
- package/dist/src/runners/wakeup.d.ts.map +1 -0
- package/dist/src/runners/wakeup.js +355 -0
- package/dist/src/runners/wakeup.js.map +1 -0
- package/dist/src/utils/validation.d.ts +22 -0
- package/dist/src/utils/validation.d.ts.map +1 -0
- package/dist/src/utils/validation.js +50 -0
- package/dist/src/utils/validation.js.map +1 -0
- package/dist/utils/sqlite.d.ts +17 -0
- package/dist/utils/sqlite.d.ts.map +1 -0
- package/dist/utils/sqlite.js +27 -0
- package/dist/utils/sqlite.js.map +1 -0
- package/dist/utils/storage-cache.d.ts +33 -0
- package/dist/utils/storage-cache.d.ts.map +1 -0
- package/dist/utils/storage-cache.js +81 -0
- package/dist/utils/storage-cache.js.map +1 -0
- package/dist/utils/validation.d.ts +22 -0
- package/dist/utils/validation.d.ts.map +1 -0
- package/dist/utils/validation.js +51 -0
- package/dist/utils/validation.js.map +1 -0
- package/package.json +39 -0
- package/src/index.ts +199 -0
- package/src/routes/activity.ts +302 -0
- package/src/routes/config.ts +723 -0
- package/src/routes/credit-alerts.ts +73 -0
- package/src/routes/health.ts +219 -0
- package/src/routes/incidents.ts +131 -0
- package/src/routes/projects.ts +854 -0
- package/src/routes/runners.ts +357 -0
- package/src/routes/skills.ts +127 -0
- package/src/routes/storage.ts +108 -0
- package/src/routes/tasks.ts +1372 -0
- package/src/utils/sqlite.ts +36 -0
- package/src/utils/storage-cache.ts +107 -0
- package/src/utils/validation.ts +61 -0
- package/tsconfig.json +20 -0
|
@@ -0,0 +1,240 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Gemini Provider
|
|
3
|
+
* Implementation for Google Gemini CLI
|
|
4
|
+
*/
|
|
5
|
+
import { spawn } from 'node:child_process';
|
|
6
|
+
import { writeFileSync, unlinkSync, existsSync } from 'node:fs';
|
|
7
|
+
import { tmpdir } from 'node:os';
|
|
8
|
+
import { join } from 'node:path';
|
|
9
|
+
import { BaseAIProvider, } from './interface.js';
|
|
10
|
+
/**
|
|
11
|
+
* Available Gemini models
|
|
12
|
+
*/
|
|
13
|
+
const GEMINI_MODELS = [
|
|
14
|
+
{
|
|
15
|
+
id: 'gemini-pro',
|
|
16
|
+
name: 'Gemini Pro',
|
|
17
|
+
recommendedFor: ['coder'],
|
|
18
|
+
supportsStreaming: true,
|
|
19
|
+
},
|
|
20
|
+
{
|
|
21
|
+
id: 'gemini-ultra',
|
|
22
|
+
name: 'Gemini Ultra',
|
|
23
|
+
recommendedFor: ['orchestrator', 'reviewer'],
|
|
24
|
+
supportsStreaming: true,
|
|
25
|
+
},
|
|
26
|
+
{
|
|
27
|
+
id: 'gemini-flash',
|
|
28
|
+
name: 'Gemini Flash',
|
|
29
|
+
recommendedFor: [],
|
|
30
|
+
supportsStreaming: true,
|
|
31
|
+
},
|
|
32
|
+
];
|
|
33
|
+
/**
|
|
34
|
+
* Default models per role
|
|
35
|
+
*/
|
|
36
|
+
const DEFAULT_MODELS = {
|
|
37
|
+
orchestrator: 'gemini-ultra',
|
|
38
|
+
coder: 'gemini-pro',
|
|
39
|
+
reviewer: 'gemini-ultra',
|
|
40
|
+
};
|
|
41
|
+
/**
|
|
42
|
+
* Default timeout in milliseconds (15 minutes)
|
|
43
|
+
*/
|
|
44
|
+
const DEFAULT_TIMEOUT = 900_000;
|
|
45
|
+
/**
|
|
46
|
+
* Default invocation template for Gemini CLI
|
|
47
|
+
* Uses -p flag for non-interactive (headless) mode with prompt from file
|
|
48
|
+
*/
|
|
49
|
+
const DEFAULT_INVOCATION_TEMPLATE = '{cli} -p "$(cat {prompt_file})" -m {model}';
|
|
50
|
+
/**
|
|
51
|
+
* Gemini AI Provider implementation
|
|
52
|
+
*/
|
|
53
|
+
export class GeminiProvider extends BaseAIProvider {
|
|
54
|
+
name = 'gemini';
|
|
55
|
+
displayName = 'Google Gemini';
|
|
56
|
+
/**
|
|
57
|
+
* Write prompt to a temporary file
|
|
58
|
+
*/
|
|
59
|
+
writePromptFile(prompt) {
|
|
60
|
+
const tempPath = join(tmpdir(), `steroids-gemini-${Date.now()}.txt`);
|
|
61
|
+
writeFileSync(tempPath, prompt, { mode: 0o600 });
|
|
62
|
+
return tempPath;
|
|
63
|
+
}
|
|
64
|
+
/**
|
|
65
|
+
* Clean up temporary prompt file
|
|
66
|
+
*/
|
|
67
|
+
cleanupPromptFile(path) {
|
|
68
|
+
try {
|
|
69
|
+
if (existsSync(path)) {
|
|
70
|
+
unlinkSync(path);
|
|
71
|
+
}
|
|
72
|
+
}
|
|
73
|
+
catch {
|
|
74
|
+
// Ignore cleanup errors
|
|
75
|
+
}
|
|
76
|
+
}
|
|
77
|
+
/**
|
|
78
|
+
* Get the default invocation template
|
|
79
|
+
*/
|
|
80
|
+
getDefaultInvocationTemplate() {
|
|
81
|
+
return DEFAULT_INVOCATION_TEMPLATE;
|
|
82
|
+
}
|
|
83
|
+
/**
|
|
84
|
+
* Invoke Gemini CLI with a prompt
|
|
85
|
+
*/
|
|
86
|
+
async invoke(prompt, options) {
|
|
87
|
+
const timeout = options.timeout ?? DEFAULT_TIMEOUT;
|
|
88
|
+
const cwd = options.cwd ?? process.cwd();
|
|
89
|
+
const streamOutput = options.streamOutput ?? true;
|
|
90
|
+
const onActivity = options.onActivity;
|
|
91
|
+
// Apply custom invocation template if provided in options
|
|
92
|
+
if (options.invocationTemplate) {
|
|
93
|
+
this.setInvocationTemplate(options.invocationTemplate);
|
|
94
|
+
}
|
|
95
|
+
// Write prompt to temp file
|
|
96
|
+
const promptFile = options.promptFile ?? this.writePromptFile(prompt);
|
|
97
|
+
const createdTempFile = !options.promptFile;
|
|
98
|
+
try {
|
|
99
|
+
return await this.invokeWithFile(promptFile, options.model, timeout, cwd, streamOutput, onActivity);
|
|
100
|
+
}
|
|
101
|
+
finally {
|
|
102
|
+
if (createdTempFile) {
|
|
103
|
+
this.cleanupPromptFile(promptFile);
|
|
104
|
+
}
|
|
105
|
+
}
|
|
106
|
+
}
|
|
107
|
+
/**
|
|
108
|
+
* Invoke Gemini CLI with a prompt file using the invocation template
|
|
109
|
+
*/
|
|
110
|
+
invokeWithFile(promptFile, model, timeout, cwd, streamOutput, onActivity) {
|
|
111
|
+
return new Promise((resolve) => {
|
|
112
|
+
const startTime = Date.now();
|
|
113
|
+
let stdout = '';
|
|
114
|
+
let stderr = '';
|
|
115
|
+
let timedOut = false;
|
|
116
|
+
// Build command from invocation template
|
|
117
|
+
const command = this.buildCommand(promptFile, model);
|
|
118
|
+
// Spawn using shell to handle the command template
|
|
119
|
+
const child = spawn(command, {
|
|
120
|
+
shell: true,
|
|
121
|
+
cwd,
|
|
122
|
+
stdio: ['pipe', 'pipe', 'pipe'],
|
|
123
|
+
});
|
|
124
|
+
const timeoutHandle = setTimeout(() => {
|
|
125
|
+
timedOut = true;
|
|
126
|
+
child.kill('SIGTERM');
|
|
127
|
+
// Force kill after 5 seconds if still running
|
|
128
|
+
setTimeout(() => {
|
|
129
|
+
if (!child.killed) {
|
|
130
|
+
child.kill('SIGKILL');
|
|
131
|
+
}
|
|
132
|
+
}, 5000);
|
|
133
|
+
}, timeout);
|
|
134
|
+
child.stdout?.on('data', (data) => {
|
|
135
|
+
const text = data.toString();
|
|
136
|
+
stdout += text;
|
|
137
|
+
onActivity?.({ type: 'output', stream: 'stdout', msg: text });
|
|
138
|
+
if (streamOutput) {
|
|
139
|
+
process.stdout.write(text);
|
|
140
|
+
}
|
|
141
|
+
});
|
|
142
|
+
child.stderr?.on('data', (data) => {
|
|
143
|
+
const text = data.toString();
|
|
144
|
+
stderr += text;
|
|
145
|
+
onActivity?.({ type: 'output', stream: 'stderr', msg: text });
|
|
146
|
+
if (streamOutput) {
|
|
147
|
+
process.stderr.write(text);
|
|
148
|
+
}
|
|
149
|
+
});
|
|
150
|
+
child.on('close', (code) => {
|
|
151
|
+
clearTimeout(timeoutHandle);
|
|
152
|
+
const duration = Date.now() - startTime;
|
|
153
|
+
resolve({
|
|
154
|
+
success: code === 0 && !timedOut,
|
|
155
|
+
exitCode: code ?? 1,
|
|
156
|
+
stdout,
|
|
157
|
+
stderr,
|
|
158
|
+
duration,
|
|
159
|
+
timedOut,
|
|
160
|
+
});
|
|
161
|
+
});
|
|
162
|
+
child.on('error', (error) => {
|
|
163
|
+
clearTimeout(timeoutHandle);
|
|
164
|
+
const duration = Date.now() - startTime;
|
|
165
|
+
resolve({
|
|
166
|
+
success: false,
|
|
167
|
+
exitCode: 1,
|
|
168
|
+
stdout,
|
|
169
|
+
stderr: error.message,
|
|
170
|
+
duration,
|
|
171
|
+
timedOut: false,
|
|
172
|
+
});
|
|
173
|
+
});
|
|
174
|
+
});
|
|
175
|
+
}
|
|
176
|
+
/**
|
|
177
|
+
* Check if Gemini CLI is available
|
|
178
|
+
* Checks for both 'gemini' and 'gcloud' CLIs
|
|
179
|
+
*/
|
|
180
|
+
async isAvailable() {
|
|
181
|
+
const cli = this.cliPath ?? 'gemini';
|
|
182
|
+
// First try the specified or default gemini CLI
|
|
183
|
+
const geminiAvailable = await this.checkCliAvailable(cli);
|
|
184
|
+
if (geminiAvailable) {
|
|
185
|
+
return true;
|
|
186
|
+
}
|
|
187
|
+
// Fall back to gcloud if gemini CLI not found
|
|
188
|
+
if (cli === 'gemini') {
|
|
189
|
+
return this.checkCliAvailable('gcloud');
|
|
190
|
+
}
|
|
191
|
+
return false;
|
|
192
|
+
}
|
|
193
|
+
/**
|
|
194
|
+
* Check if a specific CLI is available
|
|
195
|
+
*/
|
|
196
|
+
checkCliAvailable(cli) {
|
|
197
|
+
return new Promise((resolve) => {
|
|
198
|
+
const child = spawn('which', [cli], {
|
|
199
|
+
shell: true,
|
|
200
|
+
stdio: ['pipe', 'pipe', 'pipe'],
|
|
201
|
+
});
|
|
202
|
+
child.on('close', (code) => {
|
|
203
|
+
resolve(code === 0);
|
|
204
|
+
});
|
|
205
|
+
child.on('error', () => {
|
|
206
|
+
resolve(false);
|
|
207
|
+
});
|
|
208
|
+
// Timeout after 5 seconds
|
|
209
|
+
setTimeout(() => {
|
|
210
|
+
child.kill();
|
|
211
|
+
resolve(false);
|
|
212
|
+
}, 5000);
|
|
213
|
+
});
|
|
214
|
+
}
|
|
215
|
+
/**
|
|
216
|
+
* List available model IDs
|
|
217
|
+
*/
|
|
218
|
+
listModels() {
|
|
219
|
+
return GEMINI_MODELS.map((m) => m.id);
|
|
220
|
+
}
|
|
221
|
+
/**
|
|
222
|
+
* Get detailed model information
|
|
223
|
+
*/
|
|
224
|
+
getModelInfo() {
|
|
225
|
+
return [...GEMINI_MODELS];
|
|
226
|
+
}
|
|
227
|
+
/**
|
|
228
|
+
* Get the default model for a role
|
|
229
|
+
*/
|
|
230
|
+
getDefaultModel(role) {
|
|
231
|
+
return DEFAULT_MODELS[role];
|
|
232
|
+
}
|
|
233
|
+
}
|
|
234
|
+
/**
|
|
235
|
+
* Create a Gemini provider instance
|
|
236
|
+
*/
|
|
237
|
+
export function createGeminiProvider() {
|
|
238
|
+
return new GeminiProvider();
|
|
239
|
+
}
|
|
240
|
+
//# sourceMappingURL=gemini.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"gemini.js","sourceRoot":"","sources":["../../../../src/providers/gemini.ts"],"names":[],"mappings":"AAAA;;;GAGG;AAEH,OAAO,EAAE,KAAK,EAAE,MAAM,oBAAoB,CAAC;AAC3C,OAAO,EAAE,aAAa,EAAE,UAAU,EAAE,UAAU,EAAE,MAAM,SAAS,CAAC;AAChE,OAAO,EAAE,MAAM,EAAE,MAAM,SAAS,CAAC;AACjC,OAAO,EAAE,IAAI,EAAE,MAAM,WAAW,CAAC;AACjC,OAAO,EACL,cAAc,GAIf,MAAM,gBAAgB,CAAC;AAExB;;GAEG;AACH,MAAM,aAAa,GAAgB;IACjC;QACE,EAAE,EAAE,YAAY;QAChB,IAAI,EAAE,YAAY;QAClB,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AAC;AAC9B,CAAC"}
|
|
@@ -0,0 +1,185 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* AI Provider Interface
|
|
3
|
+
* Defines the contract for AI providers (Claude, Gemini, OpenAI, etc.)
|
|
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
|
+
}
|
|
29
|
+
/**
|
|
30
|
+
* Activity entry emitted during a provider invocation.
|
|
31
|
+
* Kept intentionally flexible (JSONL logger appends arbitrary fields).
|
|
32
|
+
*/
|
|
33
|
+
export type InvocationActivity = Record<string, unknown> & {
|
|
34
|
+
type: string;
|
|
35
|
+
};
|
|
36
|
+
/**
|
|
37
|
+
* Result of an AI provider invocation
|
|
38
|
+
*/
|
|
39
|
+
export interface InvokeResult {
|
|
40
|
+
/** Whether the invocation succeeded (exit code 0) */
|
|
41
|
+
success: boolean;
|
|
42
|
+
/** Exit code from the CLI process */
|
|
43
|
+
exitCode: number;
|
|
44
|
+
/** Standard output from the process */
|
|
45
|
+
stdout: string;
|
|
46
|
+
/** Standard error from the process */
|
|
47
|
+
stderr: string;
|
|
48
|
+
/** Duration in milliseconds */
|
|
49
|
+
duration: number;
|
|
50
|
+
/** Whether the process was killed due to timeout */
|
|
51
|
+
timedOut: boolean;
|
|
52
|
+
}
|
|
53
|
+
/**
|
|
54
|
+
* Error types that can be classified from provider output
|
|
55
|
+
*/
|
|
56
|
+
export type ProviderErrorType = 'rate_limit' | 'auth_error' | 'network_error' | 'model_not_found' | 'context_exceeded' | 'subprocess_hung' | 'unknown';
|
|
57
|
+
/**
|
|
58
|
+
* Classified error from provider invocation
|
|
59
|
+
*/
|
|
60
|
+
export interface ProviderError {
|
|
61
|
+
/** Type of error */
|
|
62
|
+
type: ProviderErrorType;
|
|
63
|
+
/** Human-readable error message */
|
|
64
|
+
message: string;
|
|
65
|
+
/** Whether this error is retryable */
|
|
66
|
+
retryable: boolean;
|
|
67
|
+
/** Suggested retry delay in milliseconds */
|
|
68
|
+
retryAfterMs?: number;
|
|
69
|
+
}
|
|
70
|
+
/**
|
|
71
|
+
* Model information
|
|
72
|
+
*/
|
|
73
|
+
export interface ModelInfo {
|
|
74
|
+
/** Model identifier used for invocation */
|
|
75
|
+
id: string;
|
|
76
|
+
/** Human-readable name */
|
|
77
|
+
name: string;
|
|
78
|
+
/** Recommended role for this model */
|
|
79
|
+
recommendedFor?: ('orchestrator' | 'coder' | 'reviewer')[];
|
|
80
|
+
/** Whether this model supports streaming */
|
|
81
|
+
supportsStreaming?: boolean;
|
|
82
|
+
}
|
|
83
|
+
/**
|
|
84
|
+
* AI Provider interface
|
|
85
|
+
* All providers must implement this interface
|
|
86
|
+
*/
|
|
87
|
+
export interface IAIProvider {
|
|
88
|
+
/** Provider name (e.g., 'claude', 'gemini', 'openai') */
|
|
89
|
+
readonly name: string;
|
|
90
|
+
/** Human-readable display name */
|
|
91
|
+
readonly displayName: string;
|
|
92
|
+
/**
|
|
93
|
+
* Invoke the provider with a prompt
|
|
94
|
+
* @param prompt The prompt text to send
|
|
95
|
+
* @param options Invocation options
|
|
96
|
+
* @returns Promise resolving to the invocation result
|
|
97
|
+
*/
|
|
98
|
+
invoke(prompt: string, options: InvokeOptions): Promise<InvokeResult>;
|
|
99
|
+
/**
|
|
100
|
+
* Check if this provider is available (CLI installed and accessible)
|
|
101
|
+
* @returns Promise resolving to true if available
|
|
102
|
+
*/
|
|
103
|
+
isAvailable(): Promise<boolean>;
|
|
104
|
+
/**
|
|
105
|
+
* List available models for this provider
|
|
106
|
+
* @returns Array of model identifiers
|
|
107
|
+
*/
|
|
108
|
+
listModels(): string[];
|
|
109
|
+
/**
|
|
110
|
+
* Get detailed model information
|
|
111
|
+
* @returns Array of model info objects
|
|
112
|
+
*/
|
|
113
|
+
getModelInfo(): ModelInfo[];
|
|
114
|
+
/**
|
|
115
|
+
* Get the default model for a role
|
|
116
|
+
* @param role The role to get default model for
|
|
117
|
+
* @returns Default model ID or undefined
|
|
118
|
+
*/
|
|
119
|
+
getDefaultModel(role: 'orchestrator' | 'coder' | 'reviewer'): string | undefined;
|
|
120
|
+
/**
|
|
121
|
+
* Classify an error from stderr output
|
|
122
|
+
* @param exitCode The process exit code
|
|
123
|
+
* @param stderr The stderr output
|
|
124
|
+
* @returns Classified error or null if not an error
|
|
125
|
+
*/
|
|
126
|
+
classifyError(exitCode: number, stderr: string): ProviderError | null;
|
|
127
|
+
/**
|
|
128
|
+
* Get the CLI path for this provider
|
|
129
|
+
* @returns Path to CLI executable or undefined if using default
|
|
130
|
+
*/
|
|
131
|
+
getCliPath(): string | undefined;
|
|
132
|
+
/**
|
|
133
|
+
* Set a custom CLI path
|
|
134
|
+
* @param path Path to CLI executable
|
|
135
|
+
*/
|
|
136
|
+
setCliPath(path: string): void;
|
|
137
|
+
/**
|
|
138
|
+
* Get the default invocation template
|
|
139
|
+
* @returns Default template with {prompt_file} and {model} placeholders
|
|
140
|
+
*/
|
|
141
|
+
getDefaultInvocationTemplate(): string;
|
|
142
|
+
/**
|
|
143
|
+
* Set a custom invocation template
|
|
144
|
+
* @param template Custom template with {prompt_file} and {model} placeholders
|
|
145
|
+
*/
|
|
146
|
+
setInvocationTemplate(template: string): void;
|
|
147
|
+
/**
|
|
148
|
+
* Get the current invocation template
|
|
149
|
+
* @returns Current template (custom or default)
|
|
150
|
+
*/
|
|
151
|
+
getInvocationTemplate(): string;
|
|
152
|
+
}
|
|
153
|
+
/**
|
|
154
|
+
* Base abstract class for AI providers
|
|
155
|
+
* Provides common functionality
|
|
156
|
+
*/
|
|
157
|
+
export declare abstract class BaseAIProvider implements IAIProvider {
|
|
158
|
+
abstract readonly name: string;
|
|
159
|
+
abstract readonly displayName: string;
|
|
160
|
+
protected cliPath: string | undefined;
|
|
161
|
+
protected invocationTemplate: string | undefined;
|
|
162
|
+
abstract invoke(prompt: string, options: InvokeOptions): Promise<InvokeResult>;
|
|
163
|
+
abstract isAvailable(): Promise<boolean>;
|
|
164
|
+
abstract listModels(): string[];
|
|
165
|
+
abstract getModelInfo(): ModelInfo[];
|
|
166
|
+
abstract getDefaultModel(role: 'orchestrator' | 'coder' | 'reviewer'): string | undefined;
|
|
167
|
+
abstract getDefaultInvocationTemplate(): string;
|
|
168
|
+
/**
|
|
169
|
+
* Classify an error based on exit code and stderr
|
|
170
|
+
* Subclasses can override for provider-specific error detection
|
|
171
|
+
*/
|
|
172
|
+
classifyError(exitCode: number, stderr: string): ProviderError | null;
|
|
173
|
+
getCliPath(): string | undefined;
|
|
174
|
+
setCliPath(path: string): void;
|
|
175
|
+
setInvocationTemplate(template: string): void;
|
|
176
|
+
getInvocationTemplate(): string;
|
|
177
|
+
/**
|
|
178
|
+
* Build the command from the invocation template
|
|
179
|
+
* @param promptFile Path to the prompt file
|
|
180
|
+
* @param model Model identifier
|
|
181
|
+
* @returns Command string ready for execution
|
|
182
|
+
*/
|
|
183
|
+
protected buildCommand(promptFile: string, model: string): string;
|
|
184
|
+
}
|
|
185
|
+
//# sourceMappingURL=interface.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"interface.d.ts","sourceRoot":"","sources":["../../../../src/providers/interface.ts"],"names":[],"mappings":"AAAA;;;GAGG;AAEH;;GAEG;AACH,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,CAAC,EAAE,cAAc,GAAG,OAAO,GAAG,UAAU,CAAC;IAC7C,mFAAmF;IACnF,kBAAkB,CAAC,EAAE,MAAM,CAAC;IAC5B,gDAAgD;IAChD,YAAY,CAAC,EAAE,OAAO,CAAC;IACvB;;;OAGG;IACH,UAAU,CAAC,EAAE,CAAC,QAAQ,EAAE,kBAAkB,KAAK,IAAI,CAAC;CACrD;AAED;;;GAGG;AACH,MAAM,MAAM,kBAAkB,GAAG,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,GAAG;IAAE,IAAI,EAAE,MAAM,CAAA;CAAE,CAAC;AAE5E;;GAEG;AACH,MAAM,WAAW,YAAY;IAC3B,qDAAqD;IACrD,OAAO,EAAE,OAAO,CAAC;IACjB,qCAAqC;IACrC,QAAQ,EAAE,MAAM,CAAC;IACjB,uCAAuC;IACvC,MAAM,EAAE,MAAM,CAAC;IACf,sCAAsC;IACtC,MAAM,EAAE,MAAM,CAAC;IACf,+BAA+B;IAC/B,QAAQ,EAAE,MAAM,CAAC;IACjB,oDAAoD;IACpD,QAAQ,EAAE,OAAO,CAAC;CACnB;AAED;;GAEG;AACH,MAAM,MAAM,iBAAiB,GACzB,YAAY,GACZ,YAAY,GACZ,eAAe,GACf,iBAAiB,GACjB,kBAAkB,GAClB,iBAAiB,GACjB,SAA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AAE,MAAM,GAAG,MAAM;CASlE"}
|
|
@@ -0,0 +1,92 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* AI Provider Interface
|
|
3
|
+
* Defines the contract for AI providers (Claude, Gemini, OpenAI, etc.)
|
|
4
|
+
*/
|
|
5
|
+
/**
|
|
6
|
+
* Base abstract class for AI providers
|
|
7
|
+
* Provides common functionality
|
|
8
|
+
*/
|
|
9
|
+
export class BaseAIProvider {
|
|
10
|
+
cliPath;
|
|
11
|
+
invocationTemplate;
|
|
12
|
+
/**
|
|
13
|
+
* Classify an error based on exit code and stderr
|
|
14
|
+
* Subclasses can override for provider-specific error detection
|
|
15
|
+
*/
|
|
16
|
+
classifyError(exitCode, stderr) {
|
|
17
|
+
if (exitCode === 0) {
|
|
18
|
+
return null;
|
|
19
|
+
}
|
|
20
|
+
const stderrLower = stderr.toLowerCase();
|
|
21
|
+
if (stderrLower.includes('rate limit') || stderr.includes('429')) {
|
|
22
|
+
return {
|
|
23
|
+
type: 'rate_limit',
|
|
24
|
+
message: 'Rate limit exceeded',
|
|
25
|
+
retryable: true,
|
|
26
|
+
retryAfterMs: 60000,
|
|
27
|
+
};
|
|
28
|
+
}
|
|
29
|
+
if (stderrLower.includes('unauthorized') || stderrLower.includes('auth')) {
|
|
30
|
+
return {
|
|
31
|
+
type: 'auth_error',
|
|
32
|
+
message: 'Authentication failed',
|
|
33
|
+
retryable: false,
|
|
34
|
+
};
|
|
35
|
+
}
|
|
36
|
+
if (stderrLower.includes('connection') || stderrLower.includes('timeout') ||
|
|
37
|
+
stderrLower.includes('network')) {
|
|
38
|
+
return {
|
|
39
|
+
type: 'network_error',
|
|
40
|
+
message: 'Network error',
|
|
41
|
+
retryable: true,
|
|
42
|
+
};
|
|
43
|
+
}
|
|
44
|
+
if (stderrLower.includes('model') && stderrLower.includes('not found')) {
|
|
45
|
+
return {
|
|
46
|
+
type: 'model_not_found',
|
|
47
|
+
message: 'Model not found',
|
|
48
|
+
retryable: false,
|
|
49
|
+
};
|
|
50
|
+
}
|
|
51
|
+
if (stderrLower.includes('context') || stderrLower.includes('token limit') ||
|
|
52
|
+
stderrLower.includes('too long')) {
|
|
53
|
+
return {
|
|
54
|
+
type: 'context_exceeded',
|
|
55
|
+
message: 'Context limit exceeded',
|
|
56
|
+
retryable: false,
|
|
57
|
+
};
|
|
58
|
+
}
|
|
59
|
+
return {
|
|
60
|
+
type: 'unknown',
|
|
61
|
+
message: stderr.slice(0, 200) || 'Unknown error',
|
|
62
|
+
retryable: true,
|
|
63
|
+
};
|
|
64
|
+
}
|
|
65
|
+
getCliPath() {
|
|
66
|
+
return this.cliPath;
|
|
67
|
+
}
|
|
68
|
+
setCliPath(path) {
|
|
69
|
+
this.cliPath = path;
|
|
70
|
+
}
|
|
71
|
+
setInvocationTemplate(template) {
|
|
72
|
+
this.invocationTemplate = template;
|
|
73
|
+
}
|
|
74
|
+
getInvocationTemplate() {
|
|
75
|
+
return this.invocationTemplate ?? this.getDefaultInvocationTemplate();
|
|
76
|
+
}
|
|
77
|
+
/**
|
|
78
|
+
* Build the command from the invocation template
|
|
79
|
+
* @param promptFile Path to the prompt file
|
|
80
|
+
* @param model Model identifier
|
|
81
|
+
* @returns Command string ready for execution
|
|
82
|
+
*/
|
|
83
|
+
buildCommand(promptFile, model) {
|
|
84
|
+
const template = this.getInvocationTemplate();
|
|
85
|
+
const cli = this.cliPath ?? this.name;
|
|
86
|
+
return template
|
|
87
|
+
.replace('{cli}', cli)
|
|
88
|
+
.replace('{prompt_file}', promptFile)
|
|
89
|
+
.replace('{model}', model);
|
|
90
|
+
}
|
|
91
|
+
}
|
|
92
|
+
//# sourceMappingURL=interface.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"interface.js","sourceRoot":"","sources":["../../../../src/providers/interface.ts"],"names":[],"mappings":"AAAA;;;GAGG;AA8KH;;;GAGG;AACH,MAAM,OAAgB,cAAc;IAIxB,OAAO,CAAqB;IAC5B,kBAAkB,CAAqB;IASjD;;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AAC,UAAU,CAAC,EAAE,CAAC;YACrC,OAAO;gBACL,IAAI,EAAE,kBAAkB;gBACxB,OAAO,EAAE,wBAAwB;gBACjC,SAAS,EAAE,KAAK;aACjB,CAAC;QACJ,CAAC;QAED,OAAO;YACL,IAAI,EAAE,SAAS;YACf,OAAO,EAAE,MAAM,CAAC,KAAK,CAAC,CAAC,EAAE,GAAG,CAAC,IAAI,eAAe;YAChD,SAAS,EAAE,IAAI;SAChB,CAAC;IACJ,CAAC;IAED,UAAU;QACR,OAAO,IAAI,CAAC,OAAO,CAAC;IACtB,CAAC;IAED,UAAU,CAAC,IAAY;QACrB,IAAI,CAAC,OAAO,GAAG,IAAI,CAAC;IACtB,CAAC;IAED,qBAAqB,CAAC,QAAgB;QACpC,IAAI,CAAC,kBAAkB,GAAG,QAAQ,CAAC;IACrC,CAAC;IAED,qBAAqB;QACnB,OAAO,IAAI,CAAC,kBAAkB,IAAI,IAAI,CAAC,4BAA4B,EAAE,CAAC;IACxE,CAAC;IAED;;;;;OAKG;IACO,YAAY,CAAC,UAAkB,EAAE,KAAa;QACtD,MAAM,QAAQ,GAAG,IAAI,CAAC,qBAAqB,EAAE,CAAC;QAC9C,MAAM,GAAG,GAAG,IAAI,CAAC,OAAO,IAAI,IAAI,CAAC,IAAI,CAAC;QAEtC,OAAO,QAAQ;aACZ,OAAO,CAAC,OAAO,EAAE,GAAG,CAAC;aACrB,OAAO,CAAC,eAAe,EAAE,UAAU,CAAC;aACpC,OAAO,CAAC,SAAS,EAAE,KAAK,CAAC,CAAC;IAC/B,CAAC;CACF"}
|
|
@@ -0,0 +1,97 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Invocation Logger
|
|
3
|
+
* Logs all LLM invocations for debugging and audit purposes
|
|
4
|
+
*/
|
|
5
|
+
import type { InvocationActivity, InvokeResult } from './interface.js';
|
|
6
|
+
/**
|
|
7
|
+
* Log entry for an LLM invocation
|
|
8
|
+
*/
|
|
9
|
+
export interface InvocationLogEntry {
|
|
10
|
+
timestamp: string;
|
|
11
|
+
role: 'orchestrator' | 'coder' | 'reviewer';
|
|
12
|
+
provider: string;
|
|
13
|
+
model: string;
|
|
14
|
+
taskId?: string;
|
|
15
|
+
duration: number;
|
|
16
|
+
exitCode: number;
|
|
17
|
+
success: boolean;
|
|
18
|
+
timedOut: boolean;
|
|
19
|
+
prompt: string;
|
|
20
|
+
response: string;
|
|
21
|
+
error?: string;
|
|
22
|
+
}
|
|
23
|
+
/**
|
|
24
|
+
* Configuration for invocation logging
|
|
25
|
+
*/
|
|
26
|
+
export interface InvocationLoggerConfig {
|
|
27
|
+
enabled?: boolean;
|
|
28
|
+
logsDir?: string;
|
|
29
|
+
retentionDays?: number;
|
|
30
|
+
includePrompts?: boolean;
|
|
31
|
+
includeResponses?: boolean;
|
|
32
|
+
}
|
|
33
|
+
/**
|
|
34
|
+
* Invocation Logger
|
|
35
|
+
* Logs LLM invocations to disk for debugging and audit
|
|
36
|
+
*/
|
|
37
|
+
export declare class InvocationLogger {
|
|
38
|
+
private config;
|
|
39
|
+
constructor(config?: InvocationLoggerConfig);
|
|
40
|
+
/**
|
|
41
|
+
* Log an invocation
|
|
42
|
+
*/
|
|
43
|
+
log(entry: InvocationLogEntry): void;
|
|
44
|
+
/**
|
|
45
|
+
* Create log file name
|
|
46
|
+
*/
|
|
47
|
+
private createLogFileName;
|
|
48
|
+
/**
|
|
49
|
+
* Format log entry as text
|
|
50
|
+
*/
|
|
51
|
+
private formatLogEntry;
|
|
52
|
+
/**
|
|
53
|
+
* Ensure logs directory exists
|
|
54
|
+
*/
|
|
55
|
+
private ensureLogsDirectory;
|
|
56
|
+
/**
|
|
57
|
+
* Clean up old logs based on retention policy
|
|
58
|
+
*/
|
|
59
|
+
private cleanupOldLogs;
|
|
60
|
+
/**
|
|
61
|
+
* Get all log files
|
|
62
|
+
*/
|
|
63
|
+
getAllLogs(): string[];
|
|
64
|
+
/**
|
|
65
|
+
* Purge all logs
|
|
66
|
+
*/
|
|
67
|
+
purgeAll(): void;
|
|
68
|
+
/**
|
|
69
|
+
* Get total size of all logs in bytes
|
|
70
|
+
*/
|
|
71
|
+
getTotalSize(): number;
|
|
72
|
+
}
|
|
73
|
+
/**
|
|
74
|
+
* Get the global invocation logger
|
|
75
|
+
*/
|
|
76
|
+
export declare function getInvocationLogger(config?: InvocationLoggerConfig): InvocationLogger;
|
|
77
|
+
/**
|
|
78
|
+
* Set the global invocation logger
|
|
79
|
+
*/
|
|
80
|
+
export declare function setInvocationLogger(logger: InvocationLogger): void;
|
|
81
|
+
/**
|
|
82
|
+
* Reset the global invocation logger
|
|
83
|
+
*/
|
|
84
|
+
export declare function resetInvocationLogger(): void;
|
|
85
|
+
type InvocationInvokeContext = {
|
|
86
|
+
onActivity?: (activity: InvocationActivity) => void;
|
|
87
|
+
};
|
|
88
|
+
export declare function logInvocation(prompt: string, invokeOrResult: ((ctx?: InvocationInvokeContext) => Promise<InvokeResult>) | InvokeResult, metadata: {
|
|
89
|
+
role: 'orchestrator' | 'coder' | 'reviewer';
|
|
90
|
+
provider: string;
|
|
91
|
+
model: string;
|
|
92
|
+
taskId?: string;
|
|
93
|
+
projectPath?: string;
|
|
94
|
+
rejectionNumber?: number;
|
|
95
|
+
}): Promise<InvokeResult>;
|
|
96
|
+
export {};
|
|
97
|
+
//# sourceMappingURL=invocation-logger.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"invocation-logger.d.ts","sourceRoot":"","sources":["../../../../src/providers/invocation-logger.ts"],"names":[],"mappings":"AAAA;;;GAGG;AAYH,OAAO,KAAK,EAAE,kBAAkB,EAAE,YAAY,EAAE,MAAM,gBAAgB,CAAC;AAEvE;;GAEG;AACH,MAAM,WAAW,kBAAkB;IACjC,SAAS,EAAE,MAAM,CAAC;IAClB,IAAI,EAAE,cAAc,GAAG,OAAO,GAAG,UAAU,CAAC;IAC5C,QAAQ,EAAE,MAAM,CAAC;IACjB,KAAK,EAAE,MAAM,CAAC;IACd,MAAM,CA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