good!
This commit is contained in:
@@ -71,27 +71,37 @@ export async function runTask(
|
||||
|
||||
const taskHeader = `${task.id} · ${task.title}`;
|
||||
|
||||
// Live progress widget above the editor — animated spinner + tool call updates
|
||||
// Live progress widget above the editor — animated spinner + tool call tree
|
||||
// Using setWidget instead of setWorkingMessage because the working message area
|
||||
// is only visible during parent agent streaming, not during extension command execution.
|
||||
const SPINNER_FRAMES = ["⠋", "⠙", "⠹", "⠸", "⠼", "⠴", "⠦", "⠧", "⠇", "⠏"];
|
||||
let frameIndex = 0;
|
||||
let lastToolLabel = "";
|
||||
const theme = ctx.ui.theme;
|
||||
const MAX_COLLAPSED = 3;
|
||||
|
||||
const toolCalls: ToolCallEntry[] = [];
|
||||
|
||||
const updateWidget = () => {
|
||||
const frame = theme.fg("accent", SPINNER_FRAMES[frameIndex]);
|
||||
const lines = [`${frame} ${taskHeader}`];
|
||||
|
||||
if (toolCalls.length > 0) {
|
||||
lines.push(
|
||||
theme.fg(
|
||||
"dim",
|
||||
` ${toolCalls.length} tool${toolCalls.length !== 1 ? "s" : ""} · ${lastToolLabel}`,
|
||||
),
|
||||
);
|
||||
const shown = toolCalls.slice(-MAX_COLLAPSED);
|
||||
const remaining = toolCalls.length - shown.length;
|
||||
|
||||
if (remaining > 0) {
|
||||
lines.push(theme.fg("dim", ` ├── ${remaining} more`));
|
||||
}
|
||||
|
||||
for (let i = 0; i < shown.length; i++) {
|
||||
const entry = shown[i];
|
||||
const isLast = i === shown.length - 1;
|
||||
const branch = isLast ? " └── " : " ├── ";
|
||||
const tag = theme.fg("accent", `[${entry.name}]`);
|
||||
lines.push(`${branch}${tag} ${entry.label}`);
|
||||
}
|
||||
}
|
||||
|
||||
ctx.ui.setWidget("ralph-task", lines);
|
||||
};
|
||||
|
||||
@@ -119,8 +129,6 @@ export async function runTask(
|
||||
name: event.toolName,
|
||||
label,
|
||||
});
|
||||
// Update widget with latest tool call info
|
||||
lastToolLabel = `[${event.toolName}] ${label}`;
|
||||
updateWidget();
|
||||
}
|
||||
},
|
||||
|
||||
@@ -88,13 +88,38 @@ function parseFioFormat(
|
||||
}
|
||||
|
||||
if (inDeps) {
|
||||
const depMatch = line.match(/^(\d+)\s*->\s*(\d+)/);
|
||||
if (depMatch) {
|
||||
const [, from, to] = depMatch;
|
||||
// Format 2: Arrow notation with multiple targets
|
||||
// "01 -> 02,03,06 (description)" means 02, 03, 06 depend on 01
|
||||
const arrowMatch = line.match(/^(\d+)\s*->\s*([\d,\s]+?)(?:\s*\(|$)/);
|
||||
if (arrowMatch) {
|
||||
const [, from, targets] = arrowMatch;
|
||||
const fromId = `0${from}`;
|
||||
const toId = `0${to}`;
|
||||
if (!dependencies[fromId]) dependencies[fromId] = [];
|
||||
dependencies[fromId].push(toId);
|
||||
const targetIds = targets
|
||||
.split(",")
|
||||
.map((t) => t.trim())
|
||||
.filter((t) => t)
|
||||
.map((t) => `0${t}`);
|
||||
|
||||
// Each target depends on the source
|
||||
for (const toId of targetIds) {
|
||||
if (!dependencies[toId]) dependencies[toId] = [];
|
||||
dependencies[toId].push(fromId);
|
||||
}
|
||||
}
|
||||
|
||||
// Format 1: Natural language "X depends on A, B, C"
|
||||
const dependsMatch = line.match(/^(\d+)\s+depends\s+on\s+([\d,\s]+)/i);
|
||||
if (dependsMatch) {
|
||||
const [, taskId, depsList] = dependsMatch;
|
||||
const taskIdPadded = `0${taskId}`;
|
||||
const depIds = depsList
|
||||
.split(",")
|
||||
.map((t) => t.trim())
|
||||
.filter((t) => t)
|
||||
.map((t) => `0${t}`);
|
||||
|
||||
if (!dependencies[taskIdPadded]) dependencies[taskIdPadded] = [];
|
||||
dependencies[taskIdPadded].push(...depIds);
|
||||
}
|
||||
|
||||
// Parse meta blocks for task configuration (timeout, etc.)
|
||||
@@ -126,6 +151,13 @@ function parseFioFormat(
|
||||
const objectiveMatch = content.match(/^#\s+(.+)$/m);
|
||||
const objective = objectiveMatch ? objectiveMatch[1].trim() : undefined;
|
||||
|
||||
// Apply dependencies map to task.dependencies arrays
|
||||
for (const task of tasks) {
|
||||
if (dependencies[task.id]) {
|
||||
task.dependencies = dependencies[task.id];
|
||||
}
|
||||
}
|
||||
|
||||
return {
|
||||
tasks,
|
||||
dependencies,
|
||||
|
||||
Reference in New Issue
Block a user