Compare commits

..

No commits in common. "61fac634097da78c08b784d827e94d4317b777f0" and "e1516c44c6172b7c3a6e7c7b889dd07432bc13ab" have entirely different histories.

3 changed files with 6 additions and 27 deletions

View File

@ -245,8 +245,7 @@ export class FanoutController {
} }
private getJobPreview(job: FanoutJob, maxChars = 500): string { private getJobPreview(job: FanoutJob, maxChars = 500): string {
// Use cached preview if available (updated in processOutputLine) const output = this.readJobOutput(job);
const output = job.lastPreview || this.readJobOutput(job);
if (!output) return ""; if (!output) return "";
if (output.length <= maxChars) return output; if (output.length <= maxChars) return output;
return output.slice(0, maxChars) + "\n… (truncated)"; return output.slice(0, maxChars) + "\n… (truncated)";
@ -258,7 +257,6 @@ export class FanoutController {
if (event.type === "message_end" && event.message) { if (event.type === "message_end" && event.message) {
const msg = event.message as Message; const msg = event.message as Message;
if (msg.role === "assistant") { if (msg.role === "assistant") {
// Cache latest assistant text for live preview
job.usage.turns++; job.usage.turns++;
const usage = msg.usage; const usage = msg.usage;
if (usage) { if (usage) {
@ -271,21 +269,6 @@ export class FanoutController {
if (!job.modelUsed && msg.model) job.modelUsed = msg.model; if (!job.modelUsed && msg.model) job.modelUsed = msg.model;
if (msg.stopReason) job.stopReason = msg.stopReason; if (msg.stopReason) job.stopReason = msg.stopReason;
if (msg.errorMessage) job.errorMessage = msg.errorMessage; if (msg.errorMessage) job.errorMessage = msg.errorMessage;
// Cache last assistant text output for live preview
let previewUpdated = false;
for (const part of msg.content) {
if (part.type === "text") {
job.lastPreview = part.text;
previewUpdated = true;
break;
}
}
// Persist cache to enable live previews after restart
if (previewUpdated) {
this.persist(job);
}
} }
} }
} }

View File

@ -51,7 +51,7 @@ export default function (pi: ExtensionAPI) {
promptGuidelines: [ promptGuidelines: [
"Use fanout_dispatch to run multiple agents in parallel without blocking the main session.", "Use fanout_dispatch to run multiple agents in parallel without blocking the main session.",
"After dispatching, you may do other work. Check status later with fanout_status.", "After dispatching, you may do other work. Check status later with fanout_status.",
"Completed jobs deliver their output automatically via follow-up messages. Use fanout_collect if you need the full, untruncated result or to archive old jobs.", "When jobs complete, the system will send a follow-up message. Retrieve output with fanout_collect.",
], ],
execute: async ( execute: async (
@ -126,14 +126,12 @@ export default function (pi: ExtensionAPI) {
result.jobs.length > 0 result.jobs.length > 0
? "\n\n" + ? "\n\n" +
result.jobs result.jobs
.map((j) => { .map(
let jobLine = (j) =>
`- ${j.id} | ${j.agent} | ${j.status}` + `- ${j.id} | ${j.agent} | ${j.status}` +
(j.exitCode !== undefined ? ` (exit ${j.exitCode})` : "") + (j.exitCode !== undefined ? ` (exit ${j.exitCode})` : "") +
(j.turns ? ` | ${j.turns} turns` : "") + (j.turns ? ` | ${j.turns} turns` : ""),
(j.preview ? `\n Preview: ${j.preview.slice(0, 120).replace(/\n/g, " ")}${j.preview.length > 120 ? "…" : ""}` : ""); )
return jobLine;
})
.join("\n") .join("\n")
: ""; : "";
return { return {

View File

@ -26,8 +26,6 @@ export interface FanoutJob {
usage: JobUsage; usage: JobUsage;
modelUsed?: string; modelUsed?: string;
stopReason?: string; stopReason?: string;
/** Last assistant text output seen while running (for live previews) */
lastPreview?: string;
} }
export interface DispatchResult { export interface DispatchResult {