steroids-cli 0.4.47
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/LICENSE +21 -0
- package/README.md +640 -0
- package/dist/cli/colors.d.ts +110 -0
- package/dist/cli/colors.d.ts.map +1 -0
- package/dist/cli/colors.js +228 -0
- package/dist/cli/colors.js.map +1 -0
- package/dist/cli/env.d.ts +159 -0
- package/dist/cli/env.d.ts.map +1 -0
- package/dist/cli/env.js +227 -0
- package/dist/cli/env.js.map +1 -0
- package/dist/cli/errors.d.ts +166 -0
- package/dist/cli/errors.d.ts.map +1 -0
- package/dist/cli/errors.js +244 -0
- package/dist/cli/errors.js.map +1 -0
- package/dist/cli/flags.d.ts +75 -0
- package/dist/cli/flags.d.ts.map +1 -0
- package/dist/cli/flags.js +232 -0
- package/dist/cli/flags.js.map +1 -0
- package/dist/cli/help.d.ts +97 -0
- package/dist/cli/help.d.ts.map +1 -0
- package/dist/cli/help.js +275 -0
- package/dist/cli/help.js.map +1 -0
- package/dist/cli/index.d.ts +13 -0
- package/dist/cli/index.d.ts.map +1 -0
- package/dist/cli/index.js +29 -0
- package/dist/cli/index.js.map +1 -0
- package/dist/cli/interactive.d.ts +58 -0
- package/dist/cli/interactive.d.ts.map +1 -0
- package/dist/cli/interactive.js +127 -0
- package/dist/cli/interactive.js.map +1 -0
- package/dist/cli/output.d.ts +116 -0
- package/dist/cli/output.d.ts.map +1 -0
- package/dist/cli/output.js +178 -0
- package/dist/cli/output.js.map +1 -0
- package/dist/commands/about.d.ts +7 -0
- package/dist/commands/about.d.ts.map +1 -0
- package/dist/commands/about.js +259 -0
- package/dist/commands/about.js.map +1 -0
- package/dist/commands/ai.d.ts +6 -0
- package/dist/commands/ai.d.ts.map +1 -0
- package/dist/commands/ai.js +382 -0
- package/dist/commands/ai.js.map +1 -0
- package/dist/commands/backup.d.ts +3 -0
- package/dist/commands/backup.d.ts.map +1 -0
- package/dist/commands/backup.js +528 -0
- package/dist/commands/backup.js.map +1 -0
- package/dist/commands/completion.d.ts +3 -0
- package/dist/commands/completion.d.ts.map +1 -0
- package/dist/commands/completion.js +405 -0
- package/dist/commands/completion.js.map +1 -0
- package/dist/commands/config.d.ts +3 -0
- package/dist/commands/config.d.ts.map +1 -0
- package/dist/commands/config.js +665 -0
- package/dist/commands/config.js.map +1 -0
- package/dist/commands/disputes.d.ts +3 -0
- package/dist/commands/disputes.d.ts.map +1 -0
- package/dist/commands/disputes.js +499 -0
- package/dist/commands/disputes.js.map +1 -0
- package/dist/commands/gc.d.ts +3 -0
- package/dist/commands/gc.d.ts.map +1 -0
- package/dist/commands/gc.js +300 -0
- package/dist/commands/gc.js.map +1 -0
- package/dist/commands/git.d.ts +3 -0
- package/dist/commands/git.d.ts.map +1 -0
- package/dist/commands/git.js +458 -0
- package/dist/commands/git.js.map +1 -0
- package/dist/commands/health.d.ts +3 -0
- package/dist/commands/health.d.ts.map +1 -0
- package/dist/commands/health.js +604 -0
- package/dist/commands/health.js.map +1 -0
- package/dist/commands/hooks.d.ts +6 -0
- package/dist/commands/hooks.d.ts.map +1 -0
- package/dist/commands/hooks.js +529 -0
- package/dist/commands/hooks.js.map +1 -0
- package/dist/commands/init.d.ts +6 -0
- package/dist/commands/init.d.ts.map +1 -0
- package/dist/commands/init.js +200 -0
- package/dist/commands/init.js.map +1 -0
- package/dist/commands/llm.d.ts +7 -0
- package/dist/commands/llm.d.ts.map +1 -0
- package/dist/commands/llm.js +285 -0
- package/dist/commands/llm.js.map +1 -0
- package/dist/commands/locks.d.ts +3 -0
- package/dist/commands/locks.d.ts.map +1 -0
- package/dist/commands/locks.js +431 -0
- package/dist/commands/locks.js.map +1 -0
- package/dist/commands/logs.d.ts +3 -0
- package/dist/commands/logs.d.ts.map +1 -0
- package/dist/commands/logs.js +487 -0
- package/dist/commands/logs.js.map +1 -0
- package/dist/commands/loop-phases.d.ts +11 -0
- package/dist/commands/loop-phases.d.ts.map +1 -0
- package/dist/commands/loop-phases.js +204 -0
- package/dist/commands/loop-phases.js.map +1 -0
- package/dist/commands/loop.d.ts +3 -0
- package/dist/commands/loop.d.ts.map +1 -0
- package/dist/commands/loop.js +396 -0
- package/dist/commands/loop.js.map +1 -0
- package/dist/commands/projects.d.ts +6 -0
- package/dist/commands/projects.d.ts.map +1 -0
- package/dist/commands/projects.js +362 -0
- package/dist/commands/projects.js.map +1 -0
- package/dist/commands/purge.d.ts +3 -0
- package/dist/commands/purge.d.ts.map +1 -0
- package/dist/commands/purge.js +516 -0
- package/dist/commands/purge.js.map +1 -0
- package/dist/commands/runners.d.ts +3 -0
- package/dist/commands/runners.d.ts.map +1 -0
- package/dist/commands/runners.js +1076 -0
- package/dist/commands/runners.js.map +1 -0
- package/dist/commands/scan.d.ts +3 -0
- package/dist/commands/scan.d.ts.map +1 -0
- package/dist/commands/scan.js +291 -0
- package/dist/commands/scan.js.map +1 -0
- package/dist/commands/sections-commands.d.ts +9 -0
- package/dist/commands/sections-commands.d.ts.map +1 -0
- package/dist/commands/sections-commands.js +282 -0
- package/dist/commands/sections-commands.js.map +1 -0
- package/dist/commands/sections-graph.d.ts +25 -0
- package/dist/commands/sections-graph.d.ts.map +1 -0
- package/dist/commands/sections-graph.js +180 -0
- package/dist/commands/sections-graph.js.map +1 -0
- package/dist/commands/sections.d.ts +3 -0
- package/dist/commands/sections.d.ts.map +1 -0
- package/dist/commands/sections.js +376 -0
- package/dist/commands/sections.js.map +1 -0
- package/dist/commands/stats.d.ts +6 -0
- package/dist/commands/stats.d.ts.map +1 -0
- package/dist/commands/stats.js +324 -0
- package/dist/commands/stats.js.map +1 -0
- package/dist/commands/tasks.d.ts +3 -0
- package/dist/commands/tasks.d.ts.map +1 -0
- package/dist/commands/tasks.js +1115 -0
- package/dist/commands/tasks.js.map +1 -0
- package/dist/commands/web.d.ts +7 -0
- package/dist/commands/web.d.ts.map +1 -0
- package/dist/commands/web.js +204 -0
- package/dist/commands/web.js.map +1 -0
- package/dist/config/ai-setup.d.ts +27 -0
- package/dist/config/ai-setup.d.ts.map +1 -0
- package/dist/config/ai-setup.js +432 -0
- package/dist/config/ai-setup.js.map +1 -0
- package/dist/config/browser.d.ts +9 -0
- package/dist/config/browser.d.ts.map +1 -0
- package/dist/config/browser.js +200 -0
- package/dist/config/browser.js.map +1 -0
- package/dist/config/json-schema.d.ts +28 -0
- package/dist/config/json-schema.d.ts.map +1 -0
- package/dist/config/json-schema.js +84 -0
- package/dist/config/json-schema.js.map +1 -0
- package/dist/config/loader.d.ts +152 -0
- package/dist/config/loader.d.ts.map +1 -0
- package/dist/config/loader.js +270 -0
- package/dist/config/loader.js.map +1 -0
- package/dist/config/schema.d.ts +34 -0
- package/dist/config/schema.d.ts.map +1 -0
- package/dist/config/schema.js +437 -0
- package/dist/config/schema.js.map +1 -0
- package/dist/config/validator.d.ts +32 -0
- package/dist/config/validator.d.ts.map +1 -0
- package/dist/config/validator.js +187 -0
- package/dist/config/validator.js.map +1 -0
- package/dist/database/connection.d.ts +35 -0
- package/dist/database/connection.d.ts.map +1 -0
- package/dist/database/connection.js +208 -0
- package/dist/database/connection.js.map +1 -0
- package/dist/database/queries.d.ts +218 -0
- package/dist/database/queries.d.ts.map +1 -0
- package/dist/database/queries.js +613 -0
- package/dist/database/queries.js.map +1 -0
- package/dist/database/schema.d.ts +8 -0
- package/dist/database/schema.d.ts.map +1 -0
- package/dist/database/schema.js +160 -0
- package/dist/database/schema.js.map +1 -0
- package/dist/disputes/behavior.d.ts +106 -0
- package/dist/disputes/behavior.d.ts.map +1 -0
- package/dist/disputes/behavior.js +150 -0
- package/dist/disputes/behavior.js.map +1 -0
- package/dist/disputes/create.d.ts +59 -0
- package/dist/disputes/create.d.ts.map +1 -0
- package/dist/disputes/create.js +222 -0
- package/dist/disputes/create.js.map +1 -0
- package/dist/disputes/index.d.ts +21 -0
- package/dist/disputes/index.d.ts.map +1 -0
- package/dist/disputes/index.js +76 -0
- package/dist/disputes/index.js.map +1 -0
- package/dist/disputes/markdown.d.ts +41 -0
- package/dist/disputes/markdown.d.ts.map +1 -0
- package/dist/disputes/markdown.js +261 -0
- package/dist/disputes/markdown.js.map +1 -0
- package/dist/disputes/queries.d.ts +83 -0
- package/dist/disputes/queries.d.ts.map +1 -0
- package/dist/disputes/queries.js +180 -0
- package/dist/disputes/queries.js.map +1 -0
- package/dist/disputes/resolve.d.ts +57 -0
- package/dist/disputes/resolve.d.ts.map +1 -0
- package/dist/disputes/resolve.js +171 -0
- package/dist/disputes/resolve.js.map +1 -0
- package/dist/disputes/stale.d.ts +98 -0
- package/dist/disputes/stale.d.ts.map +1 -0
- package/dist/disputes/stale.js +205 -0
- package/dist/disputes/stale.js.map +1 -0
- package/dist/disputes/types.d.ts +92 -0
- package/dist/disputes/types.d.ts.map +1 -0
- package/dist/disputes/types.js +100 -0
- package/dist/disputes/types.js.map +1 -0
- package/dist/git/push.d.ts +26 -0
- package/dist/git/push.d.ts.map +1 -0
- package/dist/git/push.js +97 -0
- package/dist/git/push.js.map +1 -0
- package/dist/git/status.d.ts +61 -0
- package/dist/git/status.d.ts.map +1 -0
- package/dist/git/status.js +251 -0
- package/dist/git/status.js.map +1 -0
- package/dist/hooks/events.d.ts +72 -0
- package/dist/hooks/events.d.ts.map +1 -0
- package/dist/hooks/events.js +120 -0
- package/dist/hooks/events.js.map +1 -0
- package/dist/hooks/index.d.ts +19 -0
- package/dist/hooks/index.d.ts.map +1 -0
- package/dist/hooks/index.js +48 -0
- package/dist/hooks/index.js.map +1 -0
- package/dist/hooks/integration.d.ts +69 -0
- package/dist/hooks/integration.d.ts.map +1 -0
- package/dist/hooks/integration.js +179 -0
- package/dist/hooks/integration.js.map +1 -0
- package/dist/hooks/merge.d.ts +115 -0
- package/dist/hooks/merge.d.ts.map +1 -0
- package/dist/hooks/merge.js +161 -0
- package/dist/hooks/merge.js.map +1 -0
- package/dist/hooks/orchestrator.d.ts +115 -0
- package/dist/hooks/orchestrator.d.ts.map +1 -0
- package/dist/hooks/orchestrator.js +226 -0
- package/dist/hooks/orchestrator.js.map +1 -0
- package/dist/hooks/payload.d.ts +294 -0
- package/dist/hooks/payload.d.ts.map +1 -0
- package/dist/hooks/payload.js +267 -0
- package/dist/hooks/payload.js.map +1 -0
- package/dist/hooks/script-runner.d.ts +63 -0
- package/dist/hooks/script-runner.d.ts.map +1 -0
- package/dist/hooks/script-runner.js +221 -0
- package/dist/hooks/script-runner.js.map +1 -0
- package/dist/hooks/templates.d.ts +104 -0
- package/dist/hooks/templates.d.ts.map +1 -0
- package/dist/hooks/templates.js +327 -0
- package/dist/hooks/templates.js.map +1 -0
- package/dist/hooks/webhook-runner.d.ts +69 -0
- package/dist/hooks/webhook-runner.d.ts.map +1 -0
- package/dist/hooks/webhook-runner.js +208 -0
- package/dist/hooks/webhook-runner.js.map +1 -0
- package/dist/index.d.ts +7 -0
- package/dist/index.d.ts.map +1 -0
- package/dist/index.js +281 -0
- package/dist/index.js.map +1 -0
- package/dist/locking/cleanup.d.ts +70 -0
- package/dist/locking/cleanup.d.ts.map +1 -0
- package/dist/locking/cleanup.js +157 -0
- package/dist/locking/cleanup.js.map +1 -0
- package/dist/locking/queries.d.ts +116 -0
- package/dist/locking/queries.d.ts.map +1 -0
- package/dist/locking/queries.js +255 -0
- package/dist/locking/queries.js.map +1 -0
- package/dist/locking/section-lock.d.ts +74 -0
- package/dist/locking/section-lock.d.ts.map +1 -0
- package/dist/locking/section-lock.js +207 -0
- package/dist/locking/section-lock.js.map +1 -0
- package/dist/locking/task-lock.d.ts +92 -0
- package/dist/locking/task-lock.d.ts.map +1 -0
- package/dist/locking/task-lock.js +246 -0
- package/dist/locking/task-lock.js.map +1 -0
- package/dist/migrations/index.d.ts +7 -0
- package/dist/migrations/index.d.ts.map +1 -0
- package/dist/migrations/index.js +37 -0
- package/dist/migrations/index.js.map +1 -0
- package/dist/migrations/manifest.d.ts +92 -0
- package/dist/migrations/manifest.d.ts.map +1 -0
- package/dist/migrations/manifest.js +270 -0
- package/dist/migrations/manifest.js.map +1 -0
- package/dist/migrations/runner.d.ts +84 -0
- package/dist/migrations/runner.d.ts.map +1 -0
- package/dist/migrations/runner.js +351 -0
- package/dist/migrations/runner.js.map +1 -0
- package/dist/orchestrator/coder.d.ts +32 -0
- package/dist/orchestrator/coder.d.ts.map +1 -0
- package/dist/orchestrator/coder.js +174 -0
- package/dist/orchestrator/coder.js.map +1 -0
- package/dist/orchestrator/coordinator.d.ts +28 -0
- package/dist/orchestrator/coordinator.d.ts.map +1 -0
- package/dist/orchestrator/coordinator.js +256 -0
- package/dist/orchestrator/coordinator.js.map +1 -0
- package/dist/orchestrator/reviewer.d.ts +35 -0
- package/dist/orchestrator/reviewer.d.ts.map +1 -0
- package/dist/orchestrator/reviewer.js +241 -0
- package/dist/orchestrator/reviewer.js.map +1 -0
- package/dist/orchestrator/task-selector.d.ts +102 -0
- package/dist/orchestrator/task-selector.d.ts.map +1 -0
- package/dist/orchestrator/task-selector.js +341 -0
- package/dist/orchestrator/task-selector.js.map +1 -0
- package/dist/prompts/coder.d.ts +36 -0
- package/dist/prompts/coder.d.ts.map +1 -0
- package/dist/prompts/coder.js +315 -0
- package/dist/prompts/coder.js.map +1 -0
- package/dist/prompts/prompt-helpers.d.ts +51 -0
- package/dist/prompts/prompt-helpers.d.ts.map +1 -0
- package/dist/prompts/prompt-helpers.js +312 -0
- package/dist/prompts/prompt-helpers.js.map +1 -0
- package/dist/prompts/reviewer.d.ts +40 -0
- package/dist/prompts/reviewer.d.ts.map +1 -0
- package/dist/prompts/reviewer.js +438 -0
- package/dist/prompts/reviewer.js.map +1 -0
- package/dist/providers/api-models.d.ts +65 -0
- package/dist/providers/api-models.d.ts.map +1 -0
- package/dist/providers/api-models.js +323 -0
- package/dist/providers/api-models.js.map +1 -0
- package/dist/providers/claude.d.ts +53 -0
- package/dist/providers/claude.d.ts.map +1 -0
- package/dist/providers/claude.js +229 -0
- package/dist/providers/claude.js.map +1 -0
- package/dist/providers/codex.d.ts +53 -0
- package/dist/providers/codex.d.ts.map +1 -0
- package/dist/providers/codex.js +214 -0
- package/dist/providers/codex.js.map +1 -0
- package/dist/providers/gemini.d.ts +58 -0
- package/dist/providers/gemini.d.ts.map +1 -0
- package/dist/providers/gemini.js +242 -0
- package/dist/providers/gemini.js.map +1 -0
- package/dist/providers/index.d.ts +13 -0
- package/dist/providers/index.d.ts.map +1 -0
- package/dist/providers/index.js +49 -0
- package/dist/providers/index.js.map +1 -0
- package/dist/providers/interface.d.ts +173 -0
- package/dist/providers/interface.d.ts.map +1 -0
- package/dist/providers/interface.js +96 -0
- package/dist/providers/interface.js.map +1 -0
- package/dist/providers/invocation-logger.d.ts +114 -0
- package/dist/providers/invocation-logger.d.ts.map +1 -0
- package/dist/providers/invocation-logger.js +298 -0
- package/dist/providers/invocation-logger.js.map +1 -0
- package/dist/providers/openai.d.ts +53 -0
- package/dist/providers/openai.d.ts.map +1 -0
- package/dist/providers/openai.js +232 -0
- package/dist/providers/openai.js.map +1 -0
- package/dist/providers/registry.d.ts +100 -0
- package/dist/providers/registry.d.ts.map +1 -0
- package/dist/providers/registry.js +178 -0
- package/dist/providers/registry.js.map +1 -0
- package/dist/runners/activity-log.d.ts +65 -0
- package/dist/runners/activity-log.d.ts.map +1 -0
- package/dist/runners/activity-log.js +148 -0
- package/dist/runners/activity-log.js.map +1 -0
- package/dist/runners/cron.d.ts +26 -0
- package/dist/runners/cron.d.ts.map +1 -0
- package/dist/runners/cron.js +176 -0
- package/dist/runners/cron.js.map +1 -0
- package/dist/runners/daemon.d.ts +71 -0
- package/dist/runners/daemon.d.ts.map +1 -0
- package/dist/runners/daemon.js +245 -0
- package/dist/runners/daemon.js.map +1 -0
- package/dist/runners/global-db.d.ts +31 -0
- package/dist/runners/global-db.d.ts.map +1 -0
- package/dist/runners/global-db.js +230 -0
- package/dist/runners/global-db.js.map +1 -0
- package/dist/runners/hang-detector.d.ts +38 -0
- package/dist/runners/hang-detector.d.ts.map +1 -0
- package/dist/runners/hang-detector.js +136 -0
- package/dist/runners/hang-detector.js.map +1 -0
- package/dist/runners/heartbeat.d.ts +39 -0
- package/dist/runners/heartbeat.d.ts.map +1 -0
- package/dist/runners/heartbeat.js +79 -0
- package/dist/runners/heartbeat.js.map +1 -0
- package/dist/runners/lock.d.ts +47 -0
- package/dist/runners/lock.d.ts.map +1 -0
- package/dist/runners/lock.js +150 -0
- package/dist/runners/lock.js.map +1 -0
- package/dist/runners/orchestrator-loop.d.ts +20 -0
- package/dist/runners/orchestrator-loop.d.ts.map +1 -0
- package/dist/runners/orchestrator-loop.js +285 -0
- package/dist/runners/orchestrator-loop.js.map +1 -0
- package/dist/runners/projects.d.ts +96 -0
- package/dist/runners/projects.d.ts.map +1 -0
- package/dist/runners/projects.js +255 -0
- package/dist/runners/projects.js.map +1 -0
- package/dist/runners/wakeup.d.ts +34 -0
- package/dist/runners/wakeup.d.ts.map +1 -0
- package/dist/runners/wakeup.js +291 -0
- package/dist/runners/wakeup.js.map +1 -0
- package/migrations/001_initial_schema.sql +106 -0
- package/migrations/002_add_commit_sha.sql +12 -0
- package/migrations/003_add_section_priority.sql +13 -0
- package/migrations/004_add_section_dependencies.sql +18 -0
- package/migrations/005_add_audit_actor_model.sql +10 -0
- package/migrations/006_add_task_invocations.sql +33 -0
- package/migrations/007_add_file_anchor.sql +14 -0
- package/migrations/manifest.json +62 -0
- package/package.json +49 -0
|
@@ -0,0 +1,174 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
/**
|
|
3
|
+
* Coder invocation
|
|
4
|
+
* Uses AI provider system for flexible LLM support
|
|
5
|
+
*/
|
|
6
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
7
|
+
exports.invokeCoder = invokeCoder;
|
|
8
|
+
exports.invokeCoderBatch = invokeCoderBatch;
|
|
9
|
+
const node_fs_1 = require("node:fs");
|
|
10
|
+
const node_os_1 = require("node:os");
|
|
11
|
+
const node_path_1 = require("node:path");
|
|
12
|
+
const queries_js_1 = require("../database/queries.js");
|
|
13
|
+
const connection_js_1 = require("../database/connection.js");
|
|
14
|
+
const coder_js_1 = require("../prompts/coder.js");
|
|
15
|
+
const status_js_1 = require("../git/status.js");
|
|
16
|
+
const loader_js_1 = require("../config/loader.js");
|
|
17
|
+
const registry_js_1 = require("../providers/registry.js");
|
|
18
|
+
const invocation_logger_js_1 = require("../providers/invocation-logger.js");
|
|
19
|
+
/**
|
|
20
|
+
* Write prompt to temp file
|
|
21
|
+
*/
|
|
22
|
+
function writePromptToTempFile(prompt) {
|
|
23
|
+
const tempPath = (0, node_path_1.join)((0, node_os_1.tmpdir)(), `steroids-prompt-${Date.now()}.txt`);
|
|
24
|
+
(0, node_fs_1.writeFileSync)(tempPath, prompt, 'utf-8');
|
|
25
|
+
return tempPath;
|
|
26
|
+
}
|
|
27
|
+
/**
|
|
28
|
+
* Invoke AI provider with prompt
|
|
29
|
+
* Uses configuration to determine which provider to use
|
|
30
|
+
*/
|
|
31
|
+
async function invokeProvider(promptFile, timeoutMs = 900_000, // 15 minutes default
|
|
32
|
+
taskId, projectPath) {
|
|
33
|
+
// Load configuration to get coder provider settings
|
|
34
|
+
// Project config overrides global config
|
|
35
|
+
const config = (0, loader_js_1.loadConfig)(projectPath);
|
|
36
|
+
const coderConfig = config.ai?.coder;
|
|
37
|
+
if (!coderConfig?.provider || !coderConfig?.model) {
|
|
38
|
+
throw new Error('Coder AI provider not configured. Run "steroids config ai coder" to configure.');
|
|
39
|
+
}
|
|
40
|
+
// Get the provider from registry
|
|
41
|
+
const registry = (0, registry_js_1.getProviderRegistry)();
|
|
42
|
+
const provider = registry.get(coderConfig.provider);
|
|
43
|
+
// Check if provider is available
|
|
44
|
+
if (!(await provider.isAvailable())) {
|
|
45
|
+
throw new Error(`Provider '${coderConfig.provider}' is not available. ` +
|
|
46
|
+
`Ensure the CLI is installed and in PATH.`);
|
|
47
|
+
}
|
|
48
|
+
// Read prompt content
|
|
49
|
+
const promptContent = require('fs').readFileSync(promptFile, 'utf-8');
|
|
50
|
+
// Invoke the provider
|
|
51
|
+
const result = await provider.invoke(promptContent, {
|
|
52
|
+
model: coderConfig.model,
|
|
53
|
+
timeout: timeoutMs,
|
|
54
|
+
cwd: process.cwd(),
|
|
55
|
+
promptFile,
|
|
56
|
+
role: 'coder',
|
|
57
|
+
streamOutput: true,
|
|
58
|
+
});
|
|
59
|
+
// Log the invocation (to both file and database)
|
|
60
|
+
(0, invocation_logger_js_1.logInvocation)(promptContent, result, {
|
|
61
|
+
role: 'coder',
|
|
62
|
+
provider: coderConfig.provider,
|
|
63
|
+
model: coderConfig.model,
|
|
64
|
+
taskId,
|
|
65
|
+
projectPath,
|
|
66
|
+
});
|
|
67
|
+
return {
|
|
68
|
+
success: result.success,
|
|
69
|
+
exitCode: result.exitCode,
|
|
70
|
+
stdout: result.stdout,
|
|
71
|
+
stderr: result.stderr,
|
|
72
|
+
duration: result.duration,
|
|
73
|
+
timedOut: result.timedOut,
|
|
74
|
+
};
|
|
75
|
+
}
|
|
76
|
+
/**
|
|
77
|
+
* Invoke coder for a task
|
|
78
|
+
* @param coordinatorGuidance Optional guidance from coordinator after repeated rejections
|
|
79
|
+
*/
|
|
80
|
+
async function invokeCoder(task, projectPath, action, coordinatorGuidance) {
|
|
81
|
+
// Load config to show provider/model being used
|
|
82
|
+
const config = (0, loader_js_1.loadConfig)(projectPath);
|
|
83
|
+
const coderConfig = config.ai?.coder;
|
|
84
|
+
console.log(`\n${'='.repeat(60)}`);
|
|
85
|
+
console.log(`CODER: ${task.title}`);
|
|
86
|
+
console.log(`Action: ${action}`);
|
|
87
|
+
console.log(`Task ID: ${task.id}`);
|
|
88
|
+
console.log(`Provider: ${coderConfig?.provider ?? 'not configured'}`);
|
|
89
|
+
console.log(`Model: ${coderConfig?.model ?? 'not configured'}`);
|
|
90
|
+
if (coordinatorGuidance) {
|
|
91
|
+
console.log(`Coordinator guidance: included (${coordinatorGuidance.length} chars)`);
|
|
92
|
+
}
|
|
93
|
+
console.log(`${'='.repeat(60)}\n`);
|
|
94
|
+
// Fetch rejection history so coder can see past attempts
|
|
95
|
+
let rejectionHistory = [];
|
|
96
|
+
try {
|
|
97
|
+
const { db, close } = (0, connection_js_1.openDatabase)(projectPath);
|
|
98
|
+
rejectionHistory = (0, queries_js_1.getTaskRejections)(db, task.id);
|
|
99
|
+
if (rejectionHistory.length > 0) {
|
|
100
|
+
console.log(`Found ${rejectionHistory.length} previous rejection(s) - coder will see full history`);
|
|
101
|
+
}
|
|
102
|
+
close();
|
|
103
|
+
}
|
|
104
|
+
catch (error) {
|
|
105
|
+
console.warn('Could not fetch rejection history:', error);
|
|
106
|
+
}
|
|
107
|
+
const context = {
|
|
108
|
+
task,
|
|
109
|
+
projectPath,
|
|
110
|
+
previousStatus: task.status,
|
|
111
|
+
rejectionHistory,
|
|
112
|
+
coordinatorGuidance,
|
|
113
|
+
};
|
|
114
|
+
let prompt;
|
|
115
|
+
if (action === 'resume') {
|
|
116
|
+
// Get git status for resuming prompt
|
|
117
|
+
context.gitStatus = (0, status_js_1.getGitStatus)(projectPath);
|
|
118
|
+
context.gitDiff = (0, status_js_1.getGitDiff)(projectPath);
|
|
119
|
+
prompt = (0, coder_js_1.generateResumingCoderPrompt)(context);
|
|
120
|
+
}
|
|
121
|
+
else {
|
|
122
|
+
prompt = (0, coder_js_1.generateCoderPrompt)(context);
|
|
123
|
+
}
|
|
124
|
+
// Write prompt to temp file
|
|
125
|
+
const promptFile = writePromptToTempFile(prompt);
|
|
126
|
+
try {
|
|
127
|
+
const result = await invokeProvider(promptFile, 900_000, task.id, projectPath);
|
|
128
|
+
console.log(`\n${'='.repeat(60)}`);
|
|
129
|
+
console.log(`CODER COMPLETED`);
|
|
130
|
+
console.log(`Exit code: ${result.exitCode}`);
|
|
131
|
+
console.log(`Duration: ${(result.duration / 1000).toFixed(1)}s`);
|
|
132
|
+
console.log(`${'='.repeat(60)}\n`);
|
|
133
|
+
return result;
|
|
134
|
+
}
|
|
135
|
+
finally {
|
|
136
|
+
// Clean up temp file
|
|
137
|
+
if ((0, node_fs_1.existsSync)(promptFile)) {
|
|
138
|
+
(0, node_fs_1.unlinkSync)(promptFile);
|
|
139
|
+
}
|
|
140
|
+
}
|
|
141
|
+
}
|
|
142
|
+
/**
|
|
143
|
+
* Invoke coder for a batch of tasks
|
|
144
|
+
*/
|
|
145
|
+
async function invokeCoderBatch(tasks, sectionName, projectPath) {
|
|
146
|
+
// Load config to show provider/model being used
|
|
147
|
+
const config = (0, loader_js_1.loadConfig)(projectPath);
|
|
148
|
+
const coderConfig = config.ai?.coder;
|
|
149
|
+
console.log(`\n${'='.repeat(60)}`);
|
|
150
|
+
console.log(`BATCH CODER: Section "${sectionName}"`);
|
|
151
|
+
console.log(`Tasks: ${tasks.length}`);
|
|
152
|
+
tasks.forEach((t, i) => console.log(` ${i + 1}. ${t.title} (${t.id})`));
|
|
153
|
+
console.log(`Provider: ${coderConfig?.provider ?? 'not configured'}`);
|
|
154
|
+
console.log(`Model: ${coderConfig?.model ?? 'not configured'}`);
|
|
155
|
+
console.log(`${'='.repeat(60)}\n`);
|
|
156
|
+
const prompt = (0, coder_js_1.generateBatchCoderPrompt)({ tasks, projectPath, sectionName });
|
|
157
|
+
const promptFile = writePromptToTempFile(prompt);
|
|
158
|
+
try {
|
|
159
|
+
// Longer timeout for batch: base 30 minutes + 5 minutes per task
|
|
160
|
+
const timeoutMs = 30 * 60 * 1000 + tasks.length * 5 * 60 * 1000;
|
|
161
|
+
const result = await invokeProvider(promptFile, timeoutMs, undefined, projectPath);
|
|
162
|
+
console.log(`\n${'='.repeat(60)}`);
|
|
163
|
+
console.log(`BATCH CODER COMPLETED`);
|
|
164
|
+
console.log(`Duration: ${(result.duration / 1000).toFixed(1)}s`);
|
|
165
|
+
console.log(`${'='.repeat(60)}\n`);
|
|
166
|
+
return { ...result, taskCount: tasks.length };
|
|
167
|
+
}
|
|
168
|
+
finally {
|
|
169
|
+
if ((0, node_fs_1.existsSync)(promptFile)) {
|
|
170
|
+
(0, node_fs_1.unlinkSync)(promptFile);
|
|
171
|
+
}
|
|
172
|
+
}
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AAM,MAAM,GAAG,MAAM,cAAc,CAAC,UAAU,EAAE,SAAS,EAAE,SAAS,EAAE,WAAW,CAAC,CAAC;QAEnF,OAAO,CAAC,GAAG,CAAC,KAAK,GAAG,CAAC,MAAM,CAAC,EAAE,CAAC,EAAE,CAAC,CAAC;QACnC,OAAO,CAAC,GAAG,CAAC,uBAAuB,CAAC,CAAC;QACrC,OAAO,CAAC,GAAG,CAAC,aAAa,CAAC,MAAM,CAAC,QAAQ,GAAG,IAAI,CAAC,CAAC,OAAO,CAAC,CAAC,CAAC,GAAG,CAAC,CAAC;QACjE,OAAO,CAAC,GAAG,CAAC,GAAG,GAAG,CAAC,MAAM,CAAC,EAAE,CAAC,IAAI,CAAC,CAAC;QAEnC,OAAO,EAAE,GAAG,MAAM,EAAE,SAAS,EAAE,KAAK,CAAC,MAAM,EAAE,CAAC;IAChD,CAAC;YAAS,CAAC;QACT,IAAI,IAAA,oBAAU,EAAC,UAAU,CAAC,EAAE,CAAC;YAC3B,IAAA,oBAAU,EAAC,UAAU,CAAC,CAAC;QACzB,CAAC;IACH,CAAC;AACH,CAAC"}
|
|
@@ -0,0 +1,28 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Coordinator intervention
|
|
3
|
+
* Steps in after repeated rejections to break deadlocks
|
|
4
|
+
* Uses the orchestrator AI config to analyze rejection patterns
|
|
5
|
+
* and provide actionable guidance to the coder
|
|
6
|
+
*/
|
|
7
|
+
import type { Task, RejectionEntry } from '../database/queries.js';
|
|
8
|
+
export interface CoordinatorContext {
|
|
9
|
+
sectionTasks?: {
|
|
10
|
+
id: string;
|
|
11
|
+
title: string;
|
|
12
|
+
status: string;
|
|
13
|
+
}[];
|
|
14
|
+
submissionNotes?: string | null;
|
|
15
|
+
gitDiffSummary?: string;
|
|
16
|
+
previousGuidance?: string;
|
|
17
|
+
}
|
|
18
|
+
export interface CoordinatorResult {
|
|
19
|
+
success: boolean;
|
|
20
|
+
guidance: string;
|
|
21
|
+
decision: 'guide_coder' | 'override_reviewer' | 'narrow_scope';
|
|
22
|
+
}
|
|
23
|
+
/**
|
|
24
|
+
* Invoke the coordinator to analyze rejection patterns and provide guidance
|
|
25
|
+
* Returns guidance string to inject into the coder prompt, or null if coordinator unavailable
|
|
26
|
+
*/
|
|
27
|
+
export declare function invokeCoordinator(task: Task, rejectionHistory: RejectionEntry[], projectPath: string, extra?: CoordinatorContext): Promise<CoordinatorResult | null>;
|
|
28
|
+
//# sourceMappingURL=coordinator.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"coordinator.d.ts","sourceRoot":"","sources":["../../src/orchestrator/coordinator.ts"],"names":[],"mappings":"AAAA;;;;;GAKG;AAKH,OAAO,KAAK,EAAE,IAAI,EAAE,cAAc,EAAE,MAAM,wBAAwB,CAAC;AAMnE,MAAM,WAAW,kBAAkB;IACjC,YAAY,CAAC,EAAE;QAAE,EAAE,EAAE,MAAM,CAAC;QAAC,KAAK,EAAE,MAAM,CAAC;QAAC,MAAM,EAAE,MAAM,CAAA;KAAE,EAAE,CAAC;IAC/D,eAAe,CAAC,EAAE,MAAM,GAAG,IAAI,CAAC;IAChC,cAAc,CAAC,EAAE,MAAM,CAAC;IACxB,gBAAgB,CAAC,EAAE,MAAM,CAAC;CAC3B;AAED,MAAM,WAAW,iBAAiB;IAChC,OAAO,EAAE,OAAO,CAAC;IACjB,QAAQ,EAAE,MAAM,CAAC;IACjB,QAAQ,EAAE,aAAa,GAAG,mBAAmB,GAAG,cAAc,CAAC;CAChE;AAoMD;;;GAGG;AACH,wBAAsB,iBAAiB,CACrC,IAAI,EAAE,IAAI,EACV,gBAAgB,EAAE,cAAc,EAAE,EAClC,WAAW,EAAE,MAAM,EACnB,KAAK,CAAC,EAAE,kBAAkB,GACzB,OAAO,CAAC,iBAAiB,GAAG,IAAI,CAAC,CAuEnC"}
|
|
@@ -0,0 +1,256 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
/**
|
|
3
|
+
* Coordinator intervention
|
|
4
|
+
* Steps in after repeated rejections to break deadlocks
|
|
5
|
+
* Uses the orchestrator AI config to analyze rejection patterns
|
|
6
|
+
* and provide actionable guidance to the coder
|
|
7
|
+
*/
|
|
8
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
9
|
+
exports.invokeCoordinator = invokeCoordinator;
|
|
10
|
+
const node_fs_1 = require("node:fs");
|
|
11
|
+
const node_os_1 = require("node:os");
|
|
12
|
+
const node_path_1 = require("node:path");
|
|
13
|
+
const loader_js_1 = require("../config/loader.js");
|
|
14
|
+
const registry_js_1 = require("../providers/registry.js");
|
|
15
|
+
const invocation_logger_js_1 = require("../providers/invocation-logger.js");
|
|
16
|
+
const prompt_helpers_js_1 = require("../prompts/prompt-helpers.js");
|
|
17
|
+
/**
|
|
18
|
+
* Generate the coordinator prompt
|
|
19
|
+
* The coordinator reviews rejection history and MUST provide a path forward
|
|
20
|
+
* Gets full project context: architecture, spec, and user-facing perspective
|
|
21
|
+
*/
|
|
22
|
+
function generateCoordinatorPrompt(task, rejectionHistory, projectPath, extra) {
|
|
23
|
+
const rejectionSummary = rejectionHistory.map(r => `### Rejection #${r.rejection_number}
|
|
24
|
+
${r.notes || '(no notes)'}
|
|
25
|
+
`).join('\n---\n');
|
|
26
|
+
// Pull in project context so coordinator understands the bigger picture
|
|
27
|
+
const agentsMd = (0, prompt_helpers_js_1.getAgentsMd)(projectPath);
|
|
28
|
+
const specContent = (0, prompt_helpers_js_1.getSourceFileContent)(projectPath, task.source_file);
|
|
29
|
+
// Build optional context sections
|
|
30
|
+
const sectionTasksSection = extra?.sectionTasks && extra.sectionTasks.length > 1
|
|
31
|
+
? `
|
|
32
|
+
---
|
|
33
|
+
|
|
34
|
+
## Other Tasks in This Section
|
|
35
|
+
|
|
36
|
+
This task is part of a group. Other tasks handle related work - don't demand this task does their job:
|
|
37
|
+
${extra.sectionTasks.filter(t => t.id !== task.id).map(t => `- [${t.status}] ${t.title}`).join('\n')}
|
|
38
|
+
`
|
|
39
|
+
: '';
|
|
40
|
+
const submissionNotesSection = extra?.submissionNotes
|
|
41
|
+
? `
|
|
42
|
+
---
|
|
43
|
+
|
|
44
|
+
## Coder's Latest Submission Notes
|
|
45
|
+
|
|
46
|
+
> ${extra.submissionNotes}
|
|
47
|
+
`
|
|
48
|
+
: '';
|
|
49
|
+
const diffSection = extra?.gitDiffSummary
|
|
50
|
+
? `
|
|
51
|
+
---
|
|
52
|
+
|
|
53
|
+
## What The Coder Actually Changed (Latest Attempt)
|
|
54
|
+
|
|
55
|
+
\`\`\`
|
|
56
|
+
${extra.gitDiffSummary}
|
|
57
|
+
\`\`\`
|
|
58
|
+
`
|
|
59
|
+
: '';
|
|
60
|
+
// Previous coordinator guidance section (prevents repeating itself)
|
|
61
|
+
const previousGuidanceSection = extra?.previousGuidance
|
|
62
|
+
? `
|
|
63
|
+
---
|
|
64
|
+
|
|
65
|
+
## Your Previous Guidance
|
|
66
|
+
|
|
67
|
+
You previously provided this guidance for this task:
|
|
68
|
+
|
|
69
|
+
> ${extra.previousGuidance.substring(0, 500)}${extra.previousGuidance.length > 500 ? '...' : ''}
|
|
70
|
+
|
|
71
|
+
**Do NOT repeat the same guidance.** If the previous guidance didn't work, provide a DIFFERENT approach.
|
|
72
|
+
`
|
|
73
|
+
: '';
|
|
74
|
+
return `# COORDINATOR INTERVENTION
|
|
75
|
+
|
|
76
|
+
You are a COORDINATOR in a fully automated task system with NO human in the loop.
|
|
77
|
+
A task has been rejected ${rejectionHistory.length} times. You MUST provide a decision that moves the task forward.
|
|
78
|
+
|
|
79
|
+
**Your job is to MAKE A DECISION, not to escalate.** There is no human to escalate to.
|
|
80
|
+
|
|
81
|
+
**IMPORTANT: Your guidance will be sent to BOTH the coder AND the reviewer.**
|
|
82
|
+
- The coder will follow your guidance when implementing fixes
|
|
83
|
+
- The reviewer will see your decision and must respect it (especially override_reviewer decisions)
|
|
84
|
+
|
|
85
|
+
---
|
|
86
|
+
|
|
87
|
+
## Task Information
|
|
88
|
+
|
|
89
|
+
**Task ID:** ${task.id}
|
|
90
|
+
**Title:** ${task.title}
|
|
91
|
+
**Rejection Count:** ${task.rejection_count}/15
|
|
92
|
+
**Project:** ${projectPath}
|
|
93
|
+
|
|
94
|
+
---
|
|
95
|
+
|
|
96
|
+
## Task Specification (The Brief)
|
|
97
|
+
|
|
98
|
+
From: ${task.source_file ?? '(not specified)'}
|
|
99
|
+
|
|
100
|
+
${specContent}
|
|
101
|
+
|
|
102
|
+
---
|
|
103
|
+
|
|
104
|
+
## Project Architecture & Best Practices
|
|
105
|
+
|
|
106
|
+
${agentsMd}
|
|
107
|
+
|
|
108
|
+
---
|
|
109
|
+
|
|
110
|
+
## Full Rejection History
|
|
111
|
+
|
|
112
|
+
${rejectionSummary}
|
|
113
|
+
${sectionTasksSection}${submissionNotesSection}${diffSection}${previousGuidanceSection}
|
|
114
|
+
---
|
|
115
|
+
|
|
116
|
+
## Your Decision Framework
|
|
117
|
+
|
|
118
|
+
When making your decision, always consider:
|
|
119
|
+
|
|
120
|
+
1. **Architecture** - Does the coder's approach follow the project's established patterns and best practices (see above)?
|
|
121
|
+
2. **The brief** - Does the implementation actually deliver what the specification asks for?
|
|
122
|
+
3. **User value** - Will this be usable and useful for the end user? Don't get bogged down in technical perfection at the expense of shipping.
|
|
123
|
+
4. **Scope** - Is the reviewer asking for things outside this single task's responsibility?
|
|
124
|
+
|
|
125
|
+
---
|
|
126
|
+
|
|
127
|
+
## Your Analysis
|
|
128
|
+
|
|
129
|
+
1. **Is there a pattern?** Are the same issues raised repeatedly?
|
|
130
|
+
2. **Is the feedback achievable?** Can the coder do what the reviewer asks within THIS task's scope?
|
|
131
|
+
3. **Is there a scope mismatch?** Is the reviewer demanding work outside this task (e.g., global coverage)?
|
|
132
|
+
4. **Is there a design disagreement?** Different architectural assumptions?
|
|
133
|
+
|
|
134
|
+
---
|
|
135
|
+
|
|
136
|
+
## Your Response Format
|
|
137
|
+
|
|
138
|
+
DECISION: (one of: guide_coder | override_reviewer | narrow_scope)
|
|
139
|
+
|
|
140
|
+
- **guide_coder** - The reviewer is right but the coder needs clearer direction
|
|
141
|
+
- **override_reviewer** - The reviewer is asking for something out of scope or impossible; tell the coder what to ignore
|
|
142
|
+
- **narrow_scope** - Both have valid points; narrow the task scope to what's achievable
|
|
143
|
+
|
|
144
|
+
GUIDANCE:
|
|
145
|
+
(Your specific guidance. This will be shown to BOTH the coder AND the reviewer. Be concrete:
|
|
146
|
+
- Which files to modify and what changes to make
|
|
147
|
+
- What reviewer feedback to address vs what to ignore
|
|
148
|
+
- If using override_reviewer: explicitly list which reviewer demands the coder should IGNORE
|
|
149
|
+
- If using narrow_scope: explicitly describe the NARROWED scope the reviewer should evaluate against
|
|
150
|
+
- If the reviewer demands global metrics, state clearly that this is out of scope
|
|
151
|
+
- If there's a design disagreement, pick the approach that best fits the project architecture
|
|
152
|
+
- Give the coder a clear path to get this task approved)
|
|
153
|
+
|
|
154
|
+
---
|
|
155
|
+
|
|
156
|
+
## Rules
|
|
157
|
+
|
|
158
|
+
- You MUST provide guidance that unblocks the task. "Try again" is not guidance.
|
|
159
|
+
- If the reviewer demands global project metrics from a single task, tell the coder to ignore that demand
|
|
160
|
+
- If there's a design disagreement, PICK the approach that matches the project's architecture and tell the coder to follow it
|
|
161
|
+
- If the same feedback appeared 3+ times unchanged, the coder needs a fundamentally different approach - describe it
|
|
162
|
+
- Always ask: "Will this be usable for the end user?" - if the current approach works for users, don't block on technicalities
|
|
163
|
+
- Keep guidance under 500 words
|
|
164
|
+
- Focus on UNBLOCKING - the goal is to get this task approved on the next attempt
|
|
165
|
+
`;
|
|
166
|
+
}
|
|
167
|
+
/**
|
|
168
|
+
* Parse the coordinator's response
|
|
169
|
+
* Handles cases where guidance text may contain --- separators
|
|
170
|
+
*/
|
|
171
|
+
function parseCoordinatorResponse(output) {
|
|
172
|
+
// Extract decision - look for valid decision values only
|
|
173
|
+
const decisionMatch = output.match(/DECISION:\s*(guide_coder|override_reviewer|narrow_scope)/i);
|
|
174
|
+
const rawDecision = decisionMatch?.[1]?.trim().toLowerCase();
|
|
175
|
+
// Validate decision is one of the allowed values
|
|
176
|
+
const validDecisions = ['guide_coder', 'override_reviewer', 'narrow_scope'];
|
|
177
|
+
const decision = validDecisions.includes(rawDecision)
|
|
178
|
+
? rawDecision
|
|
179
|
+
: 'guide_coder';
|
|
180
|
+
// Extract guidance - everything after "GUIDANCE:" until end of output
|
|
181
|
+
// Use a greedy match since guidance is typically the last section
|
|
182
|
+
const guidanceMatch = output.match(/GUIDANCE:\s*([\s\S]+)$/i);
|
|
183
|
+
let guidance = guidanceMatch?.[1]?.trim() || output.trim();
|
|
184
|
+
// Strip trailing section markers that might be from prompt template leaking
|
|
185
|
+
guidance = guidance.replace(/\n## Rules[\s\S]*$/i, '').trim();
|
|
186
|
+
return {
|
|
187
|
+
success: true,
|
|
188
|
+
guidance,
|
|
189
|
+
decision,
|
|
190
|
+
};
|
|
191
|
+
}
|
|
192
|
+
/**
|
|
193
|
+
* Invoke the coordinator to analyze rejection patterns and provide guidance
|
|
194
|
+
* Returns guidance string to inject into the coder prompt, or null if coordinator unavailable
|
|
195
|
+
*/
|
|
196
|
+
async function invokeCoordinator(task, rejectionHistory, projectPath, extra) {
|
|
197
|
+
const config = (0, loader_js_1.loadConfig)(projectPath);
|
|
198
|
+
const orchestratorConfig = config.ai?.orchestrator;
|
|
199
|
+
// If no orchestrator configured, fall back to reviewer config
|
|
200
|
+
const providerName = orchestratorConfig?.provider || config.ai?.reviewer?.provider;
|
|
201
|
+
const modelName = orchestratorConfig?.model || config.ai?.reviewer?.model;
|
|
202
|
+
if (!providerName || !modelName) {
|
|
203
|
+
console.warn('No orchestrator or reviewer AI configured - skipping coordinator intervention');
|
|
204
|
+
return null;
|
|
205
|
+
}
|
|
206
|
+
console.log(`\n${'='.repeat(60)}`);
|
|
207
|
+
console.log(`COORDINATOR: Analyzing rejections for "${task.title}"`);
|
|
208
|
+
console.log(`Rejection count: ${task.rejection_count}`);
|
|
209
|
+
console.log(`Provider: ${providerName} / ${modelName}`);
|
|
210
|
+
console.log(`${'='.repeat(60)}\n`);
|
|
211
|
+
const registry = (0, registry_js_1.getProviderRegistry)();
|
|
212
|
+
const provider = registry.get(providerName);
|
|
213
|
+
if (!(await provider.isAvailable())) {
|
|
214
|
+
console.warn(`Coordinator provider '${providerName}' not available - skipping`);
|
|
215
|
+
return null;
|
|
216
|
+
}
|
|
217
|
+
const prompt = generateCoordinatorPrompt(task, rejectionHistory, projectPath, extra);
|
|
218
|
+
// Write prompt to temp file
|
|
219
|
+
const tempPath = (0, node_path_1.join)((0, node_os_1.tmpdir)(), `steroids-coordinator-${Date.now()}.txt`);
|
|
220
|
+
(0, node_fs_1.writeFileSync)(tempPath, prompt, 'utf-8');
|
|
221
|
+
try {
|
|
222
|
+
const result = await provider.invoke(prompt, {
|
|
223
|
+
model: modelName,
|
|
224
|
+
timeout: 300_000, // 5 minutes for coordinator
|
|
225
|
+
cwd: projectPath,
|
|
226
|
+
promptFile: tempPath,
|
|
227
|
+
role: 'orchestrator',
|
|
228
|
+
streamOutput: false,
|
|
229
|
+
});
|
|
230
|
+
// Log the invocation
|
|
231
|
+
(0, invocation_logger_js_1.logInvocation)(prompt, result, {
|
|
232
|
+
role: 'orchestrator',
|
|
233
|
+
provider: providerName,
|
|
234
|
+
model: modelName,
|
|
235
|
+
taskId: task.id,
|
|
236
|
+
projectPath,
|
|
237
|
+
});
|
|
238
|
+
if (!result.success) {
|
|
239
|
+
console.warn('Coordinator invocation failed - continuing without guidance');
|
|
240
|
+
return null;
|
|
241
|
+
}
|
|
242
|
+
const parsed = parseCoordinatorResponse(result.stdout);
|
|
243
|
+
console.log(`\n${'='.repeat(60)}`);
|
|
244
|
+
console.log('COORDINATOR RESULT');
|
|
245
|
+
console.log(`Decision: ${parsed.decision}`);
|
|
246
|
+
console.log(`Guidance length: ${parsed.guidance.length} chars`);
|
|
247
|
+
console.log(`${'='.repeat(60)}\n`);
|
|
248
|
+
return parsed;
|
|
249
|
+
}
|
|
250
|
+
finally {
|
|
251
|
+
if ((0, node_fs_1.existsSync)(tempPath)) {
|
|
252
|
+
(0, node_fs_1.unlinkSync)(tempPath);
|
|
253
|
+
}
|
|
254
|
+
}
|
|
255
|
+
}
|
|
256
|
+
//# sourceMappingURL=coordinator.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"coordinator.js","sourceRoot":"","sources":["../../src/orchestrator/coordinator.ts"],"names":[],"mappings":";AAAA;;;;;GAKG;;AA8NH,8CA4EC;AAxSD,qCAAgE;AAChE,qCAAiC;AACjC,yCAAiC;AAEjC,mDAAiD;AACjD,0DAA+D;AAC/D,4EAAkE;AAClE,oEAAiF;AAejF;;;;GAIG;AACH,SAAS,yBAAyB,CAChC,IAAU,EACV,gBAAkC,EAClC,WAAmB,EACnB,KAA0B;IAE1B,MAAM,gBAAgB,GAAG,gBAAgB,CAAC,GAAG,CAAC,CAAC,CAAC,EAAE,CAChD,kBAAkB,CAAC,CAAC,gBAAgB;EACtC,CAAC,CAAC,KAAK,IAAI,YAAY;CACxB,CACE,CAAC,IAAI,CAAC,SAAS,CAAC,CAAC;IAElB,wEAAwE;IACxE,MAAM,QAAQ,GAAG,IAAA,+BAAW,EAAC,WAAW,CAAC,CAAC;IAC1C,MAAM,WAAW,GAAG,IAAA,wCAAoB,EAAC,WAAW,EAAE,IAAI,CAAC,WAAW,CAAC,CAAC;IAExE,kCAAkC;IAClC,MAAM,mBAAmB,GAAG,KAAK,EAAE,YAAY,IAAI,KAAK,CAAC,YAAY,CAAC,MAAM,GAAG,CAAC;QAC9E,CAAC,CAAC;;;;;;EAMJ,KAAK,CAAC,YAAY,CAAC,MAAM,CAAC,CAAC,CAAC,EAAE,CAAC,CAAC,CAAC,EAAE,KAAK,IAAI,CAAC,EAAE,CAAC,CAAC,GAAG,CAAC,CAAC,CAAC,EAAE,CAAC,MAAM,CAAC,CAAC,MAAM,KAAK,CAAC,CAAC,KAAK,EAAE,CAAC,CAAC,IAA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EAAC,MAAM,EAAE,MAAM,EAAE;YAC5B,IAAI,EAAE,cAAc;YACpB,QAAQ,EAAE,YAAY;YACtB,KAAK,EAAE,SAAS;YAChB,MAAM,EAAE,IAAI,CAAC,EAAE;YACf,WAAW;SACZ,CAAC,CAAC;QAEH,IAAI,CAAC,MAAM,CAAC,OAAO,EAAE,CAAC;YACpB,OAAO,CAAC,IAAI,CAAC,6DAA6D,CAAC,CAAC;YAC5E,OAAO,IAAI,CAAC;QACd,CAAC;QAED,MAAM,MAAM,GAAG,wBAAwB,CAAC,MAAM,CAAC,MAAM,CAAC,CAAC;QAEvD,OAAO,CAAC,GAAG,CAAC,KAAK,GAAG,CAAC,MAAM,CAAC,EAAE,CAAC,EAAE,CAAC,CAAC;QACnC,OAAO,CAAC,GAAG,CAAC,oBAAoB,CAAC,CAAC;QAClC,OAAO,CAAC,GAAG,CAAC,aAAa,MAAM,CAAC,QAAQ,EAAE,CAAC,CAAC;QAC5C,OAAO,CAAC,GAAG,CAAC,oBAAoB,MAAM,CAAC,QAAQ,CAAC,MAAM,QAAQ,CAAC,CAAC;QAChE,OAAO,CAAC,GAAG,CAAC,GAAG,GAAG,CAAC,MAAM,CAAC,EAAE,CAAC,IAAI,CAAC,CAAC;QAEnC,OAAO,MAAM,CAAC;IAChB,CAAC;YAAS,CAAC;QACT,IAAI,IAAA,oBAAU,EAAC,QAAQ,CAAC,EAAE,CAAC;YACzB,IAAA,oBAAU,EAAC,QAAQ,CAAC,CAAC;QACvB,CAAC;IACH,CAAC;AACH,CAAC"}
|
|
@@ -0,0 +1,35 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Reviewer invocation
|
|
3
|
+
* Uses AI provider system for flexible LLM support
|
|
4
|
+
*/
|
|
5
|
+
import type { Task } from '../database/queries.js';
|
|
6
|
+
export interface ReviewerResult {
|
|
7
|
+
success: boolean;
|
|
8
|
+
exitCode: number;
|
|
9
|
+
stdout: string;
|
|
10
|
+
stderr: string;
|
|
11
|
+
duration: number;
|
|
12
|
+
timedOut: boolean;
|
|
13
|
+
decision?: 'approve' | 'reject' | 'dispute';
|
|
14
|
+
notes?: string;
|
|
15
|
+
}
|
|
16
|
+
export interface BatchReviewerResult {
|
|
17
|
+
success: boolean;
|
|
18
|
+
exitCode: number;
|
|
19
|
+
stdout: string;
|
|
20
|
+
stderr: string;
|
|
21
|
+
duration: number;
|
|
22
|
+
timedOut: boolean;
|
|
23
|
+
taskCount: number;
|
|
24
|
+
}
|
|
25
|
+
/**
|
|
26
|
+
* Invoke reviewer for a task
|
|
27
|
+
* @param coordinatorGuidance Optional guidance from coordinator after repeated rejections
|
|
28
|
+
* @param coordinatorDecision Optional decision type from coordinator
|
|
29
|
+
*/
|
|
30
|
+
export declare function invokeReviewer(task: Task, projectPath: string, coordinatorGuidance?: string, coordinatorDecision?: string): Promise<ReviewerResult>;
|
|
31
|
+
/**
|
|
32
|
+
* Invoke reviewer for a batch of tasks
|
|
33
|
+
*/
|
|
34
|
+
export declare function invokeReviewerBatch(tasks: Task[], sectionName: string, projectPath: string): Promise<BatchReviewerResult>;
|
|
35
|
+
//# sourceMappingURL=reviewer.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"reviewer.d.ts","sourceRoot":"","sources":["../../src/orchestrator/reviewer.ts"],"names":[],"mappings":"AAAA;;;GAGG;AAKH,OAAO,KAAK,EAAE,IAAI,EAAE,MAAM,wBAAwB,CAAC;AAqBnD,MAAM,WAAW,cAAc;IAC7B,OAAO,EAAE,OAAO,CAAC;IACjB,QAAQ,EAAE,MAAM,CAAC;IACjB,MAAM,EAAE,MAAM,CAAC;IACf,MAAM,EAAE,MAAM,CAAC;IACf,QAAQ,EAAE,MAAM,CAAC;IACjB,QAAQ,EAAE,OAAO,CAAC;IAClB,QAAQ,CAAC,EAAE,SAAS,GAAG,QAAQ,GAAG,SAAS,CAAC;IAC5C,KAAK,CAAC,EAAE,MAAM,CAAC;CAChB;AAED,MAAM,WAAW,mBAAmB;IAClC,OAAO,EAAE,OAAO,CAAC;IACjB,QAAQ,EAAE,MAAM,CAAC;IACjB,MAAM,EAAE,MAAM,CAAC;IACf,MAAM,EAAE,MAAM,CAAC;IACf,QAAQ,EAAE,MAAM,CAAC;IACjB,QAAQ,EAAE,OAAO,CAAC;IAClB,SAAS,EAAE,MAAM,CAAC;CACnB;AA4GD;;;;GAIG;AACH,wBAAsB,cAAc,CAClC,IAAI,EAAE,IAAI,EACV,WAAW,EAAE,MAAM,EACnB,mBAAmB,CAAC,EAAE,MAAM,EAC5B,mBAAmB,CAAC,EAAE,MAAM,GAC3B,OAAO,CAAC,cAAc,CAAC,CAsGzB;AAED;;GAEG;AACH,wBAAsB,mBAAmB,CACvC,KAAK,EAAE,IAAI,EAAE,EACb,WAAW,EAAE,MAAM,EACnB,WAAW,EAAE,MAAM,GAClB,OAAO,CAAC,mBAAmB,CAAC,CA8C9B"}
|