Skip to content

Shared task board where people and AI coding agents work as teammates. Source-available, self-hostable.

Go

feat(agents): move conversation starters to the agent profile (MUL-8151) (#9419)

Jiayuan Zhang029466efb3de
diff --git a/apps/docs/content/docs/agents-create.fr.mdx b/apps/docs/content/docs/agents-create.fr.mdx
index 98e9df91dc..5ae5056fad 100644
--- a/apps/docs/content/docs/agents-create.fr.mdx
+++ b/apps/docs/content/docs/agents-create.fr.mdx
@@ -67,7 +67,7 @@ Les skills conviennent aux méthodes et aux supports réutilisés par plusieurs
Ajoutez jusqu'à trois **amorces de conversation** pour montrer ce que cet agent sait bien faire avant que l'on envoie un premier message dans une discussion. Elles apparaissent au-dessus du champ de saisie lorsque quelqu'un ouvre une nouvelle discussion avec l'agent. Chaque amorce comporte un libellé court et un prompt complet. En choisir une remplit le champ de saisie pour que l'utilisateur puisse la relire ou la modifier ; elle ne lance jamais d'exécution automatiquement.
-L'éditeur affiche un aperçu exact de ce que montrera une nouvelle discussion, et toute personne pouvant modifier l'agent voit, dans cet état vide, un lien **Personnaliser les amorces** qui ramène directement ici.
+À la création, elles sont une ligne facultative de la section **Identité**. Ensuite, elles se trouvent dans **Paramètres → Général**, avec l'avatar, le nom et la description, à côté d'un aperçu exact de ce que montrera une nouvelle discussion. Toute personne pouvant modifier l'agent voit aussi, dans cet état vide, un lien **Personnaliser les amorces** qui y mène directement.
Si vous laissez la liste vide, la Discussion affiche des amorces génériques par défaut, localisées. Des exemples propres à l'agent sont généralement plus utiles, car ils peuvent refléter le rôle et les limites définis dans les instructions.
diff --git a/apps/docs/content/docs/agents-create.ja.mdx b/apps/docs/content/docs/agents-create.ja.mdx
index 04e8dc47ad..a4ce0998df 100644
--- a/apps/docs/content/docs/agents-create.ja.mdx
+++ b/apps/docs/content/docs/agents-create.ja.mdx
@@ -67,7 +67,7 @@ Build with AI には、Builder との対話のためにオンラインのラン
最初のチャットメッセージを送る前に、このエージェントが得意なことを伝える**会話の開始例**を3件まで追加できます。新しいチャットを開いたときに、入力欄の上へ表示されます。各候補には短いラベルと完全なプロンプトがあります。選ぶと送信せずに入力欄へ入り、ユーザーが確認・編集できます。
-エディターのすぐ下で、新しいチャットでの見え方をそのままプレビューできます。エージェントを編集できる人には、その空の状態に**開始例をカスタマイズ**のリンクが表示され、ここへ直接戻れます。
+作成時は**基本情報**の任意項目です。作成後は**設定 → 一般**で、アバター・名前・説明と並んで編集でき、隣に新しいチャットでの見え方をそのままプレビューできます。エージェントを編集できる人には、その空の状態に**開始例をカスタマイズ**のリンクが表示され、そこへ直接移動できます。
空のままなら、チャットにはローカライズされた汎用の初期値が表示されます。エージェントの役割と境界に合わせた例のほうが通常は役立ちます。
diff --git a/apps/docs/content/docs/agents-create.ko.mdx b/apps/docs/content/docs/agents-create.ko.mdx
index 29111ec7b6..b31154c670 100644
--- a/apps/docs/content/docs/agents-create.ko.mdx
+++ b/apps/docs/content/docs/agents-create.ko.mdx
@@ -67,7 +67,7 @@ AI로 만들려면 Builder 대화를 진행할 온라인 런타임이 필요합
첫 채팅 메시지를 보내기 전에 이 에이전트가 잘하는 일을 보여 주는 **대화 시작 예시**를 최대 3개 추가할 수 있습니다. 새 채팅을 열면 입력창 위에 표시됩니다. 각 예시에는 짧은 라벨과 전체 프롬프트가 있습니다. 선택하면 전송하지 않고 입력창에 채워져 사용자가 먼저 확인하거나 수정할 수 있습니다.
-편집기 바로 아래에서 새 채팅에 표시될 실제 모습을 미리 볼 수 있습니다. 에이전트를 편집할 수 있는 사람에게는 그 빈 화면에 **시작 예시 편집** 링크가 표시되어 이 설정으로 바로 이동합니다.
+만들 때는 **기본 정보** 카드의 선택 항목입니다. 만든 뒤에는 **설정 → 일반**에서 아바타, 이름, 설명과 함께 편집하며, 옆에서 새 채팅에 표시될 실제 모습을 미리 볼 수 있습니다. 에이전트를 편집할 수 있는 사람에게는 그 빈 화면에 **시작 예시 편집** 링크가 표시되어 이 설정으로 바로 이동합니다.
목록을 비워 두면 채팅에 현지화된 범용 기본값이 표시됩니다. 에이전트의 역할과 경계에 맞춘 예시가 보통 더 유용합니다.
diff --git a/apps/docs/content/docs/agents-create.mdx b/apps/docs/content/docs/agents-create.mdx
index 432e8e0d2c..0de9dca4c3 100644
--- a/apps/docs/content/docs/agents-create.mdx
+++ b/apps/docs/content/docs/agents-create.mdx
@@ -67,7 +67,7 @@ Skills suit methods and material reused across agents; long-lived requirements t
Add up to three **conversation starters** to show people what this agent is good at before they send a first chat message. They appear when someone opens a new chat with the agent, above the composer. Each starter has a short label and a complete prompt. Selecting one fills the composer so the user can review or edit it; it never starts a run automatically.
-The editor previews exactly what a new chat will show, and anyone who can edit the agent gets a **Customize starters** link in that empty state that deep-links back here.
+During creation they are an optional row under **Identity**. Afterwards they live in **Settings → General**, next to the avatar, name, and description, beside a preview of exactly what a new chat will show. Anyone who can edit the agent also gets a **Customize starters** link in that empty state that deep-links there.
If you leave the list empty, Chat shows localized general-purpose defaults. Agent-specific examples are usually more useful because they can reflect the role and boundaries in the instructions.
diff --git a/apps/docs/content/docs/agents-create.zh.mdx b/apps/docs/content/docs/agents-create.zh.mdx
index 09cbf60d33..fa968a1a7f 100644
--- a/apps/docs/content/docs/agents-create.zh.mdx
+++ b/apps/docs/content/docs/agents-create.zh.mdx
@@ -67,7 +67,7 @@ Skill 适合保存可以跨智能体复用的方法和资料;只属于这名
最多添加三条**对话开场建议**,让用户在发送第一条消息前了解这个智能体擅长什么。它们出现在别人与该智能体开始新对话时,位于输入框上方。每项包含一个简短标题和一条完整提示词。选择后只会填入输入框,用户可以先检查或修改,不会自动开始执行。
-编辑器下方会预览新对话的实际效果;有编辑权限的人还会在那个空状态里看到**自定义开场建议**入口,点击可直接跳回这里。
+创建时,它是**身份**卡片里的一个可选项。创建之后,它在**设置 → 通用**里,和头像、名称、描述放在一起,旁边会预览新对话的实际效果。有编辑权限的人还会在那个空状态里看到**自定义开场建议**入口,点击可直接跳到这里。
留空时,对话页会显示本地化的通用默认值。针对智能体职责和边界编写的示例通常更有帮助。
diff --git a/packages/core/agents/conversation-starters.ts b/packages/core/agents/conversation-starters.ts
index 5ee2ad9494..94dae30148 100644
--- a/packages/core/agents/conversation-starters.ts
+++ b/packages/core/agents/conversation-starters.ts
@@ -32,8 +32,8 @@ export function selectConversationStarters(
*
* - no agent, or an archived one: its conversations are read-only, so
* editing its starters changes nothing anyone will see,
- * - a backend that does not persist conversation starters: the Instructions tab
- * renders no editor there, so the link lands somewhere that cannot honour
+ * - a backend that does not persist conversation starters: General settings
+ * render no editor there, so the link lands somewhere that cannot honour
* it,
* - a viewer who cannot edit the agent: a reader would arrive at a page they
* have no write access to.
diff --git a/packages/core/paths/paths.ts b/packages/core/paths/paths.ts
index e62e24f10c..bda798fd10 100644
--- a/packages/core/paths/paths.ts
+++ b/packages/core/paths/paths.ts
@@ -15,9 +15,9 @@
const encode = (id: string) => encodeURIComponent(id);
/**
- * `?focus=` token that scrolls the agent's Instructions tab to its
+ * `?focus=` token that scrolls the agent's General settings to its
* conversation-starters editor and flashes it. Lives here because it is URL
- * vocabulary: `agentConversationStarters()` writes it and the tab reads it,
+ * vocabulary: `agentConversationStarters()` writes it and the page reads it,
* and a shared constant is what stops the two from drifting apart.
*/
export const AGENT_FOCUS_CONVERSATION_STARTERS = "conversation_starters";
@@ -50,10 +50,10 @@ function workspaceScoped(slug: string) {
`${ws}/agents/new/ai/${encode(sessionId)}`,
agentDetail: (id: string) => `${ws}/agents/${encode(id)}`,
// Deep link behind "customize" in a chat's empty state: the agent's
- // Instructions tab, scrolled to the conversation starters that produced
+ // General settings, scrolled to the conversation starters that produced
// the buttons the viewer just looked at.
agentConversationStarters: (id: string) =>
- `${ws}/agents/${encode(id)}?view=instructions&focus=${AGENT_FOCUS_CONVERSATION_STARTERS}`,
+ `${ws}/agents/${encode(id)}?view=general&focus=${AGENT_FOCUS_CONVERSATION_STARTERS}`,
memberDetail: (id: string) => `${ws}/members/${encode(id)}`,
squads: () => `${ws}/squads`,
squadDetail: (id: string) => `${ws}/squads/${encode(id)}`,
diff --git a/packages/views/agents/components/agent-detail-inspector.starters.test.tsx b/packages/views/agents/components/agent-detail-inspector.starters.test.tsx
new file mode 100644
index 0000000000..5151e3c3b5
--- /dev/null
+++ b/packages/views/agents/components/agent-detail-inspector.starters.test.tsx
@@ -0,0 +1,119 @@
+// @vitest-environment jsdom
+
+import { afterEach, beforeEach, describe, expect, it, vi } from "vitest";
+import { act, cleanup, screen, waitFor } from "@testing-library/react";
+import userEvent from "@testing-library/user-event";
+import { configStore } from "@multica/core/config";
+import type { Agent, AgentRuntime } from "@multica/core/types";
+import { renderWithI18n } from "../../test/i18n";
+import { AgentDetailInspector } from "./agent-detail-inspector";
+
+vi.mock("@tanstack/react-query", async (importOriginal) => ({
+ ...(await importOriginal<typeof import("@tanstack/react-query")>()),
+ useQuery: () => ({ data: undefined, isSuccess: false }),
+}));
+vi.mock("../../common/avatar-upload-control", () => ({
+ AvatarUploadControl: () => <div data-testid="avatar-upload" />,
+}));
+vi.mock("./inspector/model-picker", () => ({
+ ModelPicker: () => <div data-testid="model-picker" />,
+}));
+vi.mock("./inspector/runtime-picker", () => ({
+ RuntimePicker: () => <div data-testid="runtime-picker" />,
+}));
+vi.mock("./inspector/thinking-prop-row", () => ({
+ ThinkingSettingField: () => <div data-testid="thinking-field" />,
+}));
+vi.mock("./inspector/service-tier-setting-field", () => ({
+ ServiceTierSettingField: () => <div data-testid="service-tier-field" />,
+}));
+
+const agent = {
+ id: "agent-1",
+ workspace_id: "workspace-1",
+ name: "Lambda",
+ description: "Coding agent",
+ runtime_id: "runtime-1",
+ avatar_url: null,
+ conversation_starters: [],
+ max_concurrent_tasks: 1,
+} as unknown as Agent;
+
+function renderInspector({
+ runtime = null,
+}: { runtime?: AgentRuntime | null } = {}) {
+ const onUpdate = vi.fn(
+ async (_id: string, _data: Record<string, unknown>) => {},
+ );
+ renderWithI18n(
+ <AgentDetailInspector
+ agent={agent}
+ runtime={runtime}
+ runtimes={[]}
+ members={[]}
+ currentUserId="user-1"
+ canEdit
+ onUpdate={onUpdate}
+ />,
+ );
+ return onUpdate;
+}
+
+describe("AgentDetailInspector conversation starters", () => {
+ beforeEach(() => {
+ configStore.getState().setAgentConversationStartersSupported(true);
+ });
+
+ afterEach(() => {
+ cleanup();
+ act(() => {
+ configStore.getState().setAgentConversationStartersSupported(false);
+ });
+ });
+
+ it("lives in the profile beside a new-chat preview", () => {
+ renderInspector();
+
+ expect(screen.getByText("Conversation starters")).toBeInTheDocument();
+ expect(screen.getByText("Using 3 built-in suggestions")).toBeInTheDocument();
+ expect(screen.getByText("New chat preview")).toBeInTheDocument();
+ expect(screen.getByText("Chat with Lambda")).toBeInTheDocument();
+ });
+
+ it("autosaves once a starter is complete, and not before", async () => {
+ const user = userEvent.setup();
+ const onUpdate = renderInspector();
+
+ await user.click(screen.getByRole("button", { name: "Customize" }));
+ await user.type(screen.getByLabelText("Suggestion 1 label"), "Review my PR");
+ await new Promise((resolve) => setTimeout(resolve, 800));
+ expect(onUpdate).not.toHaveBeenCalled();
+
+ await user.type(screen.getByLabelText("Suggestion 1 prompt"), "Review it.");
+
+ await waitFor(
+ () =>
+ expect(onUpdate).toHaveBeenCalledWith("agent-1", {
+ conversation_starters: [{ label: "Review my PR", prompt: "Review it." }],
+ }),
+ { timeout: 2000 },
+ );
+ });
+
+ it("offers neither starters nor a chat preview for a Qoder agent", () => {
+ renderInspector({
+ runtime: { id: "runtime-1", provider: "qoder_cloud" } as AgentRuntime,
+ });
+
+ expect(screen.queryByText("Conversation starters")).toBeNull();
+ expect(screen.queryByText("New chat preview")).toBeNull();
+ });
+
+ it("omits the editor on a backend that does not persist starters", () => {
+ configStore.getState().setAgentConversationStartersSupported(false);
+ renderInspector();
+
+ expect(screen.queryByText("Conversation starters")).toBeNull();
+ expect(screen.getByText("What can you help with?")).toBeInTheDocument();
+ });
+});
diff --git a/packages/views/agents/components/agent-detail-inspector.tsx b/packages/views/agents/components/agent-detail-inspector.tsx
index e5659686c5..2ac0da54b2 100644
--- a/packages/views/agents/components/agent-detail-inspector.tsx
+++ b/packages/views/agents/components/agent-detail-inspector.tsx
@@ -4,6 +4,7 @@ import { useCallback, useEffect, useMemo, useState } from "react";
import { useQuery } from "@tanstack/react-query";
import type {
Agent,
+ AgentConversationStarter,
AgentRuntime,
MemberWithUser,
} from "@multica/core/types";
@@ -16,19 +17,25 @@ import {
isRuntimeUsableForUser,
runtimeModelsOptions,
} from "@multica/core/runtimes";
+import { useConfigStore } from "@multica/core/config";
import { isImeComposing } from "@multica/core/utils";
import { Input } from "@multica/ui/components/ui/input";
import { Textarea } from "@multica/ui/components/ui/textarea";
+import { cn } from "@multica/ui/lib/utils";
import { AvatarUploadControl } from "../../common/avatar-upload-control";
import {
SettingsCard,
SettingsRow,
SettingsSaveState,
SettingsSection,
+ type SettingsSaveStatus,
} from "../../settings/components/settings-layout";
import { useAutoSave } from "../../settings/components/use-auto-save";
import { useT } from "../../i18n";
import { CharCounter } from "./char-counter";
+import { ConversationStartersEditor } from "./conversation-starters-editor";
+import { NewChatPreview } from "./new-chat-preview";
+import { useConversationStartersFocus } from "./use-conversation-starters-focus";
import { ModelPicker } from "./inspector/model-picker";
import {
buildModelChangeUpdate,
@@ -57,6 +64,22 @@ function profileDraftsEqual(left: ProfileDraft, right: ProfileDraft) {
return left.name === right.name && left.description === right.description;
}
+function startersEqual(
+ left: AgentConversationStarter[],
+ right: AgentConversationStarter[],
+) {
+ return JSON.stringify(left) === JSON.stringify(right);
+}
+
+function combinedSaveStatus(
+ ...statuses: SettingsSaveStatus[]
+): SettingsSaveStatus {
+ for (const status of ["error", "saving", "saved"] as const) {
+ if (statuses.includes(status)) return status;
+ }
+ return "idle";
+}
+
/**
* Full-width General settings form. Every editable value is presented as an
* explicit field; compact inspector chips are used only through their
@@ -80,10 +103,14 @@ export function AgentDetailInspector({
const [name, setName] = useState(agent.name);
const [description, setDescription] = useState(agent.description ?? "");
+ const [starters, setStarters] = useState<AgentConversationStarter[]>(
+ agent.conversation_starters ?? [],
+ );
useEffect(() => {
setName(agent.name);
setDescription(agent.description ?? "");
+ setStarters(agent.conversation_starters ?? []);
// Reset only when moving to another agent. Cache updates from this form
// must not erase a newer local draft while an autosave is in flight.
// eslint-disable-next-line react-hooks/exhaustive-deps
@@ -120,8 +147,33 @@ export function AgentDetailInspector({
// A Qoder agent is bound to a QCA agent, and the model lives there. Moving
// between Qoder and any other runtime would need a different configuration
// the server either rejects or the bridge refuses, so neither direction is
- // offered here.
+ // offered here. It also never opens a chat, so nothing chat-facing applies.
const qoderRuntime = runtime?.provider === "qoder_cloud";
+ const conversationStartersEnabled = useConfigStore(
+ (state) => state.agentConversationStartersSupported,
+ );
+ const showStarters = conversationStartersEnabled && !qoderRuntime;
+ const startersComplete = starters.every(
+ (item) => item.label.trim() && item.prompt.trim(),
+ );
+ const savedStarters = useMemo(
+ () => agent.conversation_starters ?? [],
+ [agent.conversation_starters],
+ );
+ const saveStarters = useCallback(
+ async (next: AgentConversationStarter[]) => {
+ await update({ conversation_starters: next });
+ },
+ [update],
+ );
+ const startersAutoSave = useAutoSave({
+ value: starters,
+ savedValue: savedStarters,
+ onSave: saveStarters,
+ enabled: canEdit && showStarters && startersComplete,
+ isEqual: startersEqual,
+ });
+ const startersFocus = useConversationStartersFocus(agent.id, showStarters);
const isOnline = runtime?.status === "online";
const canReadRuntime =
runtime != null && isRuntimeUsableForUser(runtime, currentUserId);
@@ -165,174 +217,218 @@ export function AgentDetailInspector({
);
return (
- <div className="space-y-8">
- <SettingsSection
- title={t(($) => $.inspector.section_profile)}
- action={
- <SettingsSaveState
- status={profileAutoSave.status}
- savingLabel={ts(($) => $.auto_save.saving)}
- savedLabel={ts(($) => $.auto_save.saved)}
- errorLabel={ts(($) => $.auto_save.failed)}
- />
- }
- >
- <SettingsCard>
- <SettingsRow
- label={t(($) => $.inspector.avatar_label)}
- size="none"
- >
- <div className="flex justify-start sm:justify-end">
- <AvatarUploadControl
- variant="agent"
- value={agent.avatar_url ?? null}
- name={agent.name}
- size={56}
- disabled={!canEdit}
- onUploaded={(url) => update({ avatar_url: url })}
- onEmojiSelected={(value) => update({ avatar_url: value })}
+ <div className="@container">
+ <div className="@4xl:grid @4xl:grid-cols-[minmax(0,1fr)_17.5rem] @4xl:items-start @4xl:gap-8">
+ <div className="min-w-0 space-y-8">
+ <SettingsSection
+ title={t(($) => $.inspector.section_profile)}
+ action={
+ <SettingsSaveState
+ status={combinedSaveStatus(
+ profileAutoSave.status,
+ startersAutoSave.status,
+ )}
+ savingLabel={ts(($) => $.auto_save.saving)}
+ savedLabel={ts(($) => $.auto_save.saved)}
+ errorLabel={ts(($) => $.auto_save.failed)}
/>
- </div>
- </SettingsRow>
-
- <SettingsRow
- label={t(($) => $.inspector.name_label)}
- size="text"
+ }
>
- <div>
- <Input
- type="text"
- name="agent-name"
- autoComplete="off"
- aria-label={t(($) => $.inspector.name_label)}
- value={name}
- onChange={(event) => setName(event.target.value)}
- onBlur={profileAutoSave.flush}
- disabled={!canEdit}
- aria-invalid={nameInvalid || undefined}
- />
- {nameInvalid ? (
- <p className="mt-1 text-caption text-destructive">
- {t(($) => $.inspector.rename_required)}
- </p>
- ) : null}
- </div>
- </SettingsRow>
+ <SettingsCard>
+ <SettingsRow
+ label={t(($) => $.inspector.avatar_label)}
+ size="none"
+ >
+ <div className="flex justify-start sm:justify-end">
+ <AvatarUploadControl
+ variant="agent"
+ value={agent.avatar_url ?? null}
+ name={agent.name}
+ size={56}
+ disabled={!canEdit}
+ onUploaded={(url) => update({ avatar_url: url })}
+ onEmojiSelected={(value) => update({ avatar_url: value })}
+ />
+ </div>
+ </SettingsRow>
- <SettingsRow
- label={t(($) => $.inspector.description_label)}
- size="text"
- align="start"
- >
- <div>
- <Textarea
- name="agent-description"
- autoComplete="off"
- aria-label={t(($) => $.inspector.description_label)}
- value={description}
- onChange={(event) => setDescription(event.target.value)}
- onBlur={profileAutoSave.flush}
- disabled={!canEdit}
- rows={5}
- maxLength={AGENT_DESCRIPTION_MAX_LENGTH}
- className="resize-y"
- placeholder={t(($) => $.inspector.description_placeholder)}
- />
- <CharCounter
- length={[...description].length}
- max={AGENT_DESCRIPTION_MAX_LENGTH}
- />
- </div>
- </SettingsRow>
- </SettingsCard>
- </SettingsSection>
+ <SettingsRow
+ label={t(($) => $.inspector.name_label)}
+ size="text"
+ >
+ <div>
+ <Input
+ type="text"
+ name="agent-name"
+ autoComplete="off"
+ aria-label={t(($) => $.inspector.name_label)}
+ value={name}
+ onChange={(event) => setName(event.target.value)}
+ onBlur={profileAutoSave.flush}
+ disabled={!canEdit}
+ aria-invalid={nameInvalid || undefined}
+ />
+ {nameInvalid ? (
+ <p className="mt-1 text-caption text-destructive">
+ {t(($) => $.inspector.rename_required)}
+ </p>
+ ) : null}
+ </div>
+ </SettingsRow>
+
+ <SettingsRow
+ label={t(($) => $.inspector.description_label)}
+ size="text"
+ align="start"
+ >
+ <div>
+ <Textarea
+ name="agent-description"
+ autoComplete="off"
+ aria-label={t(($) => $.inspector.description_label)}
+ value={description}
+ onChange={(event) => setDescription(event.target.value)}
+ onBlur={profileAutoSave.flush}
+ disabled={!canEdit}
+ rows={5}
+ maxLength={AGENT_DESCRIPTION_MAX_LENGTH}
+ className="resize-y"
+ placeholder={t(($) => $.inspector.description_placeholder)}
+ />
+ <CharCounter
+ length={[...description].length}
+ max={AGENT_DESCRIPTION_MAX_LENGTH}
+ />
+ </div>
+ </SettingsRow>
+
+ {showStarters ? (
+ <div
+ ref={startersFocus.ref}
+ className={cn(
+ "scroll-mt-4 transition-shadow duration-500",
+ startersFocus.focused && "ring-2 ring-inset ring-brand/50",
+ )}
+ >
+ <SettingsRow
+ label={t(($) => $.conversation_starters.label)}
+ description={t(($) => $.conversation_starters.hint)}
+ size="text"
+ align="start"
+ >
+ <ConversationStartersEditor
+ value={starters}
+ onChange={setStarters}
+ disabled={!canEdit}
+ />
+ </SettingsRow>
+ </div>
+ ) : null}
+ </SettingsCard>
+ </SettingsSection>
- <SettingsSection
- title={t(($) => $.inspector.section_execution)}
- description={
- qoderRuntime ? t(($) => $.inspector.qoder_execution_note) : undefined
- }
- >
- <SettingsCard>
- <SettingsRow
- label={t(($) => $.inspector.prop_runtime)}
- size="select-wide"
+ <SettingsSection
+ title={t(($) => $.inspector.section_execution)}
+ description={
+ qoderRuntime ? t(($) => $.inspector.qoder_execution_note) : undefined
+ }
>
- <RuntimePicker
- variant="field"
- showLabel={false}
- value={agent.runtime_id}
- runtimes={runtimeOptions}
- members={members}
- currentUserId={currentUserId}
- canEdit={canEdit && !qoderRuntime}
- // Model, thinking level, and service tier are runtime/model
- // native. Clear them together so the new runtime resolves its
- // own defaults instead of inheriting incompatible tokens.
- onChange={(id) =>
- update({
- runtime_id: id,
- model: "",
- thinking_level: "",
- service_tier: "",
- })
- }
- />
- </SettingsRow>
- {qoderRuntime ? null : (
- <>
+ <SettingsCard>
<SettingsRow
- label={t(($) => $.inspector.prop_model)}
+ label={t(($) => $.inspector.prop_runtime)}
size="select-wide"
>
- <ModelPicker
+ <RuntimePicker
variant="field"
showLabel={false}
- runtimeId={agent.runtime_id}
- runtimeOnline={canDiscoverRuntimeModels}
- value={agent.model ?? ""}
+ value={agent.runtime_id}
+ runtimes={runtimeOptions}
+ members={members}
+ currentUserId={currentUserId}
+ canEdit={canEdit && !qoderRuntime}
+ // Model, thinking level, and service tier are runtime/model
+ // native. Clear them together so the new runtime resolves its
+ // own defaults instead of inheriting incompatible tokens.
+ onChange={(id) =>
+ update({
+ runtime_id: id,
+ model: "",
+ thinking_level: "",
+ service_tier: "",
+ })
+ }
+ />
+ </SettingsRow>
+ {qoderRuntime ? null : (
+ <>
+ <SettingsRow
+ label={t(($) => $.inspector.prop_model)}
+ size="select-wide"
+ >
+ <ModelPicker
+ variant="field"
+ showLabel={false}
+ runtimeId={agent.runtime_id}
+ runtimeOnline={canDiscoverRuntimeModels}
+ value={agent.model ?? ""}
+ canEdit={canEdit}
+ onChange={handleModelChange}
+ />
+ </SettingsRow>
+ <ThinkingSettingField
+ label={t(($) => $.inspector.prop_thinking)}
+ runtimeId={agent.runtime_id}
+ runtimeOnline={canDiscoverRuntimeModels}
+ provider={runtime?.provider ?? ""}
+ model={agent.model ?? ""}
+ value={agent.thinking_level ?? ""}
+ canEdit={canEdit}
+ onChange={(thinkingLevel) =>
+ update({ thinking_level: thinkingLevel })
+ }
+ />
+ <ServiceTierSettingField
+ label={t(($) => $.inspector.prop_speed)}
+ runtimeId={agent.runtime_id}
+ runtimeOnline={canDiscoverRuntimeModels}
+ provider={runtime?.provider ?? ""}
+ model={agent.model ?? ""}
+ value={agent.service_tier ?? ""}
+ canEdit={canEdit}
+ onChange={(serviceTier) =>
+ update({ service_tier: serviceTier })
+ }
+ />
+ </>
+ )}
+ <SettingsRow
+ label={t(($) => $.inspector.prop_concurrency)}
+ size="select-wide"
+ >
+ <ConcurrencyField
+ value={agent.max_concurrent_tasks}
canEdit={canEdit}
- onChange={handleModelChange}
+ onSave={(next) => update({ max_concurrent_tasks: next })}
/>
</SettingsRow>
- <ThinkingSettingField
- label={t(($) => $.inspector.prop_thinking)}
- runtimeId={agent.runtime_id}
- runtimeOnline={canDiscoverRuntimeModels}
- provider={runtime?.provider ?? ""}
- model={agent.model ?? ""}
- value={agent.thinking_level ?? ""}
- canEdit={canEdit}
- onChange={(thinkingLevel) =>
- update({ thinking_level: thinkingLevel })
- }
- />
- <ServiceTierSettingField
- label={t(($) => $.inspector.prop_speed)}
- runtimeId={agent.runtime_id}
- runtimeOnline={canDiscoverRuntimeModels}
- provider={runtime?.provider ?? ""}
- model={agent.model ?? ""}
- value={agent.service_tier ?? ""}
- canEdit={canEdit}
- onChange={(serviceTier) =>
- update({ service_tier: serviceTier })
- }
- />
- </>
- )}
- <SettingsRow
- label={t(($) => $.inspector.prop_concurrency)}
- size="select-wide"
+ </SettingsCard>
+ </SettingsSection>
+ </div>
+
+ {qoderRuntime ? null : (
+ <SettingsSection
+ title={t(($) => $.conversation_starters.preview_label)}
+ className="hidden @4xl:sticky @4xl:top-0 @4xl:block"
>
- <ConcurrencyField
- value={agent.max_concurrent_tasks}
- canEdit={canEdit}
- onSave={(next) => update({ max_concurrent_tasks: next })}
+ <NewChatPreview
+ name={name.trim() || agent.name}
+ description={description}
+ avatarUrl={agent.avatar_url ?? null}
+ starters={showStarters ? starters : []}
/>
- </SettingsRow>
- </SettingsCard>
- </SettingsSection>
+ </SettingsSection>
+ )}
+ </div>
</div>
);
}
diff --git a/packages/views/agents/components/agent-overview-pane.tsx b/packages/views/agents/components/agent-overview-pane.tsx
index 594eb591a0..ca4e680b6d 100644
--- a/packages/views/agents/components/agent-overview-pane.tsx
+++ b/packages/views/agents/components/agent-overview-pane.tsx
@@ -451,7 +451,14 @@ export function AgentOverviewPane({
</aside>
<section className="min-w-0 flex-1 md:overflow-y-auto">
- <div className="w-full max-w-3xl p-4 sm:p-6 md:p-8">
+ {/* General is wider: its profile sits beside a preview of the
+ new chat it produces. */}
+ <div
+ className={cn(
+ "w-full p-4 sm:p-6 md:p-8",
+ effectiveView === "general" ? "max-w-5xl" : "max-w-3xl",
+ )}
+ >
<header>
<h2 className="text-title-sm font-medium text-balance">
{t(($) => $.tabs[activeSecondaryTab.labelKey])}
@@ -464,7 +471,6 @@ export function AgentOverviewPane({
agent={agent}
onSave={(updates) => onUpdate(agent.id, updates)}
onDirtyChange={setActiveDirty}
- showConversationStarters={!qoderRuntime}
/>
)}
{effectiveView === "skills" && (
diff --git a/packages/views/agents/components/conversation-starters-editor.test.tsx b/packages/views/agents/components/conversation-starters-editor.test.tsx
index a3a87423b7..f74db13e3c 100644
--- a/packages/views/agents/components/conversation-starters-editor.test.tsx
+++ b/packages/views/agents/components/conversation-starters-editor.test.tsx
@@ -1,66 +1,113 @@
// @vitest-environment jsdom
-import { cleanup, render, screen } from "@testing-library/react";
+import { useState } from "react";
+import { cleanup, screen } from "@testing-library/react";
+import userEvent from "@testing-library/user-event";
import { afterEach, describe, expect, it, vi } from "vitest";
-import { I18nProvider } from "@multica/core/i18n/react";
import type { AgentConversationStarter } from "@multica/core/types";
-import enAgents from "../../locales/en/agents.json";
-import enChat from "../../locales/en/chat.json";
+import { renderWithI18n } from "../../test/i18n";
import { ConversationStartersEditor } from "./conversation-starters-editor";
-// The selection matrix (which rows count, when the fallback wins) is covered
-// once in packages/core/agents/conversation-starters.test.ts. This suite only
-// proves the editor previews what a new chat would actually show.
-function renderEditor(value: AgentConversationStarter[]) {
- render(
- <I18nProvider
- locale="en"
- resources={{ en: { agents: enAgents, chat: enChat } }}
- >
- <ConversationStartersEditor value={value} onChange={vi.fn()} />
- </I18nProvider>,
+function Controlled({
+ initial,
+ onChange = vi.fn(),
+}: {
+ initial: AgentConversationStarter[];
+ onChange?: (value: AgentConversationStarter[]) => void;
+}) {
+ const [value, setValue] = useState(initial);
+ return (
+ <ConversationStartersEditor
+ value={value}
+ onChange={(next) => {
+ setValue(next);
+ onChange(next);
+ }}
+ />
);
}
-describe("ConversationStartersEditor preview", () => {
+const review = { label: "Review the release PR", prompt: "Review it and list risks." };
+
+describe("ConversationStartersEditor", () => {
afterEach(cleanup);
- it("previews the built-in defaults and says so when nothing is configured", () => {
- renderEditor([]);
+ it("says the built-in suggestions are in use when nothing is configured", () => {
+ renderWithI18n(<Controlled initial={[]} />);
- expect(screen.getByText("Preview of a new chat")).toBeInTheDocument();
- expect(screen.getByText("What can you help with?")).toBeInTheDocument();
- expect(
- screen.getByText(
- "These are the built-in defaults. Add a suggestion above to replace all three.",
- ),
- ).toBeInTheDocument();
+ expect(screen.getByText("Using 3 built-in suggestions")).toBeInTheDocument();
+ expect(screen.queryByLabelText("Suggestion 1 label")).toBeNull();
});
- it("previews the configured labels and drops the defaults note", () => {
- renderEditor([
- { label: "Review the release PR", prompt: "Review it and list risks." },
- ]);
+ it("opens a blank first suggestion from Customize", async () => {
+ const onChange = vi.fn();
+ renderWithI18n(<Controlled initial={[]} onChange={onChange} />);
+
+ await userEvent.setup().click(screen.getByRole("button", { name: "Customize" }));
- // Twice: once as the editable label input's value, once in the preview.
+ expect(onChange).toHaveBeenLastCalledWith([{ label: "", prompt: "" }]);
+ expect(screen.getByLabelText("Suggestion 1 label")).toHaveFocus();
expect(
- screen.getByDisplayValue("Review the release PR"),
+ screen.getByText("Complete or remove each suggestion before saving."),
).toBeInTheDocument();
+ });
+
+ it("keeps an incomplete suggestion open until it is filled in", async () => {
+ const user = userEvent.setup();
+ renderWithI18n(<Controlled initial={[review]} />);
+
+ await user.click(screen.getByRole("button", { name: "Add suggestion" }));
+ const done = screen.getByRole("button", { name: "Done" });
+ expect(done).toBeDisabled();
+ expect(screen.getByRole("button", { name: "Add suggestion" })).toBeDisabled();
+ expect(screen.getByRole("button", { name: "Edit suggestion 1" })).toBeDisabled();
+
+ await user.type(screen.getByLabelText("Suggestion 2 label"), "Plan");
+ expect(done).toBeDisabled();
+
+ await user.type(screen.getByLabelText("Suggestion 2 prompt"), "Plan the week.");
+ expect(done).toBeEnabled();
+ await user.click(done);
+
+ expect(screen.getByText("Plan")).toBeInTheDocument();
+ expect(screen.getByRole("button", { name: "Add suggestion" })).toBeEnabled();
+ });
+
+ it("summarises a configured suggestion and edits it in place", async () => {
+ const user = userEvent.setup();
+ const onChange = vi.fn();
+ renderWithI18n(<Controlled initial={[review]} onChange={onChange} />);
+
expect(screen.getByText("Review the release PR")).toBeInTheDocument();
- expect(screen.queryByText("What can you help with?")).toBeNull();
- expect(
- screen.queryByText(/These are the built-in defaults/),
- ).toBeNull();
+ expect(screen.getByText("Review it and list risks.")).toBeInTheDocument();
+ expect(screen.queryByLabelText("Suggestion 1 label")).toBeNull();
+
+ await user.click(screen.getByRole("button", { name: "Edit suggestion 1" }));
+ await user.type(screen.getByLabelText("Suggestion 1 label"), " today");
+ await user.click(screen.getByRole("button", { name: "Done" }));
+
+ expect(onChange).toHaveBeenLastCalledWith([
+ { ...review, label: "Review the release PR today" },
+ ]);
+ expect(screen.getByText("Review the release PR today")).toBeInTheDocument();
});
- it("keeps previewing the defaults while a row is still half-filled", () => {
- renderEditor([{ label: "Draft a plan", prompt: "" }]);
+ it("returns to the built-in suggestions when the last one is removed", async () => {
+ const user = userEvent.setup();
+ const onChange = vi.fn();
+ renderWithI18n(<Controlled initial={[review]} onChange={onChange} />);
- expect(screen.getByText("What can you help with?")).toBeInTheDocument();
- expect(
- screen.getByText(
- "Complete or remove each suggestion before saving.",
- ),
- ).toBeInTheDocument();
+ await user.click(screen.getByRole("button", { name: "Edit suggestion 1" }));
+ await user.click(screen.getByRole("button", { name: "Remove suggestion 1" }));
+
+ expect(onChange).toHaveBeenLastCalledWith([]);
+ expect(screen.getByText("Using 3 built-in suggestions")).toBeInTheDocument();
+ });
+
+ it("stops offering to add once the limit is reached", () => {
+ renderWithI18n(<Controlled initial={[review, review, review]} />);
+
+ expect(screen.queryByRole("button", { name: "Add suggestion" })).toBeNull();
+ expect(screen.getByText("3 / 3")).toBeInTheDocument();
});
});
diff --git a/packages/views/agents/components/conversation-starters-editor.tsx b/packages/views/agents/components/conversation-starters-editor.tsx
index ce240d413f..dd6a345f54 100644
--- a/packages/views/agents/components/conversation-starters-editor.tsx
+++ b/packages/views/agents/components/conversation-starters-editor.tsx
@@ -1,23 +1,26 @@
"use client";
-import { Plus, Trash2 } from "lucide-react";
+import { useState } from "react";
+import { MessageSquare, Pencil, Plus, Trash2 } from "lucide-react";
import {
AGENT_CONVERSATION_STARTER_LABEL_MAX_LENGTH,
AGENT_CONVERSATION_STARTER_MAX_LENGTH,
AGENT_CONVERSATION_STARTERS_MAX,
- selectConversationStarters,
} from "@multica/core/agents";
import type { AgentConversationStarter } from "@multica/core/types";
import { Button } from "@multica/ui/components/ui/button";
import { IconButton } from "@multica/ui/components/common/icon-button";
import { Input } from "@multica/ui/components/ui/input";
import { Textarea } from "@multica/ui/components/ui/textarea";
-import {
- ConversationStarterList,
- useFallbackConversationStarters,
-} from "../../chat/components/conversation-starter-list";
+import { useFallbackConversationStarters } from "../../chat/components/conversation-starter-list";
import { useT } from "../../i18n";
+/**
+ * A compact list of an agent's conversation starters: one summary row per
+ * starter, opened in place to edit. With nothing configured it says the
+ * built-in suggestions are in use instead of showing an empty list, because
+ * that is what a new chat shows and what any starter added here replaces.
+ */
export function ConversationStartersEditor({
value,
onChange,
@@ -28,15 +31,13 @@ export function ConversationStartersEditor({
disabled?: boolean;
}) {
const { t } = useT("agents");
- const hasIncompletePrompt = value.some(
- (item) => !item.label.trim() || !item.prompt.trim(),
- );
- // Rendered through the same component and the same resolver the chat empty
- // state uses, so the preview cannot drift from what it previews — including
- // the fallback rule, which is how an author learns that the three
- // suggestions they never configured are defaults they can replace.
- const fallbackStarters = useFallbackConversationStarters();
- const preview = selectConversationStarters(value, fallbackStarters);
+ const fallbackCount = useFallbackConversationStarters().length;
+ const [editing, setEditing] = useState<number | null>(null);
+ const hasIncompletePrompt = value.some(isIncomplete);
+ // An open suggestion stays open until it is filled in or removed, so a
+ // half-written one is never tucked away behind a collapsed row.
+ const editingItem = editing === null ? undefined : value[editing];
+ const editingIncomplete = editingItem ? isIncomplete(editingItem) : false;
const update = (
index: number,
@@ -49,94 +50,160 @@ export function ConversationStartersEditor({
),
);
};
+ const add = () => {
+ onChange([...value, { label: "", prompt: "" }]);
+ setEditing(value.length);
+ };
+ const remove = (index: number) => {
+ onChange(value.filter((_, itemIndex) => itemIndex !== index));
+ setEditing(null);
+ };
- return (
- <div className="space-y-3">
- <div>
- <p className="text-body font-medium">
- {t(($) => $.conversation_starters.label)}
- </p>
- <p className="mt-1 text-caption leading-5 text-muted-foreground">
- {t(($) => $.conversation_starters.hint)}
- </p>
+ if (value.length === 0) {
+ return (
+ <div className="flex min-h-10 items-center gap-2 rounded-lg border border-dashed py-1.5 pr-1.5 pl-3">
+ <MessageSquare
+ className="size-3.5 shrink-0 text-muted-foreground"
+ aria-hidden="true"
+ />
+ <span className="min-w-0 flex-1 text-label text-muted-foreground">
+ {t(($) => $.conversation_starters.defaults_summary, {
+ count: fallbackCount,
+ })}
+ </span>
+ <Button
+ type="button"
+ variant="outline"
+ size="xs"
+ disabled={disabled}
+ onClick={add}
+ >
+ <Plus aria-hidden="true" />
+ {t(($) => $.conversation_starters.customize)}
+ </Button>
</div>
+ );
+ }
- {value.map((item, index) => (
- <div key={index} className="rounded-lg border bg-muted/20 p-3">
- <div className="flex items-center gap-2">
+ return (
+ <div className="space-y-1.5">
+ {value.map((item, index) =>
+ editing === index ? (
+ <div key={index} className="rounded-lg border border-ring/60 bg-card p-2.5">
<Input
value={item.label}
maxLength={AGENT_CONVERSATION_STARTER_LABEL_MAX_LENGTH}
disabled={disabled}
+ autoFocus
aria-label={t(($) => $.conversation_starters.item_label, {
number: index + 1,
})}
placeholder={t(($) => $.conversation_starters.label_placeholder)}
onChange={(event) => update(index, "label", event.target.value)}
/>
+ <Textarea
+ value={item.prompt}
+ maxLength={AGENT_CONVERSATION_STARTER_MAX_LENGTH}
+ disabled={disabled}
+ rows={3}
+ className="mt-2 resize-y"
+ aria-label={t(($) => $.conversation_starters.prompt_label, {
+ number: index + 1,
+ })}
+ placeholder={t(($) => $.conversation_starters.prompt_placeholder)}
+ onChange={(event) => update(index, "prompt", event.target.value)}
+ />
+ <div className="mt-2 flex items-center justify-between gap-2">
+ <Button
+ type="button"
+ variant="ghost"
+ size="xs"
+ className="text-destructive hover:text-destructive"
+ disabled={disabled}
+ aria-label={t(($) => $.conversation_starters.remove, {
+ number: index + 1,
+ })}
+ onClick={() => remove(index)}
+ >
+ <Trash2 aria-hidden="true" />
+ {t(($) => $.conversation_starters.remove_short)}
+ </Button>
+ <Button
+ type="button"
+ variant="outline"
+ size="xs"
+ disabled={editingIncomplete}
+ onClick={() => setEditing(null)}
+ >
+ {t(($) => $.conversation_starters.done)}
+ </Button>
+ </div>
+ </div>
+ ) : (
+ <div
+ key={index}
+ className="flex items-center gap-1 rounded-lg border bg-card py-1.5 pr-1.5 pl-3"
+ >
+ <div className="min-w-0 flex-1">
+ <p className="truncate text-label font-medium">
+ {item.label.trim() || (
+ <span className="text-muted-foreground">
+ {t(($) => $.conversation_starters.untitled)}
+ </span>
+ )}
+ </p>
+ {item.prompt.trim() ? (
+ <p className="truncate text-caption text-muted-foreground">
+ {item.prompt}
+ </p>
+ ) : null}
+ </div>
<IconButton
type="button"
variant="ghost"
size="icon-sm"
- disabled={disabled}
- label={t(($) => $.conversation_starters.remove, {
+ disabled={disabled || editingIncomplete}
+ label={t(($) => $.conversation_starters.edit, {
number: index + 1,
})}
- onClick={() =>
- onChange(value.filter((_, itemIndex) => itemIndex !== index))
- }
+ onClick={() => setEditing(index)}
>
- <Trash2 className="size-4" aria-hidden="true" />
+ <Pencil className="size-3.5" aria-hidden="true" />
</IconButton>
</div>
- <Textarea
- value={item.prompt}
- maxLength={AGENT_CONVERSATION_STARTER_MAX_LENGTH}
- disabled={disabled}
- rows={3}
- className="mt-2 resize-y"
- aria-label={t(($) => $.conversation_starters.prompt_label, {
- number: index + 1,
- })}
- placeholder={t(($) => $.conversation_starters.prompt_placeholder)}
- onChange={(event) => update(index, "prompt", event.target.value)}
- />
- </div>
- ))}
+ ),
+ )}
- {value.length < AGENT_CONVERSATION_STARTERS_MAX ? (
- <Button
- type="button"
- variant="outline"
- size="sm"
- disabled={disabled}
- onClick={() => onChange([...value, { label: "", prompt: "" }])}
- >
- <Plus className="size-4" aria-hidden="true" />
- {t(($) => $.conversation_starters.add)}
- </Button>
- ) : null}
+ <div className="flex items-center justify-between gap-2">
+ {value.length < AGENT_CONVERSATION_STARTERS_MAX ? (
+ <Button
+ type="button"
+ variant="ghost"
+ size="xs"
+ className="-ml-1.5 text-muted-foreground"
+ disabled={disabled || editingIncomplete}
+ onClick={add}
+ >
+ <Plus aria-hidden="true" />
+ {t(($) => $.conversation_starters.add)}
+ </Button>
+ ) : (
+ <span />
+ )}
+ <span className="text-caption tabular-nums text-muted-foreground">
+ {value.length} / {AGENT_CONVERSATION_STARTERS_MAX}
+ </span>
+ </div>
{hasIncompletePrompt ? (
<p className="text-caption text-destructive" role="alert">
{t(($) => $.conversation_starters.incomplete)}
</p>
) : null}
-
- <div className="rounded-lg border border-dashed bg-muted/20 px-3 py-3">
- <p className="text-caption font-medium text-muted-foreground">
- {t(($) => $.conversation_starters.preview_label)}
- </p>
- <ConversationStarterList
- className="mt-2 max-w-sm"
- starters={preview.starters}
- />
- {preview.isFallback ? (
- <p className="mt-2 text-caption leading-5 text-muted-foreground">
- {t(($) => $.conversation_starters.preview_defaults)}
- </p>
- ) : null}
- </div>
</div>
);
}
+
+function isIncomplete(item: AgentConversationStarter) {
+ return !item.label.trim() || !item.prompt.trim();
+}
diff --git a/packages/views/agents/components/new-chat-preview.test.tsx b/packages/views/agents/components/new-chat-preview.test.tsx
new file mode 100644
index 0000000000..2670df006a
--- /dev/null
+++ b/packages/views/agents/components/new-chat-preview.test.tsx
@@ -0,0 +1,50 @@
+// @vitest-environment jsdom
+
+import { cleanup, screen } from "@testing-library/react";
+import { afterEach, describe, expect, it } from "vitest";
+import type { AgentConversationStarter } from "@multica/core/types";
+import { renderWithI18n } from "../../test/i18n";
+import { NewChatPreview } from "./new-chat-preview";
+
+// The selection matrix (which rows count, when the fallback wins) is covered
+// once in packages/core/agents/conversation-starters.test.ts. This suite only
+// proves the preview shows what a new chat would actually show.
+function renderPreview(starters: AgentConversationStarter[]) {
+ renderWithI18n(
+ <NewChatPreview
+ name="Lambda"
+ description="Jiayuan's coding agent."
+ avatarUrl={null}
+ starters={starters}
+ />,
+ );
+}
+
+describe("NewChatPreview", () => {
+ afterEach(cleanup);
+
+ it("shows the profile and the built-in defaults when nothing is configured", () => {
+ renderPreview([]);
+
+ expect(screen.getByText("Chat with Lambda")).toBeInTheDocument();
+ expect(screen.getByText("Jiayuan's coding agent.")).toBeInTheDocument();
+ expect(screen.getByText("What can you help with?")).toBeInTheDocument();
+ expect(screen.getByText(/These are the built-in suggestions/)).toBeInTheDocument();
+ });
+
+ it("shows configured starters and drops the defaults note", () => {
+ renderPreview([
+ { label: "Review the release PR", prompt: "Review it and list risks." },
+ ]);
+
+ expect(screen.getByText("Review the release PR")).toBeInTheDocument();
+ expect(screen.queryByText("What can you help with?")).toBeNull();
+ expect(screen.queryByText(/These are the built-in suggestions/)).toBeNull();
+ });
+
+ it("keeps showing the defaults while a starter is still half-filled", () => {
+ renderPreview([{ label: "Draft a plan", prompt: "" }]);
+
+ expect(screen.getByText("What can you help with?")).toBeInTheDocument();
+ });
+});
diff --git a/packages/views/agents/components/new-chat-preview.tsx b/packages/views/agents/components/new-chat-preview.tsx
new file mode 100644
index 0000000000..0116b7baf5
--- /dev/null
+++ b/packages/views/agents/components/new-chat-preview.tsx
@@ -0,0 +1,69 @@
+"use client";
+
+import { selectConversationStarters } from "@multica/core/agents";
+import type { AgentConversationStarter } from "@multica/core/types";
+import { resolvePublicFileUrl } from "@multica/core/workspace/avatar-url";
+import { ActorAvatar } from "@multica/ui/components/common/actor-avatar";
+import {
+ ConversationStarterList,
+ useFallbackConversationStarters,
+} from "../../chat/components/conversation-starter-list";
+import { useT } from "../../i18n";
+
+/**
+ * What a new chat with this agent shows before anyone types, built from the
+ * profile being edited rather than the saved agent, so every field change is
+ * visible at once. Starters go through the same component and resolver as the
+ * real empty state — including the fallback, which is how an author learns
+ * that suggestions they never configured are defaults they can replace.
+ */
+export function NewChatPreview({
+ name,
+ description,
+ avatarUrl,
+ starters,
+}: {
+ name: string;
+ description: string;
+ avatarUrl: string | null;
+ starters: AgentConversationStarter[];
+}) {
+ const { t } = useT("agents");
+ const { t: tChat } = useT("chat");
+ const fallbackStarters = useFallbackConversationStarters();
+ const preview = selectConversationStarters(starters, fallbackStarters);
+ const trimmedDescription = description.trim();
+
+ return (
+ <div className="rounded-xl border bg-background px-4 pt-6 pb-4">
+ <div className="flex flex-col items-center gap-3.5 text-center">
+ <ActorAvatar
+ name={name}
+ initials=""
+ avatarUrl={
+ avatarUrl?.startsWith("/") ? resolvePublicFileUrl(avatarUrl) : avatarUrl
+ }
+ isAgent
+ size="xl"
+ className="ring-1 ring-inset ring-border"
+ />
+ <div className="min-w-0 space-y-0.5">
+ <p className="text-body font-semibold break-words">
+ {tChat(($) => $.empty_state.chat_with_named, { name })}
+ </p>
+ {trimmedDescription ? (
+ <p className="line-clamp-3 text-caption text-muted-foreground">
+ {trimmedDescription}
+ </p>
+ ) : null}
+ </div>
+ <ConversationStarterList starters={preview.starters} />
+ </div>
+ {preview.isFallback ? (
+ <p className="mt-3 text-caption leading-5 text-muted-foreground">
+ {t(($) => $.conversation_starters.preview_defaults)}
+ </p>
+ ) : null}
+ </div>
+ );
+}
diff --git a/packages/views/agents/components/tabs/instructions-tab.test.tsx b/packages/views/agents/components/tabs/instructions-tab.test.tsx
index af9e35e848..06f0d2fe01 100644
--- a/packages/views/agents/components/tabs/instructions-tab.test.tsx
+++ b/packages/views/agents/components/tabs/instructions-tab.test.tsx
@@ -1,27 +1,12 @@
// @vitest-environment jsdom
-import { afterEach, beforeEach, describe, expect, it, vi } from "vitest";
-import { act, render, screen } from "@testing-library/react";
+import { describe, expect, it, vi } from "vitest";
+import { act, screen } from "@testing-library/react";
import userEvent from "@testing-library/user-event";
-import { configStore } from "@multica/core/config";
-import { I18nProvider } from "@multica/core/i18n/react";
import type { Agent } from "@multica/core/types";
-import enCommon from "../../../locales/en/common.json";
-import enAgents from "../../../locales/en/agents.json";
-// The conversation-starter editor previews the chat empty state, so it reads the
-// chat namespace for the built-in defaults it renders when nothing is set.
-import enChat from "../../../locales/en/chat.json";
-import { NavigationProvider } from "../../../navigation";
-import type { NavigationAdapter } from "../../../navigation";
+import { renderWithI18n } from "../../../test/i18n";
import { InstructionsTab } from "./instructions-tab";
-const TEST_RESOURCES = {
- en: { common: enCommon, agents: enAgents, chat: enChat },
-};
-const persistedPrompt = {
- label: "Review a PR",
- prompt: "Review the open pull request.",
-};
const baseAgent: Agent = {
id: "agent-1",
workspace_id: "ws-1",
@@ -29,7 +14,7 @@ const baseAgent: Agent = {
name: "Reviewer",
description: "",
instructions: "Review carefully.",
- conversation_starters: [persistedPrompt],
+ conversation_starters: [{ label: "Review a PR", prompt: "Review it." }],
avatar_url: null,
runtime_mode: "local",
runtime_config: {},
@@ -49,126 +34,24 @@ const baseAgent: Agent = {
};
function tab(agent: Agent, onSave = vi.fn().mockResolvedValue(undefined)) {
- return (
- <I18nProvider locale="en" resources={TEST_RESOURCES}>
- <InstructionsTab agent={agent} onSave={onSave} />
- </I18nProvider>
- );
+ return <InstructionsTab agent={agent} onSave={onSave} />;
}
-describe("InstructionsTab persisted-state synchronization", () => {
- beforeEach(() => {
- configStore.getState().setAgentConversationStartersSupported(true);
- });
-
- afterEach(() => {
- act(() => {
- configStore.getState().setAgentConversationStartersSupported(false);
- });
- });
-
- it("preserves an unsaved prompt across an equivalent agent-list refetch", async () => {
- const user = userEvent.setup();
- const { rerender } = render(tab(baseAgent));
- const label = screen.getByLabelText("Suggestion 1 label");
- await user.clear(label);
- await user.type(label, "Inspect the patch");
-
- rerender(
- tab({
- ...baseAgent,
- conversation_starters: [{ ...persistedPrompt }],
- }),
- );
-
- expect(screen.getByLabelText("Suggestion 1 label")).toHaveValue(
- "Inspect the patch",
- );
- });
-
- it("preserves dirty local state when persisted contents change", async () => {
- const user = userEvent.setup();
- const { rerender } = render(tab(baseAgent));
- const label = screen.getByLabelText("Suggestion 1 label");
- await user.clear(label);
- await user.type(label, "Inspect the patch");
-
- rerender(
- tab({
- ...baseAgent,
- conversation_starters: [
- { label: "Server-side change", prompt: "A different prompt." },
- ],
- }),
- );
-
- expect(screen.getByLabelText("Suggestion 1 label")).toHaveValue(
- "Inspect the patch",
- );
- });
-
- it("preserves submitted prompt edits when an optimistic update rolls back", async () => {
- let rejectSave!: (reason?: unknown) => void;
- const onSave = vi.fn(
- () =>
- new Promise<void>((_, reject) => {
- rejectSave = reject;
- }),
- );
- const user = userEvent.setup();
- const { rerender } = render(tab(baseAgent, onSave));
- const label = screen.getByLabelText("Suggestion 1 label");
- const prompt = screen.getByLabelText("Suggestion 1 prompt");
- await user.clear(label);
- await user.type(label, "Inspect the patch");
- await user.clear(prompt);
- await user.type(prompt, "Inspect the patch for correctness.");
- await user.click(screen.getByRole("button", { name: "Save" }));
-
- const optimisticPrompt = {
- label: "Inspect the patch",
- prompt: "Inspect the patch for correctness.",
- };
- rerender(
- tab(
- {
- ...baseAgent,
- conversation_starters: [optimisticPrompt],
- },
- onSave,
- ),
- );
- rerender(
- tab(
- {
- ...baseAgent,
- conversation_starters: [{ ...persistedPrompt }],
- },
- onSave,
- ),
- );
- await act(async () => rejectSave(new Error("Update failed")));
-
- expect(screen.getByLabelText("Suggestion 1 label")).toHaveValue(
- "Inspect the patch",
- );
- expect(screen.getByLabelText("Suggestion 1 prompt")).toHaveValue(
- "Inspect the patch for correctness.",
- );
- });
+async function typeInstructions(text: string) {
+ const user = userEvent.setup();
+ const field = screen.getByLabelText("System prompt");
+ await user.clear(field);
+ await user.type(field, text);
+ return user;
+}
- it("omits conversation starters from settings writes to an older backend", async () => {
- configStore.getState().setAgentConversationStartersSupported(false);
+describe("InstructionsTab", () => {
+ it("saves only the instructions; starters live in General settings", async () => {
const onSave = vi.fn().mockResolvedValue(undefined);
- const user = userEvent.setup();
- render(tab(baseAgent, onSave));
+ renderWithI18n(tab(baseAgent, onSave));
- expect(
- screen.queryByText("Conversation starters"),
- ).not.toBeInTheDocument();
- const instructions = screen.getByLabelText("System prompt");
- await user.clear(instructions);
- await user.type(instructions, "Updated instructions.");
+ expect(screen.queryByText("Conversation starters")).toBeNull();
+ const user = await typeInstructions("Updated instructions.");
await user.click(screen.getByRole("button", { name: "Save" }));
expect(onSave).toHaveBeenCalledWith({
@@ -176,161 +59,67 @@ describe("InstructionsTab persisted-state synchronization", () => {
});
});
- it("leaves starters out for a runtime that never opens a chat", async () => {
- const onSave = vi.fn().mockResolvedValue(undefined);
- const user = userEvent.setup();
- render(
- <I18nProvider locale="en" resources={TEST_RESOURCES}>
- <InstructionsTab
- agent={baseAgent}
- onSave={onSave}
- showConversationStarters={false}
- />
- </I18nProvider>,
- );
+ it("discards unsaved edits back to the saved instructions", async () => {
+ renderWithI18n(tab(baseAgent));
- expect(screen.queryByLabelText("Suggestion 1 label")).toBeNull();
- const instructions = screen.getByLabelText("System prompt");
- await user.clear(instructions);
- await user.type(instructions, "Updated instructions.");
- await user.click(screen.getByRole("button", { name: "Save" }));
+ const user = await typeInstructions("Scratch that.");
+ expect(screen.getByText("Unsaved changes")).toBeInTheDocument();
+ await user.click(screen.getByRole("button", { name: "Discard" }));
- expect(onSave).toHaveBeenCalledWith({
- instructions: "Updated instructions.",
- });
+ expect(screen.getByLabelText("System prompt")).toHaveValue(
+ "Review carefully.",
+ );
+ expect(screen.queryByText("Unsaved changes")).toBeNull();
+ expect(screen.getByRole("button", { name: "Save" })).toBeDisabled();
});
-});
-
-// The "customize" link in a chat's empty state lands here with ?focus=. The
-// tab must bring the editor into view and then clear the param, so a refresh
-// or a later tab switch does not replay the flash.
-describe("InstructionsTab conversation-starters deep link", () => {
- // Mirrors FOCUS_FLASH_MS in instructions-tab.tsx.
- const FLASH_MS = 1600;
- beforeEach(() => {
- configStore.getState().setAgentConversationStartersSupported(true);
- });
+ it("counts characters and previews an empty prompt without an editor", async () => {
+ renderWithI18n(tab({ ...baseAgent, instructions: "" }));
- afterEach(() => {
- act(() => {
- configStore.getState().setAgentConversationStartersSupported(false);
- });
- });
+ expect(screen.getByText("0 characters")).toBeInTheDocument();
+ await userEvent.setup().click(screen.getByRole("tab", { name: "Preview" }));
- // A fresh adapter object per render — what the web platform actually hands
- // down, and the condition the flash-timer regression below depends on.
- const adapter = (search: string, replace = vi.fn()): NavigationAdapter => ({
- push: vi.fn(),
- replace,
- back: vi.fn(),
- pathname: "/acme/agents/agent-1",
- searchParams: new URLSearchParams(search),
- hash: "",
- getShareableUrl: (path: string) => `https://app.test${path}`,
+ expect(screen.queryByLabelText("System prompt")).toBeNull();
+ expect(screen.getByText("Nothing to preview yet.")).toBeInTheDocument();
});
- function renderWithSearch(search: string) {
- const replace = vi.fn();
- const scrollIntoView = vi.fn();
- // jsdom has no layout, so the method does not exist at all.
- Element.prototype.scrollIntoView = scrollIntoView;
- const tree = (value: NavigationAdapter, agent: Agent) => (
- <I18nProvider locale="en" resources={TEST_RESOURCES}>
- <NavigationProvider value={value}>
- <InstructionsTab agent={agent} onSave={vi.fn()} />
- </NavigationProvider>
- </I18nProvider>
- );
- const { rerender } = render(tree(adapter(search, replace), baseAgent));
- return {
- replace,
- scrollIntoView,
- /**
- * Re-render as the platform does: a new adapter object every time, and
- * optionally a different agent for an in-place navigation between two
- * agent pages on the same route.
- */
- settleUrl: (next: string, agent: Agent = baseAgent) =>
- rerender(tree(adapter(next, replace), agent)),
- };
- }
-
- const ringed = () =>
- document.querySelector<HTMLElement>("[class*='ring-brand']");
+ it("preserves an unsaved edit when the server copy changes", async () => {
+ const { rerender } = renderWithI18n(tab(baseAgent));
+ await typeInstructions("Local draft.");
- it("scrolls to the editor and drops the focus param, keeping the view", () => {
- const { replace, scrollIntoView } = renderWithSearch(
- "view=instructions&focus=conversation_starters",
- );
+ rerender(tab({ ...baseAgent, instructions: "Server-side change." }));
- expect(scrollIntoView).toHaveBeenCalledWith({ block: "nearest" });
- expect(replace).toHaveBeenCalledWith(
- "/acme/agents/agent-1?view=instructions",
- );
+ expect(screen.getByLabelText("System prompt")).toHaveValue("Local draft.");
});
- // Regression: the flash timer must not hang off the effect's cleanup. The
- // navigation adapter is not referentially stable, so React would run that
- // cleanup on the very next render and cancel the timeout, leaving the ring
- // on the editor permanently.
- it("ends the flash instead of ringing the editor forever", () => {
- vi.useFakeTimers();
- try {
- const { settleUrl } = renderWithSearch(
- "view=instructions&focus=conversation_starters",
- );
- expect(ringed()).not.toBeNull();
-
- // The stripped URL arrives on a new adapter object, re-running the
- // effect. A flash timer owned by that effect's cleanup dies here.
- act(() => settleUrl("view=instructions"));
- act(() => {
- vi.advanceTimersByTime(FLASH_MS + 400);
- });
+ it("adopts a server change while the editor is clean", () => {
+ const { rerender } = renderWithI18n(tab(baseAgent));
- expect(ringed()).toBeNull();
- } finally {
- vi.useRealTimers();
- }
- });
+ rerender(tab({ ...baseAgent, instructions: "Server-side change." }));
- // Regression: the guard against re-firing before the stripped URL lands must
- // not become a one-shot-per-mount latch. A chat window left open beside this
- // page can send the very same link again, and it has to land again.
- it("focuses again when the link is clicked a second time", () => {
- const { replace, scrollIntoView, settleUrl } = renderWithSearch(
- "view=instructions&focus=conversation_starters",
+ expect(screen.getByLabelText("System prompt")).toHaveValue(
+ "Server-side change.",
);
- expect(scrollIntoView).toHaveBeenCalledTimes(1);
-
- act(() => settleUrl("view=instructions"));
- act(() => settleUrl("view=instructions&focus=conversation_starters"));
-
- expect(scrollIntoView).toHaveBeenCalledTimes(2);
- expect(replace).toHaveBeenCalledTimes(2);
- expect(ringed()).not.toBeNull();
});
- // Regression: the same guard is keyed by agent, so navigating between two
- // agent pages on this route does not swallow the second agent's link.
- it("focuses a link aimed at a different agent", () => {
- const other: Agent = { ...baseAgent, id: "agent-2" };
- const { scrollIntoView, settleUrl } = renderWithSearch(
- "view=instructions&focus=conversation_starters",
+ it("keeps submitted edits when an optimistic update rolls back", async () => {
+ let rejectSave!: (reason?: unknown) => void;
+ const onSave = vi.fn(
+ () =>
+ new Promise<void>((_, reject) => {
+ rejectSave = reject;
+ }),
);
- expect(scrollIntoView).toHaveBeenCalledTimes(1);
-
- // The URL still carries focus — it is the NEXT agent's deep link.
- act(() => settleUrl("view=instructions&focus=conversation_starters", other));
-
- expect(scrollIntoView).toHaveBeenCalledTimes(2);
- });
+ const { rerender } = renderWithI18n(tab(baseAgent, onSave));
+ const user = await typeInstructions("Inspect the patch.");
+ await user.click(screen.getByRole("button", { name: "Save" }));
- it("ignores an ordinary visit", () => {
- const { replace, scrollIntoView } = renderWithSearch("view=instructions");
+ rerender(tab({ ...baseAgent, instructions: "Inspect the patch." }, onSave));
+ rerender(tab(baseAgent, onSave));
+ await act(async () => rejectSave(new Error("Update failed")));
- expect(scrollIntoView).not.toHaveBeenCalled();
- expect(replace).not.toHaveBeenCalled();
+ expect(screen.getByLabelText("System prompt")).toHaveValue(
+ "Inspect the patch.",
+ );
});
});
diff --git a/packages/views/agents/components/tabs/instructions-tab.tsx b/packages/views/agents/components/tabs/instructions-tab.tsx
index 868f751b3c..94c800ab60 100644
--- a/packages/views/agents/components/tabs/instructions-tab.tsx
+++ b/packages/views/agents/components/tabs/instructions-tab.tsx
@@ -2,80 +2,34 @@
import { useEffect, useRef, useState } from "react";
import { Loader2, Save } from "lucide-react";
-import { useConfigStore } from "@multica/core/config";
-import { AGENT_FOCUS_CONVERSATION_STARTERS } from "@multica/core/paths";
-import type { Agent, AgentConversationStarter } from "@multica/core/types";
+import type { Agent } from "@multica/core/types";
import { Button } from "@multica/ui/components/ui/button";
import { Textarea } from "@multica/ui/components/ui/textarea";
-import { cn } from "@multica/ui/lib/utils";
+import { ReadonlyContent } from "../../../editor/readonly-content";
import { useT } from "../../../i18n";
-import { useOptionalNavigation } from "../../../navigation";
+import { SettingsViewTabs } from "../../../settings/components/settings-layout";
-import { ConversationStartersEditor } from "../conversation-starters-editor";
-
-/** How long the deep-linked conversation-starters editor stays ringed. */
-const FOCUS_FLASH_MS = 1600;
+type EditorMode = "write" | "preview";
export function InstructionsTab({
agent,
onSave,
onDirtyChange,
- showConversationStarters = true,
}: {
agent: Agent;
- onSave: (updates: {
- instructions: string;
- conversation_starters?: AgentConversationStarter[];
- }) => Promise<void>;
+ onSave: (updates: { instructions: string }) => Promise<void>;
onDirtyChange?: (dirty: boolean) => void;
- /** False for runtimes that never open a chat, where starters do nothing. */
- showConversationStarters?: boolean;
}) {
const { t } = useT("agents");
- // Optional read: this tab is a leaf that tests mount in isolation, and its
- // only navigation-dependent behaviour (the deep-link focus below) degrades
- // to "no highlight" when there is no adapter.
- const navigation = useOptionalNavigation();
- const conversationStartersEnabled = useConfigStore(
- (state) => state.agentConversationStartersSupported,
- );
- const conversationStartersSupported =
- conversationStartersEnabled && showConversationStarters;
const [value, setValue] = useState(agent.instructions ?? "");
- const [conversationStarters, setConversationStarters] = useState<AgentConversationStarter[]>(
- agent.conversation_starters ?? [],
- );
+ const [mode, setMode] = useState<EditorMode>("write");
const [saving, setSaving] = useState(false);
- const [conversationStartersFocused, setConversationStartersFocused] = useState(false);
- const conversationStartersRef = useRef<HTMLDivElement | null>(null);
- const focusHandledForAgentRef = useRef<string | null>(null);
- const focusFlashTimerRef = useRef<ReturnType<typeof setTimeout> | null>(null);
const [systemOpen, setSystemOpen] = useState(false);
- const persistedConversationStartersKey = JSON.stringify(
- agent.conversation_starters ?? [],
- );
- const persistedRef = useRef({
- agentId: agent.id,
- instructions: agent.instructions ?? "",
- conversationStartersKey: persistedConversationStartersKey,
- });
- const localRef = useRef({
- instructions: value,
- conversationStartersKey: JSON.stringify(conversationStarters),
- });
- localRef.current = {
- instructions: value,
- conversationStartersKey: JSON.stringify(conversationStarters),
- };
- const isDirty =
- value !== (agent.instructions ?? "") ||
- (conversationStartersSupported &&
- JSON.stringify(conversationStarters) !== persistedConversationStartersKey);
- const conversationStartersValid =
- !conversationStartersSupported ||
- conversationStarters.every(
- (item) => item.label.trim() && item.prompt.trim(),
- );
+ const persisted = agent.instructions ?? "";
+ const persistedRef = useRef({ agentId: agent.id, instructions: persisted });
+ const localRef = useRef(value);
+ localRef.current = value;
+ const isDirty = value !== persisted;
// A system agent's prompt has two halves: the product half ships with the
// backend and updates on deploy, so it is shown read-only; the editable
@@ -83,93 +37,31 @@ export function InstructionsTab({
// overwrites. Ordinary agents have no system half and render unchanged.
const systemInstructions = agent.system_instructions?.trim() ?? "";
const hasSystemLayer = systemInstructions.length > 0;
+ const fieldLabel = hasSystemLayer
+ ? t(($) => $.tab_body.instructions.workspace_notes_label)
+ : t(($) => $.tab_body.instructions.system_prompt_label);
- // Refetches replace nested arrays even when their contents are unchanged.
- // Compare against the last persisted semantic snapshot so those refetches
- // do not erase local edits. A real server change is adopted only when the
- // local form was clean; switching agents always loads the selected agent.
+ // Refetches can deliver the same instructions again or a newer server copy.
+ // A server change is adopted only when the local editor was clean, so a
+ // refetch never erases an edit; switching agents always loads the selection.
useEffect(() => {
const previous = persistedRef.current;
const switchingAgents = previous.agentId !== agent.id;
- // The parent publishes these fields optimistically while a save is in
+ // The parent publishes the value optimistically while a save is in
// flight. Neither that snapshot nor a later rollback is confirmed server
- // state, so keep the submitted values available for retry on failure.
+ // state, so keep the submitted value available for retry on failure.
if (!switchingAgents && saving) return;
- const local = localRef.current;
- const wasLocallyDirty =
- local.instructions !== previous.instructions ||
- local.conversationStartersKey !== previous.conversationStartersKey;
- const persistedContentsChanged =
- previous.instructions !== (agent.instructions ?? "") ||
- previous.conversationStartersKey !== persistedConversationStartersKey;
-
- persistedRef.current = {
- agentId: agent.id,
- instructions: agent.instructions ?? "",
- conversationStartersKey: persistedConversationStartersKey,
- };
- if (switchingAgents || (!wasLocallyDirty && persistedContentsChanged)) {
- setValue(agent.instructions ?? "");
- setConversationStarters(
- JSON.parse(persistedConversationStartersKey) as AgentConversationStarter[],
- );
- }
- }, [agent.id, agent.instructions, persistedConversationStartersKey, saving]);
-
- // Arriving from "customize" in a chat's empty state: bring the starter
- // prompts into view and flash them, so the deep link lands ON the setting
- // rather than on a long page that happens to contain it. The param is
- // consumed on arrival, so a refresh never replays an animation nobody asked
- // for — but every fresh click must land, including a second one from a chat
- // window still open beside this page, and one aimed at a different agent.
- useEffect(() => {
- if (!navigation || !conversationStartersSupported) return;
-
- if (navigation.searchParams.get("focus") !== AGENT_FOCUS_CONVERSATION_STARTERS) {
- // The param is gone: either this is an ordinary visit, or the `replace`
- // below has landed. Re-arm so the next click focuses again.
- focusHandledForAgentRef.current = null;
- return;
+ const wasLocallyDirty = localRef.current !== previous.instructions;
+ persistedRef.current = { agentId: agent.id, instructions: persisted };
+ if (
+ switchingAgents ||
+ (!wasLocallyDirty && previous.instructions !== persisted)
+ ) {
+ setValue(persisted);
}
- // Guard against re-running before the stripped URL arrives — the adapter
- // object is not referentially stable, so this effect re-runs on renders
- // the `replace` below itself causes. Keyed by agent so a deep link aimed
- // at a DIFFERENT agent is never swallowed by this latch.
- if (focusHandledForAgentRef.current === agent.id) return;
- focusHandledForAgentRef.current = agent.id;
-
- // `block: "nearest"` deliberately: native scrollIntoView scrolls every
- // scrollable ancestor, which on desktop drags the shell itself (#3929).
- conversationStartersRef.current?.scrollIntoView?.({ block: "nearest" });
- setConversationStartersFocused(true);
-
- const params = new URLSearchParams(navigation.searchParams);
- params.delete("focus");
- const query = params.toString();
- navigation.replace(
- query ? `${navigation.pathname}?${query}` : navigation.pathname,
- );
-
- // The timer is held in a ref, NOT returned as this effect's cleanup: the
- // adapter object is unstable, so a cleanup would be invoked on the very
- // next render and cancel the flash before it ever ended, leaving the ring
- // on permanently. Unmount clears it below. A repeat focus restarts the
- // window rather than inheriting the previous one's remaining time.
- if (focusFlashTimerRef.current) clearTimeout(focusFlashTimerRef.current);
- focusFlashTimerRef.current = setTimeout(
- () => setConversationStartersFocused(false),
- FOCUS_FLASH_MS,
- );
- }, [agent.id, navigation, conversationStartersSupported]);
-
- useEffect(
- () => () => {
- if (focusFlashTimerRef.current) clearTimeout(focusFlashTimerRef.current);
- },
- [],
- );
+ }, [agent.id, persisted, saving]);
// Report dirty state up so the parent can guard tab switches.
useEffect(() => {
@@ -179,12 +71,7 @@ export function InstructionsTab({
const handleSave = async () => {
setSaving(true);
try {
- await onSave({
- instructions: value,
- ...(conversationStartersSupported
- ? { conversation_starters: conversationStarters }
- : {}),
- });
+ await onSave({ instructions: value });
} catch {
// toast handled by parent
} finally {
@@ -229,67 +116,90 @@ export function InstructionsTab({
</div>
)}
- <div className="space-y-2">
- <label
- htmlFor={`agent-system-prompt-${agent.id}`}
- className="text-body font-medium"
- >
- {hasSystemLayer
- ? t(($) => $.tab_body.instructions.workspace_notes_label)
- : t(($) => $.tab_body.instructions.system_prompt_label)}
- </label>
- <Textarea
- id={`agent-system-prompt-${agent.id}`}
- name="agent-system-prompt"
- autoComplete="off"
- value={value}
- onChange={(event) => setValue(event.target.value)}
- placeholder={
- hasSystemLayer
- ? t(($) => $.tab_body.instructions.workspace_notes_placeholder)
- : t(($) => $.tab_body.instructions.placeholder)
- }
- rows={18}
- className="min-h-96 resize-y leading-6"
- />
- </div>
-
- {conversationStartersSupported ? (
- <div
- ref={conversationStartersRef}
- className={cn(
- "scroll-mt-4 rounded-lg transition-shadow duration-500",
- conversationStartersFocused && "ring-2 ring-brand/50 ring-offset-2 ring-offset-background",
- )}
- >
- <ConversationStartersEditor
- value={conversationStarters}
- onChange={setConversationStarters}
+ {/* No overflow clipping on the card: the footer is sticky inside the
+ page's scroll container, so Save stays reachable on a long prompt. */}
+ <div className="rounded-xl border bg-card transition-[border-color,box-shadow] has-[textarea:focus-visible]:border-ring has-[textarea:focus-visible]:ring-3 has-[textarea:focus-visible]:ring-ring/50">
+ <div className="flex h-11 items-center gap-3 border-b px-2">
+ {hasSystemLayer ? (
+ <span className="pl-1 text-label font-medium">{fieldLabel}</span>
+ ) : null}
+ <SettingsViewTabs<EditorMode>
+ label={t(($) => $.tab_body.instructions.mode_aria)}
+ items={[
+ { value: "write", label: t(($) => $.tab_body.instructions.mode_write) },
+ { value: "preview", label: t(($) => $.tab_body.instructions.mode_preview) },
+ ]}
+ value={mode}
+ onChange={setMode}
/>
+ <span className="ml-auto pr-1 text-caption tabular-nums text-muted-foreground">
+ {t(($) => $.tab_body.instructions.char_count, {
+ count: [...value].length,
+ })}
+ </span>
</div>
- ) : null}
- <div className="flex items-center justify-end gap-3">
- {isDirty && (
- <span className="text-caption text-muted-foreground">
- {t(($) => $.tab_body.common.unsaved_changes)}
- </span>
+ {mode === "write" ? (
+ <Textarea
+ id={`agent-system-prompt-${agent.id}`}
+ name="agent-system-prompt"
+ autoComplete="off"
+ aria-label={fieldLabel}
+ value={value}
+ onChange={(event) => setValue(event.target.value)}
+ placeholder={
+ hasSystemLayer
+ ? t(($) => $.tab_body.instructions.workspace_notes_placeholder)
+ : t(($) => $.tab_body.instructions.placeholder)
+ }
+ className="min-h-[28rem] resize-none rounded-none border-0 bg-transparent px-4 py-3 font-mono text-label leading-6 shadow-none focus-visible:ring-0 md:text-label dark:bg-transparent"
+ />
+ ) : (
+ <div className="min-h-[28rem] px-4 py-3">
+ {value.trim() ? (
+ <ReadonlyContent content={value} />
+ ) : (
+ <p className="text-body text-muted-foreground">
+ {t(($) => $.tab_body.instructions.preview_empty)}
+ </p>
+ )}
+ </div>
)}
- <Button
- size="sm"
- onClick={handleSave}
- disabled={!isDirty || !conversationStartersValid || saving}
- >
- {saving ? (
- <Loader2
- className="h-3.5 w-3.5 animate-spin motion-reduce:animate-none"
- aria-hidden="true"
- />
- ) : (
- <Save className="h-3.5 w-3.5" aria-hidden="true" />
- )}
- {t(($) => $.tab_body.common.save)}
- </Button>
+
+ <div className="sticky bottom-0 flex min-h-12 items-center gap-2 rounded-b-xl border-t bg-card py-2 pr-2 pl-4">
+ {isDirty ? (
+ <span className="flex min-w-0 items-center gap-2 text-caption text-muted-foreground">
+ <span
+ aria-hidden="true"
+ className="size-1.5 shrink-0 rounded-full bg-warning"
+ />
+ {t(($) => $.tab_body.common.unsaved_changes)}
+ </span>
+ ) : null}
+ <div className="ml-auto flex items-center gap-1.5">
+ {isDirty ? (
+ <Button
+ size="sm"
+ variant="ghost"
+ disabled={saving}
+ onClick={() => setValue(persisted)}
+ >
+ {t(($) => $.tab_body.common.discard)}
+ </Button>
+ ) : null}
+ <Button size="sm" onClick={handleSave} disabled={!isDirty || saving}>
+ {saving ? (
+ <Loader2
+ className="h-3.5 w-3.5 animate-spin motion-reduce:animate-none"
+ aria-hidden="true"
+ />
+ ) : (
+ <Save className="h-3.5 w-3.5" aria-hidden="true" />
+ )}
+ {t(($) => $.tab_body.common.save)}
+ </Button>
+ </div>
+ </div>
</div>
</div>
);
diff --git a/packages/views/agents/components/use-conversation-starters-focus.test.tsx b/packages/views/agents/components/use-conversation-starters-focus.test.tsx
new file mode 100644
index 0000000000..0df56b3897
--- /dev/null
+++ b/packages/views/agents/components/use-conversation-starters-focus.test.tsx
@@ -0,0 +1,157 @@
+// @vitest-environment jsdom
+
+import { StrictMode } from "react";
+import { describe, expect, it, vi } from "vitest";
+import { act, render } from "@testing-library/react";
+import { NavigationProvider } from "../../navigation";
+import type { NavigationAdapter } from "../../navigation";
+import {
+ CONVERSATION_STARTERS_FOCUS_FLASH_MS,
+ useConversationStartersFocus,
+} from "./use-conversation-starters-focus";
+
+function Harness({ agentId }: { agentId: string }) {
+ const { ref, focused } = useConversationStartersFocus(agentId, true);
+ return <div ref={ref} data-focused={focused ? "true" : "false"} />;
+}
+
+// The "customize" link in a chat's empty state lands on General settings with
+// ?focus=. The page must bring the editor into view and then clear the param,
+// so a refresh or a later tab switch does not replay the flash.
+describe("useConversationStartersFocus", () => {
+ // A fresh adapter object per render — what the web platform actually hands
+ // down, and the condition the flash-timer regression below depends on.
+ const adapter = (search: string, replace = vi.fn()): NavigationAdapter => ({
+ push: vi.fn(),
+ replace,
+ back: vi.fn(),
+ pathname: "/acme/agents/agent-1",
+ searchParams: new URLSearchParams(search),
+ hash: "",
+ getShareableUrl: (path: string) => `https://app.test${path}`,
+ });
+
+ function renderWithSearch(search: string) {
+ const replace = vi.fn();
+ const scrollIntoView = vi.fn();
+ // jsdom has no layout, so the method does not exist at all.
+ Element.prototype.scrollIntoView = scrollIntoView;
+ const tree = (value: NavigationAdapter, agentId: string) => (
+ <NavigationProvider value={value}>
+ <Harness agentId={agentId} />
+ </NavigationProvider>
+ );
+ const { rerender, container } = render(tree(adapter(search, replace), "agent-1"));
+ return {
+ replace,
+ scrollIntoView,
+ focused: () =>
+ container.querySelector("[data-focused]")?.getAttribute("data-focused") ===
+ "true",
+ /**
+ * Re-render as the platform does: a new adapter object every time, and
+ * optionally a different agent for an in-place navigation between two
+ * agent pages on the same route.
+ */
+ settleUrl: (next: string, agentId = "agent-1") =>
+ rerender(tree(adapter(next, replace), agentId)),
+ };
+ }
+
+ it("scrolls to the editor and drops the focus param, keeping the view", () => {
+ const { replace, scrollIntoView, focused } = renderWithSearch(
+ "view=general&focus=conversation_starters",
+ );
+
+ expect(scrollIntoView).toHaveBeenCalledWith({ block: "nearest" });
+ expect(replace).toHaveBeenCalledWith("/acme/agents/agent-1?view=general");
+ expect(focused()).toBe(true);
+ });
+
+ // Regression: the flash timer must not hang off the effect's cleanup. The
+ // navigation adapter is not referentially stable, so React would run that
+ // cleanup on the very next render and cancel the timeout, leaving the ring
+ // on the editor permanently.
+ it("ends the flash instead of ringing the editor forever", () => {
+ vi.useFakeTimers();
+ try {
+ const { settleUrl, focused } = renderWithSearch(
+ "view=general&focus=conversation_starters",
+ );
+ expect(focused()).toBe(true);
+
+ act(() => settleUrl("view=general"));
+ act(() => {
+ vi.advanceTimersByTime(CONVERSATION_STARTERS_FOCUS_FLASH_MS + 400);
+ });
+
+ expect(focused()).toBe(false);
+ } finally {
+ vi.useRealTimers();
+ }
+ });
+
+ // Regression: StrictMode replays mount → unmount → mount. The latch keeps
+ // the replay from focusing twice, so the flash timer must not be one the
+ // simulated unmount cancels for good.
+ it("ends the flash under StrictMode", () => {
+ vi.useFakeTimers();
+ try {
+ Element.prototype.scrollIntoView = vi.fn();
+ const { container } = render(
+ <StrictMode>
+ <NavigationProvider value={adapter("view=general&focus=conversation_starters")}>
+ <Harness agentId="agent-1" />
+ </NavigationProvider>
+ </StrictMode>,
+ );
+ const focused = () =>
+ container.querySelector("[data-focused]")?.getAttribute("data-focused");
+ expect(focused()).toBe("true");
+
+ act(() => {
+ vi.advanceTimersByTime(CONVERSATION_STARTERS_FOCUS_FLASH_MS + 400);
+ });
+
+ expect(focused()).toBe("false");
+ } finally {
+ vi.useRealTimers();
+ }
+ });
+
+ // Regression: the guard against re-firing before the stripped URL lands must
+ // not become a one-shot-per-mount latch. A chat window left open beside this
+ // page can send the very same link again, and it has to land again.
+ it("focuses again when the link is clicked a second time", () => {
+ const { replace, scrollIntoView, settleUrl } = renderWithSearch(
+ "view=general&focus=conversation_starters",
+ );
+ expect(scrollIntoView).toHaveBeenCalledTimes(1);
+
+ act(() => settleUrl("view=general"));
+ act(() => settleUrl("view=general&focus=conversation_starters"));
+
+ expect(scrollIntoView).toHaveBeenCalledTimes(2);
+ expect(replace).toHaveBeenCalledTimes(2);
+ });
+
+ // Regression: the same guard is keyed by agent, so navigating between two
+ // agent pages on this route does not swallow the second agent's link.
+ it("focuses a link aimed at a different agent", () => {
+ const { scrollIntoView, settleUrl } = renderWithSearch(
+ "view=general&focus=conversation_starters",
+ );
+ expect(scrollIntoView).toHaveBeenCalledTimes(1);
+
+ act(() => settleUrl("view=general&focus=conversation_starters", "agent-2"));
+
+ expect(scrollIntoView).toHaveBeenCalledTimes(2);
+ });
+
+ it("ignores an ordinary visit", () => {
+ const { replace, scrollIntoView } = renderWithSearch("view=general");
+
+ expect(scrollIntoView).not.toHaveBeenCalled();
+ expect(replace).not.toHaveBeenCalled();
+ });
+});
diff --git a/packages/views/agents/components/use-conversation-starters-focus.ts b/packages/views/agents/components/use-conversation-starters-focus.ts
new file mode 100644
index 0000000000..eefdbb6e6e
--- /dev/null
+++ b/packages/views/agents/components/use-conversation-starters-focus.ts
@@ -0,0 +1,75 @@
+"use client";
+
+import { useEffect, useRef, useState } from "react";
+import { AGENT_FOCUS_CONVERSATION_STARTERS } from "@multica/core/paths";
+import { useOptionalNavigation } from "../../navigation";
+
+/** How long the deep-linked conversation-starters editor stays ringed. */
+export const CONVERSATION_STARTERS_FOCUS_FLASH_MS = 1600;
+
+/**
+ * Arriving from "customize" in a chat's empty state: bring the starter
+ * prompts into view and flash them, so the deep link lands ON the setting
+ * rather than on a long page that happens to contain it. The param is
+ * consumed on arrival, so a refresh never replays an animation nobody asked
+ * for — but every fresh click must land, including a second one from a chat
+ * window still open beside this page, and one aimed at a different agent.
+ *
+ * Navigation is read optionally: the editors that host this are leaves that
+ * tests mount in isolation, and without an adapter there is nothing to focus.
+ */
+export function useConversationStartersFocus(agentId: string, enabled: boolean) {
+ const navigation = useOptionalNavigation();
+ const ref = useRef<HTMLDivElement | null>(null);
+ const [focused, setFocused] = useState(false);
+ // Bumped on every focus so a repeat restarts the flash window instead of
+ // inheriting the previous one's remaining time.
+ const [flashId, setFlashId] = useState(0);
+ const handledForAgentRef = useRef<string | null>(null);
+
+ useEffect(() => {
+ if (!navigation || !enabled) return;
+
+ if (navigation.searchParams.get("focus") !== AGENT_FOCUS_CONVERSATION_STARTERS) {
+ // The param is gone: either this is an ordinary visit, or the `replace`
+ // below has landed. Re-arm so the next click focuses again.
+ handledForAgentRef.current = null;
+ return;
+ }
+ // Guard against re-running before the stripped URL arrives — the adapter
+ // object is not referentially stable, so this effect re-runs on renders
+ // the `replace` below itself causes. Keyed by agent so a deep link aimed
+ // at a DIFFERENT agent is never swallowed by this latch.
+ if (handledForAgentRef.current === agentId) return;
+ handledForAgentRef.current = agentId;
+
+ // `block: "nearest"` deliberately: native scrollIntoView scrolls every
+ // scrollable ancestor, which on desktop drags the shell itself (#3929).
+ ref.current?.scrollIntoView?.({ block: "nearest" });
+ setFocused(true);
+ setFlashId((id) => id + 1);
+
+ const params = new URLSearchParams(navigation.searchParams);
+ params.delete("focus");
+ const query = params.toString();
+ navigation.replace(
+ query ? `${navigation.pathname}?${query}` : navigation.pathname,
+ );
+ }, [agentId, navigation, enabled]);
+
+ // The flash timer must not hang off the effect above: the adapter object is
+ // unstable, so that effect's cleanup runs on the very next render and would
+ // cancel the timer, leaving the ring on permanently. Keyed on the flash
+ // itself, it also survives StrictMode's mount-unmount-mount replay, which
+ // the latch above deliberately does not re-run.
+ useEffect(() => {
+ if (!focused) return;
+ const timer = setTimeout(
+ () => setFocused(false),
+ CONVERSATION_STARTERS_FOCUS_FLASH_MS,
+ );
+ return () => clearTimeout(timer);
+ }, [focused, flashId]);
+
+ return { ref, focused };
+}
diff --git a/packages/views/agents/create/agent-configuration-panel.tsx b/packages/views/agents/create/agent-configuration-panel.tsx
index bfe636e4d7..e23be12d06 100644
--- a/packages/views/agents/create/agent-configuration-panel.tsx
+++ b/packages/views/agents/create/agent-configuration-panel.tsx
@@ -158,6 +158,19 @@ export function AgentConfigurationPanel({
/>
</div>
</DraftFieldRow>
+ {conversationStartersSupported && !qoderRuntime ? (
+ <DraftFieldRow
+ compact={compact}
+ align="start"
+ label={t(($) => $.conversation_starters.label)}
+ description={t(($) => $.conversation_starters.create_hint)}
+ >
+ <ConversationStartersEditor
+ value={draft.conversationStarters}
+ onChange={(value) => set("conversationStarters", value)}
+ />
+ </DraftFieldRow>
+ ) : null}
</SettingsCard>
</SettingsSection>
@@ -184,14 +197,6 @@ export function AgentConfigurationPanel({
className="min-h-44 resize-y font-mono text-label leading-6"
/>
</DraftFieldRow>
- {conversationStartersSupported && !qoderRuntime ? (
- <div className="px-4 py-4">
- <ConversationStartersEditor
- value={draft.conversationStarters}
- onChange={(value) => set("conversationStarters", value)}
- />
- </div>
- ) : null}
{qoderRuntime ? (
<p className="px-4 py-3 text-caption text-muted-foreground">
{t(($) => $.creation_studio.cloud_fields_note)}
@@ -459,12 +464,14 @@ export function AgentExecutionOverrides({
function DraftFieldRow({
label,
+ description,
children,
compact = false,
align = "center",
htmlFor,
}: {
label: string;
+ description?: string;
children: ReactNode;
compact?: boolean;
align?: "center" | "start";
@@ -480,13 +487,20 @@ function DraftFieldRow({
!compact && (align === "center" ? "sm:items-center" : "sm:items-start"),
)}
>
- {htmlFor ? (
- <label htmlFor={htmlFor} className="text-body font-medium">
- {label}
- </label>
- ) : (
- <div className="text-body font-medium">{label}</div>
- )}
+ <div className="min-w-0">
+ {htmlFor ? (
+ <label htmlFor={htmlFor} className="text-body font-medium">
+ {label}
+ </label>
+ ) : (
+ <div className="text-body font-medium">{label}</div>
+ )}
+ {description ? (
+ <p className="mt-0.5 text-caption leading-5 text-muted-foreground">
+ {description}
+ </p>
+ ) : null}
+ </div>
<div className="min-w-0">{children}</div>
</div>
);
diff --git a/packages/views/chat/components/chat-empty-state.test.tsx b/packages/views/chat/components/chat-empty-state.test.tsx
index dfd33846d5..105bb1f9ea 100644
--- a/packages/views/chat/components/chat-empty-state.test.tsx
+++ b/packages/views/chat/components/chat-empty-state.test.tsx
@@ -91,7 +91,7 @@ describe("chat empty-state conversation starters", () => {
describe("chat empty-state customize affordance", () => {
afterEach(cleanup);
- const href = "/acme/agents/agent-1?view=instructions&focus=conversation_starters";
+ const href = "/acme/agents/agent-1?view=general&focus=conversation_starters";
it("links a viewer who may edit the agent to its conversation starters", () => {
renderEmptyState(agent(), href);
diff --git a/packages/views/locales/en/agents.json b/packages/views/locales/en/agents.json
index e6c7072093..51dba7b086 100644
--- a/packages/views/locales/en/agents.json
+++ b/packages/views/locales/en/agents.json
@@ -511,7 +511,7 @@
},
"conversation_starters": {
"label": "Conversation starters",
- "hint": "Up to three. Selecting one fills the composer without sending.",
+ "hint": "Suggested in a new chat with this agent. Picking one fills the composer without sending.",
"add": "Add suggestion",
"item_label": "Suggestion {{number}} label",
"prompt_label": "Suggestion {{number}} prompt",
@@ -519,14 +519,23 @@
"prompt_placeholder": "Review the open pull request, summarize the risks, and recommend next steps.",
"incomplete": "Complete or remove each suggestion before saving.",
"remove": "Remove suggestion {{number}}",
- "preview_label": "Preview of a new chat",
- "preview_defaults": "These are the built-in defaults. Add a suggestion above to replace all three."
+ "preview_label": "New chat preview",
+ "preview_defaults": "These are the built-in suggestions. Add your own to replace all three.",
+ "create_hint": "Optional. Shown in a new chat with this agent.",
+ "edit": "Edit suggestion {{number}}",
+ "remove_short": "Remove",
+ "done": "Done",
+ "untitled": "Untitled suggestion",
+ "customize": "Customize",
+ "defaults_summary_one": "Using {{count}} built-in suggestion",
+ "defaults_summary_other": "Using {{count}} built-in suggestions"
},
"tab_body": {
"common": {
"save": "Save",
"add": "Add",
- "unsaved_changes": "Unsaved changes"
+ "unsaved_changes": "Unsaved changes",
+ "discard": "Discard"
},
"instructions": {
"intro": "Set the system prompt used for every run. Markdown is supported.",
@@ -538,7 +547,13 @@
"system_layer_hide": "Hide",
"workspace_notes_label": "Workspace notes",
"workspace_notes_intro": "Add your team's context and preferences below. They apply on top of the instructions Multica maintains for this agent. Markdown is supported.",
- "workspace_notes_placeholder": "Add context this agent should always have.\n\n# Example\nOur main repository is github.com/acme/platform.\nWrite issues in English even when we chat in Chinese.\nWe do not deploy on Fridays."
+ "workspace_notes_placeholder": "Add context this agent should always have.\n\n# Example\nOur main repository is github.com/acme/platform.\nWrite issues in English even when we chat in Chinese.\nWe do not deploy on Fridays.",
+ "mode_aria": "Editor mode",
+ "mode_write": "Write",
+ "mode_preview": "Preview",
+ "preview_empty": "Nothing to preview yet.",
+ "char_count_one": "{{count}} character",
+ "char_count_other": "{{count}} characters"
},
"env": {
"intro_readonly": "Injected into the agent process at launch. Only workspace owners and admins can read or edit values; every reveal and edit is recorded in the workspace audit log.",
diff --git a/packages/views/locales/fr/agents.json b/packages/views/locales/fr/agents.json
index 4b97dac166..b764e8800c 100644
--- a/packages/views/locales/fr/agents.json
+++ b/packages/views/locales/fr/agents.json
@@ -511,7 +511,7 @@
},
"conversation_starters": {
"label": "Amorces de conversation",
- "hint": "Trois au maximum. En choisir une remplit le champ de saisie sans envoyer le message.",
+ "hint": "Proposées dans une nouvelle discussion avec cet agent. En choisir une remplit le champ de saisie sans envoyer le message.",
"add": "Ajouter une suggestion",
"item_label": "Libellé de la suggestion {{number}}",
"prompt_label": "Prompt de la suggestion {{number}}",
@@ -520,13 +520,22 @@
"incomplete": "Complétez ou supprimez chaque suggestion avant d'enregistrer.",
"remove": "Supprimer la suggestion {{number}}",
"preview_label": "Aperçu d'une nouvelle discussion",
- "preview_defaults": "Voici les suggestions par défaut. Ajoutez une suggestion ci-dessus pour remplacer les trois."
+ "preview_defaults": "Voici les suggestions intégrées. Ajoutez les vôtres pour remplacer les trois.",
+ "create_hint": "Facultatif. Affichées dans une nouvelle discussion avec cet agent.",
+ "edit": "Modifier la suggestion {{number}}",
+ "remove_short": "Supprimer",
+ "done": "Terminé",
+ "untitled": "Suggestion sans titre",
+ "customize": "Personnaliser",
+ "defaults_summary_one": "{{count}} suggestion intégrée utilisée",
+ "defaults_summary_other": "{{count}} suggestions intégrées utilisées"
},
"tab_body": {
"common": {
"save": "Enregistrer",
"add": "Ajouter",
- "unsaved_changes": "Modifications non enregistrées"
+ "unsaved_changes": "Modifications non enregistrées",
+ "discard": "Annuler les modifications"
},
"instructions": {
"intro": "Définissez le prompt système utilisé à chaque exécution. Markdown est pris en charge.",
@@ -538,7 +547,13 @@
"system_layer_hide": "Masquer",
"workspace_notes_label": "Notes de l'espace de travail",
"workspace_notes_intro": "Ajoutez ci-dessous le contexte et les préférences de votre équipe. Ils s'appliquent par-dessus les instructions que Multica maintient pour cet agent. Le Markdown est pris en charge.",
- "workspace_notes_placeholder": "Ajoutez le contexte que cet agent doit toujours avoir.\n\n# Exemple\nNotre dépôt principal est github.com/acme/platform.\nRédige les tâches en anglais même quand nous discutons en français.\nNous ne déployons pas le vendredi."
+ "workspace_notes_placeholder": "Ajoutez le contexte que cet agent doit toujours avoir.\n\n# Exemple\nNotre dépôt principal est github.com/acme/platform.\nRédige les tâches en anglais même quand nous discutons en français.\nNous ne déployons pas le vendredi.",
+ "mode_aria": "Mode de l'éditeur",
+ "mode_write": "Écrire",
+ "mode_preview": "Aperçu",
+ "preview_empty": "Rien à prévisualiser pour l'instant.",
+ "char_count_one": "{{count}} caractère",
+ "char_count_other": "{{count}} caractères"
},
"env": {
"intro_readonly": "Injectées dans le processus de l'agent au lancement. Seuls les propriétaires et administrateurs de l'espace de travail peuvent lire ou modifier les valeurs ; chaque affichage et chaque modification sont consignés dans le journal d'audit de l'espace de travail.",
diff --git a/packages/views/locales/ja/agents.json b/packages/views/locales/ja/agents.json
index 7e3c78c6eb..3efea69f11 100644
--- a/packages/views/locales/ja/agents.json
+++ b/packages/views/locales/ja/agents.json
@@ -334,7 +334,7 @@
},
"conversation_starters": {
"label": "会話の開始例",
- "hint": "最大3件。選択すると入力欄に入り、送信はされません。",
+ "hint": "このエージェントとの新しいチャットに表示されます。選択すると入力欄に入り、送信はされません。",
"add": "候補を追加",
"item_label": "候補 {{number}} のラベル",
"prompt_label": "候補 {{number}} のプロンプト",
@@ -343,13 +343,21 @@
"incomplete": "各候補を完成させるか削除してから保存してください。",
"remove": "候補 {{number}} を削除",
"preview_label": "新しいチャットのプレビュー",
- "preview_defaults": "これは組み込みの初期値です。上で候補を1件追加すると3件すべて置き換わります。"
+ "preview_defaults": "これは組み込みの候補です。独自の候補を追加すると3件すべて置き換わります。",
+ "create_hint": "任意。このエージェントとの新しいチャットに表示されます。",
+ "edit": "候補 {{number}} を編集",
+ "remove_short": "削除",
+ "done": "完了",
+ "untitled": "無題の候補",
+ "customize": "カスタマイズ",
+ "defaults_summary_other": "組み込みの候補 {{count}} 件を使用中"
},
"tab_body": {
"common": {
"save": "保存",
"add": "追加",
- "unsaved_changes": "保存していない変更"
+ "unsaved_changes": "保存していない変更",
+ "discard": "破棄"
},
"instructions": {
"intro": "すべての実行で使用する System Prompt を設定します。Markdown に対応しています。",
@@ -361,7 +369,12 @@
"system_layer_hide": "隠す",
"workspace_notes_label": "ワークスペースの補足",
"workspace_notes_intro": "チームのコンテキストや好みを下に追加してください。Multica がこのエージェント向けに管理している指示の上に適用されます。Markdown が使えます。",
- "workspace_notes_placeholder": "このエージェントが常に知っておくべきことを書きます。\n\n# 例\nメインリポジトリは github.com/acme/platform です。\nチャットが日本語でも、タスクは英語で書いてください。\n金曜日はデプロイしません。"
+ "workspace_notes_placeholder": "このエージェントが常に知っておくべきことを書きます。\n\n# 例\nメインリポジトリは github.com/acme/platform です。\nチャットが日本語でも、タスクは英語で書いてください。\n金曜日はデプロイしません。",
+ "mode_aria": "エディターモード",
+ "mode_write": "編集",
+ "mode_preview": "プレビュー",
+ "preview_empty": "プレビューする内容がまだありません。",
+ "char_count_other": "{{count}} 文字"
},
"env": {
"intro_readonly": "エージェントプロセスの起動時に注入されます。値の読み取りや編集ができるのはワークスペースのオーナーと admin のみで、すべての表示と編集はワークスペースの監査ログに記録されます。",
diff --git a/packages/views/locales/ko/agents.json b/packages/views/locales/ko/agents.json
index be79ac1442..7b4bfdd69f 100644
--- a/packages/views/locales/ko/agents.json
+++ b/packages/views/locales/ko/agents.json
@@ -342,7 +342,7 @@
},
"conversation_starters": {
"label": "대화 시작 예시",
- "hint": "최대 3개입니다. 선택하면 입력란에 채워지며 전송되지 않습니다.",
+ "hint": "이 에이전트와 새 채팅을 시작하면 표시됩니다. 선택하면 입력란에 채워지며 전송되지 않습니다.",
"add": "추천 추가",
"item_label": "추천 {{number}} 라벨",
"prompt_label": "추천 {{number}} 프롬프트",
@@ -351,13 +351,21 @@
"incomplete": "각 제안을 완성하거나 삭제한 후 저장하세요.",
"remove": "추천 {{number}} 삭제",
"preview_label": "새 채팅 미리보기",
- "preview_defaults": "지금은 기본 예시입니다. 위에서 하나를 추가하면 세 개 모두 교체됩니다."
+ "preview_defaults": "지금은 기본 추천입니다. 직접 추가하면 세 개 모두 교체됩니다.",
+ "create_hint": "선택 사항입니다. 이 에이전트와의 새 채팅에 표시됩니다.",
+ "edit": "추천 {{number}} 편집",
+ "remove_short": "삭제",
+ "done": "완료",
+ "untitled": "제목 없는 추천",
+ "customize": "사용자 지정",
+ "defaults_summary_other": "기본 추천 {{count}}개 사용 중"
},
"tab_body": {
"common": {
"save": "저장",
"add": "추가",
- "unsaved_changes": "저장하지 않은 변경사항"
+ "unsaved_changes": "저장하지 않은 변경사항",
+ "discard": "변경 취소"
},
"instructions": {
"intro": "모든 실행에 사용할 System Prompt를 설정하세요. Markdown을 지원합니다.",
@@ -369,7 +377,12 @@
"system_layer_hide": "접기",
"workspace_notes_label": "워크스페이스 메모",
"workspace_notes_intro": "팀의 컨텍스트와 선호를 아래에 추가하세요. Multica가 이 에이전트를 위해 관리하는 지침 위에 적용됩니다. Markdown을 지원합니다.",
- "workspace_notes_placeholder": "이 에이전트가 항상 알아야 할 내용을 적으세요.\n\n# 예시\n메인 저장소는 github.com/acme/platform입니다.\n채팅은 한국어로 해도 태스크는 영어로 작성하세요.\n금요일에는 배포하지 않습니다."
+ "workspace_notes_placeholder": "이 에이전트가 항상 알아야 할 내용을 적으세요.\n\n# 예시\n메인 저장소는 github.com/acme/platform입니다.\n채팅은 한국어로 해도 태스크는 영어로 작성하세요.\n금요일에는 배포하지 않습니다.",
+ "mode_aria": "편집 모드",
+ "mode_write": "작성",
+ "mode_preview": "미리보기",
+ "preview_empty": "아직 미리 볼 내용이 없습니다.",
+ "char_count_other": "{{count}}자"
},
"env": {
"intro_readonly": "에이전트 프로세스가 시작될 때 주입됩니다. 워크스페이스 소유자와 관리자만 값을 읽거나 수정할 수 있으며, 모든 공개와 수정은 워크스페이스 감사 로그에 기록됩니다.",
diff --git a/packages/views/locales/zh-Hans/agents.json b/packages/views/locales/zh-Hans/agents.json
index cacbcc9d01..303d0d059c 100644
--- a/packages/views/locales/zh-Hans/agents.json
+++ b/packages/views/locales/zh-Hans/agents.json
@@ -497,7 +497,7 @@
},
"conversation_starters": {
"label": "对话开场建议",
- "hint": "最多三条。点击后填入输入框,不会发送。",
+ "hint": "新建对话时显示。点击后填入输入框,不会发送。",
"add": "添加建议",
"item_label": "建议 {{number}} 的标题",
"prompt_label": "建议 {{number}} 的提示词",
@@ -506,13 +506,21 @@
"incomplete": "请填写完整或移除每条建议后再保存。",
"remove": "移除建议 {{number}}",
"preview_label": "新对话预览",
- "preview_defaults": "以上是内置的默认值。在上方添加一条建议即可整组替换。"
+ "preview_defaults": "以上是内置建议。添加你自己的建议即可整组替换。",
+ "create_hint": "可选。新建与这个智能体的对话时显示。",
+ "edit": "编辑建议 {{number}}",
+ "remove_short": "移除",
+ "done": "完成",
+ "untitled": "未命名建议",
+ "customize": "自定义",
+ "defaults_summary_other": "正在使用 {{count}} 条内置建议"
},
"tab_body": {
"common": {
"save": "保存",
"add": "添加",
- "unsaved_changes": "未保存的修改"
+ "unsaved_changes": "未保存的修改",
+ "discard": "放弃修改"
},
"instructions": {
"intro": "设置每次运行都会使用的 System Prompt,支持 Markdown。",
@@ -524,7 +532,12 @@
"system_layer_hide": "收起",
"workspace_notes_label": "工作区补充",
"workspace_notes_intro": "在下面补充你们团队的上下文和偏好,它们会叠加在 Multica 为这个智能体维护的指令之上。支持 Markdown。",
- "workspace_notes_placeholder": "写下这个智能体应该始终知道的上下文。\n\n# 示例\n我们的主仓库是 github.com/acme/platform。\n即使聊天用中文,任务也一律用英文写。\n周五不部署。"
+ "workspace_notes_placeholder": "写下这个智能体应该始终知道的上下文。\n\n# 示例\n我们的主仓库是 github.com/acme/platform。\n即使聊天用中文,任务也一律用英文写。\n周五不部署。",
+ "mode_aria": "编辑模式",
+ "mode_write": "编辑",
+ "mode_preview": "预览",
+ "preview_empty": "还没有可预览的内容。",
+ "char_count_other": "{{count}} 个字符"
},
"env": {
"intro_readonly": "在智能体进程启动时注入。只有工作区所有者 / 管理员可以查看或编辑值;每次解锁和编辑都会写入工作区审计日志。",