diff --git a/ui/src/chat/ChatComposer.vue b/ui/src/chat/ChatComposer.vue
index 2c0f237d7..fb03ac86e 100644
--- a/ui/src/chat/ChatComposer.vue
+++ b/ui/src/chat/ChatComposer.vue
@@ -9,6 +9,7 @@ import { cn } from "@/lib/utils";
import { Textarea } from "@/components/ui/textarea";
import { isExactCommand, replaceToken } from "./commands";
import ChatSlashPalette from "./ChatSlashPalette.vue";
+import ChatSuggestions from "./ChatSuggestions.vue";
import {
closeCommandMenu,
commandMatches,
@@ -242,6 +243,10 @@ function onKeydown(event: KeyboardEvent): void {
/>
+
+
import Logo from "@/components/topbar/Logo.vue";
-import { Button } from "@/components/ui/button";
/**
- * What the panel opens on before there is a conversation: an invitation, and
- * three prompts that fill the composer. The text is handed up rather than
- * typed into the composer here, because the composer owns its own focus.
+ * What the panel opens on before there is a conversation: the mark. The
+ * suggested prompts live beside the composer (ChatSuggestions), where they
+ * are reachable whether or not the transcript is empty.
*/
-const emit = defineEmits<{ prompt: [text: string] }>();
-
-// Prompts an operator might actually ask, rather than demonstrations of the
-// feature.
-const PROMPTS = [
- "Summarise active tasks",
- "Show running agents",
- "Check system status",
-];
@@ -23,16 +13,5 @@ const PROMPTS = [
-
-
- {{ prompt }}
-
-
diff --git a/ui/src/chat/ChatSuggestions.vue b/ui/src/chat/ChatSuggestions.vue
new file mode 100644
index 000000000..45ffd4646
--- /dev/null
+++ b/ui/src/chat/ChatSuggestions.vue
@@ -0,0 +1,42 @@
+
+
+
+
+
+ {{ prompt }}
+
+
+
diff --git a/ui/src/chat/ChatTranscript.vue b/ui/src/chat/ChatTranscript.vue
index 9f24fc812..f0fd7bec7 100644
--- a/ui/src/chat/ChatTranscript.vue
+++ b/ui/src/chat/ChatTranscript.vue
@@ -37,8 +37,6 @@ import {
* that set scrollTop by hand would have no "reader scrolled away" state and no
* way back down, so MessageScroller owns this.
*/
-const emit = defineEmits<{ prompt: [text: string] }>();
-
function parts(message: ChatMessage, index: number) {
const from = message.from ?? message.From ?? "";
// Anything this browser's composer did not send is Archie's answer.
@@ -114,10 +112,7 @@ const rows = computed(() => {
Retry
-
+
;
+ meta?: Record;
+}
+
+/** The pages that get their own prompt set. */
+export type SuggestionPage =
+ | "task"
+ | "tasks"
+ | "events"
+ | "workflows"
+ | "schedules"
+ | "settings"
+ | "default";
+
+/** Which prompt set a route gets, by route name like the page tag's. */
+export function suggestionPage(route: SuggestionRoute): SuggestionPage {
+ const name = typeof route.name === "string" ? route.name : "";
+ switch (name) {
+ case "task-detail":
+ return "task";
+ case "tasks":
+ return "tasks";
+ case "events":
+ return "events";
+ case "workflows":
+ return "workflows";
+ case "schedules":
+ case "org-schedules":
+ case "org-schedule-runs":
+ return "schedules";
+ default:
+ break;
+ }
+ const path = route.path ?? "";
+ if (route.meta?.settings === true || name.startsWith("settings-") || path.startsWith("/settings")) {
+ return "settings";
+ }
+ return "default";
+}
+
+/** The prompts for a route; a task page names the task it is open on. */
+export function suggestionsForRoute(route: SuggestionRoute): string[] {
+ switch (suggestionPage(route)) {
+ case "task": {
+ const id = route.params?.id;
+ const ref = id === undefined || id === "" ? "this task" : `task #${String(id)}`;
+ return [
+ `What is ${ref} doing right now?`,
+ `Summarise what ${ref} did`,
+ `Which files did ${ref} change?`,
+ ];
+ }
+ case "tasks":
+ return [
+ "Which tasks are waiting on me?",
+ "What failed in the last hour?",
+ "Show tasks that need review",
+ ];
+ case "events":
+ return [
+ "Which events fired today?",
+ "Why didn't my last event start a workflow?",
+ "Show recent event deliveries",
+ ];
+ case "workflows":
+ return [
+ "Which workflow ran most recently?",
+ "What did the last run change?",
+ "Which workflows failed recently?",
+ ];
+ case "schedules":
+ return [
+ "When is the next scheduled run?",
+ "Did the last scheduled run succeed?",
+ "Which schedules are enabled?",
+ ];
+ case "settings":
+ return [
+ "Which model is Archie using right now?",
+ "How do I connect a new repository?",
+ "Show recent access denials",
+ ];
+ default:
+ return [
+ "Summarise active tasks",
+ "Show running agents",
+ "Check system status",
+ ];
+ }
+}
diff --git a/ui/test/chat-suggestions.test.ts b/ui/test/chat-suggestions.test.ts
new file mode 100644
index 000000000..9de092865
--- /dev/null
+++ b/ui/test/chat-suggestions.test.ts
@@ -0,0 +1,79 @@
+import assert from "node:assert/strict";
+import test from "node:test";
+
+import {
+ suggestionPage,
+ suggestionsForRoute,
+ type SuggestionRoute,
+} from "../src/chat/suggestions.ts";
+
+// One route per page the prompts distinguish, in the shape the page tag reads.
+const pages: Array<[SuggestionRoute, string]> = [
+ [{ name: "task-detail", path: "/tasks/42", params: { id: "42" } }, "task"],
+ [{ name: "tasks", path: "/tasks" }, "tasks"],
+ [{ name: "events", path: "/events" }, "events"],
+ [{ name: "workflows", path: "/workflows" }, "workflows"],
+ [{ name: "schedules", path: "/schedules" }, "schedules"],
+ [{ name: "org-schedules", path: "/org/schedules" }, "schedules"],
+ [{ name: "org-schedule-runs", path: "/org/schedules/7/runs", params: { id: "7" } }, "schedules"],
+ [{ name: "system-models", path: "/settings/models", meta: { settings: true, label: "Models" } }, "settings"],
+ [{ name: "settings-tools", path: "/settings/tools" }, "settings"],
+ [{ path: "/settings/secret-engines" }, "settings"],
+ [{ name: "dashboard", path: "/" }, "default"],
+ [{ name: "org-members", path: "/org/members" }, "default"],
+ [{ name: "not-found", path: "/nope" }, "default"],
+ [{}, "default"],
+];
+
+test("each page route resolves to its own prompt set", () => {
+ for (const [route, page] of pages) {
+ assert.equal(suggestionPage(route), page, JSON.stringify(route));
+ }
+});
+
+test("the prompts follow the page", () => {
+ const byPage = new Map();
+ for (const [route, page] of pages) {
+ const prompts = suggestionsForRoute(route);
+ const seen = byPage.get(page);
+ if (seen) assert.deepEqual(prompts, seen, page);
+ else byPage.set(page, prompts);
+ }
+ const sets = [...byPage.values()];
+ for (let i = 0; i < sets.length; i++) {
+ for (let j = i + 1; j < sets.length; j++) {
+ assert.notDeepEqual(sets[i], sets[j], `pages ${[...byPage.keys()][i]} and ${[...byPage.keys()][j]} share a prompt set`);
+ }
+ }
+});
+
+test("every route yields distinct, well-formed prompts", () => {
+ for (const [route] of pages) {
+ const prompts = suggestionsForRoute(route);
+ assert.ok(prompts.length >= 2, JSON.stringify(route));
+ assert.equal(new Set(prompts).size, prompts.length, JSON.stringify(route));
+ for (const prompt of prompts) {
+ assert.ok(prompt.trim().length > 0, JSON.stringify(route));
+ assert.ok(!prompt.includes("undefined"), prompt);
+ }
+ }
+});
+
+test("a task page names the task it is open on", () => {
+ const withId = suggestionsForRoute({ name: "task-detail", path: "/tasks/42", params: { id: "42" } });
+ assert.ok(withId.some((prompt) => prompt.includes("#42")));
+ assert.ok(withId.every((prompt) => !prompt.includes("undefined")));
+
+ const withoutId = suggestionsForRoute({ name: "task-detail", path: "/tasks" });
+ assert.ok(withoutId.some((prompt) => prompt.includes("this task")));
+ assert.ok(withoutId.every((prompt) => !prompt.includes("#")));
+});
+
+test("settings is recognised by flag, by name and by path alike", () => {
+ const byFlag = suggestionsForRoute({ name: "system-status", path: "/settings/status", meta: { settings: true } });
+ const byName = suggestionsForRoute({ name: "settings-plugins", path: "/settings/plugins" });
+ const byPath = suggestionsForRoute({ path: "/settings/container-runtime" });
+ assert.deepEqual(byName, byFlag);
+ assert.deepEqual(byPath, byFlag);
+ assert.notDeepEqual(byFlag, suggestionsForRoute({ name: "dashboard", path: "/" }));
+});