fix(control): activity feed distinguishes templated dispatches from custom prompts

The Activity feed on each project card rendered every entry as a flat
"time + preview" row. A user scanning the feed couldn't tell at a glance
which entries were autopilot-fired Next best vs Test & fix vs a custom
prompt they typed by hand — the ledger threw the intent away and used
getIntentLabel as the body when customPrompt was null, so templated
dispatches just looked like short body text.

Carry intent through ProjectActivityEvent (null when customPrompt is
present) and render an uppercase pill badge before the preview when set.
Free-form prompts render unchanged. Existing copy + expand UX is
untouched.

Sample row reads "8m ago [NEXT BEST]" instead of "8m ago Next best" —
the badge is immediately visually distinct from the body text, so
scanning the feed shows the dispatch type at a glance.
This commit is contained in:
g-but committed 2026-05-31 02:42:47 +02:00
1 parent eae42d97d9
commit 4373e845f8
2 files changed
+15 -1

No files matched your search

@@ -9,6 +9,10 @@ export type ProjectActivityEvent =
occurredAt: number;
title: string;
body: string;
/** Preset intent (e.g. "next_best", "test_fix") when no customPrompt
* was supplied, null for free-form user prompts. Lets the renderer
* distinguish at-a-glance which dispatches were templated vs typed. */
intent: string | null;
}
| {
id: string;
@@ -26,13 +30,15 @@ export function buildProjectActivityLedger({
git: ProjectState["git"];
}): ProjectActivityEvent[] {
const promptEvents: ProjectActivityEvent[] = injections.map((item) => {
const body = item.customPrompt ?? getIntentLabel(item.intent);
const isCustom = Boolean(item.customPrompt?.trim());
const body = isCustom ? item.customPrompt! : getIntentLabel(item.intent);
return {
id: `prompt:${item.id}`,
kind: "user_prompt",
occurredAt: new Date(item.dispatchedAt).getTime(),
title: "Sent prompt",
body,
intent: isCustom ? null : item.intent,
};
});
@@ -62,6 +62,14 @@ export function ProjectActivitySection({
<span className="shrink-0 pt-0.5 text-text-muted tabular-nums">
{event.occurredAt ? timeAgo(event.occurredAt) : ""}
</span>
{event.kind === "user_prompt" && event.intent && (
<span
className="shrink-0 mt-px rounded-full border border-accent-primary/30 bg-accent-muted px-1.5 py-0.5 text-[10px] font-medium uppercase tracking-wide text-accent-text"
title={`Templated dispatch — intent: ${event.intent}`}
>
{event.intent.replace(/_/g, " ")}
</span>
)}
<button
onClick={() => setExpandedId((current) => current === event.id ? null : event.id)}
className="min-w-0 flex-1 truncate text-left text-text-tertiary transition-colors hover:text-text-secondary"