Skip to content

A local-first multi-agent app development platform, built on PenguinHarness

1.4 KB
Raw Blame
/**
 * Completion notice of a background task (`[background_task_done]`, a harness-injected user
 * message reporting that a run_in_background command/subagent settled): a standalone card in
 * the work group's own form — collapsed it reads exactly like a settled "Done" group header
 * (same chrome, title styling, sticky pinning against the scrollport), showing only the
 * outcome label; expanded, the report body (registry handle, what ran, exit detail, output
 * tail) renders in the tool cards' output styling. The Trace page shows the raw marker text
 * as-is.
 */
import {
  DISCLOSURE_CARD_CLASS,
  DISCLOSURE_OUTPUT_PRE_CLASS,
  DisclosureRow,
  StatusIcon,
} from "@adelie/ui";
import { S } from "../../lib/strings";
import type { BackgroundTaskDone } from "./agent-handoff";

export function BackgroundDoneBanner({ done, body }: { done: BackgroundTaskDone; body: string }) {
  const state =
    done.status === "completed" ? "done" : done.status === "stopped" ? "stopped" : "failed";
  return (
    <div className={DISCLOSURE_CARD_CLASS}>
      <DisclosureRow
        variant="header"
        sticky
        icon={<StatusIcon state={state} label={done.status} />}
        label={S.chat.backgroundDone(done.kind, done.status)}
      >
        <pre className={DISCLOSURE_OUTPUT_PRE_CLASS}>{body ? `${done.id}\n${body}` : done.id}</pre>
      </DisclosureRow>
    </div>
  );
}