Open-source SEO, GEO, and marketing skills for AI agents.
feat: human task IDs (demo7-N), id+title rows, slash command popover
Yuting Zhong2c634ae25eb7
diff --git a/src/app/(app)/tasks/[id]/page.tsx b/src/app/(app)/tasks/[id]/page.tsxindex b5422b1e..05213a8b 100644--- a/src/app/(app)/tasks/[id]/page.tsx+++ b/src/app/(app)/tasks/[id]/page.tsx@@ -35,5 +35,8 @@ export default async function TaskDetailPage({const templateKey = (meta?.template_key as AgentTemplateKey | undefined) ?? "google_ads";const agentSlug = meta?.slug ?? urlSlugForTemplate(templateKey);- redirect(`/agents/${agentSlug}/tasks?task=${task.id}`);+ // Use the human-readable display_id in the canonical URL so the path+ // someone bookmarks reads "?task=demo7-3" not a UUID. getTask in the+ // workspace accepts either form, so legacy UUID deep-links still resolve.+ redirect(`/agents/${agentSlug}/tasks?task=${task.display_id}`);}diff --git a/src/components/agent-task-workspace.tsx b/src/components/agent-task-workspace.tsxindex 638fc582..d0e9468b 100644--- a/src/components/agent-task-workspace.tsx+++ b/src/components/agent-task-workspace.tsx@@ -81,9 +81,9 @@ export function AgentTaskWorkspace({(grouped.get("proposed")?.length ?? 0) +(grouped.get("approved")?.length ?? 0);- function selectTask(id: string) {+ function selectTask(displayId: string) {const params = new URLSearchParams(search?.toString() ?? "");- params.set("task", id);+ params.set("task", displayId);router.replace(`?${params.toString()}`, { scroll: false });}@@ -146,8 +146,10 @@ export function AgentTaskWorkspace({<li key={t.id}><TaskRowtask={t}- selected={t.id === selectedId}- onSelect={() => selectTask(t.id)}+ selected={+ t.display_id === selectedId || t.id === selectedId+ }+ onSelect={() => selectTask(t.display_id)}/></li>))}@@ -172,9 +174,7 @@ export function AgentTaskWorkspace({Tasks</Link><span>/</span>- <span className="font-mono">- {selected.task.id.slice(0, 8)}- </span>+ <span className="font-mono">{selected.task.display_id}</span></div><h1 className="mt-0.5 text-base font-semibold tracking-tight truncate">{selected.task.title ?? "(untitled task)"}@@ -302,14 +302,18 @@ function TaskRow({<StatusGlyph status={task.status} />)}</span>- <span- className={cn(- "flex-1 truncate text-xs",- selected ? "font-medium text-foreground" : "text-foreground/90",- !isInFlight && task.status !== "running" && "text-muted-foreground",- )}- >- {task.title ?? task.brief.slice(0, 80)}+ <span className="min-w-0 flex-1 truncate text-xs">+ <span className="mr-1.5 font-mono text-[10px] text-muted-foreground tabular-nums">+ {task.display_id}+ </span>+ <span+ className={cn(+ selected ? "font-medium text-foreground" : "text-foreground/90",+ !isInFlight && task.status !== "running" && "text-muted-foreground",+ )}+ >+ {task.title ?? task.brief.slice(0, 80)}+ </span></span><span className="shrink-0 text-[10px] tabular-nums text-muted-foreground">{formatRelative(task.updated_at)}diff --git a/src/components/live-transcript.tsx b/src/components/live-transcript.tsxindex 5b57f94b..aaaa7573 100644--- a/src/components/live-transcript.tsx+++ b/src/components/live-transcript.tsx@@ -28,7 +28,14 @@ import { toast } from "sonner";import { Button } from "@/components/ui/button";import { Markdown } from "@/components/markdown";import { RunningDot } from "@/components/running-dot";+import { SlashCommandPopover } from "@/components/slash-command-popover";import { cn } from "@/lib/utils";+import {+ executeLocalSlashCommand,+ filterSlashCommands,+ parseSlashMessage,+ type SlashCommand,+} from "@/lib/slash-commands";import { stripOrchestrationBlocks } from "@/server/orchestration/blocks";import type { TranscriptEvent } from "@/server/openclaw/transcript-tail";@@ -88,6 +95,38 @@ export function LiveTranscript({const [input, setInput] = useState("");const [sendingChat, setSendingChat] = useState(false);const [stopPolling, setStopPolling] = useState(false);+ const [slashIndex, setSlashIndex] = useState(0);+ const textareaRef = useRef<HTMLTextAreaElement>(null);++ // Slash command autocomplete: open while input starts with "/" and the+ // user is still composing the command name (no space yet). After they+ // pick or type a space, the popover closes.+ const slashQuery = input.startsWith("/") && !input.includes(" ") ? input : null;+ const slashOpen = slashQuery !== null && !sendingChat && !composerDisabled;+ const slashMatches = useMemo<SlashCommand[]>(+ () => (slashOpen ? filterSlashCommands(slashQuery!) : []),+ [slashOpen, slashQuery],+ );+ const safeSlashIndex =+ slashMatches.length === 0+ ? 0+ : Math.min(slashIndex, slashMatches.length - 1);++ function insertSlashCommand(cmd: SlashCommand) {+ // Catalog `name` is the command without the leading slash ("new", "clear").+ // Insert ends with a trailing space so the popover closes — a second+ // Enter then submits.+ const insert = cmd.insert ?? `/${cmd.name} `;+ setInput(insert);+ setSlashIndex(0);+ requestAnimationFrame(() => {+ const ta = textareaRef.current;+ if (ta) {+ ta.focus();+ ta.setSelectionRange(insert.length, insert.length);+ }+ });+ }// Optimistic state for the active /api/chat send. Rendered after committed// events so the user sees their message + the streaming response before@@ -173,6 +212,37 @@ export function LiveTranscript({const usingOverride = typeof overrideText === "string";const text = (usingOverride ? overrideText : input).trim();if (!text || sendingChat) return;++ // Local slash commands intercept the send. Skip when the message+ // was sent programmatically (overrides are always real prompts).+ const parsed = usingOverride ? null : parseSlashMessage(text);+ if (parsed) {+ const action = executeLocalSlashCommand(parsed.command);+ if (action) {+ setInput("");+ switch (action.kind) {+ case "clear":+ setEvents([]);+ setByteOffset(0);+ toast.info(+ "Local view cleared. Full transcript is still on disk; the next agent reply will repopulate.",+ );+ return;+ case "new-session": {+ const newId = crypto.randomUUID();+ router.push(`/agents/${agentSlug}/chat/${newId}`);+ return;+ }+ case "stop":+ abortRef.current?.abort();+ return;+ case "help":+ toast.message("Slash commands", { description: action.content });+ return;+ }+ }+ }+if (!usingOverride) setInput("");setSendingChat(true);setPendingUserMsg(opts.hidden ? null : text);@@ -245,7 +315,7 @@ export function LiveTranscript({abortRef.current = null;}},- [agentSlug, input, pollOnce, sendingChat, sessionKey, threadId],+ [agentSlug, input, pollOnce, router, sendingChat, sessionKey, threadId],);// ── Auto-kickoff for FIRST_TURN-style flows. ────────────────────────@@ -312,7 +382,15 @@ export function LiveTranscript({</div><div className="border-t bg-background/95 backdrop-blur supports-[backdrop-filter]:bg-background/80">- <div className="mx-auto w-full max-w-3xl px-6 py-3">+ <div className="relative mx-auto w-full max-w-3xl px-6 py-3">+ {slashOpen && (+ <SlashCommandPopover+ commands={slashMatches}+ selectedIndex={safeSlashIndex}+ onSelect={insertSlashCommand}+ onHover={setSlashIndex}+ />+ )}<formclassName="flex items-end gap-2"onSubmit={(e) => {@@ -321,9 +399,41 @@ export function LiveTranscript({}}><textarea+ ref={textareaRef}value={input}- onChange={(e) => setInput(e.target.value)}+ onChange={(e) => {+ setInput(e.target.value);+ setSlashIndex(0);+ }}onKeyDown={(e) => {+ // Slash autocomplete: arrow keys cycle, Tab/Enter insert.+ if (slashOpen && slashMatches.length > 0) {+ if (e.key === "ArrowDown") {+ e.preventDefault();+ setSlashIndex((i) => (i + 1) % slashMatches.length);+ return;+ }+ if (e.key === "ArrowUp") {+ e.preventDefault();+ setSlashIndex(+ (i) =>+ (i - 1 + slashMatches.length) % slashMatches.length,+ );+ return;+ }+ if (e.key === "Tab" || (e.key === "Enter" && !e.shiftKey)) {+ e.preventDefault();+ const picked = slashMatches[safeSlashIndex];+ if (picked) insertSlashCommand(picked);+ return;+ }+ if (e.key === "Escape") {+ e.preventDefault();+ setInput("");+ setSlashIndex(0);+ return;+ }+ }if (e.key === "Enter" && !e.shiftKey) {e.preventDefault();void send();@@ -333,7 +443,7 @@ export function LiveTranscript({placeholder={composerDisabled? `${agentDisplayName} is on a task — the transcript updates live`- : `Message ${agentDisplayName}…`+ : `Message ${agentDisplayName}… (type / for commands)`}rows={1}className="flex min-h-[40px] flex-1 resize-none rounded-xl border bg-background px-3.5 py-2 text-sm shadow-sm placeholder:text-muted-foreground focus-visible:outline-none focus-visible:ring-1 focus-visible:ring-ring disabled:cursor-not-allowed disabled:opacity-50"diff --git a/src/components/slash-command-popover.tsx b/src/components/slash-command-popover.tsxnew file mode 100644index 00000000..0456ab3e--- /dev/null+++ b/src/components/slash-command-popover.tsx@@ -0,0 +1,114 @@+"use client";++import { useEffect, useRef } from "react";+import { cn } from "@/lib/utils";+import type { SlashCommand } from "@/lib/slash-commands";++type Props = {+ commands: SlashCommand[];+ selectedIndex: number;+ onSelect: (command: SlashCommand) => void;+ onHover: (index: number) => void;+};++const CATEGORY_LABEL: Record<SlashCommand["category"], string> = {+ session: "Session",+ model: "Model",+ status: "Status",+ agents: "Agents",+ tools: "Tools",+ advanced: "Advanced",+};++const CATEGORY_ACCENT: Record<SlashCommand["category"], string> = {+ session: "text-blue-600 dark:text-blue-400",+ model: "text-emerald-600 dark:text-emerald-400",+ status: "text-zinc-500 dark:text-zinc-400",+ agents: "text-violet-600 dark:text-violet-400",+ tools: "text-cyan-600 dark:text-cyan-400",+ advanced: "text-amber-600 dark:text-amber-400",+};++export function SlashCommandPopover({+ commands,+ selectedIndex,+ onSelect,+ onHover,+}: Props) {+ const listRef = useRef<HTMLUListElement>(null);++ // Keep the selected row in view as the user arrows through a long list.+ useEffect(() => {+ const list = listRef.current;+ if (!list) return;+ const row = list.children[selectedIndex] as HTMLElement | undefined;+ if (row) row.scrollIntoView({ block: "nearest" });+ }, [selectedIndex]);++ if (commands.length === 0) {+ return (+ <div+ className="absolute bottom-full left-0 right-0 mb-2 rounded-xl border bg-popover p-3 text-xs text-muted-foreground shadow-lg"+ role="listbox"+ aria-label="Slash commands"+ >+ No matching slash commands.+ </div>+ );+ }++ return (+ <div+ className="absolute bottom-full left-0 right-0 mb-2 overflow-hidden rounded-xl border bg-popover shadow-lg"+ role="listbox"+ aria-label="Slash commands"+ >+ <ul ref={listRef} className="max-h-72 overflow-y-auto py-1">+ {commands.map((c, idx) => {+ const isActive = idx === selectedIndex;+ return (+ <li key={c.name}>+ <button+ type="button"+ onMouseEnter={() => onHover(idx)}+ onClick={() => onSelect(c)}+ className={cn(+ "flex w-full items-center gap-3 px-3 py-2 text-left text-sm transition-colors",+ isActive ? "bg-accent" : "hover:bg-accent/50",+ )}+ role="option"+ aria-selected={isActive}+ >+ <span className="w-28 shrink-0 font-mono text-[13px] text-foreground">+ /{c.name}+ {c.args && (+ <span className="ml-1 text-muted-foreground">{c.args}</span>+ )}+ </span>+ <span className="flex-1 truncate text-xs text-muted-foreground">+ {c.description}+ </span>+ {c.executeLocal && (+ <span className="shrink-0 rounded border px-1 text-[9px] uppercase tracking-wide text-muted-foreground">+ local+ </span>+ )}+ <span+ className={cn(+ "shrink-0 text-[10px] uppercase tracking-wide",+ CATEGORY_ACCENT[c.category],+ )}+ >+ {CATEGORY_LABEL[c.category]}+ </span>+ </button>+ </li>+ );+ })}+ </ul>+ <div className="border-t bg-muted/30 px-3 py-1.5 text-[10px] text-muted-foreground">+ ↑↓ navigate · Enter / Tab to select · Enter again to send · Esc to clear+ </div>+ </div>+ );+}diff --git a/src/lib/slash-commands.ts b/src/lib/slash-commands.tsnew file mode 100644index 00000000..9944ed9a--- /dev/null+++ b/src/lib/slash-commands.ts@@ -0,0 +1,281 @@+/**+ * Slash command catalog + local executor.+ *+ * Ported from OpenClaw's web UI:+ * - ui/src/ui/chat/slash-commands.ts (catalog + LOCAL_COMMANDS set)+ * - ui/src/ui/chat/slash-command-executor.ts (action-based dispatcher)+ *+ * Rules:+ * - executeLocal=true → command is handled by the client; not sent to the agent.+ * - Anything else → message goes to OpenClaw verbatim.+ *+ * For the V1 client we wire only the no-gateway-RPC locals (clear, new, help,+ * stop). The rest carry executeLocal=false and pass through to the agent.+ */++export type SlashCommandCategory =+ | "session"+ | "model"+ | "status"+ | "agents"+ | "tools"+ | "advanced";++export type SlashCommandTier = "essential" | "standard" | "power";++export type SlashCommand = {+ /** Canonical key (matches OpenClaw registry where applicable). */+ key: string;+ /** Display name (without the leading slash). */+ name: string;+ /** Short description shown in the menu. */+ description: string;+ /** Optional argument hint shown beside the name. */+ args?: string;+ category: SlashCommandCategory;+ tier: SlashCommandTier;+ /** When true, AgentChat handles this client-side and does NOT call openclaw. */+ executeLocal?: boolean;+ /** Text inserted into the textarea when the user picks this. Defaults to `/${name} `. */+ insert?: string;+};++export const SLASH_COMMANDS: SlashCommand[] = [+ // Session — local-only in OpenClaw web UI+ {+ key: "clear",+ name: "clear",+ description: "Clear the visible chat buffer (trajectory on disk is kept).",+ category: "session",+ tier: "essential",+ executeLocal: true,+ },+ {+ key: "new",+ name: "new",+ description: "Start a new session (creates a fresh thread).",+ category: "session",+ tier: "essential",+ executeLocal: true,+ },+ {+ key: "stop",+ name: "stop",+ description: "Stop the in-flight response.",+ category: "session",+ tier: "essential",+ executeLocal: true,+ },+ {+ key: "help",+ name: "help",+ description: "Show available commands.",+ category: "status",+ tier: "essential",+ executeLocal: true,+ },++ // Status — sent to the agent / OpenClaw handles+ {+ key: "commands",+ name: "commands",+ description: "List all slash commands.",+ category: "status",+ tier: "power",+ },+ {+ key: "status",+ name: "status",+ description: "Show current status.",+ category: "status",+ tier: "essential",+ },+ {+ key: "whoami",+ name: "whoami",+ description: "Show your identity / caller.",+ category: "status",+ tier: "standard",+ },+ {+ key: "usage",+ name: "usage",+ description: "Show token / cost usage for this session.",+ category: "status",+ tier: "standard",+ },++ // Tools+ {+ key: "tools",+ name: "tools",+ description: "List available runtime tools.",+ category: "tools",+ tier: "standard",+ },+ {+ key: "skill",+ name: "skill",+ description: "Run a skill by name.",+ args: "<name>",+ category: "tools",+ tier: "standard",+ insert: "/skill ",+ },++ // Session / context management — pass through to OpenClaw+ {+ key: "compact",+ name: "compact",+ description: "Compact the session context to reduce token use.",+ category: "session",+ tier: "standard",+ },+ {+ key: "reset",+ name: "reset",+ description: "Reset the current session.",+ category: "session",+ tier: "standard",+ },++ // Model / behaviour directives — pass through to OpenClaw+ {+ key: "model",+ name: "model",+ description: "Override model for this turn.",+ args: "<id>",+ category: "model",+ tier: "standard",+ insert: "/model ",+ },+ {+ key: "think",+ name: "think",+ description: "Directive: enable extended thinking.",+ category: "model",+ tier: "standard",+ },+ {+ key: "fast",+ name: "fast",+ description: "Directive: disable thinking for fastest response.",+ category: "model",+ tier: "standard",+ },+ {+ key: "verbose",+ name: "verbose",+ description: "Directive: verbose progress output.",+ category: "model",+ tier: "standard",+ },+ {+ key: "trace",+ name: "trace",+ description: "Directive: include trace details.",+ category: "model",+ tier: "power",+ },+ {+ key: "reasoning",+ name: "reasoning",+ description: "Directive: surface reasoning steps.",+ category: "model",+ tier: "power",+ },++ // Advanced+ {+ key: "elevated",+ name: "elevated",+ description: "Directive: request elevated permissions (gateway-controlled).",+ category: "advanced",+ tier: "power",+ },+ {+ key: "exec",+ name: "exec",+ description: "Directive: allow exec tool use (gateway-controlled).",+ category: "advanced",+ tier: "power",+ },+ {+ key: "queue",+ name: "queue",+ description: "Directive: queue the turn instead of running inline.",+ category: "advanced",+ tier: "power",+ },+];++/**+ * Filter commands by what the user has typed after the leading `/`.+ * Prefix match wins; substring is a fallback so `/cm` still finds /compact + /commands.+ */+export function filterSlashCommands(query: string): SlashCommand[] {+ const q = query.trim().toLowerCase();+ if (!q || q === "/") return SLASH_COMMANDS;+ const stripped = q.startsWith("/") ? q.slice(1) : q;+ const exact = SLASH_COMMANDS.filter((c) => c.name.toLowerCase().startsWith(stripped));+ if (exact.length > 0) return exact;+ return SLASH_COMMANDS.filter((c) => c.name.toLowerCase().includes(stripped));+}++/**+ * Parse a chat message into { command, args } if it starts with a slash.+ * Returns null for plain (non-slash) messages.+ */+export function parseSlashMessage(text: string): { command: string; args: string } | null {+ const trimmed = text.trim();+ if (!trimmed.startsWith("/")) return null;+ const space = trimmed.indexOf(" ");+ if (space === -1) {+ return { command: trimmed.slice(1), args: "" };+ }+ return { command: trimmed.slice(1, space), args: trimmed.slice(space + 1).trim() };+}++export function findCommand(name: string): SlashCommand | undefined {+ return SLASH_COMMANDS.find((c) => c.name === name);+}++// --- Local command actions ---++export type LocalSlashAction =+ | { kind: "clear" }+ | { kind: "new-session" }+ | { kind: "stop" }+ | { kind: "help"; content: string };++/**+ * Execute a slash command locally if it's marked executeLocal. Returns null+ * when the command should be sent to the agent verbatim.+ */+export function executeLocalSlashCommand(command: string): LocalSlashAction | null {+ const def = findCommand(command);+ if (!def?.executeLocal) return null;+ switch (command) {+ case "clear":+ return { kind: "clear" };+ case "new":+ return { kind: "new-session" };+ case "stop":+ return { kind: "stop" };+ case "help":+ return { kind: "help", content: renderHelp() };+ default:+ // executeLocal=true but no handler? Treat as pass-through.+ return null;+ }+}++function renderHelp(): string {+ const lines = ["**Available commands** (type `/` to open the menu):", ""];+ for (const c of SLASH_COMMANDS) {+ const args = c.args ? ` ${c.args}` : "";+ const local = c.executeLocal ? " · local" : " · sent to agent";+ lines.push(`• \`/${c.name}${args}\` — ${c.description}${local}`);+ }+ return lines.join("\n");+}diff --git a/src/server/db/migrations.ts b/src/server/db/migrations.tsindex e0f6a430..fcfe226f 100644--- a/src/server/db/migrations.ts+++ b/src/server/db/migrations.ts@@ -148,6 +148,33 @@ ALTER TABLE projects ADD COLUMN google_ads_account_id TEXT;ALTER TABLE tasks ADD COLUMN title TEXT;ALTER TABLE tasks ADD COLUMN thread_id TEXT;ALTER TABLE tasks ADD COLUMN assigner_agent_id TEXT;+`,+ },+ {+ name: "004_task_display_id.sql",+ sql: `+-- Human-readable per-project task IDs (e.g. demo7-3) shown in the UI and+-- used in URLs. PK stays as the UUID for FK integrity / agent protocol;+-- display_id is the surface that humans + URLs see.+--+-- Backfill assigns sequential numbers in created_at order per project,+-- so existing demos get pretty IDs without manual cleanup.+ALTER TABLE tasks ADD COLUMN display_id TEXT;++WITH numbered AS (+ SELECT+ id,+ project_slug || '-' || ROW_NUMBER() OVER (+ PARTITION BY project_slug ORDER BY created_at+ ) AS dn+ FROM tasks+)+UPDATE tasks+SET display_id = numbered.dn+FROM numbered+WHERE tasks.id = numbered.id;++CREATE UNIQUE INDEX IF NOT EXISTS idx_tasks_display_id ON tasks(display_id);`,},];diff --git a/src/server/db/migrations/004_task_display_id.sql b/src/server/db/migrations/004_task_display_id.sqlnew file mode 100644index 00000000..0030dac5--- /dev/null+++ b/src/server/db/migrations/004_task_display_id.sql@@ -0,0 +1,22 @@+-- Human-readable per-project task IDs (e.g. demo7-3) shown in the UI and+-- used in URLs. PK stays as the UUID for FK integrity / agent protocol;+-- display_id is the surface that humans + URLs see.+--+-- Backfill assigns sequential numbers in created_at order per project,+-- so existing demos get pretty IDs without manual cleanup.+ALTER TABLE tasks ADD COLUMN display_id TEXT;++WITH numbered AS (+ SELECT+ id,+ project_slug || '-' || ROW_NUMBER() OVER (+ PARTITION BY project_slug ORDER BY created_at+ ) AS dn+ FROM tasks+)+UPDATE tasks+SET display_id = numbered.dn+FROM numbered+WHERE tasks.id = numbered.id;++CREATE UNIQUE INDEX IF NOT EXISTS idx_tasks_display_id ON tasks(display_id);diff --git a/src/server/db/tasks.ts b/src/server/db/tasks.tsindex 2231ab33..ccf6f291 100644--- a/src/server/db/tasks.ts+++ b/src/server/db/tasks.ts@@ -16,11 +16,34 @@ export type CreateTaskInput = {assigner_agent_id?: string | null;};+/**+ * Allocate the next display_id for a project — `<slug>-<n>` where n is one+ * past the current MAX. better-sqlite3 is synchronous so two creates in+ * one process can't race; cross-process collisions don't apply (single-user+ * local CLI) and the UNIQUE index would catch them if they ever did.+ */+function nextDisplayId(project_slug: string): string {+ const db = getDb();+ // substr starts at length(slug) + 2 to skip past "slug-".+ const row = db+ .prepare(+ `SELECT COALESCE(MAX(CAST(substr(display_id, ?) AS INTEGER)), 0) AS max_n+ FROM tasks+ WHERE project_slug = ? AND display_id LIKE ?`,+ )+ .get(project_slug.length + 2, project_slug, `${project_slug}-%`) as+ | { max_n: number }+ | undefined;+ const n = (row?.max_n ?? 0) + 1;+ return `${project_slug}-${n}`;+}+export function createTask(input: CreateTaskInput): Task {const db = getDb();const now = new Date().toISOString();const task: Task = {id: randomUUID(),+ display_id: nextDisplayId(input.project_slug),project_slug: input.project_slug,agent_id: input.agent_id,title: input.title ?? null,@@ -37,11 +60,12 @@ export function createTask(input: CreateTaskInput): Task {};db.prepare(`INSERT INTO tasks- (id, project_slug, agent_id, title, brief, success_criteria, deadline_iso,+ (id, display_id, project_slug, agent_id, title, brief, success_criteria, deadline_iso,status, result_json, error_message, thread_id, assigner_agent_id, created_at, updated_at)- VALUES (?, ?, ?, ?, ?, ?, ?, ?, NULL, NULL, NULL, ?, ?, ?)`,+ VALUES (?, ?, ?, ?, ?, ?, ?, ?, ?, NULL, NULL, NULL, ?, ?, ?)`,).run(task.id,+ task.display_id,task.project_slug,task.agent_id,task.title,@@ -76,9 +100,16 @@ export function setTaskThreadIfMissing(return getTask(id);}-export function getTask(id: string): Task | null {+/**+ * Look up a task by either the PK UUID or the human-readable display_id+ * (`<slug>-<n>`). URLs prefer display_id; internal callers may pass+ * either. Returns null when neither matches.+ */+export function getTask(idOrDisplayId: string): Task | null {const db = getDb();- const row = db.prepare("SELECT * FROM tasks WHERE id = ?").get(id);+ const row = db+ .prepare("SELECT * FROM tasks WHERE id = ? OR display_id = ?")+ .get(idOrDisplayId, idOrDisplayId);return (row as Task) ?? null;}diff --git a/src/types/index.ts b/src/types/index.tsindex 5df85ad5..c91ab71e 100644--- a/src/types/index.ts+++ b/src/types/index.ts@@ -35,6 +35,13 @@ export type TaskStatus =// └───────────────┘export type Task = {id: string;+ /**+ * Human-readable per-project ID like "demo7-3". Used in URLs and UI+ * surfaces. PK stays as `id` (UUID) for FK integrity; display_id is+ * the surface humans see. Backfilled for pre-004 tasks; always set+ * for new tasks.+ */+ display_id: string;project_slug: string;/** Assignee — the agent expected to do the work. */agent_id: string;