dependency parsing broken
This commit is contained in:
@@ -2,7 +2,7 @@ import * as path from "node:path";
|
|||||||
import type { Task, Project, Reflection, ToolUsage } from "./types";
|
import type { Task, Project, Reflection, ToolUsage } from "./types";
|
||||||
import type { RalphConfig } from "./types";
|
import type { RalphConfig } from "./types";
|
||||||
import type { ProgressTracker } from "./progress";
|
import type { ProgressTracker } from "./progress";
|
||||||
import type { ExtensionCommandContext } from "@earendil-works/pi-coding-agent";
|
import type { ExtensionContext } from "@earendil-works/pi-coding-agent";
|
||||||
import { buildTaskPrompt } from "./prompts";
|
import { buildTaskPrompt } from "./prompts";
|
||||||
import { extractReflection } from "./reflection";
|
import { extractReflection } from "./reflection";
|
||||||
import {
|
import {
|
||||||
@@ -36,7 +36,7 @@ export async function runTask(
|
|||||||
project: Project,
|
project: Project,
|
||||||
config: RalphConfig,
|
config: RalphConfig,
|
||||||
depReflections: Reflection[],
|
depReflections: Reflection[],
|
||||||
ctx: ExtensionCommandContext,
|
ctx: ExtensionContext,
|
||||||
sendChatMessage?: SendChatMessage,
|
sendChatMessage?: SendChatMessage,
|
||||||
projectDir: string = project.sourceDir,
|
projectDir: string = project.sourceDir,
|
||||||
): Promise<{
|
): Promise<{
|
||||||
@@ -210,16 +210,22 @@ function saveSessionOutput(
|
|||||||
* Execute a batch of tasks (sequentially or in parallel)
|
* Execute a batch of tasks (sequentially or in parallel)
|
||||||
*/
|
*/
|
||||||
export async function executeBatch(
|
export async function executeBatch(
|
||||||
_batchIndex: number,
|
|
||||||
tasks: Task[],
|
tasks: Task[],
|
||||||
project: Project,
|
project: Project,
|
||||||
config: RalphConfig,
|
config: RalphConfig,
|
||||||
progress: ProgressTracker,
|
progress: ProgressTracker,
|
||||||
ctx: ExtensionCommandContext,
|
ctx: ExtensionContext,
|
||||||
options?: { parallel?: boolean },
|
options?: { parallel?: boolean },
|
||||||
sendChatMessage?: SendChatMessage,
|
sendChatMessage?: SendChatMessage,
|
||||||
projectDir?: string,
|
projectDir?: string,
|
||||||
): Promise<void> {
|
): Promise<void> {
|
||||||
|
// Defensive: ensure tasks is an iterable array
|
||||||
|
if (!Array.isArray(tasks)) {
|
||||||
|
throw new Error(
|
||||||
|
`executeBatch received invalid tasks: expected array, got ${typeof tasks}`,
|
||||||
|
);
|
||||||
|
}
|
||||||
|
|
||||||
// Check if we should run parallel
|
// Check if we should run parallel
|
||||||
const shouldParallel =
|
const shouldParallel =
|
||||||
options?.parallel && tasks.length > 1 && config.execution.maxParallel > 0;
|
options?.parallel && tasks.length > 1 && config.execution.maxParallel > 0;
|
||||||
@@ -259,7 +265,7 @@ async function executeBatchParallel(
|
|||||||
project: Project,
|
project: Project,
|
||||||
config: RalphConfig,
|
config: RalphConfig,
|
||||||
progress: ProgressTracker,
|
progress: ProgressTracker,
|
||||||
ctx: ExtensionCommandContext,
|
ctx: ExtensionContext,
|
||||||
sendChatMessage?: SendChatMessage,
|
sendChatMessage?: SendChatMessage,
|
||||||
projectDir?: string,
|
projectDir?: string,
|
||||||
): Promise<void> {
|
): Promise<void> {
|
||||||
@@ -300,7 +306,7 @@ async function executeTask(
|
|||||||
project: Project,
|
project: Project,
|
||||||
config: RalphConfig,
|
config: RalphConfig,
|
||||||
progress: ProgressTracker,
|
progress: ProgressTracker,
|
||||||
ctx: ExtensionCommandContext,
|
ctx: ExtensionContext,
|
||||||
sendChatMessage?: SendChatMessage,
|
sendChatMessage?: SendChatMessage,
|
||||||
projectDir: string = project.sourceDir,
|
projectDir: string = project.sourceDir,
|
||||||
): Promise<void> {
|
): Promise<void> {
|
||||||
|
|||||||
@@ -99,7 +99,7 @@ function parseFioFormat(
|
|||||||
.map((t) => t.trim())
|
.map((t) => t.trim())
|
||||||
.filter((t) => t)
|
.filter((t) => t)
|
||||||
.map((t) => `0${t}`);
|
.map((t) => `0${t}`);
|
||||||
|
|
||||||
// Each target depends on the source
|
// Each target depends on the source
|
||||||
for (const toId of targetIds) {
|
for (const toId of targetIds) {
|
||||||
if (!dependencies[toId]) dependencies[toId] = [];
|
if (!dependencies[toId]) dependencies[toId] = [];
|
||||||
@@ -117,7 +117,7 @@ function parseFioFormat(
|
|||||||
.map((t) => t.trim())
|
.map((t) => t.trim())
|
||||||
.filter((t) => t)
|
.filter((t) => t)
|
||||||
.map((t) => `0${t}`);
|
.map((t) => `0${t}`);
|
||||||
|
|
||||||
if (!dependencies[taskIdPadded]) dependencies[taskIdPadded] = [];
|
if (!dependencies[taskIdPadded]) dependencies[taskIdPadded] = [];
|
||||||
dependencies[taskIdPadded].push(...depIds);
|
dependencies[taskIdPadded].push(...depIds);
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user