Skip to content

Local-first AI coding agent desktop: Electron + Rust host core + pi Agent Harness + user-installable plugins

feat(scheduled): read one task's runs inside the Scheduled page

Hanawa925f976aefb0
diff --git a/apps/desktop/electron/main/ipc/scheduled-ipc.ts b/apps/desktop/electron/main/ipc/scheduled-ipc.ts
index e4b4d2aea..9655a5e41 100644
--- a/apps/desktop/electron/main/ipc/scheduled-ipc.ts
+++ b/apps/desktop/electron/main/ipc/scheduled-ipc.ts
@@ -18,11 +18,25 @@ export function registerScheduledIpc({
invoke,
isQuitting,
}: ScheduledIpcDependencies): void {
- registrar.handle(IPC.invoke.scheduledListRuns, async () => {
- const host = getHost();
- if (!host) throw new Error("host unavailable");
- return host.call("scheduled.listRuns", { limit: 100 });
- });
+ // The Scheduled workspace renders one task's own history, so the caller may
+ // scope the read to a single task. The host owns the 1..200 bound and the
+ // default, so the request only forwards a validated scope and limit.
+ registrar.handle(
+ IPC.invoke.scheduledListRuns,
+ async (options: { taskId?: unknown; limit?: unknown } = {}) => {
+ const host = getHost();
+ if (!host) throw new Error("host unavailable");
+ const taskId = typeof options?.taskId === "string" ? options.taskId.trim() : "";
+ const limit = options?.limit === undefined ? undefined : options.limit;
+ if (limit !== undefined && (typeof limit !== "number" || !Number.isFinite(limit))) {
+ throw new Error("invalid scheduled run limit");
+ }
+ return host.call("scheduled.listRuns", {
+ ...(taskId ? { taskId } : {}),
+ ...(limit === undefined ? {} : { limit: Math.trunc(limit) }),
+ });
+ },
+ );
registrar.handle(IPC.invoke.scheduledExecute, async (id: string, automatic = false) => {
if (typeof id !== "string" || typeof automatic !== "boolean") throw new Error("invalid task request");
const host = getHost();
diff --git a/apps/desktop/src/components/Sidebar.tsx b/apps/desktop/src/components/Sidebar.tsx
index 9eab45510..c0c332a23 100644
--- a/apps/desktop/src/components/Sidebar.tsx
+++ b/apps/desktop/src/components/Sidebar.tsx
@@ -28,6 +28,7 @@ import {
sessionArchived,
sessionPinned,
} from "../lib/sidebar-session-groups";
+import { isAutomationSession } from "../lib/session-origin";
import {
composerDropItems,
hasComposerFileDrag,
@@ -631,11 +632,14 @@ export function Sidebar({
}, [t]);
const filtered = useMemo(() => {
- const candidates = showArchived
- ? sessions
- : sessions.filter(
- (session) => !sessionArchived(session, sessionMeta[session.id]),
- );
+ // A scheduled run's transcript belongs to the Scheduled page, not to the
+ // project groups: that page's task column and run history are its entry
+ // point (issue #1291). The session stays in the store so the chat surface
+ // can still resolve its title, source, and capabilities when it is opened
+ // from there.
+ const candidates = sessions
+ .filter((session) => !isAutomationSession(session))
+ .filter((session) => showArchived || !sessionArchived(session, sessionMeta[session.id]));
// Empty sessions are durable sidebar rows now. Their message count, not
// their title, controls New Task reuse, so a manual rename never changes
// the empty-slot behavior.
diff --git a/apps/desktop/src/features/scheduled/ScheduledRunHistory.tsx b/apps/desktop/src/features/scheduled/ScheduledRunHistory.tsx
new file mode 100644
index 000000000..f670c90cb
--- /dev/null
+++ b/apps/desktop/src/features/scheduled/ScheduledRunHistory.tsx
@@ -0,0 +1,110 @@
+import { useTranslation } from "react-i18next";
+import type { ScheduledTaskRun } from "@pi-desktop/shared";
+import { TooltipButton, cx } from "../../components/ui";
+import {
+ IconChevronDown,
+ IconCircleAlert,
+ IconCircleCheck,
+ IconDot,
+ IconExternal,
+ IconStop,
+} from "../../components/icons";
+import { formatDuration, formatMoment } from "./scheduled-format";
+import { runDurationMs } from "./scheduled-runs";
+import { RUN_STATUS_I18N_KEYS } from "./scheduled-labels";
+
+function RunStatusGlyph({ status }: { status: ScheduledTaskRun["status"] }) {
+ switch (status) {
+ case "completed":
+ return <IconCircleCheck size={15} />;
+ case "error":
+ return <IconCircleAlert size={15} />;
+ case "aborted":
+ return <IconStop size={14} />;
+ default:
+ return <IconDot size={15} />;
+ }
+}
+
+/** One task's own runs, newest first. Selecting a row reads that run in the
+ * page; opening its conversation stays a separate, explicit action. */
+export function ScheduledRunHistory({
+ runs,
+ selectedRunId,
+ busy,
+ locale,
+ onSelectRun,
+ onOpenSession,
+}: {
+ runs: ScheduledTaskRun[];
+ selectedRunId: string | null;
+ busy: boolean;
+ locale: string;
+ onSelectRun: (runId: string) => void;
+ onOpenSession: (sessionId: string) => void;
+}) {
+ const { t } = useTranslation();
+ return (
+ <section className="scheduled-card" aria-labelledby="scheduled-run-history">
+ <div className="scheduled-card-head">
+ <h3 className="scheduled-card-title" id="scheduled-run-history">
+ {t("scheduled.runs")}
+ </h3>
+ <span className="scheduled-card-count">{runs.length}</span>
+ </div>
+ {runs.length === 0 ? (
+ <p className="scheduled-hint">{t("scheduled.emptyRuns")}</p>
+ ) : (
+ <>
+ <p className="scheduled-hint">{t("scheduled.historyHint")}</p>
+ <ol className="scheduled-runs">
+ {runs.map((run) => {
+ const selected = run.id === selectedRunId;
+ const duration = runDurationMs(run);
+ const sessionId = run.sessionId;
+ const meta = [
+ formatMoment(run.startedAt, locale),
+ duration === null ? "" : formatDuration(duration),
+ run.errorCode ?? "",
+ ].filter(Boolean);
+ return (
+ <li key={run.id} className={cx("scheduled-run", selected && "is-selected")}>
+ <button
+ type="button"
+ className="scheduled-run-main"
+ aria-current={selected ? "true" : undefined}
+ onClick={() => onSelectRun(run.id)}
+ >
+ <span className={cx("scheduled-run-glyph", `is-${run.status}`)} aria-hidden>
+ <RunStatusGlyph status={run.status} />
+ </span>
+ <span className="scheduled-run-body">
+ <span className="scheduled-run-state">{t(RUN_STATUS_I18N_KEYS[run.status])}</span>
+ <span className="scheduled-run-meta">{meta.join(" · ")}</span>
+ </span>
+ <IconChevronDown
+ size={14}
+ className={cx("scheduled-run-chevron", selected && "is-open")}
+ aria-hidden
+ />
+ </button>
+ {sessionId && (
+ <TooltipButton
+ tooltip={t("scheduled.openResult")}
+ ariaLabel={t("scheduled.openResult")}
+ className="scheduled-icon-btn"
+ disabled={busy}
+ onClick={() => onOpenSession(sessionId)}
+ >
+ <IconExternal size={14} aria-hidden />
+ </TooltipButton>
+ )}
+ </li>
+ );
+ })}
+ </ol>
+ </>
+ )}
+ </section>
+ );
+}
diff --git a/apps/desktop/src/features/scheduled/ScheduledRunTranscript.tsx b/apps/desktop/src/features/scheduled/ScheduledRunTranscript.tsx
new file mode 100644
index 000000000..d2f82a6c3
--- /dev/null
+++ b/apps/desktop/src/features/scheduled/ScheduledRunTranscript.tsx
@@ -0,0 +1,143 @@
+import { useCallback, useEffect, useRef, useState } from "react";
+import { useTranslation } from "react-i18next";
+import type { ScheduledTaskRun, UiMessage } from "@pi-desktop/shared";
+import { api } from "../../lib/api";
+
+/**
+ * Bounded read of a run's transcript. The page never loads a whole session:
+ * 60 newest messages with a 20k character ceiling per field keeps a run that
+ * printed a huge tool result from freezing the Scheduled workspace.
+ */
+const TRANSCRIPT_MESSAGE_LIMIT = 60;
+const TRANSCRIPT_CONTENT_LIMIT = 20_000;
+/** A run that is still in flight keeps writing; follow it at the poll's pace. */
+const LIVE_REFRESH_INTERVAL_MS = 5_000;
+
+type Reading = {
+ status: "idle" | "loading" | "ready" | "error";
+ messages: UiMessage[];
+ truncated: boolean;
+};
+
+const EMPTY_READING: Reading = { status: "idle", messages: [], truncated: false };
+
+function roleLabelKey(role: UiMessage["role"]): string {
+ switch (role) {
+ case "user":
+ return "chat.speakerYou";
+ case "assistant":
+ return "chat.speakerAssistant";
+ case "tool":
+ return "chat.toolCall";
+ default:
+ return "scheduled.roleSystem";
+ }
+}
+
+function TranscriptMessage({ message }: { message: UiMessage }) {
+ const { t } = useTranslation();
+ const text = message.content.trim();
+ // A tool call with no text of its own adds nothing a reader can use here.
+ if (!text) return null;
+ return (
+ <li className={`scheduled-message scheduled-message-${message.role}`}>
+ <span className="scheduled-message-role">{t(roleLabelKey(message.role))}</span>
+ <p className="scheduled-message-text" data-status={message.status ?? "complete"}>
+ {text}
+ </p>
+ </li>
+ );
+}
+
+/**
+ * Read-only view of one run's transcript, rendered inside the Scheduled page so
+ * reviewing an automation result never costs a conversation switch. The
+ * conversation itself stays one explicit action away.
+ */
+export function ScheduledRunTranscript({ run }: { run: ScheduledTaskRun }) {
+ const { t } = useTranslation();
+ const sessionId = run.sessionId;
+ const [reading, setReading] = useState<Reading>(EMPTY_READING);
+ const mounted = useRef(false);
+ const revision = useRef(0);
+
+ useEffect(() => {
+ mounted.current = true;
+ return () => {
+ mounted.current = false;
+ revision.current++;
+ };
+ }, []);
+
+ const read = useCallback(async () => {
+ const request = ++revision.current;
+ if (!sessionId) {
+ if (mounted.current) setReading(EMPTY_READING);
+ return;
+ }
+ setReading((previous) => ({
+ status: "loading",
+ messages: previous.messages,
+ truncated: previous.truncated,
+ }));
+ try {
+ const result = await api.getSession(sessionId, {
+ messageLimit: TRANSCRIPT_MESSAGE_LIMIT,
+ contentLimit: TRANSCRIPT_CONTENT_LIMIT,
+ });
+ if (!mounted.current || request !== revision.current) return;
+ const session = result.session;
+ setReading({
+ status: "ready",
+ messages: session?.messages ?? [],
+ truncated: session?.hasMoreBefore === true,
+ });
+ } catch {
+ if (mounted.current && request === revision.current) {
+ setReading({ ...EMPTY_READING, status: "error" });
+ }
+ }
+ }, [sessionId]);
+
+ // A run that finished after this card opened still carries the answer the
+ // reader came for, so the read follows the run's own state, not just its id.
+ useEffect(() => {
+ void read();
+ }, [read, run.status, run.endedAt]);
+
+ useEffect(() => {
+ if (run.status !== "running" || !sessionId) return;
+ const timer = setInterval(() => void read(), LIVE_REFRESH_INTERVAL_MS);
+ return () => clearInterval(timer);
+ }, [read, run.status, sessionId, run.endedAt]);
+
+ if (!sessionId) {
+ return <p className="scheduled-hint">{t("scheduled.runContentUnavailable")}</p>;
+ }
+ if (reading.status === "error") {
+ return (
+ <p className="scheduled-hint" role="alert">
+ {t("scheduled.runContentError")}
+ </p>
+ );
+ }
+ if (reading.messages.length === 0) {
+ return (
+ <p className="scheduled-hint" role={reading.status === "loading" ? "status" : undefined}>
+ {t(reading.status === "loading" ? "scheduled.runContentLoading" : "scheduled.runContentUnavailable")}
+ </p>
+ );
+ }
+ return (
+ <ol className="scheduled-transcript" aria-label={t("scheduled.runContent")}>
+ {reading.truncated && (
+ <li className="scheduled-hint scheduled-transcript-more">
+ {t("scheduled.transcriptTruncated")}
+ </li>
+ )}
+ {reading.messages.map((message) => (
+ <TranscriptMessage key={message.id} message={message} />
+ ))}
+ </ol>
+ );
+}
diff --git a/apps/desktop/src/features/scheduled/ScheduledTaskDetail.tsx b/apps/desktop/src/features/scheduled/ScheduledTaskDetail.tsx
new file mode 100644
index 000000000..1eb84886e
--- /dev/null
+++ b/apps/desktop/src/features/scheduled/ScheduledTaskDetail.tsx
@@ -0,0 +1,205 @@
+import { useState, type ReactNode } from "react";
+import { useTranslation } from "react-i18next";
+import type { ScheduledTask, ScheduledTaskRun } from "@pi-desktop/shared";
+import { Badge, Button, cx } from "../../components/ui";
+import { IconChevronDown, IconExternal } from "../../components/icons";
+import { PERMISSION_MODE_I18N_KEYS } from "../../lib/permission-mode-labels";
+import { shortenPath } from "../../lib/project-archive";
+import {
+ formatDuration,
+ formatMoment,
+ formatRelativeMoment,
+ formatScheduleClock,
+} from "./scheduled-format";
+import { resolveSelectedRun, runDurationMs } from "./scheduled-runs";
+import { CADENCE_I18N_KEYS, RUN_STATUS_I18N_KEYS } from "./scheduled-labels";
+import { ScheduledRunHistory } from "./ScheduledRunHistory";
+import { ScheduledRunTranscript } from "./ScheduledRunTranscript";
+
+function Fact({ label, children }: { label: string; children: ReactNode }) {
+ return (
+ <div className="scheduled-fact">
+ <dt className="scheduled-fact-label">{label}</dt>
+ <dd className="scheduled-fact-value">{children}</dd>
+ </div>
+ );
+}
+
+/**
+ * One task's page: what it does next, how its last run ended, its own run
+ * history, and the transcript of the run the reader picked — all inside the
+ * route, so reviewing a run no longer costs a conversation switch.
+ */
+export function ScheduledTaskDetail({
+ task,
+ runs,
+ selectedRunId,
+ running,
+ busy,
+ now,
+ locale,
+ onSelectRun,
+ onOpenSession,
+ onRunNow,
+ onEdit,
+ onToggleEnabled,
+ onDelete,
+ providerName,
+}: {
+ task: ScheduledTask;
+ runs: ScheduledTaskRun[];
+ selectedRunId: string | null;
+ running: boolean;
+ busy: boolean;
+ now: number;
+ locale: string;
+ onSelectRun: (runId: string) => void;
+ onOpenSession: (sessionId: string) => void;
+ onRunNow: () => void;
+ onEdit: () => void;
+ onToggleEnabled: () => void;
+ onDelete: () => void;
+ /** Display name of the task's provider; the stored id is a UUID. */
+ providerName?: string | null;
+}) {
+ const { t } = useTranslation();
+ const [instructionOpen, setInstructionOpen] = useState(false);
+ const latest = runs[0] ?? null;
+ const latestDuration = runDurationMs(latest);
+ const clock = formatScheduleClock(task.schedule);
+ const cadence = t(CADENCE_I18N_KEYS[task.cadence]);
+ const selectedRun = resolveSelectedRun(runs, selectedRunId);
+ const selectedDuration = runDurationMs(selectedRun);
+ const selectedSessionId = selectedRun?.sessionId ?? null;
+ const project = task.workspacePath ? shortenPath(task.workspacePath) : "";
+ // The stored provider id is a UUID; the facts row shows the provider's name
+ // beside the model, and falls back to the model alone when it is unknown.
+ const model = task.modelId
+ ? [providerName, task.modelId].filter(Boolean).join(" / ")
+ : t("settings.defaultModel");
+ const nextRun =
+ task.enabled && task.cadence !== "manual" && task.nextRunAt
+ ? `${formatRelativeMoment(task.nextRunAt, now, locale)} · ${formatMoment(task.nextRunAt, locale)}`
+ : t(
+ task.enabled && task.cadence !== "manual" && !task.schedule
+ ? "scheduled.legacyHint"
+ : "scheduled.noNextRun",
+ );
+
+ return (
+ <section className="scheduled-detail" aria-labelledby="scheduled-detail-title">
+ <div className="scheduled-detail-head">
+ <div className="scheduled-detail-heading">
+ <h2 className="scheduled-detail-title" id="scheduled-detail-title">
+ {task.title}
+ </h2>
+ <div className="scheduled-detail-badges">
+ <Badge tone={task.enabled ? "success" : "neutral"}>
+ {t(task.enabled ? "scheduled.enabled" : "scheduled.disabled")}
+ </Badge>
+ {running ? <Badge tone="warning">{t("scheduled.statusRunning")}</Badge> : null}
+ </div>
+ </div>
+ <div className="scheduled-detail-actions">
+ <Button size="sm" variant="primary" disabled={busy || running} onClick={onRunNow}>
+ {t(running ? "scheduled.statusRunning" : "scheduled.runNow")}
+ </Button>
+ <Button size="sm" disabled={busy} onClick={onEdit}>
+ {t("scheduled.edit")}
+ </Button>
+ <Button size="sm" disabled={busy} onClick={onToggleEnabled}>
+ {t(task.enabled ? "scheduled.pause" : "scheduled.resume")}
+ </Button>
+ <Button size="sm" variant="ghost" disabled={busy || running} onClick={onDelete}>
+ {t("scheduled.delete")}
+ </Button>
+ </div>
+ </div>
+
+ <dl className="scheduled-facts">
+ <Fact label={t("scheduled.lastRun")}>
+ {latest ? (
+ <span className={cx("scheduled-fact-run", `is-${latest.status}`)}>
+ {t(RUN_STATUS_I18N_KEYS[latest.status])}
+ {" · "}
+ {formatRelativeMoment(latest.startedAt, now, locale)}
+ {latestDuration === null ? "" : ` · ${formatDuration(latestDuration)}`}
+ </span>
+ ) : (
+ t("scheduled.neverRun")
+ )}
+ </Fact>
+ <Fact label={t("scheduled.nextRun")}>{nextRun}</Fact>
+ <Fact label={t("scheduled.cadence")}>{clock ? `${cadence} · ${clock}` : cadence}</Fact>
+ {project ? <Fact label={t("scheduled.detailProject")}>{project}</Fact> : null}
+ <Fact label={t("scheduled.detailPermission")}>
+ {t(PERMISSION_MODE_I18N_KEYS[task.permissionMode ?? "inherit"])}
+ </Fact>
+ <Fact label={t("scheduled.detailModel")}>{model}</Fact>
+ </dl>
+
+ <section className="scheduled-card" aria-labelledby="scheduled-instruction">
+ <div className="scheduled-card-head">
+ <h3 className="scheduled-card-title" id="scheduled-instruction">
+ {t("scheduled.prompt")}
+ </h3>
+ <button
+ type="button"
+ className="scheduled-disclosure"
+ aria-expanded={instructionOpen}
+ onClick={() => setInstructionOpen((open) => !open)}
+ >
+ {t(instructionOpen ? "scheduled.instructionHide" : "scheduled.instructionShow")}
+ <IconChevronDown
+ size={13}
+ className={cx("scheduled-run-chevron", instructionOpen && "is-open")}
+ aria-hidden
+ />
+ </button>
+ </div>
+ <p className={cx("scheduled-instruction", instructionOpen && "is-open")}>
+ {task.prompt}
+ </p>
+ </section>
+
+ <ScheduledRunHistory
+ runs={runs}
+ selectedRunId={selectedRun?.id ?? null}
+ busy={busy}
+ locale={locale}
+ onSelectRun={onSelectRun}
+ onOpenSession={onOpenSession}
+ />
+
+ {selectedRun ? (
+ <section className="scheduled-card scheduled-content" aria-labelledby="scheduled-run-content">
+ <div className="scheduled-card-head">
+ <h3 className="scheduled-card-title" id="scheduled-run-content">
+ {t("scheduled.runContent")}
+ </h3>
+ <span className="scheduled-content-meta">
+ <span className={cx("scheduled-fact-run", `is-${selectedRun.status}`)}>
+ {t(RUN_STATUS_I18N_KEYS[selectedRun.status])}
+ </span>
+ {" · "}
+ {formatMoment(selectedRun.startedAt, locale)}
+ {selectedDuration === null ? "" : ` · ${formatDuration(selectedDuration)}`}
+ </span>
+ {selectedSessionId ? (
+ <Button
+ size="sm"
+ variant="ghost"
+ disabled={busy}
+ onClick={() => onOpenSession(selectedSessionId)}
+ >
+ <IconExternal size={13} aria-hidden />
+ {t("scheduled.openResult")}
+ </Button>
+ ) : null}
+ </div>
+ <ScheduledRunTranscript run={selectedRun} />
+ </section>
+ ) : null}
+ </section>
+ );
+}
diff --git a/apps/desktop/src/features/scheduled/ScheduledTaskRail.tsx b/apps/desktop/src/features/scheduled/ScheduledTaskRail.tsx
new file mode 100644
index 000000000..93bd90f3d
--- /dev/null
+++ b/apps/desktop/src/features/scheduled/ScheduledTaskRail.tsx
@@ -0,0 +1,107 @@
+import { useTranslation } from "react-i18next";
+import type { ScheduledTask, ScheduledTaskRun } from "@pi-desktop/shared";
+import { cx } from "../../components/ui";
+import {
+ IconCircleAlert,
+ IconCircleCheck,
+ IconClock,
+ IconDot,
+ IconStop,
+} from "../../components/icons";
+import { formatDuration, formatRelativeMoment, formatScheduleClock } from "./scheduled-format";
+import { runDurationMs } from "./scheduled-runs";
+import { CADENCE_I18N_KEYS, RUN_STATUS_I18N_KEYS } from "./scheduled-labels";
+
+function RunGlyph({ run }: { run: ScheduledTaskRun }) {
+ switch (run.status) {
+ case "completed":
+ return <IconCircleCheck size={13} />;
+ case "error":
+ return <IconCircleAlert size={13} />;
+ case "aborted":
+ return <IconStop size={12} />;
+ default:
+ return <IconDot size={13} />;
+ }
+}
+
+/** The task column: one row per task, each reporting its own last outcome and
+ * next occurrence so the page answers "did it run, and did it work?" without a
+ * second, global run list. */
+export function ScheduledTaskRail({
+ tasks,
+ latestRuns,
+ selectedTaskId,
+ now,
+ locale,
+ onSelect,
+}: {
+ tasks: ScheduledTask[];
+ latestRuns: Map<string, ScheduledTaskRun>;
+ selectedTaskId: string | null;
+ now: number;
+ locale: string;
+ onSelect: (taskId: string) => void;
+}) {
+ const { t } = useTranslation();
+ const total = tasks.length;
+ return (
+ <aside className="scheduled-rail">
+ <div className="scheduled-card-head">
+ <h2 className="scheduled-card-title" id="scheduled-task-rail-label">
+ {t("scheduled.tasks")}
+ </h2>
+ <span className="scheduled-card-count">{total}</span>
+ </div>
+ <ul className="scheduled-rail-list" aria-labelledby="scheduled-task-rail-label">
+ {tasks.map((task) => {
+ const selected = task.id === selectedTaskId;
+ const latest = latestRuns.get(task.id) ?? null;
+ const duration = runDurationMs(latest);
+ const clock = formatScheduleClock(task.schedule);
+ const cadence = t(CADENCE_I18N_KEYS[task.cadence]);
+ const running = latest?.status === "running";
+ return (
+ <li key={task.id}>
+ <button
+ type="button"
+ className={cx("scheduled-task", selected && "is-selected")}
+ aria-current={selected ? "true" : undefined}
+ onClick={() => onSelect(task.id)}
+ >
+ <span className="scheduled-task-title">
+ <span className="scheduled-task-name">{task.title}</span>
+ {running ? (
+ <span className="scheduled-task-live" aria-hidden>
+ <IconDot size={10} />
+ </span>
+ ) : null}
+ {!task.enabled && (
+ <span className="scheduled-task-paused">{t("scheduled.disabled")}</span>
+ )}
+ </span>
+ <span className="scheduled-task-cadence">
+ <IconClock size={12} aria-hidden />
+ {clock ? `${cadence} · ${clock}` : cadence}
+ </span>
+ {latest ? (
+ <span className={cx("scheduled-task-last", `is-${latest.status}`)}>
+ <RunGlyph run={latest} />
+ <span className="scheduled-task-last-text">
+ {t(RUN_STATUS_I18N_KEYS[latest.status])}
+ {" · "}
+ {formatRelativeMoment(latest.startedAt, now, locale)}
+ {duration === null ? "" : ` · ${formatDuration(duration)}`}
+ </span>
+ </span>
+ ) : (
+ <span className="scheduled-task-last is-empty">{t("scheduled.neverRun")}</span>
+ )}
+ </button>
+ </li>
+ );
+ })}
+ </ul>
+ </aside>
+ );
+}
diff --git a/apps/desktop/src/features/scheduled/scheduled-format.ts b/apps/desktop/src/features/scheduled/scheduled-format.ts
new file mode 100644
index 000000000..78a1ac23c
--- /dev/null
+++ b/apps/desktop/src/features/scheduled/scheduled-format.ts
@@ -0,0 +1,83 @@
+import type { ScheduledTask, ScheduledTaskSchedule } from "@pi-desktop/shared";
+
+const MINUTE_MS = 60_000;
+const HOUR_MS = 60 * MINUTE_MS;
+const DAY_MS = 24 * HOUR_MS;
+const WEEK_MS = 7 * DAY_MS;
+
+/**
+ * Compact, language-neutral run length (`42s`, `1m 12s`, `2h 05m`). Durations
+ * stay unit-suffixed on purpose: the component spec renders them the same way
+ * in the transcript timeline and the E2E logs, and every locale reads them.
+ */
+export function formatDuration(ms: number | null | undefined): string {
+ if (ms === null || ms === undefined || !Number.isFinite(ms) || ms < 0) return "";
+ const totalSeconds = Math.max(1, Math.round(ms / 1000));
+ if (totalSeconds < 60) return `${totalSeconds}s`;
+ const minutes = Math.floor(totalSeconds / 60);
+ const seconds = totalSeconds % 60;
+ if (minutes < 60) return seconds ? `${minutes}m ${seconds}s` : `${minutes}m`;
+ const hours = Math.floor(minutes / 60);
+ const rest = minutes % 60;
+ return rest ? `${hours}h ${String(rest).padStart(2, "0")}m` : `${hours}h`;
+}
+
+/** Absolute localized moment, used where a relative phrase would be vague. */
+export function formatMoment(value: string | null | undefined, locale?: string): string {
+ if (!value) return "";
+ const parsed = Date.parse(value);
+ if (!Number.isFinite(parsed)) return "";
+ try {
+ return new Intl.DateTimeFormat(locale || undefined, {
+ dateStyle: "medium",
+ timeStyle: "short",
+ }).format(new Date(parsed));
+ } catch {
+ return new Date(parsed).toLocaleString();
+ }
+}
+
+/**
+ * Relative phrase for a past ("2 hours ago") or future ("in 3 hours") moment.
+ * Beyond a week it falls back to an absolute date, so a next run three weeks
+ * out never reads as a countdown nobody can convert.
+ */
+export function formatRelativeMoment(
+ value: string | null | undefined,
+ now: number,
+ locale?: string,
+): string {
+ if (!value) return "";
+ const parsed = Date.parse(value);
+ if (!Number.isFinite(parsed)) return "";
+ const delta = parsed - now;
+ const magnitude = Math.abs(delta);
+ if (magnitude >= WEEK_MS) return formatMoment(value, locale);
+ try {
+ const relative = new Intl.RelativeTimeFormat(locale || undefined, {
+ numeric: "auto",
+ });
+ if (magnitude < MINUTE_MS) return relative.format(Math.round(delta / 1000), "second");
+ if (magnitude < HOUR_MS) return relative.format(Math.round(delta / MINUTE_MS), "minute");
+ if (magnitude < DAY_MS) return relative.format(Math.round(delta / HOUR_MS), "hour");
+ return relative.format(Math.round(delta / DAY_MS), "day");
+ } catch {
+ return formatMoment(value, locale);
+ }
+}
+
+/** `HH:MM` for a saved calendar intent; `null` when the task has no clock. */
+export function formatScheduleClock(
+ schedule: ScheduledTaskSchedule | null | undefined,
+): string | null {
+ if (!schedule) return null;
+ const hour = Math.trunc(schedule.hour);
+ const minute = Math.trunc(schedule.minute);
+ if (hour < 0 || hour > 23 || minute < 0 || minute > 59) return null;
+ return `${String(hour).padStart(2, "0")}:${String(minute).padStart(2, "0")}`;
+}
+
+/** The newest timestamp a task row can report as "last attempt". */
+export function lastAttemptAt(task: ScheduledTask): string | null {
+ return task.lastRunAt ?? null;
+}
diff --git a/apps/desktop/src/features/scheduled/scheduled-labels.ts b/apps/desktop/src/features/scheduled/scheduled-labels.ts
new file mode 100644
index 000000000..10d700181
--- /dev/null
+++ b/apps/desktop/src/features/scheduled/scheduled-labels.ts
@@ -0,0 +1,17 @@
+import type { ScheduledTaskRun } from "@pi-desktop/shared";
+
+/** One vocabulary for run status and cadence labels, shared by the rail, the
+ * history rows, the detail facts, and the run-content header. */
+export const RUN_STATUS_I18N_KEYS: Record<ScheduledTaskRun["status"], string> = {
+ running: "scheduled.statusRunning",
+ completed: "scheduled.statusCompleted",
+ aborted: "scheduled.statusAborted",
+ error: "scheduled.statusError",
+};
+
+export const CADENCE_I18N_KEYS = {
+ manual: "scheduled.cadenceManual",
+ hourly: "scheduled.cadenceHourly",
+ daily: "scheduled.cadenceDaily",
+ weekly: "scheduled.cadenceWeekly",
+} as const;
diff --git a/apps/desktop/src/features/scheduled/scheduled-runs.ts b/apps/desktop/src/features/scheduled/scheduled-runs.ts
new file mode 100644
index 000000000..f630d17b0
--- /dev/null
+++ b/apps/desktop/src/features/scheduled/scheduled-runs.ts
@@ -0,0 +1,88 @@
+import type { ScheduledTaskRun } from "@pi-desktop/shared";
+
+export type ScheduledRunStatus = ScheduledTaskRun["status"];
+
+/** Stable order for a horizontal band of runs: newest first, ties by id. */
+function compareRunsDescending(left: ScheduledTaskRun, right: ScheduledTaskRun): number {
+ const started = Date.parse(right.startedAt) - Date.parse(left.startedAt);
+ if (Number.isFinite(started) && started !== 0) return started;
+ return right.id.localeCompare(left.id);
+}
+
+/** Newest first. The host orders runs by `startedAt DESC`; regrouping must not
+ * reorder them, so every view reads its rows through this function. */
+export function sortRunsNewestFirst(runs: readonly ScheduledTaskRun[]): ScheduledTaskRun[] {
+ return [...runs].sort(compareRunsDescending);
+}
+
+/** One task's own history, newest first. */
+export function runsForTask(
+ runs: readonly ScheduledTaskRun[],
+ taskId: string | null | undefined,
+): ScheduledTaskRun[] {
+ if (!taskId) return [];
+ return sortRunsNewestFirst(runs.filter((run) => run.taskId === taskId));
+}
+
+/** The newest run of every task, so a task row can report its own outcome
+ * without asking the host once per task. */
+export function latestRunByTask(
+ runs: readonly ScheduledTaskRun[],
+): Map<string, ScheduledTaskRun> {
+ const latest = new Map<string, ScheduledTaskRun>();
+ for (const run of sortRunsNewestFirst(runs)) {
+ if (!latest.has(run.taskId)) latest.set(run.taskId, run);
+ }
+ return latest;
+}
+
+/** Wall-clock length of a finished run. `null` while it still runs, or when the
+ * stored times cannot be compared. */
+export function runDurationMs(run: ScheduledTaskRun | null | undefined): number | null {
+ if (!run || !run.endedAt) return null;
+ const started = Date.parse(run.startedAt);
+ const ended = Date.parse(run.endedAt);
+ if (!Number.isFinite(started) || !Number.isFinite(ended) || ended < started) return null;
+ return ended - started;
+}
+
+/** True when a task currently holds an in-flight run. A run stays `running`
+ * until the host records its terminal status, so the row can say so. */
+export function taskIsRunning(
+ runs: readonly ScheduledTaskRun[],
+ taskId: string | null | undefined,
+): boolean {
+ if (!taskId) return false;
+ return runs.some((run) => run.taskId === taskId && run.status === "running");
+}
+
+/** The run a history view should read: the caller's pick while it still exists,
+ * otherwise the newest one. Selection survives a refresh that keeps the row. */
+export function resolveSelectedRun(
+ runs: readonly ScheduledTaskRun[],
+ runId: string | null | undefined,
+): ScheduledTaskRun | null {
+ const ordered = sortRunsNewestFirst(runs);
+ if (runId) {
+ const match = ordered.find((run) => run.id === runId);
+ if (match) return match;
+ }
+ return ordered[0] ?? null;
+}
+
+/** Whether the selected run is the one a run-detail surface should load. */
+export function selectedRunSessionId(
+ runs: readonly ScheduledTaskRun[],
+ runId: string | null | undefined,
+): string | null {
+ return resolveSelectedRun(runs, runId)?.sessionId ?? null;
+}
+
+/** A task row's status line: the outcome of its newest run. */
+export function latestRunForTask(
+ runs: readonly ScheduledTaskRun[],
+ taskId: string | null | undefined,
+): ScheduledTaskRun | null {
+ if (!taskId) return null;
+ return runsForTask(runs, taskId)[0] ?? null;
+}
diff --git a/apps/desktop/src/features/scheduled/scheduled-workspace.css b/apps/desktop/src/features/scheduled/scheduled-workspace.css
new file mode 100644
index 000000000..3b55adaf8
--- /dev/null
+++ b/apps/desktop/src/features/scheduled/scheduled-workspace.css
@@ -0,0 +1,530 @@
+/*
+ Scheduled workspace — the task column and one task's page (facts, instruction,
+ its own run history, and the in-page run transcript). Destination-page chrome
+ and the create form stay with their own partials; this file owns only what the
+ master-detail workspace adds. Every value comes from the token scales so the
+ surface follows the active theme and the font-scale setting.
+*/
+
+.scheduled-frame {
+ /* The workspace is a workbench, not a list: keep the page rhythm and leave a
+ little less air at the end than a card list needs. */
+ padding-bottom: 32px;
+}
+
+.scheduled-workspace {
+ display: grid;
+ grid-template-columns: 268px minmax(0, 1fr);
+ gap: 20px;
+ align-items: start;
+}
+
+.scheduled-editor-slot {
+ margin-bottom: 16px;
+}
+
+.scheduled-error {
+ margin-bottom: 16px;
+}
+
+/* ---- card shell ---------------------------------------------------------- */
+
+.scheduled-card {
+ display: flex;
+ flex-direction: column;
+ gap: 10px;
+ border-radius: var(--radius-lg-plus);
+ background: var(--ds-tile);
+ padding: 12px 14px;
+}
+
+.scheduled-card-head {
+ display: flex;
+ align-items: center;
+ gap: 8px;
+ min-width: 0;
+}
+
+.scheduled-card-title {
+ margin: 0;
+ flex: 1;
+ min-width: 0;
+ color: var(--ds-text-muted);
+ font-size: var(--text-xs-plus);
+ font-weight: var(--font-weight-medium);
+ letter-spacing: var(--tracking-wide);
+ text-transform: uppercase;
+}
+
+.scheduled-card-count {
+ flex: 0 0 auto;
+ border-radius: var(--radius-full);
+ padding: 1px 7px;
+ background: color-mix(in oklab, var(--ds-text-primary) 6%, transparent);
+ color: var(--ds-text-muted);
+ font-size: var(--text-3xs);
+ font-variant-numeric: tabular-nums;
+}
+
+.scheduled-hint {
+ margin: 0;
+ color: var(--ds-text-muted);
+ font-size: var(--text-sm);
+ line-height: var(--leading-body);
+}
+
+/* ---- task column --------------------------------------------------------- */
+
+.scheduled-rail {
+ position: sticky;
+ top: calc(var(--ds-toolbar-height) + 12px);
+ display: flex;
+ flex-direction: column;
+ gap: 6px;
+ min-width: 0;
+}
+
+.scheduled-rail-list {
+ display: flex;
+ flex-direction: column;
+ gap: 2px;
+ margin: 0;
+ padding: 0;
+ list-style: none;
+ max-height: calc(100vh - 240px);
+ overflow-y: auto;
+}
+
+.scheduled-task {
+ display: grid;
+ width: 100%;
+ gap: 3px;
+ border: 0;
+ border-radius: var(--radius-md);
+ padding: 8px 10px;
+ background: transparent;
+ text-align: left;
+ transition: background var(--motion-duration-fast) var(--motion-ease-out);
+}
+
+.scheduled-task:hover {
+ background: var(--ds-bg-hover);
+}
+
+.scheduled-task.is-selected {
+ background: var(--ds-raised);
+ box-shadow: var(--ds-raised-shadow);
+}
+
+.scheduled-task-title {
+ display: flex;
+ min-width: 0;
+ align-items: center;
+ gap: 6px;
+}
+
+.scheduled-task-name {
+ min-width: 0;
+ overflow: hidden;
+ color: var(--ds-text-primary);
+ font-size: var(--text-md);
+ font-weight: var(--font-weight-medium);
+ text-overflow: ellipsis;
+ white-space: nowrap;
+}
+
+.scheduled-task-live {
+ display: inline-flex;
+ flex: 0 0 auto;
+ color: var(--ds-warning);
+ animation: scheduled-live-pulse 1.6s var(--motion-ease-standard) infinite;
+}
+
+@keyframes scheduled-live-pulse {
+ 0%,
+ 100% {
+ opacity: 1;
+ }
+
+ 50% {
+ opacity: 0.35;
+ }
+}
+
+.scheduled-task-paused {
+ flex: 0 0 auto;
+ border-radius: var(--radius-full);
+ padding: 1px 7px;
+ background: color-mix(in oklab, var(--ds-text-primary) 6%, transparent);
+ color: var(--ds-text-muted);
+ font-size: var(--text-3xs);
+}
+
+.scheduled-task-cadence {
+ display: inline-flex;
+ min-width: 0;
+ align-items: center;
+ gap: 5px;
+ color: var(--ds-text-muted);
+ font-size: var(--text-xs);
+}
+
+.scheduled-task-last {
+ display: inline-flex;
+ min-width: 0;
+ align-items: center;
+ gap: 5px;
+ color: var(--ds-text-secondary);
+ font-size: var(--text-xs);
+}
+
+.scheduled-task-last-text {
+ min-width: 0;
+ overflow: hidden;
+ text-overflow: ellipsis;
+ white-space: nowrap;
+}
+
+.scheduled-task-last.is-completed {
+ color: var(--ds-success);
+}
+
+.scheduled-task-last.is-error {
+ color: var(--ds-error);
+}
+
+.scheduled-task-last.is-empty {
+ color: var(--ds-text-muted);
+}
+
+/* ---- task page ----------------------------------------------------------- */
+
+.scheduled-detail {
+ display: flex;
+ flex-direction: column;
+ gap: 14px;
+ min-width: 0;
+}
+
+.scheduled-detail-head {
+ display: flex;
+ flex-wrap: wrap;
+ align-items: flex-start;
+ justify-content: space-between;
+ gap: 10px;
+}
+
+.scheduled-detail-heading {
+ display: flex;
+ min-width: 0;
+ flex-direction: column;
+ gap: 6px;
+}
+
+.scheduled-detail-title {
+ margin: 0;
+ color: var(--ds-text-primary);
+ font-size: var(--text-lg-plus);
+ font-weight: var(--font-weight-strong);
+ letter-spacing: var(--tracking-tight);
+}
+
+.scheduled-detail-badges,
+.scheduled-detail-actions {
+ display: flex;
+ flex-wrap: wrap;
+ align-items: center;
+ gap: 6px;
+}
+
+.scheduled-facts {
+ display: grid;
+ grid-template-columns: repeat(auto-fit, minmax(150px, 1fr));
+ gap: 10px 16px;
+ margin: 0;
+ border-radius: var(--radius-lg);
+ background: var(--ds-tile);
+ padding: 12px 14px;
+}
+
+.scheduled-fact {
+ min-width: 0;
+}
+
+.scheduled-fact-label {
+ color: var(--ds-text-muted);
+ font-size: var(--text-3xs);
+ letter-spacing: var(--tracking-wide);
+ text-transform: uppercase;
+}
+
+.scheduled-fact-value {
+ margin: 3px 0 0;
+ overflow-wrap: anywhere;
+ color: var(--ds-text-primary);
+ font-size: var(--text-sm-plus);
+ line-height: var(--leading-compact-plus);
+}
+
+.scheduled-fact-run.is-completed {
+ color: var(--ds-success);
+}
+
+.scheduled-fact-run.is-error {
+ color: var(--ds-error);
+}
+
+.scheduled-fact-run.is-running {
+ color: var(--ds-warning);
+}
+
+/* ---- instruction --------------------------------------------------------- */
+
+.scheduled-disclosure {
+ display: inline-flex;
+ flex: 0 0 auto;
+ align-items: center;
+ gap: 4px;
+ border: 0;
+ border-radius: var(--radius-sm);
+ padding: 2px 6px;
+ background: transparent;
+ color: var(--ds-text-muted);
+ font-size: var(--text-2xs);
+ transition: color var(--motion-duration-fast) var(--motion-ease-out);
+}
+
+.scheduled-disclosure:hover,
+.scheduled-disclosure:focus-visible {
+ color: var(--ds-text-primary);
+}
+
+.scheduled-instruction {
+ margin: 0;
+ overflow: hidden;
+ display: -webkit-box;
+ -webkit-line-clamp: 3;
+ -webkit-box-orient: vertical;
+ color: var(--ds-text-secondary);
+ font-size: var(--text-sm-plus);
+ line-height: var(--leading-body);
+ white-space: pre-wrap;
+}
+
+.scheduled-instruction.is-open {
+ display: block;
+ max-height: 320px;
+ overflow-y: auto;
+ color: var(--ds-text-primary);
+}
+
+/* ---- run history --------------------------------------------------------- */
+
+.scheduled-runs {
+ display: flex;
+ flex-direction: column;
+ gap: 2px;
+ margin: 0;
+ padding: 0;
+ list-style: none;
+}
+
+.scheduled-run {
+ display: flex;
+ align-items: center;
+ gap: 6px;
+ border-radius: var(--radius-sm);
+ transition: background var(--motion-duration-fast) var(--motion-ease-out);
+}
+
+.scheduled-run:hover {
+ background: var(--ds-bg-hover);
+}
+
+.scheduled-run.is-selected {
+ background: var(--ds-bg-active);
+}
+
+.scheduled-run-main {
+ display: flex;
+ min-width: 0;
+ flex: 1;
+ align-items: center;
+ gap: 9px;
+ border: 0;
+ border-radius: var(--radius-sm);
+ padding: 7px 8px;
+ background: transparent;
+ text-align: left;
+}
+
+.scheduled-run-glyph {
+ display: inline-flex;
+ flex: 0 0 auto;
+ color: var(--ds-text-muted);
+}
+
+.scheduled-run-glyph.is-completed {
+ color: var(--ds-success);
+}
+
+.scheduled-run-glyph.is-error {
+ color: var(--ds-error);
+}
+
+.scheduled-run-glyph.is-running {
+ color: var(--ds-warning);
+}
+
+.scheduled-run-body {
+ display: flex;
+ min-width: 0;
+ flex: 1;
+ flex-direction: column;
+ gap: 2px;
+}
+
+.scheduled-run-state {
+ color: var(--ds-text-primary);
+ font-size: var(--text-sm-plus);
+ font-weight: var(--font-weight-medium);
+}
+
+.scheduled-run-meta {
+ overflow: hidden;
+ color: var(--ds-text-muted);
+ font-size: var(--text-xs);
+ text-overflow: ellipsis;
+ white-space: nowrap;
+}
+
+.scheduled-run-chevron {
+ flex: 0 0 auto;
+ color: var(--ds-text-muted);
+ transition: transform var(--motion-duration-fast) var(--motion-ease-out);
+}
+
+.scheduled-run-chevron.is-open {
+ transform: rotate(180deg);
+}
+
+.scheduled-icon-btn {
+ display: inline-flex;
+ height: 26px;
+ width: 26px;
+ flex: 0 0 auto;
+ align-items: center;
+ justify-content: center;
+ border: 0;
+ border-radius: var(--radius-sm);
+ background: transparent;
+ color: var(--ds-text-muted);
+ transition:
+ background var(--motion-duration-fast) var(--motion-ease-out),
+ color var(--motion-duration-fast) var(--motion-ease-out);
+}
+
+.scheduled-icon-btn:hover:not(:disabled),
+.scheduled-icon-btn:focus-visible {
+ background: var(--ds-bg-hover);
+ color: var(--ds-text-primary);
+}
+
+.scheduled-icon-btn:disabled {
+ opacity: 0.5;
+ cursor: not-allowed;
+}
+
+/* ---- run content --------------------------------------------------------- */
+
+.scheduled-content-meta {
+ flex: 0 0 auto;
+ color: var(--ds-text-muted);
+ font-size: var(--text-xs);
+ font-variant-numeric: tabular-nums;
+}
+
+.scheduled-transcript {
+ display: flex;
+ flex-direction: column;
+ gap: 0;
+ margin: 0;
+ padding: 0;
+ list-style: none;
+ max-height: 420px;
+ overflow-y: auto;
+}
+
+.scheduled-message {
+ display: flex;
+ flex-direction: column;
+ gap: 4px;
+ padding: 9px 0;
+ border-top: 1px solid var(--ds-border-subtle);
+}
+
+.scheduled-message:first-child {
+ border-top: 0;
+}
+
+.scheduled-message-role {
+ color: var(--ds-text-muted);
+ font-size: var(--text-3xs);
+ font-weight: var(--font-weight-medium);
+ letter-spacing: var(--tracking-wide);
+ text-transform: uppercase;
+}
+
+.scheduled-message-text {
+ margin: 0;
+ max-height: 260px;
+ overflow: auto;
+ overflow-wrap: anywhere;
+ color: var(--ds-text-primary);
+ font-size: var(--text-sm-plus);
+ line-height: var(--leading-body);
+ white-space: pre-wrap;
+}
+
+.scheduled-message-tool .scheduled-message-text,
+.scheduled-message-system .scheduled-message-text {
+ color: var(--ds-text-secondary);
+}
+
+.scheduled-message-text[data-status="error"] {
+ color: var(--ds-error);
+}
+
+.scheduled-transcript-more {
+ padding-bottom: 6px;
+}
+
+/* ---- responsive ---------------------------------------------------------- */
+
+@media (max-width: 900px) {
+ .scheduled-workspace {
+ grid-template-columns: minmax(0, 1fr);
+ }
+
+ .scheduled-rail {
+ position: static;
+ }
+
+ .scheduled-rail-list {
+ max-height: none;
+ }
+}
+
+@media (prefers-reduced-motion: reduce) {
+ .scheduled-task,
+ .scheduled-run,
+ .scheduled-run-chevron,
+ .scheduled-icon-btn,
+ .scheduled-disclosure {
+ transition: none;
+ }
+
+ .scheduled-task-live {
+ animation: none;
+ }
+}
diff --git a/apps/desktop/src/features/scheduled/use-scheduled-workspace.ts b/apps/desktop/src/features/scheduled/use-scheduled-workspace.ts
new file mode 100644
index 000000000..c84525cde
--- /dev/null
+++ b/apps/desktop/src/features/scheduled/use-scheduled-workspace.ts
@@ -0,0 +1,229 @@
+import { useCallback, useEffect, useMemo, useRef, useState } from "react";
+import type { ProjectRecord, ScheduledTask, ScheduledTaskRun } from "@pi-desktop/shared";
+import { api } from "../../lib/api";
+import { latestRunByTask, runsForTask, taskIsRunning } from "./scheduled-runs";
+import type { ScheduledDraft } from "./ScheduledEditor";
+
+/** Same cadence the page always used: the host owns admission, the page only
+ * reflects it. */
+const REFRESH_INTERVAL_MS = 10_000;
+/** One read feeds every task row's last outcome; the host bounds it at 200. */
+const RAIL_RUN_LIMIT = 100;
+/** The selected task's own history, which the run panel reads. */
+const TASK_RUN_LIMIT = 200;
+
+export type ScheduledWorkspace = {
+ tasks: ScheduledTask[];
+ projects: ProjectRecord[];
+ selectedTask: ScheduledTask | null;
+ selectedTaskId: string | null;
+ /** The selected task's own runs, newest first. */
+ runs: ScheduledTaskRun[];
+ /** Newest run per task, for the task column. */
+ latestRuns: Map<string, ScheduledTaskRun>;
+ selectedRunId: string | null;
+ busy: boolean;
+ loaded: boolean;
+ error: string;
+ taskIsRunning: (taskId: string) => boolean;
+ selectTask: (taskId: string) => void;
+ selectRun: (runId: string) => void;
+ refresh: () => Promise<void>;
+ saveTask: (taskId: string | null, draft: ScheduledDraft) => Promise<boolean>;
+ runTaskNow: (taskId: string) => Promise<void>;
+ toggleTask: (taskId: string, enabled: boolean) => Promise<void>;
+ deleteTask: (taskId: string) => Promise<void>;
+};
+
+/**
+ * Data flow for the Scheduled workspace: one poll for every task row's last
+ * outcome, one scoped read for the selected task's history, and the task
+ * mutations the page exposes. Reads are revision-guarded so a slow response can
+ * never overwrite a newer one, and a change of selection cancels the stale read.
+ */
+export function useScheduledWorkspace(
+ onError: (message: string) => void,
+): ScheduledWorkspace {
+ const [tasks, setTasks] = useState<ScheduledTask[]>([]);
+ const [recentRuns, setRecentRuns] = useState<ScheduledTaskRun[]>([]);
+ const [taskRuns, setTaskRuns] = useState<ScheduledTaskRun[]>([]);
+ const [projects, setProjects] = useState<ProjectRecord[]>([]);
+ const [selectedTaskId, setSelectedTaskId] = useState<string | null>(null);
+ const [selectedRunId, setSelectedRunId] = useState<string | null>(null);
+ const [busy, setBusy] = useState(false);
+ const [loaded, setLoaded] = useState(false);
+ const [error, setError] = useState("");
+
+ const mounted = useRef(false);
+ const revision = useRef(0);
+ const runRevision = useRef(0);
+ const selectedTaskIdRef = useRef<string | null>(null);
+ const busyRef = useRef(false);
+ const onErrorRef = useRef(onError);
+
+ useEffect(() => {
+ onErrorRef.current = onError;
+ }, [onError]);
+ useEffect(() => {
+ selectedTaskIdRef.current = selectedTaskId;
+ }, [selectedTaskId]);
+
+ const refresh = useCallback(async () => {
+ const request = ++revision.current;
+ try {
+ const [taskResult, runResult, projectResult] = await Promise.all([
+ api.listScheduled(),
+ api.listScheduledRuns({ limit: RAIL_RUN_LIMIT }),
+ api.listProjects().catch(() => ({ projects: [] as ProjectRecord[] })),
+ ]);
+ if (!mounted.current || request !== revision.current) return;
+ setTasks(taskResult.tasks);
+ setRecentRuns(runResult.runs);
+ setProjects(projectResult.projects);
+ setError("");
+ setLoaded(true);
+ } catch (failure) {
+ if (mounted.current && request === revision.current) {
+ setError(failure instanceof Error ? failure.message : String(failure));
+ }
+ }
+ }, []);
+
+ const readTaskRuns = useCallback(async (taskId: string) => {
+ const request = ++runRevision.current;
+ try {
+ const result = await api.listScheduledRuns({ taskId, limit: TASK_RUN_LIMIT });
+ if (!mounted.current || request !== runRevision.current) return;
+ setTaskRuns(result.runs);
+ } catch {
+ // The rail still reports the outcome it read; an empty history with a
+ // retryable page error is better than clearing what the user is reading.
+ if (mounted.current && request === runRevision.current) setTaskRuns([]);
+ }
+ }, []);
+
+ useEffect(() => {
+ mounted.current = true;
+ void refresh();
+ const id = selectedTaskIdRef.current;
+ if (id) void readTaskRuns(id);
+ const timer = setInterval(() => {
+ void refresh();
+ const current = selectedTaskIdRef.current;
+ if (current) void readTaskRuns(current);
+ }, REFRESH_INTERVAL_MS);
+ return () => {
+ mounted.current = false;
+ revision.current++;
+ runRevision.current++;
+ clearInterval(timer);
+ };
+ }, [refresh, readTaskRuns]);
+
+ // Keep one task selected: the first one, or the previous selection while it
+ // still exists. A deleted task never leaves the pane pointing at nothing.
+ useEffect(() => {
+ setSelectedTaskId((current) => {
+ if (current && tasks.some((task) => task.id === current)) return current;
+ return tasks[0]?.id ?? null;
+ });
+ }, [tasks]);
+
+ useEffect(() => {
+ setSelectedRunId(null);
+ if (selectedTaskId) void readTaskRuns(selectedTaskId);
+ }, [selectedTaskId, readTaskRuns]);
+
+ const selectedTask = useMemo(
+ () => tasks.find((task) => task.id === selectedTaskId) ?? null,
+ [tasks, selectedTaskId],
+ );
+ const runs = useMemo(() => runsForTask(taskRuns, selectedTaskId), [taskRuns, selectedTaskId]);
+ const latestRuns = useMemo(() => latestRunByTask(recentRuns), [recentRuns]);
+
+ const action = useCallback(
+ async (work: () => Promise<void>): Promise<boolean> => {
+ if (busyRef.current) return false;
+ busyRef.current = true;
+ setBusy(true);
+ try {
+ await work();
+ await refresh();
+ const current = selectedTaskIdRef.current;
+ if (current) await readTaskRuns(current);
+ return true;
+ } catch (failure) {
+ onErrorRef.current(failure instanceof Error ? failure.message : String(failure));
+ return false;
+ } finally {
+ busyRef.current = false;
+ if (mounted.current) setBusy(false);
+ }
+ },
+ [refresh, readTaskRuns],
+ );
+
+ const saveTask = useCallback(
+ async (taskId: string | null, draft: ScheduledDraft): Promise<boolean> =>
+ action(async () => {
+ if (taskId) await api.updateScheduled({ id: taskId, ...draft });
+ else await api.createScheduled(draft);
+ }),
+ [action],
+ );
+
+ const runTaskNow = useCallback(
+ async (taskId: string) => {
+ await action(async () => {
+ await api.executeScheduled(taskId);
+ // Show the run that was just admitted rather than an older selection.
+ setSelectedRunId(null);
+ });
+ },
+ [action],
+ );
+
+ const toggleTask = useCallback(
+ async (taskId: string, enabled: boolean) => {
+ await action(async () => {
+ await api.updateScheduled({ id: taskId, enabled });
+ });
+ },
+ [action],
+ );
+
+ const deleteTask = useCallback(
+ async (taskId: string) => {
+ await action(async () => {
+ await api.deleteScheduled(taskId);
+ if (selectedTaskIdRef.current === taskId) setSelectedRunId(null);
+ });
+ },
+ [action],
+ );
+
+ const selectTask = useCallback((taskId: string) => setSelectedTaskId(taskId), []);
+ const selectRun = useCallback((runId: string) => setSelectedRunId(runId), []);
+ const runningFor = useCallback((taskId: string) => taskIsRunning(recentRuns, taskId), [recentRuns]);
+
+ return {
+ tasks,
+ projects,
+ selectedTask,
+ selectedTaskId,
+ runs,
+ latestRuns,
+ selectedRunId,
+ busy,
+ loaded,
+ error,
+ taskIsRunning: runningFor,
+ selectTask,
+ selectRun,
+ refresh,
+ saveTask,
+ runTaskNow,
+ toggleTask,
+ deleteTask,
+ };
+}
diff --git a/apps/desktop/src/hooks/use-session-search.ts b/apps/desktop/src/hooks/use-session-search.ts
index 32010da4f..fa69e4494 100644
--- a/apps/desktop/src/hooks/use-session-search.ts
+++ b/apps/desktop/src/hooks/use-session-search.ts
@@ -2,6 +2,7 @@ import { useEffect, useMemo, useSyncExternalStore } from "react";
import { create } from "zustand";
import { api } from "../lib/api";
import { SessionSearchController } from "../lib/session-search";
+import { isAutomationSession } from "../lib/session-origin";
/** Transient search state survives closing the palette, never goes to disk. */
export const useSessionSearchState = create<{
@@ -27,7 +28,12 @@ export function useSessionSearch(open: boolean, query: string) {
}, [controller, normalized, open]);
return {
...state,
- hits: state.query === normalized ? state.hits : [],
+ // Scheduled run transcripts are reached from the Scheduled page, so search
+ // never offers them as a conversation to switch to (issue #1291).
+ hits:
+ state.query === normalized
+ ? state.hits.filter((hit) => !isAutomationSession(hit.session))
+ : [],
nextOffset: state.query === normalized ? state.nextOffset : null,
error: state.query === normalized ? state.error : undefined,
loading: Boolean(normalized) && (state.query !== normalized || state.loading),
diff --git a/apps/desktop/src/lib/api.ts b/apps/desktop/src/lib/api.ts
index 25a086885..06967c0c4 100644
--- a/apps/desktop/src/lib/api.ts
+++ b/apps/desktop/src/lib/api.ts
@@ -894,7 +894,8 @@ export const api = {
invoke<{ task: ScheduledTask }>(IPC.invoke.scheduledUpdate, input),
deleteScheduled: (id: string) => invoke(IPC.invoke.scheduledDelete, id),
executeScheduled: (id: string) => invoke<{ sessionId: string }>(IPC.invoke.scheduledExecute, id),
- listScheduledRuns: () => invoke<{ runs: ScheduledTaskRun[] }>(IPC.invoke.scheduledListRuns),
+ listScheduledRuns: (options: { taskId?: string; limit?: number } = {}) =>
+ invoke<{ runs: ScheduledTaskRun[] }>(IPC.invoke.scheduledListRuns, options),
runScheduled: (id: string) =>
invoke<{ sessionId: string; prompt: string; task: ScheduledTask }>(
IPC.invoke.scheduledRun,
diff --git a/apps/desktop/src/lib/session-origin.ts b/apps/desktop/src/lib/session-origin.ts
new file mode 100644
index 000000000..942e7a586
--- /dev/null
+++ b/apps/desktop/src/lib/session-origin.ts
@@ -0,0 +1,22 @@
+import type { SessionSummary } from "@pi-desktop/shared";
+
+/**
+ * A scheduled-task run owns its transcript: `scheduled.run` creates the session
+ * and records it in `task_runs`, and the host reports that ownership back as
+ * `scheduledRun` on every session summary (issue #1291).
+ *
+ * Those transcripts are entered from the Scheduled page — the task's own run
+ * history reads them in place — so the SessionList's project groups, its pinned
+ * rows, and global session search never list them. The session is still in the
+ * store, because opening it from the Scheduled page must resolve its title,
+ * source, and capabilities like any other conversation.
+ *
+ * Ownership is derived, never stored on the session: deleting the task removes
+ * the `task_runs` row, so its transcripts return to the ordinary lists instead
+ * of becoming unreachable.
+ */
+export function isAutomationSession(
+ session: Pick<SessionSummary, "scheduledRun"> | null | undefined,
+): boolean {
+ return session?.scheduledRun === true;
+}
diff --git a/apps/desktop/src/pages/ScheduledPage.tsx b/apps/desktop/src/pages/ScheduledPage.tsx
index a33c88933..eb77bce79 100644
--- a/apps/desktop/src/pages/ScheduledPage.tsx
+++ b/apps/desktop/src/pages/ScheduledPage.tsx
@@ -1,276 +1,134 @@
-import { useCallback, useEffect, useRef, useState } from "react";
+import { useState } from "react";
import { useTranslation } from "react-i18next";
-import type { ProjectRecord, ScheduledTask, ScheduledTaskRun } from "@pi-desktop/shared";
+import type { ScheduledTask } from "@pi-desktop/shared";
import { useAppStore } from "../stores/app-store";
-import { api } from "../lib/api";
-import { Badge, Button, Panel } from "../components/ui";
+import { Button, Panel } from "../components/ui";
import { IconClock } from "../components/icons";
import { ScheduledEditor, type ScheduledDraft } from "../features/scheduled/ScheduledEditor";
+import { ScheduledTaskDetail } from "../features/scheduled/ScheduledTaskDetail";
+import { ScheduledTaskRail } from "../features/scheduled/ScheduledTaskRail";
+import { useScheduledWorkspace } from "../features/scheduled/use-scheduled-workspace";
+import "../features/scheduled/scheduled-workspace.css";
+/**
+ * Scheduled workspace: a task column and the selected task's page. Each task
+ * reports its own last outcome and next occurrence, its runs are readable in
+ * place, and the conversation stays one explicit action away — the automation's
+ * transcripts live here rather than in the sidebar's project groups.
+ */
export function ScheduledPage() {
const { t, i18n } = useTranslation();
const showToast = useAppStore((s) => s.showToast);
const selectSession = useAppStore((s) => s.selectSession);
const setPage = useAppStore((s) => s.setPage);
const currentWorkspacePath = useAppStore((s) => s.workspace?.path ?? "");
- const [tasks, setTasks] = useState<ScheduledTask[]>([]);
- const [runs, setRuns] = useState<ScheduledTaskRun[]>([]);
- const [projects, setProjects] = useState<ProjectRecord[]>([]);
- const [tab, setTab] = useState<"tasks" | "runs">("tasks");
+ const providers = useAppStore((s) => s.providers);
const [editor, setEditor] = useState<ScheduledTask | "new" | null>(null);
- const [busy, setBusy] = useState(false);
- const [loaded, setLoaded] = useState(false);
- const [error, setError] = useState("");
- const mounted = useRef(false);
- const revision = useRef(0);
- const refresh = useCallback(async () => {
- const request = ++revision.current;
- try {
- const [taskResult, runResult, projectResult] = await Promise.all([
- api.listScheduled(),
- api.listScheduledRuns(),
- api.listProjects().catch(() => ({ projects: [] as ProjectRecord[] })),
- ]);
- if (!mounted.current || request !== revision.current) return;
- setTasks(taskResult.tasks);
- setRuns(runResult.runs);
- setProjects(projectResult.projects);
- setError("");
- setLoaded(true);
- } catch (failure) {
- if (mounted.current && request === revision.current)
- setError(failure instanceof Error ? failure.message : String(failure));
- }
- }, []);
- useEffect(() => {
- mounted.current = true;
- void refresh();
- const timer = setInterval(() => void refresh(), 10_000);
- return () => {
- mounted.current = false;
- revision.current++;
- clearInterval(timer);
- };
- }, [refresh]);
- const action = async (work: () => Promise<void>) => {
- if (busy) return;
- setBusy(true);
- try {
- await work();
- if (mounted.current) await refresh();
- } catch (failure) {
- showToast(failure instanceof Error ? failure.message : String(failure), { variant: "error" });
- } finally {
- if (mounted.current) setBusy(false);
- }
+ const workspace = useScheduledWorkspace((message) => showToast(message, { variant: "error" }));
+ const locale = i18n.resolvedLanguage ?? i18n.language;
+ const { tasks, projects, selectedTask, selectedTaskId, runs, latestRuns, selectedRunId, busy, loaded, error } =
+ workspace;
+
+ const openSession = async (sessionId: string) => {
+ await selectSession(sessionId);
+ setPage("chat");
+ };
+ const save = async (draft: ScheduledDraft) => {
+ const saved = await workspace.saveTask(editor && editor !== "new" ? editor.id : null, draft);
+ if (saved) setEditor(null);
};
- const save = (draft: ScheduledDraft) =>
- action(async () => {
- if (editor && editor !== "new") await api.updateScheduled({ id: editor.id, ...draft });
- else await api.createScheduled(draft);
- if (mounted.current) setEditor(null);
- });
- const openSession = async (id: string) => {
- await selectSession(id);
- if (mounted.current) setPage("chat");
+ const remove = (task: ScheduledTask) => {
+ if (!window.confirm(t("scheduled.deleteConfirm", { title: task.title }))) return;
+ if (editor && editor !== "new" && editor.id === task.id) setEditor(null);
+ void workspace.deleteTask(task.id);
};
- const date = (value: string) =>
- new Date(value).toLocaleString(i18n.resolvedLanguage ?? i18n.language);
- const cadenceKey = {
- manual: "scheduled.cadenceManual",
- hourly: "scheduled.cadenceHourly",
- daily: "scheduled.cadenceDaily",
- weekly: "scheduled.cadenceWeekly",
- } as const;
- const statusKey = {
- running: "scheduled.statusRunning",
- completed: "scheduled.statusCompleted",
- aborted: "scheduled.statusAborted",
- error: "scheduled.statusError",
- } as const;
+ // Relative labels are recomputed on every render, and the poll re-renders at
+ // least every ten seconds, so a row never reports a stale "in 2 minutes".
+ const now = Date.now();
+
return (
<div className="route-scroll">
- <div className="page-frame">
+ <div className="page-frame scheduled-frame">
<div className="page-header">
<div>
<h1 className="page-title">{t("scheduled.title")}</h1>
<p className="dest-row-meta">{t("scheduled.description")}</p>
</div>
- <Button
- variant="primary"
- disabled={busy}
- onClick={() => {
- setTab("tasks");
- setEditor("new");
- }}
- >
+ <Button variant="primary" disabled={busy} onClick={() => setEditor("new")}>
{t("scheduled.create")}
</Button>
</div>
- <div className="mb-4 flex gap-2" role="group" aria-label={t("scheduled.title")}>
- <Button
- aria-pressed={tab === "tasks"}
- variant={tab === "tasks" ? "secondary" : "ghost"}
- onClick={() => setTab("tasks")}
- >
- {t("scheduled.tasks")} ({tasks.length})
- </Button>
- <Button
- aria-pressed={tab === "runs"}
- variant={tab === "runs" ? "secondary" : "ghost"}
- onClick={() => setTab("runs")}
- >
- {t("scheduled.runs")}
- </Button>
- </div>
+
{error && (
- <Panel>
+ <Panel className="scheduled-error">
<p role="alert">{error}</p>
- <Button onClick={() => void refresh()}>{t("scheduled.retry")}</Button>
+ <Button onClick={() => void workspace.refresh()}>{t("scheduled.retry")}</Button>
</Panel>
)}
{!loaded && !error && <p role="status">{t("common.loading")}</p>}
- {tab === "tasks" && (
- <>
- {editor && (
- <ScheduledEditor
- key={editor === "new" ? "new" : editor.id}
- task={editor === "new" ? undefined : editor}
- projects={projects}
- currentWorkspacePath={currentWorkspacePath}
+
+ {editor && (
+ <div className="scheduled-editor-slot">
+ <ScheduledEditor
+ key={editor === "new" ? "new" : editor.id}
+ task={editor === "new" ? undefined : editor}
+ projects={projects}
+ currentWorkspacePath={currentWorkspacePath}
+ busy={busy}
+ save={save}
+ cancel={() => setEditor(null)}
+ />
+ </div>
+ )}
+
+ {loaded && tasks.length === 0 && !editor ? (
+ <Panel className="page-card page-empty">
+ <div className="page-empty-icon">
+ <IconClock size={20} />
+ </div>
+ <h2>{t("scheduled.emptyTitle")}</h2>
+ <p className="dest-row-meta">{t("scheduled.description")}</p>
+ </Panel>
+ ) : null}
+
+ {loaded && tasks.length > 0 ? (
+ <div className="scheduled-workspace">
+ <ScheduledTaskRail
+ tasks={tasks}
+ latestRuns={latestRuns}
+ selectedTaskId={selectedTaskId}
+ now={now}
+ locale={locale}
+ onSelect={workspace.selectTask}
+ />
+ {selectedTask ? (
+ <ScheduledTaskDetail
+ task={selectedTask}
+ runs={runs}
+ selectedRunId={selectedRunId}
+ running={workspace.taskIsRunning(selectedTask.id)}
busy={busy}
- save={save}
- cancel={() => setEditor(null)}
+ now={now}
+ locale={locale}
+ onSelectRun={workspace.selectRun}
+ onOpenSession={(sessionId) => void openSession(sessionId)}
+ onRunNow={() => void workspace.runTaskNow(selectedTask.id)}
+ onEdit={() => setEditor(selectedTask)}
+ onToggleEnabled={() =>
+ void workspace.toggleTask(selectedTask.id, !selectedTask.enabled)
+ }
+ onDelete={() => remove(selectedTask)}
+ providerName={
+ providers.find((item) => item.id === selectedTask.providerId)?.name ?? null
+ }
/>
- )}
- {loaded && !tasks.length && !editor && (
+ ) : (
<Panel className="page-card page-empty">
- <div className="page-empty-icon">
- <IconClock size={20} />
- </div>
- <h2>{t("scheduled.emptyTitle")}</h2>
- <p className="dest-row-meta">{t("scheduled.description")}</p>
+ <p className="dest-row-meta">{t("scheduled.selectTask")}</p>
</Panel>
)}
- <div className="dest-list">
- {tasks.map((task) => {
- const running = runs.some(
- (run) => run.taskId === task.id && run.status === "running",
- );
- return (
- <div className="dest-row" key={task.id}>
- <div className="dest-row-icon">
- <IconClock size={16} />
- </div>
- <div className="dest-row-body">
- <div className="dest-row-title">
- <span>{task.title}</span>
- <Badge tone={task.enabled ? "success" : "neutral"}>
- {t(task.enabled ? "scheduled.enabled" : "scheduled.disabled")}
- </Badge>
- <Badge tone="neutral">{t(cadenceKey[task.cadence])}</Badge>
- </div>
- <p className="dest-row-meta line-clamp-2">{task.prompt}</p>
- <p className="dest-row-meta">
- {task.schedule && task.enabled && task.nextRunAt
- ? `${t("scheduled.nextRun")}: ${date(task.nextRunAt)}`
- : t(
- task.enabled && task.cadence !== "manual" && !task.schedule
- ? "scheduled.legacyHint"
- : "scheduled.noNextRun",
- )}
- </p>
- {task.workspacePath && (
- <p className="dest-row-meta truncate">{task.workspacePath}</p>
- )}
- </div>
- <div className="dest-row-actions flex-wrap">
- <Button
- size="sm"
- disabled={busy || running}
- onClick={() =>
- void action(async () => {
- await api.executeScheduled(task.id);
- if (mounted.current) setTab("runs");
- })
- }
- >
- {t(running ? "scheduled.statusRunning" : "scheduled.runNow")}
- </Button>
- <Button size="sm" disabled={busy} onClick={() => setEditor(task)}>
- {t("scheduled.edit")}
- </Button>
- <Button
- size="sm"
- disabled={busy}
- onClick={() =>
- void action(async () => {
- await api.updateScheduled({ id: task.id, enabled: !task.enabled });
- })
- }
- >
- {t(task.enabled ? "scheduled.pause" : "scheduled.resume")}
- </Button>
- <Button
- size="sm"
- variant="ghost"
- disabled={busy || running}
- onClick={() => {
- if (window.confirm(t("scheduled.deleteConfirm", { title: task.title })))
- void action(async () => {
- await api.deleteScheduled(task.id);
- });
- }}
- >
- {t("scheduled.delete")}
- </Button>
- </div>
- </div>
- );
- })}
- </div>
- </>
- )}
- {tab === "runs" && (
- <>
- <p className="dest-row-meta mb-3">{t("scheduled.historyHint")}</p>
- {!runs.length && loaded && (
- <Panel className="page-card page-empty">{t("scheduled.emptyRuns")}</Panel>
- )}
- <div className="dest-list">
- {runs.map((run) => (
- <div className="dest-row" key={run.id}>
- <div className="dest-row-body">
- <div className="dest-row-title">
- <span>
- {tasks.find((task) => task.id === run.taskId)?.title ??
- t("scheduled.title")}
- </span>
- <Badge tone={run.status === "completed" ? "success" : "neutral"}>
- {t(statusKey[run.status])}
- </Badge>
- </div>
- <p className="dest-row-meta">{date(run.startedAt)}</p>
- {run.errorCode && (
- <p className="dest-row-meta">
- {t("scheduled.runError")} ({run.errorCode})
- </p>
- )}
- </div>
- {run.sessionId && (
- <Button
- size="sm"
- disabled={busy}
- onClick={() => void action(() => openSession(run.sessionId!))}
- >
- {t("scheduled.openResult")}
- </Button>
- )}
- </div>
- ))}
- </div>
- </>
- )}
+ </div>
+ ) : null}
</div>
</div>
);
diff --git a/apps/desktop/test/scheduled-workspace.test.mjs b/apps/desktop/test/scheduled-workspace.test.mjs
new file mode 100644
index 000000000..bdf1f22ec
--- /dev/null
+++ b/apps/desktop/test/scheduled-workspace.test.mjs
@@ -0,0 +1,300 @@
+import assert from "node:assert/strict";
+import test from "node:test";
+import { createElement } from "react";
+import { renderToStaticMarkup } from "react-dom/server";
+import { createInstance } from "i18next";
+import { I18nextProvider } from "react-i18next";
+import { catalogs } from "@pi-desktop/i18n";
+import { createServer } from "vite";
+import { fileURLToPath } from "node:url";
+
+const NOW = Date.parse("2026-01-02T12:00:00Z");
+
+const TASK_A = {
+ id: "task-a",
+ title: "Nightly dependency check",
+ prompt: "Summarize the dependency state and the open issues.",
+ cadence: "daily",
+ mode: "agent",
+ enabled: true,
+ createdAt: "2026-01-01T00:00:00Z",
+ updatedAt: "2026-01-02T00:01:12Z",
+ lastRunAt: "2026-01-02T00:01:12Z",
+ schedule: { hour: 9, minute: 5, weekday: 0 },
+ nextRunAt: "2026-01-03T09:05:00Z",
+ workspacePath: "/Users/dev/project",
+ permissionMode: "auto",
+ providerId: "custom",
+ modelId: "fixture",
+};
+
+const TASK_B = {
+ id: "task-b",
+ title: "PR sweep",
+ prompt: "Review the open pull requests.",
+ cadence: "manual",
+ mode: "agent",
+ enabled: false,
+ createdAt: "2026-01-01T00:00:00Z",
+ updatedAt: "2026-01-01T00:00:00Z",
+ schedule: null,
+};
+
+const RUN_FAILED = {
+ id: "run-failed",
+ taskId: "task-a",
+ sessionId: "session-failed",
+ status: "error",
+ errorCode: "PROVIDER_ERROR",
+ startedAt: "2026-01-02T00:00:00Z",
+ endedAt: "2026-01-02T00:01:12Z",
+};
+
+const RUN_COMPLETED = {
+ id: "run-completed",
+ taskId: "task-a",
+ sessionId: "session-completed",
+ status: "completed",
+ errorCode: null,
+ startedAt: "2026-01-01T00:00:00Z",
+ endedAt: "2026-01-01T00:00:42Z",
+};
+
+async function withVite(work) {
+ const server = await createServer({
+ root: fileURLToPath(new URL("..", import.meta.url)),
+ configFile: false,
+ server: { middlewareMode: true, hmr: false, ws: false },
+ esbuild: { jsx: "automatic" },
+ appType: "custom",
+ optimizeDeps: { noDiscovery: true, include: [] },
+ });
+ try {
+ return await work(server);
+ } finally {
+ await server.close();
+ }
+}
+
+/** Renders one component the way the route does, through the real catalog. */
+async function render(server, modulePath, exportName, props, locale = "en") {
+ const module = await server.ssrLoadModule(modulePath);
+ const Component = module[exportName];
+ const i18n = createInstance();
+ await i18n.init({ lng: locale, resources: { [locale]: { translation: catalogs[locale] } } });
+ return renderToStaticMarkup(
+ createElement(I18nextProvider, { i18n }, createElement(Component, props)),
+ );
+}
+
+test("run helpers scope, order, and measure one task's history", async () => {
+ await withVite(async (server) => {
+ const runs = await server.ssrLoadModule("/src/features/scheduled/scheduled-runs.ts");
+ const sample = [RUN_FAILED, RUN_COMPLETED, { ...RUN_COMPLETED, id: "run-other", taskId: "task-b" }];
+
+ assert.deepEqual(
+ runs.runsForTask(sample, "task-a").map((run) => run.id),
+ ["run-failed", "run-completed"],
+ "newest first, and only this task's runs",
+ );
+ assert.deepEqual(runs.runsForTask(sample, null), []);
+ assert.equal(runs.latestRunByTask(sample).get("task-a").id, "run-failed");
+ assert.equal(runs.latestRunForTask(sample, "task-a").id, "run-failed");
+
+ assert.equal(runs.runDurationMs(RUN_FAILED), 72_000);
+ assert.equal(
+ runs.runDurationMs({ ...RUN_FAILED, endedAt: null, status: "running" }),
+ null,
+ "a run still in flight has no duration",
+ );
+ assert.equal(runs.runDurationMs({ ...RUN_FAILED, endedAt: "2026-01-01T00:00:00Z" }), null);
+
+ assert.equal(runs.taskIsRunning(sample, "task-a"), false);
+ assert.equal(runs.taskIsRunning([{ ...RUN_FAILED, status: "running" }], "task-a"), true);
+
+ const history = runs.runsForTask(sample, "task-a");
+ assert.equal(runs.resolveSelectedRun(history, "run-completed").id, "run-completed");
+ assert.equal(
+ runs.resolveSelectedRun(history, "run-deleted").id,
+ "run-failed",
+ "a selection that no longer exists falls back to the newest run",
+ );
+ assert.equal(runs.resolveSelectedRun([], "run-failed"), null);
+ assert.equal(runs.selectedRunSessionId(history, "run-completed"), "session-completed");
+ });
+});
+
+test("run formatting stays compact, localized, and bounded", async () => {
+ await withVite(async (server) => {
+ const format = await server.ssrLoadModule("/src/features/scheduled/scheduled-format.ts");
+
+ assert.equal(format.formatDuration(0), "1s");
+ assert.equal(format.formatDuration(42_400), "42s");
+ assert.equal(format.formatDuration(72_000), "1m 12s");
+ assert.equal(format.formatDuration(120_000), "2m");
+ assert.equal(format.formatDuration(5_400_000), "1h 30m");
+ assert.equal(format.formatDuration(7_200_000), "2h");
+ assert.equal(format.formatDuration(null), "");
+ assert.equal(format.formatDuration(Number.NaN), "");
+
+ assert.match(format.formatRelativeMoment("2026-01-02T11:00:00Z", NOW, "en"), /hour/);
+ assert.match(format.formatRelativeMoment("2026-01-04T12:00:00Z", NOW, "en"), /day/);
+ const far = format.formatRelativeMoment("2026-02-11T12:00:00Z", NOW, "en");
+ assert.doesNotMatch(far, /day|hour|minute/, "beyond a week the phrase becomes a date");
+ assert.ok(far.length > 0);
+ assert.equal(format.formatRelativeMoment(null, NOW, "en"), "");
+
+ assert.equal(format.formatScheduleClock({ hour: 9, minute: 5, weekday: 0 }), "09:05");
+ assert.equal(format.formatScheduleClock({ hour: 23, minute: 59, weekday: 0 }), "23:59");
+ assert.equal(format.formatScheduleClock(null), null);
+ assert.equal(format.formatScheduleClock({ hour: 24, minute: 0, weekday: 0 }), null);
+ });
+});
+
+test("the task column reports each task's own last outcome", async () => {
+ await withVite(async (server) => {
+ const html = await render(server, "/src/features/scheduled/ScheduledTaskRail.tsx", "ScheduledTaskRail", {
+ tasks: [TASK_A, TASK_B],
+ latestRuns: new Map([["task-a", RUN_FAILED]]),
+ selectedTaskId: "task-a",
+ now: NOW,
+ locale: "en",
+ onSelect() {},
+ });
+
+ assert.match(html, /Nightly dependency check/);
+ assert.match(html, /Daily · 09:05/, "cadence and its clock share one line");
+ assert.match(html, /Failed/, "the failing task reports its own outcome");
+ assert.match(html, /1m 12s/, "and how long it took");
+ assert.match(html, /PR sweep/);
+ assert.match(html, /Not run yet/, "a task that never ran says so");
+ assert.match(html, /Disabled/, "a paused task is marked");
+ assert.equal((html.match(/aria-current="true"/g) ?? []).length, 1, "one selected task");
+ });
+});
+
+test("the task page reads facts, history, and the selected run in place", async () => {
+ await withVite(async (server) => {
+ const format = await server.ssrLoadModule("/src/features/scheduled/scheduled-format.ts");
+ const props = {
+ task: TASK_A,
+ runs: [RUN_FAILED, RUN_COMPLETED],
+ selectedRunId: RUN_FAILED.id,
+ running: false,
+ busy: false,
+ now: NOW,
+ locale: "en",
+ onSelectRun() {},
+ onOpenSession() {},
+ onRunNow() {},
+ onEdit() {},
+ onToggleEnabled() {},
+ onDelete() {},
+ providerName: "Fixture provider",
+ };
+ const html = await render(
+ server,
+ "/src/features/scheduled/ScheduledTaskDetail.tsx",
+ "ScheduledTaskDetail",
+ props,
+ );
+
+ assert.match(html, /Nightly dependency check/);
+ assert.match(html, /Last run[\s\S]*?Failed/, "the facts lead with the last outcome");
+ assert.match(html, /1m 12s/);
+ assert.match(html, /~/u, "the project path is shortened");
+ assert.match(html, /Auto/, "the task's own permission mode is shown");
+ assert.match(html, /Fixture provider \/ fixture/, "the model fact names the provider, not its id");
+ const unnamedProvider = await render(
+ server,
+ "/src/features/scheduled/ScheduledTaskDetail.tsx",
+ "ScheduledTaskDetail",
+ { ...props, providerName: null },
+ );
+ assert.doesNotMatch(
+ unnamedProvider,
+ /custom \/ fixture/,
+ "an unresolved provider never leaks its UUID into the facts row",
+ );
+ assert.match(html, /aria-expanded="false"/, "the instruction starts collapsed");
+ assert.match(html, /PROVIDER_ERROR/, "a failed run keeps its code in the history");
+ assert.match(html, /Run history/);
+ assert.match(html, /Run content/);
+
+ const contentCard = html.slice(html.indexOf('id="scheduled-run-content"'));
+ assert.ok(
+ contentCard.includes(format.formatMoment(RUN_FAILED.startedAt, "en")),
+ "the content card follows the selected run",
+ );
+
+ const other = await render(
+ server,
+ "/src/features/scheduled/ScheduledTaskDetail.tsx",
+ "ScheduledTaskDetail",
+ { ...props, selectedRunId: RUN_COMPLETED.id },
+ );
+ const otherCard = other.slice(other.indexOf('id="scheduled-run-content"'));
+ assert.ok(
+ otherCard.includes(format.formatMoment(RUN_COMPLETED.startedAt, "en")),
+ "selecting another run moves the card with it",
+ );
+ assert.equal((other.match(/aria-current="true"/g) ?? []).length, 1);
+ });
+});
+
+test("a run with no stored transcript says so instead of showing an empty pane", async () => {
+ await withVite(async (server) => {
+ const html = await render(
+ server,
+ "/src/features/scheduled/ScheduledRunTranscript.tsx",
+ "ScheduledRunTranscript",
+ { run: { ...RUN_COMPLETED, sessionId: null } },
+ );
+ assert.match(html, /This run stored no transcript\./);
+ });
+});
+
+test("automation ownership keeps run transcripts out of the lists", async () => {
+ await withVite(async (server) => {
+ const { isAutomationSession } = await server.ssrLoadModule("/src/lib/session-origin.ts");
+ assert.equal(isAutomationSession({ scheduledRun: true }), true);
+ assert.equal(isAutomationSession({ scheduledRun: false }), false);
+ assert.equal(isAutomationSession({}), false, "a host that omits the flag is ordinary");
+ assert.equal(isAutomationSession(null), false);
+ assert.equal(isAutomationSession(undefined), false);
+ });
+});
+
+test("the session list and search both consume the automation predicate", async () => {
+ const { readFile } = await import("node:fs/promises");
+ const sidebar = await readFile(new URL("../src/components/Sidebar.tsx", import.meta.url), "utf8");
+ assert.match(sidebar, /import \{ isAutomationSession \} from "\.\.\/lib\/session-origin";/);
+ assert.match(
+ sidebar,
+ /\.filter\(\(session\) => !isAutomationSession\(session\)\)/,
+ "the sidebar drops automation transcripts before grouping",
+ );
+ const search = await readFile(new URL("../src/hooks/use-session-search.ts", import.meta.url), "utf8");
+ assert.match(
+ search,
+ /state\.hits\.filter\(\(hit\) => !isAutomationSession\(hit\.session\)\)/,
+ "search never offers one as a conversation to open",
+ );
+});
+
+test("a run's transcript follows the run, not just its session", async () => {
+ // A real run wrote its answer only after the card opened; reading once on the
+ // session id alone left the reader with the prompt and no reply.
+ const { readFile } = await import("node:fs/promises");
+ const source = await readFile(
+ new URL("../src/features/scheduled/ScheduledRunTranscript.tsx", import.meta.url),
+ "utf8",
+ );
+ assert.match(
+ source,
+ /\}, \[read, run\.status, run\.endedAt\]\);/,
+ "a run that finished re-reads its transcript",
+ );
+ assert.match(source, /run\.status !== "running"/, "an in-flight run keeps following it");
+ assert.match(source, /revision\.current\+\+/, "and a late response cannot overwrite a newer read");
+});
diff --git a/apps/desktop/test/settings-general.test.mjs b/apps/desktop/test/settings-general.test.mjs
index 3ab051c30..c806d1c55 100644
--- a/apps/desktop/test/settings-general.test.mjs
+++ b/apps/desktop/test/settings-general.test.mjs
@@ -26,6 +26,10 @@ const scheduledSource = await readFile(
new URL("../src/pages/ScheduledPage.tsx", import.meta.url),
"utf8",
);
+const scheduledFormatSource = await readFile(
+ new URL("../src/features/scheduled/scheduled-format.ts", import.meta.url),
+ "utf8",
+);
const pluginsPageSource = await readPluginsSource();
const marketplaceSettingsSource = await readFile(
new URL(
@@ -253,9 +257,13 @@ test("stored language drives i18n and native labels at startup and on settings c
});
test("date copy follows the active application locale", () => {
+ // The page resolves one locale and hands it to every moment it renders; the
+ // formatter is what actually builds the string.
+ assert.match(scheduledSource, /const locale = i18n\.resolvedLanguage \?\? i18n\.language;/);
+ assert.match(scheduledSource, /locale=\{locale\}/);
assert.match(
- scheduledSource,
- /toLocaleString\(\s*i18n\.resolvedLanguage \?\? i18n\.language/s,
+ scheduledFormatSource,
+ /new Intl\.DateTimeFormat\(locale \|\| undefined/,
);
assert.match(
providersSource,
diff --git a/crates/host-core/src/rpc/scheduled_rpc.rs b/crates/host-core/src/rpc/scheduled_rpc.rs
index ce248bc61..f40e9b38c 100644
--- a/crates/host-core/src/rpc/scheduled_rpc.rs
+++ b/crates/host-core/src/rpc/scheduled_rpc.rs
@@ -288,6 +288,90 @@ fn validate_execution_input(params: &Value) -> Result<(), JsonRpcError> {
mod tests {
use super::*;
+ /// A run's transcript reports its automation ownership, the reader the
+ /// Scheduled page uses sees the same flag, search carries it through the
+ /// query that builds its own column list, and deleting the task releases the
+ /// transcript back into the ordinary lists (issue #1291).
+ #[tokio::test]
+ async fn automation_sessions_are_marked_and_released_with_their_task() {
+ let dir = tempfile::tempdir().unwrap();
+ let mut st = AppState::open(dir.path()).unwrap();
+ st.handshook = true;
+ let id = handle(
+ &st,
+ "scheduled.create",
+ json!({"title":"Nightly","prompt":"Summarize the dependencies",
+ "cadence":"manual","schedule":null}),
+ )
+ .unwrap()["task"]["id"]
+ .as_str()
+ .unwrap()
+ .to_string();
+ let run = handle(&st, "scheduled.run", json!({"id":id})).unwrap();
+ let run_session = run["sessionId"].as_str().unwrap().to_string();
+ let ordinary = sessions::create_session(
+ &st.db,
+ Some("Hand written".into()),
+ Some("agent".into()),
+ None,
+ None,
+ None,
+ )
+ .unwrap();
+
+ let flag = |session_id: &str| {
+ sessions::list_sessions(&st.db)
+ .unwrap()
+ .into_iter()
+ .find(|session| session.id == session_id)
+ .map(|session| session.scheduled_run)
+ };
+ assert_eq!(
+ flag(&run_session),
+ Some(true),
+ "a run's transcript is marked as automation output"
+ );
+ assert_eq!(
+ flag(&ordinary.id),
+ Some(false),
+ "an ordinary conversation is never marked"
+ );
+ let detail = sessions::get_session(&st.db, &run_session)
+ .unwrap()
+ .expect("the run's session exists");
+ assert!(detail.summary.scheduled_run);
+
+ let page = crate::session_search::search(&st.db, "Nightly", 0).unwrap();
+ let hit = page
+ .hits
+ .iter()
+ .find(|hit| hit.session.id == run_session)
+ .expect("search finds the run's transcript");
+ assert!(
+ hit.session.scheduled_run,
+ "search reports the same ownership as the list"
+ );
+
+ // A task with a run still in flight cannot be deleted yet.
+ let settled = handle(
+ &st,
+ "scheduled.finishRun",
+ json!({"runId": run["runId"].as_str().unwrap(), "status": "completed"}),
+ )
+ .unwrap();
+ assert_eq!(settled["ok"], json!(true));
+ handle(&st, "scheduled.delete", json!({"id":id})).unwrap();
+ assert_eq!(
+ flag(&run_session),
+ Some(false),
+ "deleting the task releases its transcripts"
+ );
+ assert!(
+ flag(&ordinary.id).is_some(),
+ "the conversation itself survives the task deletion"
+ );
+ }
+
#[tokio::test]
async fn review_deleted_project_is_not_recreated_by_automatic_task() {
use std::sync::Arc;
diff --git a/crates/host-core/src/session_search.rs b/crates/host-core/src/session_search.rs
index 70ce064b3..28c1c4170 100644
--- a/crates/host-core/src/session_search.rs
+++ b/crates/host-core/src/session_search.rs
@@ -85,7 +85,8 @@ pub fn search(db: &Database, query: &str, offset: i64) -> Result<SearchPage> {
s.thinking_level, s.permission_mode, s.updated_at, s.created_at,
p.name, COALESCE(matched.count, 0),
(pi_search_contains(s.title, ?1) OR pi_search_contains(p.name, ?1)
- OR pi_search_contains(p.path, ?1)) AS metadata_match
+ OR pi_search_contains(p.path, ?1)) AS metadata_match,
+ EXISTS (SELECT 1 FROM task_runs r WHERE r.session_id = s.id) AS scheduled_run
FROM sessions s LEFT JOIN projects p ON p.id = s.project_id
LEFT JOIN matched ON matched.session_id = s.id
WHERE s.deleted_at IS NULL AND (matched.count > 0 OR metadata_match)
diff --git a/crates/host-core/src/sessions.rs b/crates/host-core/src/sessions.rs
index 778b3c344..0b2478225 100644
--- a/crates/host-core/src/sessions.rs
+++ b/crates/host-core/src/sessions.rs
@@ -115,6 +115,13 @@ pub struct SessionSummary {
pub permission_mode: String,
pub updated_at: String,
pub created_at: String,
+ /// True when this session is the transcript owned by a scheduled-task run.
+ /// Automation transcripts are entered from the Scheduled page, so the
+ /// sidebar and session search hide them (issue #1291). The value is derived
+ /// from `task_runs.session_id` on read; no session column stores it, and
+ /// deleting the task frees its sessions back into the ordinary lists.
+ #[serde(default)]
+ pub scheduled_run: bool,
}
#[derive(Debug, Clone, Serialize, Deserialize)]
@@ -1175,7 +1182,8 @@ fn session_created_at(db: &Database, session_id: &str) -> Result<String> {
const SUMMARY_SELECT: &str =
"SELECT s.id, s.title, s.last_seq, p.path, s.model_id, s.provider_id, s.mode,
- s.thinking_level, s.permission_mode, s.updated_at, s.created_at
+ s.thinking_level, s.permission_mode, s.updated_at, s.created_at,
+ EXISTS (SELECT 1 FROM task_runs r WHERE r.session_id = s.id) AS scheduled_run
FROM sessions s LEFT JOIN projects p ON p.id = s.project_id
WHERE s.deleted_at IS NULL";
@@ -1192,6 +1200,9 @@ pub(crate) fn summary_from_row(row: &rusqlite::Row<'_>) -> rusqlite::Result<Sess
permission_mode: row.get(8)?,
updated_at: ms_to_ts(row.get(9)?),
created_at: ms_to_ts(row.get(10)?),
+ // Read by name: search and listing build their own column lists, so the
+ // alias keeps this mapper independent of any one query's column order.
+ scheduled_run: row.get("scheduled_run")?,
})
}
@@ -1357,6 +1368,8 @@ pub fn create_session_with_options(
permission_mode,
updated_at: ms_to_ts(now),
created_at: ms_to_ts(now),
+ // The run row that owns this transcript is written after creation.
+ scheduled_run: false,
})
}
@@ -1717,6 +1730,8 @@ pub fn fork_session_through(
permission_mode: source.summary.permission_mode,
updated_at: created_at.clone(),
created_at,
+ // A fork is the user's own conversation, not the automation's transcript.
+ scheduled_run: false,
};
let messages = records.into_iter().map(record_to_ui).collect();
Ok(ForkSessionResult::Created(Box::new(SessionDetail {
@@ -4431,6 +4446,8 @@ mod tests {
mode: "agent".into(),
thinking_level: "off".into(),
permission_mode: "inherit".into(),
+ // Ownership is derived from `task_runs`, so an import is never one.
+ scheduled_run: false,
created_at: "2025-01-01T00:00:00Z".into(),
updated_at: "2025-01-02T00:00:00Z".into(),
};
@@ -4481,6 +4498,8 @@ mod tests {
mode: "agent".into(),
thinking_level: "off".into(),
permission_mode: "inherit".into(),
+ // Ownership is derived from `task_runs`, so an import is never one.
+ scheduled_run: false,
created_at: "2025-01-01T00:00:00Z".into(),
updated_at: "2025-01-01T00:00:00Z".into(),
};
@@ -5306,6 +5325,8 @@ mod tests {
mode: "agent".into(),
thinking_level: "medium".into(),
permission_mode: "inherit".into(),
+ // Ownership is derived from `task_runs`, so an import is never one.
+ scheduled_run: false,
created_at: "2025-01-01T00:00:00Z".into(),
updated_at: "2025-01-01T00:00:00Z".into(),
};
diff --git a/docs/spec/03-runtime/04-data-storage.md b/docs/spec/03-runtime/04-data-storage.md
index 5b7aacc16..4ae94d59a 100644
--- a/docs/spec/03-runtime/04-data-storage.md
+++ b/docs/spec/03-runtime/04-data-storage.md
@@ -1127,6 +1127,12 @@ CREATE INDEX idx_task_runs ON task_runs(task_id, started_at DESC);
```
A run that spawns a session gets its transcript for free via `session_id`.
+That transcript is identified as automation output by an `EXISTS` check against
+`task_runs` that every session summary and search hit carries as `scheduledRun`.
+The ownership is derived on read and never stored on the session row, so the
+SessionList and session search hide the transcript while it has a run, and
+deleting the task returns it to the ordinary lists instead of leaving it
+unreachable (issue #1291).
The existing JSON extension stores `schedule: {hour, minute, weekday}`,
`nextRunAt` (epoch milliseconds) and `workspacePath` for desktop automations.
Optional `weekdays` stores 1–7 unique integers in 0–6, overriding legacy
diff --git a/docs/spec/04-ux/01-ui-ia.md b/docs/spec/04-ux/01-ui-ia.md
index baa6a4a7c..3030b352f 100644
--- a/docs/spec/04-ux/01-ui-ia.md
+++ b/docs/spec/04-ux/01-ui-ia.md
@@ -244,7 +244,7 @@ destination, chat as the home surface, tools and permissions inline.
focus.
### 3.3 Scheduled
-Tasks and Run history views, with an explicit create/edit form, a cadence dropdown, time,
+A task column beside the selected task's page, with an explicit create/edit form, a cadence dropdown, time,
next occurrence, saved project, per-task permission/model selection, pause/resume and delete confirmation. Hourly
schedules repeat at one-hour intervals without a time selector. Daily schedules
use a themed time-period dropdown: Morning 09:00, Afternoon 14:00, Evening
@@ -254,10 +254,17 @@ and survives other form edits until the user explicitly selects a preset. Weekly
separate dropdown listing Monday through Sunday with selection markers.
Each day toggles independently; there are no preset combinations. An empty
selection disables saving. The menu supports arrows, Home/End, Enter/Space,
-Escape/outside dismissal, and exposes selected states. The footer clock and global search open
-this route. Run now dispatches in the background and selects Run history; a
-conversation link opens the real transcript. The latest 100 runs show running,
-completed, failed or interrupted status. Automatic runs never steal foreground
+Escape/outside dismissal, and exposes selected states. The column reports each
+task's cadence and clock, the outcome of its newest run with its duration, and
+whether it is paused or running. The task page shows that task's last run, next
+occurrence, project, permission and model, its instruction behind a disclosure,
+its own run history newest first (status, start time, duration, stable error
+code), and the transcript of the selected run read in the page through a bounded
+read. A run's transcript belongs to this route: the SessionList and global
+session search never list it, and Open conversation is the explicit action that
+carries it into the chat route. The footer clock and global search open
+this route. Run now dispatches in the background, selects the run it admitted,
+and leaves the reader on this page. Automatic runs never steal foreground
focus. See [desktop automations](../../adr/scheduled-desktop-automations.md).
The application must remain running. The host polls every 30 seconds and skips
diff --git a/docs/spec/04-ux/08-component-spec.md b/docs/spec/04-ux/08-component-spec.md
index a378a05ee..0dff72b7f 100644
--- a/docs/spec/04-ux/08-component-spec.md
+++ b/docs/spec/04-ux/08-component-spec.md
@@ -1312,6 +1312,12 @@ unpinned history for retained project tabs and path-less sessions.
Pin/archive/collapse state is a presentation over durable host
sessions, not a replacement persistence model.
+A scheduled-task run's transcript is never part of this list: the run owns its
+session (`task_runs.session_id`), the host reports that ownership as
+`scheduledRun` on every session summary, and the Scheduled route is its entry
+point. Global session search hides the same rows. Deleting the task releases the
+transcript back into the ordinary lists (issue #1291).
+
### 6.2 Anatomy
Groups and session items:
@@ -4076,6 +4082,65 @@ Sidebar footer Popover (360px max)
---
+## 20A. ScheduledWorkspace
+
+### 20A.1 Purpose
+
+Read and operate scheduled tasks: what each task did last, what it will do next,
+and the transcript of any run — without leaving the route. See
+[desktop automations](../../adr/scheduled-desktop-automations.md) and issue #1291.
+
+### 20A.2 Anatomy
+
+A task column beside the selected task's page:
+
+```text
+TASKS (2) │ Nightly dependency check [Enabled] [Run now][Edit][Pause][Delete]
+● Nightly dependency check │ LAST RUN Failed · 2 hours ago · 1m 12s
+ Daily · 09:05 │ NEXT RUN in 21 hours · Jan 3, 2026, 9:05 AM
+ Failed · 2 hours ago · 1m12s│ CADENCE Daily · 09:05
+○ PR sweep [Disabled]│ PROJECT ~/project PERMISSION Auto MODEL custom / fixture
+ Manual │ INSTRUCTION Summarize the dependency state… [Show full instruction]
+ Not run yet │ RUN HISTORY (2)
+ │ Failed Jan 2, 2026, 12:00 AM · 1m 12s · PROVIDER_ERROR
+ │ Completed Jan 1, 2026, 12:00 AM · 42s
+ │ RUN CONTENT
+ │ Completed · Jan 1, 2026 · 42s [Open conversation]
+ │ USER Summarize the dependency state…
+ │ ASSISTANT Scheduled review complete.
+```
+
+### 20A.3 States
+
+| State | Appearance |
+|---|---|
+| Selected task | Raised tile with the shared raised shadow, and one `aria-current="true"` |
+| Running task | Warning-coloured dot in the row plus a `Running / awaiting input` badge |
+| Paused task | `Disabled` chip; the row still reports its last outcome |
+| Never run | `Not run yet` in the row's outcome line |
+| Completed run | Success glyph, status, moment and duration |
+| Failed run | Error glyph and the stable error code beside the moment |
+| Running run | No duration yet; the status reads as running |
+| Empty history | The history card states the task has no runs |
+| No transcript | The run content card states the run stored no transcript |
+| Read failure | The card reports the failure instead of showing an empty pane |
+
+### 20A.4 Interaction
+
+- Selecting a task moves the page; the previously selected run is released, and
+ the first task is selected when none is.
+- Selecting a run reads it in place through a bounded session read (60 newest
+ messages, 20 000 characters per field) and moves the content card to it.
+- The instruction is disclosed on demand and starts collapsed.
+- Run now dispatches in the background, selects the run it admitted, and keeps
+ the reader on the route.
+- Open conversation is the only action that leaves for the chat route.
+- Above 900px the task column sticks below the titlebar band; below it the
+ column stacks above the page.
+- Motion: colour and chevron transitions only, disabled under
+ `prefers-reduced-motion`, including the running dot's pulse.
+
+
## 21. Acceptance criteria (all components)
1. All components use semantic color tokens from [07-ui-design-system.md](07-ui-design-system.md) — no raw hex
diff --git a/docs/spec/06-delivery/04-e2e-test-plan.md b/docs/spec/06-delivery/04-e2e-test-plan.md
index 74f85b7ec..683144d89 100644
--- a/docs/spec/06-delivery/04-e2e-test-plan.md
+++ b/docs/spec/06-delivery/04-e2e-test-plan.md
@@ -414,8 +414,9 @@
select a daily time period from four fixed defaults; open the weekday menu,
select custom days, save and reopen; reject empty days; verify the four defaults,
arrows, Home/End, Enter, Escape/Tab and outside dismissal; select hourly without time
- fields and verify its first occurrence is one hour away; pause/resume; Run now;
- open the result conversation; configure a daily task for the next real minute;
+ fields and verify its first occurrence is one hour away; pause/resume; Run now
+ and read the admitted run's transcript inside the task page; open the result
+ conversation from that page; configure a daily task for the next real minute;
observe automatic completion; delete the settled task. In a normal Agent
conversation, use model tool calls to discover, create, list, update to 15:30
and delete a task. Verify the custom time appears in the form and survives
@@ -426,12 +427,14 @@
Composer-style bottom toolbar, including at the narrow viewport, with no horizontal overflow.
Legacy rows without the new fields retain their previous defaults. Configuration
persists, next time is visible, paused tasks do
- not dispatch, both execution paths reach the real Agent sidecar, history links
- to the persisted transcript, and automatic execution does not require a
+ not dispatch, both execution paths reach the real Agent sidecar, the task's own
+ history lists each run with its status and duration and Open conversation
+ reaches the persisted transcript while the SessionList and session search never
+ list it, and automatic execution does not require a
renderer prompt. Host tests additionally prove duplicate admission rejection,
stale/missed occurrence handling, invalid input rejection and recovery.
-- **Specs:** 04-ux/01-ui-ia §3.3; 03-runtime/04-data-storage §4.11;
- ADR scheduled-desktop-automations; ADR 0305.
+- **Specs:** 04-ux/01-ui-ia §3.3; 04-ux/08-component-spec §6, §20A;
+ 03-runtime/04-data-storage §4.11; ADR scheduled-desktop-automations; ADR 0305.
- **Acceptance:** Scheduled task execution and recoverable run history.
- **Milestone:** Post-MVP desktop automations.
- **Status:** Automated in `node scripts/e2e-scheduled.mjs`; run against the
diff --git a/docs/zh-CN/spec/03-runtime/04-data-storage.md b/docs/zh-CN/spec/03-runtime/04-data-storage.md
index ed16f95c3..fb7f7bf76 100644
--- a/docs/zh-CN/spec/03-runtime/04-data-storage.md
+++ b/docs/zh-CN/spec/03-runtime/04-data-storage.md
@@ -913,6 +913,7 @@ CREATE INDEX idx_task_runs ON task_runs(task_id, started_at DESC);
```
生成会话的运行通过 `session_id` 免费获取其转录本。
+该转录本通过针对 `task_runs` 的 `EXISTS` 判断被识别为自动化产出,每个会话摘要与搜索命中都以 `scheduledRun` 返回这一归属。归属在读取时派生、不写入会话行:因此在该会话仍属于某次运行时,会话列表与会话搜索会隐藏它;删除任务后它会回到普通列表,而不会变得无法访问(issue #1291)。
`config_json` 保存 `schedule: {hour, minute, weekday}`、毫秒时间戳 `nextRunAt`、
`workspacePath`,以及可选的任务级 `permissionMode` 与成对的 `providerId`/`modelId`。
这些新增字段无需物理表迁移。缺少模型字段时仍在运行时读取应用默认值;缺少权限字段时,
diff --git a/docs/zh-CN/spec/04-ux/01-ui-ia.md b/docs/zh-CN/spec/04-ux/01-ui-ia.md
index f844ad8c9..d0444c9bc 100644
--- a/docs/zh-CN/spec/04-ux/01-ui-ia.md
+++ b/docs/zh-CN/spec/04-ux/01-ui-ia.md
@@ -202,14 +202,13 @@
焦点。
### 3. 3 定时任务
-任务与运行记录两个视图,支持创建、编辑、暂停、启用和确认删除。表单可为每个任务单独选择项目、权限和模型。周期保留下拉选择,并与时分统一为自定义主题菜单。每小时按一小时间隔执行,不显示时间选择;保存、启用、启动或上次自动准入后重新计时。
+任务列与所选任务的页面并排展示,支持创建、编辑、暂停、启用和确认删除。表单可为每个任务单独选择项目、权限和模型。周期保留下拉选择,并与时分统一为自定义主题菜单。每小时按一小时间隔执行,不显示时间选择;保存、启用、启动或上次自动准入后重新计时。
每天通过下拉框选择上午 09:00、下午 14:00、晚上 19:00、夜间 22:00;
界面不提供时分编辑,AI 可设置具体时间,非预设值显示为自定义时间,其他字段的编辑不得覆盖它。每周通过独立下拉面板多选周一至周日,
右侧显示选中标记,不提供快捷组合。至少选择一天才能保存。支持方向键、Home/End、Enter/Space
选择及 Escape/外部点击关闭,选项具有选中状态语义。
每天、每周按电脑本地时区计算并显示下次执行时间。
-侧边栏时钟与全局搜索均可进入。立即运行在后台执行并切换到运行记录;可打开
-结果会话查看真实记录或处理授权。显示最近 100 次运行的运行中、完成、失败、中断状态。
+任务列显示每个任务的周期与时间、最近一次运行的结果与耗时,以及暂停或运行中状态;任务页面显示该任务的上次运行、下次执行、项目、权限与模型,指令默认折叠,运行记录只列本任务的运行(状态、开始时间、耗时与稳定错误码,最新在前),并在页内按有界读取展示所选运行的转写。运行的转写属于本页面:会话列表与全局搜索不再列出它,只有“打开会话”这个显式动作才会把它带入对话页。侧边栏时钟与全局搜索均可进入。立即运行在后台执行并选中刚准入的那次运行,读者仍停留在本页。
应用必须保持运行。每 30 秒检查一次,超过 90 秒的错过时段与重叠运行被跳过;
重启只安排未来时段。旧任务需明确保存周期后才自动执行。新任务保存所选项目、Ask 权限和当前默认 provider/model;这些值只属于当前任务。任务文本标为“指令”,项目、权限和模型选择器嵌在指令框底部,并复用主 Composer 的容器、芯片和锚定菜单样式。两处直接共用权限选择组件和支持搜索、服务商分组、能力标记的模型列表。任务的模型按钮只显示模型名或别名,不拼接服务商名称;选择结果只更新任务草稿,不更改当前对话或应用默认设置。指令输入区域使用独立圆角边框及与底栏不同的底色,不显示原生缩放手柄,长文本在输入区内滚动。缺少模型字段的旧任务继续跟随应用默认值,已保存但不可用的模型保留显示且不会被静默替换。选择 Auto 时明确提示受限操作可能无需询问。没有显式选择时,首次设置仍保存当前项目,
diff --git a/docs/zh-CN/spec/04-ux/08-component-spec.md b/docs/zh-CN/spec/04-ux/08-component-spec.md
index 0cbae32c1..3a59e55fd 100644
--- a/docs/zh-CN/spec/04-ux/08-component-spec.md
+++ b/docs/zh-CN/spec/04-ux/08-component-spec.md
@@ -919,6 +919,8 @@ Maximized/fullscreen 几何形状不受影响。后台会话工件
项目。 Pin/archive/collapse 状态是持久主机的表示
会话,而不是替代持久性模型。
+定时任务运行的转写不属于本列表:该次运行拥有它的会话(`task_runs.session_id`),宿主在每个会话摘要上以 `scheduledRun` 返回这一归属,其入口是定时任务页面,全局会话搜索同样隐藏这些行;删除任务后该转写会回到普通列表(issue #1291)。
+
### 6.2 解剖学
小组和会话项目:
@@ -2850,6 +2852,60 @@ Sidebar footer Popover (360px max)
---
+## 20A. 定时任务工作区
+
+### 20A.1 目的
+
+读取并操作定时任务:每个任务上次做了什么、下次何时执行,以及任意一次运行的转写,
+全程不离开本页面。参见[桌面自动化](/adr/scheduled-desktop-automations)与 issue #1291。
+
+### 20A.2 解剖
+
+任务列与所选任务的页面并排:
+
+```text
+任务 (2) │ 夜间依赖检查 [已启用] [立即运行][编辑][暂停][删除]
+● 夜间依赖检查 │ 上次运行 失败 · 2 小时前 · 1m 12s
+ 每天 · 09:05 │ 下次执行 21 小时后 · 2026年1月3日 09:05
+ 失败 · 2 小时前 · 1m 12s │ 周期 每天 · 09:05
+○ PR 巡查 [已禁用] │ 项目 ~/project 权限 Auto 模型 custom / fixture
+ 手动 │ 指令 汇总依赖状态… [展开完整指令]
+ 尚未运行 │ 运行记录 (2)
+ │ 失败 2026年1月2日 00:00 · 1m 12s · PROVIDER_ERROR
+ │ 已完成 2026年1月1日 00:00 · 42s
+ │ 运行内容
+ │ 已完成 · 2026年1月1日 · 42s [打开会话]
+ │ 你 汇总依赖状态…
+ │ 助手 定时检查已完成。
+```
+
+### 20A.3 状态
+
+| 状态 | 外观 |
+|---|---|
+| 选中任务 | 抬升底板与共享抬升阴影,且只有一处 `aria-current="true"` |
+| 运行中任务 | 行内警告色圆点,并显示「运行中/等待输入」徽章 |
+| 已暂停任务 | `已禁用` 标签;该行仍显示上次运行结果 |
+| 尚未运行 | 结果行显示「尚未运行」 |
+| 已完成运行 | 成功色图标、状态、时间与耗时 |
+| 失败运行 | 错误色图标与时间旁的稳定错误码 |
+| 运行中运行 | 尚无耗时;状态显示为运行中 |
+| 空记录 | 运行记录卡片说明该任务暂无运行 |
+| 无转写 | 运行内容卡片说明这次运行没有保存转写 |
+| 读取失败 | 卡片报告失败原因,不显示空白面板 |
+
+### 20A.4 交互
+
+- 选择任务切换页面;原先选中的运行会被释放,未选中时默认选中第一个任务。
+- 选择某次运行会在页内按有界读取(最近 60 条消息、每个字段 20 000 字符)读取它,
+ 并把运行内容卡片切到该运行。
+- 指令按需展开,默认折叠。
+- 立即运行在后台执行,选中刚准入的那次运行,读者仍停留在本页面。
+- 「打开会话」是唯一离开本页面进入对话页的动作。
+- 宽度大于 900px 时任务列吸附在标题栏下方;更窄时任务列堆叠在页面上方。
+- 动画仅使用颜色与箭头过渡,并在 `prefers-reduced-motion` 下关闭,包括运行中圆点的脉冲。
+
+
## 21. 验收标准(所有组件)
1. 所有组件均使用 [07-ui-design-system.md](/zh-CN/spec/04-ux/07-ui-design-system) 中的语义颜色标记 — 无原始十六进制
diff --git a/docs/zh-CN/spec/06-delivery/04-e2e-test-plan.md b/docs/zh-CN/spec/06-delivery/04-e2e-test-plan.md
index 4c558434a..8b65dea7c 100644
--- a/docs/zh-CN/spec/06-delivery/04-e2e-test-plan.md
+++ b/docs/zh-CN/spec/06-delivery/04-e2e-test-plan.md
@@ -8714,16 +8714,16 @@ the latest destination. These assertions measure work counts, not device FPS.
- **前提:** 独立桌面配置、构建后的任务候选版本、本地 SSE 模拟模型;不使用真实
服务凭据或付费 API。
-- **步骤:** 点击页脚时钟;创建每天上午 09:00 的任务;选择另一个已保存项目、Auto 权限和非默认模型;编辑名称;暂停/启用;立即运行;
+- **步骤:** 点击页脚时钟;创建每天上午 09:00 的任务;选择另一个已保存项目、Auto 权限和非默认模型;编辑名称;暂停/启用;立即运行并在任务页面内读取刚准入运行的转写;从该页面打开结果会话;验证周期/四个时段主题下拉菜单、星期多选及选中标记、保存回显、空选择与固定时间;
打开结果会话;验证周期/四个时段主题下拉菜单、星期多选及选中标记、保存回显、空选择与固定时间;
验证方向键、Home/End、Enter、Escape/Tab 和外部点击关闭;
验证每小时无时间输入且首次等待一小时;设置每天任务在下一个真实分钟执行;
观察自动完成;删除已结束的任务。普通 Agent 对话经模型工具调用发现、创建、查询、
修改任务到 15:30,再删除;验证页面显示具体时间,改名保存不覆盖。模型为本地确定性夹具。
- **预期:** 项目、权限和精确 provider/model 只保存在该任务,重新打开仍显示相同值并实际传到 sidecar,其他任务不受影响;项目、权限和模型控件保持嵌在“指令”框的 Composer 风格底栏中,窄窗口也不产生横向溢出;缺少新增字段的旧记录保持原默认行为。配置持久化并显示下次时间;暂停后不触发;手动与自动入口均调用真实
- Agent sidecar;历史记录链接到持久化会话;自动执行不依赖渲染器发送提示词。
+ Agent sidecar;本任务的运行记录列出每次运行的状态与耗时,「打开会话」到达持久化会话,而会话列表与会话搜索不会列出它;自动执行不依赖渲染器发送提示词。
宿主测试补充验证重复准入、错过时段、无效输入和重启恢复。
-- **规格:** 04-ux/01-ui-ia §3.3;03-runtime/04-data-storage §4.11;
+- **规格:** 04-ux/01-ui-ia §3.3;04-ux/08-component-spec §6、§20A;03-runtime/04-data-storage §4.11;
ADR scheduled-desktop-automations;ADR 0305。
- **验收:** 定时执行与可恢复的运行历史。
- **里程碑:** MVP 后的桌面自动化。
diff --git a/packages/i18n/src/locales/de/index.ts b/packages/i18n/src/locales/de/index.ts
index 05dd344ee..1447077e3 100644
--- a/packages/i18n/src/locales/de/index.ts
+++ b/packages/i18n/src/locales/de/index.ts
@@ -1747,7 +1747,20 @@ sklm: {
"pause": "Pausieren",
"resume": "Fortsetzen",
"deleteConfirm": "„{{title}}\" und den Ausführungsverlauf löschen?",
- "historyHint": "Die letzten 100 Ausführungen. Öffne einen Chat, um Ergebnisse oder Genehmigungsanfragen zu prüfen.",
+ "historyHint": "Die Ausführungen dieser Aufgabe, neueste zuerst. Wähle eine aus, um ihr Transkript hier zu lesen, oder öffne den Chat zum Fortsetzen.",
+ "runContent": "Ausführungsinhalt",
+ "runContentLoading": "Transkript wird geladen…",
+ "runContentError": "Das Transkript dieser Ausführung konnte nicht gelesen werden.",
+ "runContentUnavailable": "Für diese Ausführung wurde kein Transkript gespeichert.",
+ "transcriptTruncated": "Ältere Nachrichten sind ausgeblendet. Öffne den Chat für das vollständige Transkript.",
+ "roleSystem": "System",
+ "instructionShow": "Vollständige Anweisung anzeigen",
+ "instructionHide": "Anweisung einklappen",
+ "detailProject": "Projekt",
+ "detailPermission": "Berechtigung",
+ "detailModel": "Modell",
+ "neverRun": "Noch nicht ausgeführt",
+ "selectTask": "Wähle eine Aufgabe, um ihre Ausführungen zu sehen.",
"emptyRuns": "Noch keine Ausführungen",
"statusRunning": "Läuft / wartet auf Eingabe",
"statusCompleted": "Abgeschlossen",
diff --git a/packages/i18n/src/locales/en/index.ts b/packages/i18n/src/locales/en/index.ts
index f75625db3..95fc6af31 100644
--- a/packages/i18n/src/locales/en/index.ts
+++ b/packages/i18n/src/locales/en/index.ts
@@ -1770,7 +1770,20 @@ sklm: {
pause: "Pause",
resume: "Resume",
deleteConfirm: "Delete \"{{title}}\" and its run history?",
- historyHint: "Most recent 100 runs. Open a conversation to review results or respond to permission requests.",
+ historyHint: "This task's runs, newest first. Select one to read its transcript here, or open the conversation to continue it.",
+ runContent: "Run content",
+ runContentLoading: "Loading transcript…",
+ runContentError: "This run's transcript could not be read.",
+ runContentUnavailable: "This run stored no transcript.",
+ transcriptTruncated: "Earlier messages are hidden. Open the conversation to read the full transcript.",
+ roleSystem: "System",
+ instructionShow: "Show full instruction",
+ instructionHide: "Collapse instruction",
+ detailProject: "Project",
+ detailPermission: "Permission",
+ detailModel: "Model",
+ neverRun: "Not run yet",
+ selectTask: "Select a task to see its runs.",
emptyRuns: "No runs yet",
statusRunning: "Running / awaiting input",
statusCompleted: "Completed",
diff --git a/packages/i18n/src/locales/es/index.ts b/packages/i18n/src/locales/es/index.ts
index aab7a0dd8..0163966c7 100644
--- a/packages/i18n/src/locales/es/index.ts
+++ b/packages/i18n/src/locales/es/index.ts
@@ -1747,7 +1747,20 @@ sklm: {
"pause": "Pausar",
"resume": "Reanudar",
"deleteConfirm": "¿Eliminar «{{title}}» y su historial?",
- "historyHint": "Las últimas 100 ejecuciones. Abre la conversación para revisar resultados o solicitudes de autorización.",
+ "historyHint": "Las ejecuciones de esta tarea, de la más reciente a la más antigua. Selecciona una para leer su transcripción aquí o abre la conversación para continuarla.",
+ "runContent": "Contenido de la ejecución",
+ "runContentLoading": "Cargando la transcripción…",
+ "runContentError": "No se pudo leer la transcripción de esta ejecución.",
+ "runContentUnavailable": "Esta ejecución no guardó ninguna transcripción.",
+ "transcriptTruncated": "Los mensajes anteriores están ocultos. Abre la conversación para ver la transcripción completa.",
+ "roleSystem": "Sistema",
+ "instructionShow": "Mostrar la instrucción completa",
+ "instructionHide": "Contraer la instrucción",
+ "detailProject": "Proyecto",
+ "detailPermission": "Permiso",
+ "detailModel": "Modelo",
+ "neverRun": "Aún no se ha ejecutado",
+ "selectTask": "Selecciona una tarea para ver sus ejecuciones.",
"emptyRuns": "Aún no hay ejecuciones",
"statusRunning": "En curso / esperando entrada",
"statusCompleted": "Completada",
diff --git a/packages/i18n/src/locales/fr/index.ts b/packages/i18n/src/locales/fr/index.ts
index 54ffaccd8..6495a19d4 100644
--- a/packages/i18n/src/locales/fr/index.ts
+++ b/packages/i18n/src/locales/fr/index.ts
@@ -1747,7 +1747,20 @@ sklm: {
"pause": "Suspendre",
"resume": "Reprendre",
"deleteConfirm": "Supprimer « {{title}} » et son historique ?",
- "historyHint": "Les 100 dernières exécutions. Ouvrez la conversation pour consulter les résultats ou les demandes d’autorisation.",
+ "historyHint": "Les exécutions de cette tâche, de la plus récente à la plus ancienne. Sélectionnez-en une pour lire sa transcription ici, ou ouvrez la conversation pour la poursuivre.",
+ "runContent": "Contenu de l’exécution",
+ "runContentLoading": "Chargement de la transcription…",
+ "runContentError": "La transcription de cette exécution n’a pas pu être lue.",
+ "runContentUnavailable": "Cette exécution n’a enregistré aucune transcription.",
+ "transcriptTruncated": "Les messages plus anciens sont masqués. Ouvrez la conversation pour la transcription complète.",
+ "roleSystem": "Système",
+ "instructionShow": "Afficher l’instruction complète",
+ "instructionHide": "Réduire l’instruction",
+ "detailProject": "Projet",
+ "detailPermission": "Autorisation",
+ "detailModel": "Modèle",
+ "neverRun": "Pas encore exécuté",
+ "selectTask": "Sélectionnez une tâche pour voir ses exécutions.",
"emptyRuns": "Aucune exécution",
"statusRunning": "En cours / en attente de saisie",
"statusCompleted": "Terminée",
diff --git a/packages/i18n/src/locales/ko/index.ts b/packages/i18n/src/locales/ko/index.ts
index 24593e38b..3e9de3db3 100644
--- a/packages/i18n/src/locales/ko/index.ts
+++ b/packages/i18n/src/locales/ko/index.ts
@@ -1762,7 +1762,20 @@ sklm: {
pause: "일시 중지",
resume: "다시 시작",
deleteConfirm: "“{{title}}” 및 실행 기록을 삭제할까요?",
- historyHint: "최근 100회 실행입니다. 대화를 열어 결과를 확인하거나 승인 요청을 처리하세요.",
+ historyHint: "이 작업의 실행 기록입니다(최신순). 하나를 선택하면 이 페이지에서 기록을 읽을 수 있고, 대화를 열어 이어갈 수도 있습니다.",
+ runContent: "실행 내용",
+ runContentLoading: "기록을 불러오는 중…",
+ runContentError: "이 실행의 기록을 읽을 수 없습니다.",
+ runContentUnavailable: "이 실행에는 저장된 기록이 없습니다.",
+ transcriptTruncated: "이전 메시지는 표시되지 않습니다. 대화를 열면 전체 기록을 볼 수 있습니다.",
+ roleSystem: "시스템",
+ instructionShow: "전체 지침 보기",
+ instructionHide: "지침 접기",
+ detailProject: "프로젝트",
+ detailPermission: "권한",
+ detailModel: "모델",
+ neverRun: "아직 실행되지 않음",
+ selectTask: "실행 기록을 보려면 작업을 선택하세요.",
emptyRuns: "실행 기록 없음",
statusRunning: "실행 중 / 입력 대기",
statusCompleted: "완료",
diff --git a/packages/i18n/src/locales/pt-BR/index.ts b/packages/i18n/src/locales/pt-BR/index.ts
index 4b1fa0c6b..d4e8c0e76 100644
--- a/packages/i18n/src/locales/pt-BR/index.ts
+++ b/packages/i18n/src/locales/pt-BR/index.ts
@@ -1702,7 +1702,20 @@ export const ptBR = {
pause: "Pausar",
resume: "Retomar",
deleteConfirm: "Excluir “{{title}}” e o histórico de execuções?",
- historyHint: "Exibe as 100 execuções mais recentes. Abra uma conversa para revisar os resultados ou responder a solicitações de permissão.",
+ historyHint: "As execuções desta tarefa, da mais recente para a mais antiga. Selecione uma para ler a transcrição aqui ou abra a conversa para continuar.",
+ runContent: "Conteúdo da execução",
+ runContentLoading: "Carregando a transcrição…",
+ runContentError: "Não foi possível ler a transcrição desta execução.",
+ runContentUnavailable: "Esta execução não guardou transcrição.",
+ transcriptTruncated: "As mensagens anteriores estão ocultas. Abra a conversa para ver a transcrição completa.",
+ roleSystem: "Sistema",
+ instructionShow: "Mostrar a instrução completa",
+ instructionHide: "Recolher a instrução",
+ detailProject: "Projeto",
+ detailPermission: "Permissão",
+ detailModel: "Modelo",
+ neverRun: "Ainda não executado",
+ selectTask: "Selecione uma tarefa para ver as execuções dela.",
emptyRuns: "Nenhuma execução ainda",
statusRunning: "Em execução / aguardando resposta",
statusCompleted: "Concluída",
diff --git a/packages/i18n/src/locales/tr/index.ts b/packages/i18n/src/locales/tr/index.ts
index 86084b064..8fdb63a99 100644
--- a/packages/i18n/src/locales/tr/index.ts
+++ b/packages/i18n/src/locales/tr/index.ts
@@ -1752,7 +1752,20 @@ sklm: {
pause: "Duraklat",
resume: "Sürdür",
deleteConfirm: "“{{title}}” ve çalıştırma geçmişi silinsin mi?",
- historyHint: "Son 100 çalıştırma. Sonuçları veya izin isteklerini incelemek için sohbeti açın.",
+ historyHint: "Bu görevin çalıştırmaları, en yeniden en eskiye. Birini seçip dökümünü burada okuyabilir veya konuşmayı açabilirsiniz.",
+ runContent: "Çalıştırma içeriği",
+ runContentLoading: "Döküm yükleniyor…",
+ runContentError: "Bu çalıştırmanın dökümü okunamadı.",
+ runContentUnavailable: "Bu çalıştırma döküm kaydetmedi.",
+ transcriptTruncated: "Daha eski mesajlar gizli. Tam döküm için konuşmayı açın.",
+ roleSystem: "Sistem",
+ instructionShow: "Talimatın tamamını göster",
+ instructionHide: "Talimatı daralt",
+ detailProject: "Proje",
+ detailPermission: "İzin",
+ detailModel: "Model",
+ neverRun: "Henüz çalıştırılmadı",
+ selectTask: "Çalıştırmalarını görmek için bir görev seçin.",
emptyRuns: "Henüz çalıştırılmadı",
statusRunning: "Çalışıyor / giriş bekleniyor",
statusCompleted: "Tamamlandı",
diff --git a/packages/i18n/src/locales/zh-CN/index.ts b/packages/i18n/src/locales/zh-CN/index.ts
index e297bc6c8..fc93fab24 100644
--- a/packages/i18n/src/locales/zh-CN/index.ts
+++ b/packages/i18n/src/locales/zh-CN/index.ts
@@ -1733,7 +1733,20 @@ sklm: {
pause: "暂停",
resume: "启用",
deleteConfirm: "删除“{{title}}”及其运行记录?",
- historyHint: "显示最近 100 次运行。打开会话可查看结果或处理授权请求。",
+ historyHint: "该任务的运行记录,最新的在前面。选中一条可在本页阅读转写,或打开会话继续追问。",
+ runContent: "运行内容",
+ runContentLoading: "正在读取转写…",
+ runContentError: "无法读取这次运行的转写。",
+ runContentUnavailable: "这次运行没有保存转写。",
+ transcriptTruncated: "较早的消息未显示,打开会话可查看完整转写。",
+ roleSystem: "系统",
+ instructionShow: "展开完整指令",
+ instructionHide: "收起指令",
+ detailProject: "项目",
+ detailPermission: "权限",
+ detailModel: "模型",
+ neverRun: "尚未运行",
+ selectTask: "选择一个任务以查看它的运行记录。",
emptyRuns: "暂无运行记录",
statusRunning: "运行中/等待输入",
statusCompleted: "已完成",
diff --git a/packages/i18n/src/locales/zh-TW/index.ts b/packages/i18n/src/locales/zh-TW/index.ts
index ddb54924d..d8e11b609 100644
--- a/packages/i18n/src/locales/zh-TW/index.ts
+++ b/packages/i18n/src/locales/zh-TW/index.ts
@@ -1733,7 +1733,20 @@ sklm: {
pause: "暫停",
resume: "啟用",
deleteConfirm: "刪除「{{title}}」及其執行記錄?",
- historyHint: "顯示最近 100 次執行。開啟對話可檢視結果或處理授權請求。",
+ historyHint: "此任務的執行記錄,最新的在前。選取一筆可在此頁閱讀逐字稿,或開啟對話繼續追問。",
+ runContent: "執行內容",
+ runContentLoading: "正在讀取逐字稿…",
+ runContentError: "無法讀取這次執行的逐字稿。",
+ runContentUnavailable: "這次執行沒有儲存逐字稿。",
+ transcriptTruncated: "較早的訊息未顯示,開啟對話可查看完整逐字稿。",
+ roleSystem: "系統",
+ instructionShow: "展開完整指令",
+ instructionHide: "收合指令",
+ detailProject: "專案",
+ detailPermission: "權限",
+ detailModel: "模型",
+ neverRun: "尚未執行",
+ selectTask: "選擇一個任務以查看它的執行記錄。",
emptyRuns: "尚無執行記錄",
statusRunning: "執行中/等待輸入",
statusCompleted: "已完成",
diff --git a/packages/shared/src/types/sessions.ts b/packages/shared/src/types/sessions.ts
index 119625396..f46d0f9c0 100644
--- a/packages/shared/src/types/sessions.ts
+++ b/packages/shared/src/types/sessions.ts
@@ -46,6 +46,13 @@ export type SessionSummary = {
/** Effective image-input capability for this session's exact model. */
supportsVision?: boolean;
supportedThinkingLevels?: ThinkingLevel[];
+ /**
+ * True when this session is the transcript owned by a scheduled-task run.
+ * The automation owns it: the SessionList and global session search hide it,
+ * and the Scheduled page is its entry point (`todos`-style automation output).
+ * Older hosts omit it, so `undefined` means an ordinary conversation.
+ */
+ scheduledRun?: boolean;
updatedAt: string;
createdAt: string;
};