Skip to content

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

Go

feat(docs): overhaul interactive demos with native-medium split (MUL-9976) (#11384)

Jiayuan Zhange1cc97721af5
diff --git a/apps/docs/app/global.css b/apps/docs/app/global.css
index 7082164ce5..c3f6aef4c2 100644
--- a/apps/docs/app/global.css
+++ b/apps/docs/app/global.css
@@ -185,60 +185,6 @@ html[lang="zh-Hant"] {
--color-fd-diff-add-symbol: rgb(10, 200, 100);
}
-/* Interactive demos: the pulse around the control a reader should use next. */
-@keyframes demo-halo {
- from {
- box-shadow: 0 0 0 0 color-mix(in oklab, var(--brand) 45%, transparent);
- }
- to {
- box-shadow: 0 0 0 10px color-mix(in oklab, var(--brand) 0%, transparent);
- }
-}
-
-.demo-halo {
- animation: demo-halo 1.4s ease-out infinite;
-}
-
-/* The coach-mark arrow nudges toward the control it points at. */
-@keyframes demo-nudge {
- 50% {
- translate: var(--demo-nudge);
- }
-}
-
-.demo-nudge-top,
-.demo-nudge-bottom,
-.demo-nudge-left,
-.demo-nudge-right {
- animation: demo-nudge 1s ease-in-out infinite;
-}
-
-.demo-nudge-top {
- --demo-nudge: 0 3px;
-}
-
-.demo-nudge-bottom {
- --demo-nudge: 0 -3px;
-}
-
-.demo-nudge-left {
- --demo-nudge: 3px 0;
-}
-
-.demo-nudge-right {
- --demo-nudge: -3px 0;
-}
-
-@media (prefers-reduced-motion: reduce) {
- .demo-halo,
- .demo-nudge-top,
- .demo-nudge-bottom,
- .demo-nudge-left,
- .demo-nudge-right {
- animation: none;
- }
-}
-
/* Sidebar uses dedicated --sidebar-* tokens so it sits a hair off the main
* canvas. Fumadocs renders it as #nd-sidebar (desktop) and
* #nd-sidebar-mobile (mobile drawer); both IDs need the override. */
diff --git a/apps/docs/components/demos/agent-access-demo.tsx b/apps/docs/components/demos/agent-access-demo.tsx
index 2b7d69008c..0fb4d748f8 100644
--- a/apps/docs/components/demos/agent-access-demo.tsx
+++ b/apps/docs/components/demos/agent-access-demo.tsx
@@ -1,380 +1,223 @@
"use client";
import { useState } from "react";
-import { ArrowLeft, Check, Globe, Lock, Minus, Users } from "@multica/ui/icons";
-import { Button } from "@multica/ui/components/ui/button";
+import { Check, Globe, Lock, Minus, Users } from "@multica/ui/icons";
import { cn } from "@multica/ui/lib/utils";
-import { CoachMark, DemoAvatar, DemoFrame, useDemoCopy, useStartWhenVisible } from "./demo-kit";
-import { useDocsLocale } from "@/components/locale-link";
-import { demoChromeCopy } from "@/lib/translations";
+import { EditorialUtility, useDemoCopy } from "./demo-kit";
-type Scope = "private" | "workspace" | "members";
-type Person = { name: string; owner: boolean };
+type Scope = "private" | "members" | "workspace";
-const SCOPES: Scope[] = ["private", "workspace", "members"];
-const SCOPE_ICON = { private: Lock, workspace: Globe, members: Users } as const;
+const SCOPES: Scope[] = ["private", "members", "workspace"];
+const SCOPE_ICON = { private: Lock, members: Users, workspace: Globe } as const;
const copy = {
en: {
- title: "Ops helper · Access",
- sectionTitle: "Who can run this agent",
+ title: "Agent Access scopes compared",
scopes: {
- private: { title: "Only me", desc: "Only you can run this agent" },
- workspace: { title: "Entire workspace", desc: "All workspace members can run this agent" },
- members: { title: "Specific people", desc: "You and the people you pick can run this agent" },
+ private: { title: "Only me", desc: "Only the agent owner can assign, @mention, or chat with it." },
+ members: { title: "Specific people", desc: "The owner plus explicitly chosen workspace members." },
+ workspace: { title: "Entire workspace", desc: "Every member of the workspace can invoke this agent." },
} as Record<Scope, { title: string; desc: string }>,
- targetRequired: "Select at least one person before saving.",
- save: "Save",
- effectTitle: "What each member sees",
- pickerCol: "Assignee picker",
- mentionCol: "@mention",
- ownerBadge: "Agent owner",
- memberBadge: "Member",
- canPick: "Can pick",
- canMention: "Starts a run",
+ cols: { member: "Member", picker: "Assignee picker", mention: "@mention & Chat" },
+ rows: [
+ { name: "Agent owner", role: "Owner", allow: { private: true, members: true, workspace: true } },
+ { name: "Selected teammate", role: "In allowlist", allow: { private: false, members: true, workspace: true } },
+ { name: "Other workspace member", role: "Member", allow: { private: false, members: false, workspace: true } },
+ ],
+ canUse: "Available",
+ canRun: "Starts run",
hidden: "Not listed",
- people: [
- { name: "You", owner: true },
- { name: "Lei Li", owner: false },
- { name: "Meimei Han", owner: false },
- ] as Person[],
- captions: {
- idle: "You own Ops helper, and right now only you can run it.",
- pickWorkspace: "Lei Li and Meimei Han can't see Ops helper at all. Pick Entire workspace to open it to every member.",
- saveWorkspace: "Choosing a scope only changes the draft; nothing applies until you save. Click Save.",
- pickMembers: "Saved: every member can now assign Ops helper and @mention it. Next, narrow it with Specific people.",
- checkMember: "Specific people needs at least one person before it can be saved. Check Lei Li.",
- saveMembers: "You're always included as the owner. Click Save.",
- done: "Only you and Lei Li can run Ops helper now; Meimei Han no longer sees it. Use Replay to start over.",
- },
+ note: "Workspace owners and admins can manage an agent's settings, but viewing never bypasses Access to start a run.",
},
zh: {
- title: "运营助手 · 访问权限",
- sectionTitle: "谁可以运行该智能体",
+ title: "智能体 Access 三档权限对照",
scopes: {
- private: { title: "仅自己", desc: "只有你可以运行该智能体" },
- workspace: { title: "整个工作区", desc: "默认允许工作区内所有成员运行该智能体" },
- members: { title: "指定成员", desc: "你和所选成员可以运行该智能体" },
+ private: { title: "仅自己", desc: "只有智能体 owner 可以分配、@提及或与之对话。" },
+ members: { title: "指定成员", desc: "owner 和名单中的指定成员可以调用。" },
+ workspace: { title: "整个工作区", desc: "工作区内所有成员均可调用该智能体。" },
} as Record<Scope, { title: string; desc: string }>,
- targetRequired: "保存前,请至少选择一名成员。",
- save: "保存",
- effectTitle: "每位成员看到的",
- pickerCol: "负责人选择器",
- mentionCol: "@提及",
- ownerBadge: "智能体 owner",
- memberBadge: "普通成员",
- canPick: "可以选择",
- canMention: "触发运行",
- hidden: "看不到",
- people: [
- { name: "你", owner: true },
- { name: "李雷", owner: false },
- { name: "韩梅梅", owner: false },
- ] as Person[],
- captions: {
- idle: "运营助手 的 owner 是你,现在只有你能运行它。",
- pickWorkspace: "李雷和韩梅梅完全看不到运营助手。选择\"整个工作区\",把它开放给所有成员。",
- saveWorkspace: "选中某一档只改了草稿,保存后才生效。点击保存。",
- pickMembers: "已保存:所有成员都能把任务分配给运营助手,也能 @它。接下来用\"指定成员\"收窄范围。",
- checkMember: "\"指定成员\"至少要选一个人才能保存。勾选李雷。",
- saveMembers: "你是 owner,始终可以运行,不用勾选自己。点击保存。",
- done: "现在只有你和李雷能运行运营助手,韩梅梅看不到它了。点右上角可以重新演示。",
- },
+ cols: { member: "成员身份", picker: "负责人选择器", mention: "@提及与对话" },
+ rows: [
+ { name: "智能体 owner", role: "始终允许", allow: { private: true, members: true, workspace: true } },
+ { name: "名单内成员", role: "已授权", allow: { private: false, members: true, workspace: true } },
+ { name: "其他工作区成员", role: "普通成员", allow: { private: false, members: false, workspace: true } },
+ ],
+ canUse: "可选",
+ canRun: "可启动运行",
+ hidden: "不可见",
+ note: "工作区 owner 和 admin 可以管理配置,但「看得到」不代表可以绕过 Access 启动运行。",
+ },
+ "zh-Hant": {
+ title: "智能體 Access 三檔權限對照",
+ scopes: {
+ private: { title: "僅自己", desc: "只有智能體 owner 可以指派、@提及或與之對話。" },
+ members: { title: "指定成員", desc: "owner 和名單中的指定成員可以呼叫。" },
+ workspace: { title: "整個工作區", desc: "工作區內所有成員均可呼叫該智能體。" },
+ } as Record<Scope, { title: string; desc: string }>,
+ cols: { member: "成員身分", picker: "負責人選擇器", mention: "@提及與對話" },
+ rows: [
+ { name: "智能體 owner", role: "始終允許", allow: { private: true, members: true, workspace: true } },
+ { name: "名單內成員", role: "已授權", allow: { private: false, members: true, workspace: true } },
+ { name: "其他工作區成員", role: "一般成員", allow: { private: false, members: false, workspace: true } },
+ ],
+ canUse: "可選",
+ canRun: "可啟動執行",
+ hidden: "不可見",
+ note: "工作區 owner 和 admin 可以管理設定,但「看得到」不代表可以繞過 Access 啟動執行。",
},
ja: {
- title: "運用アシスタント · アクセス",
- sectionTitle: "このエージェントを実行できるユーザー",
+ title: "エージェントのアクセス範囲の比較",
scopes: {
- private: { title: "プライベート", desc: "あなただけがこのエージェントを実行できます" },
- workspace: { title: "ワークスペースに公開", desc: "このワークスペースの全員がこのエージェントを実行できます" },
- members: { title: "特定のメンバーに公開", desc: "あなたと選択した人がこのエージェントを実行できます" },
+ private: { title: "自分のみ", desc: "オーナーだけが割り当て、@メンション、チャットを実行できます。" },
+ members: { title: "特定のメンバー", desc: "オーナーと選択したメンバーが実行できます。" },
+ workspace: { title: "ワークスペース全体", desc: "ワークスペースの全メンバーが実行できます。" },
} as Record<Scope, { title: string; desc: string }>,
- targetRequired: "保存する前に、ワークスペースまたは1人以上のメンバーを選択してください。",
- save: "保存",
- effectTitle: "各メンバーに見える内容",
- pickerCol: "担当者の選択",
- mentionCol: "@メンション",
- ownerBadge: "エージェントのオーナー",
- memberBadge: "メンバー",
- canPick: "選択できる",
- canMention: "実行が始まる",
- hidden: "表示されない",
- people: [
- { name: "あなた", owner: true },
- { name: "李雷", owner: false },
- { name: "韓梅梅", owner: false },
- ] as Person[],
- captions: {
- idle: "運用アシスタントのオーナーはあなたで、今はあなたしか実行できません。",
- pickWorkspace: "李雷と韓梅梅には運用アシスタントがまったく見えていません。「ワークスペースに公開」を選んで、全メンバーに開放します。",
- saveWorkspace: "選んだだけでは下書きが変わるだけで、保存するまで反映されません。「保存」をクリックします。",
- pickMembers: "保存しました。全メンバーが運用アシスタントにタスクを割り当て、@メンションできます。次は「特定のメンバーに公開」で範囲を絞ります。",
- checkMember: "「特定のメンバーに公開」は 1 人以上選ばないと保存できません。李雷にチェックを入れます。",
- saveMembers: "オーナーのあなたは常に実行できるので、自分を選ぶ必要はありません。「保存」をクリックします。",
- done: "運用アシスタントを実行できるのはあなたと李雷だけになり、韓梅梅には表示されなくなりました。「もう一度」で最初から見られます。",
- },
+ cols: { member: "メンバー", picker: "担当者選択", mention: "@メンション・チャット" },
+ rows: [
+ { name: "エージェントオーナー", role: "常に許可", allow: { private: true, members: true, workspace: true } },
+ { name: "許可リストのメンバー", role: "指定済み", allow: { private: false, members: true, workspace: true } },
+ { name: "その他のメンバー", role: "メンバー", allow: { private: false, members: false, workspace: true } },
+ ],
+ canUse: "選択可能",
+ canRun: "実行を開始",
+ hidden: "非表示",
+ note: "ワークスペースのオーナーや管理者でも、アクセス許可なしに実行を開始することはできません。",
},
ko: {
- title: "운영 도우미 · 접근 권한",
- sectionTitle: "이 에이전트를 실행할 수 있는 사용자",
+ title: "에이전트 접근 범위 비교",
scopes: {
- private: { title: "비공개", desc: "나만 이 에이전트를 실행할 수 있습니다" },
- workspace: { title: "워크스페이스에 공개", desc: "이 워크스페이스의 모든 사람이 이 에이전트를 실행할 수 있습니다" },
- members: { title: "특정 사용자에게 공개", desc: "나와 선택한 사람이 이 에이전트를 실행할 수 있습니다" },
+ private: { title: "나만 사용", desc: "에이전트 소유자만 할당, @멘션, 채팅할 수 있습니다." },
+ members: { title: "특정 멤버", desc: "소유자와 선택한 멤버만 실행할 수 있습니다." },
+ workspace: { title: "전체 워크스페이스", desc: "워크스페이스의 모든 멤버가 실행할 수 있습니다." },
} as Record<Scope, { title: string; desc: string }>,
- targetRequired: "저장하기 전에 워크스페이스 또는 한 명 이상의 사용자를 선택하세요.",
- save: "저장",
- effectTitle: "멤버별로 보이는 결과",
- pickerCol: "담당자 선택",
- mentionCol: "@멘션",
- ownerBadge: "에이전트 소유자",
- memberBadge: "멤버",
- canPick: "선택 가능",
- canMention: "실행 시작",
+ cols: { member: "멤버", picker: "담당자 선택", mention: "@멘션 및 채팅" },
+ rows: [
+ { name: "에이전트 소유자", role: "항상 허용", allow: { private: true, members: true, workspace: true } },
+ { name: "지정된 멤버", role: "허용 목록", allow: { private: false, members: true, workspace: true } },
+ { name: "기타 워크스페이스 멤버", role: "멤버", allow: { private: false, members: false, workspace: true } },
+ ],
+ canUse: "선택 가능",
+ canRun: "실행 시작",
hidden: "표시 안 됨",
- people: [
- { name: "나", owner: true },
- { name: "리레이", owner: false },
- { name: "한메이메이", owner: false },
- ] as Person[],
- captions: {
- idle: "운영 도우미의 소유자는 나이고, 지금은 나만 실행할 수 있습니다.",
- pickWorkspace: "리레이와 한메이메이에게는 운영 도우미가 아예 보이지 않습니다. 워크스페이스에 공개를 골라 모든 멤버에게 엽니다.",
- saveWorkspace: "범위를 고르기만 하면 초안만 바뀌고, 저장해야 적용됩니다. 저장을 클릭하세요.",
- pickMembers: "저장했습니다. 이제 모든 멤버가 운영 도우미에게 태스크를 할당하고 @멘션할 수 있습니다. 다음으로 특정 사용자에게 공개로 범위를 좁힙니다.",
- checkMember: "특정 사용자에게 공개는 한 명 이상 골라야 저장할 수 있습니다. 리레이를 체크하세요.",
- saveMembers: "소유자인 나는 항상 실행할 수 있으니 나를 따로 고를 필요는 없습니다. 저장을 클릭하세요.",
- done: "이제 운영 도우미는 나와 리레이만 실행할 수 있고, 한메이메이에게는 보이지 않습니다. 다시 보기를 누르면 처음부터 볼 수 있습니다.",
- },
+ note: "워크스페이스 소유자와 관리자도 접근 권한 없이 실행을 시작할 수 없습니다.",
},
fr: {
- title: "Assistant ops · Accès",
- sectionTitle: "Qui peut exécuter cet agent",
+ title: "Comparaison des niveaux d'accès d'un agent",
scopes: {
- private: { title: "Moi uniquement", desc: "Vous seul pouvez exécuter cet agent" },
- workspace: { title: "Tout l'espace de travail", desc: "Tous les membres de l'espace de travail peuvent exécuter cet agent" },
- members: { title: "Personnes précises", desc: "Vous et les personnes que vous choisissez pouvez exécuter cet agent" },
+ private: { title: "Moi uniquement", desc: "Seul le propriétaire de l'agent peut l'assigner ou le @mentionner." },
+ members: { title: "Membres choisis", desc: "Le propriétaire et les membres sélectionnés." },
+ workspace: { title: "Tout l'espace de travail", desc: "Tous les membres de l'espace de travail peuvent l'utiliser." },
} as Record<Scope, { title: string; desc: string }>,
- targetRequired: "Sélectionnez au moins une personne avant d'enregistrer.",
- save: "Enregistrer",
- effectTitle: "Ce que voit chaque membre",
- pickerCol: "Sélecteur d'assigné",
- mentionCol: "@mention",
- ownerBadge: "Propriétaire de l'agent",
- memberBadge: "Membre",
- canPick: "Peut le choisir",
- canMention: "Lance une exécution",
- hidden: "Absent de la liste",
- people: [
- { name: "Vous", owner: true },
- { name: "Lei Li", owner: false },
- { name: "Meimei Han", owner: false },
- ] as Person[],
- captions: {
- idle: "Vous êtes propriétaire d'Assistant ops, et pour l'instant vous seul pouvez l'exécuter.",
- pickWorkspace: "Lei Li et Meimei Han ne voient pas du tout Assistant ops. Choisissez Tout l'espace de travail pour l'ouvrir à tous les membres.",
- saveWorkspace: "Choisir une option ne modifie que le brouillon ; rien ne s'applique avant l'enregistrement. Cliquez sur Enregistrer.",
- pickMembers: "Enregistré : tous les membres peuvent maintenant assigner Assistant ops et le @mentionner. Restreignez ensuite avec Personnes précises.",
- checkMember: "Personnes précises exige au moins une personne pour pouvoir enregistrer. Cochez Lei Li.",
- saveMembers: "En tant que propriétaire, vous êtes toujours inclus. Cliquez sur Enregistrer.",
- done: "Seuls vous et Lei Li pouvez désormais exécuter Assistant ops ; Meimei Han ne le voit plus. Cliquez sur Rejouer pour recommencer.",
- },
+ cols: { member: "Membre", picker: "Sélecteur d'assigné", mention: "@mention & discussion" },
+ rows: [
+ { name: "Propriétaire de l'agent", role: "Toujours autorisé", allow: { private: true, members: true, workspace: true } },
+ { name: "Membre sélectionné", role: "Autorisé", allow: { private: false, members: true, workspace: true } },
+ { name: "Autre membre", role: "Membre", allow: { private: false, members: false, workspace: true } },
+ ],
+ canUse: "Disponible",
+ canRun: "Démarre",
+ hidden: "Masqué",
+ note: "Voir un agent en tant qu'admin ne contourne jamais son niveau d'accès pour lancer une exécution.",
},
};
-type Phase = "pickWorkspace" | "saveWorkspace" | "pickMembers" | "checkMember" | "saveMembers" | "done";
-
-// The reader walks one fixed path — Only me → Entire workspace → Specific
-// people with Lei Li — so the only enabled control is the next one on it.
export function AgentAccessDemo() {
const t = useDemoCopy(copy);
- const [frameRef, visible] = useStartWhenVisible<HTMLElement>();
- const [phase, setPhase] = useState<Phase>("pickWorkspace");
-
- const saved: Scope = phase === "pickWorkspace" || phase === "saveWorkspace"
- ? "private"
- : phase === "done"
- ? "members"
- : "workspace";
- const draft: Scope = phase === "pickWorkspace"
- ? "private"
- : phase === "saveWorkspace" || phase === "pickMembers"
- ? "workspace"
- : "members";
- const leiChecked = phase === "saveMembers" || phase === "done";
-
- // Mirrors the invoke gate: the owner always passes; otherwise a workspace
- // grant admits every member and a member grant only the people listed. A
- // regular member who can't run an agent doesn't get it in the list at all.
- const canRun = (person: Person, index: number) =>
- person.owner || saved === "workspace" || (saved === "members" && index === 1);
-
- const nextScope: Scope | null = phase === "pickWorkspace" ? "workspace" : phase === "pickMembers" ? "members" : null;
- const canSave = phase === "saveWorkspace" || phase === "saveMembers";
-
- const replay = () => setPhase("pickWorkspace");
-
- const shown = visible;
- const caption = shown ? t.captions[phase] : t.captions.idle;
+ const [scope, setScope] = useState<Scope>("private");
return (
- <DemoFrame frameRef={frameRef} title={t.title} caption={caption} onReplay={replay}>
- <div className="grid gap-4 p-4 sm:grid-cols-[minmax(0,1.1fr)_minmax(0,1fr)]">
- <fieldset className="min-w-0 overflow-hidden rounded-lg border bg-background">
- <legend className="sr-only">{t.sectionTitle}</legend>
- <div className="border-b px-3 py-2 text-label font-medium">{t.sectionTitle}</div>
- <div className="divide-y">
- {SCOPES.map((scope) => {
- const Icon = SCOPE_ICON[scope];
- const selected = draft === scope;
- const enabled = shown && nextScope === scope;
- return (
- <CoachMark quiet key={scope} active={enabled} ringClassName="rounded-md" className="flex w-full">
- <button
- type="button"
- role="radio"
- aria-checked={selected}
- disabled={!enabled}
- onClick={() => setPhase(scope === "workspace" ? "saveWorkspace" : "checkMember")}
- className="flex w-full items-start gap-2.5 px-3 py-2.5 text-left transition-colors hover:bg-muted/60 disabled:hover:bg-transparent"
- >
- <span
- aria-hidden
- className={cn(
- "mt-1.5 flex size-3.5 shrink-0 items-center justify-center rounded-full border",
- selected ? "border-foreground" : "border-muted-foreground/50",
- )}
- >
- {selected && <span className="size-1.5 rounded-full bg-foreground" />}
- </span>
- <span className="flex size-7 shrink-0 items-center justify-center rounded-full bg-muted text-muted-foreground">
- <Icon aria-hidden className="size-3.5" />
- </span>
- <span className="min-w-0 flex-1">
- <span className="flex flex-wrap items-baseline gap-x-2">
- <span className="text-body font-medium">{t.scopes[scope].title}</span>
- {enabled && (
- <InlineHint />
- )}
- </span>
- <span className="block text-caption text-muted-foreground">{t.scopes[scope].desc}</span>
- </span>
- </button>
- </CoachMark>
- );
- })}
- </div>
-
- {draft === "members" && (
- <div className="border-t bg-muted/30 px-3 py-3 motion-safe:animate-in motion-safe:fade-in">
- <div className="divide-y rounded-md border bg-background">
- {t.people
- .filter((person) => !person.owner)
- .map((person, i) => {
- const checked = i === 0 && leiChecked;
- const enabled = i === 0 && phase === "checkMember";
- return (
- <CoachMark quiet key={person.name} active={enabled} ringClassName="rounded-md" className="flex w-full">
- <button
- type="button"
- role="checkbox"
- aria-checked={checked}
- disabled={!enabled}
- onClick={() => setPhase("saveMembers")}
- className="flex w-full items-center gap-2.5 px-2.5 py-2 text-left text-body hover:bg-muted/60 disabled:hover:bg-transparent"
- >
- <span
- aria-hidden
- className={cn(
- "flex size-4 shrink-0 items-center justify-center rounded-sm border",
- checked ? "border-foreground bg-foreground text-background" : "border-muted-foreground/50",
- )}
- >
- {checked && <Check className="size-3" />}
- </span>
- <DemoAvatar name={person.name} />
- <span className="truncate">{person.name}</span>
- {enabled && <InlineHint />}
- </button>
- </CoachMark>
- );
- })}
- </div>
- {!leiChecked && (
- <p role="alert" className="mt-2 text-caption text-destructive">
- {t.targetRequired}
- </p>
- )}
- </div>
- )}
-
- <div className="flex justify-end border-t px-3 py-2.5">
- <CoachMark active={shown && canSave} side="left" ringClassName="rounded-md">
- <Button
+ <EditorialUtility title={t.title}>
+ <div className="flex flex-col gap-4">
+ <div role="tablist" aria-label={t.title} className="grid gap-2 sm:grid-cols-3">
+ {SCOPES.map((s) => {
+ const Icon = SCOPE_ICON[s];
+ const active = scope === s;
+ return (
+ <button
+ key={s}
type="button"
- size="sm"
- disabled={!shown || !canSave}
- onClick={() => setPhase(phase === "saveWorkspace" ? "pickMembers" : "done")}
+ role="tab"
+ aria-selected={active}
+ onClick={() => setScope(s)}
+ className={cn(
+ "flex flex-col gap-1 rounded-[4px] border px-3 py-2.5 text-left transition-colors focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-ring",
+ active
+ ? "border-[var(--primary)] bg-accent"
+ : "border-border bg-card hover:border-[var(--docs-rule)]",
+ )}
>
- {t.save}
- </Button>
- </CoachMark>
- </div>
- </fieldset>
-
- <div className="min-w-0">
- <div className="mb-2 text-caption text-muted-foreground">{t.effectTitle}</div>
- <ul className="flex flex-col gap-2">
- {t.people.map((person, i) => {
- const allowed = canRun(person, i);
- return (
- <li key={person.name} className="block rounded-lg border bg-background px-3 py-2">
- <div className="flex items-center gap-2">
- <DemoAvatar name={person.name} />
- <span className="text-label font-medium">{person.name}</span>
- <span className="rounded-xs bg-muted px-1 text-micro text-muted-foreground">
- {person.owner ? t.ownerBadge : t.memberBadge}
- </span>
- </div>
- <dl
- key={`${saved}-${allowed}`}
- className="mt-1.5 grid grid-cols-[auto_1fr] gap-x-3 gap-y-0.5 pl-7 text-caption motion-safe:animate-in motion-safe:fade-in"
- >
- <dt className="text-muted-foreground">{t.pickerCol}</dt>
- <dd><Verdict ok={allowed}>{allowed ? t.canPick : t.hidden}</Verdict></dd>
- <dt className="text-muted-foreground">{t.mentionCol}</dt>
- <dd><Verdict ok={allowed}>{allowed ? t.canMention : t.hidden}</Verdict></dd>
- </dl>
- </li>
- );
- })}
- </ul>
+ <span className="flex items-center gap-1.5 text-[0.84375rem] font-medium text-foreground">
+ <Icon
+ aria-hidden
+ className={cn("size-3.5", active ? "text-[var(--primary)]" : "text-muted-foreground")}
+ />
+ {t.scopes[s].title}
+ </span>
+ <span className="text-[0.75rem] leading-[1.45] text-muted-foreground">
+ {t.scopes[s].desc}
+ </span>
+ </button>
+ );
+ })}
</div>
- </div>
- </DemoFrame>
- );
-}
-/** The coach-mark hint, placed inside the row so it never covers a neighbour. */
-function InlineHint() {
- const lang = useDocsLocale();
- return (
- <span aria-hidden className="inline-flex items-center gap-0.5 text-caption font-medium text-brand motion-safe:animate-in motion-safe:fade-in">
- <ArrowLeft className="demo-nudge-right size-3.5 shrink-0" />
- {demoChromeCopy[lang].click}
- </span>
- );
-}
+ <div className="overflow-x-auto">
+ <table className="w-full border-collapse text-[0.84375rem]">
+ <thead>
+ <tr className="border-b border-border text-left font-mono text-[0.6875rem] uppercase tracking-[0.06em] text-muted-foreground">
+ <th className="py-2 pr-4 font-semibold">{t.cols.member}</th>
+ <th className="py-2 pr-4 font-semibold">{t.cols.picker}</th>
+ <th className="py-2 font-semibold">{t.cols.mention}</th>
+ </tr>
+ </thead>
+ <tbody>
+ {t.rows.map((row) => {
+ const ok = row.allow[scope];
+ return (
+ <tr key={row.name} className="border-b border-border last:border-b-0">
+ <td className="py-2.5 pr-4">
+ <span className="font-medium text-foreground">{row.name}</span>
+ <span className="ml-2 font-mono text-[0.7rem] text-muted-foreground">{row.role}</span>
+ </td>
+ <td className="py-2.5 pr-4">
+ <span
+ className={cn(
+ "inline-flex items-center gap-1.5 text-[0.8125rem]",
+ ok ? "font-medium text-foreground" : "text-muted-foreground",
+ )}
+ >
+ {ok ? (
+ <Check aria-hidden className="size-3.5 text-success" />
+ ) : (
+ <Minus aria-hidden className="size-3.5 opacity-50" />
+ )}
+ {ok ? t.canUse : t.hidden}
+ </span>
+ </td>
+ <td className="py-2.5">
+ <span
+ className={cn(
+ "inline-flex items-center gap-1.5 text-[0.8125rem]",
+ ok ? "font-medium text-foreground" : "text-muted-foreground",
+ )}
+ >
+ {ok ? (
+ <Check aria-hidden className="size-3.5 text-success" />
+ ) : (
+ <Minus aria-hidden className="size-3.5 opacity-50" />
+ )}
+ {ok ? t.canRun : t.hidden}
+ </span>
+ </td>
+ </tr>
+ );
+ })}
+ </tbody>
+ </table>
+ </div>
-function Verdict({ ok, children }: { ok: boolean; children: string }) {
- return (
- <span className={cn("inline-flex items-center gap-1", ok ? "text-foreground" : "text-muted-foreground")}>
- {ok ? (
- <Check aria-hidden className="size-3.5 shrink-0 text-success" />
- ) : (
- <Minus aria-hidden className="size-3.5 shrink-0" />
- )}
- {children}
- </span>
+ <p className="text-[0.8125rem] leading-[1.5] text-muted-foreground">{t.note}</p>
+ </div>
+ </EditorialUtility>
);
}
diff --git a/apps/docs/components/demos/assign-demo.tsx b/apps/docs/components/demos/assign-demo.tsx
index 6ca823cc67..63722cc490 100644
--- a/apps/docs/components/demos/assign-demo.tsx
+++ b/apps/docs/components/demos/assign-demo.tsx
@@ -1,424 +1,47 @@
"use client";
-import { useState } from "react";
-import { ChevronDown, X } from "@multica/ui/icons";
-import { Button } from "@multica/ui/components/ui/button";
-import { cn } from "@multica/ui/lib/utils";
-import {
- CoachMark,
- DemoAvatar,
- DemoComment,
- DemoFrame,
- DemoRun,
- DemoStep,
- useDemoCopy,
- useDemoTimers,
- useStartWhenVisible,
-} from "./demo-kit";
-
-type Candidate = { name: string; agent: boolean };
-type Status = "todo" | "in_progress" | "in_review";
+import { CLIP_MANIFEST } from "./clip-manifest";
+import { EditorialClip, useDemoCopy } from "./demo-kit";
const copy = {
en: {
- title: "OPS-14 · Put together the new-hire onboarding checklist",
- statusLabel: "Status",
- assigneeLabel: "Assignee",
- unassigned: "Unassigned",
- status: { todo: "Todo", in_progress: "In Progress", in_review: "In Review" } as Record<Status, string>,
- agentsGroup: "Agents",
- membersGroup: "Members",
- candidates: [
- { name: "Ops helper", agent: true },
- { name: "Writing helper", agent: true },
- { name: "You", agent: false },
- { name: "Lei Li", agent: false },
- ] as Candidate[],
- confirmTitle: "Confirm assignment?",
- confirmBody: (name: string) => `Assign this issue to ${name}. They'll start right away if the run conditions are met.`,
- close: "Close",
- dontStart: "Don't start yet",
- confirm: "Confirm assignment",
- queued: "Queued",
- running: "Running",
- completed: "Completed",
- steps: [
- "Read the issue description and discussion",
- "Set the status to In Progress",
- "Collect the onboarding items from IT, admin and HR",
- "Arrange them by first day and first week",
- "Set the status to In Review",
- ],
- reply: "The onboarding checklist is ready: 18 items grouped by first day and first week. Please review.",
- captions: {
- idle: "An issue with no assignee yet.",
- start: "Hand the whole issue to an agent: click Assignee.",
- pick: "Pick an agent. Choosing a member only changes the assignee.",
- confirm: "The confirmation names who will start. Confirm to start now, or keep the assignee without starting.",
- member: "Assigned to a member: the assignee changed, and no AI coding tool was called.",
- parked: "The agent is the assignee now, but no run was created. It starts once you ask it to.",
- running: "A run was created. The agent moves the issue to In Progress as it starts.",
- done: "Delivered: the agent moved the issue to In Review. Use Replay to try another path.",
- },
+ title: "Assign an issue to an agent",
+ chapters: ["Pick agent", "Confirm start", "Live run", "Delivered"],
+ caption: "Assigning an agent opens a confirmation dialog, moves the issue to In Progress during execution, and lands in In Review with the reply.",
},
zh: {
- title: "OPS-14 · 整理新员工入职清单",
- statusLabel: "状态",
- assigneeLabel: "负责人",
- unassigned: "未分配",
- status: { todo: "待办", in_progress: "进行中", in_review: "审核中" } as Record<Status, string>,
- agentsGroup: "智能体",
- membersGroup: "成员",
- candidates: [
- { name: "运营助手", agent: true },
- { name: "文案助手", agent: true },
- { name: "你", agent: false },
- { name: "李雷", agent: false },
- ] as Candidate[],
- confirmTitle: "确认指派?",
- confirmBody: (name: string) => `将这个任务指派给 ${name};符合运行条件时会立即开始处理。`,
- close: "关闭",
- dontStart: "暂不开始",
- confirm: "确认指派",
- queued: "排队中",
- running: "运行中",
- completed: "已完成",
- steps: [
- "读取任务描述和讨论",
- "把状态改为 进行中",
- "汇总 IT、行政、人事三方的入职事项",
- "按入职第一天、第一周排好顺序",
- "把状态改为 审核中",
- ],
- reply: "入职清单已整理好:按第一天和第一周分组,共 18 项,请检查。",
- captions: {
- idle: "一条还没有负责人的任务。",
- start: "把整条任务交给智能体:点击负责人。",
- pick: "选择一个智能体。选择成员只会改变负责人。",
- confirm: "确认窗写明了谁会开始工作。确认后立即开始;暂不开始只保存负责人。",
- member: "负责人改成了成员:只改变负责人,不会调用 AI 编程工具。",
- parked: "负责人已经是智能体,但这次没有创建运行;之后向它提出要求时才会开始。",
- running: "已创建运行。智能体开始工作时把任务改为进行中。",
- done: "交付完成,智能体把任务改为审核中。点右上角可以换一条路径再试。",
- },
+ title: "将任务分配给智能体",
+ chapters: ["选择智能体", "确认启动", "实时运行", "交付审核"],
+ caption: "选择智能体后会弹出确认窗口;开始执行时状态自动推进为进行中,交付后移至审核中并写回评论。",
+ },
+ "zh-Hant": {
+ title: "將任務指派給智能體",
+ chapters: ["選擇智能體", "確認啟動", "即時執行", "交付審核"],
+ caption: "選擇智能體後會彈出確認視窗;執行時狀態自動推進為進行中,交付後移至審核中並寫回評論。",
},
ja: {
- title: "OPS-14 · 新入社員のオンボーディングチェックリストを作る",
- statusLabel: "ステータス",
- assigneeLabel: "担当者",
- unassigned: "未割り当て",
- status: { todo: "未着手", in_progress: "進行中", in_review: "レビュー中" } as Record<Status, string>,
- agentsGroup: "エージェント",
- membersGroup: "メンバー",
- candidates: [
- { name: "運用アシスタント", agent: true },
- { name: "ライティングアシスタント", agent: true },
- { name: "あなた", agent: false },
- { name: "李雷", agent: false },
- ] as Candidate[],
- confirmTitle: "割り当てを確認しますか?",
- confirmBody: (name: string) =>
- `このタスクを ${name} に割り当てます。実行条件を満たす場合はすぐに作業を開始します。`,
- close: "閉じる",
- dontStart: "まだ開始しない",
- confirm: "割り当てを確認",
- queued: "待機中",
- running: "実行中",
- completed: "完了",
- steps: [
- "タスクの説明とコメントを読む",
- "ステータスを 進行中 に変更",
- "IT・総務・人事からオンボーディングの項目を集める",
- "初日と最初の 1 週間に分けて並べる",
- "ステータスを レビュー中 に変更",
- ],
- reply: "オンボーディングチェックリストができました。初日と最初の 1 週間に分けて全 18 項目です。確認をお願いします。",
- captions: {
- idle: "まだ担当者のいないタスクです。",
- start: "タスクをまるごとエージェントに任せます。担当者をクリックします。",
- pick: "エージェントを選びます。メンバーを選ぶと担当者が変わるだけです。",
- confirm:
- "確認ダイアログに、誰が作業を始めるかが書かれています。確認するとすぐに始まり、「まだ開始しない」なら担当者だけを保存します。",
- member: "担当者がメンバーに変わりました。変わったのは担当者だけで、AI コーディングツールは呼び出されていません。",
- parked: "担当者はエージェントになりましたが、今回は実行が作成されていません。あとで依頼したときに作業を始めます。",
- running: "実行が作成されました。エージェントは作業を始めるときにタスクを 進行中 にします。",
- done: "納品されました。エージェントがタスクを レビュー中 に移しました。「もう一度」で別の流れも試せます。",
- },
+ title: "タスクをエージェントに割り当てる",
+ chapters: ["エージェント選択", "開始を確認", "実行中", "納品・レビュー中"],
+ caption: "エージェントを選ぶと確認ダイアログが開き、実行中は進行中、完了後はレビュー中へ自動で移ります。",
},
ko: {
- title: "OPS-14 · 신입 사원 온보딩 체크리스트 정리",
- statusLabel: "상태",
- assigneeLabel: "담당자",
- unassigned: "담당자 없음",
- status: { todo: "할 일", in_progress: "진행 중", in_review: "리뷰 중" } as Record<Status, string>,
- agentsGroup: "에이전트",
- membersGroup: "멤버",
- candidates: [
- { name: "운영 도우미", agent: true },
- { name: "글쓰기 도우미", agent: true },
- { name: "나", agent: false },
- { name: "리레이", agent: false },
- ] as Candidate[],
- confirmTitle: "할당을 확인할까요?",
- confirmBody: (name: string) => `이 태스크를 ${name}에게 할당합니다. 실행 조건을 충족하면 바로 시작합니다.`,
- close: "닫기",
- dontStart: "아직 시작 안 함",
- confirm: "할당 확인",
- queued: "대기 중",
- running: "실행 중",
- completed: "완료됨",
- steps: [
- "태스크 설명과 댓글 읽기",
- "상태를 진행 중으로 변경",
- "IT·총무·인사팀의 온보딩 항목 모으기",
- "첫날과 첫 주 기준으로 순서 정리",
- "상태를 리뷰 중으로 변경",
- ],
- reply: "온보딩 체크리스트를 정리했습니다. 첫날과 첫 주로 나눠 모두 18개 항목입니다. 확인해 주세요.",
- captions: {
- idle: "아직 담당자가 없는 태스크입니다.",
- start: "태스크 전체를 에이전트에게 맡기려면 담당자를 클릭하세요.",
- pick: "에이전트를 선택하세요. 멤버를 선택하면 담당자만 바뀝니다.",
- confirm:
- "확인 창에 누가 작업을 시작하는지 나옵니다. 확인하면 바로 시작하고, '아직 시작 안 함'을 고르면 담당자만 저장합니다.",
- member: "담당자가 멤버로 바뀌었습니다. 담당자만 바뀌고 AI 코딩 도구는 호출되지 않았습니다.",
- parked: "담당자는 이제 에이전트지만 이번에는 실행이 만들어지지 않았습니다. 나중에 요청하면 그때 시작합니다.",
- running: "실행이 만들어졌습니다. 에이전트가 작업을 시작하면서 태스크를 진행 중으로 바꿉니다.",
- done: "전달 완료: 에이전트가 태스크를 리뷰 중으로 옮겼습니다. '다시 보기'로 다른 경로도 해 보세요.",
- },
+ title: "태스크를 에이전트에게 할당하기",
+ chapters: ["에이전트 선택", "시작 확인", "실행 중", "전달 완료"],
+ caption: "에이전트를 선택하면 확인 창이 열리고, 작업 중에는 진행 중으로, 전달 후에는 리뷰 중으로 이동합니다.",
},
fr: {
- title: "OPS-14 · Préparer la checklist d'intégration des nouveaux arrivants",
- statusLabel: "Statut",
- assigneeLabel: "Assigné à",
- unassigned: "Non assigné",
- status: { todo: "À faire", in_progress: "En cours", in_review: "En relecture" } as Record<Status, string>,
- agentsGroup: "Agents",
- membersGroup: "Membres",
- candidates: [
- { name: "Assistant ops", agent: true },
- { name: "Assistant rédaction", agent: true },
- { name: "Vous", agent: false },
- { name: "Lei Li", agent: false },
- ] as Candidate[],
- confirmTitle: "Confirmer l'assignation ?",
- confirmBody: (name: string) =>
- `Assigner cette tâche à ${name}. Le travail démarrera immédiatement si les conditions d'exécution sont réunies.`,
- close: "Fermer",
- dontStart: "Ne pas démarrer maintenant",
- confirm: "Confirmer l'assignation",
- queued: "En file d'attente",
- running: "En cours",
- completed: "Terminée",
- steps: [
- "Lire la description et la discussion de la tâche",
- "Passer le statut à En cours",
- "Rassembler les points d'intégration de l'IT, des services généraux et des RH",
- "Les classer entre premier jour et première semaine",
- "Passer le statut à En relecture",
- ],
- reply:
- "La checklist d'intégration est prête : 18 points répartis entre le premier jour et la première semaine. Merci de la relire.",
- captions: {
- idle: "Une tâche qui n'a pas encore d'assigné.",
- start: "Confiez toute la tâche à un agent : cliquez sur Assigné à.",
- pick: "Choisissez un agent. Choisir un membre change seulement l'assigné.",
- confirm:
- "La confirmation indique qui va démarrer. Confirmez pour démarrer maintenant, ou gardez l'assigné sans démarrer.",
- member: "Assignée à un membre : seul l'assigné a changé, aucun outil de codage IA n'a été appelé.",
- parked: "L'agent est maintenant l'assigné, mais aucune exécution n'a été créée. Il démarrera quand vous le lui demanderez.",
- running: "Une exécution a été créée. L'agent passe la tâche à En cours en démarrant.",
- done: "Livré : l'agent a passé la tâche à En relecture. Utilisez Rejouer pour essayer un autre chemin.",
- },
+ title: "Assigner une tâche à un agent",
+ chapters: ["Choisir l'agent", "Confirmer", "En cours", "Livré"],
+ caption: "Assigner un agent ouvre une confirmation, passe la tâche à En cours pendant l'exécution, puis à En relecture.",
},
};
-type Phase = "idle" | "start" | "pick" | "confirm" | "member" | "parked" | "running" | "done";
-
-// Index of the step at which the agent updates the issue status.
-const STATUS_STEPS: Partial<Record<number, Status>> = { 2: "in_progress", 5: "in_review" };
-
-const statusDot: Record<Status, string> = {
- todo: "border-muted-foreground",
- in_progress: "border-warning bg-warning/40",
- in_review: "border-brand bg-brand/40",
-};
-
export function AssignDemo() {
const t = useDemoCopy(copy);
- const { after, clear } = useDemoTimers();
- const [frameRef, visible] = useStartWhenVisible<HTMLElement>();
- const [phase, setPhase] = useState<Phase>("start");
- const [assignee, setAssignee] = useState<Candidate | null>(null);
- const [status, setStatus] = useState<Status>("todo");
- const [queued, setQueued] = useState(true);
- const [stepsShown, setStepsShown] = useState(0);
-
- const shownPhase: Phase = visible ? phase : "idle";
-
- const pick = (candidate: Candidate) => {
- setAssignee(candidate);
- setPhase(candidate.agent ? "confirm" : "member");
- };
-
- const confirm = () => {
- setPhase("running");
- after(1000, () => setQueued(false));
- t.steps.forEach((_, i) =>
- after(1000 + i * 1000, () => {
- setStepsShown(i + 1);
- const next = STATUS_STEPS[i + 1];
- if (next) setStatus(next);
- }),
- );
- after(1000 + t.steps.length * 1000 + 600, () => setPhase("done"));
- };
-
- const replay = () => {
- clear();
- setPhase("start");
- setAssignee(null);
- setStatus("todo");
- setQueued(true);
- setStepsShown(0);
- };
-
- const runActive = phase === "running";
- const showRun = (phase === "running" || phase === "done") && assignee;
-
- return (
- <DemoFrame frameRef={frameRef} title={t.title} caption={t.captions[shownPhase]} onReplay={replay}>
- <div className="relative flex min-h-80 flex-col gap-3 p-4">
- <dl className="grid w-fit grid-cols-[auto_auto] items-center gap-x-6 gap-y-2 text-body">
- <dt className="text-caption text-muted-foreground">{t.statusLabel}</dt>
- <dd className="flex items-center gap-1.5">
- <span aria-hidden className={cn("size-3 rounded-full border-2 transition-colors", statusDot[status])} />
- <span key={status} className="motion-safe:animate-in motion-safe:fade-in">
- {t.status[status]}
- </span>
- </dd>
- <dt className="text-caption text-muted-foreground">{t.assigneeLabel}</dt>
- <dd className="relative">
- <CoachMark active={shownPhase === "start"} side="right" ringClassName="rounded-md">
- <button
- type="button"
- aria-haspopup="listbox"
- aria-expanded={phase === "pick"}
- disabled={!visible || (phase !== "start" && phase !== "pick")}
- onClick={() => setPhase(phase === "pick" ? "start" : "pick")}
- className="-mx-1.5 inline-flex h-7 items-center gap-1.5 rounded-md px-1.5 hover:bg-muted disabled:hover:bg-transparent"
- >
- {assignee ? (
- <>
- <DemoAvatar name={assignee.name} agent={assignee.agent} />
- {assignee.name}
- </>
- ) : (
- <span className="text-muted-foreground">{t.unassigned}</span>
- )}
- {(phase === "start" || phase === "pick") && (
- <ChevronDown aria-hidden className="size-3.5 text-muted-foreground" />
- )}
- </button>
- </CoachMark>
- {phase === "pick" && (
- <div
- role="listbox"
- aria-label={t.assigneeLabel}
- className="absolute top-full left-0 z-10 mt-1 w-52 rounded-lg border bg-popover p-1 text-popover-foreground shadow-md motion-safe:animate-in motion-safe:fade-in"
- >
- {[true, false].map((isAgent) => (
- <div key={String(isAgent)}>
- <div className="px-2 pt-1 pb-0.5 text-micro text-muted-foreground">
- {isAgent ? t.agentsGroup : t.membersGroup}
- </div>
- {t.candidates
- .filter((c) => c.agent === isAgent)
- .map((candidate, i) => (
- <CoachMark
- key={candidate.name}
- active={isAgent && i === 0}
- side="right"
- ringClassName="rounded-md"
- className="flex w-full"
- >
- <button
- type="button"
- role="option"
- aria-selected={false}
- onClick={() => pick(candidate)}
- className="flex w-full items-center gap-2 rounded-md px-2 py-1.5 text-left text-body hover:bg-accent"
- >
- <DemoAvatar name={candidate.name} agent={candidate.agent} />
- {candidate.name}
- </button>
- </CoachMark>
- ))}
- </div>
- ))}
- </div>
- )}
- </dd>
- </dl>
-
- {showRun && (
- <DemoRun
- agent={assignee.name}
- status={phase === "done" ? t.completed : queued ? t.queued : t.running}
- active={runActive}
- >
- {t.steps.slice(0, stepsShown).map((step, i) => (
- <DemoStep key={step} state={i === stepsShown - 1 && runActive ? "running" : "done"}>
- {step}
- </DemoStep>
- ))}
- </DemoRun>
- )}
-
- {phase === "done" && assignee && (
- <DemoComment author={assignee.name} agent>
- {t.reply}
- </DemoComment>
- )}
-
- {phase === "confirm" && assignee && (
- <div className="absolute inset-0 z-20 flex items-center justify-center bg-background/60 p-4 backdrop-blur-[2px] motion-safe:animate-in motion-safe:fade-in">
- <div
- role="dialog"
- aria-modal="false"
- aria-labelledby="assign-demo-title"
- className="w-full max-w-sm rounded-xl border bg-popover text-popover-foreground shadow-lg motion-safe:animate-in motion-safe:zoom-in-95"
- >
- <div className="flex items-start gap-2 p-4 pb-3">
- <div className="min-w-0 flex-1">
- <div id="assign-demo-title" className="text-title-sm font-medium">
- {t.confirmTitle}
- </div>
- <div className="mt-1 text-body text-muted-foreground">{t.confirmBody(assignee.name)}</div>
- </div>
- <button
- type="button"
- aria-label={t.close}
- onClick={replay}
- className="rounded-md p-1 text-muted-foreground hover:bg-muted"
- >
- <X className="size-4" />
- </button>
- </div>
- <div className="flex justify-end gap-2 rounded-b-xl border-t bg-muted/40 px-4 py-3">
- <Button type="button" variant="outline" size="sm" onClick={() => setPhase("parked")}>
- {t.dontStart}
- </Button>
- <CoachMark active side="bottom" align="end" ringClassName="rounded-lg">
- <Button type="button" size="sm" onClick={confirm}>
- {t.confirm}
- </Button>
- </CoachMark>
- </div>
- </div>
- </div>
- )}
- </div>
- </DemoFrame>
- );
+ const meta = CLIP_MANIFEST.assign ?? { duration: 7.5, chapters: [] };
+ const chapters = t.chapters.map((label, i) => ({
+ label,
+ at: meta.chapters[i]?.at ?? (i * meta.duration) / t.chapters.length,
+ }));
+ return <EditorialClip slug="assign" title={t.title} chapters={chapters} duration={meta.duration} caption={t.caption} />;
}
diff --git a/apps/docs/components/demos/autopilot-demo.tsx b/apps/docs/components/demos/autopilot-demo.tsx
index f9e6f189c2..c64e7c5df7 100644
--- a/apps/docs/components/demos/autopilot-demo.tsx
+++ b/apps/docs/components/demos/autopilot-demo.tsx
@@ -1,515 +1,47 @@
"use client";
-import { useEffect, useState } from "react";
-import { CheckCircle2, Clock, FastForward, Loader2, Pencil, Play } from "@multica/ui/icons";
-import { Button } from "@multica/ui/components/ui/button";
-import { cn } from "@multica/ui/lib/utils";
-import {
- CoachMark,
- DemoAvatar,
- DemoComment,
- DemoFrame,
- DemoRun,
- DemoStep,
- useDemoCopy,
- useDemoTimers,
- useStartWhenVisible,
-} from "./demo-kit";
-
-type IssueStatus = "todo" | "in_progress" | "in_review";
-type Source = "manual" | "schedule";
+import { CLIP_MANIFEST } from "./clip-manifest";
+import { EditorialClip, useDemoCopy } from "./demo-kit";
const copy = {
en: {
- title: "Autopilot · Weekly customer feedback roundup",
- breadcrumb: "Autopilot",
- name: "Weekly customer feedback roundup",
- active: "Active",
- edit: "Edit",
- runNow: "Run now",
- running: "Running...",
- toast: "Autopilot triggered",
- properties: "Properties",
- agentLabel: "Agent",
- agent: "Ops helper",
- modeLabel: "Output Mode",
- mode: "Create Issue",
- triggers: "Triggers",
- schedule: "Schedule",
- scheduleText: "09:00 · Mon (Asia/Shanghai)",
- cron: "0 9 * * 1",
- nextBefore: "Next: Oct 26, 09:00",
- nextAfter: "Next: Nov 2, 09:00",
- fastForward: "Skip ahead to Monday 09:00",
- history: "Run History",
- noRuns: "No runs yet. Click \"Run now\" to trigger manually.",
- runStatus: { created: "Issue Created", completed: "Completed" },
- source: { manual: "Manual", schedule: "Schedule" } as Record<Source, string>,
- issueLinked: "Issue linked",
- runTime: { manual: "Oct 24, 15:42", schedule: "Oct 26, 09:00" } as Record<Source, string>,
- issueTitle: "OPS-31 · Weekly customer feedback roundup",
- statusLabel: "Status",
- issueStatus: { todo: "Todo", in_progress: "In Progress", in_review: "In Review" } as Record<IssueStatus, string>,
- assigneeLabel: "Assignee",
- queued: "Queued",
- workingStatus: "Running",
- completed: "Completed",
- steps: [
- "Read the issue description and discussion",
- "Set the status to In Progress",
- "Collect last week's support tickets, survey answers and app reviews",
- "Group them by problem type and count each group",
- "Write a one-page weekly report",
- "Set the status to In Review",
- ],
- reply:
- "Last week's feedback is in: 64 items in five groups. Slow delivery is up the most, with 21 mentions. The one-page report is ready; please review.",
- captions: {
- idle: "An autopilot that runs every Monday at 09:00 and creates an issue each time.",
- ready: "Click \"Run now\" to run the whole flow once. Or skip ahead to Monday 09:00 to watch the schedule fire.",
- triggering: "Triggering the autopilot...",
- created: {
- manual: "The autopilot created issue OPS-31 and assigned it to Ops helper. Run History records a manual run.",
- schedule: "Monday 09:00 arrived and the schedule fired: the autopilot created issue OPS-31 and assigned it to Ops helper.",
- } as Record<Source, string>,
- running: "Ops helper follows the runbook and reports progress on the issue.",
- done: "The issue moved to In Review, so this autopilot run is marked Completed. Use Replay to try the other trigger.",
- },
+ title: "Run recurring work with Autopilots",
+ chapters: ["Autopilot list", "Schedule & runbook", "Run now"],
+ caption: "Autopilots trigger on a cron schedule or webhook, and can also be tested immediately with Run now.",
},
zh: {
- title: "自动化 · 每周客户反馈整理",
- breadcrumb: "自动化",
- name: "每周客户反馈整理",
- active: "启用",
- edit: "编辑",
- runNow: "立即运行",
- running: "运行中...",
- toast: "已触发自动化",
- properties: "属性",
- agentLabel: "智能体",
- agent: "运营助手",
- modeLabel: "输出模式",
- mode: "创建任务",
- triggers: "触发器",
- schedule: "时间表",
- scheduleText: "09:00 · 周一 (Asia/Shanghai)",
- cron: "0 9 * * 1",
- nextBefore: "下次:10月26日 09:00",
- nextAfter: "下次:11月2日 09:00",
- fastForward: "快进到周一 09:00",
- history: "运行历史",
- noRuns: "暂无运行记录。点击\"立即运行\"手动触发。",
- runStatus: { created: "已创建任务", completed: "已完成" },
- source: { manual: "手动", schedule: "时间表" } as Record<Source, string>,
- issueLinked: "已关联任务",
- runTime: { manual: "10月24日 15:42", schedule: "10月26日 09:00" } as Record<Source, string>,
- issueTitle: "OPS-31 · 每周客户反馈整理",
- statusLabel: "状态",
- issueStatus: { todo: "待办", in_progress: "进行中", in_review: "审核中" } as Record<IssueStatus, string>,
- assigneeLabel: "负责人",
- queued: "排队中",
- workingStatus: "运行中",
- completed: "已完成",
- steps: [
- "读取任务描述和讨论",
- "把状态改为 进行中",
- "汇总上周的客服工单、问卷回复和应用商店评论",
- "按问题类型归类,统计每类数量",
- "写成一页周报",
- "把状态改为 审核中",
- ],
- reply: "上周反馈已整理好:共 64 条,分成 5 类,其中\"配送慢\"增加最多,有 21 条。一页周报已写好,请检查。",
- captions: {
- idle: "一条每周一 09:00 运行的自动化,每次触发都会创建一条任务。",
- ready: "点击\"立即运行\",手动执行一次完整流程;也可以快进到周一 09:00,看时间表怎么触发。",
- triggering: "正在触发自动化...",
- created: {
- manual: "自动化创建了任务 OPS-31,交给 运营助手。运行历史记下一次手动运行。",
- schedule: "到了周一 09:00,时间表触发:自动化创建了任务 OPS-31,交给 运营助手。",
- } as Record<Source, string>,
- running: "运营助手 按 Runbook 处理任务,进度写在任务里。",
- done: "任务进入审核中,这次自动化运行记为已完成。点右上角可以换另一种触发方式再试。",
- },
+ title: "用自动化定期或按事件启动智能体",
+ chapters: ["自动化列表", "定时规则与运行手册", "立即运行测试"],
+ caption: "自动化按 Cron 时间表或外部 Webhook 自动触发,也支持点击「立即运行」随时试跑一次。",
+ },
+ "zh-Hant": {
+ title: "用自動化定期或按事件啟動智能體",
+ chapters: ["自動化列表", "排程與執行手冊", "立即執行測試"],
+ caption: "自動化按 Cron 排程或外部 Webhook 觸發,也支援點擊「立即執行」隨時試跑。",
},
ja: {
- title: "オートパイロット · 毎週の顧客フィードバックまとめ",
- breadcrumb: "オートパイロット",
- name: "毎週の顧客フィードバックまとめ",
- active: "アクティブ",
- edit: "編集",
- runNow: "今すぐ実行",
- running: "実行中...",
- toast: "オートパイロットを実行しました",
- properties: "プロパティ",
- agentLabel: "エージェント",
- agent: "運用アシスタント",
- modeLabel: "出力モード",
- mode: "タスクを作成",
- triggers: "トリガー",
- schedule: "スケジュール",
- scheduleText: "09:00 · 月 (Asia/Shanghai)",
- cron: "0 9 * * 1",
- nextBefore: "次回: 10月26日 09:00",
- nextAfter: "次回: 11月2日 09:00",
- fastForward: "月曜 09:00 まで早送り",
- history: "実行履歴",
- noRuns: "まだ実行履歴がありません。手動で実行するには「今すぐ実行」をクリックしてください。",
- runStatus: { created: "タスク作成済み", completed: "完了" },
- source: { manual: "手動", schedule: "スケジュール" } as Record<Source, string>,
- issueLinked: "タスクをリンク済み",
- runTime: { manual: "10月24日 15:42", schedule: "10月26日 09:00" } as Record<Source, string>,
- issueTitle: "OPS-31 · 毎週の顧客フィードバックまとめ",
- statusLabel: "ステータス",
- issueStatus: { todo: "未着手", in_progress: "進行中", in_review: "レビュー中" } as Record<IssueStatus, string>,
- assigneeLabel: "担当者",
- queued: "待機中",
- workingStatus: "実行中",
- completed: "完了",
- steps: [
- "タスクの説明と議論を読む",
- "ステータスを 進行中 にする",
- "先週のサポートチケット、アンケート回答、アプリレビューを集める",
- "問題の種類ごとに分類し、件数を数える",
- "1 ページの週次レポートにまとめる",
- "ステータスを レビュー中 にする",
- ],
- reply:
- "先週のフィードバックをまとめました。全 64 件を 5 つに分類し、最も増えたのは「配送が遅い」で 21 件です。1 ページのレポートができたので確認をお願いします。",
- captions: {
- idle: "毎週月曜 09:00 に動き、そのたびにタスクを作成するオートパイロットです。",
- ready: "「今すぐ実行」をクリックすると、一連の流れを 1 回手動で実行します。月曜 09:00 まで早送りして、スケジュールでの起動を見ることもできます。",
- triggering: "オートパイロットを実行しています...",
- created: {
- manual: "オートパイロットがタスク OPS-31 を作成し、運用アシスタント に割り当てました。実行履歴には手動の実行が記録されます。",
- schedule: "月曜 09:00 になりスケジュールが発火しました。オートパイロットがタスク OPS-31 を作成し、運用アシスタント に割り当てました。",
- } as Record<Source, string>,
- running: "運用アシスタント が Runbook に沿って作業し、進捗をタスクに書き込みます。",
- done: "タスクがレビュー中になり、このオートパイロットの実行は完了と記録されました。「もう一度」でもう一方のトリガーも試せます。",
- },
+ title: "オートパイロットで定期タスクを自動実行する",
+ chapters: ["一覧", "スケジュールと手順", "今すぐ実行"],
+ caption: "Cron や Webhook で自動起動でき、「今すぐ実行」でいつでも動作を試せます。",
},
ko: {
- title: "오토파일럿 · 주간 고객 피드백 정리",
- breadcrumb: "오토파일럿",
- name: "주간 고객 피드백 정리",
- active: "활성",
- edit: "수정",
- runNow: "지금 실행",
- running: "실행 중...",
- toast: "오토파일럿을 실행했습니다",
- properties: "속성",
- agentLabel: "에이전트",
- agent: "운영 도우미",
- modeLabel: "출력 모드",
- mode: "태스크 생성",
- triggers: "트리거",
- schedule: "일정",
- scheduleText: "09:00 · 월 (Asia/Shanghai)",
- cron: "0 9 * * 1",
- nextBefore: "다음: 10월 26일 09:00",
- nextAfter: "다음: 11월 2일 09:00",
- fastForward: "월요일 09:00으로 건너뛰기",
- history: "실행 기록",
- noRuns: "아직 실행 기록이 없습니다. 수동으로 실행하려면 \"지금 실행\"을 클릭하세요.",
- runStatus: { created: "태스크 생성됨", completed: "완료됨" },
- source: { manual: "수동", schedule: "일정" } as Record<Source, string>,
- issueLinked: "태스크 연결됨",
- runTime: { manual: "10월 24일 15:42", schedule: "10월 26일 09:00" } as Record<Source, string>,
- issueTitle: "OPS-31 · 주간 고객 피드백 정리",
- statusLabel: "상태",
- issueStatus: { todo: "할 일", in_progress: "진행 중", in_review: "리뷰 중" } as Record<IssueStatus, string>,
- assigneeLabel: "담당자",
- queued: "대기 중",
- workingStatus: "실행 중",
- completed: "완료됨",
- steps: [
- "태스크 설명과 논의 읽기",
- "상태를 진행 중으로 변경",
- "지난주 고객 지원 티켓, 설문 응답, 앱 리뷰 모으기",
- "문제 유형별로 묶고 유형마다 개수 세기",
- "한 페이지짜리 주간 보고서 작성",
- "상태를 리뷰 중으로 변경",
- ],
- reply:
- "지난주 피드백을 정리했습니다. 총 64건을 5개 유형으로 나눴고, 가장 많이 늘어난 것은 \"배송 지연\"으로 21건입니다. 한 페이지 보고서를 작성했으니 확인해 주세요.",
- captions: {
- idle: "매주 월요일 09:00에 실행되고, 실행할 때마다 태스크를 만드는 오토파일럿입니다.",
- ready: "\"지금 실행\"을 클릭하면 전체 흐름을 한 번 수동으로 실행합니다. 월요일 09:00으로 건너뛰어 일정이 실행되는 모습을 볼 수도 있습니다.",
- triggering: "오토파일럿을 실행하는 중...",
- created: {
- manual: "오토파일럿이 태스크 OPS-31을 만들고 운영 도우미에게 할당했습니다. 실행 기록에 수동 실행이 남습니다.",
- schedule: "월요일 09:00이 되어 일정이 실행되었습니다. 오토파일럿이 태스크 OPS-31을 만들고 운영 도우미에게 할당했습니다.",
- } as Record<Source, string>,
- running: "운영 도우미가 Runbook에 따라 작업하고 진행 상황을 태스크에 남깁니다.",
- done: "태스크가 리뷰 중으로 바뀌어 이번 오토파일럿 실행은 완료됨으로 기록되었습니다. \"다시 보기\"로 다른 트리거도 시도해 보세요.",
- },
+ title: "오토파일럿으로 반복 작업 자동화하기",
+ chapters: ["오토파일럿 목록", "일정 및 런북", "지금 실행"],
+ caption: "크론 일정이나 웹훅으로 자동 실행되며, 지금 실행 버튼으로 즉시 테스트할 수 있습니다.",
},
fr: {
- title: "Automatisation · Synthèse hebdomadaire des retours clients",
- breadcrumb: "Automatisation",
- name: "Synthèse hebdomadaire des retours clients",
- active: "Active",
- edit: "Modifier",
- runNow: "Exécuter maintenant",
- running: "Exécution...",
- toast: "Automatisation déclenchée",
- properties: "Propriétés",
- agentLabel: "Agent",
- agent: "Assistant ops",
- modeLabel: "Mode de sortie",
- mode: "Créer une tâche",
- triggers: "Déclencheurs",
- schedule: "Planification",
- scheduleText: "09:00 · lun. (Asia/Shanghai)",
- cron: "0 9 * * 1",
- nextBefore: "Prochaine : 26 oct., 09:00",
- nextAfter: "Prochaine : 2 nov., 09:00",
- fastForward: "Avancer jusqu'à lundi 09:00",
- history: "Historique des exécutions",
- noRuns: "Aucune exécution pour l'instant. Cliquez sur « Exécuter maintenant » pour déclencher manuellement.",
- runStatus: { created: "Tâche créée", completed: "Terminée" },
- source: { manual: "Manuelle", schedule: "Planification" } as Record<Source, string>,
- issueLinked: "Tâche liée",
- runTime: { manual: "24 oct., 15:42", schedule: "26 oct., 09:00" } as Record<Source, string>,
- issueTitle: "OPS-31 · Synthèse hebdomadaire des retours clients",
- statusLabel: "Statut",
- issueStatus: { todo: "À faire", in_progress: "En cours", in_review: "En relecture" } as Record<IssueStatus, string>,
- assigneeLabel: "Assigné à",
- queued: "En file d'attente",
- workingStatus: "En cours",
- completed: "Terminée",
- steps: [
- "Lire la description et la discussion de la tâche",
- "Passer le statut à En cours",
- "Rassembler les tickets support, les réponses au questionnaire et les avis de l'app de la semaine dernière",
- "Les regrouper par type de problème et compter chaque groupe",
- "Rédiger un rapport hebdomadaire d'une page",
- "Passer le statut à En relecture",
- ],
- reply:
- "Les retours de la semaine dernière sont regroupés : 64 éléments en cinq groupes. La lenteur de livraison progresse le plus, avec 21 mentions. Le rapport d'une page est prêt ; merci de le relire.",
- captions: {
- idle: "Une automatisation qui tourne chaque lundi à 09:00 et crée une tâche à chaque fois.",
- ready: "Cliquez sur « Exécuter maintenant » pour dérouler le flux complet une fois. Ou avancez jusqu'à lundi 09:00 pour voir la planification se déclencher.",
- triggering: "Déclenchement de l'automatisation...",
- created: {
- manual: "L'automatisation a créé la tâche OPS-31 et l'a assignée à Assistant ops. L'historique des exécutions enregistre une exécution manuelle.",
- schedule: "Lundi 09:00 est arrivé et la planification s'est déclenchée : l'automatisation a créé la tâche OPS-31 et l'a assignée à Assistant ops.",
- } as Record<Source, string>,
- running: "Assistant ops suit le runbook et rend compte de l'avancement dans la tâche.",
- done: "La tâche est passée à En relecture, donc cette exécution de l'automatisation est marquée Terminée. Rejouer permet d'essayer l'autre déclencheur.",
- },
+ title: "Automatiser les tâches récurrentes avec Autopilot",
+ chapters: ["Liste", "Horaire et runbook", "Exécuter maintenant"],
+ caption: "Les automatisations se déclenchent par cron ou webhook et se testent à tout moment avec Exécuter maintenant.",
},
};
-type Phase = "idle" | "ready" | "triggering" | "created" | "running" | "done";
-
-// Index of the step at which the agent updates the issue status.
-const STATUS_STEPS: Partial<Record<number, IssueStatus>> = { 2: "in_progress", 6: "in_review" };
-
-const issueDot: Record<IssueStatus, string> = {
- todo: "border-muted-foreground",
- in_progress: "border-warning bg-warning/40",
- in_review: "border-brand bg-brand/40",
-};
-
export function AutopilotDemo() {
const t = useDemoCopy(copy);
- const { after, clear } = useDemoTimers();
- const [frameRef, visible] = useStartWhenVisible<HTMLElement>();
- const [cycle, setCycle] = useState(0);
- const [phase, setPhase] = useState<Phase>("idle");
- const [source, setSource] = useState<Source>("manual");
- const [issueStatus, setIssueStatus] = useState<IssueStatus>("todo");
- const [stepsShown, setStepsShown] = useState(0);
- const [toast, setToast] = useState(false);
-
- useEffect(() => {
- if (!visible) return;
- clear();
- after(500, () => setPhase("ready"));
- }, [visible, cycle, after, clear]);
-
- const startRun = (from: number) => {
- after(from, () => setPhase("running"));
- t.steps.forEach((_, i) =>
- after(from + 1000 + i * 1000, () => {
- setStepsShown(i + 1);
- const next = STATUS_STEPS[i + 1];
- if (next) setIssueStatus(next);
- }),
- );
- after(from + 1000 + t.steps.length * 1000 + 600, () => setPhase("done"));
- };
-
- const runNow = () => {
- setSource("manual");
- setPhase("triggering");
- after(700, () => {
- setPhase("created");
- setToast(true);
- });
- after(2700, () => setToast(false));
- startRun(2600);
- };
-
- const fastForward = () => {
- setSource("schedule");
- setPhase("created");
- startRun(2200);
- };
-
- const replay = () => {
- clear();
- setPhase("idle");
- setSource("manual");
- setIssueStatus("todo");
- setStepsShown(0);
- setToast(false);
- setCycle((c) => c + 1);
- };
-
- const shownPhase: Phase = visible ? phase : "idle";
- const fired = shownPhase === "created" || shownPhase === "running" || shownPhase === "done";
- const caption =
- shownPhase === "created" ? t.captions.created[source] : t.captions[shownPhase];
- const runStatus = shownPhase === "done" ? t.completed : shownPhase === "running" ? t.workingStatus : t.queued;
-
- return (
- <DemoFrame frameRef={frameRef} title={t.title} caption={caption} onReplay={replay}>
- <div className="relative flex min-h-96 flex-col gap-4 p-4">
- <div className="flex flex-wrap items-center gap-2">
- <span className="text-caption text-muted-foreground">{t.breadcrumb} /</span>
- <span className="min-w-0 truncate text-body font-medium">{t.name}</span>
- <span className="inline-flex items-center gap-1.5 text-caption font-medium text-success">
- <span aria-hidden className="inline-flex h-4 w-7 items-center rounded-full bg-success/80 p-0.5">
- <span className="ml-auto size-3 rounded-full bg-background" />
- </span>
- {t.active}
- </span>
- <span className="ml-auto flex items-center gap-1.5">
- <Button type="button" size="sm" variant="outline" disabled>
- <Pencil />
- {t.edit}
- </Button>
- <CoachMark active={shownPhase === "ready"} side="bottom" align="end" ringClassName="rounded-lg">
- <Button type="button" size="sm" disabled={shownPhase !== "ready"} onClick={runNow}>
- {shownPhase === "triggering" ? <Loader2 className="motion-safe:animate-spin" /> : <Play />}
- {shownPhase === "triggering" ? t.running : t.runNow}
- </Button>
- </CoachMark>
- </span>
- </div>
-
- <div className="grid gap-4 sm:grid-cols-2">
- <section className="flex min-w-0 flex-col gap-2">
- <div className="text-caption font-medium text-muted-foreground">{t.properties}</div>
- <dl className="grid grid-cols-[auto_minmax(0,1fr)] items-center gap-x-4 gap-y-1.5 text-body">
- <dt className="text-caption text-muted-foreground">{t.agentLabel}</dt>
- <dd className="flex min-w-0 items-center gap-1.5">
- <DemoAvatar name={t.agent} agent />
- <span className="truncate">{t.agent}</span>
- </dd>
- <dt className="text-caption text-muted-foreground">{t.modeLabel}</dt>
- <dd>{t.mode}</dd>
- </dl>
- </section>
-
- <section className="flex min-w-0 flex-col gap-2">
- <div className="text-caption font-medium text-muted-foreground">{t.triggers}</div>
- <div className="flex items-start gap-2.5 rounded-md border bg-background px-3 py-2">
- <Clock aria-hidden className="mt-0.5 size-4 shrink-0 text-muted-foreground" />
- <div className="min-w-0 flex-1">
- <div className="text-body font-medium">{t.schedule}</div>
- <div className="text-caption text-muted-foreground">{t.scheduleText}</div>
- <div className="font-mono text-micro text-muted-foreground">{t.cron}</div>
- <div key={String(fired && source === "schedule")} className="text-caption text-muted-foreground motion-safe:animate-in motion-safe:fade-in">
- {fired && source === "schedule" ? t.nextAfter : t.nextBefore}
- </div>
- </div>
- </div>
- <Button
- type="button"
- size="xs"
- variant="ghost"
- className="self-start text-muted-foreground"
- disabled={shownPhase !== "ready"}
- onClick={fastForward}
- >
- <FastForward />
- {t.fastForward}
- </Button>
- </section>
- </div>
-
- <section className="flex min-w-0 flex-col gap-2">
- <div className="text-caption font-medium text-muted-foreground">{t.history}</div>
- <div className="overflow-hidden rounded-md border bg-background">
- {fired ? (
- <div className="flex min-w-0 flex-wrap items-center gap-x-3 gap-y-1 px-3 py-2 text-body motion-safe:animate-in motion-safe:fade-in">
- {shownPhase === "done" ? (
- <CheckCircle2 aria-hidden className="size-4 shrink-0 text-success" />
- ) : (
- <Clock aria-hidden className="size-4 shrink-0 text-info" />
- )}
- <span className={cn("w-20 shrink-0 text-caption font-medium", shownPhase === "done" ? "text-success" : "text-info")}>
- {shownPhase === "done" ? t.runStatus.completed : t.runStatus.created}
- </span>
- <span className="shrink-0 text-caption text-muted-foreground">{t.source[source]}</span>
- <span className="min-w-0 flex-1 truncate text-caption text-muted-foreground">{t.issueLinked}</span>
- <span className="shrink-0 text-caption text-muted-foreground tabular-nums">{t.runTime[source]}</span>
- </div>
- ) : (
- <div className="px-3 py-3 text-center text-caption text-muted-foreground">{t.noRuns}</div>
- )}
- </div>
- </section>
-
- {fired && (
- <section className="flex min-w-0 flex-col gap-3 rounded-lg border border-dashed p-3 motion-safe:animate-in motion-safe:fade-in motion-safe:slide-in-from-bottom-1">
- <div className="min-w-0 truncate text-label font-medium">{t.issueTitle}</div>
- <dl className="flex flex-wrap items-center gap-x-5 gap-y-1.5 text-body">
- <div className="flex items-center gap-2">
- <dt className="text-caption text-muted-foreground">{t.statusLabel}</dt>
- <dd className="flex items-center gap-1.5">
- <span aria-hidden className={cn("size-3 rounded-full border-2 transition-colors", issueDot[issueStatus])} />
- <span key={issueStatus} className="motion-safe:animate-in motion-safe:fade-in">
- {t.issueStatus[issueStatus]}
- </span>
- </dd>
- </div>
- <div className="flex items-center gap-2">
- <dt className="text-caption text-muted-foreground">{t.assigneeLabel}</dt>
- <dd className="flex items-center gap-1.5">
- <DemoAvatar name={t.agent} agent />
- {t.agent}
- </dd>
- </div>
- </dl>
- <DemoRun agent={t.agent} status={runStatus} active={shownPhase !== "done"}>
- {t.steps.slice(0, stepsShown).map((step, i) => (
- <DemoStep key={step} state={i === stepsShown - 1 && shownPhase !== "done" ? "running" : "done"}>
- {step}
- </DemoStep>
- ))}
- </DemoRun>
- {shownPhase === "done" && (
- <DemoComment author={t.agent} agent>
- {t.reply}
- </DemoComment>
- )}
- </section>
- )}
-
- {toast && (
- <div
- aria-hidden
- className="absolute right-4 bottom-4 z-10 flex items-center gap-2 rounded-lg border bg-popover px-3 py-2 text-caption text-popover-foreground shadow-md motion-safe:animate-in motion-safe:fade-in motion-safe:slide-in-from-bottom-2"
- >
- <CheckCircle2 className="size-4 text-success" />
- {t.toast}
- </div>
- )}
- </div>
- </DemoFrame>
- );
+ const meta = CLIP_MANIFEST.autopilot ?? { duration: 6.0, chapters: [] };
+ const chapters = t.chapters.map((label, i) => ({
+ label,
+ at: meta.chapters[i]?.at ?? (i * meta.duration) / t.chapters.length,
+ }));
+ return <EditorialClip slug="autopilot" title={t.title} chapters={chapters} duration={meta.duration} caption={t.caption} />;
}
diff --git a/apps/docs/components/demos/channel-chat-demo.tsx b/apps/docs/components/demos/channel-chat-demo.tsx
index b519faa1bf..4ddaf227cb 100644
--- a/apps/docs/components/demos/channel-chat-demo.tsx
+++ b/apps/docs/components/demos/channel-chat-demo.tsx
@@ -1,467 +1,224 @@
"use client";
-import { useState, type ReactNode } from "react";
-import { Users } from "@multica/ui/icons";
+import { useState } from "react";
import { cn } from "@multica/ui/lib/utils";
-import {
- CoachMark,
- DemoAvatar,
- DemoFrame,
- DemoRun,
- DemoSendButton,
- DemoStep,
- useDemoCopy,
- useDemoTimers,
- useStartWhenVisible,
-} from "./demo-kit";
+import { EditorialFigure, useDemoCopy } from "./demo-kit";
-type Status = "todo" | "in_progress";
+type Command = "mention" | "issue";
const copy = {
en: {
- title: "Ops team group chat · Ops helper connected",
- chatApp: "Chat app",
- multica: "Multica",
- chatName: "Ops team",
- botTag: "Bot",
- you: "You",
- lei: "Lei Li",
- bot: "Ops helper",
- leiMessage: "I'll hand this month's expense reports to finance by Friday.",
- mention: "@Ops helper",
- askText:
- " Team dinner next Wednesday, 12 people, up to 150 per person. What should I confirm before booking a restaurant?",
- askReply:
- "Before booking, confirm four things: dietary restrictions, lunch or dinner, whether the 150 includes drinks, and a private room or the main hall.",
- issueText: " /issue Book a restaurant for next Wednesday's team dinner\n12 people, up to 150 per person, private room needed.",
- created: "✅ Created OPS-21 — Book a restaurant for next Wednesday's team dinner",
- link: ".../issues/OPS-21",
- placeholder: "Message Ops team",
- send: "Send",
- issueTitle: "OPS-21 · Book a restaurant for next Wednesday's team dinner",
- statusLabel: "Status",
- assigneeLabel: "Assignee",
- creatorLabel: "Created by",
- status: { todo: "Todo", in_progress: "In Progress" } as Record<Status, string>,
- description: "12 people, up to 150 per person, private room needed.",
- queued: "Queued",
- running: "Running",
- steps: [
- "Read the issue description",
- "Set the status to In Progress",
- "Shortlist restaurants that fit the group size and budget",
- ],
+ kicker: "CHANNEL BRIDGE",
+ title: "How messages flow between your chat app and Multica",
+ tabs: { mention: "@mention → Quick reply", issue: "/issue → Tracked issue" } as Record<Command, string>,
+ channelZone: "SLACK / LARK / TELEGRAM / WECOM / DISCORD",
+ multicaZone: "MULTICA WORKSPACE",
+ msgMention: "@Engineer Summarize today's failed CI checks",
+ msgIssue: "/issue Fix flaky checkout test on Safari",
+ bridgeTitle: "Connected Bot",
+ bridgeSub: "Routes group @mentions & commands",
+ chatResultTitle: "Multica Chat Run",
+ chatResultSub: "Replies directly back in the same thread",
+ issueResultTitle: "Issue ENG-48 created",
+ issueResultSub: "Assigned to Engineer · Run starts immediately",
+ replyLoop: "Reply / Issue link posted back to channel",
captions: {
- idle: "A group chat with the Ops helper Bot connected.",
- ask: "In a group, the Bot only handles messages that @ it, so Lei Li's message doesn't start it. Click send.",
- thinking: "The message goes into a Multica chat, and Ops helper starts a run.",
- replied:
- "The reply comes back to this group. Next, record the work as an issue with /issue: the first line is the title, the rest is the description. Click send.",
- creating: "/issue is a command: Multica creates the issue straight from the message and doesn't add it to the chat.",
- created: "The issue is created and assigned to the agent behind this Bot. Click the link to open it.",
- issue: "The issue is assigned to Ops helper and created as Todo. A run starts for it, and the agent moves the issue to In Progress as it begins.",
- done: "Ops helper is working on the issue, and its progress stays on the issue. Use Replay to start over.",
+ mention: "In a group chat, only messages that @mention the connected Bot trigger a run. The reply streams back into the same chat thread.",
+ issue: "Prefix a message with `/issue` to create a tracked Multica issue straight from chat (first line = title, rest = description) and start the agent.",
},
},
zh: {
- title: "运营组群聊 · 已接入 运营助手",
- chatApp: "聊天工具",
- multica: "Multica",
- chatName: "运营组",
- botTag: "Bot",
- you: "你",
- lei: "李雷",
- bot: "运营助手",
- leiMessage: "这个月的报销单我周五前交给财务。",
- mention: "@运营助手",
- askText: " 下周三部门聚餐,12 个人,人均 150 元以内。订餐厅前还要确认哪些事?",
- askReply: "订之前建议确认四件事:有没有人忌口,吃午饭还是晚饭,150 元含不含酒水,要包间还是大厅。",
- issueText: " /issue 预订下周三部门聚餐的餐厅\n12 人,人均 150 元以内,需要包间。",
- created: "✅ 已创建 OPS-21 — 预订下周三部门聚餐的餐厅",
- link: ".../issues/OPS-21",
- placeholder: "发送给 运营组",
- send: "发送",
- issueTitle: "OPS-21 · 预订下周三部门聚餐的餐厅",
- statusLabel: "状态",
- assigneeLabel: "负责人",
- creatorLabel: "创建者",
- status: { todo: "待办", in_progress: "进行中" } as Record<Status, string>,
- description: "12 人,人均 150 元以内,需要包间。",
- queued: "排队中",
- running: "运行中",
- steps: ["读取任务描述", "把状态改为 进行中", "按人数和预算筛选餐厅"],
+ kicker: "渠道桥接",
+ title: "外部聊天工具与 Multica 之间的消息流转",
+ tabs: { mention: "@提及 → 群内直接回复", issue: "/issue → 建单并启动运行" } as Record<Command, string>,
+ channelZone: "SLACK / 飞书 / 钉钉 / 企业微信 / TELEGRAM",
+ multicaZone: "MULTICA 工作区",
+ msgMention: "@Engineer 汇总今天失败的 CI 检查",
+ msgIssue: "/issue 修复 Safari 结算页偶发测试失败",
+ bridgeTitle: "已接入的智能体 Bot",
+ bridgeSub: "仅响应群内 @提及 与斜杠命令",
+ chatResultTitle: "进入 Multica 对话运行",
+ chatResultSub: "完成后直接把回复发回当前群聊",
+ issueResultTitle: "创建任务 ENG-48",
+ issueResultSub: "自动指派给 Engineer 并立即开始执行",
+ replyLoop: "结果回复 / 任务链接回传至原群聊",
captions: {
- idle: "一个接入了 运营助手 Bot 的群聊。",
- ask: "群聊里只有 @ Bot 的消息才会交给它,李雷那条不会触发。点击发送。",
- thinking: "消息进入一段 Multica 对话,运营助手 开始一次运行。",
- replied: "回复发回了这个群。接下来用 /issue 把这件事记成任务:第一行是标题,其余是描述。点击发送。",
- creating: "/issue 是命令:Multica 直接按这条消息创建任务,不会把它加入对话。",
- created: "任务已创建,负责人是这个 Bot 绑定的智能体。点击链接打开任务。",
- issue: "任务的负责人是 运营助手,创建时为待办。Multica 为它创建了一次运行,智能体开始工作时把状态改为进行中。",
- done: "运营助手 正在处理这条任务,进展都记在任务里。点右上角可以重新演示。",
+ mention: "群聊中只有明确 @Bot 的消息才会触发智能体,普通聊天不会打扰它;结果直接回复在原群聊中。",
+ issue: "使用 /issue 命令可直接把消息转为正式任务(首行为标题,其余为描述),自动分配给绑定的智能体并启动运行。",
+ },
+ },
+ "zh-Hant": {
+ kicker: "管道橋接",
+ title: "外部聊天工具與 Multica 之間的訊息流轉",
+ tabs: { mention: "@提及 → 群內回覆", issue: "/issue → 建立任務並執行" } as Record<Command, string>,
+ channelZone: "SLACK / 飛書 / 釘釘 / 企業微信 / TELEGRAM",
+ multicaZone: "MULTICA 工作區",
+ msgMention: "@Engineer 彙整今天失敗的 CI 檢查",
+ msgIssue: "/issue 修復 Safari 結帳頁偶發測試失敗",
+ bridgeTitle: "已接入的智能體 Bot",
+ bridgeSub: "僅回應群內 @提及 與指令",
+ chatResultTitle: "進入 Multica 對話執行",
+ chatResultSub: "完成後直接回覆至原群組",
+ issueResultTitle: "建立任務 ENG-48",
+ issueResultSub: "自動指派給 Engineer 並立即開始",
+ replyLoop: "結果回覆 / 任務連結回傳至群組",
+ captions: {
+ mention: "群組中只有 @Bot 的訊息才會觸發智能體,結果直接回覆在原群組對話中。",
+ issue: "使用 /issue 指令可直接建立正式任務,自動指派給綁定的智能體並啟動執行。",
},
},
ja: {
- title: "運用チームのグループチャット · 運用アシスタント 接続済み",
- chatApp: "チャットツール",
- multica: "Multica",
- chatName: "運用チーム",
- botTag: "Bot",
- you: "あなた",
- lei: "李雷",
- bot: "運用アシスタント",
- leiMessage: "今月の経費精算は金曜までに経理へ出しておきます。",
- mention: "@運用アシスタント",
- askText:
- " 来週水曜にチームの食事会をします。12 人で、予算は 1 人 5,000 円まで。お店を予約する前に何を確認しておくべき?",
- askReply:
- "予約の前に 4 つ確認しておきましょう:食べられないものがある人はいるか、ランチかディナーか、5,000 円に飲み物代を含むか、個室かフロア席か。",
- issueText: " /issue 来週水曜のチーム食事会のお店を予約する\n12 人、1 人 5,000 円まで、個室希望。",
- created: "✅ OPS-21 を作成しました — 来週水曜のチーム食事会のお店を予約する",
- link: ".../issues/OPS-21",
- placeholder: "運用チーム にメッセージを送信",
- send: "送信",
- issueTitle: "OPS-21 · 来週水曜のチーム食事会のお店を予約する",
- statusLabel: "ステータス",
- assigneeLabel: "担当者",
- creatorLabel: "作成者",
- status: { todo: "未着手", in_progress: "進行中" } as Record<Status, string>,
- description: "12 人、1 人 5,000 円まで、個室希望。",
- queued: "キュー待ち",
- running: "実行中",
- steps: ["タスクの説明を読む", "ステータスを 進行中 に変更", "人数と予算に合うお店を絞り込む"],
+ kicker: "CHANNEL BRIDGE",
+ title: "チャットツールと Multica 間のメッセージ連携",
+ tabs: { mention: "@メンション → スレッド返信", issue: "/issue → タスク作成・実行" } as Record<Command, string>,
+ channelZone: "SLACK / LARK / TELEGRAM / DISCORD",
+ multicaZone: "MULTICA ワークスペース",
+ msgMention: "@Engineer 今日の失敗した CI をまとめて",
+ msgIssue: "/issue Safari の決済テストの失敗を修正",
+ bridgeTitle: "連携済み Bot",
+ bridgeSub: "@メンションとコマンドのみ処理",
+ chatResultTitle: "Multica チャット実行",
+ chatResultSub: "同じスレッドへ返信を返す",
+ issueResultTitle: "タスク ENG-48 を作成",
+ issueResultSub: "Engineer に割り当てて即座に実行開始",
+ replyLoop: "返信 / タスク URL をチャットへ返送",
captions: {
- idle: "運用アシスタント の Bot を接続したグループチャットです。",
- ask: "グループでは Bot を @メンションしたメッセージだけが Bot に渡るので、李雷 のメッセージでは動きません。送信をクリックしてください。",
- thinking: "メッセージが Multica のチャットに入り、運用アシスタント が実行を始めます。",
- replied:
- "返信はこのグループに届きます。次は /issue でこの件をタスクにします。1 行目がタイトル、残りが説明です。送信をクリックしてください。",
- creating: "/issue はコマンドです。Multica はこのメッセージからそのままタスクを作成し、チャットには追加しません。",
- created: "タスクが作成され、担当者はこの Bot に紐づいたエージェントです。リンクをクリックしてタスクを開きます。",
- issue: "担当者は 運用アシスタント、作成時のステータスは 未着手 です。Multica が実行を作成し、エージェントは作業を始めるときにステータスを 進行中 に変更します。",
- done: "運用アシスタント がタスクに取り組んでいて、進捗はタスクに記録されます。「もう一度」で最初から見られます。",
+ mention: "グループチャットでは Bot を @メンションしたメッセージだけがトリガーされ、返信が同じスレッドに戻ります。",
+ issue: "/issue を使うとチャットから直接タスクを作成し、紐づくエージェントに割り当てて実行を始められます。",
},
},
ko: {
- title: "운영팀 그룹 채팅 · 운영 도우미 연결됨",
- chatApp: "채팅 도구",
- multica: "Multica",
- chatName: "운영팀",
- botTag: "Bot",
- you: "나",
- lei: "리레이",
- bot: "운영 도우미",
- leiMessage: "이번 달 경비 정산서는 금요일까지 재무팀에 낼게요.",
- mention: "@운영 도우미",
- askText: " 다음 주 수요일에 팀 회식이 있어요. 12명이고 1인당 3만 원 이하예요. 식당을 예약하기 전에 뭘 확인해야 할까요?",
- askReply:
- "예약 전에 네 가지를 확인하세요. 못 먹는 음식이 있는 사람이 있는지, 점심인지 저녁인지, 3만 원에 주류가 포함되는지, 룸이 필요한지 홀이면 되는지입니다.",
- issueText: " /issue 다음 주 수요일 팀 회식 식당 예약\n12명, 1인당 3만 원 이하, 룸 필요.",
- created: "✅ OPS-21 생성됨 — 다음 주 수요일 팀 회식 식당 예약",
- link: ".../issues/OPS-21",
- placeholder: "운영팀에 메시지 보내기",
- send: "보내기",
- issueTitle: "OPS-21 · 다음 주 수요일 팀 회식 식당 예약",
- statusLabel: "상태",
- assigneeLabel: "담당자",
- creatorLabel: "작성자",
- status: { todo: "할 일", in_progress: "진행 중" } as Record<Status, string>,
- description: "12명, 1인당 3만 원 이하, 룸 필요.",
- queued: "대기열에 있음",
- running: "실행 중",
- steps: ["태스크 설명 읽기", "상태를 진행 중으로 변경", "인원과 예산에 맞는 식당 추리기"],
+ kicker: "CHANNEL BRIDGE",
+ title: "외부 메신저와 Multica 간 메시지 흐름",
+ tabs: { mention: "@멘션 → 스레드 답변", issue: "/issue → 태스크 생성·실행" } as Record<Command, string>,
+ channelZone: "SLACK / LARK / TELEGRAM / DISCORD",
+ multicaZone: "MULTICA 워크스페이스",
+ msgMention: "@Engineer 오늘 실패한 CI 체크 요약해 줘",
+ msgIssue: "/issue Safari 결제 테스트 간헐 실패 수정",
+ bridgeTitle: "연결된 Bot",
+ bridgeSub: "@멘션과 슬래시 명령만 라우팅",
+ chatResultTitle: "Multica 채팅 실행",
+ chatResultSub: "같은 채팅 스레드로 바로 답변",
+ issueResultTitle: "태스크 ENG-48 생성",
+ issueResultSub: "Engineer에 자동 할당 후 즉시 실행",
+ replyLoop: "답변 / 태스크 링크를 원래 채널로 전달",
captions: {
- idle: "운영 도우미 Bot이 연결된 그룹 채팅입니다.",
- ask: "그룹에서는 Bot을 @멘션한 메시지만 Bot에게 전달되므로 리레이의 메시지로는 시작되지 않습니다. 보내기를 클릭하세요.",
- thinking: "메시지가 Multica 대화에 들어가고 운영 도우미가 실행을 시작합니다.",
- replied:
- "답변이 이 그룹으로 돌아왔습니다. 이제 /issue로 이 일을 태스크로 남깁니다. 첫 줄은 제목, 나머지는 설명입니다. 보내기를 클릭하세요.",
- creating: "/issue는 명령입니다. Multica는 이 메시지로 바로 태스크를 만들고 대화에는 추가하지 않습니다.",
- created: "태스크가 생성되었고 담당자는 이 Bot에 연결된 에이전트입니다. 링크를 클릭해 태스크를 여세요.",
- issue: "담당자는 운영 도우미이고 태스크는 할 일 상태로 생성되었습니다. Multica가 실행을 만들고, 에이전트는 작업을 시작하면서 상태를 진행 중으로 바꿉니다.",
- done: "운영 도우미가 태스크를 처리하고 있으며 진행 상황은 태스크에 남습니다. 다시 보기를 누르면 처음부터 볼 수 있습니다.",
+ mention: "그룹 채팅에서는 Bot을 @멘션한 메시지만 에이전트를 호출하며, 답변이 같은 스레드로 돌아옵니다.",
+ issue: "/issue 명령으로 채팅에서 바로 태스크를 만들고 연결된 에이전트 실행을 시작할 수 있습니다.",
},
},
fr: {
- title: "Groupe Équipe ops · Assistant ops connecté",
- chatApp: "Messagerie",
- multica: "Multica",
- chatName: "Équipe ops",
- botTag: "Bot",
- you: "Vous",
- lei: "Lei Li",
- bot: "Assistant ops",
- leiMessage: "Je transmets les notes de frais du mois à la compta d'ici vendredi.",
- mention: "@Assistant ops",
- askText:
- " Dîner d'équipe mercredi prochain, 12 personnes, 30 € maximum par personne. Que faut-il vérifier avant de réserver un restaurant ?",
- askReply:
- "Avant de réserver, vérifiez quatre points : les restrictions alimentaires, déjeuner ou dîner, si les 30 € incluent les boissons, et salle privée ou salle principale.",
- issueText:
- " /issue Réserver un restaurant pour le dîner d'équipe de mercredi prochain\n12 personnes, 30 € maximum par personne, salle privée nécessaire.",
- created: "✅ OPS-21 créée — Réserver un restaurant pour le dîner d'équipe de mercredi prochain",
- link: ".../issues/OPS-21",
- placeholder: "Écrire dans Équipe ops",
- send: "Envoyer",
- issueTitle: "OPS-21 · Réserver un restaurant pour le dîner d'équipe de mercredi prochain",
- statusLabel: "Statut",
- assigneeLabel: "Assigné à",
- creatorLabel: "Créé par",
- status: { todo: "À faire", in_progress: "En cours" } as Record<Status, string>,
- description: "12 personnes, 30 € maximum par personne, salle privée nécessaire.",
- queued: "En file",
- running: "En cours",
- steps: [
- "Lire la description de la tâche",
- "Passer le statut à En cours",
- "Sélectionner des restaurants adaptés au groupe et au budget",
- ],
+ kicker: "PASSERELLE CANAUX",
+ title: "Échanges entre votre messagerie et Multica",
+ tabs: { mention: "@mention → Réponse directe", issue: "/issue → Création de tâche" } as Record<Command, string>,
+ channelZone: "SLACK / LARK / TELEGRAM / DISCORD",
+ multicaZone: "ESPACE MULTICA",
+ msgMention: "@Engineer Résume les échecs CI du jour",
+ msgIssue: "/issue Corriger le test Safari instable",
+ bridgeTitle: "Bot connecté",
+ bridgeSub: "Traite @mentions et commandes",
+ chatResultTitle: "Exécution Chat Multica",
+ chatResultSub: "Répond dans le même fil de discussion",
+ issueResultTitle: "Tâche ENG-48 créée",
+ issueResultSub: "Assignée à Engineer · démarre aussitôt",
+ replyLoop: "Réponse / lien de tâche renvoyé dans le canal",
captions: {
- idle: "Une discussion de groupe où le bot Assistant ops est connecté.",
- ask: "Dans un groupe, le bot ne traite que les messages qui le @mentionnent : le message de Lei Li ne le déclenche pas. Cliquez sur Envoyer.",
- thinking: "Le message rejoint une discussion Multica, et Assistant ops lance une exécution.",
- replied:
- "La réponse revient dans ce groupe. Enregistrez maintenant ce travail comme tâche avec /issue : la première ligne est le titre, le reste la description. Cliquez sur Envoyer.",
- creating: "/issue est une commande : Multica crée la tâche directement à partir du message et ne l'ajoute pas à la discussion.",
- created: "La tâche est créée et assignée à l'agent lié à ce bot. Cliquez sur le lien pour l'ouvrir.",
- issue: "La tâche est assignée à Assistant ops et créée en À faire. Une exécution démarre, et l'agent passe la tâche à En cours en commençant.",
- done: "Assistant ops travaille sur la tâche, et son avancement reste consigné sur la tâche. Cliquez sur Rejouer pour recommencer.",
+ mention: "En groupe, seuls les messages qui @mentionnent le Bot déclenchent une exécution et répondent dans le fil.",
+ issue: "La commande /issue crée une tâche suivie depuis le chat et lance l'agent lié.",
},
},
};
-type Phase = "idle" | "ask" | "thinking" | "replied" | "creating" | "created" | "issue" | "done";
-
-const ORDER: Phase[] = ["ask", "thinking", "replied", "creating", "created", "issue", "done"];
-
-// Index of the step at which the agent moves the issue to In Progress.
-const IN_PROGRESS_STEP = 2;
-
-function ChatMessage({
- author,
- bot,
- botTag,
- own,
- children,
-}: {
- author: string;
- bot?: boolean;
- botTag?: string;
- own?: boolean;
- children: ReactNode;
-}) {
- return (
- <div
- className={cn(
- "flex min-w-0 items-start gap-2 motion-safe:animate-in motion-safe:fade-in motion-safe:slide-in-from-bottom-1",
- own && "flex-row-reverse",
- )}
- >
- <DemoAvatar name={author} agent={bot} />
- <div className={cn("flex min-w-0 max-w-[85%] flex-col gap-0.5", own && "items-end")}>
- <span className="flex items-center gap-1 text-micro text-muted-foreground">
- {author}
- {bot && botTag && <span className="rounded-xs bg-muted px-1 text-micro text-foreground">{botTag}</span>}
- </span>
- <div
- className={cn(
- "rounded-lg px-2.5 py-1.5 text-body break-words whitespace-pre-line",
- own ? "bg-brand/10 dark:bg-brand/20" : "border bg-background",
- )}
- >
- {children}
- </div>
- </div>
- </div>
- );
-}
-
-function TypingBubble({ author, botTag }: { author: string; botTag: string }) {
- return (
- <ChatMessage author={author} bot botTag={botTag}>
- <span aria-hidden className="inline-flex gap-1 py-1">
- {[0, 1, 2].map((i) => (
- <span
- key={i}
- className="size-1.5 rounded-full bg-muted-foreground motion-safe:animate-pulse"
- style={{ animationDelay: `${i * 200}ms` }}
- />
- ))}
- </span>
- </ChatMessage>
- );
-}
-
-// The chat tool is drawn neutral on purpose: the flow is the same on every
-// supported platform, so no platform's look is implied.
export function ChannelChatDemo() {
const t = useDemoCopy(copy);
- const { after, clear } = useDemoTimers();
- const [frameRef, visible] = useStartWhenVisible<HTMLElement>();
- const [phase, setPhase] = useState<Exclude<Phase, "idle">>("ask");
- const [status, setStatus] = useState<Status>("todo");
- const [queued, setQueued] = useState(true);
- const [stepsShown, setStepsShown] = useState(0);
-
- const shownPhase: Phase = visible ? phase : "idle";
- const reached = (p: Phase) => ORDER.indexOf(phase) >= ORDER.indexOf(p);
- const view = reached("issue") ? "multica" : "chat";
- const canSend = visible && (phase === "ask" || phase === "replied");
-
- const send = () => {
- if (phase === "ask") {
- setPhase("thinking");
- after(1800, () => setPhase("replied"));
- } else if (phase === "replied") {
- setPhase("creating");
- after(1200, () => setPhase("created"));
- }
- };
-
- const openIssue = () => {
- setPhase("issue");
- after(1000, () => setQueued(false));
- t.steps.forEach((_, i) =>
- after(1000 + i * 1000, () => {
- setStepsShown(i + 1);
- if (i + 1 === IN_PROGRESS_STEP) setStatus("in_progress");
- }),
- );
- after(1000 + t.steps.length * 1000, () => setPhase("done"));
- };
-
- const replay = () => {
- clear();
- setPhase("ask");
- setStatus("todo");
- setQueued(true);
- setStepsShown(0);
- };
-
- const mention = <span className="font-medium text-brand">{t.mention}</span>;
- const draft = phase === "ask" ? t.askText : phase === "replied" ? t.issueText : null;
+ const [cmd, setCmd] = useState<Command>("mention");
+ const isIssue = cmd === "issue";
return (
- <DemoFrame frameRef={frameRef} title={t.title} caption={t.captions[shownPhase]} onReplay={replay}>
- <div aria-hidden className="flex gap-1 border-b px-3 py-1.5 text-caption">
- {(["chat", "multica"] as const).map((v) => (
- <span
- key={v}
- className={cn(
- "rounded-md px-2 py-0.5 transition-colors",
- view === v ? "bg-muted font-medium text-foreground" : "text-muted-foreground",
- )}
- >
- {v === "chat" ? t.chatApp : t.multica}
- </span>
- ))}
- </div>
-
- {view === "chat" ? (
- <div className="flex min-h-96 flex-col">
- <div className="flex items-center gap-2 border-b px-4 py-2">
- <span
- aria-hidden
- className="inline-flex size-6 items-center justify-center rounded-md bg-muted text-muted-foreground"
- >
- <Users className="size-3.5" />
- </span>
- <span className="text-label font-medium">{t.chatName}</span>
- </div>
-
- <div className="flex flex-1 flex-col gap-3 p-4">
- <ChatMessage author={t.lei}>{t.leiMessage}</ChatMessage>
- {reached("thinking") && (
- <ChatMessage author={t.you} own>
- {mention}
- {t.askText}
- </ChatMessage>
- )}
- {phase === "thinking" && <TypingBubble author={t.bot} botTag={t.botTag} />}
- {reached("replied") && (
- <ChatMessage author={t.bot} bot botTag={t.botTag}>
- {t.askReply}
- </ChatMessage>
- )}
- {reached("creating") && (
- <ChatMessage author={t.you} own>
- {mention}
- {t.issueText}
- </ChatMessage>
- )}
- {phase === "creating" && <TypingBubble author={t.bot} botTag={t.botTag} />}
- {reached("created") && (
- <ChatMessage author={t.bot} bot botTag={t.botTag}>
- {t.created}
- {"\n"}
- <CoachMark active={phase === "created"} side="right" ringClassName="rounded-sm">
- <button
- type="button"
- disabled={phase !== "created"}
- onClick={openIssue}
- className="text-brand underline decoration-brand/40 underline-offset-2 hover:decoration-brand"
- >
- {t.link}
- </button>
- </CoachMark>
- </ChatMessage>
- )}
- </div>
-
- <div className="m-3 mt-0 flex items-end gap-2 rounded-lg border bg-background p-2">
- <div className="min-h-10 min-w-0 flex-1 px-1 text-body break-words whitespace-pre-line">
- {visible && draft ? (
- <span key={phase} className="motion-safe:animate-in motion-safe:fade-in">
- {mention}
- {draft}
- </span>
- ) : (
- <span className="text-muted-foreground">{t.placeholder}</span>
+ <EditorialFigure
+ kicker={t.kicker}
+ title={t.title}
+ actions={
+ <div className="flex items-center gap-3" role="tablist" aria-label={t.title}>
+ {(["mention", "issue"] as Command[]).map((m) => (
+ <button
+ key={m}
+ type="button"
+ role="tab"
+ aria-selected={cmd === m}
+ onClick={() => setCmd(m)}
+ className={cn(
+ "border-b-[1.5px] pb-1 text-[0.75rem] transition-colors",
+ cmd === m
+ ? "border-[var(--primary)] font-medium text-foreground"
+ : "border-transparent text-muted-foreground hover:text-foreground",
)}
- </div>
- <CoachMark active={canSend} side="top" align="end" ringClassName="rounded-full">
- <DemoSendButton label={t.send} disabled={!canSend} onClick={send} />
- </CoachMark>
- </div>
- </div>
- ) : (
- <div className="flex min-h-96 flex-col gap-3 p-4 motion-safe:animate-in motion-safe:fade-in">
- <div className="text-body font-medium">{t.issueTitle}</div>
- <dl className="grid w-fit grid-cols-[auto_auto] items-center gap-x-6 gap-y-2 text-body">
- <dt className="text-caption text-muted-foreground">{t.statusLabel}</dt>
- <dd className="flex items-center gap-1.5">
- <span
- aria-hidden
- className={cn(
- "size-3 rounded-full border-2 transition-colors",
- status === "todo" ? "border-muted-foreground" : "border-warning bg-warning/40",
- )}
- />
- <span key={status} className="motion-safe:animate-in motion-safe:fade-in">
- {t.status[status]}
- </span>
- </dd>
- <dt className="text-caption text-muted-foreground">{t.assigneeLabel}</dt>
- <dd className="flex items-center gap-1.5">
- <DemoAvatar name={t.bot} agent />
- {t.bot}
- </dd>
- <dt className="text-caption text-muted-foreground">{t.creatorLabel}</dt>
- <dd className="flex items-center gap-1.5">
- <DemoAvatar name={t.you} />
- {t.you}
- </dd>
- </dl>
- <p className="rounded-lg border bg-background px-3 py-2 text-body">{t.description}</p>
- <DemoRun agent={t.bot} status={queued ? t.queued : t.running} active>
- {t.steps.slice(0, stepsShown).map((step, i) => (
- <DemoStep key={step} state={i === stepsShown - 1 ? "running" : "done"}>
- {step}
- </DemoStep>
- ))}
- </DemoRun>
+ >
+ {t.tabs[m]}
+ </button>
+ ))}
</div>
- )}
- </DemoFrame>
+ }
+ caption={t.captions[cmd]}
+ >
+ <svg viewBox="0 0 640 212" className="block h-auto w-full select-none" role="img" aria-label={t.title}>
+ <defs>
+ <marker id="cc-hi" viewBox="0 0 8 8" refX="7" refY="4" markerWidth="6" markerHeight="6" orient="auto">
+ <path d="M0 1 L7 4 L0 7" fill="none" stroke="var(--primary)" strokeWidth="1.4" strokeLinecap="round" strokeLinejoin="round" />
+ </marker>
+ </defs>
+
+ {/* Left: External Chat Channel */}
+ <rect x="12" y="14" width="218" height="134" rx="5" fill="var(--background)" stroke="var(--border)" />
+ <text x="24" y="33" fill="var(--muted-foreground)" fontFamily="var(--font-mono)" fontSize="8.5" letterSpacing="0.5">
+ {t.channelZone}
+ </text>
+ <rect x="24" y="48" width="194" height="68" rx="4" fill="var(--accent)" stroke="var(--primary)" strokeWidth="1.4" />
+ <text x="34" y="70" fill="var(--primary)" fontFamily="var(--font-mono)" fontSize="10" fontWeight="600">
+ {isIssue ? "/issue" : "@mention"}
+ </text>
+ <text x="34" y="92" fill="var(--foreground)" fontSize="11" fontWeight="500">
+ {(isIssue ? t.msgIssue : t.msgMention).slice(0, 28)}
+ </text>
+
+ {/* Middle: Bridge */}
+ <path d="M230 82 H268" fill="none" stroke="var(--primary)" strokeWidth="1.6" markerEnd="url(#cc-hi)" />
+ <rect x="270" y="50" width="126" height="64" rx="4" fill="var(--card)" stroke="var(--border)" />
+ <text x="333" y="76" textAnchor="middle" fill="var(--foreground)" fontSize="12" fontWeight="600">
+ {t.bridgeTitle}
+ </text>
+ <text x="333" y="96" textAnchor="middle" fill="var(--muted-foreground)" fontSize="9.5">
+ {t.bridgeSub}
+ </text>
+ <path d="M396 82 H432" fill="none" stroke="var(--primary)" strokeWidth="1.6" markerEnd="url(#cc-hi)" />
+
+ {/* Right: Multica Workspace Result */}
+ <rect x="434" y="14" width="194" height="134" rx="5" fill="var(--background)" stroke="var(--border)" />
+ <text x="446" y="33" fill="var(--muted-foreground)" fontFamily="var(--font-mono)" fontSize="9" letterSpacing="0.7">
+ {t.multicaZone}
+ </text>
+ <rect x="446" y="48" width="170" height="68" rx="4" fill="var(--accent)" stroke="var(--primary)" strokeWidth="1.4" />
+ <text x="456" y="72" fill="var(--foreground)" fontSize="12" fontWeight="600">
+ {isIssue ? t.issueResultTitle : t.chatResultTitle}
+ </text>
+ <text x="456" y="94" fill="var(--muted-foreground)" fontSize="10">
+ {(isIssue ? t.issueResultSub : t.chatResultSub).slice(0, 26)}
+ </text>
+
+ {/* Return loop */}
+ <path
+ d="M530 148 V186 H120 V150"
+ fill="none"
+ stroke="var(--primary)"
+ strokeWidth="1.4"
+ strokeDasharray="4 3"
+ markerEnd="url(#cc-hi)"
+ />
+ <rect x="208" y="176" width="224" height="20" rx="3" fill="var(--card)" />
+ <text x="320" y="189" textAnchor="middle" fill="var(--primary)" fontSize="10.5" fontWeight="500">
+ {t.replyLoop}
+ </text>
+ </svg>
+ </EditorialFigure>
);
}
diff --git a/apps/docs/components/demos/chat-demo.tsx b/apps/docs/components/demos/chat-demo.tsx
index ea322cab2a..af6af900df 100644
--- a/apps/docs/components/demos/chat-demo.tsx
+++ b/apps/docs/components/demos/chat-demo.tsx
@@ -1,447 +1,47 @@
"use client";
-import { type ReactNode, useState } from "react";
-import { CircleDashed, Loader2 } from "@multica/ui/icons";
-import { CoachMark, DemoAvatar, DemoFrame, DemoSendButton, useDemoCopy, useDemoTimers, useStartWhenVisible } from "./demo-kit";
-
-type Suggestion = { label: string; prompt: string };
-type DueIssue = { id: string; title: string; due: string; assignee: string };
+import { CLIP_MANIFEST } from "./clip-manifest";
+import { EditorialClip, useDemoCopy } from "./demo-kit";
const copy = {
en: {
- title: "Chat · Ops helper",
- agent: "Ops helper",
- heading: "Chat with Ops helper",
- description: "Handles office and operations chores: checks progress, plans schedules, files issues.",
- startersLabel: "Conversation starters",
- starters: [
- {
- label: "What's due this week?",
- prompt: "List the issues due this week that aren't done yet, sorted by due date, with their assignees.",
- },
- { label: "Sum up yesterday's customer feedback", prompt: "Sum up yesterday's customer feedback in five points." },
- { label: "Plan my day", prompt: "Look at my open issues and suggest an order for today." },
- ] as Suggestion[],
- placeholder: "Message Ops helper...",
- send: "Send",
- thinking: "Thinking",
- runningCommand: "Running a command",
- repliedIn: (elapsed: string) => `Replied in ${elapsed}`,
- replyTimes: ["12s", "9s"],
- dueIntro: "Three issues are due this week and none is done yet:",
- due: [
- { id: "OPS-32", title: "Buy gifts for the annual party", due: "Wed", assignee: "Lei Li" },
- { id: "OPS-33", title: "Update the staff directory", due: "Thu", assignee: "You" },
- { id: "OPS-34", title: "Submit Q3 expense claims", due: "Fri", assignee: "Lei Li" },
- ] as DueIssue[],
- dueOutro: "OPS-34 is still missing two invoices.",
- followUpsHeading: "Follow-up questions",
- followUps: [
- {
- label: "Create an issue to chase the missing invoices",
- prompt:
- "Create an issue: collect the two invoices OPS-34 is missing, assign it to me, due this Thursday.",
- },
- { label: "Which issues are overdue?", prompt: "Which issues are overdue?" },
- ] as Suggestion[],
- createdReply: "Done. I created the issue, assigned it to you and set it due Thursday:",
- created: { id: "OPS-35", title: "Collect the missing invoices for OPS-34", status: "Todo" },
- captions: {
- idle: "A new chat with an agent. Nobody else can see it.",
- start: "Before the first message, the agent's suggestions are shown. Pick the first one.",
- filled: "The suggestion went into the composer and was not sent, so you can adjust it first. Click send.",
- replying: "The agent looks this up in the workspace with the Multica CLI. The chat isn't tied to any issue.",
- replied:
- "The agent answered without creating anything. Click the follow-up to ask it to create an issue: a follow-up is sent right away.",
- creating: "You asked it explicitly, so the agent acts with your workspace access and creates the issue.",
- done: "The issue is created, and the chat stays private to you. Use Replay to watch again.",
- },
+ title: "Chat 1:1 with an agent",
+ chapters: ["Send prompt", "Agent runs", "Structured reply"],
+ caption: "Each chat message triggers a private run against the agent's local runtime without creating an issue.",
},
zh: {
- title: "对话 · 运营助手",
- agent: "运营助手",
- heading: "与 运营助手 对话",
- description: "负责行政和运营杂务:查进度、排日程、建任务。",
- startersLabel: "对话开场建议",
- starters: [
- { label: "这周有哪些任务要到期?", prompt: "列出这周到期、还没完成的任务,按截止日期排序,并注明负责人。" },
- { label: "总结昨天的客户反馈", prompt: "把昨天的客户反馈总结成五条要点。" },
- { label: "规划我的今天", prompt: "看看我手上还没完成的任务,建议今天按什么顺序处理。" },
- ] as Suggestion[],
- placeholder: "给 运营助手 发消息...",
- send: "发送",
- thinking: "思考中",
- runningCommand: "执行命令",
- repliedIn: (elapsed: string) => `${elapsed} 内回复`,
- replyTimes: ["12s", "9s"],
- dueIntro: "这周有 3 个任务到期,都还没完成:",
- due: [
- { id: "OPS-32", title: "采购年会礼品", due: "周三", assignee: "李雷" },
- { id: "OPS-33", title: "更新员工通讯录", due: "周四", assignee: "你" },
- { id: "OPS-34", title: "提交三季度报销", due: "周五", assignee: "李雷" },
- ] as DueIssue[],
- dueOutro: "其中 OPS-34 还缺两张发票。",
- followUpsHeading: "后续提问",
- followUps: [
- {
- label: "建一个任务去催缺的发票",
- prompt: "帮我建一个任务:催齐 OPS-34 缺的两张发票,负责人设为我,本周四截止。",
- },
- { label: "哪些任务已经逾期?", prompt: "哪些任务已经逾期?" },
- ] as Suggestion[],
- createdReply: "已经建好,负责人是你,周四截止:",
- created: { id: "OPS-35", title: "催齐 OPS-34 缺的发票", status: "待办" },
- captions: {
- idle: "和智能体新开的一段对话,只有你能看到。",
- start: "发送第一条消息前,这里列出智能体的开场建议。选择第一条。",
- filled: "建议填进了输入框,没有发送,可以先改。点击发送。",
- replying: "智能体用 Multica CLI 查询工作区。这段对话不绑定任何任务。",
- replied: "智能体只回答了问题,没有建任何东西。点击后续提问请它建任务,后续提问点了就会发送。",
- creating: "你明确提出了要求,智能体以你的工作区权限代你建任务。",
- done: "任务建好了,这段对话仍然只有你能看到。点右上角可以重新演示。",
- },
+ title: "与智能体一对一对话",
+ chapters: ["发送提问", "实时执行", "返回结构化答复"],
+ caption: "每条对话消息都会在智能体绑定的本地运行时上触发一次私有运行,无需为此新建任务。",
+ },
+ "zh-Hant": {
+ title: "與智能體一對一對話",
+ chapters: ["發送提問", "即時執行", "返回結構化回覆"],
+ caption: "每條對話訊息都會在綁定的本機執行環境觸發一次私人執行,無需建立任務。",
},
ja: {
- title: "チャット · 運用アシスタント",
- agent: "運用アシスタント",
- heading: "運用アシスタント とチャット",
- description: "総務と運用の雑務を担当します。進捗の確認、予定の調整、タスクの作成など。",
- startersLabel: "会話の開始例",
- starters: [
- {
- label: "今週が期限のタスクは?",
- prompt: "今週が期限でまだ完了していないタスクを、期限の早い順に、担当者も添えて一覧にしてください。",
- },
- { label: "昨日の顧客フィードバックをまとめる", prompt: "昨日の顧客フィードバックを 5 つの要点にまとめてください。" },
- { label: "今日の段取りを決める", prompt: "私の未完了のタスクを見て、今日取りかかる順番を提案してください。" },
- ] as Suggestion[],
- placeholder: "運用アシスタント にメッセージ…",
- send: "送信",
- thinking: "考え中",
- runningCommand: "コマンドを実行中",
- repliedIn: (elapsed: string) => `${elapsed}で返信`,
- replyTimes: ["12s", "9s"],
- dueIntro: "今週が期限のタスクは 3 件で、どれもまだ完了していません:",
- due: [
- { id: "OPS-32", title: "年次パーティーの記念品を購入", due: "水", assignee: "李雷" },
- { id: "OPS-33", title: "社員名簿を更新", due: "木", assignee: "あなた" },
- { id: "OPS-34", title: "第 3 四半期の経費精算を提出", due: "金", assignee: "李雷" },
- ] as DueIssue[],
- dueOutro: "OPS-34 はまだ領収書が 2 枚足りません。",
- followUpsHeading: "フォローアップ質問",
- followUps: [
- {
- label: "足りない領収書を集めるタスクを作成",
- prompt: "タスクを作成してください:OPS-34 で足りない領収書 2 枚を集める。担当は私、期限は今週の木曜日。",
- },
- { label: "期限を過ぎたタスクは?", prompt: "期限を過ぎたタスクは?" },
- ] as Suggestion[],
- createdReply: "作成しました。担当者はあなた、期限は木曜日です:",
- created: { id: "OPS-35", title: "OPS-34 で足りない領収書を集める", status: "未着手" },
- captions: {
- idle: "エージェントと新しく始めたチャットです。ほかの人には見えません。",
- start: "最初のメッセージを送る前は、エージェントの開始例が表示されます。最初の例を選びます。",
- filled: "開始例は入力欄に入っただけで、送信はされていません。先に手直しできます。送信をクリックします。",
- replying: "エージェントは Multica CLI でワークスペースを調べます。このチャットはどのタスクにも紐づいていません。",
- replied:
- "エージェントは質問に答えただけで、何も作成していません。フォローアップ質問をクリックしてタスクの作成を頼みます。フォローアップ質問はクリックするとすぐ送信されます。",
- creating: "はっきり頼んだので、エージェントはあなたのワークスペース権限でタスクを作成します。",
- done: "タスクができました。チャットは引き続きあなたにしか見えません。「もう一度」で最初から見られます。",
- },
+ title: "エージェントと 1 対 1 でチャットする",
+ chapters: ["質問を送信", "エージェント実行", "構造化された回答"],
+ caption: "タスクを作らずにチャットで直接質問でき、メッセージごとにプライベートな実行が走ります。",
},
ko: {
- title: "채팅 · 운영 도우미",
- agent: "운영 도우미",
- heading: "운영 도우미와 채팅",
- description: "사무와 운영 잡무를 맡습니다. 진행 상황 확인, 일정 조율, 태스크 생성 등.",
- startersLabel: "대화 시작 예시",
- starters: [
- {
- label: "이번 주에 마감되는 태스크는?",
- prompt: "이번 주가 마감이고 아직 끝나지 않은 태스크를 마감일 순으로, 담당자와 함께 보여 주세요.",
- },
- { label: "어제 고객 피드백 요약", prompt: "어제 들어온 고객 피드백을 다섯 가지 요점으로 요약해 주세요." },
- { label: "오늘 할 일 순서 정하기", prompt: "내가 맡은 미완료 태스크를 보고 오늘 처리할 순서를 제안해 주세요." },
- ] as Suggestion[],
- placeholder: "운영 도우미에게 메시지 보내기…",
- send: "보내기",
- thinking: "생각 중",
- runningCommand: "명령 실행 중",
- repliedIn: (elapsed: string) => `${elapsed} 만에 답변`,
- replyTimes: ["12s", "9s"],
- dueIntro: "이번 주에 마감되는 태스크가 3개 있고, 모두 아직 완료되지 않았습니다:",
- due: [
- { id: "OPS-32", title: "연례 파티 기념품 구매", due: "수", assignee: "리레이" },
- { id: "OPS-33", title: "직원 연락처 업데이트", due: "목", assignee: "나" },
- { id: "OPS-34", title: "3분기 경비 청구 제출", due: "금", assignee: "리레이" },
- ] as DueIssue[],
- dueOutro: "OPS-34는 아직 영수증 두 장이 빠져 있습니다.",
- followUpsHeading: "후속 질문",
- followUps: [
- {
- label: "빠진 영수증을 받을 태스크 만들기",
- prompt: "태스크를 만들어 주세요: OPS-34에 빠진 영수증 두 장 받기, 담당자는 나, 마감은 이번 주 목요일.",
- },
- { label: "기한이 지난 태스크는?", prompt: "기한이 지난 태스크는?" },
- ] as Suggestion[],
- createdReply: "태스크를 만들어 담당자로 지정했고, 마감은 목요일입니다:",
- created: { id: "OPS-35", title: "OPS-34의 빠진 영수증 받기", status: "할 일" },
- captions: {
- idle: "에이전트와 새로 시작한 채팅입니다. 다른 사람은 볼 수 없습니다.",
- start: "첫 메시지를 보내기 전에는 에이전트의 대화 시작 예시가 표시됩니다. 첫 번째 예시를 선택하세요.",
- filled: "예시는 입력란에 채워졌을 뿐 전송되지 않았으니 먼저 고칠 수 있습니다. 보내기를 클릭하세요.",
- replying: "에이전트가 Multica CLI로 워크스페이스를 조회합니다. 이 채팅은 어떤 태스크에도 묶여 있지 않습니다.",
- replied:
- "에이전트는 질문에 답하기만 했고 아무것도 만들지 않았습니다. 후속 질문을 클릭해 태스크 생성을 요청하세요. 후속 질문은 클릭하면 바로 전송됩니다.",
- creating: "명시적으로 요청했으므로 에이전트가 내 워크스페이스 권한으로 태스크를 만듭니다.",
- done: "태스크가 만들어졌고, 채팅은 여전히 나만 볼 수 있습니다. '다시 보기'로 다시 볼 수 있습니다.",
- },
+ title: "에이전트와 1:1 채팅하기",
+ chapters: ["질문 보내기", "에이전트 실행", "구조화된 답변"],
+ caption: "태스크를 만들지 않고도 메시지만 보내면 연결된 런타임에서 비공개 실행이 돌아갑니다.",
},
fr: {
- title: "Discussion · Assistant ops",
- agent: "Assistant ops",
- heading: "Discuter avec Assistant ops",
- description: "S'occupe des tâches administratives et opérationnelles : suivi d'avancement, planning, création de tâches.",
- startersLabel: "Amorces de conversation",
- starters: [
- {
- label: "Qu'est-ce qui arrive à échéance cette semaine ?",
- prompt:
- "Listez les tâches à échéance cette semaine qui ne sont pas terminées, triées par date d'échéance, avec leurs assignés.",
- },
- { label: "Résumer les retours clients d'hier", prompt: "Résumez les retours clients d'hier en cinq points." },
- { label: "Planifier ma journée", prompt: "Regardez mes tâches en cours et proposez un ordre pour aujourd'hui." },
- ] as Suggestion[],
- placeholder: "Écrire à Assistant ops…",
- send: "Envoyer",
- thinking: "Réflexion",
- runningCommand: "Exécution d'une commande",
- repliedIn: (elapsed: string) => `Réponse en ${elapsed}`,
- replyTimes: ["12s", "9s"],
- dueIntro: "Trois tâches arrivent à échéance cette semaine, et aucune n'est terminée :",
- due: [
- { id: "OPS-32", title: "Acheter les cadeaux de la soirée annuelle", due: "mer.", assignee: "Lei Li" },
- { id: "OPS-33", title: "Mettre à jour l'annuaire du personnel", due: "jeu.", assignee: "Vous" },
- { id: "OPS-34", title: "Soumettre les notes de frais du T3", due: "ven.", assignee: "Lei Li" },
- ] as DueIssue[],
- dueOutro: "Il manque encore deux factures pour OPS-34.",
- followUpsHeading: "Questions de suivi",
- followUps: [
- {
- label: "Créer une tâche pour récupérer les factures manquantes",
- prompt:
- "Créez une tâche : récupérer les deux factures qui manquent à OPS-34, assignée à moi, à échéance ce jeudi.",
- },
- { label: "Quelles tâches sont en retard ?", prompt: "Quelles tâches sont en retard ?" },
- ] as Suggestion[],
- createdReply: "C'est fait. J'ai créé la tâche, je vous l'ai assignée, échéance jeudi :",
- created: { id: "OPS-35", title: "Récupérer les factures manquantes d'OPS-34", status: "À faire" },
- captions: {
- idle: "Une nouvelle discussion avec un agent. Personne d'autre ne la voit.",
- start: "Avant le premier message, les suggestions de l'agent s'affichent. Choisissez la première.",
- filled:
- "La suggestion est dans la zone de saisie, pas encore envoyée : vous pouvez l'ajuster d'abord. Cliquez sur envoyer.",
- replying:
- "L'agent consulte l'espace de travail avec la CLI Multica. La discussion n'est liée à aucune tâche.",
- replied:
- "L'agent a répondu sans rien créer. Cliquez sur la question de suivi pour lui demander de créer une tâche : une question de suivi part dès le clic.",
- creating:
- "Vous l'avez demandé explicitement : l'agent agit avec vos droits dans l'espace de travail et crée la tâche.",
- done: "La tâche est créée, et la discussion reste visible de vous seul. Utilisez Rejouer pour revoir la démo.",
- },
+ title: "Discuter en direct avec un agent",
+ chapters: ["Envoyer un message", "Exécution", "Réponse structurée"],
+ caption: "Chaque message lance une exécution privée sur le runtime de l'agent sans créer de tâche.",
},
};
-type Phase = "idle" | "start" | "filled" | "replying" | "replied" | "creating" | "done";
-type Pill = "thinking" | "command" | null;
-
export function ChatDemo() {
const t = useDemoCopy(copy);
- const { after, clear } = useDemoTimers();
- const [frameRef, visible] = useStartWhenVisible<HTMLElement>();
- const [phase, setPhase] = useState<Exclude<Phase, "idle">>("start");
- const [pill, setPill] = useState<Pill>(null);
-
- const shownPhase: Phase = visible ? phase : "idle";
- const starter = t.starters[0]!;
- const followUp = t.followUps[0]!;
- const asked = phase !== "start" && phase !== "filled";
- const followedUp = phase === "creating" || phase === "done";
-
- // One agent turn: a short status pill, then the reply lands in `next`.
- const runTurn = (next: Exclude<Phase, "idle">) => {
- setPill("thinking");
- after(900, () => setPill("command"));
- after(2300, () => {
- setPill(null);
- setPhase(next);
- });
- };
-
- const send = () => {
- setPhase("replying");
- runTurn("replied");
- };
-
- const askFollowUp = () => {
- setPhase("creating");
- runTurn("done");
- };
-
- const replay = () => {
- clear();
- setPhase("start");
- setPill(null);
- };
-
- return (
- <DemoFrame frameRef={frameRef} title={t.title} caption={t.captions[shownPhase]} onReplay={replay}>
- <div className="flex min-h-96 flex-col gap-3 p-4">
- {!asked ? (
- <div className="flex flex-1 flex-col items-center justify-center gap-4 py-2">
- <div className="max-w-sm space-y-1 text-center">
- <div className="flex justify-center pb-1">
- <span className="inline-flex size-9 items-center justify-center rounded-full bg-brand/12 ring-1 ring-border ring-inset">
- <DemoAvatar name={t.agent} agent />
- </span>
- </div>
- <div className="text-title-sm font-semibold">{t.heading}</div>
- <p className="text-body text-muted-foreground">{t.description}</p>
- </div>
- <div aria-label={t.startersLabel} className="w-full max-w-sm space-y-2">
- {t.starters.map((item, i) => (
- <CoachMark
- key={item.label}
- active={visible && phase === "start" && i === 0}
- side="right"
- ringClassName="rounded-lg"
- className="flex w-full"
- >
- <button
- type="button"
- disabled={!visible || phase !== "start" || i !== 0}
- onClick={() => setPhase("filled")}
- className="w-full rounded-lg border bg-card px-3 py-2.5 text-left text-body hover:border-brand/40 hover:bg-accent disabled:opacity-60 disabled:hover:border-border disabled:hover:bg-card"
- >
- {item.label}
- </button>
- </CoachMark>
- ))}
- </div>
- </div>
- ) : (
- <div className="flex flex-col gap-3">
- <UserMessage>{starter.prompt}</UserMessage>
- {phase === "replying" ? (
- <StatusPill pill={pill} t={t} />
- ) : (
- <AgentMessage name={t.agent} meta={t.repliedIn(t.replyTimes[0]!)}>
- <p>{t.dueIntro}</p>
- <ul className="mt-1 flex flex-col gap-0.5">
- {t.due.map((issue) => (
- <li key={issue.id} className="flex min-w-0 gap-2">
- <span className="shrink-0 text-muted-foreground">{issue.id}</span>
- <span className="min-w-0 truncate">{issue.title}</span>
- <span className="ml-auto shrink-0 text-caption text-muted-foreground">
- {issue.due} · {issue.assignee}
- </span>
- </li>
- ))}
- </ul>
- <p className="mt-1">{t.dueOutro}</p>
- </AgentMessage>
- )}
-
- {phase === "replied" && (
- <div className="flex flex-col gap-1.5 pl-7 motion-safe:animate-in motion-safe:fade-in">
- <div className="text-caption text-muted-foreground">{t.followUpsHeading}</div>
- <div className="flex flex-wrap gap-1.5">
- {t.followUps.map((item, i) => (
- <CoachMark
- quiet
- key={item.label}
- active={i === 0}
- ringClassName="rounded-full"
- >
- <button
- type="button"
- disabled={i !== 0}
- onClick={askFollowUp}
- className="rounded-full border bg-background px-3 py-1 text-caption hover:bg-accent disabled:opacity-60 disabled:hover:bg-background"
- >
- {item.label}
- </button>
- </CoachMark>
- ))}
- </div>
- </div>
- )}
-
- {followedUp && <UserMessage>{followUp.prompt}</UserMessage>}
- {phase === "creating" && <StatusPill pill={pill} t={t} />}
- {phase === "done" && (
- <AgentMessage name={t.agent} meta={t.repliedIn(t.replyTimes[1]!)}>
- <p>{t.createdReply}</p>
- <div className="mt-1.5 flex min-w-0 items-center gap-2 rounded-lg border bg-background px-3 py-2">
- <CircleDashed aria-hidden className="size-3.5 shrink-0 text-muted-foreground" />
- <span className="shrink-0 text-caption text-muted-foreground">{t.created.id}</span>
- <span className="min-w-0 truncate text-label font-medium">{t.created.title}</span>
- <span className="ml-auto shrink-0 text-caption text-muted-foreground">{t.created.status}</span>
- </div>
- </AgentMessage>
- )}
- </div>
- )}
-
- <div className="mt-auto rounded-lg border bg-background p-2">
- <div className="min-h-10 px-1 text-body">
- {phase === "filled" ? (
- <span className="motion-safe:animate-in motion-safe:fade-in">{starter.prompt}</span>
- ) : (
- <span className="text-muted-foreground">{t.placeholder}</span>
- )}
- </div>
- <div className="mt-1.5 flex items-center">
- <span className="ml-auto" />
- <CoachMark active={phase === "filled"} side="left" ringClassName="rounded-full">
- <DemoSendButton label={t.send} disabled={phase !== "filled"} onClick={send} />
- </CoachMark>
- </div>
- </div>
- </div>
- </DemoFrame>
- );
-}
-
-function UserMessage({ children }: { children: ReactNode }) {
- return (
- <div className="flex justify-end motion-safe:animate-in motion-safe:fade-in motion-safe:slide-in-from-bottom-1">
- <div className="max-w-[85%] rounded-2xl bg-muted px-3 py-2 text-body break-words">{children}</div>
- </div>
- );
-}
-
-function AgentMessage({ name, meta, children }: { name: string; meta: string; children: ReactNode }) {
- return (
- <div className="min-w-0 motion-safe:animate-in motion-safe:fade-in">
- <div className="flex items-center gap-2">
- <DemoAvatar name={name} agent />
- <span className="text-label font-medium">{name}</span>
- <span className="text-caption text-muted-foreground">{meta}</span>
- </div>
- <div className="mt-1 pl-7 text-body break-words">{children}</div>
- </div>
- );
-}
-
-function StatusPill({ pill, t }: { pill: Pill; t: { thinking: string; runningCommand: string } }) {
- if (!pill) return null;
- return (
- <div className="pl-7">
- <span className="inline-flex items-center gap-1.5 rounded-full bg-muted px-2.5 py-1 text-caption text-muted-foreground motion-safe:animate-in motion-safe:fade-in">
- <Loader2 aria-hidden className="size-3 text-brand motion-safe:animate-spin" />
- {pill === "thinking" ? t.thinking : t.runningCommand}
- </span>
- </div>
- );
+ const meta = CLIP_MANIFEST.chat ?? { duration: 6.5, chapters: [] };
+ const chapters = t.chapters.map((label, i) => ({
+ label,
+ at: meta.chapters[i]?.at ?? (i * meta.duration) / t.chapters.length,
+ }));
+ return <EditorialClip slug="chat" title={t.title} chapters={chapters} duration={meta.duration} caption={t.caption} />;
}
diff --git a/apps/docs/components/demos/clip-manifest.ts b/apps/docs/components/demos/clip-manifest.ts
new file mode 100644
index 0000000000..2e9ffb1a20
--- /dev/null
+++ b/apps/docs/components/demos/clip-manifest.ts
@@ -0,0 +1,666 @@
+// Auto-generated by scripts/docs-demos/record.mjs — do not edit by hand.
+export interface ClipManifestTiming {
+ duration: number;
+ chapters: { id: string; at: number }[];
+}
+
+export interface ClipManifestEntry extends ClipManifestTiming {
+ dark?: ClipManifestTiming;
+}
+
+export const CLIP_MANIFEST: Record<string, ClipManifestEntry> = {
+ "mention": {
+ "duration": 7.6,
+ "chapters": [
+ {
+ "id": "compose",
+ "at": 0.3
+ },
+ {
+ "id": "preview",
+ "at": 3.2
+ },
+ {
+ "id": "reply",
+ "at": 4.9
+ }
+ ],
+ "dark": {
+ "duration": 7.5,
+ "chapters": [
+ {
+ "id": "compose",
+ "at": 0.3
+ },
+ {
+ "id": "preview",
+ "at": 3.2
+ },
+ {
+ "id": "reply",
+ "at": 4.9
+ }
+ ]
+ }
+ },
+ "inbox": {
+ "duration": 9.7,
+ "chapters": [
+ {
+ "id": "unread",
+ "at": 0.6
+ },
+ {
+ "id": "archive",
+ "at": 2.8
+ },
+ {
+ "id": "archived",
+ "at": 4.3
+ }
+ ],
+ "dark": {
+ "duration": 10.6,
+ "chapters": [
+ {
+ "id": "unread",
+ "at": 0.6
+ },
+ {
+ "id": "archive",
+ "at": 3.2
+ },
+ {
+ "id": "archived",
+ "at": 5.2
+ }
+ ]
+ }
+ },
+ "create-agent": {
+ "duration": 6.4,
+ "chapters": [
+ {
+ "id": "start",
+ "at": 0.3
+ },
+ {
+ "id": "runtime",
+ "at": 1.9
+ },
+ {
+ "id": "configure",
+ "at": 4.9
+ }
+ ],
+ "dark": {
+ "duration": 6.4,
+ "chapters": [
+ {
+ "id": "start",
+ "at": 0.3
+ },
+ {
+ "id": "runtime",
+ "at": 1.9
+ },
+ {
+ "id": "configure",
+ "at": 4.9
+ }
+ ]
+ }
+ },
+ "squad": {
+ "duration": 11.1,
+ "chapters": [
+ {
+ "id": "list",
+ "at": 0.3
+ },
+ {
+ "id": "detail",
+ "at": 2
+ },
+ {
+ "id": "workflow",
+ "at": 2.9
+ }
+ ],
+ "dark": {
+ "duration": 11.3,
+ "chapters": [
+ {
+ "id": "list",
+ "at": 0.3
+ },
+ {
+ "id": "detail",
+ "at": 2
+ },
+ {
+ "id": "workflow",
+ "at": 2.9
+ }
+ ]
+ }
+ },
+ "autopilot": {
+ "duration": 7.4,
+ "chapters": [
+ {
+ "id": "list",
+ "at": 0.3
+ },
+ {
+ "id": "detail",
+ "at": 2
+ },
+ {
+ "id": "run",
+ "at": 2.7
+ }
+ ],
+ "dark": {
+ "duration": 11.9,
+ "chapters": [
+ {
+ "id": "list",
+ "at": 0.3
+ },
+ {
+ "id": "detail",
+ "at": 2
+ },
+ {
+ "id": "run",
+ "at": 2.8
+ }
+ ]
+ }
+ },
+ "wakeup": {
+ "duration": 11.3,
+ "chapters": [
+ {
+ "id": "sidebar",
+ "at": 0.3
+ },
+ {
+ "id": "configure",
+ "at": 2.8
+ },
+ {
+ "id": "saved",
+ "at": 9.1
+ }
+ ],
+ "dark": {
+ "duration": 11.3,
+ "chapters": [
+ {
+ "id": "sidebar",
+ "at": 0.3
+ },
+ {
+ "id": "configure",
+ "at": 2.9
+ },
+ {
+ "id": "saved",
+ "at": 9.1
+ }
+ ]
+ }
+ },
+ "pr-link": {
+ "duration": 7.6,
+ "chapters": [
+ {
+ "id": "panel",
+ "at": 0.3
+ },
+ {
+ "id": "add",
+ "at": 2.7
+ },
+ {
+ "id": "synced",
+ "at": 6
+ }
+ ],
+ "dark": {
+ "duration": 7.7,
+ "chapters": [
+ {
+ "id": "panel",
+ "at": 0.3
+ },
+ {
+ "id": "add",
+ "at": 2.7
+ },
+ {
+ "id": "synced",
+ "at": 6
+ }
+ ]
+ }
+ },
+ "usage": {
+ "duration": 4.8,
+ "chapters": [
+ {
+ "id": "overview",
+ "at": 0.3
+ },
+ {
+ "id": "metrics",
+ "at": 1.1
+ },
+ {
+ "id": "errors",
+ "at": 2.5
+ }
+ ],
+ "dark": {
+ "duration": 4.8,
+ "chapters": [
+ {
+ "id": "overview",
+ "at": 0.3
+ },
+ {
+ "id": "metrics",
+ "at": 1.1
+ },
+ {
+ "id": "errors",
+ "at": 2.5
+ }
+ ]
+ }
+ },
+ "assign": {
+ "duration": 7,
+ "chapters": [
+ {
+ "id": "pick",
+ "at": 0.3
+ },
+ {
+ "id": "confirm",
+ "at": 2.5
+ },
+ {
+ "id": "running",
+ "at": 4
+ },
+ {
+ "id": "done",
+ "at": 5.1
+ }
+ ],
+ "dark": {
+ "duration": 7,
+ "chapters": [
+ {
+ "id": "pick",
+ "at": 0.3
+ },
+ {
+ "id": "confirm",
+ "at": 2.5
+ },
+ {
+ "id": "running",
+ "at": 4
+ },
+ {
+ "id": "done",
+ "at": 5.1
+ }
+ ]
+ }
+ },
+ "steer": {
+ "duration": 8.1,
+ "chapters": [
+ {
+ "id": "working",
+ "at": 0.3
+ },
+ {
+ "id": "steer",
+ "at": 1.1
+ },
+ {
+ "id": "redirected",
+ "at": 5.6
+ }
+ ],
+ "dark": {
+ "duration": 8,
+ "chapters": [
+ {
+ "id": "working",
+ "at": 0.3
+ },
+ {
+ "id": "steer",
+ "at": 1.1
+ },
+ {
+ "id": "redirected",
+ "at": 5.5
+ }
+ ]
+ }
+ },
+ "workflow": {
+ "duration": 6.8,
+ "chapters": [
+ {
+ "id": "picker",
+ "at": 0.3
+ },
+ {
+ "id": "handoff",
+ "at": 1.8
+ },
+ {
+ "id": "next",
+ "at": 4.3
+ }
+ ],
+ "dark": {
+ "duration": 6.6,
+ "chapters": [
+ {
+ "id": "picker",
+ "at": 0.3
+ },
+ {
+ "id": "handoff",
+ "at": 1.7
+ },
+ {
+ "id": "next",
+ "at": 4.1
+ }
+ ]
+ }
+ },
+ "issue-status": {
+ "duration": 12,
+ "chapters": [
+ {
+ "id": "backlog",
+ "at": 0.3
+ },
+ {
+ "id": "progress",
+ "at": 4.6
+ },
+ {
+ "id": "done",
+ "at": 8.8
+ }
+ ],
+ "dark": {
+ "duration": 10.4,
+ "chapters": [
+ {
+ "id": "backlog",
+ "at": 0.3
+ },
+ {
+ "id": "progress",
+ "at": 4.8
+ },
+ {
+ "id": "done",
+ "at": 7.2
+ }
+ ]
+ }
+ },
+ "issue-draft": {
+ "duration": 6.6,
+ "chapters": [
+ {
+ "id": "open",
+ "at": 0.3
+ },
+ {
+ "id": "draft",
+ "at": 1.4
+ },
+ {
+ "id": "create",
+ "at": 4.1
+ }
+ ],
+ "dark": {
+ "duration": 6.3,
+ "chapters": [
+ {
+ "id": "open",
+ "at": 0.3
+ },
+ {
+ "id": "draft",
+ "at": 1.4
+ },
+ {
+ "id": "create",
+ "at": 4
+ }
+ ]
+ }
+ },
+ "deliverables": {
+ "duration": 3.7,
+ "chapters": [
+ {
+ "id": "overview",
+ "at": 0.3
+ },
+ {
+ "id": "table",
+ "at": 0.9
+ },
+ {
+ "id": "diff",
+ "at": 1.9
+ }
+ ],
+ "dark": {
+ "duration": 3.7,
+ "chapters": [
+ {
+ "id": "overview",
+ "at": 0.3
+ },
+ {
+ "id": "table",
+ "at": 0.9
+ },
+ {
+ "id": "diff",
+ "at": 1.9
+ }
+ ]
+ }
+ },
+ "resolve-thread": {
+ "duration": 5.2,
+ "chapters": [
+ {
+ "id": "thread",
+ "at": 0.3
+ },
+ {
+ "id": "resolve",
+ "at": 0.9
+ },
+ {
+ "id": "collapsed",
+ "at": 3.7
+ }
+ ],
+ "dark": {
+ "duration": 5.3,
+ "chapters": [
+ {
+ "id": "thread",
+ "at": 0.3
+ },
+ {
+ "id": "resolve",
+ "at": 0.9
+ },
+ {
+ "id": "collapsed",
+ "at": 3.7
+ }
+ ]
+ }
+ },
+ "chat": {
+ "duration": 6.3,
+ "chapters": [
+ {
+ "id": "prompt",
+ "at": 0.3
+ },
+ {
+ "id": "thinking",
+ "at": 3.7
+ },
+ {
+ "id": "reply",
+ "at": 4.5
+ }
+ ],
+ "dark": {
+ "duration": 6.3,
+ "chapters": [
+ {
+ "id": "prompt",
+ "at": 0.3
+ },
+ {
+ "id": "thinking",
+ "at": 3.6
+ },
+ {
+ "id": "reply",
+ "at": 4.5
+ }
+ ]
+ }
+ },
+ "project": {
+ "duration": 3.4,
+ "chapters": [
+ {
+ "id": "overview",
+ "at": 0.3
+ },
+ {
+ "id": "issues",
+ "at": 1
+ },
+ {
+ "id": "resources",
+ "at": 2.6
+ }
+ ],
+ "dark": {
+ "duration": 3.3,
+ "chapters": [
+ {
+ "id": "overview",
+ "at": 0.3
+ },
+ {
+ "id": "issues",
+ "at": 1
+ },
+ {
+ "id": "resources",
+ "at": 2.6
+ }
+ ]
+ }
+ },
+ "skill": {
+ "duration": 4.7,
+ "chapters": [
+ {
+ "id": "list",
+ "at": 0.3
+ },
+ {
+ "id": "detail",
+ "at": 2.2
+ },
+ {
+ "id": "mounted",
+ "at": 3.1
+ }
+ ],
+ "dark": {
+ "duration": 4.6,
+ "chapters": [
+ {
+ "id": "list",
+ "at": 0.3
+ },
+ {
+ "id": "detail",
+ "at": 2.2
+ },
+ {
+ "id": "mounted",
+ "at": 3.1
+ }
+ ]
+ }
+ },
+ "quick-action": {
+ "duration": 4.2,
+ "chapters": [
+ {
+ "id": "sidebar",
+ "at": 0.3
+ },
+ {
+ "id": "trigger",
+ "at": 0.9
+ },
+ {
+ "id": "run",
+ "at": 2
+ }
+ ],
+ "dark": {
+ "duration": 4.2,
+ "chapters": [
+ {
+ "id": "sidebar",
+ "at": 0.3
+ },
+ {
+ "id": "trigger",
+ "at": 0.9
+ },
+ {
+ "id": "run",
+ "at": 2
+ }
+ ]
+ }
+ }
+};
diff --git a/apps/docs/components/demos/concept-map-demo.tsx b/apps/docs/components/demos/concept-map-demo.tsx
index 42a47a793c..3a9c2af137 100644
--- a/apps/docs/components/demos/concept-map-demo.tsx
+++ b/apps/docs/components/demos/concept-map-demo.tsx
@@ -1,722 +1,442 @@
"use client";
import { useState } from "react";
-import { CornerDownRight } from "@multica/ui/icons";
-import { cn } from "@multica/ui/lib/utils";
+import { ArrowRight } from "@multica/ui/icons";
import { LocaleLink } from "@/components/locale-link";
-import { CoachMark, DemoFrame, useDemoCopy, useStartWhenVisible } from "./demo-kit";
+import { EditorialFigure, useDemoCopy } from "./demo-kit";
type NodeId =
- | "workspace"
- | "issue"
| "project"
+ | "issue"
+ | "triggers"
+ | "skills"
+ | "squad"
| "agent"
- | "skill"
- | "runtime"
| "run"
- | "squad"
- | "chat"
- | "inbox"
- | "autopilot";
-
-type MapNode = Exclude<NodeId, "workspace">;
-
-type EdgeId =
- | "project_issue"
- | "issue_agent"
- | "chat_agent"
- | "autopilot_agent"
- | "agent_run"
- | "run_runtime"
- | "run_issue"
- | "run_chat"
- | "skill_agent"
- | "squad_agent"
- | "squad_issue"
- | "issue_inbox";
-
-type NodeCopy = { name: string; desc: string; page: string };
+ | "runtime"
+ | "inbox";
-// Positions on the wide map, in percent of its width and height.
-const POSITION: Record<MapNode, [number, number]> = {
- project: [12, 24],
- issue: [12, 48],
- chat: [12, 71],
- autopilot: [12, 90],
- inbox: [31, 24],
- squad: [50, 24],
- skill: [70, 24],
- agent: [48, 52],
- run: [72, 52],
- runtime: [90, 52],
+type NodeCopy = {
+ code: string;
+ name: string;
+ desc: string;
+ page: string;
+ href: string;
};
-// Write-back edges curve below the agent so they do not run through it.
-const EDGES: { id: EdgeId; from: MapNode; to: MapNode; curve?: [number, number]; dashed?: boolean }[] = [
- { id: "project_issue", from: "project", to: "issue" },
- { id: "issue_agent", from: "issue", to: "agent" },
- { id: "chat_agent", from: "chat", to: "agent" },
- { id: "autopilot_agent", from: "autopilot", to: "agent" },
- { id: "agent_run", from: "agent", to: "run" },
- { id: "run_runtime", from: "run", to: "runtime" },
- { id: "run_issue", from: "run", to: "issue", curve: [44, 92], dashed: true },
- { id: "run_chat", from: "run", to: "chat", curve: [46, 102], dashed: true },
- { id: "skill_agent", from: "skill", to: "agent" },
- { id: "squad_agent", from: "squad", to: "agent" },
- { id: "squad_issue", from: "squad", to: "issue" },
- { id: "issue_inbox", from: "issue", to: "inbox" },
+const EDGES: { from: NodeId; to: NodeId; main?: boolean }[] = [
+ { from: "project", to: "issue" },
+ { from: "triggers", to: "agent" },
+ { from: "skills", to: "agent" },
+ { from: "squad", to: "agent" },
+ { from: "issue", to: "agent", main: true },
+ { from: "agent", to: "run", main: true },
+ { from: "run", to: "runtime", main: true },
+ { from: "runtime", to: "issue", main: true },
+ { from: "issue", to: "inbox" },
];
-const MAP_NODES = Object.keys(POSITION) as MapNode[];
-
-// The main line the coach mark walks the reader along, as on "How Multica works".
-const GUIDE: MapNode[] = ["issue", "agent", "run", "runtime"];
-
-const GROUPS: { key: "basic" | "execution" | "collaboration"; nodes: NodeId[] }[] = [
- { key: "basic", nodes: ["workspace", "issue", "project"] },
- { key: "execution", nodes: ["agent", "skill", "runtime", "run"] },
- { key: "collaboration", nodes: ["squad", "chat", "inbox", "autopilot"] },
-];
+const MAIN_PATH = new Set<NodeId>(["issue", "agent", "run", "runtime"]);
const copy = {
en: {
- title: "Core objects and how they relate",
- groups: { basic: "Basic objects", execution: "Agents and execution", collaboration: "Collaboration and automation" },
+ kicker: "ARCHITECTURE",
+ title: "Core objects and execution flow",
+ cols: ["01 · WORK & TRIGGERS", "02 · ORCHESTRATION", "03 · LOCAL EXECUTION"],
+ edgeLabels: {
+ trigger: "assign / @",
+ create: "creates",
+ claim: "claims",
+ writeback: "logs, comments & PRs written back",
+ notify: "notifies",
+ },
+ hint: "Click any object to inspect its role and connected paths.",
+ seeDoc: "Read",
nodes: {
- workspace: {
- name: "Workspace",
- desc: "The self-contained scope where a team works together; all work and configuration happen inside it. Humans and agents collaborate in the same workspace.",
- page: "Workspaces",
- },
- issue: {
- name: "Issue",
- desc: "A piece of work to be done, plus the description, discussion, status, and history that accumulate around it. The assignee can be a member, an agent, or a squad.",
- page: "Issues",
- },
- project: {
- name: "Project",
- desc: "Organizes related issues under one goal, tracks overall progress, and can bind resources such as repositories and directories for use during execution.",
- page: "Projects",
- },
- agent: {
- name: "Agent",
- desc: "An AI collaborator in the workspace — a reusable configuration: name, instructions, model, skills, Access, and runtime. It executes only when triggered.",
- page: "Agents",
- },
- skill: {
- name: "Skill",
- desc: "A reusable capability package. It describes how a kind of work is done, and can be attached to multiple agents.",
- page: "Skills",
- },
- runtime: {
- name: "Runtime",
- desc: "Where execution actually happens: a computer connected to Multica and the AI coding tools on it.",
- page: "Daemon and runtimes",
- },
- run: {
- name: "Run",
- desc: "One concrete execution record for an agent. One issue can produce multiple runs over time; a finished run does not mean the issue is done.",
- page: "Runs",
- },
- squad: {
- name: "Squad",
- desc: "A group of agents and members led by an agent leader. Assign an issue to a squad and the leader coordinates the work.",
- page: "Squads",
- },
- chat: {
- name: "Chat",
- desc: "A way to talk that is not attached to an issue — good for questions and quick experiments. Each message triggers one run.",
- page: "Chat with agents",
- },
- inbox: {
- name: "Inbox",
- desc: "A member's notification center: activity on subscribed issues, mentions, and assignments all land here. Agents do not use the inbox.",
- page: "Inbox and subscriptions",
- },
- autopilot: {
- name: "Autopilot",
- desc: "Triggers agent runs automatically on a schedule or from external events; you can also run one manually.",
- page: "Autopilots",
- },
+ project: { code: "PROJECT", name: "Project", desc: "Groups related issues under one goal and binds shared repos, directories, and workflows.", page: "Projects", href: "/projects" },
+ issue: { code: "ISSUE", name: "Issue", desc: "A unit of work holding description, status, comments, PRs, and execution history.", page: "Issues", href: "/issues" },
+ triggers: { code: "TRIGGER", name: "Chat / Autopilot", desc: "Alternative triggers outside an issue: 1:1 chats, schedules, and external webhooks.", page: "Triggering agents", href: "/triggering-agents" },
+ skills: { code: "SKILL", name: "Skills", desc: "Reusable capability packages synced to runtimes so proven methods scale across agents.", page: "Skills", href: "/skills" },
+ squad: { code: "SQUAD", name: "Squad", desc: "A leader-coordinated group of agents and humans assignable as a single owner.", page: "Squads", href: "/squads" },
+ agent: { code: "AGENT", name: "Agent", desc: "Reusable AI collaborator configuration: instructions, model, skills, Access, and runtime.", page: "Agents", href: "/agents" },
+ run: { code: "RUN", name: "Run", desc: "One concrete execution attempt for an agent. One issue can produce many runs over time.", page: "Runs", href: "/tasks" },
+ runtime: { code: "DAEMON", name: "Runtime", desc: "A connected computer and its local AI coding tools where execution actually runs.", page: "Daemon & runtimes", href: "/daemon-runtimes" },
+ inbox: { code: "INBOX", name: "Inbox", desc: "Member notification center for mentions, assignments, and subscribed issue activity.", page: "Inbox", href: "/inbox" },
} as Record<NodeId, NodeCopy>,
- edges: {
- project_issue: "Related issues are organized with projects.",
- issue_agent: "Assigning or @-mentioning on an issue triggers the agent.",
- chat_agent: "A chat message triggers the agent.",
- autopilot_agent: "An autopilot triggers the agent on a schedule or event.",
- agent_run: "Every trigger produces a run.",
- run_runtime: "The run completes on a runtime.",
- run_issue: "Results are written back to the issue that triggered it.",
- run_chat: "Results are written back to the chat that triggered it.",
- skill_agent: "Skills attach to agents, so what works is reused across them.",
- squad_agent: "A squad lets multiple agents work together.",
- squad_issue: "An issue can be assigned to a squad; its leader coordinates.",
- issue_inbox: "Issue activity, mentions, and assignments reach members' inboxes.",
- } as Record<EdgeId, string>,
- workspaceRelation: "The workspace is the container for everything; humans and agents collaborate inside it.",
- learnMore: "See ",
- list: (names: string[]) => names.join(", "),
- captions: {
- idle: "The core objects in a workspace and the lines between them.",
- start: "Click Issue to see what it connects to.",
- connected: (name: string, related: string) => `${name} connects directly to ${related}.`,
- contains: "The workspace contains every object.",
- // Leading spaces: these follow another sentence in the caption.
- next: (name: string) => ` Next, click ${name}.`,
- done: "That is the main line: an issue triggers an agent, which produces a run; the run completes on a runtime and the results go back to the issue. Click any other object to explore.",
- explore: " Click any other object to explore.",
- },
},
zh: {
- title: "核心对象和它们的关系",
- groups: { basic: "基础对象", execution: "智能体与执行", collaboration: "协作与自动化" },
+ kicker: "架构总览",
+ title: "核心对象与执行链路",
+ cols: ["01 · 工作与触发", "02 · 智能体编排", "03 · 运行与本机执行"],
+ edgeLabels: {
+ trigger: "指派 / @",
+ create: "创建",
+ claim: "领取",
+ writeback: "执行日志、评论与 PR 回写",
+ notify: "通知",
+ },
+ hint: "点击任一对象查看职责与关联路径。",
+ seeDoc: "详见",
nodes: {
- workspace: {
- name: "工作区",
- desc: "团队共同工作的独立范围,所有工作和配置都发生在其中;人和智能体在同一个工作区里协作。",
- page: "工作区",
- },
- issue: {
- name: "任务",
- desc: "一项要完成的工作,以及围绕它积累的描述、讨论、状态和历史。负责人可以是成员、智能体或小队。",
- page: "任务",
- },
- project: {
- name: "项目",
- desc: "把相关的任务组织在一个目标下,跟踪整体进度,并可以绑定仓库、目录等资源供执行时使用。",
- page: "项目",
- },
- agent: {
- name: "智能体",
- desc: "加入工作区的 AI 协作者,是一份可复用的配置:名称、指令、模型、skill、Access 和运行时。只在被触发时执行。",
- page: "智能体",
- },
- skill: {
- name: "Skill",
- desc: "可复用的能力包,说明\"这类工作怎么做\",可以挂载给多个智能体共用。",
- page: "Skills",
- },
- runtime: {
- name: "运行时",
- desc: "执行实际发生的地方:连接到 Multica 的电脑和其中的 AI 编程工具。",
- page: "守护进程与运行时",
- },
- run: {
- name: "运行",
- desc: "智能体的一次具体执行记录。一个任务可以先后产生多次运行;运行结束不等于任务完成。",
- page: "运行",
- },
- squad: {
- name: "小队",
- desc: "一组智能体和成员,由一个智能体 leader 带领。把任务分配给小队,由 leader 协调完成。",
- page: "小队",
- },
- chat: {
- name: "对话",
- desc: "不依附于任务的交流方式,适合提问和快速尝试。每条消息触发一轮执行。",
- page: "与智能体对话",
- },
- inbox: {
- name: "收件箱",
- desc: "成员的通知中心:订阅的任务动态、提及和分配都汇聚在这里。智能体不使用收件箱。",
- page: "收件箱与订阅",
- },
- autopilot: {
- name: "自动化",
- desc: "按时间表或外部事件自动触发智能体执行,也可以手动运行一次。",
- page: "自动化",
- },
+ project: { code: "PROJECT", name: "项目", desc: "把相关任务组织在一个目标下,绑定共享代码仓库、本地目录与工作流。", page: "项目", href: "/projects" },
+ issue: { code: "ISSUE", name: "任务", desc: "日常工作的基本单位,沉淀需求描述、状态、讨论、关联 PR 与全部执行历史。", page: "任务", href: "/issues" },
+ triggers: { code: "TRIGGER", name: "对话 / 自动化", desc: "任务之外的触发入口:一对一对话、定时计划或外部 Webhook 事件。", page: "让智能体开始工作", href: "/triggering-agents" },
+ skills: { code: "SKILL", name: "Skills", desc: "可复用的能力包,执行时自动同步到运行时,让成熟做法跨智能体复用。", page: "Skills", href: "/skills" },
+ squad: { code: "SQUAD", name: "小队", desc: "由队长智能体统筹的协作组,可直接作为任务负责人自动拆解与协调。", page: "小队", href: "/squads" },
+ agent: { code: "AGENT", name: "智能体", desc: "工作区内的可复用 AI 协作者配置:指令、模型、Skills、Access 与运行时。", page: "智能体", href: "/agents" },
+ run: { code: "RUN", name: "运行", desc: "智能体的一次具体执行记录;同一条任务可先后产生多次运行。", page: "运行", href: "/tasks" },
+ runtime: { code: "DAEMON", name: "运行时", desc: "连接到 Multica 的电脑及其本地 AI 编程工具,实际执行发生在这里。", page: "守护进程与运行时", href: "/daemon-runtimes" },
+ inbox: { code: "INBOX", name: "收件箱", desc: "成员的通知中心,汇聚被分配、@提及与订阅任务的最新动态。", page: "收件箱与订阅", href: "/inbox" },
} as Record<NodeId, NodeCopy>,
- edges: {
- project_issue: "相关的任务用项目组织。",
- issue_agent: "在任务上分配或 @提及,触发智能体。",
- chat_agent: "对话里的每条消息触发智能体。",
- autopilot_agent: "自动化按时间表或外部事件触发智能体。",
- agent_run: "每次触发产生一条运行。",
- run_runtime: "运行在某个运行时上完成。",
- run_issue: "结果写回触发它的任务。",
- run_chat: "结果写回触发它的对话。",
- skill_agent: "Skill 挂载给智能体,让成功经验跨智能体复用。",
- squad_agent: "小队让多个智能体协同。",
- squad_issue: "任务可以分配给小队,由 leader 协调。",
- issue_inbox: "任务动态、提及和分配通知进成员的收件箱。",
- } as Record<EdgeId, string>,
- workspaceRelation: "工作区是一切的容器,人和智能体都在其中协作。",
- learnMore: "详见",
- list: (names: string[]) => names.join("、"),
- captions: {
- idle: "工作区里的核心对象,以及它们之间的连线。",
- start: "点击任务,看它和哪些对象相连。",
- // Space only where an English name meets Chinese, e.g. "Skill 和智能体".
- connected: (name: string, related: string) =>
- `${name}${/[A-Za-z]$/.test(name) ? " " : ""}和${/^[A-Za-z]/.test(related) ? " " : ""}${related}直接相连。`,
- contains: "工作区包含所有对象。",
- next: (name: string) => `接着点${name}。`,
- done: "主线走完了:任务触发智能体,产生一条运行;运行在运行时上完成,结果写回任务。其他对象也可以点开看。",
- explore: "其他对象也可以点开看。",
+ },
+ "zh-Hant": {
+ kicker: "架構總覽",
+ title: "核心物件與執行鏈路",
+ cols: ["01 · 工作與觸發", "02 · 智能體編排", "03 · 執行與本機環境"],
+ edgeLabels: {
+ trigger: "指派 / @",
+ create: "建立",
+ claim: "領取",
+ writeback: "執行日誌、評論與 PR 回寫",
+ notify: "通知",
},
+ hint: "點擊任一物件檢視職責與關聯路徑。",
+ seeDoc: "詳見",
+ nodes: {
+ project: { code: "PROJECT", name: "專案", desc: "將相關任務組織在同一個目標下,綁定共享倉庫、目錄與工作流。", page: "專案", href: "/projects" },
+ issue: { code: "ISSUE", name: "任務", desc: "日常工作的基本單位,沉澱描述、狀態、討論、PR 與執行歷史。", page: "任務", href: "/issues" },
+ triggers: { code: "TRIGGER", name: "對話 / 自動化", desc: "任務之外的觸發入口:一對一對話、排程或外部 Webhook。", page: "讓智能體開始工作", href: "/triggering-agents" },
+ skills: { code: "SKILL", name: "Skills", desc: "可複用的能力包,執行時自動同步至執行環境。", page: "Skills", href: "/skills" },
+ squad: { code: "SQUAD", name: "小隊", desc: "由隊長智能體統籌的協作群組,可直接指派任務。", page: "小隊", href: "/squads" },
+ agent: { code: "AGENT", name: "智能體", desc: "可複用的 AI 協作者設定:指令、模型、Skills、Access 與執行環境。", page: "智能體", href: "/agents" },
+ run: { code: "RUN", name: "執行", desc: "智能體的一次具體執行記錄;同一條任務可產生多次執行。", page: "執行", href: "/tasks" },
+ runtime: { code: "DAEMON", name: "執行環境", desc: "連接至 Multica 的電腦與本機 AI 程式設計工具。", page: "守護行程與執行環境", href: "/daemon-runtimes" },
+ inbox: { code: "INBOX", name: "收件箱", desc: "成員的通知中心,彙整指派、@提及與訂閱任務動態。", page: "收件箱與訂閱", href: "/inbox" },
+ } as Record<NodeId, NodeCopy>,
},
ja: {
- title: "コアオブジェクトとその関係",
- groups: { basic: "基本オブジェクト", execution: "エージェントと実行", collaboration: "協働と自動化" },
+ kicker: "ARCHITECTURE",
+ title: "コアオブジェクトと実行フロー",
+ cols: ["01 · 作業とトリガー", "02 · 編成", "03 · ローカル実行"],
+ edgeLabels: {
+ trigger: "割当 / @",
+ create: "作成",
+ claim: "取得",
+ writeback: "ログ・コメント・PR を書き戻す",
+ notify: "通知",
+ },
+ hint: "任意のオブジェクトをクリックして役割と接続を確認できます。",
+ seeDoc: "詳細:",
nodes: {
- workspace: {
- name: "ワークスペース",
- desc: "チームが一緒に働く独立した範囲で、すべての仕事と設定はその中で行われます。人間とエージェントは同じワークスペースで協働します。",
- page: "ワークスペース",
- },
- issue: {
- name: "タスク",
- desc: "完了すべき 1 件の仕事と、その周りに蓄積される説明、議論、ステータス、履歴。担当者はメンバー、エージェント、スクワッドのいずれかです。",
- page: "タスク",
- },
- project: {
- name: "プロジェクト",
- desc: "関連するタスクを 1 つの目標の下に整理し、全体の進捗を追跡します。リポジトリやディレクトリなどのリソースを紐づけて、実行時に使わせることもできます。",
- page: "プロジェクト",
- },
- agent: {
- name: "エージェント",
- desc: "ワークスペースに参加する AI の協働者で、名前、指示、モデル、スキル、アクセス、ランタイムからなる再利用可能な設定です。トリガーされたときだけ実行します。",
- page: "エージェント",
- },
- skill: {
- name: "スキル",
- desc: "再利用可能な能力パッケージ。ある種類の仕事をどう進めるかを記述し、複数のエージェントに取り付けて共用できます。",
- page: "スキル",
- },
- runtime: {
- name: "ランタイム",
- desc: "実行が実際に行われる場所。Multica に接続されたコンピュータと、その上の AI コーディングツールです。",
- page: "デーモンとランタイム",
- },
- run: {
- name: "実行",
- desc: "エージェントの 1 回の具体的な実行記録。1 つのタスクから複数の実行が順に生まれることがあり、実行の終了はタスクの完了を意味しません。",
- page: "実行",
- },
- squad: {
- name: "スクワッド",
- desc: "1 体のリーダーエージェントが率いる、エージェントとメンバーのグループ。タスクをスクワッドに割り当てると、リーダーが調整して進めます。",
- page: "スクワッド",
- },
- chat: {
- name: "チャット",
- desc: "タスクに紐づかないやり取りの方法で、質問や素早い試行に向いています。メッセージ 1 件ごとに 1 回の実行がトリガーされます。",
- page: "エージェントとのチャット",
- },
- inbox: {
- name: "インボックス",
- desc: "メンバーの通知センター。購読しているタスクの動き、メンション、割り当てがここに集まります。エージェントはインボックスを使いません。",
- page: "インボックスと購読",
- },
- autopilot: {
- name: "オートパイロット",
- desc: "スケジュールまたは外部イベントに応じて、エージェントの実行を自動的にトリガーします。手動で 1 回だけ実行することもできます。",
- page: "オートパイロット",
- },
+ project: { code: "PROJECT", name: "プロジェクト", desc: "関連タスクを束ね、共有リポジトリ・ディレクトリ・ワークフローを紐づけます。", page: "プロジェクト", href: "/projects" },
+ issue: { code: "ISSUE", name: "タスク", desc: "説明・ステータス・議論・PR・実行履歴が集まる作業の基本単位です。", page: "タスク", href: "/issues" },
+ triggers: { code: "TRIGGER", name: "チャット / 自動化", desc: "タスク外のトリガー:1対1チャット、スケジュール、Webhook。", page: "エージェントを動かす", href: "/triggering-agents" },
+ skills: { code: "SKILL", name: "Skills", desc: "再利用可能な手順パッケージ。実行時にランタイムへ同期されます。", page: "Skills", href: "/skills" },
+ squad: { code: "SQUAD", name: "スクワッド", desc: "リーダーエージェントが統括するチーム単位の担当者です。", page: "スクワッド", href: "/squads" },
+ agent: { code: "AGENT", name: "エージェント", desc: "指示・モデル・Skills・アクセス・ランタイムをまとめた再利用可能な設定です。", page: "エージェント", href: "/agents" },
+ run: { code: "RUN", name: "実行", desc: "エージェントの 1 回の具体的な実行記録です。", page: "実行", href: "/tasks" },
+ runtime: { code: "DAEMON", name: "ランタイム", desc: "Multica に接続されたコンピュータとローカル AI コーディングツールです。", page: "デーモンとランタイム", href: "/daemon-runtimes" },
+ inbox: { code: "INBOX", name: "インボックス", desc: "メンション・割り当て・購読タスクの通知が集まる場所です。", page: "インボックス", href: "/inbox" },
} as Record<NodeId, NodeCopy>,
- edges: {
- project_issue: "関連するタスクはプロジェクトで整理します。",
- issue_agent: "タスクでの割り当てや @メンションがエージェントをトリガーします。",
- chat_agent: "チャットのメッセージがエージェントをトリガーします。",
- autopilot_agent: "オートパイロットがスケジュールや外部イベントでエージェントをトリガーします。",
- agent_run: "トリガーのたびに実行が 1 件作られます。",
- run_runtime: "実行はいずれかのランタイム上で完了します。",
- run_issue: "結果はトリガー元のタスクに書き戻されます。",
- run_chat: "結果はトリガー元のチャットに書き戻されます。",
- skill_agent: "スキルはエージェントに取り付けて、成功したやり方をエージェント間で再利用させます。",
- squad_agent: "スクワッドは複数のエージェントを協働させます。",
- squad_issue: "タスクはスクワッドにも割り当てられ、リーダーが調整します。",
- issue_inbox: "タスクの動き、メンション、割り当てはメンバーのインボックスに届きます。",
- } as Record<EdgeId, string>,
- workspaceRelation: "ワークスペースはすべての入れ物で、人間とエージェントがその中で協働します。",
- learnMore: "詳しくは",
- list: (names: string[]) => names.join("、"),
- captions: {
- idle: "ワークスペースのコアオブジェクトと、それらをつなぐ線です。",
- start: "タスクをクリックすると、つながっているオブジェクトが分かります。",
- connected: (name: string, related: string) => `${name}は${related}と直接つながっています。`,
- contains: "ワークスペースはすべてのオブジェクトを含みます。",
- next: (name: string) => `次に${name}をクリックしてください。`,
- done: "これがメインの流れです。タスクがエージェントをトリガーして実行が作られ、実行はランタイム上で完了し、結果がタスクに書き戻されます。ほかのオブジェクトもクリックして確認できます。",
- explore: "ほかのオブジェクトもクリックして確認できます。",
- },
},
ko: {
- title: "핵심 객체와 서로의 관계",
- groups: { basic: "기본 객체", execution: "에이전트와 실행", collaboration: "협업과 자동화" },
+ kicker: "ARCHITECTURE",
+ title: "핵심 객체와 실행 흐름",
+ cols: ["01 · 작업 및 트리거", "02 · 오케스트레이션", "03 · 로컬 실행"],
+ edgeLabels: {
+ trigger: "할당 / @",
+ create: "생성",
+ claim: "수신",
+ writeback: "로그·댓글·PR 기록 반환",
+ notify: "알림",
+ },
+ hint: "객체를 클릭해 역할과 연결 경로를 확인하세요.",
+ seeDoc: "자세히:",
nodes: {
- workspace: {
- name: "워크스페이스",
- desc: "팀이 함께 일하는 독립된 공간입니다. 모든 작업과 설정이 워크스페이스 안에서 이루어지며, 사람과 에이전트가 같은 워크스페이스에서 협업합니다.",
- page: "워크스페이스",
- },
- issue: {
- name: "태스크",
- desc: "해야 할 일과 그에 관한 설명, 논의, 상태, 이력을 한곳에 모은 객체입니다. 멤버나 에이전트, 스쿼드를 담당자로 지정할 수 있습니다.",
- page: "태스크",
- },
- project: {
- name: "프로젝트",
- desc: "관련 태스크를 하나의 목표 아래 정리하고 전체 진행 상황을 추적합니다. 실행할 때 사용할 저장소나 디렉터리 같은 리소스도 연결할 수 있습니다.",
- page: "프로젝트",
- },
- agent: {
- name: "에이전트",
- desc: "워크스페이스에서 함께 일하는 AI 협업자입니다. 이름, 지침, 모델, 스킬, 접근 권한, 런타임으로 이루어진 재사용 가능한 설정이며, 트리거될 때만 동작합니다.",
- page: "에이전트",
- },
- skill: {
- name: "스킬",
- desc: "재사용할 수 있는 기능 패키지입니다. 특정 종류의 작업을 어떻게 수행하는지 설명하며, 여러 에이전트에 연결해 함께 사용할 수 있습니다.",
- page: "스킬",
- },
- runtime: {
- name: "런타임",
- desc: "실제 실행이 일어나는 곳으로, Multica에 연결된 컴퓨터와 그 컴퓨터의 AI 코딩 도구를 뜻합니다.",
- page: "데몬과 런타임",
- },
- run: {
- name: "실행",
- desc: "에이전트가 한 번 실행된 기록입니다. 하나의 태스크에서 여러 실행이 만들어질 수 있으며, 실행이 끝났다고 해서 태스크까지 완료된 것은 아닙니다.",
- page: "실행",
- },
- squad: {
- name: "스쿼드",
- desc: "리더 에이전트 한 명이 이끄는 에이전트와 멤버의 그룹입니다. 태스크를 스쿼드에 할당하면 리더가 작업을 조율합니다.",
- page: "스쿼드",
- },
- chat: {
- name: "채팅",
- desc: "태스크에 연결하지 않고 대화하는 방식으로, 질문이나 간단한 시도에 적합합니다. 메시지를 보낼 때마다 한 번의 실행이 트리거됩니다.",
- page: "에이전트와 대화",
- },
- inbox: {
- name: "인박스",
- desc: "멤버를 위한 알림 센터입니다. 구독한 태스크의 활동, 멘션, 할당 알림이 이곳에 모입니다. 에이전트는 인박스를 사용하지 않습니다.",
- page: "인박스와 구독",
- },
- autopilot: {
- name: "오토파일럿",
- desc: "일정이나 외부 이벤트에 따라 에이전트 실행을 자동으로 트리거하며, 필요하면 한 번만 수동으로 실행할 수도 있습니다.",
- page: "오토파일럿",
- },
+ project: { code: "PROJECT", name: "프로젝트", desc: "관련 태스크를 묶고 공유 저장소·디렉터리·워크플로를 연결합니다.", page: "프로젝트", href: "/projects" },
+ issue: { code: "ISSUE", name: "태스크", desc: "설명, 상태, 댓글, PR, 실행 기록이 쌓이는 작업의 기본 단위입니다.", page: "태스크", href: "/issues" },
+ triggers: { code: "TRIGGER", name: "채팅 / 오토파일럿", desc: "태스크 외 트리거: 1:1 채팅, 예약 실행, 외부 웹훅.", page: "에이전트 시작하기", href: "/triggering-agents" },
+ skills: { code: "SKILL", name: "Skills", desc: "여러 에이전트에 재사용할 수 있는 역량 패키지입니다.", page: "Skills", href: "/skills" },
+ squad: { code: "SQUAD", name: "스쿼드", desc: "리더 에이전트가 조율하는 에이전트·멤버 그룹입니다.", page: "스쿼드", href: "/squads" },
+ agent: { code: "AGENT", name: "에이전트", desc: "지침, 모델, Skills, 접근 권한, 런타임을 담은 재사용 구성입니다.", page: "에이전트", href: "/agents" },
+ run: { code: "RUN", name: "실행", desc: "에이전트의 개별 실행 기록입니다. 한 태스크에 여러 실행이 쌓일 수 있습니다.", page: "실행", href: "/tasks" },
+ runtime: { code: "DAEMON", name: "런타임", desc: "실제 실행이 이루어지는 연결된 컴퓨터와 AI 코딩 도구입니다.", page: "데몬과 런타임", href: "/daemon-runtimes" },
+ inbox: { code: "INBOX", name: "인박스", desc: "멘션, 할당, 구독한 태스크 활동이 모이는 멤버 알림 센터입니다.", page: "인박스", href: "/inbox" },
} as Record<NodeId, NodeCopy>,
- edges: {
- project_issue: "관련 태스크는 프로젝트로 정리합니다.",
- issue_agent: "태스크에서 할당하거나 @멘션하면 에이전트가 트리거됩니다.",
- chat_agent: "채팅 메시지가 에이전트를 트리거합니다.",
- autopilot_agent: "오토파일럿이 일정이나 외부 이벤트에 따라 에이전트를 트리거합니다.",
- agent_run: "트리거할 때마다 실행이 하나 만들어집니다.",
- run_runtime: "실행은 런타임에서 완료됩니다.",
- run_issue: "결과는 실행을 트리거한 태스크에 다시 기록됩니다.",
- run_chat: "결과는 실행을 트리거한 채팅에 다시 기록됩니다.",
- skill_agent: "스킬은 에이전트에 연결되어 검증된 작업 방식을 여러 에이전트에서 재사용하게 합니다.",
- squad_agent: "스쿼드는 여러 에이전트가 함께 일하게 합니다.",
- squad_issue: "태스크를 스쿼드에 할당하면 리더가 조율합니다.",
- issue_inbox: "태스크 활동, 멘션, 할당 알림은 멤버의 인박스로 갑니다.",
- } as Record<EdgeId, string>,
- workspaceRelation: "워크스페이스는 모든 객체를 담는 공간이며, 사람과 에이전트가 그 안에서 협업합니다.",
- learnMore: "자세히: ",
- list: (names: string[]) => names.join(", "),
- captions: {
- idle: "워크스페이스의 핵심 객체와 그 사이를 잇는 선입니다.",
- start: "태스크를 클릭해 어떤 객체와 연결되는지 확인하세요.",
- // Phrased so no particle has to agree with the name's final consonant.
- connected: (name: string, related: string) => `${name}에 직접 연결된 객체: ${related}.`,
- contains: "워크스페이스가 모든 객체를 담고 있습니다.",
- next: (name: string) => ` 이어서 ${name} 항목을 클릭하세요.`,
- done: "이것이 주요 흐름입니다. 태스크가 에이전트를 트리거해 실행이 만들어지고, 실행은 런타임에서 완료되어 결과가 태스크에 다시 기록됩니다. 다른 객체도 클릭해 살펴보세요.",
- explore: " 다른 객체도 클릭해 살펴보세요.",
- },
},
fr: {
- title: "Les objets clés et leurs relations",
- groups: { basic: "Objets de base", execution: "Agents et exécution", collaboration: "Collaboration et automatisation" },
+ kicker: "ARCHITECTURE",
+ title: "Objets clés et flux d'exécution",
+ cols: ["01 · TRAVAIL & DÉCLENCHEURS", "02 · ORCHESTRATION", "03 · EXÉCUTION LOCALE"],
+ edgeLabels: {
+ trigger: "assign / @",
+ create: "crée",
+ claim: "prend",
+ writeback: "journaux, commentaires et PR réécrits",
+ notify: "notifie",
+ },
+ hint: "Cliquez sur un objet pour inspecter son rôle et ses liens.",
+ seeDoc: "Voir",
nodes: {
- workspace: {
- name: "Espace de travail",
- desc: "Le périmètre autonome dans lequel une équipe travaille ensemble ; tout le travail et toute la configuration s'y trouvent. Humains et agents collaborent dans le même espace de travail.",
- page: "Espaces de travail",
- },
- issue: {
- name: "Tâche",
- desc: "Un travail à réaliser, accompagné de la description, de la discussion, du statut et de l'historique qui s'accumulent autour de lui. L'assigné peut être un membre, un agent ou un squad.",
- page: "Tâches",
- },
- project: {
- name: "Projet",
- desc: "Regroupe des tâches liées autour d'un même objectif, suit l'avancement global et peut rattacher des ressources, comme des dépôts et des répertoires, utilisées pendant l'exécution.",
- page: "Projets",
- },
- agent: {
- name: "Agent",
- desc: "Un collaborateur IA de l'espace de travail — une configuration réutilisable : nom, instructions, modèle, skills, Accès et runtime. Il ne s'exécute que lorsqu'il est déclenché.",
- page: "Agents",
- },
- skill: {
- name: "Skill",
- desc: "Un paquet de capacités réutilisable. Il décrit comment réaliser un type de travail et peut être rattaché à plusieurs agents.",
- page: "Skills",
- },
- runtime: {
- name: "Runtime",
- desc: "L'endroit où l'exécution a réellement lieu : un ordinateur connecté à Multica et les outils de codage IA qui y sont installés.",
- page: "Daemon et runtimes",
- },
- run: {
- name: "Exécution",
- desc: "L'enregistrement concret d'une exécution d'un agent. Une tâche peut produire plusieurs exécutions au fil du temps ; une exécution terminée ne signifie pas que la tâche est terminée.",
- page: "Exécutions",
- },
- squad: {
- name: "Squad",
- desc: "Un groupe d'agents et de membres dirigé par un agent chef. Assignez une tâche à un squad et le chef coordonne le travail.",
- page: "Squads",
- },
- chat: {
- name: "Discussion",
- desc: "Un moyen d'échanger qui n'est rattaché à aucune tâche, idéal pour les questions et les essais rapides. Chaque message déclenche une exécution.",
- page: "Discuter avec des agents",
- },
- inbox: {
- name: "Boîte de réception",
- desc: "Le centre de notifications d'un membre : l'activité sur les tâches suivies, les mentions et les assignations y arrivent. Les agents n'utilisent pas la Boîte de réception.",
- page: "Boîte de réception et abonnements",
- },
- autopilot: {
- name: "Automatisation",
- desc: "Déclenche automatiquement des exécutions d'agents selon une planification ou à partir d'événements externes ; vous pouvez aussi en lancer une manuellement.",
- page: "Automatisations",
- },
+ project: { code: "PROJECT", name: "Projet", desc: "Regroupe les tâches liées avec leurs dépôts, dossiers et workflows partagés.", page: "Projets", href: "/projects" },
+ issue: { code: "ISSUE", name: "Tâche", desc: "Unité de travail rassemblant description, statut, discussions, PR et historique.", page: "Tâches", href: "/issues" },
+ triggers: { code: "TRIGGER", name: "Chat / Auto", desc: "Déclencheurs hors tâche : discussions privées, horaires et webhooks.", page: "Déclencher un agent", href: "/triggering-agents" },
+ skills: { code: "SKILL", name: "Skills", desc: "Paquets de compétences réutilisables synchronisés vers les runtimes.", page: "Skills", href: "/skills" },
+ squad: { code: "SQUAD", name: "Squad", desc: "Groupe coordonné par un agent leader, assignable comme un responsable unique.", page: "Squads", href: "/squads" },
+ agent: { code: "AGENT", name: "Agent", desc: "Collaborateur IA réutilisable : instructions, modèle, skills, accès et runtime.", page: "Agents", href: "/agents" },
+ run: { code: "RUN", name: "Exécution", desc: "Une tentative concrète d'exécution. Une tâche peut produire plusieurs exécutions.", page: "Exécutions", href: "/tasks" },
+ runtime: { code: "DAEMON", name: "Runtime", desc: "Ordinateur connecté et outils de codage IA locaux où le travail s'exécute.", page: "Daemon et runtimes", href: "/daemon-runtimes" },
+ inbox: { code: "INBOX", name: "Boîte", desc: "Centre de notifications des membres pour mentions, assignations et abonnements.", page: "Boîte de réception", href: "/inbox" },
} as Record<NodeId, NodeCopy>,
- edges: {
- project_issue: "Les tâches liées sont organisées en projets.",
- issue_agent: "Assigner une tâche ou @mentionner l'agent dans une tâche le déclenche.",
- chat_agent: "Un message de discussion déclenche l'agent.",
- autopilot_agent: "Une automatisation déclenche l'agent selon une planification ou un événement.",
- agent_run: "Chaque déclenchement produit une exécution.",
- run_runtime: "L'exécution s'effectue sur un runtime.",
- run_issue: "Les résultats sont réécrits dans la tâche qui l'a déclenchée.",
- run_chat: "Les résultats sont réécrits dans la discussion qui l'a déclenchée.",
- skill_agent: "Les skills se rattachent aux agents pour réutiliser ce qui fonctionne de l'un à l'autre.",
- squad_agent: "Un squad fait travailler plusieurs agents ensemble.",
- squad_issue: "Une tâche peut être assignée à un squad ; son chef coordonne.",
- issue_inbox: "L'activité des tâches, les mentions et les assignations arrivent dans la Boîte de réception des membres.",
- } as Record<EdgeId, string>,
- workspaceRelation: "L'espace de travail contient tout ; humains et agents y collaborent.",
- learnMore: "Voir ",
- list: (names: string[]) =>
- names.length < 2 ? names.join("") : `${names.slice(0, -1).join(", ")} et ${names[names.length - 1]}`,
- captions: {
- idle: "Les objets clés d'un espace de travail et les liens entre eux.",
- start: "Cliquez sur Tâche pour voir à quoi elle est reliée.",
- connected: (name: string, related: string) => `${name} se connecte directement à : ${related}.`,
- contains: "L'espace de travail contient tous les objets.",
- next: (name: string) => ` Cliquez ensuite sur ${name}.`,
- done: "Voilà le fil principal : une tâche déclenche un agent, qui produit une exécution ; l'exécution se termine sur un runtime et les résultats reviennent dans la tâche. Cliquez sur n'importe quel autre objet pour explorer.",
- explore: " Cliquez sur n'importe quel autre objet pour explorer.",
- },
},
};
-const PAGE_HREF: Record<NodeId, string> = {
- workspace: "/workspaces",
- issue: "/issues",
- project: "/projects",
- agent: "/agents",
- skill: "/skills",
- runtime: "/daemon-runtimes",
- run: "/tasks",
- squad: "/squads",
- chat: "/chat",
- inbox: "/inbox",
- autopilot: "/autopilots",
-};
-
-function edgesOf(id: NodeId) {
- return EDGES.filter((e) => e.from === id || e.to === id);
-}
-
-function neighborsOf(id: NodeId): Set<NodeId> {
- if (id === "workspace") return new Set(MAP_NODES);
- return new Set(edgesOf(id).map((e) => (e.from === id ? e.to : e.from)));
-}
-
-function edgePath({ from, to, curve }: (typeof EDGES)[number]) {
- const [x1, y1] = POSITION[from];
- const [x2, y2] = POSITION[to];
- return curve ? `M ${x1} ${y1} Q ${curve[0]} ${curve[1]} ${x2} ${y2}` : `M ${x1} ${y1} L ${x2} ${y2}`;
-}
-
export function ConceptMapDemo() {
const t = useDemoCopy(copy);
- const [frameRef, visible] = useStartWhenVisible<HTMLElement>();
- const [selected, setSelected] = useState<NodeId | null>(null);
- const [guide, setGuide] = useState(0);
+ const [active, setActive] = useState<NodeId | null>(null);
- const guideTarget = visible && guide < GUIDE.length ? GUIDE[guide] : null;
- const neighbors = selected ? neighborsOf(selected) : null;
-
- const select = (id: NodeId) => {
- setSelected(id);
- if (id === guideTarget) setGuide(guide + 1);
+ const isEdgeLit = (from: NodeId, to: NodeId, main?: boolean) => {
+ if (!active) return Boolean(main);
+ return from === active || to === active;
};
- const replay = () => {
- setSelected(null);
- setGuide(0);
+ const isNodeLit = (id: NodeId) => {
+ if (!active) return MAIN_PATH.has(id);
+ if (id === active) return true;
+ return EDGES.some((e) => (e.from === active && e.to === id) || (e.to === active && e.from === id));
};
- const caption = (() => {
- if (!visible) return t.captions.idle;
- if (!selected) return t.captions.start;
- const name = t.nodes[selected].name;
- const head =
- selected === "workspace"
- ? t.captions.contains
- : t.captions.connected(name, t.list([...neighborsOf(selected)].map((n) => t.nodes[n].name)));
- if (guideTarget) return `${head}${t.captions.next(t.nodes[guideTarget].name)}`;
- if (selected === GUIDE[GUIDE.length - 1] && guide === GUIDE.length) return t.captions.done;
- return `${head}${t.captions.explore}`;
- })();
-
- const nodeState = (id: NodeId) => {
- if (!selected) return "idle" as const;
- if (id === selected) return "selected" as const;
- return neighbors?.has(id) ? ("related" as const) : ("dimmed" as const);
+ const nodeFill = (id: NodeId) => {
+ if (active === id) return "var(--accent)";
+ if (!active && MAIN_PATH.has(id)) return "var(--accent)";
+ return "var(--card)";
};
- const nodeButton = (id: NodeId, className?: string) => {
- const state = nodeState(id);
- return (
- <button
- type="button"
- aria-pressed={id === selected}
- disabled={!visible}
- onClick={() => select(id)}
- className={cn(
- "rounded-md border px-2.5 py-1 text-label font-medium whitespace-nowrap shadow-xs transition-[color,background-color,border-color,opacity] outline-none focus-visible:ring-3 focus-visible:ring-ring/50",
- // Every state keeps an opaque fill: edges run to node centers and
- // must stay hidden behind the label.
- state === "selected" && "border-brand bg-brand text-brand-foreground",
- state === "related" && "border-brand/60 bg-background bg-linear-to-b from-brand/10 to-brand/10 text-foreground",
- state === "idle" && "bg-background hover:bg-muted",
- state === "dimmed" && "border-border/60 bg-background text-muted-foreground/60 shadow-none hover:bg-muted",
- className,
- )}
- >
- {t.nodes[id].name}
- </button>
- );
+ const nodeStroke = (id: NodeId) => {
+ if (active === id || (!active && MAIN_PATH.has(id))) return "var(--primary)";
+ if (active && isNodeLit(id)) return "var(--primary)";
+ return "var(--border)";
};
- const workspaceState = nodeState("workspace");
+ const nodeOpacity = (id: NodeId) => (active && !isNodeLit(id) ? 0.42 : 1);
+
+ const selectedNode = active ? t.nodes[active] : null;
return (
- <DemoFrame frameRef={frameRef} title={t.title} caption={caption} onReplay={replay}>
- <div className="flex flex-col gap-3 p-4">
- {/* Wide screens: the map, with the workspace as the frame around every object. */}
- <div
- className={cn(
- "relative hidden aspect-[16/9] rounded-lg border border-dashed transition-colors sm:block",
- workspaceState === "selected" && "border-brand bg-brand/5",
- )}
- >
- <div className="absolute top-2 left-2 z-10">{nodeButton("workspace", "shadow-none")}</div>
- <svg
- aria-hidden
- className="absolute inset-0 size-full"
- viewBox="0 0 100 100"
- preserveAspectRatio="none"
+ <EditorialFigure
+ kicker={t.kicker}
+ title={t.title}
+ caption={
+ selectedNode ? (
+ <span className="flex flex-wrap items-baseline justify-between gap-2">
+ <span>
+ <strong className="font-semibold text-foreground">{selectedNode.name}</strong>
+ {" — "}
+ {selectedNode.desc}
+ </span>
+ <LocaleLink
+ href={selectedNode.href}
+ className="inline-flex shrink-0 items-center gap-1 font-medium text-[var(--primary)] hover:underline"
+ >
+ {t.seeDoc} {selectedNode.page}
+ <ArrowRight aria-hidden className="size-3" />
+ </LocaleLink>
+ </span>
+ ) : (
+ t.hint
+ )
+ }
+ >
+ <svg
+ viewBox="0 0 640 276"
+ className="block h-auto w-full select-none"
+ role="img"
+ aria-label={t.title}
+ >
+ <defs>
+ <marker id="cm-arr-hi" viewBox="0 0 8 8" refX="7" refY="4" markerWidth="6" markerHeight="6" orient="auto">
+ <path d="M0 1 L7 4 L0 7" fill="none" stroke="var(--primary)" strokeWidth="1.4" strokeLinecap="round" strokeLinejoin="round" />
+ </marker>
+ <marker id="cm-arr-lo" viewBox="0 0 8 8" refX="7" refY="4" markerWidth="5.5" markerHeight="5.5" orient="auto">
+ <path d="M0 1 L7 4 L0 7" fill="none" stroke="var(--docs-faint)" strokeWidth="1.3" strokeLinecap="round" strokeLinejoin="round" />
+ </marker>
+ </defs>
+
+ {/* Column headers */}
+ <text x="16" y="18" fill="var(--muted-foreground)" fontFamily="var(--font-mono)" fontSize="9.5" letterSpacing="1">
+ {t.cols[0]}
+ </text>
+ <text x="220" y="18" fill="var(--muted-foreground)" fontFamily="var(--font-mono)" fontSize="9.5" letterSpacing="1">
+ {t.cols[1]}
+ </text>
+ <text x="434" y="18" fill="var(--muted-foreground)" fontFamily="var(--font-mono)" fontSize="9.5" letterSpacing="1">
+ {t.cols[2]}
+ </text>
+ <line x1="16" y1="26" x2="624" y2="26" stroke="var(--border)" strokeWidth="1" />
+
+ {/* Top supporting connectors */}
+ <path
+ d="M72 76 V112"
+ fill="none"
+ stroke={isEdgeLit("project", "issue") ? "var(--primary)" : "var(--docs-faint)"}
+ strokeWidth={isEdgeLit("project", "issue") ? 1.5 : 1.15}
+ markerEnd={isEdgeLit("project", "issue") ? "url(#cm-arr-hi)" : "url(#cm-arr-lo)"}
+ />
+ <path
+ d="M178 76 V96 H262 V112"
+ fill="none"
+ stroke={isEdgeLit("triggers", "agent") ? "var(--primary)" : "var(--docs-faint)"}
+ strokeWidth={isEdgeLit("triggers", "agent") ? 1.5 : 1.15}
+ markerEnd={isEdgeLit("triggers", "agent") ? "url(#cm-arr-hi)" : "url(#cm-arr-lo)"}
+ />
+ <path
+ d="M276 76 V112"
+ fill="none"
+ stroke={isEdgeLit("skills", "agent") ? "var(--primary)" : "var(--docs-faint)"}
+ strokeWidth={isEdgeLit("skills", "agent") ? 1.5 : 1.15}
+ strokeDasharray="3 3"
+ markerEnd={isEdgeLit("skills", "agent") ? "url(#cm-arr-hi)" : "url(#cm-arr-lo)"}
+ />
+ <path
+ d="M358 76 V96 H312 V112"
+ fill="none"
+ stroke={isEdgeLit("squad", "agent") ? "var(--primary)" : "var(--docs-faint)"}
+ strokeWidth={isEdgeLit("squad", "agent") ? 1.5 : 1.15}
+ strokeDasharray="3 3"
+ markerEnd={isEdgeLit("squad", "agent") ? "url(#cm-arr-hi)" : "url(#cm-arr-lo)"}
+ />
+
+ {/* Inbox connector (bottom-left) */}
+ <path
+ d="M46 164 V216"
+ fill="none"
+ stroke={isEdgeLit("issue", "inbox") ? "var(--primary)" : "var(--docs-faint)"}
+ strokeWidth={isEdgeLit("issue", "inbox") ? 1.5 : 1.15}
+ markerEnd={isEdgeLit("issue", "inbox") ? "url(#cm-arr-hi)" : "url(#cm-arr-lo)"}
+ />
+ <text x="53" y="194" fill="var(--muted-foreground)" fontSize="9.5">
+ {t.edgeLabels.notify}
+ </text>
+
+ {/* Main horizontal spine */}
+ <path
+ d="M132 138 H216"
+ fill="none"
+ stroke={isEdgeLit("issue", "agent", true) ? "var(--primary)" : "var(--docs-faint)"}
+ strokeWidth={isEdgeLit("issue", "agent", true) ? 1.75 : 1.2}
+ markerEnd={isEdgeLit("issue", "agent", true) ? "url(#cm-arr-hi)" : "url(#cm-arr-lo)"}
+ />
+ <path
+ d="M350 138 H430"
+ fill="none"
+ stroke={isEdgeLit("agent", "run", true) ? "var(--primary)" : "var(--docs-faint)"}
+ strokeWidth={isEdgeLit("agent", "run", true) ? 1.75 : 1.2}
+ markerEnd={isEdgeLit("agent", "run", true) ? "url(#cm-arr-hi)" : "url(#cm-arr-lo)"}
+ />
+ <path
+ d="M512 138 H540"
+ fill="none"
+ stroke={isEdgeLit("run", "runtime", true) ? "var(--primary)" : "var(--docs-faint)"}
+ strokeWidth={isEdgeLit("run", "runtime", true) ? 1.75 : 1.2}
+ markerEnd={isEdgeLit("run", "runtime", true) ? "url(#cm-arr-hi)" : "url(#cm-arr-lo)"}
+ />
+
+ {/* Unobstructed write-back loop */}
+ <path
+ d="M582 164 V232 H112 V166"
+ fill="none"
+ stroke={isEdgeLit("runtime", "issue", true) ? "var(--primary)" : "var(--docs-faint)"}
+ strokeWidth={isEdgeLit("runtime", "issue", true) ? 1.5 : 1.15}
+ strokeDasharray="4 3"
+ markerEnd={isEdgeLit("runtime", "issue", true) ? "url(#cm-arr-hi)" : "url(#cm-arr-lo)"}
+ />
+
+ {/* Edge verb labels */}
+ <text x="174" y="130" textAnchor="middle" fill={isEdgeLit("issue", "agent", true) ? "var(--primary)" : "var(--muted-foreground)"} fontSize="10" fontWeight="500">
+ {t.edgeLabels.trigger}
+ </text>
+ <text x="390" y="130" textAnchor="middle" fill={isEdgeLit("agent", "run", true) ? "var(--primary)" : "var(--muted-foreground)"} fontSize="10" fontWeight="500">
+ {t.edgeLabels.create}
+ </text>
+ <text x="526" y="130" textAnchor="middle" fill={isEdgeLit("run", "runtime", true) ? "var(--primary)" : "var(--muted-foreground)"} fontSize="10" fontWeight="500">
+ {t.edgeLabels.claim}
+ </text>
+ <rect x="266" y="222" width="188" height="20" rx="3" fill="var(--card)" />
+ <text x="360" y="235" textAnchor="middle" fill={isEdgeLit("runtime", "issue", true) ? "var(--primary)" : "var(--muted-foreground)"} fontSize="10" fontWeight="500">
+ {t.edgeLabels.writeback}
+ </text>
+
+ {/* Supporting top nodes */}
+ {(
+ [
+ ["project", 16, 40, 112, 36],
+ ["triggers", 136, 40, 92, 36],
+ ["skills", 240, 40, 74, 36],
+ ["squad", 322, 40, 74, 36],
+ ] as [NodeId, number, number, number, number][]
+ ).map(([id, x, y, w, h]) => (
+ <g
+ key={id}
+ style={{ cursor: "pointer", opacity: nodeOpacity(id) }}
+ onClick={() => setActive(active === id ? null : id)}
+ onMouseEnter={() => setActive(id)}
+ onMouseLeave={() => setActive(null)}
>
- {EDGES.map((edge) => {
- const lit = selected === "workspace" || edge.from === selected || edge.to === selected;
- return (
- <path
- key={edge.id}
- d={edgePath(edge)}
- vectorEffect="non-scaling-stroke"
- strokeDasharray={edge.dashed ? "4 3" : undefined}
- strokeWidth={lit ? 2 : 1.25}
- className={cn(
- "fill-none transition-[stroke,opacity]",
- lit ? "stroke-brand" : "stroke-border",
- selected && !lit && "opacity-50",
- )}
- />
- );
- })}
- </svg>
- {MAP_NODES.map((id) => {
- const [x, y] = POSITION[id];
- return (
- <div
- key={id}
- className="absolute z-10 -translate-x-1/2 -translate-y-1/2"
- style={{ left: `${x}%`, top: `${y}%` }}
- >
- <CoachMark
- active={guideTarget === id}
- side="top"
- align={x > 85 ? "end" : x < 15 ? "start" : "center"}
- ringClassName="rounded-lg"
- >
- {nodeButton(id)}
- </CoachMark>
- </div>
- );
- })}
- </div>
+ <rect x={x} y={y} width={w} height={h} rx="4" fill={nodeFill(id)} stroke={nodeStroke(id)} strokeWidth={active === id ? 1.5 : 1} />
+ <text x={x + w / 2} y={y + 22} textAnchor="middle" fill="var(--foreground)" fontSize="12" fontWeight="500">
+ {t.nodes[id].name}
+ </text>
+ </g>
+ ))}
- {/* Phones: the same objects grouped as on the page; related ones light up. */}
- <div className="flex flex-col gap-3 sm:hidden">
- {GROUPS.map((group) => (
- <div key={group.key}>
- <div className="mb-1.5 text-micro text-muted-foreground">{t.groups[group.key]}</div>
- <div className="flex flex-wrap gap-2">
- {group.nodes.map((id) => (
- <CoachMark quiet key={id} active={guideTarget === id} ringClassName="rounded-lg">
- {nodeButton(id)}
- </CoachMark>
- ))}
- </div>
- </div>
- ))}
- </div>
+ {/* Bottom-left Inbox node */}
+ <g
+ style={{ cursor: "pointer", opacity: nodeOpacity("inbox") }}
+ onClick={() => setActive(active === "inbox" ? null : "inbox")}
+ onMouseEnter={() => setActive("inbox")}
+ onMouseLeave={() => setActive(null)}
+ >
+ <rect x="16" y="218" width="84" height="36" rx="4" fill={nodeFill("inbox")} stroke={nodeStroke("inbox")} strokeWidth={active === "inbox" ? 1.5 : 1} />
+ <text x="58" y="240" textAnchor="middle" fill="var(--foreground)" fontSize="12" fontWeight="500">
+ {t.nodes.inbox.name}
+ </text>
+ </g>
- {selected && (
- <div
- key={selected}
- className="rounded-lg border bg-background px-3 py-2.5 motion-safe:animate-in motion-safe:fade-in"
+ {/* Primary spine nodes */}
+ {(
+ [
+ ["issue", 16, 112, 116, 52],
+ ["agent", 218, 112, 132, 52],
+ ["run", 432, 112, 80, 52],
+ ["runtime", 542, 112, 82, 52],
+ ] as [NodeId, number, number, number, number][]
+ ).map(([id, x, y, w, h]) => (
+ <g
+ key={id}
+ style={{ cursor: "pointer", opacity: nodeOpacity(id) }}
+ onClick={() => setActive(active === id ? null : id)}
+ onMouseEnter={() => setActive(id)}
+ onMouseLeave={() => setActive(null)}
>
- <div className="text-body font-medium">{t.nodes[selected].name}</div>
- <p className="mt-0.5 text-body text-muted-foreground">{t.nodes[selected].desc}</p>
- <ul className="mt-2 flex flex-col gap-1">
- {selected === "workspace" ? (
- <li className="flex items-start gap-1.5 text-caption">
- <CornerDownRight aria-hidden className="mt-px size-3.5 shrink-0 text-brand" />
- {t.workspaceRelation}
- </li>
- ) : (
- edgesOf(selected).map((edge) => (
- <li key={edge.id} className="flex items-start gap-1.5 text-caption">
- <CornerDownRight aria-hidden className="mt-px size-3.5 shrink-0 text-brand" />
- {t.edges[edge.id]}
- </li>
- ))
- )}
- </ul>
- <div className="mt-2 text-caption text-muted-foreground">
- {t.learnMore}
- <LocaleLink href={PAGE_HREF[selected]} className="font-medium text-brand hover:underline">
- {t.nodes[selected].page}
- </LocaleLink>
- </div>
- </div>
- )}
- </div>
- </DemoFrame>
+ <rect
+ x={x}
+ y={y}
+ width={w}
+ height={h}
+ rx="4"
+ fill={nodeFill(id)}
+ stroke={nodeStroke(id)}
+ strokeWidth={1.5}
+ />
+ <text x={x + 11} y={y + 19} fill="var(--primary)" fontFamily="var(--font-mono)" fontSize="9" fontWeight="600">
+ {t.nodes[id].code}
+ </text>
+ <text x={x + 11} y={y + 38} fill="var(--foreground)" fontSize="13.5" fontWeight="600">
+ {t.nodes[id].name}
+ </text>
+ </g>
+ ))}
+ </svg>
+ </EditorialFigure>
);
}
diff --git a/apps/docs/components/demos/create-agent-demo.tsx b/apps/docs/components/demos/create-agent-demo.tsx
index 10e8933997..702f31fd7b 100644
--- a/apps/docs/components/demos/create-agent-demo.tsx
+++ b/apps/docs/components/demos/create-agent-demo.tsx
@@ -1,746 +1,47 @@
"use client";
-import { useState, type ReactNode } from "react";
-import { ArrowRight, AtSign, Bot, Check, CircleCheck, ListPlus, Monitor, Sparkles, Users } from "@multica/ui/icons";
-import { Button } from "@multica/ui/components/ui/button";
-import { cn } from "@multica/ui/lib/utils";
-import { CoachMark, DemoFrame, useDemoCopy, useDemoTimers, useStartWhenVisible } from "./demo-kit";
-
-type Harness = { id: string; label: string; version: string };
-type Access = { title: string; desc: string };
+import { CLIP_MANIFEST } from "./clip-manifest";
+import { EditorialClip, useDemoCopy } from "./demo-kit";
const copy = {
en: {
- frameTitle: "New agent",
- shellTitle: "Create an agent",
- steps: ["Choose runtime", "Configure", "Done"],
- runtimeTitle: "Where should this agent run?",
- machinesGroup: "Machines",
- thisMachine: "This machine",
- harnessCount: "2 harnesses",
- harnesses: [
- { id: "claude", label: "Claude", version: "v2.1" },
- { id: "codex", label: "Codex", version: "v0.46" },
- ] as Harness[],
- selected: "Selected:",
- selectedSummary: "Claude · This machine",
- cancel: "Cancel",
- next: "Next",
- configureTitle: "Configure the agent",
- askAi: "Let AI write it",
- identity: "Identity",
- nameLabel: "Name",
- name: "Ops helper",
- descriptionLabel: "Description",
- description: "Weekly reports, event prep and day-to-day ops chores",
- behavior: "Behavior & capabilities",
- instructionsLabel: "Instructions",
- instructions: [
- "You handle the team's day-to-day operations: weekly reports, event prep, customer feedback roundups.",
- "Read the description and comments first. If something is missing, ask in a comment instead of guessing.",
- "Deliver in the issue comments, in short paragraphs and lists. Check with the assignee before spending money or publishing anything.",
- ],
- skillsLabel: "Skills",
- skillsPlaceholder: "Add skills from workspace",
- execution: "Execution",
- executionHint: "Unspecified options use the runtime defaults.",
- runtimeLabel: "Runtime",
- runtime: "Claude (MacBook)",
- change: "Change",
- modelLabel: "Model",
- model: "Default (provider)",
- accessLabel: "Access",
- access: [
- { title: "Only me", desc: "Only you can run this agent." },
- { title: "Entire workspace", desc: "Every workspace member can run it." },
- { title: "Specific people", desc: "Only selected members can run it." },
- ] as Access[],
- create: "Create agent",
- creating: "Creating agent…",
- ready: (name: string) => `${name} is ready`,
- runsOn: (runtime: string) => `Runs on ${runtime}`,
- nextLabel: "What next",
- assignTitle: "Assign its first task",
- mentionTitle: "Mention it in an issue",
- squadTitle: "Add it to a squad",
- openAgent: "Open agent",
- backToList: "Back to agents",
- listTitle: "Agents",
- newAgent: "New agent",
- columns: { agent: "Agent", status: "Status", workload: "Workload", runtime: "Runtime" },
- online: "Online",
- idle: "Idle",
- working: "Working",
- otherAgent: "Writing helper",
- otherRuntime: "Codex (MacBook)",
- captions: {
- idle: "Creating an agent starts with where it runs.",
- runtime: "Step 1: pick a runtime. Only online harnesses can be chosen.",
- runtimeNext: "The footer shows your choice. Click Next.",
- configure: "Step 2: name and instructions are filled in. The model is left at the runtime default, and Access starts at Only me.",
- creating: "Creating the agent…",
- done: "Created. From here you can hand it work, or go back to the agent list.",
- list: "Ops helper is in the list: its runtime is online and nothing is running yet. Use Replay to watch again.",
- },
+ title: "Create and configure an agent",
+ chapters: ["Open New Agent", "Choose runtime", "Configure identity"],
+ caption: "Pick an online local runtime, define instructions and model, and set Access before creating the agent.",
},
zh: {
- frameTitle: "新建智能体",
- shellTitle: "创建智能体",
- steps: ["选择运行时", "配置", "完成"],
- runtimeTitle: "这个智能体在哪里运行?",
- machinesGroup: "机器",
- thisMachine: "本机",
- harnessCount: "2 个 harness",
- harnesses: [
- { id: "claude", label: "Claude", version: "v2.1" },
- { id: "codex", label: "Codex", version: "v0.46" },
- ] as Harness[],
- selected: "已选:",
- selectedSummary: "Claude · 本机",
- cancel: "取消",
- next: "下一步",
- configureTitle: "配置智能体",
- askAi: "让 AI 帮我写",
- identity: "身份",
- nameLabel: "名称",
- name: "运营助手",
- descriptionLabel: "描述",
- description: "整理周报、筹备活动和日常运营杂事",
- behavior: "行为与能力",
- instructionsLabel: "指令",
- instructions: [
- "你负责团队的日常运营:整理周报、筹备活动、汇总客户反馈。",
- "收到任务先读完描述和评论;信息不够就在评论里问,不要自己猜。",
- "结果写在任务评论里,用短段落和清单。要花钱或对外发布的事,先找负责人确认。",
- ],
- skillsLabel: "Skills",
- skillsPlaceholder: "从工作区添加 skill",
- execution: "执行配置",
- executionHint: "未指定的选项沿用运行时默认值。",
- runtimeLabel: "运行时",
- runtime: "Claude (MacBook)",
- change: "更换",
- modelLabel: "模型",
- model: "默认(提供方)",
- accessLabel: "访问权限",
- access: [
- { title: "仅自己", desc: "只有你可以运行此智能体。" },
- { title: "整个工作区", desc: "工作区中的所有成员都可以运行。" },
- { title: "指定成员", desc: "只有选中的成员可以运行。" },
- ] as Access[],
- create: "创建智能体",
- creating: "正在创建…",
- ready: (name: string) => `${name} 已就绪`,
- runsOn: (runtime: string) => `运行在 ${runtime}`,
- nextLabel: "接下来",
- assignTitle: "指派第一个任务",
- mentionTitle: "在任务里 @ 它",
- squadTitle: "加入小队",
- openAgent: "打开智能体",
- backToList: "返回智能体列表",
- listTitle: "智能体",
- newAgent: "新建智能体",
- columns: { agent: "智能体", status: "状态", workload: "工作负载", runtime: "运行时" },
- online: "在线",
- idle: "空闲",
- working: "处理中",
- otherAgent: "文案助手",
- otherRuntime: "Codex (MacBook)",
- captions: {
- idle: "创建智能体的第一步是决定它在哪里运行。",
- runtime: "第 1 步:选择运行时。只有在线的 harness 可以选。",
- runtimeNext: "底部显示了你的选择。点击下一步。",
- configure: "第 2 步:名称和指令已经填好。模型留空,沿用运行时默认值;访问权限默认是仅自己。",
- creating: "正在创建智能体…",
- done: "创建完成。可以直接给它派活,也可以先回到智能体列表。",
- list: "运营助手 出现在列表里:运行时在线,还没有运行,所以是空闲。点右上角可以重新演示。",
- },
+ title: "创建并配置一名智能体",
+ chapters: ["新建智能体", "选择在线运行时", "填写名称与指令"],
+ caption: "先选择在线的本地 AI 编程工具运行时,再配置身份名称、指令、模型与访问权限即可上线接活。",
+ },
+ "zh-Hant": {
+ title: "建立並設定一名智能體",
+ chapters: ["新建智能體", "選擇線上執行環境", "填寫名稱與指令"],
+ caption: "先選擇線上的本機 AI 程式設計工具執行環境,再設定名稱、指令、模型與權限即可使用。",
},
ja: {
- frameTitle: "新規エージェント",
- shellTitle: "エージェントを作成",
- steps: ["ランタイムを選択", "設定", "完了"],
- runtimeTitle: "このエージェントをどこで実行しますか?",
- machinesGroup: "マシン",
- thisMachine: "このマシン",
- harnessCount: "2 個のハーネス",
- harnesses: [
- { id: "claude", label: "Claude", version: "v2.1" },
- { id: "codex", label: "Codex", version: "v0.46" },
- ] as Harness[],
- selected: "選択中:",
- selectedSummary: "Claude · このマシン",
- cancel: "キャンセル",
- next: "次へ",
- configureTitle: "エージェントを設定",
- askAi: "AI に書いてもらう",
- identity: "基本情報",
- nameLabel: "名前",
- name: "運用アシスタント",
- descriptionLabel: "説明",
- description: "週報、イベント準備、日々の運用まわりの雑務",
- behavior: "動作と機能",
- instructionsLabel: "指示",
- instructions: [
- "チームの日常運用を担当します:週報の作成、イベントの準備、顧客フィードバックの取りまとめ。",
- "タスクを受けたら、まず説明とコメントを読みます。情報が足りなければ推測せず、コメントで質問します。",
- "成果はタスクのコメントに、短い段落と箇条書きで書きます。費用が発生する作業や社外への公開は、先に担当者に確認します。",
- ],
- skillsLabel: "スキル",
- skillsPlaceholder: "ワークスペースからスキルを追加",
- execution: "実行設定",
- executionHint: "未指定の項目はランタイムの既定値を使います。",
- runtimeLabel: "ランタイム",
- runtime: "Claude (MacBook)",
- change: "変更",
- modelLabel: "モデル",
- model: "デフォルト(プロバイダー)",
- accessLabel: "アクセス",
- access: [
- { title: "自分のみ", desc: "このエージェントを実行できるのは自分だけです。" },
- { title: "ワークスペース全体", desc: "すべてのワークスペースメンバーが実行できます。" },
- { title: "特定のメンバー", desc: "選択したメンバーだけが実行できます。" },
- ] as Access[],
- create: "エージェントを作成",
- creating: "エージェントを作成中…",
- ready: (name: string) => `${name} の準備ができました`,
- runsOn: (runtime: string) => `${runtime} で実行`,
- nextLabel: "次にすること",
- assignTitle: "最初のタスクを割り当てる",
- mentionTitle: "イシューでメンションする",
- squadTitle: "スクワッドに追加",
- openAgent: "エージェントを開く",
- backToList: "エージェント一覧に戻る",
- listTitle: "エージェント",
- newAgent: "新規エージェント",
- columns: { agent: "エージェント", status: "ステータス", workload: "作業量", runtime: "ランタイム" },
- online: "オンライン",
- idle: "アイドル",
- working: "作業中",
- otherAgent: "ライティングアシスタント",
- otherRuntime: "Codex (MacBook)",
- captions: {
- idle: "エージェントの作成は、どこで実行するかを決めるところから始まります。",
- runtime: "ステップ 1:ランタイムを選びます。選べるのはオンラインのハーネスだけです。",
- runtimeNext: "下部に選んだ内容が表示されます。「次へ」をクリックします。",
- configure: "ステップ 2:名前と指示は入力済みです。モデルは空欄のままなのでランタイムの既定値を使い、アクセスは最初「自分のみ」です。",
- creating: "エージェントを作成しています…",
- done: "作成できました。ここからすぐ仕事を任せることも、エージェント一覧に戻ることもできます。",
- list: "運用アシスタントが一覧に加わりました。ランタイムはオンラインで、まだ実行がないのでアイドルです。「もう一度」で最初から見られます。",
- },
+ title: "エージェントを作成・設定する",
+ chapters: ["新規作成を開く", "ランタイム選択", "名前と指示を設定"],
+ caption: "オンラインのランタイムを選び、名前・指示・モデル・アクセス範囲を設定して作成します。",
},
ko: {
- frameTitle: "새 에이전트",
- shellTitle: "에이전트 만들기",
- steps: ["런타임 선택", "구성", "완료"],
- runtimeTitle: "이 에이전트를 어디서 실행할까요?",
- machinesGroup: "머신",
- thisMachine: "이 머신",
- harnessCount: "하네스 2개",
- harnesses: [
- { id: "claude", label: "Claude", version: "v2.1" },
- { id: "codex", label: "Codex", version: "v0.46" },
- ] as Harness[],
- selected: "선택됨:",
- selectedSummary: "Claude · 이 머신",
- cancel: "취소",
- next: "다음",
- configureTitle: "에이전트 구성",
- askAi: "AI에게 작성 맡기기",
- identity: "기본 정보",
- nameLabel: "이름",
- name: "운영 도우미",
- descriptionLabel: "설명",
- description: "주간 보고, 행사 준비, 일상적인 운영 업무",
- behavior: "동작 및 기능",
- instructionsLabel: "지침",
- instructions: [
- "팀의 일상 운영을 맡습니다: 주간 보고 작성, 행사 준비, 고객 피드백 정리.",
- "태스크를 받으면 설명과 댓글부터 읽습니다. 정보가 부족하면 추측하지 말고 댓글로 물어봅니다.",
- "결과는 태스크 댓글에 짧은 문단과 목록으로 남깁니다. 비용이 들거나 외부에 공개하는 일은 먼저 담당자에게 확인합니다.",
- ],
- skillsLabel: "스킬",
- skillsPlaceholder: "워크스페이스에서 스킬 추가",
- execution: "실행 설정",
- executionHint: "지정하지 않은 옵션은 런타임 기본값을 사용합니다.",
- runtimeLabel: "런타임",
- runtime: "Claude (MacBook)",
- change: "변경",
- modelLabel: "모델",
- model: "기본값(제공자)",
- accessLabel: "접근 권한",
- access: [
- { title: "나만", desc: "나만 이 에이전트를 실행할 수 있습니다." },
- { title: "전체 워크스페이스", desc: "모든 워크스페이스 멤버가 실행할 수 있습니다." },
- { title: "특정 멤버", desc: "선택한 멤버만 실행할 수 있습니다." },
- ] as Access[],
- create: "에이전트 만들기",
- creating: "에이전트 만드는 중…",
- ready: (name: string) => `${name} 준비 완료`,
- runsOn: (runtime: string) => `${runtime}에서 실행`,
- nextLabel: "다음 단계",
- assignTitle: "첫 작업 할당하기",
- mentionTitle: "이슈에서 멘션하기",
- squadTitle: "스쿼드에 추가",
- openAgent: "에이전트 열기",
- backToList: "에이전트 목록으로",
- listTitle: "에이전트",
- newAgent: "새 에이전트",
- columns: { agent: "에이전트", status: "상태", workload: "작업량", runtime: "런타임" },
- online: "온라인",
- idle: "유휴",
- working: "작업 중",
- otherAgent: "글쓰기 도우미",
- otherRuntime: "Codex (MacBook)",
- captions: {
- idle: "에이전트를 만들 때는 먼저 어디서 실행할지 정합니다.",
- runtime: "1단계: 런타임을 고릅니다. 온라인인 하네스만 선택할 수 있습니다.",
- runtimeNext: "아래쪽에 선택한 항목이 표시됩니다. 다음을 클릭하세요.",
- configure: "2단계: 이름과 지침은 채워져 있습니다. 모델은 비워 두어 런타임 기본값을 쓰고, 접근 권한은 처음에 나만입니다.",
- creating: "에이전트를 만드는 중…",
- done: "만들었습니다. 여기서 바로 일을 맡기거나 에이전트 목록으로 돌아갈 수 있습니다.",
- list: "운영 도우미가 목록에 추가되었습니다. 런타임은 온라인이고 아직 실행이 없어 유휴 상태입니다. 다시 보기를 누르면 처음부터 볼 수 있습니다.",
- },
+ title: "새 에이전트 생성 및 구성하기",
+ chapters: ["에이전트 만들기", "런타임 선택", "이름 및 지침 설정"],
+ caption: "온라인 런타임을 고른 뒤 이름, 지침, 모델, 접근 권한을 설정하면 바로 사용할 수 있습니다.",
},
fr: {
- frameTitle: "Nouvel agent",
- shellTitle: "Créer un agent",
- steps: ["Choisir le runtime", "Configurer", "Terminé"],
- runtimeTitle: "Où cet agent doit-il s'exécuter ?",
- machinesGroup: "Machines",
- thisMachine: "Cette machine",
- harnessCount: "2 harness",
- harnesses: [
- { id: "claude", label: "Claude", version: "v2.1" },
- { id: "codex", label: "Codex", version: "v0.46" },
- ] as Harness[],
- selected: "Sélection :",
- selectedSummary: "Claude · Cette machine",
- cancel: "Annuler",
- next: "Suivant",
- configureTitle: "Configurer l'agent",
- askAi: "Laisser l'IA rédiger",
- identity: "Identité",
- nameLabel: "Nom",
- name: "Assistant ops",
- descriptionLabel: "Description",
- description: "Rapports hebdomadaires, préparation d'événements et tâches ops du quotidien",
- behavior: "Comportement et capacités",
- instructionsLabel: "Instructions",
- instructions: [
- "Tu gères les opérations courantes de l'équipe : rapports hebdomadaires, préparation d'événements, synthèse des retours clients.",
- "Lis d'abord la description et les commentaires. S'il manque une information, pose la question en commentaire au lieu de deviner.",
- "Livre le résultat dans les commentaires de la tâche, en paragraphes courts et en listes. Avant toute dépense ou publication externe, demande confirmation à la personne assignée.",
- ],
- skillsLabel: "Skills",
- skillsPlaceholder: "Ajouter des skills de l'espace de travail",
- execution: "Exécution",
- executionHint: "Les options non spécifiées utilisent les valeurs par défaut du runtime.",
- runtimeLabel: "Runtime",
- runtime: "Claude (MacBook)",
- change: "Changer",
- modelLabel: "Modèle",
- model: "Par défaut (fournisseur)",
- accessLabel: "Accès",
- access: [
- { title: "Moi uniquement", desc: "Vous seul pouvez exécuter cet agent." },
- { title: "Tout l'espace de travail", desc: "Tous les membres de l'espace de travail peuvent l'exécuter." },
- { title: "Personnes précises", desc: "Seuls les membres sélectionnés peuvent l'exécuter." },
- ] as Access[],
- create: "Créer l'agent",
- creating: "Création de l'agent…",
- ready: (name: string) => `${name} est prêt`,
- runsOn: (runtime: string) => `S'exécute sur ${runtime}`,
- nextLabel: "Et ensuite",
- assignTitle: "Lui confier une première tâche",
- mentionTitle: "Le mentionner dans un ticket",
- squadTitle: "L'ajouter à une escouade",
- openAgent: "Ouvrir l'agent",
- backToList: "Retour aux agents",
- listTitle: "Agents",
- newAgent: "Nouvel agent",
- columns: { agent: "Agent", status: "Statut", workload: "Charge", runtime: "Runtime" },
- online: "En ligne",
- idle: "Au repos",
- working: "Au travail",
- otherAgent: "Assistant rédaction",
- otherRuntime: "Codex (MacBook)",
- captions: {
- idle: "Créer un agent commence par choisir où il s'exécute.",
- runtime: "Étape 1 : choisissez un runtime. Seuls les harness en ligne sont sélectionnables.",
- runtimeNext: "Le bas de l'écran affiche votre choix. Cliquez sur Suivant.",
- configure: "Étape 2 : le nom et les instructions sont remplis. Le modèle reste vide, donc le runtime applique sa valeur par défaut, et l'accès part de Moi uniquement.",
- creating: "Création de l'agent…",
- done: "C'est créé. D'ici, vous pouvez lui confier du travail ou revenir à la liste des agents.",
- list: "Assistant ops apparaît dans la liste : son runtime est en ligne et rien ne tourne encore, il est donc au repos. Cliquez sur Rejouer pour revoir la démo.",
- },
+ title: "Créer et configurer un agent",
+ chapters: ["Nouvel agent", "Choisir le runtime", "Configurer l'identité"],
+ caption: "Sélectionnez un runtime en ligne, puis renseignez le nom, les instructions, le modèle et l'accès.",
},
};
-type Phase = "runtime" | "runtimeNext" | "configure" | "creating" | "done" | "list";
-
-const STEP_INDEX: Record<Phase, number> = {
- runtime: 0,
- runtimeNext: 0,
- configure: 1,
- creating: 1,
- done: 2,
- list: 2,
-};
-
-// Follows the product's three-step route: choose a runtime, configure the
-// draft, land on the done page. Form fields are fixed text, so the only
-// enabled control on each screen is the one that moves the flow forward.
export function CreateAgentDemo() {
const t = useDemoCopy(copy);
- const { after, clear } = useDemoTimers();
- const [frameRef, visible] = useStartWhenVisible<HTMLElement>();
- const [phase, setPhase] = useState<Phase>("runtime");
-
- const create = () => {
- setPhase("creating");
- after(900, () => setPhase("done"));
- };
-
- const replay = () => {
- clear();
- setPhase("runtime");
- };
-
- const caption = visible ? t.captions[phase] : t.captions.idle;
- const step = STEP_INDEX[phase];
-
- return (
- <DemoFrame frameRef={frameRef} title={t.frameTitle} caption={caption} onReplay={replay}>
- {phase === "list" ? (
- <AgentList t={t} />
- ) : (
- <div className="flex min-h-80 flex-col">
- <div className="flex flex-wrap items-center gap-x-3 gap-y-1 border-b px-4 py-2">
- <div className="min-w-0 flex-1">
- <div className="truncate text-label font-semibold">{t.shellTitle}</div>
- <div className="truncate text-caption text-muted-foreground">{t.steps[step]}</div>
- </div>
- <ol className="flex items-center gap-1.5">
- {t.steps.map((label, i) => (
- <li key={label} className="flex items-center gap-1.5 text-caption">
- <span
- className={cn(
- "flex size-4 items-center justify-center rounded-full text-micro font-medium",
- i < step && "bg-success/15 text-success",
- i === step && "bg-foreground text-background",
- i > step && "bg-muted text-muted-foreground",
- )}
- >
- {i < step ? <Check aria-hidden className="size-2.5" /> : i + 1}
- </span>
- <span className={cn("max-sm:hidden", i === step ? "text-foreground" : "text-muted-foreground")}>
- {label}
- </span>
- </li>
- ))}
- </ol>
- </div>
-
- {(phase === "runtime" || phase === "runtimeNext") && (
- <RuntimeStep t={t} visible={visible} phase={phase} onPick={() => setPhase("runtimeNext")} onNext={() => setPhase("configure")} />
- )}
- {(phase === "configure" || phase === "creating") && (
- <ConfigureStep t={t} creating={phase === "creating"} onCreate={create} />
- )}
- {phase === "done" && <DoneStep t={t} onBack={() => setPhase("list")} />}
- </div>
- )}
- </DemoFrame>
- );
-}
-
-type Copy = (typeof copy)["en"];
-
-function RuntimeStep({
- t,
- visible,
- phase,
- onPick,
- onNext,
-}: {
- t: Copy;
- visible: boolean;
- phase: Phase;
- onPick: () => void;
- onNext: () => void;
-}) {
- const picked = phase === "runtimeNext";
- return (
- <>
- <div className="flex-1 px-4 py-4">
- <div className="text-title-sm font-semibold">{t.runtimeTitle}</div>
- <div className="mt-3 text-micro text-muted-foreground">{t.machinesGroup}</div>
- <div className="mt-1 rounded-lg border bg-background">
- <div className="flex items-center gap-2 border-b px-3 py-2">
- <Monitor aria-hidden className="size-4 text-muted-foreground" />
- <span className="text-label font-medium">{t.thisMachine}</span>
- <span className="text-caption text-muted-foreground">· {t.harnessCount}</span>
- </div>
- <div className="grid gap-1.5 p-2 sm:grid-cols-2">
- {t.harnesses.map((harness, i) => {
- const selected = picked && i === 0;
- const enabled = visible && phase === "runtime" && i === 0;
- return (
- <CoachMark
- key={harness.id}
- active={enabled}
- side="bottom"
- align="start"
- ringClassName="rounded-md"
- className="flex w-full"
- >
- <button
- type="button"
- aria-pressed={selected}
- disabled={!enabled}
- onClick={onPick}
- className={cn(
- "flex w-full items-center gap-2 rounded-md border px-2.5 py-2 text-left transition-colors",
- selected ? "border-brand bg-brand/7 dark:bg-brand/12" : "hover:bg-muted/60 disabled:hover:bg-transparent",
- )}
- >
- <span aria-hidden className="size-1.5 shrink-0 rounded-full bg-success" />
- <span className="min-w-0 flex-1 truncate text-body font-medium">{harness.label}</span>
- <span className="text-caption text-muted-foreground">{harness.version}</span>
- {selected && <Check aria-hidden className="size-3.5 text-brand" />}
- </button>
- </CoachMark>
- );
- })}
- </div>
- </div>
- </div>
- <div className="mt-4 flex items-center gap-2 border-t px-4 py-2.5">
- <p className="min-w-0 flex-1 truncate text-label text-muted-foreground">
- {picked && (
- <>
- {t.selected} <span className="font-medium text-foreground">{t.selectedSummary}</span>
- </>
- )}
- </p>
- <Button type="button" variant="ghost" size="sm" disabled>
- {t.cancel}
- </Button>
- <CoachMark active={picked} side="top" align="end" ringClassName="rounded-lg">
- <Button type="button" size="sm" disabled={!picked} onClick={onNext}>
- {t.next}
- <ArrowRight aria-hidden className="size-3.5" />
- </Button>
- </CoachMark>
- </div>
- </>
- );
-}
-
-function Field({ label, children }: { label: string; children: ReactNode }) {
- return (
- <div className="grid gap-1 px-3 py-2 sm:grid-cols-[6rem_minmax(0,1fr)] sm:gap-3">
- <div className="pt-1 text-label font-medium">{label}</div>
- <div className="min-w-0">{children}</div>
- </div>
- );
-}
-
-function Section({ title, hint, children }: { title: string; hint?: string; children: ReactNode }) {
- return (
- <section>
- <div className="mb-1 flex flex-wrap items-baseline gap-x-2">
- <span className="text-label font-semibold">{title}</span>
- {hint && <span className="text-caption text-muted-foreground">{hint}</span>}
- </div>
- <div className="divide-y rounded-lg border bg-background">{children}</div>
- </section>
- );
-}
-
-const valueBox = "rounded-md border bg-card px-2 py-1 text-body";
-
-function ConfigureStep({ t, creating, onCreate }: { t: Copy; creating: boolean; onCreate: () => void }) {
- return (
- <>
- <div className="flex flex-1 flex-col gap-4 px-4 py-4 motion-safe:animate-in motion-safe:fade-in">
- <div className="flex flex-wrap items-center justify-between gap-2">
- <div className="text-title-sm font-semibold">{t.configureTitle}</div>
- <Button type="button" variant="outline" size="sm" disabled>
- <Sparkles aria-hidden className="size-3.5" />
- {t.askAi}
- </Button>
- </div>
-
- <Section title={t.identity}>
- <Field label={t.nameLabel}>
- <div className={valueBox}>{t.name}</div>
- </Field>
- <Field label={t.descriptionLabel}>
- <div className={valueBox}>{t.description}</div>
- </Field>
- </Section>
-
- <Section title={t.behavior}>
- <Field label={t.instructionsLabel}>
- <div className={cn(valueBox, "flex flex-col gap-1 font-mono text-caption leading-5")}>
- {t.instructions.map((line) => (
- <span key={line}>{line}</span>
- ))}
- </div>
- </Field>
- <Field label={t.skillsLabel}>
- <div className={cn(valueBox, "border-dashed text-muted-foreground")}>{t.skillsPlaceholder}</div>
- </Field>
- </Section>
-
- <Section title={t.execution} hint={t.executionHint}>
- <Field label={t.runtimeLabel}>
- <div className={cn(valueBox, "flex items-center gap-2")}>
- <span aria-hidden className="size-1.5 shrink-0 rounded-full bg-success" />
- <span className="min-w-0 flex-1 truncate">{t.runtime}</span>
- <span className="text-caption text-muted-foreground">{t.change}</span>
- </div>
- </Field>
- <Field label={t.modelLabel}>
- <div className={cn(valueBox, "text-muted-foreground")}>{t.model}</div>
- </Field>
- </Section>
-
- <Section title={t.accessLabel}>
- <div className="flex flex-col gap-0.5 p-1.5">
- {t.access.map((option, i) => (
- <div key={option.title} className={cn("flex items-start gap-2 rounded-md px-2 py-1.5", i === 0 && "bg-muted")}>
- <span
- aria-hidden
- className={cn(
- "mt-1 flex size-3.5 shrink-0 items-center justify-center rounded-full border",
- i === 0 ? "border-foreground" : "border-muted-foreground/50",
- )}
- >
- {i === 0 && <span className="size-1.5 rounded-full bg-foreground" />}
- </span>
- <span className="min-w-0 text-body">
- <span className="font-medium">{option.title}</span>
- <span className="text-caption text-muted-foreground"> · {option.desc}</span>
- </span>
- </div>
- ))}
- </div>
- </Section>
- </div>
- <div className="flex justify-end border-t px-4 py-2.5">
- <CoachMark active={!creating} side="left" ringClassName="rounded-lg">
- <Button type="button" size="sm" disabled={creating} onClick={onCreate}>
- {creating ? t.creating : t.create}
- </Button>
- </CoachMark>
- </div>
- </>
- );
-}
-
-function DoneStep({ t, onBack }: { t: Copy; onBack: () => void }) {
- const actions = [
- { icon: ListPlus, title: t.assignTitle, primary: true },
- { icon: AtSign, title: t.mentionTitle, primary: false },
- { icon: Users, title: t.squadTitle, primary: false },
- ];
- return (
- <div className="flex flex-1 flex-col items-center px-4 py-6 motion-safe:animate-in motion-safe:fade-in">
- <span className="relative inline-flex">
- <span className="flex size-12 items-center justify-center rounded-full bg-brand/12 text-brand">
- <Bot aria-hidden className="size-6" />
- </span>
- <CircleCheck aria-hidden className="absolute -right-1 -bottom-1 size-5 rounded-full bg-background text-success" />
- </span>
- <div className="mt-3 text-title-sm font-semibold">{t.ready(t.name)}</div>
- <div className="mt-1 text-body text-muted-foreground">{t.runsOn(t.runtime)}</div>
-
- <div className="mt-5 w-full max-w-sm">
- <div className="text-label font-medium text-muted-foreground">{t.nextLabel}</div>
- <div className="mt-1.5 flex flex-col gap-1.5">
- {actions.map(({ icon: Icon, title, primary }) => (
- <div
- key={title}
- className={cn(
- "flex items-center gap-2.5 rounded-lg border bg-card px-3 py-2",
- primary && "border-primary/30 bg-primary/[0.03]",
- )}
- >
- <span
- className={cn(
- "flex size-7 shrink-0 items-center justify-center rounded-md bg-muted text-muted-foreground",
- primary && "bg-primary/10 text-primary",
- )}
- >
- <Icon aria-hidden className="size-3.5" />
- </span>
- <span className="min-w-0 flex-1 text-body font-medium">{title}</span>
- <ArrowRight aria-hidden className="size-3.5 text-muted-foreground" />
- </div>
- ))}
- </div>
- </div>
-
- <div className="mt-5 flex items-center gap-3 text-label">
- <span className="font-medium">{t.openAgent}</span>
- <span aria-hidden className="text-muted-foreground">·</span>
- <CoachMark active side="bottom" ringClassName="rounded-md">
- <button type="button" onClick={onBack} className="rounded-md px-1 text-muted-foreground underline-offset-4 hover:text-foreground hover:underline">
- {t.backToList}
- </button>
- </CoachMark>
- </div>
- <div className="h-6" />
- </div>
- );
-}
-
-function AgentList({ t }: { t: Copy }) {
- const rows = [
- { name: t.name, workload: t.idle, runtime: t.runtime, fresh: true },
- { name: t.otherAgent, workload: t.working, runtime: t.otherRuntime, fresh: false },
- ];
- return (
- <div className="flex flex-col gap-3 p-4 motion-safe:animate-in motion-safe:fade-in">
- <div className="flex items-center justify-between gap-2">
- <div className="text-title-sm font-semibold">{t.listTitle}</div>
- <Button type="button" size="sm" disabled>
- {t.newAgent}
- </Button>
- </div>
- <div className="overflow-hidden rounded-lg border bg-background">
- <div className="grid grid-cols-[minmax(0,1.4fr)_minmax(0,1fr)_minmax(0,1fr)] gap-2 border-b px-3 py-1.5 text-caption text-muted-foreground sm:grid-cols-[minmax(0,1.4fr)_minmax(0,1fr)_minmax(0,1fr)_minmax(0,1.4fr)]">
- <span>{t.columns.agent}</span>
- <span>{t.columns.status}</span>
- <span>{t.columns.workload}</span>
- <span className="max-sm:hidden">{t.columns.runtime}</span>
- </div>
- {rows.map((row) => (
- <div
- key={row.name}
- className={cn(
- "grid grid-cols-[minmax(0,1.4fr)_minmax(0,1fr)_minmax(0,1fr)] items-center gap-2 px-3 py-2 text-body sm:grid-cols-[minmax(0,1.4fr)_minmax(0,1fr)_minmax(0,1fr)_minmax(0,1.4fr)]",
- row.fresh && "bg-brand/5 motion-safe:animate-in motion-safe:slide-in-from-top-1",
- )}
- >
- <span className="flex min-w-0 items-center gap-2">
- <span aria-hidden className="inline-flex size-5 shrink-0 items-center justify-center rounded-full bg-brand/12 text-brand">
- <Bot className="size-3" />
- </span>
- <span className="truncate font-medium">{row.name}</span>
- </span>
- <span className="flex items-center gap-1.5">
- <span aria-hidden className="size-1.5 shrink-0 rounded-full bg-success" />
- {t.online}
- </span>
- <span className="text-muted-foreground">{row.workload}</span>
- <span className="truncate text-caption text-muted-foreground max-sm:hidden">{row.runtime}</span>
- </div>
- ))}
- </div>
- </div>
- );
+ const meta = CLIP_MANIFEST["create-agent"] ?? { duration: 6.0, chapters: [] };
+ const chapters = t.chapters.map((label, i) => ({
+ label,
+ at: meta.chapters[i]?.at ?? (i * meta.duration) / t.chapters.length,
+ }));
+ return <EditorialClip slug="create-agent" title={t.title} chapters={chapters} duration={meta.duration} caption={t.caption} />;
}
diff --git a/apps/docs/components/demos/deliverables-demo.tsx b/apps/docs/components/demos/deliverables-demo.tsx
index 08b17ac8c8..ee5b19630c 100644
--- a/apps/docs/components/demos/deliverables-demo.tsx
+++ b/apps/docs/components/demos/deliverables-demo.tsx
@@ -1,410 +1,47 @@
"use client";
-import { useState, type ReactNode } from "react";
-import { Check, ChevronDown, ChevronRight, FileText, LayoutGrid, MessageSquareText, X } from "@multica/ui/icons";
-import { cn } from "@multica/ui/lib/utils";
-import { CoachMark, DemoAvatar, DemoFrame, useDemoCopy, useStartWhenVisible } from "./demo-kit";
-
-type Version = 1 | 2;
+import { CLIP_MANIFEST } from "./clip-manifest";
+import { EditorialClip, useDemoCopy } from "./demo-kit";
const copy = {
en: {
- title: "OPS-52 · Compare restaurants for the team dinner",
- agent: "Ops helper",
- member: "Lei Li",
- fileName: "restaurants.pdf",
- fileType: "PDF",
- size: { 1: "84 KB", 2: "86 KB" } as Record<Version, string>,
- uploadedAt: { 1: "Oct 20, 2026, 2:05 PM", 2: "Oct 21, 2026, 10:40 AM" } as Record<Version, string>,
- comments: {
- first: "Three candidates compared in the attachment, sorted by distance from the office.",
- feedback: "The second one has a free private room. Sort them by total price instead?",
- second: "Re-sorted by total price.",
- },
- sectionTitle: "Deliverables",
- viewAll: "View all 1 deliverable",
- versionShort: (v: Version) => `v${v}`,
- versionLabel: (v: Version) => `Version ${v} of 2`,
- versionOf: (v: Version) => `v${v} of 2`,
- locate: "Show in comments",
- close: "Close",
- page: {
- heading: "Team dinner · 12 people",
- sortedBy: { 1: "Sorted by distance", 2: "Sorted by total price" } as Record<Version, string>,
- rows: {
- 1: ["Riverside Grill · 5 min walk", "Lotus Garden · 8 min walk", "The Brick Room · 12 min walk"],
- 2: ["Lotus Garden · $420, room free", "Riverside Grill · $450", "The Brick Room · $470"],
- } as Record<Version, string[]>,
- },
- captions: {
- idle: "An issue where the agent uploaded a file, got feedback, and uploaded it again.",
- start: "Both uploads share a name and type, so Deliverables lists one file, marked v2. Open it.",
- viewer: "The viewer opens the latest version. Click the version number to see the others.",
- versions: "Newest first. Pick v1.",
- v1: "This is the first version. Show in comments takes you to the comment that posted it.",
- located: "The viewer closed and the page is on the comment that uploaded v1. Use Replay to run it again.",
- },
+ title: "Review structured deliverables in an issue",
+ chapters: ["Issue context", "Structured tables", "Diff & summary"],
+ caption: "Tables, diffs, charts, and attached files stay directly on the issue timeline so reviewers verify outcomes in one place.",
},
zh: {
- title: "OPS-52 · 比较团建餐厅候选",
- agent: "运营助手",
- member: "李雷",
- fileName: "餐厅对比.pdf",
- fileType: "PDF",
- size: { 1: "84 KB", 2: "86 KB" } as Record<Version, string>,
- uploadedAt: { 1: "2026年10月20日 14:05", 2: "2026年10月21日 10:40" } as Record<Version, string>,
- comments: {
- first: "三家候选餐厅的对比在附件里,按离公司的距离排序。",
- feedback: "第二家包间免费,改成按总价排吧。",
- second: "已改成按总价排序。",
- },
- sectionTitle: "产物",
- viewAll: "查看全部 1 个产物",
- versionShort: (v: Version) => `v${v}`,
- versionLabel: (v: Version) => `第 ${v} 版,共 2 版`,
- versionOf: (v: Version) => `v${v}(共 2 版)`,
- locate: "定位到评论",
- close: "关闭",
- page: {
- heading: "团建聚餐 · 12 人",
- sortedBy: { 1: "按距离排序", 2: "按总价排序" } as Record<Version, string>,
- rows: {
- 1: ["江边小馆 · 步行 5 分钟", "荷塘人家 · 步行 8 分钟", "红砖餐厅 · 步行 12 分钟"],
- 2: ["荷塘人家 · 1680 元,包间免费", "江边小馆 · 1800 元", "红砖餐厅 · 1860 元"],
- } as Record<Version, string[]>,
- },
- captions: {
- idle: "一条任务:智能体上传了文件,收到意见后又传了一版。",
- start: "两次上传的文件同名、同类型,所以产物里只列一份,标着 v2。点开它。",
- viewer: "查看器打开的是最新版。点版本号看其他版本。",
- versions: "新版本在上面。选 v1。",
- v1: "现在看的是第一版。点定位到评论,回到上传它的那条评论。",
- located: "查看器关了,页面停在上传 v1 的评论上。点右上角可以再演示一遍。",
- },
+ title: "在任务时间线中验收结构化交付物",
+ chapters: ["任务上下文", "结构化对比表", "改动 Diff 与结论"],
+ caption: "对比表、代码 Diff、图表与附件完整沉淀在任务时间线中,验收者不必切工具即可一屏核对。",
+ },
+ "zh-Hant": {
+ title: "在任務時間線中驗收結構化交付物",
+ chapters: ["任務上下文", "結構化對比表", "改動 Diff 與結論"],
+ caption: "對比表、程式碼 Diff、圖表與附件完整沉澱在任務時間線中,驗收者可於同頁核對。",
},
ja: {
- title: "OPS-52 · チーム食事会のお店候補を比較",
- agent: "運用アシスタント",
- member: "李雷",
- fileName: "店舗比較.pdf",
- fileType: "PDF",
- size: { 1: "84 KB", 2: "86 KB" } as Record<Version, string>,
- uploadedAt: { 1: "2026/10/20 14:05", 2: "2026/10/21 10:40" } as Record<Version, string>,
- comments: {
- first: "候補 3 店の比較を添付しました。会社からの距離順です。",
- feedback: "2 軒目は個室料が無料です。総額順に並べ替えてもらえますか?",
- second: "総額順に並べ替えました。",
- },
- sectionTitle: "成果物",
- viewAll: "成果物 1 件をすべて表示",
- versionShort: (v: Version) => `v${v}`,
- versionLabel: (v: Version) => `バージョン ${v}(全 2 版)`,
- versionOf: (v: Version) => `v${v}(全 2 版)`,
- locate: "コメントで表示",
- close: "閉じる",
- page: {
- heading: "チーム食事会 · 12 人",
- sortedBy: { 1: "距離順", 2: "総額順" } as Record<Version, string>,
- rows: {
- 1: ["川辺食堂 · 徒歩 5 分", "蓮の庭 · 徒歩 8 分", "レンガ亭 · 徒歩 12 分"],
- 2: ["蓮の庭 · 54,000 円、個室無料", "川辺食堂 · 58,000 円", "レンガ亭 · 60,000 円"],
- } as Record<Version, string[]>,
- },
- captions: {
- idle: "エージェントがファイルを上げ、意見を受けてもう一度上げたタスクです。",
- start: "2 回のアップロードは名前も種類も同じなので、成果物には 1 件だけ v2 として並びます。開いてみます。",
- viewer: "ビューアは最新版で開きます。バージョン番号をクリックすると、ほかの版が見られます。",
- versions: "新しい版が上です。v1 を選びます。",
- v1: "いま見ているのは最初の版です。「コメントで表示」で、これを投稿したコメントに戻ります。",
- located: "ビューアが閉じ、v1 をアップロードしたコメントが表示されました。「もう一度」で最初から試せます。",
- },
+ title: "タスク上で構造化された成果物をレビューする",
+ chapters: ["タスクの背景", "比較テーブル", "差分とまとめ"],
+ caption: "テーブル、diff、グラフ、添付ファイルが同じタイムラインに残り、その場で確認できます。",
},
ko: {
- title: "OPS-52 · 팀 회식 식당 후보 비교",
- agent: "운영 도우미",
- member: "리레이",
- fileName: "식당-비교.pdf",
- fileType: "PDF",
- size: { 1: "84 KB", 2: "86 KB" } as Record<Version, string>,
- uploadedAt: { 1: "2026. 10. 20. 오후 2:05", 2: "2026. 10. 21. 오전 10:40" } as Record<Version, string>,
- comments: {
- first: "후보 식당 세 곳 비교를 첨부했습니다. 회사에서 가까운 순입니다.",
- feedback: "두 번째 집은 룸이 무료예요. 총액 순으로 바꿔 줄래요?",
- second: "총액 순으로 다시 정렬했습니다.",
- },
- sectionTitle: "산출물",
- viewAll: "산출물 1개 모두 보기",
- versionShort: (v: Version) => `v${v}`,
- versionLabel: (v: Version) => `버전 ${v} / 전체 2개`,
- versionOf: (v: Version) => `v${v} / 전체 2개`,
- locate: "댓글에서 보기",
- close: "닫기",
- page: {
- heading: "팀 회식 · 12명",
- sortedBy: { 1: "거리순", 2: "총액순" } as Record<Version, string>,
- rows: {
- 1: ["강변식당 · 도보 5분", "연못집 · 도보 8분", "벽돌집 · 도보 12분"],
- 2: ["연못집 · 46만 원, 룸 무료", "강변식당 · 49만 원", "벽돌집 · 51만 원"],
- } as Record<Version, string[]>,
- },
- captions: {
- idle: "에이전트가 파일을 올리고, 의견을 받은 뒤 다시 올린 태스크입니다.",
- start: "두 번 올린 파일은 이름과 형식이 같아서 산출물에는 하나만 v2로 표시됩니다. 열어 보세요.",
- viewer: "뷰어는 최신 버전으로 열립니다. 버전 번호를 클릭하면 다른 버전을 볼 수 있습니다.",
- versions: "새 버전이 위에 있습니다. v1을 고르세요.",
- v1: "지금 보는 것은 첫 버전입니다. '댓글에서 보기'를 누르면 이 파일을 올린 댓글로 돌아갑니다.",
- located: "뷰어가 닫히고 v1을 올린 댓글이 표시됐습니다. '다시 보기'로 처음부터 해 보세요.",
- },
+ title: "태스크 타임라인에서 구조화된 결과물 검토하기",
+ chapters: ["태스크 맥락", "비교 테이블", "Diff 및 요약"],
+ caption: "표, 코드 diff, 차트, 첨부 파일이 같은 타임라인에 정리되어 한곳에서 검증할 수 있습니다.",
},
fr: {
- title: "OPS-52 · Comparer les restaurants du dîner d'équipe",
- agent: "Assistant ops",
- member: "Lei Li",
- fileName: "comparatif.pdf",
- fileType: "PDF",
- size: { 1: "84 Ko", 2: "86 Ko" } as Record<Version, string>,
- uploadedAt: { 1: "20 oct. 2026, 14:05", 2: "21 oct. 2026, 10:40" } as Record<Version, string>,
- comments: {
- first: "Le comparatif des trois restaurants est en pièce jointe, trié par distance du bureau.",
- feedback: "Le deuxième offre le salon privé. Tu peux trier par prix total ?",
- second: "Trié par prix total.",
- },
- sectionTitle: "Livrables",
- viewAll: "Voir le livrable",
- versionShort: (v: Version) => `v${v}`,
- versionLabel: (v: Version) => `Version ${v} sur 2`,
- versionOf: (v: Version) => `v${v} sur 2`,
- locate: "Afficher dans les commentaires",
- close: "Fermer",
- page: {
- heading: "Dîner d'équipe · 12 personnes",
- sortedBy: { 1: "Trié par distance", 2: "Trié par prix total" } as Record<Version, string>,
- rows: {
- 1: ["Le Quai · 5 min à pied", "Le Jardin du Lotus · 8 min à pied", "La Brique · 12 min à pied"],
- 2: ["Le Jardin du Lotus · 380 €, salon offert", "Le Quai · 410 €", "La Brique · 425 €"],
- } as Record<Version, string[]>,
- },
- captions: {
- idle: "Une tâche où l'agent a envoyé un fichier, reçu un retour, puis l'a renvoyé.",
- start: "Les deux envois ont le même nom et le même type : Livrables n'affiche qu'un fichier, marqué v2. Ouvrez-le.",
- viewer: "La visionneuse s'ouvre sur la dernière version. Cliquez sur le numéro de version pour voir les autres.",
- versions: "La plus récente en haut. Choisissez v1.",
- v1: "Voici la première version. Afficher dans les commentaires ramène au commentaire qui l'a publiée.",
- located: "La visionneuse s'est fermée sur le commentaire qui a envoyé la v1. Utilisez Rejouer pour recommencer.",
- },
+ title: "Relire des livrables structurés dans une tâche",
+ chapters: ["Contexte", "Tableaux", "Diff et résumé"],
+ caption: "Tableaux, diffs et pièces jointes restent sur le fil de la tâche pour tout vérifier au même endroit.",
},
};
-type Phase = "idle" | "start" | "viewer" | "versions" | "v1" | "located";
-
export function DeliverablesDemo() {
const t = useDemoCopy(copy);
- const [frameRef, visible] = useStartWhenVisible<HTMLElement>();
- const [phase, setPhase] = useState<Exclude<Phase, "idle">>("start");
-
- const shownPhase: Phase = visible ? phase : "idle";
- const viewerOpen = phase === "viewer" || phase === "versions" || phase === "v1";
- const version: Version = phase === "v1" ? 1 : 2;
- const replay = () => setPhase("start");
-
- const attachment = (v: Version) => (
- <span className="mt-1.5 flex w-full max-w-64 items-center gap-2 rounded-md border bg-card px-2 py-1.5 text-caption">
- <FileText aria-hidden className="size-3.5 shrink-0 text-muted-foreground" />
- <span className="min-w-0 truncate">{t.fileName}</span>
- <VersionBadge label={t.versionShort(v)} />
- <span className="ml-auto shrink-0 text-micro text-muted-foreground tabular-nums">{t.size[v]}</span>
- </span>
- );
-
- return (
- <DemoFrame frameRef={frameRef} title={t.title} caption={t.captions[shownPhase]} onReplay={replay}>
- <div className="relative min-h-96">
- <div className={cn("grid gap-4 p-4 sm:grid-cols-[minmax(0,1fr)_13rem]", viewerOpen && "invisible")}>
- <div className="flex min-w-0 flex-col gap-2">
- <Comment
- author={t.agent}
- agent
- highlighted={phase === "located"}
- body={t.comments.first}
- attachment={attachment(1)}
- />
- <Comment author={t.member} body={t.comments.feedback} />
- <Comment author={t.agent} agent body={t.comments.second} attachment={attachment(2)} />
- </div>
-
- <aside className="order-first min-w-0 sm:order-none">
- <div className="mb-1.5 flex items-center gap-1 px-1 text-caption font-medium">
- {t.sectionTitle}
- <span className="rounded-xs bg-muted px-1 text-micro font-medium text-muted-foreground tabular-nums">1</span>
- <ChevronRight aria-hidden className="size-3 rotate-90 text-muted-foreground" />
- </div>
- <CoachMark active={shownPhase === "start"} side="bottom" align="end" ringClassName="rounded-md" className="flex w-full">
- <button
- type="button"
- aria-label={t.fileName}
- disabled={!visible || phase !== "start"}
- onClick={() => setPhase("viewer")}
- className="flex w-full items-center gap-2 rounded-md px-1 py-1 text-left text-caption hover:bg-accent/50 disabled:hover:bg-transparent"
- >
- <FileText aria-hidden className="size-3.5 shrink-0 text-muted-foreground" />
- <span className="min-w-0 truncate">{t.fileName}</span>
- <VersionBadge label={t.versionShort(2)} />
- <span className="ml-auto shrink-0 text-micro text-muted-foreground tabular-nums">{t.size[2]}</span>
- </button>
- </CoachMark>
- <span className="mt-0.5 flex items-center gap-2 px-1 py-1 text-caption text-muted-foreground">
- <LayoutGrid aria-hidden className="size-3.5 shrink-0" />
- {t.viewAll}
- </span>
- </aside>
- </div>
-
- {viewerOpen && (
- <div
- role="dialog"
- aria-label={t.fileName}
- className="dark absolute inset-0 z-20 flex flex-col bg-black/95 text-foreground motion-safe:animate-in motion-safe:fade-in"
- >
- <div className="flex items-center gap-2 border-b border-white/10 px-3 py-2">
- <FileText aria-hidden className="size-4 shrink-0 text-muted-foreground" />
- <span className="min-w-0 truncate text-body font-medium">{t.fileName}</span>
- <span className="relative shrink-0">
- <CoachMark active={phase === "viewer"} side="bottom" align="start" ringClassName="rounded-md">
- <button
- type="button"
- aria-label={t.versionLabel(version)}
- aria-haspopup="menu"
- aria-expanded={phase === "versions"}
- disabled={phase !== "viewer" && phase !== "versions"}
- onClick={() => setPhase(phase === "versions" ? "viewer" : "versions")}
- className="flex items-center gap-0.5 rounded-xs bg-secondary px-1.5 py-0.5 text-micro font-medium text-muted-foreground tabular-nums hover:text-foreground"
- >
- {t.versionShort(version)}
- <ChevronDown aria-hidden className="size-3" />
- </button>
- </CoachMark>
- {phase === "versions" && (
- <div
- role="menu"
- aria-label={t.versionLabel(version)}
- className="absolute top-full left-0 z-10 mt-1 w-60 max-w-[calc(100vw-3rem)] rounded-lg border bg-popover p-1 text-popover-foreground shadow-md motion-safe:animate-in motion-safe:fade-in"
- >
- {([2, 1] as Version[]).map((v) => {
- const row = (
- <button
- type="button"
- role="menuitem"
- disabled={v !== 1}
- onClick={() => setPhase("v1")}
- className="flex w-full items-center gap-2 rounded-md px-2 py-1.5 text-left text-body hover:bg-accent disabled:hover:bg-transparent"
- >
- <span className="w-6 font-medium tabular-nums">{t.versionShort(v)}</span>
- <span className="min-w-0 flex-1 truncate text-caption text-muted-foreground tabular-nums">
- {t.uploadedAt[v]} · {t.size[v]}
- </span>
- {v === version && <Check aria-hidden className="size-3.5 shrink-0" />}
- </button>
- );
- return v === 1 ? (
- <CoachMark key={v} active quiet ringClassName="rounded-md" className="flex w-full">
- {row}
- </CoachMark>
- ) : (
- <div key={v}>{row}</div>
- );
- })}
- </div>
- )}
- </span>
- <span className="ml-auto flex shrink-0 items-center gap-1">
- <CoachMark active={phase === "v1"} side="bottom" align="end" ringClassName="rounded-md">
- <button
- type="button"
- aria-label={t.locate}
- disabled={phase !== "v1"}
- onClick={() => setPhase("located")}
- className="inline-flex items-center gap-1.5 rounded-md px-2 py-1 text-caption text-muted-foreground hover:bg-secondary hover:text-foreground disabled:hover:bg-transparent"
- >
- <MessageSquareText aria-hidden className="size-3.5" />
- <span className="max-sm:hidden">{t.locate}</span>
- </button>
- </CoachMark>
- <button
- type="button"
- disabled
- aria-label={t.close}
- className="rounded-md p-1 text-muted-foreground opacity-60"
- >
- <X className="size-4" />
- </button>
- </span>
- </div>
-
- <div className="flex min-h-0 flex-1 flex-col items-center justify-center gap-2 p-4">
- <div
- key={version}
- className="w-full max-w-72 rounded-md bg-white px-4 py-3 text-neutral-900 shadow-lg motion-safe:animate-in motion-safe:fade-in"
- >
- <div className="text-label font-medium">{t.page.heading}</div>
- <div className="mt-0.5 text-micro text-neutral-500">{t.page.sortedBy[version]}</div>
- <ol className="mt-2 flex list-decimal flex-col gap-1 ps-4 text-caption">
- {t.page.rows[version].map((row) => (
- <li key={row} className="m-0">
- {row}
- </li>
- ))}
- </ol>
- </div>
- <div className="text-caption text-muted-foreground tabular-nums">
- {t.fileType} · {t.size[version]} · {t.versionOf(version)}
- </div>
- </div>
- </div>
- )}
- </div>
- </DemoFrame>
- );
-}
-
-function VersionBadge({ label }: { label: string }) {
- return (
- <span
- aria-hidden
- className="shrink-0 rounded-xs bg-muted px-1 text-micro font-medium text-muted-foreground tabular-nums"
- >
- {label}
- </span>
- );
-}
-
-function Comment({
- author,
- agent = false,
- highlighted = false,
- body,
- attachment,
-}: {
- author: string;
- agent?: boolean;
- highlighted?: boolean;
- body: string;
- attachment?: ReactNode;
-}) {
- return (
- <div
- className={cn(
- "min-w-0 rounded-lg border bg-background px-3 py-2 transition-colors",
- highlighted && "border-brand/50 bg-brand/5 ring-2 ring-brand/30",
- )}
- >
- <div className="flex items-center gap-2">
- <DemoAvatar name={author} agent={agent} />
- <span className="text-label font-medium">{author}</span>
- </div>
- <div className="mt-1 pl-7 text-body break-words">
- {body}
- {attachment}
- </div>
- </div>
- );
+ const meta = CLIP_MANIFEST.deliverables ?? { duration: 5.5, chapters: [] };
+ const chapters = t.chapters.map((label, i) => ({
+ label,
+ at: meta.chapters[i]?.at ?? (i * meta.duration) / t.chapters.length,
+ }));
+ return <EditorialClip slug="deliverables" title={t.title} chapters={chapters} duration={meta.duration} caption={t.caption} />;
}
diff --git a/apps/docs/components/demos/demo-kit.tsx b/apps/docs/components/demos/demo-kit.tsx
index ed75d185d8..1333385cae 100644
--- a/apps/docs/components/demos/demo-kit.tsx
+++ b/apps/docs/components/demos/demo-kit.tsx
@@ -1,33 +1,20 @@
"use client";
-import {
- useCallback,
- useEffect,
- useRef,
- useState,
- type ReactNode,
- type RefObject,
-} from "react";
-import {
- ArrowDown,
- ArrowLeft,
- ArrowRight,
- ArrowUp,
- Bot,
- Check,
- CornerDownRight,
- Loader2,
- RotateCcw,
-} from "@multica/ui/icons";
-import { Button } from "@multica/ui/components/ui/button";
+import { useCallback, useEffect, useRef, useState, type ReactNode } from "react";
+import { useTheme } from "next-themes";
+import { Pause, Play, RotateCcw } from "@multica/ui/icons";
import { cn } from "@multica/ui/lib/utils";
import { useDocsLocale } from "@/components/locale-link";
import type { Lang } from "@/lib/i18n";
import { demoChromeCopy } from "@/lib/translations";
+import { CLIP_MANIFEST } from "./clip-manifest";
-// Building blocks for the scripted product demos embedded in docs pages. The
-// demos imitate the product with docs-local markup instead of importing
-// @multica/views, which needs live stores and queries.
+// Shared primitives for the three native demo mediums in Multica Docs:
+// 1. EditorialClip — real English product recordings + localized chapter scrubber
+// 2. EditorialFigure — architectural SVG schematics aligned with the warm-paper palette
+// 3. EditorialUtility — borderless prose-embedded decision tools & matrices
+
+const VIDEO_BASE = "/docs/videos/demos";
/** Picks a demo's scenario copy for the page language, falling back to English. */
export function useDemoCopy<T>(copy: { en: T } & Partial<Record<Lang, T>>): T {
@@ -35,285 +22,339 @@ export function useDemoCopy<T>(copy: { en: T } & Partial<Record<Lang, T>>): T {
return copy[lang] ?? copy.en;
}
-/** Timers owned by one demo run: cleared on replay and on unmount. */
-export function useDemoTimers() {
- const ids = useRef<number[]>([]);
- const clear = useCallback(() => {
- for (const id of ids.current) window.clearTimeout(id);
- ids.current = [];
- }, []);
- const after = useCallback((ms: number, fn: () => void) => {
- ids.current.push(window.setTimeout(fn, ms));
- }, []);
- useEffect(() => clear, [clear]);
- return { after, clear };
+export interface ClipChapter {
+ /** Short localized chapter label shown below its progress segment. */
+ label: string;
+ /** Timestamp in seconds where this chapter begins. */
+ at: number;
}
-/**
- * True once the element has been mostly on screen, so a demo starts when the
- * reader reaches it rather than while they read the top of the page.
- */
-export function useStartWhenVisible<T extends Element>(): [RefObject<T | null>, boolean] {
- const ref = useRef<T>(null);
- const [visible, setVisible] = useState(false);
- useEffect(() => {
- const el = ref.current;
- if (!el || visible) return;
- const observer = new IntersectionObserver(
- ([entry]) => {
- if (entry?.isIntersecting) {
- setVisible(true);
- observer.disconnect();
- }
- },
- { threshold: 0.35 },
- );
- observer.observe(el);
- return () => observer.disconnect();
- }, [visible]);
- return [ref, visible];
+function formatClock(seconds: number): string {
+ const s = Math.max(0, Math.floor(seconds));
+ const mins = Math.floor(s / 60);
+ const secs = s % 60;
+ return `${mins}:${secs.toString().padStart(2, "0")}`;
}
-export function DemoFrame({
+/**
+ * Medium 1: Real recorded English product clip with a quiet editorial frame
+ * and clickable chapter progress bar. Auto-plays muted when visible (unless
+ * reduced motion is requested) and pauses when scrolled offscreen.
+ */
+export function EditorialClip({
+ slug,
title,
+ chapters,
+ duration,
caption,
- onReplay,
- frameRef,
- children,
}: {
+ slug: string;
title: string;
- /** What the reader should do or notice now; announced to screen readers. */
- caption: ReactNode;
- onReplay: () => void;
- frameRef?: RefObject<HTMLElement | null>;
- children: ReactNode;
+ chapters: ClipChapter[];
+ /** Nominal duration in seconds, used before video metadata arrives. */
+ duration: number;
+ caption?: string;
}) {
const lang = useDocsLocale();
const chrome = demoChromeCopy[lang];
- // `isolate` keeps the demos' own z-indexes below the sticky page header.
+ const { resolvedTheme } = useTheme();
+ const [mounted, setMounted] = useState(false);
+ useEffect(() => setMounted(true), []);
+
+ const theme = mounted && resolvedTheme === "dark" ? "dark" : "light";
+ const videoSrc = `${VIDEO_BASE}/${slug}-${theme}.mp4`;
+ const posterSrc = `${VIDEO_BASE}/${slug}-${theme}.jpg`;
+
+ const darkVariant = theme === "dark" ? CLIP_MANIFEST[slug]?.dark : undefined;
+ const activeChapters = darkVariant
+ ? chapters.map((ch, i) => ({
+ label: ch.label,
+ at: darkVariant.chapters[i]?.at ?? ch.at,
+ }))
+ : chapters;
+ const nominalDuration = darkVariant?.duration ?? duration;
+
+ const figureRef = useRef<HTMLElement>(null);
+ const videoRef = useRef<HTMLVideoElement>(null);
+
+ const [playing, setPlaying] = useState(false);
+ const [userPaused, setUserPaused] = useState(false);
+ const [inView, setInView] = useState(false);
+ const [currentTime, setCurrentTime] = useState(0);
+ const [mediaDuration, setMediaDuration] = useState(nominalDuration);
+
+ const totalDuration = mediaDuration > 0 ? mediaDuration : nominalDuration;
+
+ // Pause when scrolled offscreen; autoplay when visible unless user paused or reduced motion.
+ useEffect(() => {
+ const el = figureRef.current;
+ if (!el) return;
+ const observer = new IntersectionObserver(
+ ([entry]) => setInView(Boolean(entry?.isIntersecting)),
+ { threshold: 0.25 },
+ );
+ observer.observe(el);
+ return () => observer.disconnect();
+ }, []);
+
+ useEffect(() => {
+ const video = videoRef.current;
+ if (!video) return;
+ const reducedMotion = window.matchMedia("(prefers-reduced-motion: reduce)").matches;
+ if (inView && !userPaused && !reducedMotion) {
+ video.play().catch(() => {});
+ } else if (!inView && !video.paused) {
+ video.pause();
+ }
+ }, [inView, userPaused, videoSrc]);
+
+ // Keep current playback position when toggling between light and dark video sources.
+ const prevTimeRef = useRef(0);
+ useEffect(() => {
+ const video = videoRef.current;
+ if (!video) return;
+ const resumeAt = prevTimeRef.current;
+ const onLoaded = () => {
+ if (Number.isFinite(video.duration) && video.duration > 0) {
+ setMediaDuration(video.duration);
+ }
+ if (resumeAt > 0 && resumeAt < (video.duration || duration)) {
+ video.currentTime = resumeAt;
+ }
+ };
+ video.addEventListener("loadedmetadata", onLoaded);
+ return () => video.removeEventListener("loadedmetadata", onLoaded);
+ }, [videoSrc, duration]);
+
+ const togglePlay = useCallback(() => {
+ const video = videoRef.current;
+ if (!video) return;
+ if (video.paused) {
+ setUserPaused(false);
+ video.play().catch(() => {});
+ } else {
+ setUserPaused(true);
+ video.pause();
+ }
+ }, []);
+
+ const seekTo = useCallback((at: number) => {
+ const video = videoRef.current;
+ if (!video) return;
+ video.currentTime = at;
+ prevTimeRef.current = at;
+ setCurrentTime(at);
+ setUserPaused(false);
+ video.play().catch(() => {});
+ }, []);
+
+ const activeChapter = (() => {
+ let idx = 0;
+ for (let i = 0; i < activeChapters.length; i++) {
+ if (currentTime + 0.08 >= activeChapters[i]!.at) idx = i;
+ }
+ return idx;
+ })();
+
+ const chapterProgress = (idx: number) => {
+ const start = activeChapters[idx]!.at;
+ const end = activeChapters[idx + 1]?.at ?? totalDuration;
+ if (currentTime <= start) return 0;
+ if (currentTime >= end) return 100;
+ const span = Math.max(0.1, end - start);
+ return Math.min(100, Math.max(0, ((currentTime - start) / span) * 100));
+ };
+
return (
<figure
- ref={frameRef}
- className="not-prose isolate my-6 overflow-hidden rounded-xl border bg-card text-card-foreground shadow-sm"
+ ref={figureRef}
+ className="not-prose my-7 border-y border-[var(--docs-rule)] py-4"
>
- <div className="flex items-center gap-2 border-b bg-muted/40 py-1.5 pr-1.5 pl-3">
- <span className="shrink-0 rounded-sm bg-brand/10 px-1.5 py-0.5 text-micro font-medium text-brand">
- {chrome.label}
- </span>
- <span className="min-w-0 flex-1 truncate text-caption text-muted-foreground">{title}</span>
- <Button type="button" size="xs" variant="ghost" className="text-muted-foreground" onClick={onReplay}>
- <RotateCcw />
- {chrome.replay}
- </Button>
+ <div className="mb-3 flex items-baseline justify-between gap-4">
+ <div className="min-w-0 font-[family-name:var(--font-serif)] text-[1.0625rem] leading-[1.35] tracking-[-0.01em] text-foreground">
+ {title}
+ </div>
+ <div className="flex shrink-0 items-center gap-2 font-mono text-[0.6875rem] tabular-nums text-muted-foreground">
+ <span>
+ {formatClock(currentTime)} / {formatClock(totalDuration)}
+ </span>
+ <button
+ type="button"
+ onClick={togglePlay}
+ aria-label={playing ? chrome.pause : chrome.play}
+ className="inline-flex size-6 items-center justify-center rounded-sm border border-border bg-card text-foreground transition-colors hover:border-[var(--primary)] hover:text-[var(--primary)] focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-ring"
+ >
+ {playing ? <Pause className="size-3" /> : <Play className="size-3 translate-x-[0.5px]" />}
+ </button>
+ </div>
</div>
- <div className="relative">{children}</div>
- <figcaption
- role="status"
- aria-live="polite"
- className="border-t bg-muted/40 px-3 py-2 text-label text-muted-foreground"
+
+ <div
+ className="overflow-hidden rounded-[5px] border border-border bg-muted/40 cursor-pointer"
+ onClick={togglePlay}
>
- {caption}
- </figcaption>
+ <video
+ key={videoSrc}
+ ref={videoRef}
+ src={videoSrc}
+ poster={posterSrc}
+ muted
+ loop
+ playsInline
+ preload="metadata"
+ aria-label={title}
+ onPlay={() => setPlaying(true)}
+ onPause={() => setPlaying(false)}
+ onTimeUpdate={(e) => {
+ const t = e.currentTarget.currentTime;
+ prevTimeRef.current = t;
+ setCurrentTime(t);
+ }}
+ className="block aspect-[16/10] w-full bg-background object-cover"
+ />
+ </div>
+
+ {activeChapters.length > 0 && (
+ <div
+ className="mt-3 grid gap-2.5"
+ style={{ gridTemplateColumns: `repeat(${activeChapters.length}, minmax(0, 1fr))` }}
+ >
+ {activeChapters.map((chapter, idx) => {
+ const pct = chapterProgress(idx);
+ const active = idx === activeChapter;
+ const done = idx < activeChapter;
+ return (
+ <button
+ key={`${chapter.at}-${chapter.label}`}
+ type="button"
+ onClick={() => seekTo(chapter.at)}
+ className="group flex min-w-0 flex-col gap-1.5 rounded-sm text-left focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-ring focus-visible:ring-offset-2 focus-visible:ring-offset-background"
+ >
+ <span className="block h-[2.5px] w-full overflow-hidden rounded-full bg-border">
+ <span
+ className={cn(
+ "block h-full rounded-full transition-[width] duration-150 ease-linear motion-reduce:transition-none",
+ active ? "bg-[var(--primary)]" : done ? "bg-foreground/35" : "bg-transparent",
+ )}
+ style={{ width: `${pct}%` }}
+ />
+ </span>
+ <span
+ className={cn(
+ "truncate text-[0.75rem] leading-[1.35] transition-colors",
+ active
+ ? "font-medium text-foreground"
+ : "text-muted-foreground group-hover:text-foreground",
+ )}
+ >
+ <span className="mr-1 font-mono text-[0.65rem] opacity-65">
+ {String(idx + 1).padStart(2, "0")}
+ </span>
+ {chapter.label}
+ </span>
+ </button>
+ );
+ })}
+ </div>
+ )}
+
+ {caption && (
+ <figcaption className="mt-2.5 text-[0.8125rem] leading-[1.5] text-muted-foreground">
+ {caption}
+ </figcaption>
+ )}
</figure>
);
}
/**
- * Draws the eye to the control the reader should use next: a pulsing ring
- * around it and a plain "Click" with an arrow pointing at it. The control's
- * own label says what it does, so the hint never repeats it. It is
- * decorative; the frame caption carries the instruction for assistive
- * technology.
+ * Medium 2: Publication-grade architectural schematic frame.
+ * Hairline top/bottom rules, editorial serif title, warm-paper SVG surface,
+ * and a fixed-height quiet caption strip below.
*/
-export function CoachMark({
- active,
- quiet = false,
- side = "top",
- align = "center",
- ringClassName = "rounded-lg",
- className,
+export function EditorialFigure({
+ kicker,
+ title,
+ actions,
+ caption,
children,
}: {
- active: boolean;
- /** Show only the ring, e.g. where a label would cover neighbouring content. */
- quiet?: boolean;
- /** Where the label sits relative to the control; the arrow points back at it. */
- side?: "top" | "bottom" | "left" | "right";
- align?: "start" | "center" | "end";
- ringClassName?: string;
- className?: string;
+ kicker?: string;
+ title: string;
+ actions?: ReactNode;
+ caption?: ReactNode;
children: ReactNode;
}) {
- const lang = useDocsLocale();
- const Arrow = { top: ArrowDown, bottom: ArrowUp, left: ArrowRight, right: ArrowLeft }[side];
- const vertical = side === "top" || side === "bottom";
return (
- <span className={cn("relative inline-flex", className)}>
- {children}
- {active && (
- <>
- <span
- aria-hidden
- className={cn("demo-halo pointer-events-none absolute -inset-1 ring-2 ring-brand", ringClassName)}
- />
- {!quiet && (
- <span
- aria-hidden
- className={cn(
- // Phones have no room for labels beside controls; the ring and the
- // caption remain.
- "pointer-events-none absolute z-20 flex w-max max-w-56 gap-0.5 text-caption font-medium text-brand motion-safe:animate-in motion-safe:fade-in max-sm:hidden",
- side === "top" && "bottom-full mb-1.5 flex-col",
- side === "bottom" && "top-full mt-1.5 flex-col-reverse",
- side === "left" && "top-1/2 right-full mr-2 -translate-y-1/2 items-center",
- side === "right" && "top-1/2 left-full ml-2 -translate-y-1/2 flex-row-reverse items-center",
- vertical && align === "start" && "left-0 items-start",
- vertical && align === "center" && "left-1/2 -translate-x-1/2 items-center",
- vertical && align === "end" && "right-0 items-end",
- )}
- >
- {/* A halo in the card color keeps lines underneath from crossing the text. */}
- <span className="[text-shadow:0_0_2px_var(--card),0_0_4px_var(--card),0_0_6px_var(--card)]">
- {demoChromeCopy[lang].click}
- </span>
- <Arrow className={cn("size-3.5 shrink-0", `demo-nudge-${side}`)} />
+ <figure className="not-prose my-7 border-y border-[var(--docs-rule)] py-4">
+ <div className="mb-3 flex flex-wrap items-baseline justify-between gap-3">
+ <div className="flex min-w-0 items-baseline gap-2.5">
+ {kicker && (
+ <span className="shrink-0 font-mono text-[0.6875rem] font-semibold uppercase tracking-[0.08em] text-[var(--primary)]">
+ {kicker}
</span>
)}
- </>
- )}
- </span>
- );
-}
-
-export function DemoAvatar({ name, agent = false }: { name: string; agent?: boolean }) {
- return (
- <span
- aria-hidden
- className={cn(
- "inline-flex size-5 shrink-0 items-center justify-center rounded-full text-micro font-medium",
- agent ? "bg-brand/12 text-brand" : "bg-muted text-foreground",
- )}
- >
- {agent ? <Bot className="size-3" /> : name.slice(0, 1)}
- </span>
- );
-}
+ <span className="font-[family-name:var(--font-serif)] text-[1.0625rem] leading-[1.35] tracking-[-0.01em] text-foreground">
+ {title}
+ </span>
+ </div>
+ {actions}
+ </div>
-export type StepState = "running" | "done";
+ <div className="rounded-[4px] border border-border bg-card/70 p-3.5 sm:p-5">
+ {children}
+ </div>
-export function DemoStep({ state, children }: { state: StepState; children: ReactNode }) {
- return (
- <li className="m-0 flex min-w-0 items-start gap-2 py-0.5 ps-0 text-caption text-muted-foreground motion-safe:animate-in motion-safe:fade-in motion-safe:slide-in-from-top-1">
- {state === "running" ? (
- <Loader2 aria-hidden className="mt-px size-3.5 shrink-0 text-brand motion-safe:animate-spin" />
- ) : (
- <Check aria-hidden className="mt-px size-3.5 shrink-0 text-success" />
+ {caption && (
+ <figcaption className="mt-3 min-h-[1.35rem] text-[0.8125rem] leading-[1.55] text-muted-foreground">
+ {caption}
+ </figcaption>
)}
- <span className={cn("min-w-0", state === "running" && "text-foreground")}>{children}</span>
- </li>
- );
-}
-
-/** The step-list marker for a message a running turn has read (mirrors the product). */
-export function DemoSteerMarker({ label, detail }: { label: string; detail: string }) {
- return (
- <li className="m-0 flex min-w-0 items-center gap-2 rounded-xs bg-brand/7 px-1 py-1.5 text-caption motion-safe:animate-in motion-safe:fade-in dark:bg-brand/12">
- <CornerDownRight aria-hidden className="size-3.5 shrink-0 text-brand" />
- <span className="min-w-0 truncate">
- <span className="font-medium">{label}</span>
- <span className="text-muted-foreground"> · {detail}</span>
- </span>
- </li>
- );
-}
-
-/** One agent run as it appears in the issue timeline. */
-export function DemoRun({
- agent,
- status,
- active,
- children,
-}: {
- agent: string;
- status: string;
- active: boolean;
- children?: ReactNode;
-}) {
- return (
- <div className="min-w-0 motion-safe:animate-in motion-safe:fade-in">
- <div className="flex min-h-7 items-center gap-2">
- <DemoAvatar name={agent} agent />
- <span className="truncate text-body font-medium">{agent}</span>
- <span className="inline-flex items-center gap-1 text-caption text-muted-foreground">
- {active ? (
- <Loader2 aria-hidden className="size-3 text-brand motion-safe:animate-spin" />
- ) : (
- <Check aria-hidden className="size-3 text-success" />
- )}
- {status}
- </span>
- </div>
- {children && <ul className="mt-1 flex flex-col gap-0.5 pl-7">{children}</ul>}
- </div>
+ </figure>
);
}
-/** A posted comment in the issue timeline. */
-export function DemoComment({
- author,
- agent = false,
+/**
+ * Medium 3: Borderless prose-embedded utility (filters, decision matrices,
+ * role tables). No card box, no blue "Try it" badge, no pulsing cues.
+ */
+export function EditorialUtility({
+ title,
+ meta,
+ onReset,
children,
- footer,
}: {
- author: string;
- agent?: boolean;
+ title: string;
+ meta?: ReactNode;
+ onReset?: () => void;
children: ReactNode;
- footer?: ReactNode;
}) {
+ const lang = useDocsLocale();
+ const chrome = demoChromeCopy[lang];
return (
- <div className="min-w-0 rounded-lg border bg-background px-3 py-2 motion-safe:animate-in motion-safe:fade-in motion-safe:slide-in-from-bottom-1">
- <div className="flex items-center gap-2">
- <DemoAvatar name={author} agent={agent} />
- <span className="text-label font-medium">{author}</span>
+ <section
+ aria-label={title}
+ className="not-prose my-7 border-y border-[var(--docs-rule)] py-4"
+ >
+ <div className="mb-3 flex flex-wrap items-baseline justify-between gap-2">
+ <div className="font-[family-name:var(--font-serif)] text-[1.0625rem] leading-[1.35] tracking-[-0.01em] text-foreground">
+ {title}
+ </div>
+ <div className="flex items-center gap-3 text-[0.75rem] text-muted-foreground">
+ {meta}
+ {onReset && (
+ <button
+ type="button"
+ onClick={onReset}
+ className="inline-flex items-center gap-1 text-muted-foreground transition-colors hover:text-foreground"
+ >
+ <RotateCcw className="size-3" />
+ {chrome.reset}
+ </button>
+ )}
+ </div>
</div>
- <div className="mt-1 pl-7 text-body break-words">{children}</div>
- {footer && <div className="mt-1.5 pl-7">{footer}</div>}
- </div>
- );
-}
-
-export function DemoReceipt({ read, children }: { read: boolean; children: ReactNode }) {
- return (
- <span className="flex items-center gap-1.5 text-caption text-muted-foreground">
- {read ? (
- <Check aria-hidden className="size-3.5 shrink-0 text-success" />
- ) : (
- <Loader2 aria-hidden className="size-3.5 shrink-0 motion-safe:animate-spin" />
- )}
{children}
- </span>
- );
-}
-
-/** The round send button of the comment composer. */
-export function DemoSendButton({
- label,
- disabled,
- onClick,
-}: {
- label: string;
- disabled?: boolean;
- onClick: () => void;
-}) {
- return (
- <button
- type="button"
- aria-label={label}
- disabled={disabled}
- onClick={onClick}
- className="inline-flex size-7 items-center justify-center rounded-full bg-foreground text-background transition-opacity outline-none hover:opacity-85 focus-visible:ring-3 focus-visible:ring-ring/50 disabled:opacity-40"
- >
- <ArrowUp className="size-4" />
- </button>
+ </section>
);
}
diff --git a/apps/docs/components/demos/desktop-tabs-demo.tsx b/apps/docs/components/demos/desktop-tabs-demo.tsx
index 8a85e921a2..663f6b6fcc 100644
--- a/apps/docs/components/demos/desktop-tabs-demo.tsx
+++ b/apps/docs/components/demos/desktop-tabs-demo.tsx
@@ -1,444 +1,217 @@
"use client";
import { useState } from "react";
-import { Check, ChevronsUpDown, Inbox, ListTodo, Pin, PinOff, UserRound, X } from "@multica/ui/icons";
+import { Pin } from "@multica/ui/icons";
import { cn } from "@multica/ui/lib/utils";
-import { CoachMark, DemoFrame, useDemoCopy, useStartWhenVisible } from "./demo-kit";
+import { EditorialFigure, useDemoCopy } from "./demo-kit";
-type Ws = "a" | "b";
-type Status = "todo" | "in_progress" | "in_review";
-type Issue = { id: string; title: string; status: Status };
+type Ws = "acme" | "personal";
const copy = {
en: {
- title: "Desktop · Each workspace keeps its own tabs",
- workspaces: { a: "Ops team", b: "Marketing team" } as Record<Ws, string>,
- workspacesLabel: "Workspaces",
- nav: { inbox: "Inbox", myIssues: "My Issues", issues: "Issues" },
- issues: {
- a: [
- { id: "OPS-31", title: "Travel expense rules", status: "in_progress" },
- { id: "OPS-32", title: "New-hire handbook", status: "todo" },
- { id: "OPS-33", title: "Quarterly team outing", status: "todo" },
- ],
- b: [
- { id: "MKT-8", title: "Holiday campaign poster", status: "in_review" },
- { id: "MKT-9", title: "Customer story", status: "in_progress" },
- ],
- } as Record<Ws, Issue[]>,
- status: { todo: "Todo", in_progress: "In Progress", in_review: "In Review" } as Record<Status, string>,
- pin: "Pin tab",
- unpin: "Unpin tab",
- close: "Close tab",
- pinnedName: (title: string) => `${title} (pinned)`,
- captions: {
- idle: "The Ops team workspace already has three tabs open.",
- pin: "First pin the Issues list: click the pin on its tab.",
- open: "A pinned tab stays on its page. Click OPS-33, and it opens in a new tab.",
- switch: "Move to another workspace: click the workspace name at the top left.",
- pickB: "Choose Marketing team.",
- inB: "These are Marketing team's own tabs; none of Ops team's tabs came along. Now switch back to Ops team.",
- pickA: "Choose Ops team.",
- done: "Ops team's tabs are all still here, and OPS-33 is still the active tab.",
- },
+ kicker: "DESKTOP TABS",
+ title: "Each workspace keeps its own tab strip",
+ workspaces: {
+ acme: {
+ name: "Acme Engineering",
+ tabs: [
+ { label: "Issues", pinned: true },
+ { label: "ACM-142 · Rate limiting", active: true },
+ { label: "ACM-151 · Safari checkout" },
+ ],
+ summary: "Pinned tabs stay anchored to their page; opening an issue spawns a new tab instead of overwriting the list.",
+ },
+ personal: {
+ name: "Personal Site",
+ tabs: [
+ { label: "Inbox", pinned: true },
+ { label: "SITE-1 · Portfolio build", active: true },
+ ],
+ summary: "Switching workspaces swaps the entire tab strip cleanly. When you return to Acme Engineering, every tab and scroll position is still right where you left it.",
+ },
+ } as Record<Ws, { name: string; tabs: { label: string; pinned?: boolean; active?: boolean }[]; summary: string }>,
+ shortcuts: "⌘1–9 switch tabs · ⌘T new tab · ⌘W close",
},
zh: {
- title: "Desktop · 每个工作区保留自己的标签页",
- workspaces: { a: "运营团队", b: "市场团队" } as Record<Ws, string>,
- workspacesLabel: "工作区",
- nav: { inbox: "收件箱", myIssues: "我的任务", issues: "任务" },
- issues: {
- a: [
- { id: "OPS-31", title: "差旅报销规则", status: "in_progress" },
- { id: "OPS-32", title: "新人手册", status: "todo" },
- { id: "OPS-33", title: "季度团建", status: "todo" },
- ],
- b: [
- { id: "MKT-8", title: "节日活动海报", status: "in_review" },
- { id: "MKT-9", title: "客户案例", status: "in_progress" },
- ],
- } as Record<Ws, Issue[]>,
- status: { todo: "待办", in_progress: "进行中", in_review: "审核中" } as Record<Status, string>,
- pin: "固定标签页",
- unpin: "取消固定标签页",
- close: "关闭标签页",
- pinnedName: (title: string) => `${title}(已固定)`,
- captions: {
- idle: "运营团队工作区里已经开着三个标签页。",
- pin: `先把"任务"列表固定住:点它标签上的图钉。`,
- open: "固定的标签页会停在原页面。点 OPS-33,它会在新标签页里打开。",
- switch: "切到另一个工作区:点左上角的工作区名称。",
- pickB: `选择"市场团队"。`,
- inB: "这里是市场团队自己的标签页,运营团队的标签一个也没带过来。再切回运营团队看看。",
- pickA: `选择"运营团队"。`,
- done: "运营团队的标签页都还在,OPS-33 仍是当前标签。",
- },
+ kicker: "桌面端标签页",
+ title: "每个工作区独立保留自己的标签栏",
+ workspaces: {
+ acme: {
+ name: "Acme 研发团队",
+ tabs: [
+ { label: "任务列表", pinned: true },
+ { label: "ACM-142 · API 限流", active: true },
+ { label: "ACM-151 · Safari 结算测试" },
+ ],
+ summary: "固定后的标签页始终停留在原视图;从中打开具体任务时会自动在新标签页展开,不会顶掉列表。",
+ },
+ personal: {
+ name: "个人作品集",
+ tabs: [
+ { label: "收件箱", pinned: true },
+ { label: "SITE-1 · 搭建摄影师网站", active: true },
+ ],
+ summary: "切换工作区时整个标签栏随之切换;切回 Acme 研发团队后,原有标签与各自滚动位置原封不动保留。",
+ },
+ } as Record<Ws, { name: string; tabs: { label: string; pinned?: boolean; active?: boolean }[]; summary: string }>,
+ shortcuts: "⌘1–9 切换标签 · ⌘T 新建标签 · ⌘W 关闭",
+ },
+ "zh-Hant": {
+ kicker: "桌面端分頁",
+ title: "每個工作區獨立保留自己的分頁列",
+ workspaces: {
+ acme: {
+ name: "Acme 研發團隊",
+ tabs: [
+ { label: "任務列表", pinned: true },
+ { label: "ACM-142 · API 限流", active: true },
+ { label: "ACM-151 · Safari 結帳測試" },
+ ],
+ summary: "固定後的分頁會停在原頁面;開啟任務時會在新分頁展開,不會覆蓋列表。",
+ },
+ personal: {
+ name: "個人作品集",
+ tabs: [
+ { label: "收件箱", pinned: true },
+ { label: "SITE-1 · 建立攝影師網站", active: true },
+ ],
+ summary: "切換工作區時分頁列會獨立切換;切回後原工作區的分頁與捲動位置完整保留。",
+ },
+ } as Record<Ws, { name: string; tabs: { label: string; pinned?: boolean; active?: boolean }[]; summary: string }>,
+ shortcuts: "⌘1–9 切換分頁 · ⌘T 新分頁 · ⌘W 關閉",
},
ja: {
- title: "Desktop · ワークスペースごとにタブを保持",
- workspaces: { a: "運用チーム", b: "マーケティングチーム" } as Record<Ws, string>,
- workspacesLabel: "ワークスペース",
- nav: { inbox: "インボックス", myIssues: "マイタスク", issues: "タスク" },
- issues: {
- a: [
- { id: "OPS-31", title: "出張旅費の精算ルール", status: "in_progress" },
- { id: "OPS-32", title: "新入社員ハンドブック", status: "todo" },
- { id: "OPS-33", title: "四半期のチームイベント", status: "todo" },
- ],
- b: [
- { id: "MKT-8", title: "季節キャンペーンのポスター", status: "in_review" },
- { id: "MKT-9", title: "導入事例", status: "in_progress" },
- ],
- } as Record<Ws, Issue[]>,
- status: { todo: "未着手", in_progress: "進行中", in_review: "レビュー中" } as Record<Status, string>,
- pin: "タブをピン留め",
- unpin: "タブのピン留めを解除",
- close: "タブを閉じる",
- pinnedName: (title: string) => `${title}(ピン留め)`,
- captions: {
- idle: "運用チームのワークスペースでは、すでに 3 つのタブが開いています。",
- pin: "まず「タスク」一覧をピン留めします。タブのピンをクリックします。",
- open: "ピン留めしたタブは元のページにとどまります。OPS-33 をクリックすると、新しいタブで開きます。",
- switch: "別のワークスペースに移ります。左上のワークスペース名をクリックします。",
- pickB: "「マーケティングチーム」を選びます。",
- inB: "ここはマーケティングチーム自身のタブです。運用チームのタブは 1 つも入っていません。運用チームに戻ってみます。",
- pickA: "「運用チーム」を選びます。",
- done: "運用チームのタブはすべて残っていて、OPS-33 もアクティブなままです。",
- },
+ kicker: "DESKTOP TABS",
+ title: "ワークスペースごとに独立したタブを保持",
+ workspaces: {
+ acme: {
+ name: "Acme Engineering",
+ tabs: [
+ { label: "タスク一覧", pinned: true },
+ { label: "ACM-142 · レート制限", active: true },
+ { label: "ACM-151 · Safari テスト" },
+ ],
+ summary: "ピン留めしたタブは元のページに留まり、タスクを開くと新しいタブで開かれます。",
+ },
+ personal: {
+ name: "Personal Site",
+ tabs: [
+ { label: "インボックス", pinned: true },
+ { label: "SITE-1 · ポートフォリオ制作", active: true },
+ ],
+ summary: "ワークスペースを切り替えるとタブ一覧も独立して切り替わり、戻ったとき元の状態がそのまま残ります。",
+ },
+ } as Record<Ws, { name: string; tabs: { label: string; pinned?: boolean; active?: boolean }[]; summary: string }>,
+ shortcuts: "⌘1–9 タブ切替 · ⌘T 新規タブ · ⌘W 閉じる",
},
ko: {
- title: "Desktop · 워크스페이스마다 탭을 따로 보관",
- workspaces: { a: "운영팀", b: "마케팅팀" } as Record<Ws, string>,
- workspacesLabel: "워크스페이스",
- nav: { inbox: "인박스", myIssues: "내 태스크", issues: "태스크" },
- issues: {
- a: [
- { id: "OPS-31", title: "출장비 정산 규칙", status: "in_progress" },
- { id: "OPS-32", title: "신입 사원 안내서", status: "todo" },
- { id: "OPS-33", title: "분기 팀 행사", status: "todo" },
- ],
- b: [
- { id: "MKT-8", title: "시즌 캠페인 포스터", status: "in_review" },
- { id: "MKT-9", title: "고객 사례", status: "in_progress" },
- ],
- } as Record<Ws, Issue[]>,
- status: { todo: "할 일", in_progress: "진행 중", in_review: "리뷰 중" } as Record<Status, string>,
- pin: "탭 고정",
- unpin: "탭 고정 해제",
- close: "탭 닫기",
- pinnedName: (title: string) => `${title} (고정됨)`,
- captions: {
- idle: "운영팀 워크스페이스에는 이미 탭 세 개가 열려 있습니다.",
- pin: "먼저 '태스크' 목록을 고정합니다. 탭의 핀을 클릭하세요.",
- open: "고정한 탭은 원래 페이지에 머뭅니다. OPS-33을 클릭하면 새 탭에서 열립니다.",
- switch: "다른 워크스페이스로 이동합니다. 왼쪽 위의 워크스페이스 이름을 클릭하세요.",
- pickB: "'마케팅팀'을 선택하세요.",
- inB: "여기는 마케팅팀의 탭입니다. 운영팀의 탭은 하나도 따라오지 않았습니다. 다시 운영팀으로 돌아가 보세요.",
- pickA: "'운영팀'을 선택하세요.",
- done: "운영팀의 탭이 모두 남아 있고 OPS-33도 여전히 현재 탭입니다.",
- },
+ kicker: "DESKTOP TABS",
+ title: "워크스페이스마다 독립된 탭 목록 유지",
+ workspaces: {
+ acme: {
+ name: "Acme Engineering",
+ tabs: [
+ { label: "태스크 목록", pinned: true },
+ { label: "ACM-142 · API 속도 제한", active: true },
+ { label: "ACM-151 · Safari 테스트" },
+ ],
+ summary: "고정된 탭은 원래 페이지에 유지되며, 태스크를 클릭하면 새 탭에서 열립니다.",
+ },
+ personal: {
+ name: "Personal Site",
+ tabs: [
+ { label: "인박스", pinned: true },
+ { label: "SITE-1 · 포트폴리오 제작", active: true },
+ ],
+ summary: "워크스페이스를 전환하면 탭 목록도 따로 바뀌며, 돌아왔을 때 기존 탭과 스크롤 위치가 그대로 남습니다.",
+ },
+ } as Record<Ws, { name: string; tabs: { label: string; pinned?: boolean; active?: boolean }[]; summary: string }>,
+ shortcuts: "⌘1–9 탭 전환 · ⌘T 새 탭 · ⌘W 닫기",
},
fr: {
- title: "Desktop · Chaque espace de travail garde ses onglets",
- workspaces: { a: "Équipe ops", b: "Équipe marketing" } as Record<Ws, string>,
- workspacesLabel: "Espaces de travail",
- nav: { inbox: "Boîte de réception", myIssues: "Mes tâches", issues: "Tâches" },
- issues: {
- a: [
- { id: "OPS-31", title: "Règles des notes de frais", status: "in_progress" },
- { id: "OPS-32", title: "Guide des nouveaux arrivants", status: "todo" },
- { id: "OPS-33", title: "Sortie d'équipe trimestrielle", status: "todo" },
- ],
- b: [
- { id: "MKT-8", title: "Affiche de la campagne saisonnière", status: "in_review" },
- { id: "MKT-9", title: "Témoignage client", status: "in_progress" },
- ],
- } as Record<Ws, Issue[]>,
- status: { todo: "À faire", in_progress: "En cours", in_review: "En relecture" } as Record<Status, string>,
- pin: "Épingler l'onglet",
- unpin: "Désépingler l'onglet",
- close: "Fermer l'onglet",
- pinnedName: (title: string) => `${title} (épinglé)`,
- captions: {
- idle: "L'espace de travail Équipe ops a déjà trois onglets ouverts.",
- pin: "Épinglez d'abord la liste des tâches : cliquez sur l'épingle de son onglet.",
- open: "Un onglet épinglé reste sur sa page. Cliquez sur OPS-33 : la tâche s'ouvre dans un nouvel onglet.",
- switch: "Passez à un autre espace de travail : cliquez sur son nom en haut à gauche.",
- pickB: "Choisissez Équipe marketing.",
- inB: "Voici les onglets propres à Équipe marketing ; aucun onglet d'Équipe ops ne l'a suivie. Revenez maintenant à Équipe ops.",
- pickA: "Choisissez Équipe ops.",
- done: "Les onglets d'Équipe ops sont tous là, et OPS-33 est toujours l'onglet actif.",
- },
- },
-};
-
-type Phase = "idle" | "pin" | "open" | "switch" | "pickB" | "inB" | "pickA" | "done";
-
-// A tab is the workspace's issue list (issue === null) or one issue.
-type TabState = { key: string; issue: number | null; pinned: boolean };
-type Group = { tabs: TabState[]; active: string };
-
-const INITIAL: Record<Ws, Group> = {
- a: {
- tabs: [
- { key: "list", issue: null, pinned: false },
- { key: "0", issue: 0, pinned: false },
- { key: "1", issue: 1, pinned: false },
- ],
- active: "list",
- },
- b: {
- tabs: [
- { key: "list", issue: null, pinned: false },
- { key: "0", issue: 0, pinned: false },
- { key: "1", issue: 1, pinned: false },
- ],
- active: "0",
+ kicker: "ONGLETS DESKTOP",
+ title: "Chaque espace conserve ses propres onglets",
+ workspaces: {
+ acme: {
+ name: "Acme Engineering",
+ tabs: [
+ { label: "Tâches", pinned: true },
+ { label: "ACM-142 · Rate limiting", active: true },
+ { label: "ACM-151 · Test Safari" },
+ ],
+ summary: "Les onglets épinglés restent sur leur vue ; ouvrir une tâche crée un nouvel onglet.",
+ },
+ personal: {
+ name: "Personal Site",
+ tabs: [
+ { label: "Boîte", pinned: true },
+ { label: "SITE-1 · Portfolio", active: true },
+ ],
+ summary: "Changer d'espace bascule toute la barre d'onglets ; chaque espace retrouve ses onglets au retour.",
+ },
+ } as Record<Ws, { name: string; tabs: { label: string; pinned?: boolean; active?: boolean }[]; summary: string }>,
+ shortcuts: "⌘1–9 onglets · ⌘T nouvel onglet · ⌘W fermer",
},
};
-const statusDot: Record<Status, string> = {
- todo: "border-muted-foreground",
- in_progress: "border-warning bg-warning/40",
- in_review: "border-brand bg-brand/40",
-};
-
export function DesktopTabsDemo() {
const t = useDemoCopy(copy);
- const [frameRef, visible] = useStartWhenVisible<HTMLElement>();
- const [phase, setPhase] = useState<Phase>("pin");
- const [ws, setWs] = useState<Ws>("a");
- const [groups, setGroups] = useState(INITIAL);
-
- const shownPhase: Phase = visible ? phase : "idle";
- const group = groups[ws];
- const activeTab = group.tabs.find((tab) => tab.key === group.active)!;
- const menuOpen = phase === "pickB" || phase === "pickA";
- const issuesOf = t.issues[ws];
-
- const tabTitle = (tab: TabState) => (tab.issue === null ? t.nav.issues : issuesOf[tab.issue]!.title);
-
- // Pinning keeps the list where it is: it is already the first tab, which is
- // the end of the (empty) pinned zone.
- const pinList = () => {
- setGroups((g) => ({
- ...g,
- a: { ...g.a, tabs: g.a.tabs.map((tab) => (tab.key === "list" ? { ...tab, pinned: true } : tab)) },
- }));
- setPhase("open");
- };
-
- // A push from a pinned tab opens a new, active tab right of the opener
- // (never inside the pinned zone), so the list stays parked.
- const openFromPinned = (issue: number) => {
- setGroups((g) => {
- const tabs = g.a.tabs;
- const activeIndex = tabs.findIndex((tab) => tab.key === g.a.active);
- const boundary = tabs.filter((tab) => tab.pinned).length;
- const at = Math.max(activeIndex + 1, boundary);
- const tab: TabState = { key: String(issue), issue, pinned: false };
- return { ...g, a: { tabs: [...tabs.slice(0, at), tab, ...tabs.slice(at)], active: tab.key } };
- });
- setPhase("switch");
- };
-
- const pickWorkspace = (target: Ws) => {
- setWs(target);
- setPhase(target === "b" ? "inB" : "done");
- };
-
- const replay = () => {
- setPhase("pin");
- setWs("a");
- setGroups(INITIAL);
- };
+ const [ws, setWs] = useState<Ws>("acme");
+ const cur = t.workspaces[ws];
return (
- <DemoFrame frameRef={frameRef} title={t.title} caption={t.captions[shownPhase]} onReplay={replay}>
- <div className="grid min-h-80 grid-cols-1 grid-rows-[auto_1fr] sm:grid-cols-[10rem_minmax(0,1fr)] sm:grid-rows-1">
- {/* Sidebar: the workspace switcher sits at its top, as in Desktop. */}
- <div className="relative border-b bg-muted/30 p-2 sm:border-r sm:border-b-0">
- <CoachMark
- active={shownPhase === "switch" || shownPhase === "inB"}
- // A label below would cover the sidebar's first entry; the caption
- // already names the workspace switcher.
- quiet
- ringClassName="rounded-md"
- className="flex w-full"
- >
+ <EditorialFigure
+ kicker={t.kicker}
+ title={t.title}
+ actions={
+ <div className="flex items-center gap-3" role="tablist" aria-label={t.title}>
+ {(["acme", "personal"] as Ws[]).map((key) => (
<button
+ key={key}
type="button"
- aria-haspopup="menu"
- aria-expanded={menuOpen}
- disabled={!visible || (phase !== "switch" && phase !== "inB")}
- onClick={() => setPhase(phase === "switch" ? "pickB" : "pickA")}
- className="flex h-8 w-full min-w-0 items-center gap-2 rounded-md px-1.5 text-left text-label font-medium hover:bg-muted disabled:hover:bg-transparent"
+ role="tab"
+ aria-selected={ws === key}
+ onClick={() => setWs(key)}
+ className={cn(
+ "border-b-[1.5px] pb-1 text-[0.75rem] transition-colors",
+ ws === key
+ ? "border-[var(--primary)] font-medium text-foreground"
+ : "border-transparent text-muted-foreground hover:text-foreground",
+ )}
>
- <WorkspaceAvatar name={t.workspaces[ws]} />
- <span className="min-w-0 flex-1 truncate">{t.workspaces[ws]}</span>
- <ChevronsUpDown aria-hidden className="size-3.5 shrink-0 text-muted-foreground" />
+ {t.workspaces[key].name}
</button>
- </CoachMark>
- {menuOpen && (
- <div
- role="menu"
- aria-label={t.workspacesLabel}
- className="absolute top-11 left-2 z-30 w-52 rounded-lg border bg-popover p-1 text-popover-foreground shadow-md motion-safe:animate-in motion-safe:fade-in"
+ ))}
+ </div>
+ }
+ caption={cur.summary}
+ >
+ <div className="flex flex-col gap-3">
+ {/* Stylized Desktop tab bar */}
+ <div className="flex flex-wrap items-center gap-1.5 rounded-[4px] border border-border bg-background p-1.5">
+ <span className="mr-1 inline-flex items-center gap-1.5 rounded-[3px] bg-muted px-2 py-1 font-mono text-[0.6875rem] font-medium text-foreground">
+ {cur.name}
+ </span>
+ {cur.tabs.map((tab) => (
+ <span
+ key={tab.label}
+ className={cn(
+ "inline-flex items-center gap-1.5 rounded-[3px] border px-2.5 py-1 text-[0.78125rem]",
+ tab.active
+ ? "border-[var(--primary)]/50 bg-accent font-medium text-foreground"
+ : "border-border bg-card text-muted-foreground",
+ )}
>
- <div className="px-2 pt-1 pb-0.5 text-micro text-muted-foreground">{t.workspacesLabel}</div>
- {(["a", "b"] as Ws[]).map((option) => {
- const target = phase === "pickB" ? "b" : "a";
- return (
- <CoachMark
- key={option}
- active={option === target}
- quiet
- ringClassName="rounded-md"
- className="flex w-full"
- >
- <button
- type="button"
- role="menuitemradio"
- aria-checked={option === ws}
- disabled={option !== target}
- onClick={() => pickWorkspace(option)}
- className="flex w-full min-w-0 items-center gap-2 rounded-md px-2 py-1.5 text-left text-body hover:bg-accent disabled:hover:bg-transparent"
- >
- <WorkspaceAvatar name={t.workspaces[option]} />
- <span className="min-w-0 flex-1 truncate">{t.workspaces[option]}</span>
- {option === ws && <Check aria-hidden className="size-3.5 shrink-0 text-muted-foreground" />}
- </button>
- </CoachMark>
- );
- })}
- </div>
- )}
- <ul aria-hidden className="m-0 mt-10 hidden list-none flex-col gap-0.5 p-0 text-caption text-muted-foreground sm:flex">
- {[
- { Icon: Inbox, label: t.nav.inbox },
- { Icon: UserRound, label: t.nav.myIssues },
- { Icon: ListTodo, label: t.nav.issues },
- ].map(({ Icon, label }) => (
- <li key={label} className="m-0 flex items-center gap-2 rounded-md px-1.5 py-1">
- <Icon className="size-3.5 shrink-0" />
- <span className="truncate">{label}</span>
- </li>
- ))}
- </ul>
+ {tab.pinned && <Pin aria-hidden className="size-3 text-[var(--primary)]" />}
+ {tab.label}
+ </span>
+ ))}
</div>
- <div className="flex min-w-0 flex-col">
- <div role="tablist" aria-label={t.workspaces[ws]} className="flex min-w-0 gap-0.5 border-b bg-muted/30 px-1.5 pt-1.5">
- {group.tabs.map((tab) => {
- const isActive = tab.key === group.active;
- const title = tabTitle(tab);
- const issue = tab.issue === null ? null : issuesOf[tab.issue]!;
- const pinTarget = ws === "a" && tab.key === "list" && shownPhase === "pin";
- return (
- <div
- key={`${ws}-${tab.key}`}
- role="tab"
- aria-selected={isActive}
- aria-label={tab.pinned ? t.pinnedName(title) : title}
- className={cn(
- "flex h-8 min-w-0 max-w-40 flex-1 items-center gap-1.5 rounded-t-md border border-b-0 px-2 text-caption motion-safe:animate-in motion-safe:fade-in",
- tab.pinned ? "shrink-0 flex-none" : "",
- isActive
- ? "-mb-px min-w-24 border-border bg-card font-medium text-foreground"
- : "border-transparent text-muted-foreground",
- )}
- >
- {issue ? (
- <span aria-hidden className={cn("size-2.5 shrink-0 rounded-full border-2", statusDot[issue.status])} />
- ) : (
- <ListTodo aria-hidden className="size-3.5 shrink-0" />
- )}
- <span className="min-w-0 flex-1 truncate">{title}</span>
- {pinTarget ? (
- <CoachMark active side="bottom" ringClassName="rounded-sm">
- <button
- type="button"
- aria-label={t.pin}
- onClick={pinList}
- className="inline-flex size-4 items-center justify-center rounded-sm text-muted-foreground hover:bg-muted-foreground/20 hover:text-foreground"
- >
- <Pin className="size-3" />
- </button>
- </CoachMark>
- ) : tab.pinned ? (
- <PinOff aria-label={t.unpin} role="img" className="size-3 shrink-0 text-muted-foreground" />
- ) : (
- isActive && <X aria-label={t.close} role="img" className="size-3 shrink-0 text-muted-foreground" />
- )}
- </div>
- );
- })}
- </div>
-
- <div key={`${ws}-${group.active}`} className="min-w-0 flex-1 px-4 pt-3 pb-4 motion-safe:animate-in motion-safe:fade-in">
- {activeTab.issue === null ? (
- <>
- <div className="flex h-8 items-center text-label font-medium">{t.nav.issues}</div>
- <ul className="m-0 mt-1 flex list-none flex-col p-0">
- {issuesOf.map((issue, i) => {
- const target = ws === "a" && i === 2 && shownPhase === "open";
- return (
- <li key={issue.id} className="m-0 flex min-h-9 items-center gap-2 border-b last:border-b-0">
- <span
- aria-hidden
- className={cn("size-3 shrink-0 rounded-full border-2", statusDot[issue.status])}
- />
- <span className="w-14 shrink-0 text-caption text-muted-foreground">{issue.id}</span>
- <CoachMark active={target} side="right" ringClassName="rounded-sm" className="min-w-0">
- <button
- type="button"
- disabled={!target}
- onClick={() => openFromPinned(i)}
- className="max-w-full truncate rounded-sm text-left text-body hover:underline disabled:hover:no-underline"
- >
- {issue.title}
- </button>
- </CoachMark>
- </li>
- );
- })}
- </ul>
- </>
- ) : (
- <IssueDetail issue={issuesOf[activeTab.issue]!} statusLabel={t.status[issuesOf[activeTab.issue]!.status]} />
- )}
- </div>
+ <div className="flex items-center justify-between text-[0.75rem] text-muted-foreground">
+ <span className="font-mono">{t.shortcuts}</span>
</div>
</div>
- </DemoFrame>
- );
-}
-
-function WorkspaceAvatar({ name }: { name: string }) {
- return (
- <span
- aria-hidden
- className="inline-flex size-5 shrink-0 items-center justify-center rounded-sm bg-brand/12 text-micro font-medium text-brand"
- >
- {name.slice(0, 1)}
- </span>
- );
-}
-
-function IssueDetail({ issue, statusLabel }: { issue: Issue; statusLabel: string }) {
- return (
- <div className="min-w-0">
- <div className="flex h-8 items-center text-caption text-muted-foreground">{issue.id}</div>
- <div className="text-title-sm font-medium">{issue.title}</div>
- <div className="mt-2 flex items-center gap-1.5 text-caption text-muted-foreground">
- <span aria-hidden className={cn("size-3 rounded-full border-2", statusDot[issue.status])} />
- {statusLabel}
- </div>
- <div aria-hidden className="mt-4 flex flex-col gap-2">
- <span className="h-2 w-11/12 rounded-full bg-muted" />
- <span className="h-2 w-4/5 rounded-full bg-muted" />
- <span className="h-2 w-2/3 rounded-full bg-muted" />
- </div>
- </div>
+ </EditorialFigure>
);
}
diff --git a/apps/docs/components/demos/inbox-demo.tsx b/apps/docs/components/demos/inbox-demo.tsx
index fc84a10cff..6bb33e9ad0 100644
--- a/apps/docs/components/demos/inbox-demo.tsx
+++ b/apps/docs/components/demos/inbox-demo.tsx
@@ -1,789 +1,47 @@
"use client";
-import { useState, type ReactNode } from "react";
-import {
- AlarmClock,
- Archive,
- ArchiveRestore,
- Bot,
- ChevronRight,
- Circle,
- CircleCheck,
- CircleDashed,
- CircleDot,
- Filter,
- MoreHorizontal,
- SlidersHorizontal,
- X,
-} from "@multica/ui/icons";
-import { Button } from "@multica/ui/components/ui/button";
-import { cn } from "@multica/ui/lib/utils";
-import type { Lang } from "@/lib/i18n";
-import { CoachMark, DemoAvatar, DemoComment, DemoFrame, useDemoCopy, useStartWhenVisible } from "./demo-kit";
+import { CLIP_MANIFEST } from "./clip-manifest";
+import { EditorialClip, useDemoCopy } from "./demo-kit";
-type NoticeId = "mention" | "draft" | "failed" | "assigned";
-
-type Notice = {
- id: NoticeId;
- issue: string;
- title: string;
- actor: string;
- agent: boolean;
- time: string;
- /** What the issue shows when the notification is opened. */
- body: string;
- /** A mention that opens the comment body. */
- mention?: string;
-};
-
-type Copy = {
- title: string;
- inbox: string;
- /** The Work panel's other sections, below the Inbox. */
- sections: string[];
- /** Newest first, as the section lists them. */
- notices: Notice[];
- selectPrompt: string;
- /** The Inbox's floating group above the composer. */
- snooze: string;
- /** The assignee of the issues that aren't an agent's. */
- you: string;
- statuses: Record<Status, string>;
- archive: string;
- archivedToast: string;
- runFailed: string;
- /** The section header's tabs after the Inbox. */
- archivedTitle: string;
- snoozedTitle: string;
- restore: string;
- captions: Record<Phase, string>;
-};
-
-type Phase = "idle" | "start" | "opened" | "archived" | "archivedAgain" | "archivedView";
-
-const copy: { en: Copy } & Partial<Record<Lang, Copy>> = {
+const copy = {
en: {
- title: "Work",
- inbox: "Inbox",
- sections: ["Pinned", "Views", "Projects"],
- notices: [
- {
- id: "mention",
- issue: "OPS-41",
- title: "Sort out March expense claims",
- actor: "Lei Li",
- agent: false,
- time: "5m",
- mention: "@You",
- body: "Two March invoices are still missing. Can you send them by Friday?",
- },
- {
- id: "draft",
- issue: "OPS-44",
- title: "Write the November campaign post",
- actor: "Writing helper",
- agent: true,
- time: "20m",
- body: "The first draft is ready. Pick one of the two titles and I'll finish it.",
- },
- {
- id: "failed",
- issue: "OPS-42",
- title: "Update the customer service FAQ",
- actor: "Ops helper",
- agent: true,
- time: "1h",
- body: "Ops helper's run failed before it finished.",
- },
- {
- id: "assigned",
- issue: "OPS-43",
- title: "Prepare the quarterly supplier review",
- actor: "Lei Li",
- agent: false,
- time: "3h",
- body: "",
- },
- ],
- selectPrompt: "Open a notification from the Inbox",
- snooze: "Snooze",
- you: "You",
- statuses: { todo: "Todo", in_progress: "In Progress", in_review: "In Review" },
- archive: "Archive",
- archivedToast: "Notification archived",
- runFailed: "Run failed",
- archivedTitle: "Archived",
- snoozedTitle: "Snoozed",
- restore: "Move back to Inbox",
- captions: {
- idle: "Notifications that concern you sit at the top of the Work panel.",
- start: "Three unread notifications. Open the one where someone mentioned you.",
- opened:
- "The issue opened at the comment. The notification turned read and stayed in the list. When you're done with it, click Archive (E).",
- archived:
- "The row left the Inbox and the next notification opened: the draft is in. Once you've read it, archive this one too (E). Archiving never changes the issue's status.",
- archivedAgain:
- "That notification left too and the next one opened. The draft stays In Review until you change the issue's Status. Archived notifications have a tab of their own in the section header. Click Archived.",
- archivedView:
- "The section lists the archive now. Archived notifications keep their read state, and Move back to Inbox restores one. Use Replay to watch again.",
- },
+ title: "Triage notifications in the Work panel Inbox",
+ chapters: ["Open unread", "Archive from floating bar", "Archived tab"],
+ caption: "Opening a notification jumps to the comment with its floating action bar above the composer; archiving advances to the next item without changing issue status.",
},
zh: {
- title: "工作",
- inbox: "收件箱",
- sections: ["固定", "视图", "项目"],
- notices: [
- {
- id: "mention",
- issue: "OPS-41",
- title: "整理三月报销单",
- actor: "李雷",
- agent: false,
- time: "5 分钟",
- mention: "@你",
- body: "三月还差两张发票,周五前能补上吗?",
- },
- {
- id: "draft",
- issue: "OPS-44",
- title: "写 11 月活动推文",
- actor: "文案助手",
- agent: true,
- time: "20 分钟",
- body: "初稿写好了。两个标题选一个,我来收尾。",
- },
- {
- id: "failed",
- issue: "OPS-42",
- title: "更新客服常见问题",
- actor: "运营助手",
- agent: true,
- time: "1 小时",
- body: "运营助手的运行没有完成。",
- },
- {
- id: "assigned",
- issue: "OPS-43",
- title: "准备季度供应商评估",
- actor: "李雷",
- agent: false,
- time: "3 小时",
- body: "",
- },
- ],
- selectPrompt: "从收件箱打开一条通知",
- snooze: "延后",
- you: "你",
- statuses: { todo: "待办", in_progress: "进行中", in_review: "审核中" },
- archive: "归档",
- archivedToast: "已归档通知",
- runFailed: "运行失败",
- archivedTitle: "已归档",
- snoozedTitle: "已延后",
- restore: "移回收件箱",
- captions: {
- idle: "和你有关的通知在工作面板的最上方。",
- start: "三条未读通知。打开有人 @你 的那一条。",
- opened: "任务打开并定位到那条评论。通知变为已读,但仍留在列表里。处理完点\"归档\"(E)。",
- archived: "这一行离开了收件箱,下一条通知自动打开:初稿到了。看完也点\"归档\"(E)。归档不会改变任务的状态。",
- archivedAgain:
- "这条通知也归档了,下一条自动打开。初稿仍是审核中,直到你在任务的\"状态\"里修改。已归档的通知在分区标题的标签里。点\"已归档\"。",
- archivedView:
- "分区现在列出已归档的通知。它们保留已读状态,点\"移回收件箱\"即可恢复。点右上角可以重新演示。",
- },
+ title: "在工作面板收件箱中高效处理通知",
+ chapters: ["打开未读通知", "从悬浮栏归档并推进", "查看已归档标签"],
+ caption: "点开通知直达对应评论,输入框上方悬浮显示通知操作栏;归档(E)后自动推进到下一条,且不会修改任务状态。",
},
"zh-Hant": {
- title: "工作",
- inbox: "收件箱",
- sections: ["固定", "檢視", "專案"],
- notices: [
- {
- id: "mention",
- issue: "OPS-41",
- title: "整理三月報銷單",
- actor: "李雷",
- agent: false,
- time: "5 分鐘",
- mention: "@你",
- body: "三月還差兩張發票,週五前能補上嗎?",
- },
- {
- id: "draft",
- issue: "OPS-44",
- title: "寫 11 月活動推文",
- actor: "文案助手",
- agent: true,
- time: "20 分鐘",
- body: "初稿寫好了。兩個標題選一個,我來收尾。",
- },
- {
- id: "failed",
- issue: "OPS-42",
- title: "更新客服常見問題",
- actor: "營運助手",
- agent: true,
- time: "1 小時",
- body: "營運助手的執行沒有完成。",
- },
- {
- id: "assigned",
- issue: "OPS-43",
- title: "準備季度供應商評估",
- actor: "李雷",
- agent: false,
- time: "3 小時",
- body: "",
- },
- ],
- selectPrompt: "從收件箱開啟一條通知",
- snooze: "延後",
- you: "你",
- statuses: { todo: "待辦", in_progress: "進行中", in_review: "審查中" },
- archive: "歸檔",
- archivedToast: "已歸檔通知",
- runFailed: "執行失敗",
- archivedTitle: "已歸檔",
- snoozedTitle: "已延後",
- restore: "移回收件箱",
- captions: {
- idle: "和你有關的通知在工作面板的最上方。",
- start: "三條未讀通知。開啟有人 @你 的那一條。",
- opened: "任務開啟並定位到那條評論。通知變為已讀,但仍留在列表裡。處理完點\"歸檔\"(E)。",
- archived: "這一列離開了收件箱,下一條通知自動開啟:初稿到了。看完也點\"歸檔\"(E)。歸檔不會改變任務的狀態。",
- archivedAgain:
- "這條通知也歸檔了,下一條自動開啟。初稿仍是審查中,直到你在任務的\"狀態\"裡修改。已歸檔的通知在分區標題的分頁裡。點\"已歸檔\"。",
- archivedView:
- "分區現在列出已歸檔的通知。它們保留已讀狀態,點\"移回收件箱\"即可復原。點右上角可以重新播放。",
- },
+ title: "在工作面板收件箱中處理通知",
+ chapters: ["開啟未讀通知", "從懸浮列歸檔並推進", "檢視已歸檔分頁"],
+ caption: "點開通知直達評論,輸入框上方懸浮顯示通知操作列;歸檔(E)後自動推進至下一條,且不會改變任務狀態。",
},
ja: {
- title: "作業",
- inbox: "インボックス",
- sections: ["ピン留め済み", "ビュー", "プロジェクト"],
- notices: [
- {
- id: "mention",
- issue: "OPS-41",
- title: "3 月の経費精算を整理する",
- actor: "李雷",
- agent: false,
- time: "5分",
- mention: "@あなた",
- body: "3 月分の領収書がまだ 2 枚足りません。金曜までに出してもらえますか?",
- },
- {
- id: "draft",
- issue: "OPS-44",
- title: "11 月のキャンペーン投稿を書く",
- actor: "ライティングアシスタント",
- agent: true,
- time: "20分",
- body: "初稿ができました。タイトル案を 2 つから選んでもらえれば仕上げます。",
- },
- {
- id: "failed",
- issue: "OPS-42",
- title: "カスタマーサポートの FAQ を更新する",
- actor: "運用アシスタント",
- agent: true,
- time: "1時間",
- body: "運用アシスタントの実行は、終わる前に失敗しました。",
- },
- {
- id: "assigned",
- issue: "OPS-43",
- title: "四半期のサプライヤー評価を準備する",
- actor: "李雷",
- agent: false,
- time: "3時間",
- body: "",
- },
- ],
- selectPrompt: "インボックスから通知を開いてください",
- snooze: "スヌーズ",
- you: "あなた",
- statuses: { todo: "未着手", in_progress: "進行中", in_review: "レビュー中" },
- archive: "アーカイブ",
- archivedToast: "通知をアーカイブしました",
- runFailed: "実行失敗",
- archivedTitle: "アーカイブ済み",
- snoozedTitle: "スヌーズ中",
- restore: "インボックスに戻す",
- captions: {
- idle: "あなたに関係する通知は作業パネルの一番上に並びます。",
- start: "未読の通知が 3 件あります。あなたがメンションされた通知を開きます。",
- opened:
- "タスクがそのコメントの位置で開きました。通知は既読になりましたが、リストには残っています。対応が済んだら「アーカイブ」(E)をクリックします。",
- archived:
- "行がインボックスから外れ、次の通知が開きました。初稿が届いています。読んだらこれも「アーカイブ」(E)します。アーカイブしてもタスクのステータスは変わりません。",
- archivedAgain:
- "この通知もアーカイブされ、次の通知が開きました。タスクの「ステータス」を変えるまで、初稿はレビュー中のままです。アーカイブした通知はセクション見出しのタブにあります。「アーカイブ済み」をクリックします。",
- archivedView:
- "セクションにアーカイブした通知が並びます。既読の状態はそのまま残り、「インボックスに戻す」で元に戻せます。「もう一度」で最初から見られます。",
- },
+ title: "ワークパネルのインボックスで通知を整理する",
+ chapters: ["未読を開く", "フローティングバーでアーカイブ", "アーカイブ済み"],
+ caption: "通知を開くと入力欄の上部に操作バーが浮かび、アーカイブ(E)で次へ進みます。タスクのステータスは変わりません。",
},
ko: {
- title: "작업",
- inbox: "인박스",
- sections: ["고정됨", "뷰", "프로젝트"],
- notices: [
- {
- id: "mention",
- issue: "OPS-41",
- title: "3월 경비 청구 정리",
- actor: "리레이",
- agent: false,
- time: "5분",
- mention: "@나",
- body: "3월 영수증이 아직 두 장 빠져 있어요. 금요일까지 보내 주실 수 있나요?",
- },
- {
- id: "draft",
- issue: "OPS-44",
- title: "11월 캠페인 게시물 작성",
- actor: "글쓰기 도우미",
- agent: true,
- time: "20분",
- body: "초안이 준비됐습니다. 제목 두 가지 중 하나를 골라 주시면 마무리하겠습니다.",
- },
- {
- id: "failed",
- issue: "OPS-42",
- title: "고객 지원 FAQ 업데이트",
- actor: "운영 도우미",
- agent: true,
- time: "1시간",
- body: "운영 도우미의 실행이 끝나기 전에 실패했습니다.",
- },
- {
- id: "assigned",
- issue: "OPS-43",
- title: "분기별 공급업체 평가 준비",
- actor: "리레이",
- agent: false,
- time: "3시간",
- body: "",
- },
- ],
- selectPrompt: "인박스에서 알림을 여세요",
- snooze: "다시 알림",
- you: "나",
- statuses: { todo: "할 일", in_progress: "진행 중", in_review: "리뷰 중" },
- archive: "보관",
- archivedToast: "알림을 보관했습니다",
- runFailed: "실행 실패함",
- archivedTitle: "보관됨",
- snoozedTitle: "미뤄둔 항목",
- restore: "인박스로 되돌리기",
- captions: {
- idle: "나와 관련된 알림은 작업 패널 맨 위에 모입니다.",
- start: "읽지 않은 알림이 3개 있습니다. 누군가 나를 멘션한 알림을 여세요.",
- opened:
- "태스크가 그 댓글 위치에서 열렸습니다. 알림은 읽음이 되었지만 목록에 그대로 남아 있습니다. 처리가 끝나면 '보관'(E)을 클릭하세요.",
- archived:
- "행이 인박스에서 빠지고 다음 알림이 열렸습니다. 초안이 도착했습니다. 읽고 나면 이것도 '보관'(E)하세요. 보관해도 태스크의 상태는 바뀌지 않습니다.",
- archivedAgain:
- "이 알림도 보관되고 다음 알림이 열렸습니다. 태스크의 '상태'를 바꾸기 전까지 초안은 리뷰 중으로 남습니다. 보관된 알림은 섹션 제목의 탭에 있습니다. '보관됨'을 클릭하세요.",
- archivedView:
- "이제 섹션에 보관된 알림이 나열됩니다. 보관된 알림은 읽음 상태를 유지하고, '인박스로 되돌리기'로 되돌릴 수 있습니다. '다시 보기'로 다시 볼 수 있습니다.",
- },
+ title: "작업 패널 인박스에서 알림 정리하기",
+ chapters: ["읽지 않은 알림 열기", "플로팅 바에서 보관", "보관됨 탭"],
+ caption: "알림을 열면 입력창 위에 작업 바가 표시되며, 보관(E)하면 태스크 상태를 바꾸지 않고 다음 알림으로 이동합니다.",
},
fr: {
- title: "Travail",
- inbox: "Boîte de réception",
- sections: ["Épinglés", "Vues", "Projets"],
- notices: [
- {
- id: "mention",
- issue: "OPS-41",
- title: "Régulariser les notes de frais de mars",
- actor: "Lei Li",
- agent: false,
- time: "5 min",
- mention: "@Vous",
- body: "Il manque encore deux factures de mars. Pouvez-vous les envoyer d'ici vendredi ?",
- },
- {
- id: "draft",
- issue: "OPS-44",
- title: "Rédiger le post de la campagne de novembre",
- actor: "Assistant rédaction",
- agent: true,
- time: "20 min",
- body: "Le premier jet est prêt. Choisissez l'un des deux titres et je le termine.",
- },
- {
- id: "failed",
- issue: "OPS-42",
- title: "Mettre à jour la FAQ du service client",
- actor: "Assistant ops",
- agent: true,
- time: "1 h",
- body: "L'exécution d'Assistant ops a échoué avant la fin.",
- },
- {
- id: "assigned",
- issue: "OPS-43",
- title: "Préparer la revue trimestrielle des fournisseurs",
- actor: "Lei Li",
- agent: false,
- time: "3 h",
- body: "",
- },
- ],
- selectPrompt: "Ouvrez une notification depuis la boîte de réception",
- snooze: "Reporter",
- you: "Vous",
- statuses: { todo: "À faire", in_progress: "En cours", in_review: "En relecture" },
- archive: "Archiver",
- archivedToast: "Notification archivée",
- runFailed: "Exécution en échec",
- archivedTitle: "Archivées",
- snoozedTitle: "Reportés",
- restore: "Remettre dans la boîte de réception",
- captions: {
- idle: "Les notifications qui vous concernent sont en haut du panneau Travail.",
- start: "Trois notifications non lues. Ouvrez celle où quelqu'un vous a mentionné.",
- opened:
- "La tâche s'est ouverte au commentaire. La notification est devenue lue et reste dans la liste. Une fois qu'elle est traitée, cliquez sur Archiver (E).",
- archived:
- "La ligne a quitté la boîte de réception et la notification suivante s'est ouverte : le premier jet est arrivé. Une fois lu, archivez-le aussi (E). Archiver ne change jamais le statut de la tâche.",
- archivedAgain:
- "Cette notification est partie à son tour et la suivante s'est ouverte. Le premier jet reste En relecture tant que vous ne changez pas le Statut de la tâche. Les notifications archivées ont leur propre onglet dans l'en-tête de la section. Cliquez sur Archivées.",
- archivedView:
- "La section liste maintenant les archives. Les notifications archivées gardent leur état de lecture, et Remettre dans la boîte de réception en restaure une. Utilisez Rejouer pour revoir la démo.",
- },
+ title: "Trier les notifications dans la boîte de réception",
+ chapters: ["Ouvrir non lu", "Archiver depuis la barre flottante", "Onglet Archivées"],
+ caption: "Les actions flottent au-dessus de la zone de commentaire ; archiver passe à la notification suivante sans modifier le statut de la tâche.",
},
};
-type Step = Exclude<Phase, "idle">;
-
-// What each step has archived, read, and open.
-const ARCHIVED: Record<Step, NoticeId[]> = {
- start: [],
- opened: [],
- archived: ["mention"],
- archivedAgain: ["mention", "draft"],
- archivedView: ["mention", "draft"],
-};
-const READ: Record<Step, NoticeId[]> = {
- start: ["assigned"],
- opened: ["assigned", "mention"],
- archived: ["assigned", "mention", "draft"],
- archivedAgain: ["assigned", "mention", "draft", "failed"],
- archivedView: ["assigned", "mention", "draft", "failed"],
-};
-const OPEN: Record<Step, NoticeId | null> = {
- start: null,
- opened: "mention",
- archived: "draft",
- archivedAgain: "failed",
- archivedView: null,
-};
-
-type Status = "todo" | "in_progress" | "in_review";
-
-function statusOf(id: NoticeId): Status {
- if (id === "draft") return "in_review";
- return id === "failed" ? "in_progress" : "todo";
-}
-
-/** Leads a row the way the issue's status icon does in the product. */
-function DemoStatus({ status }: { status: Status }) {
- const Icon = { todo: Circle, in_progress: CircleDashed, in_review: CircleDot }[status];
- const color = {
- todo: "text-muted-foreground",
- in_progress: "text-warning",
- in_review: "text-success",
- }[status];
- return <Icon aria-hidden className={cn("size-3.5 shrink-0", color)} />;
-}
-
-/** The actor's avatar on a row's second line, smaller than DemoAvatar. */
-function RowAvatar({ name, agent }: { name: string; agent: boolean }) {
- return (
- <span
- aria-hidden
- className={cn(
- "inline-flex size-4 shrink-0 items-center justify-center rounded-full text-[0.625rem] font-medium",
- agent ? "bg-brand/12 text-brand" : "bg-muted text-foreground",
- )}
- >
- {agent ? <Bot className="size-2.5" /> : name.slice(0, 1)}
- </span>
- );
-}
-
-/**
- * A control in the Inbox's floating group. When the group is narrow its
- * shortcut gives way, with the issue's labels, then the rest of the labels;
- * a `pinned` control keeps both.
- */
-function BarButton({
- icon,
- label,
- shortcut,
- muted = true,
- pinned = false,
- issue = false,
- primary = false,
- onClick,
-}: {
- icon: ReactNode;
- label?: string;
- shortcut?: string;
- muted?: boolean;
- pinned?: boolean;
- issue?: boolean;
- primary?: boolean;
- onClick?: () => void;
-}) {
- return (
- <Button
- type="button"
- variant={primary ? "default" : "ghost"}
- size="xs"
- aria-label={label}
- title={label}
- disabled={!onClick}
- onClick={onClick}
- className={cn(
- "shrink-0 gap-1 px-1.5 disabled:opacity-100 [&_svg]:size-3.5",
- muted && !primary && "text-muted-foreground",
- )}
- >
- {icon}
- {label && (
- <span className={cn(!pinned && (issue ? "@max-[30rem]/bar:hidden" : "@max-[18rem]/bar:hidden"))}>
- {label}
- </span>
- )}
- {shortcut && (
- <kbd
- className={cn(
- "rounded border px-1 font-mono text-[0.625rem] leading-4",
- !pinned && "@max-[30rem]/bar:hidden",
- primary ? "border-current/25 bg-current/14" : "bg-muted text-muted-foreground",
- )}
- >
- {shortcut}
- </kbd>
- )}
- </Button>
- );
-}
-
-/**
- * The group floating above the composer of an issue opened from the Inbox:
- * the issue's status and assignee, then the notification's own actions, the
- * rarer ones behind ⋯, with Archive last.
- */
-function InboxBar({
- notice,
- copy,
- coach,
- onArchive,
-}: {
- notice: Notice;
- copy: Copy;
- coach: boolean;
- onArchive: () => void;
-}) {
- const status = statusOf(notice.id);
- const assignee = notice.agent ? notice.actor : copy.you;
- return (
- <div className="flex min-w-0 max-w-full items-center gap-0.5 rounded-lg border bg-background px-1.5 py-1 shadow-lg">
- <BarButton icon={<DemoStatus status={status} />} label={copy.statuses[status]} muted={false} issue />
- <BarButton icon={<RowAvatar name={assignee} agent={notice.agent} />} label={assignee} muted={false} issue />
- <span aria-hidden className="mx-1 h-4 w-px shrink-0 bg-border" />
- <BarButton icon={<MoreHorizontal />} />
- <BarButton icon={<AlarmClock />} label={copy.snooze} shortcut="H" />
- <CoachMark active={coach} side="top" align="end" ringClassName="rounded-md">
- <BarButton icon={<Archive />} label={copy.archive} shortcut="E" pinned primary onClick={coach ? onArchive : undefined} />
- </CoachMark>
- </div>
- );
-}
-
-/** A tab in the Inbox section's header, as the product's Inbox · Snoozed · Archived. */
-function DemoTab({
- label,
- active,
- count = 0,
- onClick,
-}: {
- label: string;
- active: boolean;
- count?: number;
- onClick?: () => void;
-}) {
- return (
- <button
- type="button"
- role="tab"
- aria-selected={active}
- disabled={!onClick}
- onClick={onClick}
- className={cn(
- "flex h-5 shrink-0 items-center gap-1 rounded-md px-1.5",
- active ? "bg-accent text-foreground" : "text-muted-foreground enabled:hover:text-foreground",
- )}
- >
- {label}
- {count > 0 && <span className="text-brand tabular-nums">{count}</span>}
- </button>
- );
-}
-
export function InboxDemo() {
const t = useDemoCopy(copy);
- const [frameRef, visible] = useStartWhenVisible<HTMLElement>();
- const [phase, setPhase] = useState<Step>("start");
-
- const shownPhase: Phase = visible ? phase : "idle";
- const rows = t.notices.filter((n) => !ARCHIVED[phase].includes(n.id));
- const isRead = (id: NoticeId) => READ[phase].includes(id);
- const unread = rows.filter((n) => !isRead(n.id)).length;
- const selected = t.notices.find((n) => n.id === OPEN[phase]) ?? null;
-
- const archivedTab = phase === "archivedView";
- const archivedRows = t.notices.filter((n) => ARCHIVED[phase].includes(n.id));
-
- const panel = (
- <div className="flex min-w-0 flex-col gap-0.5 bg-muted/30 p-1.5 sm:w-[46%] sm:shrink-0 sm:border-r">
- <div className="flex h-7 items-center gap-1 px-2">
- <span role="tablist" aria-label={t.inbox} className="-ml-1.5 flex min-w-0 flex-1 items-center gap-0.5 text-caption font-medium">
- <DemoTab label={t.inbox} active={!archivedTab} count={unread} />
- <DemoTab label={t.snoozedTitle} active={false} />
- <CoachMark active={visible && phase === "archivedAgain"} quiet ringClassName="rounded-md">
- <DemoTab
- label={t.archivedTitle}
- active={archivedTab}
- onClick={phase === "archivedAgain" ? () => setPhase("archivedView") : undefined}
- />
- </CoachMark>
- </span>
- <span aria-hidden className="flex items-center gap-1.5 text-faint-foreground">
- <Filter className="size-3.5" />
- <SlidersHorizontal className="size-3.5" />
- </span>
- </div>
- <ul className="m-0 flex list-none flex-col gap-0.5 p-0">
- {archivedTab
- ? archivedRows.map((notice) => (
- <li
- key={notice.id}
- className="m-0 flex h-8 items-center gap-2 rounded-md px-2 motion-safe:animate-in motion-safe:fade-in"
- >
- <DemoStatus status={statusOf(notice.id)} />
- <span className="min-w-0 flex-1 truncate text-body text-muted-foreground">{notice.title}</span>
- <span title={t.restore} className="flex shrink-0 text-muted-foreground">
- <ArchiveRestore aria-label={t.restore} className="size-3.5" />
- </span>
- </li>
- ))
- : rows.map((notice) => {
- const rowUnread = !isRead(notice.id);
- const active = notice.id === selected?.id;
- const clickable = visible && phase === "start" && notice.id === "mention";
- return (
- <li key={notice.id} className="m-0 p-0">
- <CoachMark active={clickable} side="right" ringClassName="rounded-md" className="flex w-full">
- <button
- type="button"
- disabled={!clickable}
- aria-current={active ? "page" : undefined}
- onClick={() => setPhase("opened")}
- className={cn(
- "flex h-8 w-full items-center gap-2 rounded-md px-2 text-left motion-safe:animate-in motion-safe:fade-in",
- active ? "bg-accent" : "enabled:hover:bg-accent/50",
- )}
- >
- <DemoStatus status={statusOf(notice.id)} />
- <span
- className={cn(
- "min-w-0 flex-1 truncate text-body",
- rowUnread ? "font-medium text-foreground" : "text-muted-foreground",
- )}
- >
- {notice.title}
- </span>
- <span className="shrink-0 text-caption text-faint-foreground tabular-nums">{notice.time}</span>
- <span
- aria-hidden
- className={cn("size-1.5 shrink-0 rounded-full", rowUnread ? "bg-brand" : "bg-transparent")}
- />
- </button>
- </CoachMark>
- </li>
- );
- })}
- </ul>
- <div aria-hidden className="mt-1 flex flex-col gap-0.5">
- {t.sections.map((label) => (
- <span key={label} className="flex h-7 items-center gap-1 px-2 text-caption font-medium text-faint-foreground">
- <ChevronRight className="size-3" />
- {label}
- </span>
- ))}
- </div>
- </div>
- );
-
- const detail = selected ? (
- <div key={selected.id} className="flex min-w-0 flex-1 flex-col motion-safe:animate-in motion-safe:fade-in">
- <div className="flex h-10 items-center gap-1.5 border-b px-3 text-caption">
- <span className="shrink-0 text-muted-foreground">{selected.issue}</span>
- <span className="min-w-0 flex-1 truncate text-label font-medium">{selected.title}</span>
- </div>
- <div className="flex flex-1 flex-col gap-2 p-3">
- {selected.id === "failed" ? (
- <>
- <div className="flex items-center gap-2 text-body">
- <DemoAvatar name={selected.actor} agent />
- <span className="font-medium">{selected.actor}</span>
- <span className="inline-flex items-center gap-1 text-caption text-destructive">
- <X aria-hidden className="size-3" />
- {t.runFailed}
- </span>
- </div>
- <p className="pl-7 text-caption text-muted-foreground">{selected.body}</p>
- </>
- ) : (
- <DemoComment author={selected.actor} agent={selected.agent}>
- {selected.mention && <span className="font-medium text-brand">{selected.mention} </span>}
- {selected.body}
- </DemoComment>
- )}
- </div>
- <div className="@container/bar flex justify-center px-3 pb-2">
- <InboxBar
- notice={selected}
- copy={t}
- coach={phase === "opened" || phase === "archived"}
- onArchive={() => setPhase(phase === "opened" ? "archived" : "archivedAgain")}
- />
- </div>
- <div aria-hidden className="mx-3 mb-3 h-12 rounded-lg border bg-card" />
- </div>
- ) : (
- <div className="flex min-h-32 flex-1 items-center justify-center p-4 text-caption text-muted-foreground">
- {t.selectPrompt}
- </div>
- );
-
- return (
- <DemoFrame frameRef={frameRef} title={t.title} caption={t.captions[shownPhase]} onReplay={() => setPhase("start")}>
- <div className="relative flex min-h-96 flex-col max-sm:divide-y sm:flex-row">
- {panel}
- {detail}
- {phase === "archived" && (
- <div className="absolute right-3 bottom-3 z-20 flex items-center gap-2 rounded-lg border bg-popover px-3 py-2 text-caption text-popover-foreground shadow-md motion-safe:animate-in motion-safe:fade-in motion-safe:slide-in-from-bottom-2">
- <CircleCheck aria-hidden className="size-3.5 text-success" />
- {t.archivedToast}
- </div>
- )}
- </div>
- </DemoFrame>
- );
+ const meta = CLIP_MANIFEST.inbox ?? { duration: 6.0, chapters: [] };
+ const chapters = t.chapters.map((label, i) => ({
+ label,
+ at: meta.chapters[i]?.at ?? (i * meta.duration) / t.chapters.length,
+ }));
+ return <EditorialClip slug="inbox" title={t.title} chapters={chapters} duration={meta.duration} caption={t.caption} />;
}
diff --git a/apps/docs/components/demos/issue-draft-demo.tsx b/apps/docs/components/demos/issue-draft-demo.tsx
index 1db8dbd82a..29e3481e26 100644
--- a/apps/docs/components/demos/issue-draft-demo.tsx
+++ b/apps/docs/components/demos/issue-draft-demo.tsx
@@ -1,538 +1,47 @@
"use client";
-import { useState } from "react";
-import {
- ArrowLeftRight,
- ChevronDown,
- ChevronRight,
- FolderKanban,
- Maximize2,
- MoreHorizontal,
- Paperclip,
- Users,
- X,
-} from "@multica/ui/icons";
-import { Button } from "@multica/ui/components/ui/button";
-import { cn } from "@multica/ui/lib/utils";
-import {
- CoachMark,
- DemoAvatar,
- DemoFrame,
- DemoRun,
- DemoStep,
- useDemoCopy,
- useDemoTimers,
- useStartWhenVisible,
-} from "./demo-kit";
-
-type Actor = { name: string; squad: boolean };
+import { CLIP_MANIFEST } from "./clip-manifest";
+import { EditorialClip, useDemoCopy } from "./demo-kit";
const copy = {
en: {
- title: "Create with agent · Book the team-dinner venue",
- workspace: "Ops team",
- breadcrumb: "Create with agent",
- expand: "Expand",
- close: "Close",
- createdBy: "Created by",
- agentsGroup: "Agents",
- squadsGroup: "Squads",
- actors: [
- { name: "Ops helper", squad: false },
- { name: "Writing helper", squad: false },
- { name: "Admin squad", squad: true },
- ] as Actor[],
- prompt:
- "Team dinner next Wednesday. Book a restaurant for 12 people, under $40 a head, close to the office, a private room if possible.",
- project: "Team events",
- projectLabel: "Project",
- moreFields: "More fields",
- attach: "Attach file",
- switchToManual: "Switch to Manual",
- createAnother: "Create another",
- submit: "Create",
- sending: "Sending…",
- toastSent: "Sent to agent — you'll get an inbox notification when it's done",
- inbox: "Inbox",
- notificationType: "Created with agent",
- issueId: "OPS-51",
- issueTitle: "Book a restaurant for next Wednesday's team dinner (12 people)",
- issueDescription:
- "Team dinner next Wednesday: book a restaurant for 12 people, under $40 a head, close to the office, a private room if possible.",
- statusLabel: "Status",
- assigneeLabel: "Assignee",
- status: "Todo",
- queued: "Queued",
- running: "Running",
- firstStep: "Read the issue description and discussion",
- captions: {
- idle: "Say what needs doing in a sentence or two, and an agent turns it into an issue.",
- actor: "The request is written. Created by starts with the agent you picked last time; click it to choose another.",
- picking: "Pick Ops helper. A squad works too: its leader drafts the issue.",
- ready: "The project carries over from the page you opened the dialog on. Click Create.",
- sending: "Sending the request to Ops helper…",
- waiting: "Ops helper drafts it in the background, so the dialog has already closed. The inbox tells you when it's done.",
- inbox: "The notification arrived. Open the new issue.",
- done: "Ops helper wrote the title and description and kept itself as the assignee. The issue is in Todo, so it starts working on it next.",
- },
+ title: "Create an issue with an agent (C)",
+ chapters: ["Press C", "Describe the goal", "Create & start"],
+ caption: "Press C from anywhere in the workspace, write a plain-language goal, and let Multica draft and start the issue.",
},
zh: {
- title: "通过智能体创建:团建订餐厅",
- workspace: "运营部",
- breadcrumb: "通过智能体创建",
- expand: "展开",
- close: "关闭",
- createdBy: "创建者",
- agentsGroup: "智能体",
- squadsGroup: "小队",
- actors: [
- { name: "运营助手", squad: false },
- { name: "文案助手", squad: false },
- { name: "行政小队", squad: true },
- ] as Actor[],
- prompt: "下周三团建,帮忙订一家餐厅:12 个人,人均 150 元以内,离公司近一点,最好有包间。",
- project: "团队活动",
- projectLabel: "项目",
- moreFields: "更多字段",
- attach: "添加附件",
- switchToManual: "切换到手动",
- createAnother: "继续创建",
- submit: "创建",
- sending: "发送中...",
- toastSent: "已交给智能体——完成后会在收件箱通知你",
- inbox: "收件箱",
- notificationType: "通过智能体创建",
- issueId: "OPS-51",
- issueTitle: "预订下周三团建餐厅(12 人)",
- issueDescription: "下周三团建,订一家餐厅:12 人,人均 150 元以内,离公司近,最好有包间。",
- statusLabel: "状态",
- assigneeLabel: "负责人",
- status: "待办",
- queued: "排队中",
- running: "运行中",
- firstStep: "读取任务描述和讨论",
- captions: {
- idle: "一两句话说清要做的事,由智能体写成任务。",
- actor: "需求已经写好。创建者默认是上次选的智能体,点它换一个。",
- picking: "选运营助手。也可以选小队,由队长来起草。",
- ready: "项目沿用了打开对话框时所在的项目。点击创建。",
- sending: "正在把需求交给运营助手...",
- waiting: "运营助手在后台起草,对话框已经关了,不用守着。写好后收件箱会通知你。",
- inbox: "通知到了。点开这条新任务。",
- done: "运营助手写好了标题和描述,负责人默认是它自己。任务处于待办,所以它接着就开始处理。",
- },
+ title: "按 C 快速通过智能体创建任务",
+ chapters: ["按 C 打开弹窗", "用自然语言描述目标", "创建并启动"],
+ caption: "在工作区任意位置按 C 呼出新建任务窗,直接描述目标即可自动生成结构化任务并交给智能体处理。",
+ },
+ "zh-Hant": {
+ title: "按 C 透過智能體快速建立任務",
+ chapters: ["按 C 開啟視窗", "以自然語言描述目標", "建立並啟動"],
+ caption: "在工作區任一位置按 C 呼出新建任務視窗,輸入目標即可自動建立並交給智能體執行。",
},
ja: {
- title: "エージェントで作成:チームの食事会の店を予約",
- workspace: "運用チーム",
- breadcrumb: "エージェントで作成",
- expand: "展開",
- close: "閉じる",
- createdBy: "作成者",
- agentsGroup: "エージェント",
- squadsGroup: "スクワッド",
- actors: [
- { name: "運用アシスタント", squad: false },
- { name: "ライティングアシスタント", squad: false },
- { name: "総務スクワッド", squad: true },
- ] as Actor[],
- prompt: "来週水曜のチームの食事会、お店を予約してほしい。12 人、1 人 5,000 円以内、会社の近くで、できれば個室。",
- project: "チームイベント",
- projectLabel: "プロジェクト",
- moreFields: "その他のフィールド",
- attach: "ファイルを添付",
- switchToManual: "手動に切り替え",
- createAnother: "もう 1 つ作成",
- submit: "作成",
- sending: "送信中…",
- toastSent: "エージェントに送信しました。完了するとインボックス通知が届きます",
- inbox: "インボックス",
- notificationType: "エージェントで作成",
- issueId: "OPS-51",
- issueTitle: "来週水曜のチーム食事会の店を予約(12 人)",
- issueDescription: "来週水曜のチームの食事会:12 人、1 人 5,000 円以内、会社の近く、できれば個室のお店を予約する。",
- statusLabel: "ステータス",
- assigneeLabel: "担当者",
- status: "未着手",
- queued: "待機中",
- running: "実行中",
- firstStep: "タスクの説明とコメントを読む",
- captions: {
- idle: "やりたいことを一言二言で書けば、エージェントがタスクにまとめます。",
- actor: "依頼文は書けています。作成者には前回選んだエージェントが入っています。クリックして選び直します。",
- picking: "運用アシスタントを選びます。スクワッドを選ぶと、リーダーが下書きします。",
- ready: "プロジェクトは、ダイアログを開いたページのものが引き継がれています。作成をクリックします。",
- sending: "依頼を運用アシスタントに送っています…",
- waiting: "運用アシスタントがバックグラウンドで下書きするので、ダイアログはもう閉じています。終わるとインボックスに通知が届きます。",
- inbox: "通知が届きました。新しいタスクを開きます。",
- done: "運用アシスタントがタイトルと説明を書き、担当者には自分を設定しました。タスクは未着手なので、続けて作業を始めます。",
- },
+ title: "エージェントと一緒にタスクを作成 (C)",
+ chapters: ["C キーで開く", "目的を自然文で入力", "作成して開始"],
+ caption: "ワークスペースのどこからでも C で作成ダイアログを開き、目的を書くだけでタスクを起票できます。",
},
ko: {
- title: "에이전트로 만들기: 팀 회식 식당 예약",
- workspace: "운영팀",
- breadcrumb: "에이전트로 만들기",
- expand: "펼치기",
- close: "닫기",
- createdBy: "생성자",
- agentsGroup: "에이전트",
- squadsGroup: "스쿼드",
- actors: [
- { name: "운영 도우미", squad: false },
- { name: "글쓰기 도우미", squad: false },
- { name: "총무 스쿼드", squad: true },
- ] as Actor[],
- prompt: "다음 주 수요일 팀 회식, 식당 하나 예약해 줘. 12명, 1인 4만 원 이내, 회사 근처, 가능하면 룸.",
- project: "팀 행사",
- projectLabel: "프로젝트",
- moreFields: "추가 필드",
- attach: "파일 첨부",
- switchToManual: "직접 만들기로 전환",
- createAnother: "하나 더 만들기",
- submit: "만들기",
- sending: "보내는 중...",
- toastSent: "에이전트에게 보냈습니다. 완료되면 인박스 알림을 받습니다",
- inbox: "인박스",
- notificationType: "에이전트로 생성됨",
- issueId: "OPS-51",
- issueTitle: "다음 주 수요일 팀 회식 식당 예약 (12명)",
- issueDescription: "다음 주 수요일 팀 회식: 12명, 1인 4만 원 이내, 회사 근처, 가능하면 룸이 있는 식당을 예약한다.",
- statusLabel: "상태",
- assigneeLabel: "담당자",
- status: "할 일",
- queued: "대기 중",
- running: "실행 중",
- firstStep: "태스크 설명과 댓글 읽기",
- captions: {
- idle: "할 일을 한두 문장으로 적으면 에이전트가 태스크로 만듭니다.",
- actor: "요청은 이미 적혀 있습니다. 생성자에는 지난번에 고른 에이전트가 들어 있습니다. 클릭해서 바꿉니다.",
- picking: "운영 도우미를 고르세요. 스쿼드를 고르면 리더가 초안을 씁니다.",
- ready: "프로젝트는 대화상자를 연 페이지의 것이 그대로 들어갑니다. 만들기를 클릭하세요.",
- sending: "요청을 운영 도우미에게 보내는 중...",
- waiting: "운영 도우미가 백그라운드에서 초안을 쓰므로 대화상자는 이미 닫혔습니다. 끝나면 인박스로 알려 줍니다.",
- inbox: "알림이 왔습니다. 새 태스크를 여세요.",
- done: "운영 도우미가 제목과 설명을 쓰고 담당자는 자기 자신으로 두었습니다. 태스크가 할 일 상태라서 이어서 작업을 시작합니다.",
- },
+ title: "에이전트로 태스크 빠르게 만들기 (C)",
+ chapters: ["C 키로 열기", "목표 설명 입력", "생성 및 시작"],
+ caption: "어디서나 C 키로 새 태스크 창을 열고 원하는 결과를 적으면 바로 생성하고 실행을 시작합니다.",
},
fr: {
- title: "Créer avec un agent : réserver le restaurant du dîner d'équipe",
- workspace: "Équipe ops",
- breadcrumb: "Créer avec un agent",
- expand: "Agrandir",
- close: "Fermer",
- createdBy: "Créé par",
- agentsGroup: "Agents",
- squadsGroup: "Squads",
- actors: [
- { name: "Assistant ops", squad: false },
- { name: "Assistant rédaction", squad: false },
- { name: "Squad services généraux", squad: true },
- ] as Actor[],
- prompt:
- "Dîner d'équipe mercredi prochain : réserve un restaurant pour 12 personnes, moins de 35 € par tête, près du bureau, avec un salon privé si possible.",
- project: "Événements d'équipe",
- projectLabel: "Projet",
- moreFields: "Plus de champs",
- attach: "Joindre un fichier",
- switchToManual: "Passer en mode manuel",
- createAnother: "En créer un autre",
- submit: "Créer",
- sending: "Envoi…",
- toastSent: "Envoyé à l'agent — vous recevrez une notification dans votre boîte de réception une fois terminé",
- inbox: "Boîte de réception",
- notificationType: "Créé avec un agent",
- issueId: "OPS-51",
- issueTitle: "Réserver le restaurant du dîner d'équipe de mercredi prochain (12 personnes)",
- issueDescription:
- "Dîner d'équipe mercredi prochain : réserver un restaurant pour 12 personnes, moins de 35 € par tête, près du bureau, avec un salon privé si possible.",
- statusLabel: "Statut",
- assigneeLabel: "Assigné à",
- status: "À faire",
- queued: "En file d'attente",
- running: "En cours",
- firstStep: "Lire la description et la discussion de la tâche",
- captions: {
- idle: "Décrivez le travail en une ou deux phrases ; un agent en fait une tâche.",
- actor: "La demande est rédigée. Créé par reprend l'agent choisi la dernière fois ; cliquez dessus pour en changer.",
- picking: "Choisissez Assistant ops. Un squad convient aussi : son chef rédige la tâche.",
- ready: "Le projet est repris de la page depuis laquelle vous avez ouvert la fenêtre. Cliquez sur Créer.",
- sending: "Envoi de la demande à Assistant ops…",
- waiting: "Assistant ops rédige en arrière-plan, la fenêtre est donc déjà fermée. La boîte de réception vous prévient quand c'est fait.",
- inbox: "La notification est arrivée. Ouvrez la nouvelle tâche.",
- done: "Assistant ops a écrit le titre et la description, et s'est laissé comme assigné. La tâche est À faire, il commence donc à la traiter.",
- },
+ title: "Créer une tâche avec un agent (C)",
+ chapters: ["Appuyer sur C", "Décrire l'objectif", "Créer et démarrer"],
+ caption: "Appuyez sur C n'importe où dans l'espace, décrivez le besoin et créez la tâche en un geste.",
},
};
-type Phase = "idle" | "actor" | "picking" | "ready" | "sending" | "waiting" | "inbox" | "done";
-
export function IssueDraftDemo() {
const t = useDemoCopy(copy);
- const { after, clear } = useDemoTimers();
- const [frameRef, visible] = useStartWhenVisible<HTMLElement>();
- const [phase, setPhase] = useState<Exclude<Phase, "idle">>("actor");
- // The picker opens on the agent used last time; the scenario switches to the first one.
- const [actorIndex, setActorIndex] = useState(1);
- const [queued, setQueued] = useState(true);
-
- const shownPhase: Phase = visible ? phase : "idle";
- const actor = t.actors[actorIndex]!;
- const dialogOpen = phase === "actor" || phase === "picking" || phase === "ready" || phase === "sending";
-
- const pick = (index: number) => {
- setActorIndex(index);
- setPhase("ready");
- };
-
- const create = () => {
- setPhase("sending");
- after(800, () => setPhase("waiting"));
- after(3200, () => setPhase("inbox"));
- };
-
- const open = () => {
- setPhase("done");
- after(1100, () => setQueued(false));
- };
-
- const replay = () => {
- clear();
- setPhase("actor");
- setActorIndex(1);
- setQueued(true);
- };
-
- return (
- <DemoFrame frameRef={frameRef} title={t.title} caption={t.captions[shownPhase]} onReplay={replay}>
- <div className="relative flex min-h-96 flex-col bg-muted/30 p-3 sm:p-4">
- {dialogOpen && (
- <div
- role="dialog"
- aria-label={t.breadcrumb}
- className="flex flex-1 flex-col rounded-xl border bg-popover text-popover-foreground shadow-lg motion-safe:animate-in motion-safe:fade-in"
- >
- <div className="flex items-center justify-between gap-2 px-4 pt-3 pb-2">
- <div className="flex min-w-0 items-center gap-1.5 text-caption">
- <span className="truncate text-muted-foreground">{t.workspace}</span>
- <ChevronRight aria-hidden className="size-3 shrink-0 text-muted-foreground" />
- <span className="truncate font-medium">{t.breadcrumb}</span>
- </div>
- <div className="flex shrink-0 items-center gap-1 text-muted-foreground">
- <button type="button" disabled aria-label={t.expand} className="rounded-sm p-1 opacity-60">
- <Maximize2 className="size-3.5" />
- </button>
- <button type="button" disabled aria-label={t.close} className="rounded-sm p-1 opacity-60">
- <X className="size-3.5" />
- </button>
- </div>
- </div>
-
- <div className="relative px-4 pb-2">
- <CoachMark active={shownPhase === "actor"} side="right" ringClassName="rounded-md">
- <button
- type="button"
- aria-haspopup="listbox"
- aria-expanded={phase === "picking"}
- disabled={!visible || (phase !== "actor" && phase !== "picking")}
- onClick={() => setPhase(phase === "picking" ? "actor" : "picking")}
- className="-mx-1 inline-flex h-7 items-center gap-2 rounded-md px-1 text-caption text-muted-foreground hover:bg-muted disabled:hover:bg-transparent"
- >
- <span>{t.createdBy}</span>
- <span className="flex items-center gap-1.5 text-label text-foreground">
- <ActorAvatar actor={actor} />
- {actor.name}
- </span>
- {(phase === "actor" || phase === "picking") && (
- <ChevronDown aria-hidden className="size-3.5" />
- )}
- </button>
- </CoachMark>
- {phase === "picking" && (
- <div
- role="listbox"
- aria-label={t.createdBy}
- className="absolute top-full left-3 z-10 mt-1 w-56 rounded-lg border bg-popover p-1 text-popover-foreground shadow-md motion-safe:animate-in motion-safe:fade-in"
- >
- {[false, true].map((squad) => (
- <div key={String(squad)}>
- <div className="px-2 pt-1 pb-0.5 text-micro text-muted-foreground">
- {squad ? t.squadsGroup : t.agentsGroup}
- </div>
- {t.actors.map((candidate, i) =>
- candidate.squad === squad ? (
- <CoachMark
- key={candidate.name}
- active={i === 0}
- side="right"
- ringClassName="rounded-md"
- className="flex w-full"
- >
- <button
- type="button"
- role="option"
- aria-selected={i === actorIndex}
- disabled={i !== 0}
- onClick={() => pick(i)}
- className="flex w-full items-center gap-2 rounded-md px-2 py-1.5 text-left text-body hover:bg-accent disabled:opacity-50 disabled:hover:bg-transparent"
- >
- <ActorAvatar actor={candidate} />
- <span className="min-w-0 truncate">{candidate.name}</span>
- </button>
- </CoachMark>
- ) : null,
- )}
- </div>
- ))}
- </div>
- )}
- </div>
-
- <p className="min-h-20 flex-1 px-4 pb-3 text-body">{t.prompt}</p>
-
- <div className="flex flex-wrap items-center gap-1.5 px-3 pb-2">
- <span
- aria-label={t.projectLabel}
- className="inline-flex h-6 items-center gap-1 rounded-full border px-2 text-caption"
- >
- <FolderKanban aria-hidden className="size-3.5 text-muted-foreground" />
- {t.project}
- </span>
- <button
- type="button"
- disabled
- aria-label={t.moreFields}
- className="inline-flex h-6 items-center rounded-full border px-1.5 text-muted-foreground opacity-60"
- >
- <MoreHorizontal className="size-3.5" />
- </button>
- </div>
-
- <div className="flex flex-wrap items-center gap-x-2 gap-y-2 border-t px-3 py-2.5">
- <button
- type="button"
- disabled
- aria-label={t.attach}
- className="mr-auto rounded-md p-1 text-muted-foreground opacity-60"
- >
- <Paperclip className="size-3.5" />
- </button>
- <button
- type="button"
- disabled
- className="inline-flex items-center gap-1.5 rounded-sm px-2 py-1 text-caption text-muted-foreground opacity-60"
- >
- <ArrowLeftRight aria-hidden className="size-3.5" />
- {t.switchToManual}
- </button>
- <span className="inline-flex items-center gap-1.5 text-caption text-muted-foreground opacity-60">
- <span aria-hidden className="inline-flex h-3.5 w-6 items-center rounded-full bg-input px-0.5">
- <span className="size-2.5 rounded-full bg-background shadow-sm" />
- </span>
- {t.createAnother}
- </span>
- <CoachMark active={shownPhase === "ready"} side="top" align="end" ringClassName="rounded-lg" className="ml-auto">
- <Button
- type="button"
- size="sm"
- className="min-w-20"
- disabled={phase !== "ready"}
- onClick={create}
- >
- {phase === "sending" ? t.sending : t.submit}
- </Button>
- </CoachMark>
- </div>
- </div>
- )}
-
- {(phase === "waiting" || phase === "inbox") && (
- <div className="flex flex-1 flex-col rounded-xl border bg-background motion-safe:animate-in motion-safe:fade-in">
- <div className="border-b px-3 py-2 text-label font-medium">{t.inbox}</div>
- <div className="flex flex-col gap-1 p-2">
- {phase === "inbox" ? (
- <CoachMark active side="bottom" align="start" ringClassName="rounded-md" className="flex w-full">
- <button
- type="button"
- onClick={open}
- className="flex w-full items-start gap-2 rounded-md bg-brand/5 px-2 py-2 text-left hover:bg-accent motion-safe:animate-in motion-safe:fade-in motion-safe:slide-in-from-top-1"
- >
- <DemoAvatar name={t.actors[0]!.name} agent />
- <span className="min-w-0 flex-1">
- <span className="flex items-center gap-1.5 text-caption text-muted-foreground">
- <span className="truncate font-medium text-foreground">{t.actors[0]!.name}</span>
- <span className="truncate">· {t.notificationType}</span>
- </span>
- <span className="mt-0.5 block text-body break-words">
- <span className="text-muted-foreground">{t.issueId}</span> {t.issueTitle}
- </span>
- </span>
- <span aria-hidden className="mt-1.5 size-1.5 shrink-0 rounded-full bg-brand" />
- </button>
- </CoachMark>
- ) : (
- <div aria-hidden className="flex flex-col gap-2 px-2 py-2">
- <span className="h-2.5 w-2/3 rounded-full bg-muted" />
- <span className="h-2.5 w-1/2 rounded-full bg-muted" />
- </div>
- )}
- </div>
- </div>
- )}
-
- {phase === "done" && (
- <div className="flex flex-1 flex-col gap-3 rounded-xl border bg-background p-4 motion-safe:animate-in motion-safe:fade-in">
- <div>
- <div className="text-caption text-muted-foreground">{t.issueId}</div>
- <div className="mt-0.5 text-title-sm font-medium break-words">{t.issueTitle}</div>
- <p className="mt-1.5 text-body text-muted-foreground">{t.issueDescription}</p>
- </div>
- <dl className="grid w-fit grid-cols-[auto_minmax(0,1fr)] items-center gap-x-6 gap-y-1.5 text-body">
- <dt className="text-caption text-muted-foreground">{t.statusLabel}</dt>
- <dd className="flex items-center gap-1.5">
- <span aria-hidden className="size-3 rounded-full border-2 border-muted-foreground" />
- {t.status}
- </dd>
- <dt className="text-caption text-muted-foreground">{t.assigneeLabel}</dt>
- <dd className="flex min-w-0 items-center gap-1.5">
- <DemoAvatar name={t.actors[0]!.name} agent />
- <span className="truncate">{t.actors[0]!.name}</span>
- </dd>
- <dt className="text-caption text-muted-foreground">{t.projectLabel}</dt>
- <dd className="flex min-w-0 items-center gap-1.5">
- <FolderKanban aria-hidden className="size-3.5 shrink-0 text-muted-foreground" />
- <span className="truncate">{t.project}</span>
- </dd>
- </dl>
- <DemoRun agent={t.actors[0]!.name} status={queued ? t.queued : t.running} active>
- {!queued && <DemoStep state="running">{t.firstStep}</DemoStep>}
- </DemoRun>
- </div>
- )}
-
- {phase === "waiting" && (
- <div
- className={cn(
- "pointer-events-none absolute inset-x-3 bottom-3 rounded-lg border bg-popover px-3 py-2 text-caption shadow-md sm:inset-x-auto sm:right-4 sm:max-w-80",
- "motion-safe:animate-in motion-safe:fade-in motion-safe:slide-in-from-bottom-1",
- )}
- >
- {t.toastSent}
- </div>
- )}
- </div>
- </DemoFrame>
- );
-}
-
-function ActorAvatar({ actor }: { actor: Actor }) {
- return actor.squad ? (
- <span
- aria-hidden
- className="inline-flex size-5 shrink-0 items-center justify-center rounded-full bg-muted text-foreground"
- >
- <Users className="size-3" />
- </span>
- ) : (
- <DemoAvatar name={actor.name} agent />
- );
+ const meta = CLIP_MANIFEST["issue-draft"] ?? { duration: 5.5, chapters: [] };
+ const chapters = t.chapters.map((label, i) => ({
+ label,
+ at: meta.chapters[i]?.at ?? (i * meta.duration) / t.chapters.length,
+ }));
+ return <EditorialClip slug="issue-draft" title={t.title} chapters={chapters} duration={meta.duration} caption={t.caption} />;
}
diff --git a/apps/docs/components/demos/issue-status-demo.tsx b/apps/docs/components/demos/issue-status-demo.tsx
index 60a70b444b..2b2bc74bf6 100644
--- a/apps/docs/components/demos/issue-status-demo.tsx
+++ b/apps/docs/components/demos/issue-status-demo.tsx
@@ -1,546 +1,47 @@
"use client";
-import { useRef, useState } from "react";
-import { ChevronDown } from "@multica/ui/icons";
-import { cn } from "@multica/ui/lib/utils";
-import {
- CoachMark,
- DemoAvatar,
- DemoComment,
- DemoFrame,
- DemoRun,
- DemoStep,
- useDemoCopy,
- useDemoTimers,
- useStartWhenVisible,
-} from "./demo-kit";
-
-type Status = "backlog" | "todo" | "in_progress" | "in_review" | "blocked" | "done" | "cancelled";
-type Category = "unstarted" | "started" | "done" | "closed";
-
-const CATEGORIES: { key: Category; statuses: Status[] }[] = [
- { key: "unstarted", statuses: ["backlog", "todo"] },
- { key: "started", statuses: ["in_progress", "in_review", "blocked"] },
- { key: "done", statuses: ["done"] },
- { key: "closed", statuses: ["cancelled"] },
-];
-
-const MENU_ORDER: Status[] = ["backlog", "todo", "in_progress", "in_review", "done", "blocked", "cancelled"];
-
-const categoryOf = (status: Status) => CATEGORIES.find((c) => c.statuses.includes(status))!.key;
-
-const statusDot: Record<Status, string> = {
- backlog: "border-dashed border-muted-foreground",
- todo: "border-muted-foreground",
- in_progress: "border-warning bg-warning/40",
- in_review: "border-brand bg-brand/40",
- blocked: "border-destructive bg-destructive/30",
- done: "border-success bg-success",
- cancelled: "border-muted-foreground bg-muted-foreground/50",
-};
+import { CLIP_MANIFEST } from "./clip-manifest";
+import { EditorialClip, useDemoCopy } from "./demo-kit";
const copy = {
en: {
- title: "OPS-21 · Draft next quarter's team outing plan",
- statusLabel: "Status",
- assigneeLabel: "Assignee",
- agent: "Ops helper",
- you: "You",
- status: {
- backlog: "Backlog",
- todo: "Todo",
- in_progress: "In Progress",
- in_review: "In Review",
- blocked: "Blocked",
- done: "Done",
- cancelled: "Cancelled",
- } as Record<Status, string>,
- category: { unstarted: "Unstarted", started: "Started", done: "Done", closed: "Closed" } as Record<Category, string>,
- meaning: {
- backlog: "Parked. Assigning an issue here never starts an agent run.",
- todo: "Queued. Moving an issue here starts the assigned agent.",
- in_progress: "Actively being worked on.",
- in_review: "Delivered, waiting on human review.",
- blocked: "Stalled on an external dependency.",
- done: "Completed.",
- cancelled: "Decided not to do.",
- } as Record<Status, string>,
- note: {
- backlog: "Ops helper is already the assignee, but it waits while the issue is here.",
- todo: "A run is created for Ops helper.",
- in_progress: "The agent set this as it started work.",
- in_review: "The run has finished; the issue has not. Whether the work is done is decided by the status.",
- blocked: "",
- done: "A terminal status: the work finished as planned.",
- cancelled: "A terminal status, not counted as finished well. The discussion and results stay readable.",
- } as Record<Status, string>,
- changed: (from: string, to: string) => `changed status from ${from} to ${to}`,
- queued: "Queued",
- running: "Running",
- completed: "Completed",
- steps: [
- "Read the issue description and discussion",
- "Set the status to In Progress",
- "Compare two venues on budget, distance and capacity",
- "Draft a one-day schedule",
- "Set the status to In Review",
- ],
- reply: "The outing plan is ready: two venue options with budgets and a one-day schedule. Please review.",
- captions: {
- idle: "An issue assigned to an agent, parked in Backlog.",
- backlog: "Backlog parks the issue: the assignee is Ops helper, but it does not start. Click Status.",
- pick: "Move it to Todo.",
- running: "Leaving Backlog starts the assigned agent. It moves the issue to In Progress as it begins.",
- review: "Delivered: the agent set In Review. Check the result, then click Status.",
- finish: "Pick Done if the plan works. Cancelled also ends the issue, but not as finished.",
- done: "Done is terminal. Use Replay to try Cancelled instead.",
- cancelled: "Cancelled ends the issue without counting it as finished. Use Replay to watch again.",
- },
+ title: "Move an issue across status categories",
+ chapters: ["Backlog → Active", "In Progress → Review", "Mark Done"],
+ caption: "Every status belongs to a lifecycle category (unstarted, started, done, closed) and records transitions in the activity timeline.",
},
zh: {
- title: "OPS-21 · 整理下季度团建方案",
- statusLabel: "状态",
- assigneeLabel: "负责人",
- agent: "运营助手",
- you: "你",
- status: {
- backlog: "待规划",
- todo: "待办",
- in_progress: "进行中",
- in_review: "审核中",
- blocked: "已阻塞",
- done: "已完成",
- cancelled: "已取消",
- } as Record<Status, string>,
- category: { unstarted: "未开始", started: "已开始", done: "已完成", closed: "已关闭" } as Record<Category, string>,
- meaning: {
- backlog: "搁置。把任务移到这里不会启动智能体。",
- todo: "排队中。把任务移到这里会启动指派的智能体。",
- in_progress: "正在进行。",
- in_review: "已交付,等待人工审核。",
- blocked: "被外部依赖阻塞。",
- done: "已完成。",
- cancelled: "决定不做。",
- } as Record<Status, string>,
- note: {
- backlog: "负责人已经是运营助手,但任务停在这里时它不会开始。",
- todo: "为运营助手创建了一次运行。",
- in_progress: "智能体开始工作时自己改成了进行中。",
- in_review: "运行已经结束,任务还没有。任务是否完成,以状态为准。",
- blocked: "",
- done: "终态,工作顺利完成。",
- cancelled: "终态,但不算顺利完成。讨论和结果仍可查阅。",
- } as Record<Status, string>,
- changed: (from: string, to: string) => `状态从 ${from} 改为 ${to}`,
- queued: "排队中",
- running: "运行中",
- completed: "已完成",
- steps: [
- "读取任务描述和讨论",
- "把状态改为 进行中",
- "比较两个场地的预算、路程和容纳人数",
- "排出一天的日程",
- "把状态改为 审核中",
- ],
- reply: "团建方案已整理好:两个备选场地和各自预算,附一天的日程,请检查。",
- captions: {
- idle: "一条已分配给智能体、停在待规划的任务。",
- backlog: "待规划会把任务搁置:负责人是运营助手,但它不会开始。点击状态。",
- pick: "把任务移到待办。",
- running: "离开待规划后,被分配的智能体开始执行,并在开始时把任务改为进行中。",
- review: "交付完成,智能体把状态改成了审核中。检查结果后点击状态。",
- finish: "方案可用就选已完成。已取消同样会结束任务,但不算完成。",
- done: "已完成是终态。点右上角重新演示,可以改选已取消。",
- cancelled: "已取消结束了任务,但不计为完成。点右上角可以重新演示。",
- },
+ title: "在生命周期状态之间推进任务",
+ chapters: ["移出 Backlog", "进行中 → 审核中", "验收完成"],
+ caption: "每个状态归属明确的生命周期分类(未开始、进行中、已完成、已关闭),每次变更自动记入活动历史。",
+ },
+ "zh-Hant": {
+ title: "在生命週期狀態之間推進任務",
+ chapters: ["移出 Backlog", "進行中 → 審核中", "驗收完成"],
+ caption: "每個狀態對應明確的生命週期分類,每次狀態變更都會自動記錄於活動時間線。",
},
ja: {
- title: "OPS-21 · 来期のチームイベント案をまとめる",
- statusLabel: "ステータス",
- assigneeLabel: "担当者",
- agent: "運用アシスタント",
- you: "あなた",
- status: {
- backlog: "バックログ",
- todo: "未着手",
- in_progress: "進行中",
- in_review: "レビュー中",
- blocked: "ブロック中",
- done: "完了",
- cancelled: "キャンセル済み",
- } as Record<Status, string>,
- category: { unstarted: "未着手", started: "開始済み", done: "完了", closed: "終了" } as Record<Category, string>,
- meaning: {
- backlog: "保留。ここに移動してもエージェントは起動しません。",
- todo: "待機中。ここに移動すると担当エージェントが起動します。",
- in_progress: "作業中。",
- in_review: "納品済み、レビュー待ち。",
- blocked: "外部依存でブロック中。",
- done: "完了。",
- cancelled: "見送り。",
- } as Record<Status, string>,
- note: {
- backlog: "担当者はすでに運用アシスタントですが、タスクがここにある間は始めません。",
- todo: "運用アシスタントの実行が作成されました。",
- in_progress: "エージェントが作業を始めるときに自分で進行中に変えました。",
- in_review: "実行は終わりましたが、タスクはまだ終わっていません。完了したかどうかはステータスで決まります。",
- blocked: "",
- done: "終了状態。作業は予定どおり完了しました。",
- cancelled: "終了状態ですが、完了扱いにはなりません。議論と成果はそのまま読めます。",
- } as Record<Status, string>,
- changed: (from: string, to: string) => `ステータスを ${from} から ${to} に変更しました`,
- queued: "待機中",
- running: "実行中",
- completed: "完了",
- steps: [
- "タスクの説明と議論を読む",
- "ステータスを 進行中 に変更",
- "2 つの会場を予算、距離、収容人数で比べる",
- "1 日のスケジュール案を作る",
- "ステータスを レビュー中 に変更",
- ],
- reply: "イベント案をまとめました。会場の候補 2 つとそれぞれの予算、1 日のスケジュールです。確認をお願いします。",
- captions: {
- idle: "エージェントに割り当て済みで、バックログに置かれたタスク。",
- backlog: "バックログはタスクを保留にします。担当者は運用アシスタントですが、作業は始まりません。ステータスをクリックしてください。",
- pick: "未着手に移動してください。",
- running: "バックログを出ると、担当エージェントが動き出し、始めるときにタスクを進行中に変えます。",
- review: "納品されました。エージェントがレビュー中に変えています。結果を確認したら、ステータスをクリックしてください。",
- finish: "案に問題がなければ完了を選びます。キャンセル済みでもタスクは終わりますが、完了扱いにはなりません。",
- done: "完了は終了状態です。右上から最初に戻すと、キャンセル済みも試せます。",
- cancelled: "キャンセル済みでタスクは終わりましたが、完了には数えません。右上から最初に戻せます。",
- },
+ title: "ステータスに沿ってタスクを進める",
+ chapters: ["Backlog から移動", "進行中 → レビュー中", "完了にする"],
+ caption: "各ステータスはライフサイクル分類に属し、変更履歴はすべてアクティビティに残ります。",
},
ko: {
- title: "OPS-21 · 다음 분기 팀 워크숍 계획 정리",
- statusLabel: "상태",
- assigneeLabel: "담당자",
- agent: "운영 도우미",
- you: "나",
- status: {
- backlog: "백로그",
- todo: "할 일",
- in_progress: "진행 중",
- in_review: "리뷰 중",
- blocked: "막힘",
- done: "완료",
- cancelled: "취소됨",
- } as Record<Status, string>,
- category: { unstarted: "시작 전", started: "시작됨", done: "완료", closed: "종료" } as Record<Category, string>,
- meaning: {
- backlog: "보류. 여기로 옮겨도 에이전트가 시작되지 않습니다.",
- todo: "대기 중. 여기로 옮기면 담당 에이전트가 시작됩니다.",
- in_progress: "진행 중.",
- in_review: "전달 완료, 리뷰 대기.",
- blocked: "외부 의존성으로 중단됨.",
- done: "완료됨.",
- cancelled: "진행하지 않기로 함.",
- } as Record<Status, string>,
- note: {
- backlog: "담당자는 이미 운영 도우미지만, 태스크가 여기 있는 동안에는 시작하지 않습니다.",
- todo: "운영 도우미의 실행이 생성되었습니다.",
- in_progress: "에이전트가 작업을 시작하면서 직접 진행 중으로 바꿨습니다.",
- in_review: "실행은 끝났지만 태스크는 아직 끝나지 않았습니다. 완료 여부는 상태로 판단합니다.",
- blocked: "",
- done: "종료 상태입니다. 작업이 계획대로 끝났습니다.",
- cancelled: "종료 상태지만 완료로 보지 않습니다. 논의와 결과는 그대로 볼 수 있습니다.",
- } as Record<Status, string>,
- changed: (from: string, to: string) => `상태를 ${from}에서 ${to}로 변경했습니다`,
- queued: "대기 중",
- running: "실행 중",
- completed: "완료됨",
- steps: [
- "태스크 설명과 논의 읽기",
- "상태를 진행 중으로 변경",
- "장소 두 곳을 예산, 거리, 수용 인원으로 비교",
- "하루 일정 초안 작성",
- "상태를 리뷰 중으로 변경",
- ],
- reply: "워크숍 계획을 정리했습니다. 장소 후보 두 곳과 각각의 예산, 하루 일정입니다. 확인 부탁드립니다.",
- captions: {
- idle: "에이전트에게 할당된 채 백로그에 있는 태스크입니다.",
- backlog: "백로그는 태스크를 보류합니다. 담당자는 운영 도우미지만 시작하지 않습니다. 상태를 클릭하세요.",
- pick: "할 일로 옮기세요.",
- running: "백로그에서 나오면 담당 에이전트가 시작하고, 시작하면서 태스크를 진행 중으로 바꿉니다.",
- review: "전달이 끝나 에이전트가 리뷰 중으로 바꿨습니다. 결과를 확인한 뒤 상태를 클릭하세요.",
- finish: "계획이 괜찮으면 완료를 선택하세요. 취소됨도 태스크를 끝내지만 완료로 보지 않습니다.",
- done: "완료는 종료 상태입니다. 오른쪽 위에서 다시 시작하면 취소됨도 선택해 볼 수 있습니다.",
- cancelled: "취소됨으로 태스크는 끝났지만 완료로 세지 않습니다. 오른쪽 위에서 다시 볼 수 있습니다.",
- },
+ title: "상태 단계를 따라 태스크 진행하기",
+ chapters: ["백로그에서 이동", "진행 중 → 리뷰 중", "완료 처리"],
+ caption: "모든 상태는 생명주기 범주에 속하며, 상태 전환 내역은 활동 타임라인에 기록됩니다.",
},
fr: {
- title: "OPS-21 · Préparer la sortie d'équipe du prochain trimestre",
- statusLabel: "Statut",
- assigneeLabel: "Assigné à",
- agent: "Assistant ops",
- you: "Vous",
- status: {
- backlog: "À planifier",
- todo: "À faire",
- in_progress: "En cours",
- in_review: "En relecture",
- blocked: "Bloqué",
- done: "Terminé",
- cancelled: "Annulé",
- } as Record<Status, string>,
- category: { unstarted: "Non démarré", started: "Démarrage", done: "Terminé", closed: "Fermée" } as Record<Category, string>,
- meaning: {
- backlog: "En attente. Affecter une tâche ici ne démarre jamais un agent.",
- todo: "En file. Déplacer une tâche ici démarre l'agent qui lui est affecté.",
- in_progress: "En cours de traitement.",
- in_review: "Livré, en attente d'une relecture humaine.",
- blocked: "À l'arrêt, en attente d'une dépendance extérieure.",
- done: "Terminé.",
- cancelled: "Abandonné.",
- } as Record<Status, string>,
- note: {
- backlog: "Assistant ops est déjà assigné, mais il attend tant que la tâche reste ici.",
- todo: "Une exécution est créée pour Assistant ops.",
- in_progress: "L'agent a choisi ce statut en commençant le travail.",
- in_review: "L'exécution est terminée, pas la tâche. C'est le statut qui dit si le travail est fini.",
- blocked: "",
- done: "Statut final : le travail s'est terminé comme prévu.",
- cancelled: "Statut final, sans compter comme terminé. La discussion et les résultats restent consultables.",
- } as Record<Status, string>,
- changed: (from: string, to: string) => `a changé le statut de ${from} à ${to}`,
- queued: "En file d'attente",
- running: "En cours",
- completed: "Terminée",
- steps: [
- "Lire la description et la discussion de la tâche",
- "Passer le statut à En cours",
- "Comparer deux lieux selon le budget, la distance et la capacité",
- "Rédiger un programme sur une journée",
- "Passer le statut à En relecture",
- ],
- reply: "Le plan de la sortie est prêt : deux lieux possibles avec leur budget et un programme sur une journée. Merci de relire.",
- captions: {
- idle: "Une tâche assignée à un agent, mise de côté dans À planifier.",
- backlog: "À planifier met la tâche de côté : Assistant ops est assigné, mais ne démarre pas. Cliquez sur Statut.",
- pick: "Passez-la à À faire.",
- running: "En quittant À planifier, la tâche démarre l'agent assigné, qui la passe à En cours en commençant.",
- review: "Livré : l'agent a choisi En relecture. Vérifiez le résultat, puis cliquez sur Statut.",
- finish: "Choisissez Terminé si le plan convient. Annulé clôt aussi la tâche, mais sans la compter comme terminée.",
- done: "Terminé est un statut final. Relancez la démo pour essayer Annulé.",
- cancelled: "Annulé clôt la tâche sans la compter comme terminée. Relancez la démo pour la revoir.",
- },
+ title: "Faire avancer une tâche à travers ses statuts",
+ chapters: ["Sortir du Backlog", "En cours → Relecture", "Terminer"],
+ caption: "Chaque statut appartient à une catégorie de cycle de vie et enregistre chaque transition dans l'historique.",
},
};
-type Phase = "idle" | "backlog" | "pick" | "running" | "review" | "finish" | "done" | "cancelled";
-
-type Activity = { actor: string; agent: boolean; from: Status; to: Status };
-
-// Run step index (1-based) at which the agent updates the status.
-const STATUS_STEPS: Partial<Record<number, Status>> = { 2: "in_progress", 5: "in_review" };
-
export function IssueStatusDemo() {
const t = useDemoCopy(copy);
- const { after, clear } = useDemoTimers();
- const [frameRef, visible] = useStartWhenVisible<HTMLElement>();
- const [phase, setPhase] = useState<Exclude<Phase, "idle">>("backlog");
- const [status, setStatus] = useState<Status>("backlog");
- const [activity, setActivity] = useState<Activity[]>([]);
- const [queued, setQueued] = useState(true);
- const [stepsShown, setStepsShown] = useState(0);
-
- const shownPhase: Phase = visible ? phase : "idle";
- const menuOpen = phase === "pick" || phase === "finish";
- // The one status each open menu accepts; the finish menu offers two endings.
- const choices: Status[] = phase === "pick" ? ["todo"] : phase === "finish" ? ["done", "cancelled"] : [];
-
- const statusRef = useRef<Status>("backlog");
- const move = (to: Status, actor: string, agent: boolean) => {
- const from = statusRef.current;
- statusRef.current = to;
- setStatus(to);
- setActivity((items) => [...items, { actor, agent, from, to }]);
- };
-
- const choose = (to: Status) => {
- move(to, t.you, false);
- if (to === "todo") {
- setPhase("running");
- after(900, () => setQueued(false));
- t.steps.forEach((_, i) =>
- after(900 + i * 1000, () => {
- setStepsShown(i + 1);
- const next = STATUS_STEPS[i + 1];
- if (next) move(next, t.agent, true);
- }),
- );
- after(900 + t.steps.length * 1000 + 500, () => setPhase("review"));
- } else {
- setPhase(to === "done" ? "done" : "cancelled");
- }
- };
-
- const replay = () => {
- clear();
- setPhase("backlog");
- statusRef.current = "backlog";
- setStatus("backlog");
- setActivity([]);
- setQueued(true);
- setStepsShown(0);
- };
-
- const statusEnabled = visible && (phase === "backlog" || phase === "review" || menuOpen);
- const coachOnStatus = visible && (phase === "backlog" || phase === "review");
- const runActive = phase === "running";
- const showRun = phase !== "backlog" && phase !== "pick";
-
- return (
- <DemoFrame frameRef={frameRef} title={t.title} caption={t.captions[shownPhase]} onReplay={replay}>
- <div className="flex min-h-96 flex-col gap-3 p-4">
- <ol className="flex flex-wrap gap-2">
- {CATEGORIES.map((group) => (
- <li
- key={group.key}
- className={cn(
- "m-0 max-w-full flex-none rounded-lg border px-2 py-1.5 transition-colors",
- categoryOf(status) === group.key ? "border-brand/40 bg-brand/5" : "bg-background",
- )}
- >
- <div className="flex items-baseline gap-1.5">
- <span className="text-micro font-medium">{t.category[group.key]}</span>
- <code className="text-micro text-muted-foreground">{group.key}</code>
- </div>
- <div className="mt-1 flex flex-wrap gap-1">
- {group.statuses.map((s) => (
- <span
- key={s}
- className={cn(
- "inline-flex items-center gap-1 rounded-sm px-1 py-0.5 text-micro transition-colors",
- s === status ? "bg-foreground text-background" : "text-muted-foreground",
- )}
- >
- <span aria-hidden className={cn("size-2 rounded-full border", s === status ? "border-background" : statusDot[s])} />
- {t.status[s]}
- </span>
- ))}
- </div>
- </li>
- ))}
- </ol>
-
- <dl className="grid w-fit grid-cols-[auto_auto] items-center gap-x-6 gap-y-2 text-body">
- <dt className="text-caption text-muted-foreground">{t.statusLabel}</dt>
- <dd className="relative">
- <CoachMark
- active={coachOnStatus}
- side="right"
- ringClassName="rounded-md"
- >
- <button
- type="button"
- aria-haspopup="listbox"
- aria-expanded={menuOpen}
- disabled={!statusEnabled}
- onClick={() => {
- if (phase === "backlog") setPhase("pick");
- else if (phase === "pick") setPhase("backlog");
- else if (phase === "review") setPhase("finish");
- else if (phase === "finish") setPhase("review");
- }}
- className="-mx-1.5 inline-flex h-7 items-center gap-1.5 rounded-md px-1.5 hover:bg-muted disabled:hover:bg-transparent"
- >
- <span aria-hidden className={cn("size-3 rounded-full border-2 transition-colors", statusDot[status])} />
- <span key={status} className="motion-safe:animate-in motion-safe:fade-in">
- {t.status[status]}
- </span>
- {statusEnabled && <ChevronDown aria-hidden className="size-3.5 text-muted-foreground" />}
- </button>
- </CoachMark>
- {menuOpen && (
- <div
- role="listbox"
- aria-label={t.statusLabel}
- className="absolute top-full left-0 z-10 mt-1 w-44 rounded-lg border bg-popover p-1 text-popover-foreground shadow-md motion-safe:animate-in motion-safe:fade-in"
- >
- {MENU_ORDER.map((s) => {
- const enabled = choices.includes(s);
- return (
- <CoachMark
- quiet
- key={s}
- active={s === choices[0]}
- ringClassName="rounded-md"
- className="flex w-full"
- >
- <button
- type="button"
- role="option"
- aria-selected={s === status}
- disabled={!enabled}
- onClick={() => choose(s)}
- className="flex w-full items-center gap-2 rounded-md px-2 py-1 text-left text-body hover:bg-accent disabled:opacity-45 disabled:hover:bg-transparent"
- >
- <span aria-hidden className={cn("size-3 shrink-0 rounded-full border-2", statusDot[s])} />
- <span className="min-w-0 flex-1 truncate">{t.status[s]}</span>
- {s === status && <span className="text-caption text-muted-foreground">✓</span>}
- </button>
- </CoachMark>
- );
- })}
- </div>
- )}
- </dd>
- <dt className="text-caption text-muted-foreground">{t.assigneeLabel}</dt>
- <dd className="flex items-center gap-1.5">
- <DemoAvatar name={t.agent} agent />
- {t.agent}
- </dd>
- </dl>
-
- <div
- key={status}
- className="rounded-lg border bg-muted/40 px-3 py-2 motion-safe:animate-in motion-safe:fade-in"
- >
- <div className="flex flex-wrap items-baseline gap-x-2 text-label">
- <span className="font-medium">{t.status[status]}</span>
- <code className="text-micro text-muted-foreground">{status}</code>
- <span className="text-caption text-muted-foreground">· {t.category[categoryOf(status)]}</span>
- </div>
- <p className="mt-0.5 text-caption">{t.meaning[status]}</p>
- {t.note[status] && <p className="mt-0.5 text-caption text-muted-foreground">{t.note[status]}</p>}
- </div>
-
- {activity.length > 0 && (
- <ul className="flex flex-col gap-1">
- {activity.map((item, i) => (
- <li
- key={i}
- className="m-0 flex min-w-0 items-center gap-1.5 text-caption text-muted-foreground motion-safe:animate-in motion-safe:fade-in"
- >
- <DemoAvatar name={item.actor} agent={item.agent} />
- <span className="font-medium text-foreground">{item.actor}</span>
- <span className="min-w-0 truncate">{t.changed(t.status[item.from], t.status[item.to])}</span>
- </li>
- ))}
- </ul>
- )}
-
- {showRun && (
- <DemoRun
- agent={t.agent}
- status={runActive ? (queued ? t.queued : t.running) : t.completed}
- active={runActive}
- >
- {t.steps.slice(0, stepsShown).map((step, i) => (
- <DemoStep key={step} state={i === stepsShown - 1 && runActive ? "running" : "done"}>
- {step}
- </DemoStep>
- ))}
- </DemoRun>
- )}
-
- {(phase === "review" || phase === "finish" || phase === "done" || phase === "cancelled") && (
- <DemoComment author={t.agent} agent>
- {t.reply}
- </DemoComment>
- )}
- </div>
- </DemoFrame>
- );
+ const meta = CLIP_MANIFEST["issue-status"] ?? { duration: 6.0, chapters: [] };
+ const chapters = t.chapters.map((label, i) => ({
+ label,
+ at: meta.chapters[i]?.at ?? (i * meta.duration) / t.chapters.length,
+ }));
+ return <EditorialClip slug="issue-status" title={t.title} chapters={chapters} duration={meta.duration} caption={t.caption} />;
}
diff --git a/apps/docs/components/demos/local-dir-mode-demo.tsx b/apps/docs/components/demos/local-dir-mode-demo.tsx
index 581274d5e7..4d85e7c79d 100644
--- a/apps/docs/components/demos/local-dir-mode-demo.tsx
+++ b/apps/docs/components/demos/local-dir-mode-demo.tsx
@@ -1,556 +1,229 @@
"use client";
import { useState } from "react";
-import { Check, Clock, FileText, Folder, GitBranch, Loader2, Pencil } from "@multica/ui/icons";
-import { Button } from "@multica/ui/components/ui/button";
import { cn } from "@multica/ui/lib/utils";
-import {
- CoachMark,
- DemoAvatar,
- DemoFrame,
- DemoStep,
- useDemoCopy,
- useDemoTimers,
- useStartWhenVisible,
-} from "./demo-kit";
+import { EditorialFigure, useDemoCopy } from "./demo-kit";
-type Mode = "in_place" | "worktree";
-type RunStatus = "idle" | "waiting" | "working" | "completed";
+type Mode = "worktree" | "in_place";
-// Branch names follow server/internal/daemon/execenv/local_worktree.go:
-// agent/<sanitized agent name>/<sanitized issue identifier>. The agent segment
-// keeps only a-z and 0-9, so names without Latin letters become "agent".
const copy = {
en: {
- title: "OPS-21 and OPS-22 · Two runs on one local folder",
- path: "~/Documents/website-copy",
- agent: "Ops helper",
- issues: [
- { id: "OPS-21", title: "Update the pricing page copy", file: "pricing.md", branch: "agent/ops-helper/ops-21" },
- { id: "OPS-22", title: "Add answers to the FAQ page", file: "faq.md", branch: "agent/ops-helper/ops-22" },
- ],
- dialogTitle: "How should runs use this folder?",
- modes: {
- in_place: {
- title: "Edit this folder directly",
- description:
- "One run at a time. Changes appear in your working copy as the agent makes them, ready for you to keep working on.",
- },
- worktree: {
- title: "Run in parallel, isolated",
- description:
- "Runs execute at the same time without touching your working copy. Each one hands back an agent/… branch in this repo for you to review and merge.",
- },
- } as Record<Mode, { title: string; description: string }>,
- add: "Add folder",
- badge: { in_place: "Direct", worktree: "Parallel" } as Record<Mode, string>,
- startSecond: "Start the second run",
- status: {
- working: "Working",
- waiting: "Waiting for local directory",
- completed: "Completed",
- } as Record<Exclude<RunStatus, "idle">, string>,
- isWaiting: (name: string) => `${name} is waiting for the local directory`,
- branch: "Branch",
- steps: (file: string) => ["Read the issue and discussion", `Edit ${file}`, "Write up what changed"],
- folderLabel: "Your folder",
- noChanges: "No changes",
- modified: "Modified",
+ kicker: "EXECUTION MODE",
+ title: "Two concurrent runs on one local folder",
+ tabs: { worktree: "Parallel (worktree)", in_place: "Direct (in place)" } as Record<Mode, string>,
+ run1: "ENG-21 · Update pricing copy",
+ run2: "ENG-22 · Add FAQ answers",
+ workingCopy: "Your working copy",
+ path: "~/Projects/marketing-site",
+ untouched: "Untouched while runs execute",
+ modifiedDirectly: "Edited directly, one run at a time",
+ waiting: "Waits until ENG-21 finishes",
+ branch1: "agent/engineer/eng-21",
+ branch2: "agent/engineer/eng-22",
+ isolated: "Isolated worktree",
captions: {
- idle: "Two issues both need to edit the website copy in the same local folder.",
- choose:
- "The folder is a git repository, so Desktop preselects Parallel. To see Direct, pick it first; then click Add folder.",
- starting: "Ops helper starts working on OPS-21.",
- ready: "OPS-21 is still running. Click Start the second run so OPS-22 uses the same folder too.",
- waiting: "Direct runs one at a time: OPS-22 waits for the local directory and leaves the folder alone.",
- handoff: "OPS-21 finished and released the folder, so OPS-22 starts now.",
- parallel: "In Parallel mode both runs go at once, each in its own worktree. Your folder stays as it was.",
- doneInPlace: "The runs took turns, and their edits landed straight in your folder. Use Replay to try Parallel.",
- doneWorktree:
- "Each run handed back an agent/… branch and your folder is unchanged. Review the branches, then decide what to merge. Use Replay to try Direct.",
+ worktree: "In Parallel mode, each run gets its own git worktree and returns an `agent/...` branch for review. Your working copy stays untouched.",
+ in_place: "In Direct mode, runs execute one at a time straight inside your folder. ENG-22 waits for the directory lock until ENG-21 finishes.",
},
},
zh: {
- title: "OPS-21 和 OPS-22 · 同一个本地文件夹上的两次运行",
- path: "~/Documents/website-copy",
- agent: "运营助手",
- issues: [
- { id: "OPS-21", title: "更新价格页文案", file: "pricing.md", branch: "agent/agent/ops-21" },
- { id: "OPS-22", title: "补充常见问题", file: "faq.md", branch: "agent/agent/ops-22" },
- ],
- dialogTitle: "每次运行如何使用这个文件夹?",
- modes: {
- in_place: {
- title: "直接修改这个文件夹",
- description: "同一时间只处理一次运行。智能体的改动会直接出现在你的工作区里,你可以接着改。",
- },
- worktree: {
- title: "并行隔离运行",
- description:
- "运行可以并行,互不干扰,也不会改动你的工作区。每次运行的结果都是这个仓库里的一个 agent/… 分支,由你 review 后合并。",
- },
- } as Record<Mode, { title: string; description: string }>,
- add: "添加文件夹",
- badge: { in_place: "原地", worktree: "并行" } as Record<Mode, string>,
- startSecond: "开始第二次运行",
- status: {
- working: "正在工作",
- waiting: "等待本地目录释放",
- completed: "已完成",
- } as Record<Exclude<RunStatus, "idle">, string>,
- isWaiting: (name: string) => `${name} 正在等待本地目录`,
- branch: "分支",
- steps: (file: string) => ["读取任务和讨论", `修改 ${file}`, "整理改动说明"],
- folderLabel: "你的文件夹",
- noChanges: "没有改动",
- modified: "已修改",
+ kicker: "执行模式",
+ title: "两条并发运行如何共用同一个本地目录",
+ tabs: { worktree: "并行隔离(worktree)", in_place: "原地修改(Direct)" } as Record<Mode, string>,
+ run1: "ENG-21 · 更新价格页文案",
+ run2: "ENG-22 · 补充常见问题",
+ workingCopy: "你的本地工作目录",
+ path: "~/Projects/marketing-site",
+ untouched: "执行期间保持原样不被改动",
+ modifiedDirectly: "直接修改当前目录,同一时间仅一条运行",
+ waiting: "等待 ENG-21 释放目录锁",
+ branch1: "agent/engineer/eng-21",
+ branch2: "agent/engineer/eng-22",
+ isolated: "独立 worktree",
captions: {
- idle: "两条任务都要修改同一个本地文件夹里的官网文案。",
- choose: `这个文件夹是 git 仓库,Desktop 预选了"并行"。想看"原地"就先点它,再点"添加文件夹"。`,
- starting: "运营助手开始处理 OPS-21。",
- ready: `OPS-21 还没做完。点"开始第二次运行",让 OPS-22 也用这个文件夹。`,
- waiting: `"原地"同一时间只进行一次运行:OPS-22 进入"等待本地目录释放",不会动文件夹。`,
- handoff: "OPS-21 结束并释放了文件夹,OPS-22 接着开始。",
- parallel: `"并行"模式下两次运行同时进行,各自在单独的 worktree 里工作,你的文件夹保持原样。`,
- doneInPlace: `两次运行轮流完成,改动直接写进了你的文件夹。点右上角可以换"并行"再试。`,
- doneWorktree: `每次运行交回一个 agent/… 分支,你的文件夹没有改动。看过分支后由你决定合并哪些。点右上角可以换"原地"再试。`,
+ worktree: "并行隔离模式下,每条运行各自在独立的 git worktree 中执行并交回 agent/… 分支,完全不碰你当前的工作目录。",
+ in_place: "原地修改模式下,同一时间只允许一条运行直接改动目录;ENG-22 会等待 ENG-21 结束后再接力执行。",
+ },
+ },
+ "zh-Hant": {
+ kicker: "執行模式",
+ title: "兩條並行執行如何共用同一個本機目錄",
+ tabs: { worktree: "並行隔離(worktree)", in_place: "原地修改(Direct)" } as Record<Mode, string>,
+ run1: "ENG-21 · 更新定價頁文案",
+ run2: "ENG-22 · 補充常見問題",
+ workingCopy: "你的本機工作目錄",
+ path: "~/Projects/marketing-site",
+ untouched: "執行期間保持原樣不被改動",
+ modifiedDirectly: "直接修改目前目錄,一次僅一條執行",
+ waiting: "等待 ENG-21 釋放目錄鎖",
+ branch1: "agent/engineer/eng-21",
+ branch2: "agent/engineer/eng-22",
+ isolated: "獨立 worktree",
+ captions: {
+ worktree: "並行隔離模式下,每條執行各自在獨立 git worktree 中進行並交回 agent/… 分支,不會動到你的工作目錄。",
+ in_place: "原地修改模式下,同一時間僅一條執行直接修改目錄;ENG-22 會等待 ENG-21 結束後再開始。",
},
},
ja: {
- title: "OPS-21 と OPS-22 · 同じローカルフォルダでの 2 つの実行",
- path: "~/Documents/website-copy",
- agent: "運用アシスタント",
- issues: [
- { id: "OPS-21", title: "料金ページの文言を更新", file: "pricing.md", branch: "agent/agent/ops-21" },
- { id: "OPS-22", title: "よくある質問を追加", file: "faq.md", branch: "agent/agent/ops-22" },
- ],
- dialogTitle: "実行はこのフォルダをどう使いますか?",
- modes: {
- in_place: {
- title: "このフォルダを直接編集する",
- description: "実行は一度に1つずつ。エージェントの変更はそのまま作業コピーに現れ、続けて作業できます。",
- },
- worktree: {
- title: "隔離して並行実行する",
- description:
- "実行は、作業コピーに触れずに並行して進みます。それぞれがこのリポジトリの agent/… ブランチを返すので、レビューしてマージします。",
- },
- } as Record<Mode, { title: string; description: string }>,
- add: "フォルダを追加",
- badge: { in_place: "直接", worktree: "並行" } as Record<Mode, string>,
- startSecond: "2 回目の実行を開始",
- status: {
- working: "作業中",
- waiting: "ローカルディレクトリ待機中",
- completed: "完了",
- } as Record<Exclude<RunStatus, "idle">, string>,
- isWaiting: (name: string) => `${name} がローカルディレクトリを待機中`,
- branch: "ブランチ",
- steps: (file: string) => ["タスクの説明とコメントを読む", `${file} を編集`, "変更内容をまとめる"],
- folderLabel: "あなたのフォルダ",
- noChanges: "変更なし",
- modified: "変更あり",
+ kicker: "EXECUTION MODE",
+ title: "同じローカルフォルダでの 2 つの同時実行",
+ tabs: { worktree: "並列・分離 (worktree)", in_place: "直接編集 (Direct)" } as Record<Mode, string>,
+ run1: "ENG-21 · 価格ページを更新",
+ run2: "ENG-22 · FAQ を追記",
+ workingCopy: "あなたの作業フォルダ",
+ path: "~/Projects/marketing-site",
+ untouched: "実行中も変更されない",
+ modifiedDirectly: "フォルダを直接編集(1 件ずつ順番に実行)",
+ waiting: "ENG-21 の完了待ち",
+ branch1: "agent/engineer/eng-21",
+ branch2: "agent/engineer/eng-22",
+ isolated: "独立 worktree",
captions: {
- idle: "2 つのタスクが、同じローカルフォルダにある Web サイトの文言を編集します。",
- choose:
- "このフォルダは git リポジトリなので、Desktop は「並行」を選んだ状態で開きます。「直接」を見たい場合は先にそれを選び、「フォルダを追加」をクリックします。",
- starting: "運用アシスタントが OPS-21 の作業を始めます。",
- ready: "OPS-21 はまだ作業中です。「2 回目の実行を開始」をクリックして、OPS-22 にも同じフォルダを使わせます。",
- waiting: "「直接」では実行は一度に 1 つです。OPS-22 はローカルディレクトリ待ちになり、フォルダには触れません。",
- handoff: "OPS-21 が終わってフォルダを解放したので、OPS-22 が始まります。",
- parallel: "「並行」では 2 つの実行が同時に進み、それぞれ専用のワークツリーで作業します。フォルダはそのままです。",
- doneInPlace: "2 つの実行が順番に終わり、変更はフォルダに直接書き込まれました。「もう一度」で「並行」も試せます。",
- doneWorktree:
- "それぞれの実行が agent/… ブランチを返し、フォルダは変わっていません。ブランチを確認してから、何をマージするか決めます。「もう一度」で「直接」も試せます。",
+ worktree: "並列モードでは各実行が独立した git worktree で進み、agent/... ブランチを返します。元のフォルダはそのままです。",
+ in_place: "直接モードでは 1 件ずつ順番にフォルダへ直接書き込みます。ENG-22 は ENG-21 の完了を待ちます。",
},
},
ko: {
- title: "OPS-21과 OPS-22 · 같은 로컬 폴더에서 두 번 실행",
- path: "~/Documents/website-copy",
- agent: "운영 도우미",
- issues: [
- { id: "OPS-21", title: "요금 페이지 문구 업데이트", file: "pricing.md", branch: "agent/agent/ops-21" },
- { id: "OPS-22", title: "자주 묻는 질문 보충", file: "faq.md", branch: "agent/agent/ops-22" },
- ],
- dialogTitle: "실행이 이 폴더를 어떻게 사용할까요?",
- modes: {
- in_place: {
- title: "이 폴더를 직접 수정",
- description:
- "한 번에 하나의 실행만 진행됩니다. 에이전트의 변경 사항이 작업 사본에 바로 나타나므로 이어서 작업할 수 있습니다.",
- },
- worktree: {
- title: "격리해서 병렬 실행",
- description:
- "실행이 작업 사본을 건드리지 않고 동시에 진행됩니다. 각 실행은 이 저장소의 agent/… 브랜치를 돌려주며, 검토 후 병합하면 됩니다.",
- },
- } as Record<Mode, { title: string; description: string }>,
- add: "폴더 추가",
- badge: { in_place: "직접", worktree: "병렬" } as Record<Mode, string>,
- startSecond: "두 번째 실행 시작",
- status: {
- working: "작업 중",
- waiting: "로컬 디렉터리 대기 중",
- completed: "완료됨",
- } as Record<Exclude<RunStatus, "idle">, string>,
- isWaiting: (name: string) => `${name} 로컬 디렉터리 대기 중`,
- branch: "브랜치",
- steps: (file: string) => ["태스크 설명과 댓글 읽기", `${file} 수정`, "변경 내용 정리"],
- folderLabel: "내 폴더",
- noChanges: "변경 없음",
- modified: "수정됨",
+ kicker: "EXECUTION MODE",
+ title: "하나의 로컬 폴더에서 두 실행이 동작하는 방식",
+ tabs: { worktree: "병렬 격리 (worktree)", in_place: "직접 수정 (Direct)" } as Record<Mode, string>,
+ run1: "ENG-21 · 가격 페이지 문구 수정",
+ run2: "ENG-22 · FAQ 답변 추가",
+ workingCopy: "내 작업 폴더",
+ path: "~/Projects/marketing-site",
+ untouched: "실행 중에도 변경되지 않음",
+ modifiedDirectly: "폴더를 직접 수정 (한 번에 하나씩 실행)",
+ waiting: "ENG-21 완료 대기",
+ branch1: "agent/engineer/eng-21",
+ branch2: "agent/engineer/eng-22",
+ isolated: "독립 worktree",
captions: {
- idle: "두 태스크가 같은 로컬 폴더에 있는 웹사이트 문구를 수정해야 합니다.",
- choose:
- "이 폴더는 git 저장소라서 Desktop이 '병렬'을 미리 선택합니다. '직접'을 보려면 먼저 그것을 고른 뒤 '폴더 추가'를 클릭하세요.",
- starting: "운영 도우미가 OPS-21 작업을 시작합니다.",
- ready: "OPS-21이 아직 진행 중입니다. '두 번째 실행 시작'을 클릭해 OPS-22도 같은 폴더를 쓰게 하세요.",
- waiting: "'직접' 모드에서는 한 번에 하나만 실행됩니다. OPS-22는 로컬 디렉터리를 기다리며 폴더를 건드리지 않습니다.",
- handoff: "OPS-21이 끝나 폴더를 놓아주자 OPS-22가 시작됩니다.",
- parallel: "'병렬' 모드에서는 두 실행이 동시에 진행되고, 각자 별도의 워크트리에서 작업합니다. 폴더는 그대로입니다.",
- doneInPlace: "두 실행이 차례로 끝났고, 변경 사항은 폴더에 바로 기록되었습니다. '다시 보기'로 '병렬'도 해 보세요.",
- doneWorktree:
- "각 실행이 agent/… 브랜치를 돌려주었고 폴더는 바뀌지 않았습니다. 브랜치를 검토한 뒤 무엇을 병합할지 정하세요. '다시 보기'로 '직접'도 해 보세요.",
+ worktree: "병렬 모드에서는 각 실행이 독립 git worktree에서 동시에 진행되며 agent/... 브랜치를 반환합니다.",
+ in_place: "직접 모드에서는 한 번에 한 실행만 폴더를 수정하며, 두 번째 실행은 잠금이 풀릴 때까지 대기합니다.",
},
},
fr: {
- title: "OPS-21 et OPS-22 · Deux exécutions sur un même dossier local",
- path: "~/Documents/website-copy",
- agent: "Assistant ops",
- issues: [
- { id: "OPS-21", title: "Mettre à jour la page des tarifs", file: "pricing.md", branch: "agent/assistant-ops/ops-21" },
- { id: "OPS-22", title: "Compléter la FAQ", file: "faq.md", branch: "agent/assistant-ops/ops-22" },
- ],
- dialogTitle: "Comment les exécutions doivent-elles utiliser ce dossier ?",
- modes: {
- in_place: {
- title: "Modifier ce dossier directement",
- description:
- "Une exécution à la fois. Les modifications apparaissent dans votre copie de travail au fur et à mesure, prêtes à être reprises.",
- },
- worktree: {
- title: "Exécuter en parallèle, en isolation",
- description:
- "Les exécutions ont lieu simultanément sans toucher à votre copie de travail. Chacune restitue une branche agent/… dans ce dépôt pour relecture et fusion.",
- },
- } as Record<Mode, { title: string; description: string }>,
- add: "Ajouter le dossier",
- badge: { in_place: "Direct", worktree: "Parallèle" } as Record<Mode, string>,
- startSecond: "Lancer la deuxième exécution",
- status: {
- working: "Au travail",
- waiting: "En attente du répertoire local",
- completed: "Terminée",
- } as Record<Exclude<RunStatus, "idle">, string>,
- isWaiting: (name: string) => `${name} attend le répertoire local`,
- branch: "Branche",
- steps: (file: string) => ["Lire la tâche et la discussion", `Modifier ${file}`, "Résumer les modifications"],
- folderLabel: "Votre dossier",
- noChanges: "Aucune modification",
- modified: "Modifié",
+ kicker: "MODE D'EXÉCUTION",
+ title: "Deux exécutions concurrentes sur un même dossier local",
+ tabs: { worktree: "Parallèle (worktree)", in_place: "Direct (sur place)" } as Record<Mode, string>,
+ run1: "ENG-21 · Mettre à jour les tarifs",
+ run2: "ENG-22 · Compléter la FAQ",
+ workingCopy: "Votre copie de travail",
+ path: "~/Projects/marketing-site",
+ untouched: "Intacte pendant les exécutions",
+ modifiedDirectly: "Modifiée directement, une exécution à la fois",
+ waiting: "Attend la fin de ENG-21",
+ branch1: "agent/engineer/eng-21",
+ branch2: "agent/engineer/eng-22",
+ isolated: "Worktree isolé",
captions: {
- idle: "Deux tâches doivent modifier les textes du site, dans le même dossier local.",
- choose:
- "Ce dossier est un dépôt git, donc Desktop présélectionne Parallèle. Pour voir Direct, choisissez-le d'abord, puis cliquez sur Ajouter le dossier.",
- starting: "Assistant ops commence à travailler sur OPS-21.",
- ready:
- "OPS-21 est toujours en cours. Cliquez sur Lancer la deuxième exécution pour qu'OPS-22 utilise aussi ce dossier.",
- waiting:
- "En mode Direct, une seule exécution à la fois : OPS-22 attend le répertoire local et ne touche pas au dossier.",
- handoff: "OPS-21 est terminée et a libéré le dossier : OPS-22 démarre.",
- parallel:
- "En mode Parallèle, les deux exécutions avancent en même temps, chacune dans son propre worktree. Votre dossier reste tel quel.",
- doneInPlace:
- "Les exécutions se sont succédé et leurs modifications sont écrites directement dans votre dossier. Utilisez Rejouer pour essayer Parallèle.",
- doneWorktree:
- "Chaque exécution a restitué une branche agent/… et votre dossier n'a pas changé. Relisez les branches, puis décidez quoi fusionner. Utilisez Rejouer pour essayer Direct.",
+ worktree: "En mode Parallèle, chaque exécution utilise son propre worktree git et rend une branche agent/... sans toucher votre dossier.",
+ in_place: "En mode Direct, les exécutions passent une par une directement dans votre dossier.",
},
},
};
-type Phase =
- | "idle"
- | "choose"
- | "starting"
- | "ready"
- | "waiting"
- | "handoff"
- | "parallel"
- | "doneInPlace"
- | "doneWorktree";
-
-type Run = { status: RunStatus; steps: number };
-
-const IDLE_RUN: Run = { status: "idle", steps: 0 };
-
export function LocalDirModeDemo() {
const t = useDemoCopy(copy);
- const { after, clear } = useDemoTimers();
- const [frameRef, visible] = useStartWhenVisible<HTMLElement>();
- const [phase, setPhase] = useState<Phase>("choose");
- // A git folder on a runtime that can isolate runs opens on worktree.
const [mode, setMode] = useState<Mode>("worktree");
- const [runs, setRuns] = useState<[Run, Run]>([IDLE_RUN, IDLE_RUN]);
- const [touched, setTouched] = useState<[boolean, boolean]>([false, false]);
-
- const shownPhase: Phase = visible ? phase : "idle";
- const saved = phase !== "choose";
-
- const patchRun = (index: 0 | 1, patch: Partial<Run>) =>
- setRuns((current) => {
- const next: [Run, Run] = [current[0], current[1]];
- next[index] = { ...next[index], ...patch };
- return next;
- });
-
- // In place, the agent's edits show up in the folder while it works.
- const markTouched = (index: 0 | 1) =>
- setTouched((current) => {
- const next: [boolean, boolean] = [current[0], current[1]];
- next[index] = true;
- return next;
- });
-
- const add = () => {
- setPhase("starting");
- patchRun(0, { status: "working", steps: 1 });
- after(900, () => patchRun(0, { steps: 2 }));
- if (mode === "in_place") after(1200, () => markTouched(0));
- after(1600, () => setPhase("ready"));
- };
-
- // Runs one issue's remaining steps starting at `start` ms, then completes it.
- const play = (index: 0 | 1, start: number, fromStep: number) => {
- const total = t.steps("").length;
- for (let step = fromStep; step <= total; step++) {
- after(start + (step - fromStep) * 1000, () => {
- patchRun(index, { status: "working", steps: step });
- if (step === 2 && mode === "in_place") after(300, () => markTouched(index));
- });
- }
- const end = start + (total - fromStep + 1) * 1000;
- after(end, () => patchRun(index, { status: "completed" }));
- return end;
- };
-
- const startSecond = () => {
- if (mode === "in_place") {
- setPhase("waiting");
- patchRun(1, { status: "waiting" });
- const firstDone = play(0, 1200, 3);
- after(firstDone + 600, () => setPhase("handoff"));
- const secondDone = play(1, firstDone + 600, 1);
- after(secondDone + 400, () => setPhase("doneInPlace"));
- } else {
- setPhase("parallel");
- patchRun(1, { status: "working", steps: 1 });
- const firstDone = play(0, 1200, 3);
- const secondDone = play(1, 1000, 2);
- after(Math.max(firstDone, secondDone) + 400, () => setPhase("doneWorktree"));
- }
- };
-
- const replay = () => {
- clear();
- setPhase("choose");
- setMode("worktree");
- setRuns([IDLE_RUN, IDLE_RUN]);
- setTouched([false, false]);
- };
+ const parallel = mode === "worktree";
return (
- <DemoFrame frameRef={frameRef} title={t.title} caption={t.captions[shownPhase]} onReplay={replay}>
- <div className="flex min-h-80 flex-col gap-3 p-4">
- {!saved ? (
- <div className="rounded-xl border bg-popover p-4 text-popover-foreground shadow-sm motion-safe:animate-in motion-safe:fade-in">
- <div className="text-title-sm font-medium">{t.dialogTitle}</div>
- <div className="mt-2 rounded-md bg-muted px-2.5 py-1.5 font-mono text-micro break-all text-muted-foreground">
- {t.path}
- </div>
- <div role="radiogroup" aria-label={t.dialogTitle} className="mt-3 flex flex-col gap-2">
- {(["in_place", "worktree"] as Mode[]).map((option) => {
- const selected = mode === option;
- const Icon = option === "in_place" ? Pencil : GitBranch;
- return (
- <button
- key={option}
- type="button"
- role="radio"
- aria-checked={selected}
- disabled={!visible}
- onClick={() => setMode(option)}
- className={cn(
- "flex w-full items-start gap-3 rounded-lg border p-3 text-left transition-colors outline-none focus-visible:ring-3 focus-visible:ring-ring/50",
- selected ? "border-primary ring-1 ring-primary" : "border-border hover:bg-muted/50",
- )}
- >
- <Icon
- aria-hidden
- className={cn("mt-0.5 size-4 shrink-0", selected ? "text-primary" : "text-muted-foreground")}
- />
- <span className="min-w-0 flex-1">
- <span className="flex flex-wrap items-center gap-x-2">
- <span className="text-body font-medium">{t.modes[option].title}</span>
- <span className="font-mono text-micro text-muted-foreground">{option}</span>
- </span>
- <span className="mt-0.5 block text-caption text-muted-foreground">
- {t.modes[option].description}
- </span>
- </span>
- </button>
- );
- })}
- </div>
- <div className="mt-3 flex justify-end">
- <CoachMark active={shownPhase === "choose"} side="left" ringClassName="rounded-lg">
- <Button type="button" size="sm" disabled={!visible} onClick={add}>
- {t.add}
- </Button>
- </CoachMark>
- </div>
- </div>
+ <EditorialFigure
+ kicker={t.kicker}
+ title={t.title}
+ actions={
+ <div className="flex items-center gap-3" role="tablist" aria-label={t.title}>
+ {(["worktree", "in_place"] as Mode[]).map((m) => (
+ <button
+ key={m}
+ type="button"
+ role="tab"
+ aria-selected={mode === m}
+ onClick={() => setMode(m)}
+ className={cn(
+ "border-b-[1.5px] pb-1 text-[0.75rem] transition-colors",
+ mode === m
+ ? "border-[var(--primary)] font-medium text-foreground"
+ : "border-transparent text-muted-foreground hover:text-foreground",
+ )}
+ >
+ {t.tabs[m]}
+ </button>
+ ))}
+ </div>
+ }
+ caption={t.captions[mode]}
+ >
+ <svg viewBox="0 0 640 206" className="block h-auto w-full select-none" role="img" aria-label={t.title}>
+ <defs>
+ <marker id="ld-hi" viewBox="0 0 8 8" refX="7" refY="4" markerWidth="6" markerHeight="6" orient="auto">
+ <path d="M0 1 L7 4 L0 7" fill="none" stroke="var(--primary)" strokeWidth="1.4" strokeLinecap="round" strokeLinejoin="round" />
+ </marker>
+ <marker id="ld-lo" viewBox="0 0 8 8" refX="7" refY="4" markerWidth="5.5" markerHeight="5.5" orient="auto">
+ <path d="M0 1 L7 4 L0 7" fill="none" stroke="var(--docs-faint)" strokeWidth="1.3" strokeLinecap="round" strokeLinejoin="round" />
+ </marker>
+ </defs>
+
+ {/* Left: Two Runs */}
+ <rect x="14" y="24" width="208" height="58" rx="4" fill="var(--accent)" stroke="var(--primary)" strokeWidth="1.5" />
+ <text x="26" y="47" fill="var(--foreground)" fontSize="12" fontWeight="600">{t.run1}</text>
+ <text x="26" y="66" fill="var(--primary)" fontFamily="var(--font-mono)" fontSize="10">{parallel ? "RUN #1 · ACTIVE" : "RUN #1 · HOLDS LOCK"}</text>
+
+ <rect
+ x="14"
+ y="108"
+ width="208"
+ height="58"
+ rx="4"
+ fill={parallel ? "var(--accent)" : "var(--card)"}
+ stroke={parallel ? "var(--primary)" : "var(--border)"}
+ strokeWidth={parallel ? 1.5 : 1}
+ />
+ <text x="26" y="131" fill="var(--foreground)" fontSize="12" fontWeight="600">{t.run2}</text>
+ <text x="26" y="150" fill={parallel ? "var(--primary)" : "var(--muted-foreground)"} fontFamily="var(--font-mono)" fontSize="10">
+ {parallel ? "RUN #2 · ACTIVE" : t.waiting}
+ </text>
+
+ {parallel ? (
+ <>
+ {/* Parallel connectors to two worktrees */}
+ <path d="M222 53 H308" fill="none" stroke="var(--primary)" strokeWidth="1.6" markerEnd="url(#ld-hi)" />
+ <path d="M222 137 H308" fill="none" stroke="var(--primary)" strokeWidth="1.6" markerEnd="url(#ld-hi)" />
+
+ {/* Two isolated worktree boxes */}
+ <rect x="310" y="24" width="164" height="58" rx="4" fill="var(--card)" stroke="var(--primary)" />
+ <text x="322" y="45" fill="var(--muted-foreground)" fontSize="10">{t.isolated}</text>
+ <text x="322" y="65" fill="var(--foreground)" fontFamily="var(--font-mono)" fontSize="10.5">{t.branch1}</text>
+
+ <rect x="310" y="108" width="164" height="58" rx="4" fill="var(--card)" stroke="var(--primary)" />
+ <text x="322" y="129" fill="var(--muted-foreground)" fontSize="10">{t.isolated}</text>
+ <text x="322" y="149" fill="var(--foreground)" fontFamily="var(--font-mono)" fontSize="10.5">{t.branch2}</text>
+
+ {/* Right: Untouched Working Copy */}
+ <rect x="494" y="24" width="132" height="142" rx="5" fill="var(--background)" stroke="var(--border)" strokeDasharray="4 3" />
+ <text x="506" y="54" fill="var(--foreground)" fontSize="12" fontWeight="600">{t.workingCopy}</text>
+ <text x="506" y="74" fill="var(--muted-foreground)" fontFamily="var(--font-mono)" fontSize="9.5">{t.path}</text>
+ <text x="506" y="120" fill="var(--success)" fontSize="11" fontWeight="500">✓ {t.untouched}</text>
+ </>
) : (
<>
- <div className="flex min-w-0 items-center gap-2 rounded-lg border bg-background px-3 py-2 motion-safe:animate-in motion-safe:fade-in">
- <Folder aria-hidden className="size-4 shrink-0 text-muted-foreground" />
- <span className="min-w-0 flex-1 truncate font-mono text-caption">{t.path}</span>
- <span className="inline-flex shrink-0 items-center gap-1 rounded-sm bg-muted px-1.5 py-0.5 text-micro text-muted-foreground">
- {mode === "worktree" ? (
- <GitBranch aria-hidden className="size-3" />
- ) : (
- <Pencil aria-hidden className="size-3" />
- )}
- {t.badge[mode]}
- </span>
- </div>
-
- <div className="grid gap-3 sm:grid-cols-2">
- {t.issues.map((issue, i) => {
- const run = runs[i]!;
- return (
- <div key={issue.id} className="flex min-w-0 flex-col gap-1.5 rounded-lg border bg-background p-3">
- <div className="min-w-0 truncate text-label">
- <span className="text-muted-foreground">{issue.id}</span> {issue.title}
- </div>
- {run.status === "idle" ? (
- <div className="flex min-h-7 items-center">
- <CoachMark active={shownPhase === "ready"} side="right" ringClassName="rounded-lg">
- <Button
- type="button"
- size="sm"
- variant="outline"
- disabled={phase !== "ready"}
- onClick={startSecond}
- >
- {t.startSecond}
- </Button>
- </CoachMark>
- </div>
- ) : (
- <RunLane
- agent={t.agent}
- run={run}
- statusLabel={t.status[run.status]}
- waitingLine={t.isWaiting(t.agent)}
- steps={t.steps(issue.file)}
- branch={mode === "worktree" && run.status === "completed" ? issue.branch : null}
- branchLabel={t.branch}
- />
- )}
- </div>
- );
- })}
- </div>
-
- <div className="rounded-lg border border-dashed px-3 py-2">
- <div className="text-micro text-muted-foreground">{t.folderLabel}</div>
- {touched.some(Boolean) ? (
- <ul className="m-0 mt-1 flex list-none flex-col gap-0.5 p-0">
- {t.issues
- .filter((_, i) => touched[i])
- .map((issue) => (
- <li
- key={issue.file}
- className="m-0 flex items-center gap-1.5 text-caption motion-safe:animate-in motion-safe:fade-in"
- >
- <FileText aria-hidden className="size-3.5 shrink-0 text-muted-foreground" />
- <span className="font-mono">{issue.file}</span>
- <span className="text-warning">{t.modified}</span>
- </li>
- ))}
- </ul>
- ) : (
- <div className="mt-1 flex items-center gap-1.5 text-caption text-muted-foreground">
- <Check aria-hidden className="size-3.5 shrink-0 text-success" />
- {t.noChanges}
- </div>
- )}
- </div>
+ {/* Direct serialized connectors into single working copy */}
+ <path d="M222 53 H338 V78 H366" fill="none" stroke="var(--primary)" strokeWidth="1.6" markerEnd="url(#ld-hi)" />
+ <path d="M222 137 H338 V114 H366" fill="none" stroke="var(--docs-faint)" strokeWidth="1.3" strokeDasharray="4 3" markerEnd="url(#ld-lo)" />
+
+ {/* Single Working Copy box */}
+ <rect x="368" y="34" width="258" height="124" rx="5" fill="var(--accent)" stroke="var(--primary)" strokeWidth="1.5" />
+ <text x="384" y="64" fill="var(--foreground)" fontSize="13" fontWeight="600">{t.workingCopy}</text>
+ <text x="384" y="85" fill="var(--primary)" fontFamily="var(--font-mono)" fontSize="11">{t.path}</text>
+ <text x="384" y="124" fill="var(--muted-foreground)" fontSize="11.5">{t.modifiedDirectly}</text>
</>
)}
- </div>
- </DemoFrame>
- );
-}
-function RunLane({
- agent,
- run,
- statusLabel,
- waitingLine,
- steps,
- branch,
- branchLabel,
-}: {
- agent: string;
- run: Run;
- statusLabel: string;
- waitingLine: string;
- steps: string[];
- branch: string | null;
- branchLabel: string;
-}) {
- const active = run.status === "working";
- return (
- <div className="min-w-0 motion-safe:animate-in motion-safe:fade-in">
- <div className="flex min-h-7 flex-wrap items-center gap-x-2 gap-y-0.5">
- <DemoAvatar name={agent} agent />
- <span className="truncate text-body font-medium">{agent}</span>
- <span
- key={run.status}
- className={cn(
- "inline-flex items-center gap-1 text-caption motion-safe:animate-in motion-safe:fade-in",
- run.status === "waiting" ? "text-warning" : "text-muted-foreground",
- )}
- >
- {run.status === "waiting" ? (
- <Clock aria-hidden className="size-3" />
- ) : active ? (
- <Loader2 aria-hidden className="size-3 text-brand motion-safe:animate-spin" />
- ) : (
- <Check aria-hidden className="size-3 text-success" />
- )}
- {statusLabel}
- </span>
- </div>
- {run.status === "waiting" ? (
- <p className="mt-1 pl-7 text-caption text-muted-foreground">{waitingLine}</p>
- ) : (
- <ul className="mt-1 flex flex-col gap-0.5 pl-7">
- {steps.slice(0, run.steps).map((step, i) => (
- <DemoStep key={step} state={i === run.steps - 1 && active ? "running" : "done"}>
- {step}
- </DemoStep>
- ))}
- </ul>
- )}
- {branch && (
- <div className="mt-1.5 flex min-w-0 items-center gap-1.5 pl-7 text-caption motion-safe:animate-in motion-safe:fade-in">
- <GitBranch aria-hidden className="size-3.5 shrink-0 text-brand" />
- <span className="text-muted-foreground">{branchLabel}</span>
- <code className="min-w-0 truncate rounded-xs bg-muted px-1 font-mono text-micro">{branch}</code>
- </div>
- )}
- </div>
+ <text x="14" y="194" fill="var(--muted-foreground)" fontFamily="var(--font-mono)" fontSize="10">
+ {t.path}
+ </text>
+ </svg>
+ </EditorialFigure>
);
}
diff --git a/apps/docs/components/demos/mention-demo.tsx b/apps/docs/components/demos/mention-demo.tsx
index 1fb8b34d44..8752839969 100644
--- a/apps/docs/components/demos/mention-demo.tsx
+++ b/apps/docs/components/demos/mention-demo.tsx
@@ -1,328 +1,47 @@
"use client";
-import { useState } from "react";
-import {
- CoachMark,
- DemoAvatar,
- DemoComment,
- DemoFrame,
- DemoRun,
- DemoSendButton,
- DemoStep,
- useDemoCopy,
- useDemoTimers,
- useStartWhenVisible,
-} from "./demo-kit";
-
-type Candidate = { name: string; agent: boolean };
+import { CLIP_MANIFEST } from "./clip-manifest";
+import { EditorialClip, useDemoCopy } from "./demo-kit";
const copy = {
en: {
- title: "OPS-15 · Prepare next week's customer training",
- assigneeLabel: "Assignee",
- assignee: "Lei Li",
- you: "You",
- draft: "The invitation email for the training isn't written yet. ",
- agentsGroup: "Agents",
- membersGroup: "Members",
- candidates: [
- { name: "Writing helper", agent: true },
- { name: "Ops helper", agent: true },
- { name: "Lei Li", agent: false },
- ] as Candidate[],
- memberNote: "Notify only",
- mention: "@ Mention",
- willStart: "Starts when sent",
- send: "Send",
- running: "Running",
- completed: "Completed",
- steps: [
- "Read this comment and the issue description",
- "Check the training date and agenda",
- "Draft the invitation email",
- ],
- reply: "The invitation draft is ready, with the date, the agenda and the sign-up link. Edit it as you like.",
- captions: {
- idle: "A member is the assignee. Ask an agent for help without changing that.",
- type: "The comment is written. Click @ Mention to bring in an agent.",
- pick: "Pick an agent. Mentioning a member only notifies them, so members can't be picked here.",
- preview: "The preview under the composer shows who starts when you send. Click send.",
- running: "The agent works on this comment. The assignee is still Lei Li.",
- done: "Done. The assignee never changed. Use Replay to try again.",
- },
+ title: "@mention an agent in a comment",
+ chapters: ["Type @mention", "Trigger preview", "Agent replies"],
+ caption: "The trigger preview under the composer shows who starts when sent; the issue's assignee stays unchanged.",
},
zh: {
- title: "OPS-15 · 准备下周的客户培训",
- assigneeLabel: "负责人",
- assignee: "李雷",
- you: "你",
- draft: "培训的邀请邮件还没写,",
- agentsGroup: "智能体",
- membersGroup: "成员",
- candidates: [
- { name: "文案助手", agent: true },
- { name: "运营助手", agent: true },
- { name: "李雷", agent: false },
- ] as Candidate[],
- memberNote: "仅通知",
- mention: "@ 提及",
- willStart: "发送后开始",
- send: "发送",
- running: "运行中",
- completed: "已完成",
- steps: ["读取这条评论和任务描述", "查看培训时间和议程", "起草邀请邮件"],
- reply: "邀请邮件草稿已写好,包含时间、议程和报名链接,你可以直接修改。",
- captions: {
- idle: "这条任务的负责人是成员。不改变负责人,也能请智能体帮忙。",
- type: "评论已经写好。点击\"@ 提及\",请一个智能体来处理。",
- pick: "选择一个智能体。提及成员只会通知对方,所以这里不能选成员。",
- preview: "评论框下方的触发预览列出发送后会开始工作的智能体。点击发送。",
- running: "智能体处理这条评论,负责人仍然是 李雷。",
- done: "处理完成,负责人没有变化。点右上角可以重新演示。",
- },
+ title: "在评论中 @智能体",
+ chapters: ["输入 @提及", "触发预览", "智能体回复"],
+ caption: "发送前评论框下方会预览即将启动的智能体;运行完成后任务的负责人与状态保持不变。",
+ },
+ "zh-Hant": {
+ title: "在評論中 @智能體",
+ chapters: ["輸入 @提及", "觸發預覽", "智能體回覆"],
+ caption: "發送前評論框下方會預覽即將啟動的智能體;任務負責人與狀態維持不變。",
},
ja: {
- title: "OPS-15 · 来週の顧客トレーニングを準備する",
- assigneeLabel: "担当者",
- assignee: "李雷",
- you: "あなた",
- draft: "トレーニングの案内メールがまだ書けていません。",
- agentsGroup: "エージェント",
- membersGroup: "メンバー",
- candidates: [
- { name: "ライティングアシスタント", agent: true },
- { name: "運用アシスタント", agent: true },
- { name: "李雷", agent: false },
- ] as Candidate[],
- memberNote: "通知のみ",
- mention: "@ メンション",
- willStart: "送信後に作業を開始します",
- send: "送信",
- running: "実行中",
- completed: "完了",
- steps: ["このコメントとタスクの説明を読む", "トレーニングの日程とアジェンダを確認する", "案内メールを下書きする"],
- reply: "案内メールの下書きができました。日程、アジェンダ、申し込みリンクを入れてあります。自由に手を入れてください。",
- captions: {
- idle: "このタスクの担当者はメンバーです。担当者を変えずに、エージェントに手伝ってもらえます。",
- type: "コメントは書けています。「@ メンション」をクリックしてエージェントを呼びます。",
- pick: "エージェントを選びます。メンバーをメンションしても通知が届くだけなので、ここでは選べません。",
- preview: "入力欄の下のトリガープレビューに、送信すると作業を始めるエージェントが表示されます。送信をクリックします。",
- running: "エージェントがこのコメントに取り組みます。担当者は 李雷 のままです。",
- done: "完了しました。担当者は一度も変わっていません。「もう一度」でもう一度試せます。",
- },
+ title: "コメントでエージェントを @メンション",
+ chapters: ["@メンション入力", "トリガープレビュー", "エージェントが返信"],
+ caption: "送信前に起動するエージェントがプレビューされ、タスクの担当者は変わらないまま返信が届きます。",
},
ko: {
- title: "OPS-15 · 다음 주 고객 교육 준비",
- assigneeLabel: "담당자",
- assignee: "리레이",
- you: "나",
- draft: "교육 초대 메일을 아직 못 썼어요. ",
- agentsGroup: "에이전트",
- membersGroup: "멤버",
- candidates: [
- { name: "글쓰기 도우미", agent: true },
- { name: "운영 도우미", agent: true },
- { name: "리레이", agent: false },
- ] as Candidate[],
- memberNote: "알림만",
- mention: "@ 멘션",
- willStart: "전송 후 작업을 시작합니다",
- send: "보내기",
- running: "실행 중",
- completed: "완료됨",
- steps: ["이 댓글과 태스크 설명 읽기", "교육 일정과 안건 확인", "초대 메일 초안 작성"],
- reply: "초대 메일 초안을 작성했습니다. 일정, 안건, 신청 링크가 들어 있으니 자유롭게 고쳐 주세요.",
- captions: {
- idle: "이 태스크의 담당자는 멤버입니다. 담당자를 바꾸지 않고도 에이전트에게 도움을 요청할 수 있습니다.",
- type: "댓글은 다 썼습니다. '@ 멘션'을 클릭해 에이전트를 불러오세요.",
- pick: "에이전트를 선택하세요. 멤버를 멘션하면 알림만 가므로 여기서는 멤버를 고를 수 없습니다.",
- preview: "입력란 아래의 트리거 미리보기에 보내면 작업을 시작할 에이전트가 표시됩니다. 보내기를 클릭하세요.",
- running: "에이전트가 이 댓글을 처리합니다. 담당자는 여전히 리레이입니다.",
- done: "완료되었습니다. 담당자는 한 번도 바뀌지 않았습니다. '다시 보기'로 다시 해 보세요.",
- },
+ title: "댓글에서 에이전트 @멘션하기",
+ chapters: ["@멘션 입력", "트리거 미리보기", "에이전트 답변"],
+ caption: "보내기 전 시작될 에이전트가 미리보기로 표시되며, 태스크 담당자는 그대로 유지됩니다.",
},
fr: {
- title: "OPS-15 · Préparer la formation clients de la semaine prochaine",
- assigneeLabel: "Assigné à",
- assignee: "Lei Li",
- you: "Vous",
- draft: "L'e-mail d'invitation à la formation n'est pas encore rédigé. ",
- agentsGroup: "Agents",
- membersGroup: "Membres",
- candidates: [
- { name: "Assistant rédaction", agent: true },
- { name: "Assistant ops", agent: true },
- { name: "Lei Li", agent: false },
- ] as Candidate[],
- memberNote: "Notification seule",
- mention: "@ Mentionner",
- willStart: "Démarrera à l'envoi",
- send: "Envoyer",
- running: "En cours",
- completed: "Terminée",
- steps: [
- "Lire ce commentaire et la description de la tâche",
- "Vérifier la date et le programme de la formation",
- "Rédiger l'e-mail d'invitation",
- ],
- reply:
- "Le brouillon de l'invitation est prêt, avec la date, le programme et le lien d'inscription. Modifiez-le comme vous voulez.",
- captions: {
- idle: "Un membre est assigné à cette tâche. Vous pouvez demander l'aide d'un agent sans changer l'assigné.",
- type: "Le commentaire est rédigé. Cliquez sur « @ Mentionner » pour faire intervenir un agent.",
- pick: "Choisissez un agent. Mentionner un membre ne fait que le notifier, donc les membres ne sont pas proposés ici.",
- preview: "L'aperçu sous la zone de commentaire indique qui démarrera à l'envoi. Cliquez sur envoyer.",
- running: "L'agent traite ce commentaire. L'assigné reste Lei Li.",
- done: "Terminé. L'assigné n'a jamais changé. Utilisez Rejouer pour recommencer.",
- },
+ title: "@mentionner un agent dans un commentaire",
+ chapters: ["Saisir @mention", "Aperçu", "Réponse"],
+ caption: "L'aperçu sous la zone de saisie indique quel agent démarre sans modifier le responsable de la tâche.",
},
};
-type Phase = "idle" | "type" | "pick" | "preview" | "running" | "done";
-
-// Every step advances by a click on the one control the caption names: the
-// comment itself is fixed, so the demo can't reach a state it doesn't script.
export function MentionDemo() {
const t = useDemoCopy(copy);
- const { after, clear } = useDemoTimers();
- const [frameRef, visible] = useStartWhenVisible<HTMLElement>();
- const [phase, setPhase] = useState<Exclude<Phase, "idle">>("type");
- const [agent, setAgent] = useState<string | null>(null);
- const [stepsShown, setStepsShown] = useState(0);
-
- const shownPhase: Phase = visible ? phase : "idle";
- const sent = phase === "running" || phase === "done";
-
- const pick = (name: string) => {
- setAgent(name);
- setPhase("preview");
- };
-
- const send = () => {
- setPhase("running");
- t.steps.forEach((_, i) => after(500 + i * 1000, () => setStepsShown(i + 1)));
- after(500 + t.steps.length * 1000 + 600, () => setPhase("done"));
- };
-
- const replay = () => {
- clear();
- setPhase("type");
- setAgent(null);
- setStepsShown(0);
- };
-
- const mentionToken = (name: string | null) => (
- <span className="font-medium text-brand">@{name ?? ""}</span>
- );
-
- return (
- <DemoFrame frameRef={frameRef} title={t.title} caption={t.captions[shownPhase]} onReplay={replay}>
- <div className="flex min-h-80 flex-col gap-3 p-4">
- <div className="flex items-center gap-2 text-caption text-muted-foreground">
- <span>{t.assigneeLabel}</span>
- <DemoAvatar name={t.assignee} />
- <span className="text-label text-foreground">{t.assignee}</span>
- </div>
-
- {sent && agent && (
- <>
- <DemoComment author={t.you}>
- {t.draft}
- {mentionToken(agent)}
- </DemoComment>
- <DemoRun agent={agent} status={phase === "done" ? t.completed : t.running} active={phase !== "done"}>
- {t.steps.slice(0, stepsShown).map((step, i) => (
- <DemoStep key={step} state={i === stepsShown - 1 && phase !== "done" ? "running" : "done"}>
- {step}
- </DemoStep>
- ))}
- </DemoRun>
- </>
- )}
-
- {phase === "done" && agent && (
- <DemoComment author={agent} agent>
- {t.reply}
- </DemoComment>
- )}
-
- <div className="relative mt-auto rounded-lg border bg-background p-2">
- {phase === "pick" && (
- <div
- role="listbox"
- aria-label={t.agentsGroup}
- className="absolute bottom-full left-2 z-10 mb-1 w-56 rounded-lg border bg-popover p-1 text-popover-foreground shadow-md motion-safe:animate-in motion-safe:fade-in"
- >
- {[true, false].map((isAgent) => (
- <div key={String(isAgent)}>
- <div className="px-2 pt-1 pb-0.5 text-micro text-muted-foreground">
- {isAgent ? t.agentsGroup : t.membersGroup}
- </div>
- {t.candidates
- .filter((c) => c.agent === isAgent)
- .map((candidate, i) => (
- <CoachMark
- key={candidate.name}
- active={isAgent && i === 0}
- side="right"
- ringClassName="rounded-md"
- className="flex w-full"
- >
- <button
- type="button"
- role="option"
- aria-selected={false}
- disabled={!candidate.agent}
- onClick={() => pick(candidate.name)}
- className="flex w-full items-center gap-2 rounded-md px-2 py-1.5 text-left text-body hover:bg-accent disabled:opacity-50 disabled:hover:bg-transparent"
- >
- <DemoAvatar name={candidate.name} agent={candidate.agent} />
- <span className="min-w-0 flex-1 truncate">{candidate.name}</span>
- {!candidate.agent && <span className="text-caption text-muted-foreground">{t.memberNote}</span>}
- </button>
- </CoachMark>
- ))}
- </div>
- ))}
- </div>
- )}
-
- <div className="min-h-12 px-1 text-body">
- {!sent && visible && (
- <>
- {t.draft}
- {phase === "type" ? (
- <CoachMark active side="right" ringClassName="rounded-md">
- <button
- type="button"
- onClick={() => setPhase("pick")}
- className="rounded-md border border-dashed border-brand/50 px-1.5 text-label font-medium text-brand hover:bg-brand/7"
- >
- {t.mention}
- </button>
- </CoachMark>
- ) : (
- mentionToken(agent)
- )}
- </>
- )}
- </div>
-
- <div className="mt-1.5 flex items-center gap-2">
- {phase === "preview" && agent && (
- <span className="inline-flex h-6 min-w-0 items-center gap-1.5 rounded-md bg-muted px-1.5 text-caption motion-safe:animate-in motion-safe:fade-in">
- <DemoAvatar name={agent} agent />
- <span className="truncate">{agent}</span>
- <span className="text-muted-foreground">· {t.willStart}</span>
- </span>
- )}
- <span className="ml-auto" />
- <CoachMark active={phase === "preview"} side="left" ringClassName="rounded-full">
- <DemoSendButton label={t.send} disabled={phase !== "preview"} onClick={send} />
- </CoachMark>
- </div>
- </div>
- </div>
- </DemoFrame>
- );
+ const meta = CLIP_MANIFEST.mention ?? { duration: 6.5, chapters: [] };
+ const chapters = t.chapters.map((label, i) => ({
+ label,
+ at: meta.chapters[i]?.at ?? (i * meta.duration) / t.chapters.length,
+ }));
+ return <EditorialClip slug="mention" title={t.title} chapters={chapters} duration={meta.duration} caption={t.caption} />;
}
diff --git a/apps/docs/components/demos/pr-link-demo.tsx b/apps/docs/components/demos/pr-link-demo.tsx
index 1852d557e4..94ad05eaa0 100644
--- a/apps/docs/components/demos/pr-link-demo.tsx
+++ b/apps/docs/components/demos/pr-link-demo.tsx
@@ -1,475 +1,47 @@
"use client";
-import { useState, type ReactNode } from "react";
-import {
- CheckCircle2,
- CircleDashed,
- CircleSlash,
- GitMerge,
- GitPullRequestArrow,
- MoreHorizontal,
-} from "@multica/ui/icons";
-import { Button } from "@multica/ui/components/ui/button";
-import { cn } from "@multica/ui/lib/utils";
-import { CoachMark, DemoAvatar, DemoFrame, useDemoCopy, useDemoTimers, useStartWhenVisible } from "./demo-kit";
-
-type Status = "in_review" | "done";
+import { CLIP_MANIFEST } from "./clip-manifest";
+import { EditorialClip, useDemoCopy } from "./demo-kit";
const copy = {
en: {
- title: "OPS-31 · Update the campaign copy on the website homepage",
- github: "GitHub",
- multica: "Multica",
- ghTitle: "OPS-31 Update the campaign copy on the website homepage",
- ghNumber: "#19",
- ghBranch: "ops-31-homepage-copy → main",
- open: "Open",
- merged: "Merged",
- checks: "All checks have passed · No conflicts",
- mergeButton: "Merge pull request",
- merging: "Merging...",
- mergedNote: "Pull request successfully merged",
- issueTitle: "OPS-31 · Update the campaign copy on the website homepage",
- statusLabel: "Status",
- status: { in_review: "In Review", done: "Done" } as Record<Status, string>,
- section: "Pull requests",
- sectionMenu: "Pull request automation",
- disable: "Keep status when PRs merge",
- prTitle: "Update the campaign copy on the website homepage",
- diff: { add: "+12", del: "−4" },
- justNow: "just now",
- ready: "Ready",
- waiting: { before: "Moves to ", after: " when #19 merges" },
- issueDisabled: "PR merges won’t change this issue",
- issueDisabledAction: "Turn on",
- you: "You",
- optedOutActivity: "set this issue to keep its status when PRs merge",
- mergedActivity: "Changed status from In Review to Done after every linked PR merged (#19)",
- captions: {
- idle: "An issue with a linked pull request that hasn't merged yet.",
- ready:
- "The issue is linked to #19, and the line under it says what a merge will do. Click Merge pull request on GitHub, or first use the ⋯ menu to keep this issue's status.",
- menu: "Keep status when PRs merge: this issue stays where it is after its PRs merge.",
- optedOut: "This issue now keeps its status when PRs merge. Merge on GitHub, or click Turn on to go back to the default.",
- merging: "GitHub sends the merge event to Multica.",
- merged:
- "Every linked PR has merged, so the issue moved to Done and the timeline records it as a system change. Use Replay to try the other path.",
- kept: "The PR merged, but this issue keeps its status when PRs merge, so it stays In Review. Use Replay to start over.",
- },
+ title: "Track linked Pull Requests in the issue sidebar",
+ chapters: ["Pull requests card", "Link another PR", "Synced state"],
+ caption: "Pull requests referencing the issue identifier link automatically, showing diff stats, CI status, and merge transitions.",
},
zh: {
- title: "OPS-31 · 更新官网首页的活动文案",
- github: "GitHub",
- multica: "Multica",
- ghTitle: "OPS-31 更新官网首页的活动文案",
- ghNumber: "#19",
- ghBranch: "ops-31-homepage-copy → main",
- open: "Open",
- merged: "Merged",
- checks: "检查已通过,没有冲突",
- mergeButton: "Merge pull request",
- merging: "合并中...",
- mergedNote: "Pull request 已合并",
- issueTitle: "OPS-31 · 更新官网首页的活动文案",
- statusLabel: "状态",
- status: { in_review: "审核中", done: "已完成" } as Record<Status, string>,
- section: "Pull Request",
- sectionMenu: "PR 自动化",
- disable: "此任务合并后不改状态",
- prTitle: "更新官网首页的活动文案",
- diff: { add: "+12", del: "−4" },
- justNow: "刚刚",
- ready: "可合入",
- waiting: { before: "等待 #19 合并后改为 ", after: "" },
- issueDisabled: "此任务合并后不改状态",
- issueDisabledAction: "恢复",
- you: "你",
- optedOutActivity: "设置此任务合并后不改状态",
- mergedActivity: "所有关联 PR 均已合并(#19),状态从 审核中 改为 已完成",
- captions: {
- idle: "一条关联了 PR 的任务,PR 还没有合并。",
- ready: "任务关联了 #19,列表下方写着合并后会改成什么状态。在 GitHub 上点击 Merge pull request;也可以先在 ⋯ 菜单里让这条任务合并后不改状态。",
- menu: "选择\"此任务合并后不改状态\"后,这条任务的 PR 合并时保持当前状态。",
- optedOut: "这条任务已设置为合并后不改状态。去 GitHub 合并,或点击\"恢复\"回到默认规则。",
- merging: "GitHub 把合并事件发给 Multica。",
- merged: "关联的 PR 全部合并,任务改为已完成,时间线以系统操作记下这次变化。点右上角可以换一条路径再试。",
- kept: "PR 已合并,但这条任务设置了合并后不改状态,所以仍是审核中。点右上角可以重新演示。",
- },
+ title: "在任务右侧栏追踪关联的 Pull Request",
+ chapters: ["Pull requests 卡片", "手动关联 PR", "同步状态与合并"],
+ caption: "标题或分支包含任务编号的 PR 会自动关联到右侧栏,实时展示改动行数、CI 检查与合并流转。",
+ },
+ "zh-Hant": {
+ title: "在任務右側欄追蹤關聯的 Pull Request",
+ chapters: ["Pull requests 卡片", "手動關聯 PR", "同步狀態與合併"],
+ caption: "標題或分支包含任務編號的 PR 會自動關聯至右側欄,即時顯示改動行數、CI 檢查與合併狀態。",
},
ja: {
- title: "OPS-31 · Web サイトのトップページのキャンペーン文言を更新する",
- github: "GitHub",
- multica: "Multica",
- ghTitle: "OPS-31 Web サイトのトップページのキャンペーン文言を更新する",
- ghNumber: "#19",
- ghBranch: "ops-31-homepage-copy → main",
- open: "Open",
- merged: "Merged",
- checks: "すべてのチェックに合格 · コンフリクトなし",
- mergeButton: "Merge pull request",
- merging: "マージ中...",
- mergedNote: "Pull request をマージしました",
- issueTitle: "OPS-31 · Web サイトのトップページのキャンペーン文言を更新する",
- statusLabel: "ステータス",
- status: { in_review: "レビュー中", done: "完了" } as Record<Status, string>,
- section: "Pull requests",
- sectionMenu: "PR の自動化",
- disable: "PR マージ後もステータスを変えない",
- prTitle: "Web サイトのトップページのキャンペーン文言を更新する",
- diff: { add: "+12", del: "−4" },
- justNow: "たった今",
- ready: "マージ可能",
- waiting: { before: "#19 がマージされると ", after: " に変更" },
- issueDisabled: "このタスクは PR マージでステータスを変えません",
- issueDisabledAction: "再開",
- you: "あなた",
- optedOutActivity: "このタスクを PR マージでステータスを変えないように設定しました",
- mergedActivity: "関連するすべての PR がマージされたため(#19)、ステータスを レビュー中 から 完了 に変更しました",
- captions: {
- idle: "PR が関連付けられたタスクです。PR はまだマージされていません。",
- ready:
- "タスクには #19 が関連付けられ、その下の行にマージ後のステータスが表示されています。GitHub で Merge pull request をクリックするか、先に ⋯ メニューでこのタスクのステータスを変えないように設定します。",
- menu: "「PR マージ後もステータスを変えない」を選ぶと、このタスクは PR がマージされても今のステータスのままです。",
- optedOut: "このタスクは PR マージでステータスを変えない設定になりました。GitHub でマージするか、「再開」をクリックしてデフォルトに戻します。",
- merging: "GitHub がマージイベントを Multica に送ります。",
- merged:
- "関連する PR がすべてマージされたので、タスクは 完了 になり、タイムラインにシステムによる変更として記録されました。「もう一度」で別の流れも試せます。",
- kept: "PR はマージされましたが、このタスクは PR マージでステータスを変えない設定なので レビュー中 のままです。「もう一度」で最初から見られます。",
- },
+ title: "タスクのサイドバーで関連 PR を追跡する",
+ chapters: ["PR カード", "PR を手動リンク", "ステータス同期"],
+ caption: "タスク番号を含む PR は自動で紐づき、差分行数・CI チェック・マージ状況をリアルタイム表示します。",
},
ko: {
- title: "OPS-31 · 웹사이트 홈페이지의 캠페인 문구 업데이트",
- github: "GitHub",
- multica: "Multica",
- ghTitle: "OPS-31 웹사이트 홈페이지의 캠페인 문구 업데이트",
- ghNumber: "#19",
- ghBranch: "ops-31-homepage-copy → main",
- open: "Open",
- merged: "Merged",
- checks: "모든 검사 통과 · 충돌 없음",
- mergeButton: "Merge pull request",
- merging: "병합 중...",
- mergedNote: "Pull request가 병합되었습니다",
- issueTitle: "OPS-31 · 웹사이트 홈페이지의 캠페인 문구 업데이트",
- statusLabel: "상태",
- status: { in_review: "리뷰 중", done: "완료" } as Record<Status, string>,
- section: "Pull requests",
- sectionMenu: "PR 자동화",
- disable: "PR 병합 후에도 상태 유지",
- prTitle: "웹사이트 홈페이지의 캠페인 문구 업데이트",
- diff: { add: "+12", del: "−4" },
- justNow: "방금 전",
- ready: "병합 가능",
- waiting: { before: "#19 병합 시 ", after: "로 변경" },
- issueDisabled: "이 태스크는 PR 병합 시 상태를 바꾸지 않음",
- issueDisabledAction: "다시 켜기",
- you: "나",
- optedOutActivity: "이 태스크가 PR 병합 시 상태를 유지하도록 설정했습니다",
- mergedActivity: "연결된 PR이 모두 병합되어(#19) 상태를 리뷰 중에서 완료로 변경했습니다",
- captions: {
- idle: "PR이 연결된 태스크입니다. PR은 아직 병합되지 않았습니다.",
- ready:
- "태스크에 #19가 연결되어 있고, 그 아래 줄에 병합 후 바뀔 상태가 표시됩니다. GitHub에서 Merge pull request를 클릭하거나, 먼저 ⋯ 메뉴에서 이 태스크의 상태를 유지하도록 설정하세요.",
- menu: "PR 병합 후에도 상태 유지를 선택하면 이 태스크는 PR이 병합되어도 현재 상태를 유지합니다.",
- optedOut: "이제 이 태스크는 PR 병합 시 상태를 유지합니다. GitHub에서 병합하거나 다시 켜기를 클릭해 기본 동작으로 돌아가세요.",
- merging: "GitHub가 병합 이벤트를 Multica로 보냅니다.",
- merged:
- "연결된 PR이 모두 병합되어 태스크가 완료로 바뀌었고, 타임라인에 시스템 변경으로 기록되었습니다. 다시 보기를 눌러 다른 경로도 시도해 보세요.",
- kept: "PR은 병합되었지만 이 태스크는 PR 병합 시 상태를 유지하도록 설정되어 있어 리뷰 중으로 남습니다. 다시 보기를 누르면 처음부터 볼 수 있습니다.",
- },
+ title: "태스크 사이드바에서 연결된 PR 추적하기",
+ chapters: ["Pull requests 카드", "PR 직접 연결", "상태 동기화"],
+ caption: "태스크 번호가 포함된 PR은 자동 연결되며 변경 라인 수, CI 체크, 병합 상태를 함께 보여 줍니다.",
},
fr: {
- title: "OPS-31 · Mettre à jour le texte de la campagne sur la page d'accueil du site",
- github: "GitHub",
- multica: "Multica",
- ghTitle: "OPS-31 Mettre à jour le texte de la campagne sur la page d'accueil du site",
- ghNumber: "#19",
- ghBranch: "ops-31-homepage-copy → main",
- open: "Open",
- merged: "Merged",
- checks: "Toutes les vérifications ont réussi · Aucun conflit",
- mergeButton: "Merge pull request",
- merging: "Fusion...",
- mergedNote: "Pull request fusionnée",
- issueTitle: "OPS-31 · Mettre à jour le texte de la campagne sur la page d'accueil du site",
- statusLabel: "Statut",
- status: { in_review: "En relecture", done: "Terminé" } as Record<Status, string>,
- section: "Pull requests",
- sectionMenu: "Automatisation des pull requests",
- disable: "Garder le statut à la fusion des PR",
- prTitle: "Mettre à jour le texte de la campagne sur la page d'accueil du site",
- diff: { add: "+12", del: "−4" },
- justNow: "à l'instant",
- ready: "Prête à fusionner",
- waiting: { before: "Passe à ", after: " quand #19 est fusionnée" },
- issueDisabled: "Les fusions de PR ne changent pas cette tâche",
- issueDisabledAction: "Réactiver",
- you: "Vous",
- optedOutActivity: "a configuré cette tâche pour garder son statut à la fusion des PR",
- mergedActivity: "Statut changé de En relecture à Terminé après la fusion de toutes les PR liées (#19)",
- captions: {
- idle: "Une tâche liée à une pull request qui n'est pas encore fusionnée.",
- ready:
- "La tâche est liée à #19, et la ligne en dessous indique ce que fera la fusion. Cliquez sur Merge pull request sur GitHub, ou passez d'abord par le menu ⋯ pour que cette tâche garde son statut.",
- menu: "Garder le statut à la fusion des PR : cette tâche reste où elle est après la fusion de ses PR.",
- optedOut:
- "Cette tâche garde désormais son statut à la fusion des PR. Fusionnez sur GitHub, ou cliquez sur Réactiver pour revenir au comportement par défaut.",
- merging: "GitHub envoie l'événement de fusion à Multica.",
- merged:
- "Toutes les PR liées sont fusionnées : la tâche passe à Terminé, et la chronologie l'enregistre comme une modification système. Cliquez sur Rejouer pour essayer l'autre chemin.",
- kept: "La PR est fusionnée, mais cette tâche garde son statut à la fusion des PR : elle reste En relecture. Cliquez sur Rejouer pour recommencer.",
- },
+ title: "Suivre les Pull Requests liées dans la barre latérale",
+ chapters: ["Carte PR", "Lier une PR", "Statut synchronisé"],
+ caption: "Les PR mentionnant l'identifiant de tâche se relient automatiquement avec diff, vérifications CI et statut de fusion.",
},
};
-type Phase = "idle" | "ready" | "menu" | "optedOut" | "merging" | "merged" | "kept";
-
-const statusDot: Record<Status, string> = {
- in_review: "border-brand bg-brand/40",
- done: "border-success bg-success",
-};
-
-function StatusChip({ label, status }: { label: string; status: Status }) {
- return (
- <span className="inline-flex items-center gap-1 align-[-2px] font-medium text-foreground">
- <span aria-hidden className={cn("size-2.5 rounded-full border-2", statusDot[status])} />
- {label}
- </span>
- );
-}
-
export function PrLinkDemo() {
const t = useDemoCopy(copy);
- const { after, clear } = useDemoTimers();
- const [frameRef, visible] = useStartWhenVisible<HTMLElement>();
- const [phase, setPhase] = useState<Exclude<Phase, "idle">>("ready");
- const [optedOut, setOptedOut] = useState(false);
- const [status, setStatus] = useState<Status>("in_review");
-
- const shownPhase: Phase = visible ? phase : "idle";
- const prMerged = phase === "merged" || phase === "kept";
- const canMerge = visible && (phase === "ready" || phase === "optedOut");
- const canUseMenu = visible && (phase === "ready" || phase === "menu");
-
- const merge = () => {
- const keep = optedOut;
- setPhase("merging");
- after(900, () => {
- setPhase(keep ? "kept" : "merged");
- if (!keep) after(500, () => setStatus("done"));
- });
- };
-
- const optOut = () => {
- setOptedOut(true);
- setPhase("optedOut");
- };
-
- const turnBackOn = () => {
- setOptedOut(false);
- setPhase("ready");
- };
-
- const replay = () => {
- clear();
- setPhase("ready");
- setOptedOut(false);
- setStatus("in_review");
- };
-
- // The line under the PR list follows the server's decision: it names the
- // target while a PR is open, reports an opt-out, and goes quiet once the
- // issue is done.
- let autoLine: ReactNode = null;
- if (optedOut) {
- autoLine = (
- <>
- <CircleSlash aria-hidden />
- <span className="min-w-0">
- {t.issueDisabled} ·{" "}
- <button
- type="button"
- disabled={phase !== "optedOut"}
- onClick={turnBackOn}
- className="font-medium text-foreground underline decoration-border underline-offset-2 hover:decoration-foreground disabled:no-underline"
- >
- {t.issueDisabledAction}
- </button>
- </span>
- </>
- );
- } else if (!prMerged) {
- autoLine = (
- <>
- <CircleDashed aria-hidden />
- <span className="min-w-0">
- {t.waiting.before}
- <StatusChip label={t.status.done} status="done" />
- {t.waiting.after}
- </span>
- </>
- );
- }
-
- return (
- <DemoFrame frameRef={frameRef} title={t.title} caption={t.captions[shownPhase]} onReplay={replay}>
- <div className="grid min-h-80 gap-3 p-4 sm:grid-cols-2">
- <section className="flex min-w-0 flex-col gap-2 rounded-lg border bg-background p-3">
- <div className="text-micro font-medium text-muted-foreground">{t.github}</div>
- <div className="text-body font-medium break-words">
- {t.ghTitle} <span className="font-normal text-muted-foreground">{t.ghNumber}</span>
- </div>
- <div className="flex min-w-0 flex-wrap items-center gap-2 text-caption text-muted-foreground">
- <span
- key={String(prMerged)}
- className={cn(
- "inline-flex items-center gap-1 rounded-full px-2 py-0.5 text-micro font-medium text-white motion-safe:animate-in motion-safe:fade-in",
- prMerged ? "bg-violet-600" : "bg-emerald-600",
- )}
- >
- {prMerged ? <GitMerge aria-hidden className="size-3" /> : <GitPullRequestArrow aria-hidden className="size-3" />}
- {prMerged ? t.merged : t.open}
- </span>
- <span className="min-w-0 truncate font-mono text-micro">{t.ghBranch}</span>
- </div>
- <div className="mt-auto flex flex-col gap-2 rounded-md border bg-muted/40 p-2.5">
- {prMerged ? (
- <span className="flex items-center gap-1.5 text-caption motion-safe:animate-in motion-safe:fade-in">
- <GitMerge aria-hidden className="size-3.5 text-violet-600 dark:text-violet-400" />
- {t.mergedNote}
- </span>
- ) : (
- <>
- <span className="flex items-center gap-1.5 text-caption">
- <CheckCircle2 aria-hidden className="size-3.5 text-success" />
- {t.checks}
- </span>
- <CoachMark active={canMerge} side="bottom" align="start" ringClassName="rounded-lg">
- <Button type="button" size="sm" disabled={!canMerge} onClick={merge}>
- {phase === "merging" ? t.merging : t.mergeButton}
- </Button>
- </CoachMark>
- </>
- )}
- </div>
- </section>
-
- <section className="flex min-w-0 flex-col gap-3 rounded-lg border bg-background p-3">
- <div className="text-micro font-medium text-muted-foreground">{t.multica}</div>
- <div className="text-body font-medium break-words">{t.issueTitle}</div>
- <div className="flex items-center gap-3 text-body">
- <span className="text-caption text-muted-foreground">{t.statusLabel}</span>
- <span className="flex items-center gap-1.5">
- <span aria-hidden className={cn("size-3 rounded-full border-2 transition-colors", statusDot[status])} />
- <span key={status} className="motion-safe:animate-in motion-safe:fade-in">
- {t.status[status]}
- </span>
- </span>
- </div>
-
- <div className="relative">
- <div className="flex items-center justify-between">
- <span className="text-caption font-medium text-muted-foreground">{t.section}</span>
- <button
- type="button"
- aria-label={t.sectionMenu}
- aria-haspopup="menu"
- aria-expanded={phase === "menu"}
- disabled={!canUseMenu}
- onClick={() => setPhase(phase === "menu" ? "ready" : "menu")}
- className="inline-flex size-6 items-center justify-center rounded-md text-muted-foreground hover:bg-muted disabled:opacity-50 disabled:hover:bg-transparent"
- >
- <MoreHorizontal className="size-4" />
- </button>
- </div>
- {phase === "menu" && (
- <div
- role="menu"
- aria-label={t.sectionMenu}
- className="absolute top-7 right-0 z-10 w-56 rounded-lg border bg-popover p-1 text-popover-foreground shadow-md motion-safe:animate-in motion-safe:fade-in"
- >
- <CoachMark quiet active ringClassName="rounded-md" className="flex w-full">
- <button
- type="button"
- role="menuitem"
- onClick={optOut}
- className="flex w-full items-center gap-2 rounded-md px-2 py-1.5 text-left text-body hover:bg-accent"
- >
- <CircleSlash aria-hidden className="size-3.5 text-muted-foreground" />
- {t.disable}
- </button>
- </CoachMark>
- </div>
- )}
-
- <div className="mt-1 flex items-start gap-2 rounded-md px-0.5 py-1.5">
- {prMerged ? (
- <GitMerge aria-hidden className="mt-px size-3.5 shrink-0 text-violet-600 dark:text-violet-400" />
- ) : (
- <GitPullRequestArrow aria-hidden className="mt-px size-3.5 shrink-0 text-emerald-600 dark:text-emerald-400" />
- )}
- <div className="min-w-0 flex-1">
- <p className="truncate text-caption font-medium">{t.prTitle}</p>
- <div className="mt-1 flex items-center gap-2">
- <p className="flex min-w-0 flex-1 items-center gap-1.5 text-micro text-muted-foreground tabular-nums">
- <span>{t.ghNumber}</span>
- <span aria-hidden>·</span>
- {prMerged ? (
- <span>{t.justNow}</span>
- ) : (
- <span>
- <span className="text-emerald-600 dark:text-emerald-400">{t.diff.add}</span>{" "}
- <span className="text-rose-600 dark:text-rose-400">{t.diff.del}</span>
- </span>
- )}
- </p>
- <span
- className={cn(
- "inline-flex shrink-0 items-center gap-1 rounded-full px-1.5 py-0.5 text-micro font-medium",
- prMerged
- ? "bg-violet-500/10 text-violet-700 dark:text-violet-300"
- : "bg-emerald-500/10 text-emerald-700 dark:text-emerald-300",
- )}
- >
- {prMerged ? <GitMerge aria-hidden className="size-3" /> : <CheckCircle2 aria-hidden className="size-3" />}
- {prMerged ? t.merged : t.ready}
- </span>
- </div>
- </div>
- </div>
-
- {autoLine && (
- <p className="mt-1 flex items-start gap-1.5 border-t pt-2 text-caption text-muted-foreground motion-safe:animate-in motion-safe:fade-in [&>svg]:mt-0.5 [&>svg]:size-3.5 [&>svg]:shrink-0">
- {autoLine}
- </p>
- )}
- </div>
-
- {(optedOut || status === "done") && (
- <ul className="mt-auto flex flex-col gap-1.5 border-t pt-2 text-caption text-muted-foreground">
- {optedOut && (
- <li className="flex min-w-0 items-start gap-2 motion-safe:animate-in motion-safe:fade-in">
- <DemoAvatar name={t.you} />
- <span className="min-w-0">
- <span className="font-medium text-foreground">{t.you}</span> {t.optedOutActivity}
- </span>
- </li>
- )}
- {status === "done" && (
- <li className="flex min-w-0 items-start gap-2 motion-safe:animate-in motion-safe:fade-in">
- <span
- aria-hidden
- className="inline-flex size-5 shrink-0 items-center justify-center rounded-full bg-muted"
- >
- <GitMerge className="size-3" />
- </span>
- <span className="min-w-0">{t.mergedActivity}</span>
- </li>
- )}
- </ul>
- )}
- </section>
- </div>
- </DemoFrame>
- );
+ const meta = CLIP_MANIFEST["pr-link"] ?? { duration: 5.5, chapters: [] };
+ const chapters = t.chapters.map((label, i) => ({
+ label,
+ at: meta.chapters[i]?.at ?? (i * meta.duration) / t.chapters.length,
+ }));
+ return <EditorialClip slug="pr-link" title={t.title} chapters={chapters} duration={meta.duration} caption={t.caption} />;
}
diff --git a/apps/docs/components/demos/project-demo.tsx b/apps/docs/components/demos/project-demo.tsx
index a319744b79..23a2debf52 100644
--- a/apps/docs/components/demos/project-demo.tsx
+++ b/apps/docs/components/demos/project-demo.tsx
@@ -1,439 +1,47 @@
"use client";
-import { useState } from "react";
-import { ChevronDown, FolderKanban } from "@multica/ui/icons";
-import { cn } from "@multica/ui/lib/utils";
-import { CoachMark, DemoAvatar, DemoFrame, useDemoCopy, useStartWhenVisible } from "./demo-kit";
-
-type IssueStatus = "todo" | "in_progress" | "in_review" | "done" | "cancelled";
-type ProjectStatus = "planned" | "in_progress" | "paused" | "completed" | "cancelled";
-type IssueId = "OPS-41" | "OPS-42" | "OPS-43" | "OPS-44";
-
-const ISSUE_MENU: IssueStatus[] = ["todo", "in_progress", "in_review", "done", "cancelled"];
-const PROJECT_MENU: ProjectStatus[] = ["planned", "in_progress", "paused", "completed", "cancelled"];
-
-// Progress is done ÷ issues still in scope; cancelled ones leave the scope
-// (newProjectProgress in handler/project.go).
-
-const issueDot: Record<IssueStatus, string> = {
- todo: "border-muted-foreground",
- in_progress: "border-warning bg-warning/40",
- in_review: "border-brand bg-brand/40",
- done: "border-success bg-success",
- cancelled: "border-muted-foreground bg-muted-foreground/50",
-};
+import { CLIP_MANIFEST } from "./clip-manifest";
+import { EditorialClip, useDemoCopy } from "./demo-kit";
const copy = {
en: {
- title: "Project · Anniversary online event",
- project: "Anniversary online event",
- statusLabel: "Status",
- leadLabel: "Lead",
- progressLabel: "Progress",
- you: "You",
- descriptionLabel: "Description",
- description: "Run the anniversary online event by October 31: the announcement post, the prize draw and partner promotion. Keep the brand voice friendly; budget stays within the approved amount.",
- descriptionHint: "Used as project context for agents, applied to every run in this project.",
- issueStatus: {
- todo: "Todo",
- in_progress: "In Progress",
- in_review: "In Review",
- done: "Done",
- cancelled: "Cancelled",
- } as Record<IssueStatus, string>,
- projectStatus: {
- planned: "Planned",
- in_progress: "In Progress",
- paused: "Paused",
- completed: "Completed",
- cancelled: "Cancelled",
- } as Record<ProjectStatus, string>,
- issues: {
- "OPS-41": "Pick the event theme and dates",
- "OPS-42": "Write the event announcement post",
- "OPS-43": "List the prizes for the draw",
- "OPS-44": "Book a partner influencer",
- } as Record<IssueId, string>,
- captions: {
- idle: "A project with four issues; two are finished.",
- first: "OPS-42 has been reviewed. Click its status and mark it Done.",
- firstMenu: "Pick Done.",
- second: "Progress went up a step. The partner promotion is no longer happening: set OPS-44 to Cancelled.",
- secondMenu: "Pick Cancelled. A cancelled issue has left the project's scope.",
- allDone: "OPS-44 left the scope, so the three remaining issues are all done and the project is at 100%. Its own status is still In Progress: it does not follow the issues. Click the project status.",
- projectMenu: "Pick Completed. Changing it would not touch any issue either.",
- done: "The project is now Completed; that never happens on its own. Use Replay to watch again.",
- },
+ title: "Organize issues and context inside a project",
+ chapters: ["Project overview", "Tracked issues", "Shared resources"],
+ caption: "A project tracks progress across its issues and shares its description, repositories, and workflow with every run inside it.",
},
zh: {
- title: "项目 · 周年庆线上活动",
- project: "周年庆线上活动",
- statusLabel: "状态",
- leadLabel: "负责人",
- progressLabel: "进度",
- you: "你",
- descriptionLabel: "描述",
- description: "10 月 31 日前办完周年庆线上活动:活动推文、抽奖和合作推广。语气保持亲切,花费不超过已批预算。",
- descriptionHint: "会作为项目上下文提供给智能体,应用于该项目下的每次运行。",
- issueStatus: {
- todo: "待办",
- in_progress: "进行中",
- in_review: "审核中",
- done: "已完成",
- cancelled: "已取消",
- } as Record<IssueStatus, string>,
- projectStatus: {
- planned: "计划中",
- in_progress: "进行中",
- paused: "已暂停",
- completed: "已完成",
- cancelled: "已取消",
- } as Record<ProjectStatus, string>,
- issues: {
- "OPS-41": "确定活动主题和时间",
- "OPS-42": "写活动推文",
- "OPS-43": "列出抽奖奖品清单",
- "OPS-44": "联系合作博主",
- } as Record<IssueId, string>,
- captions: {
- idle: "一个包含 4 条任务的项目,其中 2 条已经结束。",
- first: "OPS-42 已经检查过了。点击它的状态,改为已完成。",
- firstMenu: "选择已完成。",
- second: "进度前进了一格。合作推广不做了:把 OPS-44 改为已取消。",
- secondMenu: "选择已取消。取消表示这项工作已从项目范围中结束。",
- allDone: "OPS-44 移出了范围,剩下 3 个任务都已完成,项目到了 100%,但项目状态还是进行中:它不跟随任务变化。点击项目状态。",
- projectMenu: "选择已完成。修改项目状态也不会改动其中的任务。",
- done: "项目状态改成了已完成,这一步不会自动发生。点右上角可以重新演示。",
- },
+ title: "在项目中组织任务与共享上下文",
+ chapters: ["项目概览与进度", "项目内任务", "共享资源与说明"],
+ caption: "项目自动汇总名下任务进度,并把项目说明、代码仓库与工作流提供给其中的每一次智能体运行。",
+ },
+ "zh-Hant": {
+ title: "在專案中組織任務與共享上下文",
+ chapters: ["專案概覽與進度", "專案內任務", "共享資源與說明"],
+ caption: "專案自動彙整名下任務進度,並把專案說明、倉庫與工作流提供給其中的每一次執行。",
},
ja: {
- title: "プロジェクト · 周年記念オンラインイベント",
- project: "周年記念オンラインイベント",
- statusLabel: "ステータス",
- leadLabel: "リード",
- progressLabel: "進捗",
- you: "あなた",
- descriptionLabel: "説明",
- description: "10 月 31 日までに周年記念オンラインイベントを実施する:告知投稿、抽選、パートナーとの共同プロモーション。トーンは親しみやすく、費用は承認済みの予算内に収める。",
- descriptionHint: "このプロジェクトのすべての実行で、コンテキストとしてエージェントに共有されます。",
- issueStatus: {
- todo: "未着手",
- in_progress: "進行中",
- in_review: "レビュー中",
- done: "完了",
- cancelled: "キャンセル済み",
- } as Record<IssueStatus, string>,
- projectStatus: {
- planned: "計画中",
- in_progress: "進行中",
- paused: "一時停止",
- completed: "完了",
- cancelled: "キャンセル",
- } as Record<ProjectStatus, string>,
- issues: {
- "OPS-41": "イベントのテーマと日程を決める",
- "OPS-42": "イベント告知の投稿を書く",
- "OPS-43": "抽選の景品リストを作る",
- "OPS-44": "パートナーのインフルエンサーに依頼する",
- } as Record<IssueId, string>,
- captions: {
- idle: "4 件のタスクを含むプロジェクト。そのうち 2 件はすでに終わっています。",
- first: "OPS-42 はレビュー済みです。ステータスをクリックして完了にしてください。",
- firstMenu: "完了を選んでください。",
- second: "進捗が 1 段進みました。パートナーとの共同プロモーションは取りやめになったので、OPS-44 をキャンセル済みにしてください。",
- secondMenu: "キャンセル済みを選んでください。キャンセルは、その作業がプロジェクトの範囲から外れたことを表します。",
- allDone: "OPS-44 は範囲から外れ、残る 3 件がすべて完了したので、プロジェクトは 100% になりました。それでもプロジェクトのステータスは進行中のままで、タスクには連動しません。プロジェクトのステータスをクリックしてください。",
- projectMenu: "完了を選んでください。プロジェクトのステータスを変えても、タスクは変わりません。",
- done: "プロジェクトが完了になりました。これは自動では起きません。右上から最初に戻せます。",
- },
+ title: "プロジェクトでタスクと共有コンテキストを管理する",
+ chapters: ["プロジェクト概要", "紐づくタスク", "共有リソース"],
+ caption: "プロジェクト全体の進捗を追いながら、説明・リポジトリ・ワークフローを全実行へ共有できます。",
},
ko: {
- title: "프로젝트 · 창립 기념 온라인 이벤트",
- project: "창립 기념 온라인 이벤트",
- statusLabel: "상태",
- leadLabel: "리드",
- progressLabel: "진행률",
- you: "나",
- descriptionLabel: "설명",
- description: "10월 31일까지 창립 기념 온라인 이벤트를 마친다: 이벤트 공지 게시물, 경품 추첨, 파트너 공동 홍보. 말투는 친근하게 유지하고 비용은 승인된 예산을 넘지 않는다.",
- descriptionHint: "이 프로젝트의 모든 실행에서 컨텍스트로 에이전트에게 공유됩니다.",
- issueStatus: {
- todo: "할 일",
- in_progress: "진행 중",
- in_review: "리뷰 중",
- done: "완료",
- cancelled: "취소됨",
- } as Record<IssueStatus, string>,
- projectStatus: {
- planned: "계획됨",
- in_progress: "진행 중",
- paused: "일시 중지",
- completed: "완료됨",
- cancelled: "취소됨",
- } as Record<ProjectStatus, string>,
- issues: {
- "OPS-41": "이벤트 주제와 일정 정하기",
- "OPS-42": "이벤트 공지 게시물 작성",
- "OPS-43": "추첨 경품 목록 만들기",
- "OPS-44": "협업 인플루언서 섭외",
- } as Record<IssueId, string>,
- captions: {
- idle: "태스크 4개가 있는 프로젝트입니다. 그중 2개는 이미 끝났습니다.",
- first: "OPS-42는 검토를 마쳤습니다. 상태를 클릭해 완료로 바꾸세요.",
- firstMenu: "완료를 선택하세요.",
- second: "진행률이 한 칸 올랐습니다. 파트너 공동 홍보는 하지 않기로 했으니 OPS-44를 취소됨으로 바꾸세요.",
- secondMenu: "취소됨을 선택하세요. 취소는 그 작업이 프로젝트 범위에서 끝났다는 뜻입니다.",
- allDone: "OPS-44가 범위에서 빠지고 남은 3개가 모두 완료되어 프로젝트가 100%가 됐습니다. 그래도 프로젝트 상태는 여전히 진행 중입니다. 태스크를 따라 바뀌지 않습니다. 프로젝트 상태를 클릭하세요.",
- projectMenu: "완료됨을 선택하세요. 프로젝트 상태를 바꿔도 태스크는 바뀌지 않습니다.",
- done: "프로젝트가 완료됨이 됐습니다. 이 단계는 자동으로 일어나지 않습니다. 오른쪽 위에서 다시 볼 수 있습니다.",
- },
+ title: "프로젝트에서 태스크와 공유 맥락 관리하기",
+ chapters: ["프로젝트 개요", "포함된 태스크", "공유 리소스"],
+ caption: "프로젝트가 진행률을 집계하고 설명·저장소·워크플로를 하위 모든 실행에 자동으로 공유합니다.",
},
fr: {
- title: "Projet · Événement en ligne de l'anniversaire",
- project: "Événement en ligne de l'anniversaire",
- statusLabel: "Statut",
- leadLabel: "Responsable",
- progressLabel: "Avancement",
- you: "Vous",
- descriptionLabel: "Description",
- description: "Organiser l'événement en ligne de l'anniversaire d'ici le 31 octobre : la publication d'annonce, le tirage au sort et la promotion avec un partenaire. Garder un ton chaleureux ; ne pas dépasser le budget validé.",
- descriptionHint: "Partagé avec les agents comme contexte à chaque exécution dans ce projet.",
- issueStatus: {
- todo: "À faire",
- in_progress: "En cours",
- in_review: "En relecture",
- done: "Terminé",
- cancelled: "Annulé",
- } as Record<IssueStatus, string>,
- projectStatus: {
- planned: "Planifié",
- in_progress: "En cours",
- paused: "En pause",
- completed: "Terminé",
- cancelled: "Annulé",
- } as Record<ProjectStatus, string>,
- issues: {
- "OPS-41": "Choisir le thème et les dates de l'événement",
- "OPS-42": "Rédiger la publication d'annonce",
- "OPS-43": "Lister les lots du tirage au sort",
- "OPS-44": "Contacter un influenceur partenaire",
- } as Record<IssueId, string>,
- captions: {
- idle: "Un projet de quatre tâches, dont deux sont déjà closes.",
- first: "OPS-42 a été relue. Cliquez sur son statut et passez-la à Terminé.",
- firstMenu: "Choisissez Terminé.",
- second: "L'avancement a progressé d'un cran. La promotion avec le partenaire n'aura pas lieu : passez OPS-44 à Annulé.",
- secondMenu: "Choisissez Annulé. Une tâche annulée est sortie du périmètre du projet.",
- allDone: "OPS-44 est sorti du périmètre et les trois tâches restantes sont terminées : le projet est à 100 %. Son propre statut reste En cours, car il ne suit pas les tâches. Cliquez sur le statut du projet.",
- projectMenu: "Choisissez Terminé. Changer le statut du projet ne touche à aucune tâche non plus.",
- done: "Le projet est maintenant Terminé ; cela n'arrive jamais tout seul. Relancez la démo pour la revoir.",
- },
+ title: "Organiser tâches et contexte dans un projet",
+ chapters: ["Vue d'ensemble", "Tâches suivies", "Ressources partagées"],
+ caption: "Un projet suit l'avancement global et partage description, dépôts et workflow avec chaque exécution.",
},
};
-type Phase = "idle" | "first" | "firstMenu" | "second" | "secondMenu" | "allDone" | "projectMenu" | "done";
-
-const INITIAL: Record<IssueId, IssueStatus> = {
- "OPS-41": "done",
- "OPS-42": "in_review",
- "OPS-43": "done",
- "OPS-44": "todo",
-};
-
-// Which issue each phase works on, and the status its menu accepts.
-const SCRIPT: Partial<Record<Phase, { issue: IssueId; to: IssueStatus; menu: boolean }>> = {
- first: { issue: "OPS-42", to: "done", menu: false },
- firstMenu: { issue: "OPS-42", to: "done", menu: true },
- second: { issue: "OPS-44", to: "cancelled", menu: false },
- secondMenu: { issue: "OPS-44", to: "cancelled", menu: true },
-};
-
export function ProjectDemo() {
const t = useDemoCopy(copy);
- const [frameRef, visible] = useStartWhenVisible<HTMLElement>();
- const [phase, setPhase] = useState<Exclude<Phase, "idle">>("first");
- const [statuses, setStatuses] = useState(INITIAL);
- const [projectStatus, setProjectStatus] = useState<ProjectStatus>("in_progress");
-
- const shownPhase: Phase = visible ? phase : "idle";
- const ids = Object.keys(statuses) as IssueId[];
- const done = ids.filter((id) => statuses[id] === "done").length;
- const scope = ids.filter((id) => statuses[id] !== "cancelled").length;
- const percent = scope > 0 ? Math.floor((done / scope) * 100) : 0;
- const step = visible ? SCRIPT[phase] : undefined;
-
- const toggleMenu = () => {
- if (phase === "first") setPhase("firstMenu");
- else if (phase === "firstMenu") setPhase("first");
- else if (phase === "second") setPhase("secondMenu");
- else if (phase === "secondMenu") setPhase("second");
- };
-
- const pickIssue = (id: IssueId, to: IssueStatus) => {
- setStatuses((current) => ({ ...current, [id]: to }));
- setPhase(id === "OPS-42" ? "second" : "allDone");
- };
-
- const replay = () => {
- setPhase("first");
- setStatuses(INITIAL);
- setProjectStatus("in_progress");
- };
-
- const projectMenuOpen = phase === "projectMenu";
-
- return (
- <DemoFrame frameRef={frameRef} title={t.title} caption={t.captions[shownPhase]} onReplay={replay}>
- <div className="flex min-h-96 flex-col gap-3 p-4">
- <div className="flex items-center gap-2">
- <FolderKanban aria-hidden className="size-4 text-muted-foreground" />
- <span className="text-body font-medium">{t.project}</span>
- </div>
-
- <dl className="grid grid-cols-[auto_1fr] items-center gap-x-6 gap-y-2 text-body">
- <dt className="text-caption text-muted-foreground">{t.statusLabel}</dt>
- <dd className="relative">
- <CoachMark active={visible && phase === "allDone"} side="right" ringClassName="rounded-md">
- <button
- type="button"
- aria-haspopup="listbox"
- aria-expanded={projectMenuOpen}
- disabled={!visible || (phase !== "allDone" && phase !== "projectMenu")}
- onClick={() => setPhase(projectMenuOpen ? "allDone" : "projectMenu")}
- className="-mx-1.5 inline-flex h-7 items-center gap-1.5 rounded-md px-1.5 hover:bg-muted disabled:hover:bg-transparent"
- >
- <span key={projectStatus} className="motion-safe:animate-in motion-safe:fade-in">
- {t.projectStatus[projectStatus]}
- </span>
- {(phase === "allDone" || projectMenuOpen) && (
- <ChevronDown aria-hidden className="size-3.5 text-muted-foreground" />
- )}
- </button>
- </CoachMark>
- {projectMenuOpen && (
- <div
- role="listbox"
- aria-label={t.statusLabel}
- className="absolute top-full left-0 z-10 mt-1 w-40 rounded-lg border bg-popover p-1 text-popover-foreground shadow-md motion-safe:animate-in motion-safe:fade-in"
- >
- {PROJECT_MENU.map((s) => (
- <CoachMark quiet key={s} active={s === "completed"} ringClassName="rounded-md" className="flex w-full">
- <button
- type="button"
- role="option"
- aria-selected={s === projectStatus}
- disabled={s !== "completed"}
- onClick={() => {
- setProjectStatus("completed");
- setPhase("done");
- }}
- className="flex w-full items-center gap-2 rounded-md px-2 py-1 text-left text-body hover:bg-accent disabled:opacity-45 disabled:hover:bg-transparent"
- >
- <span className="min-w-0 flex-1 truncate">{t.projectStatus[s]}</span>
- {s === projectStatus && <span className="text-caption text-muted-foreground">✓</span>}
- </button>
- </CoachMark>
- ))}
- </div>
- )}
- </dd>
- <dt className="text-caption text-muted-foreground">{t.leadLabel}</dt>
- <dd className="flex items-center gap-1.5">
- <DemoAvatar name={t.you} />
- {t.you}
- </dd>
- <dt className="text-caption text-muted-foreground">{t.progressLabel}</dt>
- <dd className="flex min-w-0 items-center gap-2">
- <span
- role="progressbar"
- aria-label={t.progressLabel}
- aria-valuenow={percent}
- aria-valuemin={0}
- aria-valuemax={100}
- className="h-1.5 w-full max-w-40 overflow-hidden rounded-full bg-muted"
- >
- <span
- className="block h-full rounded-full bg-success transition-[width] duration-500"
- style={{ width: `${percent}%` }}
- />
- </span>
- <span key={done} className="shrink-0 text-caption tabular-nums text-muted-foreground motion-safe:animate-in motion-safe:fade-in">
- {done}/{scope} · {percent}%
- </span>
- </dd>
- </dl>
-
- <ul className="rounded-lg border bg-background">
- {ids.map((id) => {
- const s = statuses[id];
- const active = step?.issue === id;
- const menuOpen = active && step.menu;
- return (
- <li key={id} className="relative m-0 flex min-h-10 items-center gap-2 border-b px-3 py-1.5 last:border-b-0">
- <span className="w-14 shrink-0 text-caption tabular-nums text-muted-foreground">{id}</span>
- <span
- className={cn(
- "min-w-0 flex-1 truncate text-body",
- s === "cancelled" && "text-muted-foreground line-through",
- )}
- >
- {t.issues[id]}
- </span>
- <CoachMark quiet active={active && !step.menu} ringClassName="rounded-md">
- <button
- type="button"
- aria-haspopup="listbox"
- aria-expanded={menuOpen}
- disabled={!active}
- onClick={toggleMenu}
- className="inline-flex h-7 shrink-0 items-center gap-1.5 rounded-md px-1.5 text-caption hover:bg-muted disabled:hover:bg-transparent"
- >
- <span aria-hidden className={cn("size-2.5 rounded-full border-2", issueDot[s])} />
- <span key={s} className="motion-safe:animate-in motion-safe:fade-in">
- {t.issueStatus[s]}
- </span>
- {active && <ChevronDown aria-hidden className="size-3 text-muted-foreground" />}
- </button>
- </CoachMark>
- {menuOpen && (
- <div
- role="listbox"
- aria-label={t.statusLabel}
- className={cn(
- "absolute right-2 z-10 w-36 rounded-lg border bg-popover p-1 text-popover-foreground shadow-md motion-safe:animate-in motion-safe:fade-in",
- // The last row opens upward so the menu stays inside the frame.
- id === ids[ids.length - 1] ? "bottom-full mb-1" : "top-full mt-1",
- )}
- >
- {ISSUE_MENU.map((option) => (
- <CoachMark quiet key={option} active={option === step.to} ringClassName="rounded-md" className="flex w-full">
- <button
- type="button"
- role="option"
- aria-selected={option === s}
- disabled={option !== step.to}
- onClick={() => pickIssue(id, option)}
- className="flex w-full items-center gap-2 rounded-md px-2 py-1 text-left text-body hover:bg-accent disabled:opacity-45 disabled:hover:bg-transparent"
- >
- <span aria-hidden className={cn("size-3 shrink-0 rounded-full border-2", issueDot[option])} />
- <span className="min-w-0 flex-1 truncate">{t.issueStatus[option]}</span>
- {option === s && <span className="text-caption text-muted-foreground">✓</span>}
- </button>
- </CoachMark>
- ))}
- </div>
- )}
- </li>
- );
- })}
- </ul>
-
- <div className="rounded-lg bg-muted/40 px-3 py-2">
- <div className="text-caption text-muted-foreground">{t.descriptionLabel}</div>
- <p className="mt-0.5 text-caption">{t.description}</p>
- <p className="mt-1 text-micro text-muted-foreground">{t.descriptionHint}</p>
- </div>
- </div>
- </DemoFrame>
- );
+ const meta = CLIP_MANIFEST.project ?? { duration: 5.5, chapters: [] };
+ const chapters = t.chapters.map((label, i) => ({
+ label,
+ at: meta.chapters[i]?.at ?? (i * meta.duration) / t.chapters.length,
+ }));
+ return <EditorialClip slug="project" title={t.title} chapters={chapters} duration={meta.duration} caption={t.caption} />;
}
diff --git a/apps/docs/components/demos/provider-picker-demo.tsx b/apps/docs/components/demos/provider-picker-demo.tsx
index 3dc1b23ab1..42d4e531fc 100644
--- a/apps/docs/components/demos/provider-picker-demo.tsx
+++ b/apps/docs/components/demos/provider-picker-demo.tsx
@@ -3,170 +3,123 @@
import { useState } from "react";
import { Check, Cpu, History, Plug } from "@multica/ui/icons";
import { cn } from "@multica/ui/lib/utils";
-import { CoachMark, DemoFrame, useDemoCopy, useStartWhenVisible } from "./demo-kit";
+import { EditorialUtility, useDemoCopy } from "./demo-kit";
import { TOOLS } from "./provider-picker-tools";
type Need = "resume" | "mcp" | "model";
const NEEDS: Need[] = ["resume", "mcp", "model"];
-
const needIcon: Record<Need, typeof History> = { resume: History, mcp: Plug, model: Cpu };
const copy = {
en: {
- title: "Filter AI coding tools by what you need",
- needsLabel: "I need",
+ title: "Filter AI coding tools by capability",
needs: {
resume: "Session resumption",
mcp: "Multica-managed MCP",
model: "Model picked in Multica",
} as Record<Need, string>,
- toolsLabel: "Tools",
- matching: (n: number, total: number) => `Matching tools: ${n} of ${total}`,
- captions: {
- idle: "Each tool supports a different mix of these three things.",
- start: "Click what you need. You can pick more than one.",
- picked: (n: number) => `${n} tools meet every need you picked. Click a need again to drop it.`,
- none: "No tool meets all of these. Drop one and look again.",
- },
+ matching: (n: number, total: number) => `${n} / ${total} tools`,
+ none: "No tool matches all selected capabilities.",
},
zh: {
- title: "按需求筛选 AI 编程工具",
- needsLabel: "我需要",
+ title: "按能力筛选 AI 编程工具",
needs: {
resume: "会话恢复",
mcp: "Multica 管理 MCP",
model: "在 Multica 选模型",
} as Record<Need, string>,
- toolsLabel: "工具",
- matching: (n: number, total: number) => `符合的工具 ${n} 个(共 ${total} 个)`,
- captions: {
- idle: "这三项能力,每个工具支持的组合都不一样。",
- start: "点选你需要的能力,可以多选。",
- picked: (n: number) => `${n} 个工具满足你选的全部需求。再点一次可以取消。`,
- none: "没有工具同时满足这些需求,去掉一项再看。",
- },
+ matching: (n: number, total: number) => `匹配 ${n} / ${total} 款工具`,
+ none: "没有工具同时满足已选的全部能力。",
+ },
+ "zh-Hant": {
+ title: "按能力篩選 AI 程式設計工具",
+ needs: {
+ resume: "工作階段恢復",
+ mcp: "Multica 管理 MCP",
+ model: "在 Multica 選模型",
+ } as Record<Need, string>,
+ matching: (n: number, total: number) => `符合 ${n} / ${total} 款工具`,
+ none: "沒有工具同時滿足已選的全部能力。",
},
ja: {
- title: "必要な機能で AI コーディングツールを絞り込む",
- needsLabel: "必要なもの",
+ title: "対応機能で AI コーディングツールを絞り込む",
needs: {
resume: "セッション再開",
mcp: "Multica による MCP 管理",
model: "Multica でのモデル選択",
} as Record<Need, string>,
- toolsLabel: "ツール",
- matching: (n: number, total: number) => `条件に合うツール: ${n} 個(全 ${total} 個)`,
- captions: {
- idle: "この 3 つの機能の組み合わせは、ツールごとに異なります。",
- start: "必要なものをクリックします。複数選べます。",
- picked: (n: number) => `選んだ条件をすべて満たすツールは ${n} 個です。もう一度クリックすると外せます。`,
- none: "すべてを満たすツールはありません。条件を 1 つ外して見直してください。",
- },
+ matching: (n: number, total: number) => `${n} / ${total} ツール`,
+ none: "選択した条件をすべて満たすツールはありません。",
},
ko: {
- title: "필요한 기능으로 AI 코딩 도구 고르기",
- needsLabel: "필요한 기능",
+ title: "지원 기능으로 AI 코딩 도구 필터링",
needs: {
resume: "세션 복원",
mcp: "Multica의 MCP 관리",
model: "Multica에서 모델 선택",
} as Record<Need, string>,
- toolsLabel: "도구",
- matching: (n: number, total: number) => `조건에 맞는 도구 ${n}개 (전체 ${total}개)`,
- captions: {
- idle: "이 세 가지 기능의 조합은 도구마다 다릅니다.",
- start: "필요한 기능을 클릭하세요. 여러 개를 고를 수 있습니다.",
- picked: (n: number) => `고른 조건을 모두 만족하는 도구는 ${n}개입니다. 다시 클릭하면 해제됩니다.`,
- none: "모든 조건을 만족하는 도구가 없습니다. 하나를 빼고 다시 보세요.",
- },
+ matching: (n: number, total: number) => `${n} / ${total}개 도구`,
+ none: "선택한 조건을 모두 만족하는 도구가 없습니다.",
},
fr: {
- title: "Filtrer les outils de codage IA selon vos besoins",
- needsLabel: "J'ai besoin de",
+ title: "Filtrer les outils de codage IA par capacité",
needs: {
resume: "Reprise de session",
mcp: "MCP géré par Multica",
model: "Modèle choisi dans Multica",
} as Record<Need, string>,
- toolsLabel: "Outils",
- matching: (n: number, total: number) => `Outils correspondants : ${n} sur ${total}`,
- captions: {
- idle: "Chaque outil prend en charge une combinaison différente de ces trois points.",
- start: "Cliquez sur ce dont vous avez besoin. Plusieurs choix sont possibles.",
- picked: (n: number) =>
- `${n} outils répondent à tous les besoins choisis. Cliquez de nouveau sur un besoin pour le retirer.`,
- none: "Aucun outil ne répond à tous ces besoins. Retirez-en un et regardez de nouveau.",
- },
+ matching: (n: number, total: number) => `${n} / ${total} outils`,
+ none: "Aucun outil ne répond à tous ces critères.",
},
};
export function ProviderPickerDemo() {
const t = useDemoCopy(copy);
- const [frameRef, visible] = useStartWhenVisible<HTMLElement>();
const [picked, setPicked] = useState<Need[]>([]);
const toggle = (need: Need) =>
- setPicked((current) => (current.includes(need) ? current.filter((n) => n !== need) : [...current, need]));
+ setPicked((cur) => (cur.includes(need) ? cur.filter((n) => n !== need) : [...cur, need]));
const matches = (tool: (typeof TOOLS)[number]) => picked.every((need) => tool[need]);
const count = TOOLS.filter(matches).length;
- const caption = !visible
- ? t.captions.idle
- : picked.length === 0
- ? t.captions.start
- : count === 0
- ? t.captions.none
- : t.captions.picked(count);
return (
- <DemoFrame frameRef={frameRef} title={t.title} caption={caption} onReplay={() => setPicked([])}>
- <div className="flex flex-col gap-3 p-4">
- <div className="min-w-0">
- <div id="provider-picker-needs" className="mb-1.5 text-micro text-muted-foreground">
- {t.needsLabel}
- </div>
- <div role="group" aria-labelledby="provider-picker-needs" className="flex flex-wrap gap-1.5">
- {NEEDS.map((need, i) => {
- const Icon = needIcon[need];
- const on = picked.includes(need);
- return (
- <CoachMark
- key={need}
- active={visible && picked.length === 0 && i === 0}
- quiet
- ringClassName="rounded-md"
- >
- <button
- type="button"
- aria-pressed={on}
- disabled={!visible}
- onClick={() => toggle(need)}
- className={cn(
- "inline-flex h-8 items-center gap-1.5 rounded-md border px-2.5 text-body transition-colors outline-none focus-visible:ring-3 focus-visible:ring-ring/50",
- on ? "border-brand bg-brand/10 font-medium" : "bg-background hover:bg-muted",
- )}
- >
- <Icon aria-hidden className={cn("size-3.5 shrink-0", on ? "text-brand" : "text-muted-foreground")} />
- {t.needs[need]}
- {on && <Check aria-hidden className="size-3.5 shrink-0 text-brand" />}
- </button>
- </CoachMark>
- );
- })}
- </div>
- </div>
-
- <div className="flex items-baseline justify-between gap-2 border-t pt-3">
- <span id="provider-picker-tools" className="text-micro text-muted-foreground">
- {t.toolsLabel}
- </span>
- <span key={count} className="text-label font-medium motion-safe:animate-in motion-safe:fade-in">
- {t.matching(count, TOOLS.length)}
- </span>
+ <EditorialUtility
+ title={t.title}
+ meta={<span className="font-mono tabular-nums">{t.matching(count, TOOLS.length)}</span>}
+ onReset={picked.length > 0 ? () => setPicked([]) : undefined}
+ >
+ <div className="flex flex-col gap-3.5">
+ <div role="group" aria-label={t.title} className="flex flex-wrap gap-2">
+ {NEEDS.map((need) => {
+ const Icon = needIcon[need];
+ const on = picked.includes(need);
+ return (
+ <button
+ key={need}
+ type="button"
+ aria-pressed={on}
+ onClick={() => toggle(need)}
+ className={cn(
+ "inline-flex h-8 items-center gap-1.5 rounded-[4px] border px-3 text-[0.8125rem] transition-colors focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-ring",
+ on
+ ? "border-[var(--primary)] bg-accent font-medium text-foreground"
+ : "border-border bg-card text-muted-foreground hover:border-[var(--docs-rule)] hover:text-foreground",
+ )}
+ >
+ <Icon
+ aria-hidden
+ className={cn("size-3.5 shrink-0", on ? "text-[var(--primary)]" : "text-muted-foreground")}
+ />
+ {t.needs[need]}
+ {on && <Check aria-hidden className="size-3.5 shrink-0 text-[var(--primary)]" />}
+ </button>
+ );
+ })}
</div>
- <ul aria-labelledby="provider-picker-tools" className="m-0 grid list-none grid-cols-2 gap-1.5 p-0 sm:grid-cols-3">
+ <ul className="m-0 grid list-none grid-cols-2 gap-1.5 p-0 sm:grid-cols-3">
{TOOLS.map((tool) => {
const hit = matches(tool);
const highlighted = hit && picked.length > 0;
@@ -174,15 +127,15 @@ export function ProviderPickerDemo() {
<li
key={tool.name}
className={cn(
- "m-0 flex min-w-0 items-center gap-1.5 rounded-md border px-2 py-1.5 transition-[opacity,background-color,border-color] duration-200",
- highlighted ? "border-brand/50 bg-brand/7 dark:bg-brand/12" : "bg-background",
- !hit && "opacity-35",
+ "m-0 flex min-w-0 items-center gap-1.5 rounded-[4px] border px-2.5 py-1.5 transition-[opacity,background-color,border-color] duration-150 motion-reduce:transition-none",
+ highlighted ? "border-[var(--primary)]/50 bg-accent/70" : "border-border bg-card",
+ !hit && "opacity-30",
)}
>
- <span className={cn("min-w-0 flex-1 truncate text-caption", highlighted && "font-medium")}>
+ <span className={cn("min-w-0 flex-1 truncate text-[0.8125rem]", highlighted && "font-medium")}>
{tool.name}
</span>
- <span className="flex shrink-0 items-center gap-0.5">
+ <span className="flex shrink-0 items-center gap-1">
{NEEDS.filter((need) => tool[need]).map((need) => {
const Icon = needIcon[need];
return (
@@ -192,7 +145,7 @@ export function ProviderPickerDemo() {
aria-label={t.needs[need]}
className={cn(
"size-3",
- picked.includes(need) ? "text-brand" : "text-muted-foreground/70",
+ picked.includes(need) ? "text-[var(--primary)]" : "text-muted-foreground/60",
)}
/>
);
@@ -202,7 +155,11 @@ export function ProviderPickerDemo() {
);
})}
</ul>
+
+ {count === 0 && (
+ <p className="text-[0.8125rem] text-muted-foreground">{t.none}</p>
+ )}
</div>
- </DemoFrame>
+ </EditorialUtility>
);
}
diff --git a/apps/docs/components/demos/quick-action-demo.tsx b/apps/docs/components/demos/quick-action-demo.tsx
index 0276a723c9..c4dfbf83e8 100644
--- a/apps/docs/components/demos/quick-action-demo.tsx
+++ b/apps/docs/components/demos/quick-action-demo.tsx
@@ -1,411 +1,47 @@
"use client";
-import { useState } from "react";
-import { ChevronRight, CircleCheck, Loader2, Zap } from "@multica/ui/icons";
-import {
- CoachMark,
- DemoAvatar,
- DemoComment,
- DemoFrame,
- DemoRun,
- DemoSendButton,
- DemoStep,
- useDemoCopy,
- useDemoTimers,
- useStartWhenVisible,
-} from "./demo-kit";
-
-type Action = { name: string; agent: string; description: string };
+import { CLIP_MANIFEST } from "./clip-manifest";
+import { EditorialClip, useDemoCopy } from "./demo-kit";
const copy = {
en: {
- title: "OPS-31 · Prepare the November customer appreciation event",
- you: "You",
- assigneeLabel: "Assignee",
- assignee: "Lei Li",
- earlier: {
- author: "Lei Li",
- body: "The venue and catering are booked. The guest list is still missing 20 people from marketing.",
- },
- section: "Quick Actions",
- actions: [
- { name: "Weekly-meeting update", agent: "Ops helper", description: "Sum up progress for the weekly meeting" },
- { name: "Draft an invitation", agent: "Writing helper", description: "Write a guest invitation" },
- ] as Action[],
- note: "/note",
- noteDescription: "Add a note — won't trigger any agents",
- prompt:
- "Turn this issue's progress so far into a weekly-meeting update: what's done, what's in progress and what needs help, a few lines each. Reply here.",
- slash: "/ Quick action",
- willStart: "Will start when sent",
- send: "Send",
- started: (name: string) => `${name} started working`,
- running: "Running",
- completed: "Completed",
- steps: ["Read the issue description and discussion", "Collect what's done and what's open", "Write the update"],
- reply:
- "Weekly-meeting update. Done: venue and catering booked. In progress: guest list. Needs help: marketing still owes 20 names.",
- captions: {
- idle: "An issue with a discussion already under way.",
- start:
- "Type / in the comment box to pick a saved action. Or click an action in the sidebar: it posts right away.",
- pick: "These are the workspace's quick actions. Pick Weekly-meeting update.",
- draft:
- "The saved request is in the draft, with @Ops helper in front of it. You can still edit it. Click send.",
- runningDraft: "Sent as your comment. Ops helper starts working on it.",
- runningSidebar: "The sidebar action posted the request at once, without a draft. Ops helper starts working on it.",
- done: "Done. The assignee and the status did not change. Use Replay to try the other entry point.",
- },
+ title: "Run a saved Quick Action from an issue",
+ chapters: ["Quick actions panel", "Pick template", "Trigger run"],
+ caption: "Quick actions save who to invoke and what prompt to send so recurring asks take one click without changing the assignee.",
},
zh: {
- title: "OPS-31 · 筹备 11 月客户答谢会",
- you: "你",
- assigneeLabel: "负责人",
- assignee: "李雷",
- earlier: {
- author: "李雷",
- body: "场地和餐饮已经订好,邀请名单还差市场部的 20 人。",
- },
- section: "快捷操作",
- actions: [
- { name: "整理成周会汇报", agent: "运营助手", description: "把进展整理成周会汇报" },
- { name: "起草邀请函", agent: "文案助手", description: "给来宾写一封邀请函" },
- ] as Action[],
- note: "/note",
- noteDescription: "添加备注——不触发任何智能体",
- prompt: "把这条任务目前的进展整理成周会汇报:已完成、进行中、需要协调的事项各列几条,回复在这里。",
- slash: "/ 快捷操作",
- willStart: "发送后开始",
- send: "发送",
- started: (name: string) => `${name} 已开始处理`,
- running: "运行中",
- completed: "已完成",
- steps: ["读取任务描述和讨论", "汇总已完成和未完成的事项", "写成周会汇报"],
- reply: "周会汇报:已完成,场地和餐饮已订好;进行中,邀请名单;需要协调,市场部还差 20 人的名单。",
- captions: {
- idle: "一条已经有讨论的任务。",
- start: "在评论框输入 / 选择保存好的操作。也可以直接点侧栏里的操作,它会立刻发布。",
- pick: "这里列出工作区的快捷操作。选择\"整理成周会汇报\"。",
- draft: "保存好的请求连同 @运营助手 放进了草稿,发送前还能修改。点击发送。",
- runningDraft: "已作为你的评论发布,运营助手开始处理。",
- runningSidebar: "侧栏里的操作不经过草稿,点击后立即发布,运营助手开始处理。",
- done: "处理完成,负责人和状态都没有变。点右上角可以换另一个入口再试。",
- },
+ title: "在任务中一键运行保存好的快捷操作",
+ chapters: ["查看快捷操作", "点击预设模板", "立即触发运行"],
+ caption: "把常用的智能体与指令存成快捷操作,在任意任务上一点即可触发,不改动当前负责人。",
+ },
+ "zh-Hant": {
+ title: "在任務中一鍵執行快捷操作",
+ chapters: ["檢視快捷操作", "點擊預設模板", "立即觸發執行"],
+ caption: "將常用的智能體與指令儲存為快捷操作,在任意任務上一鍵觸發且不改動負責人。",
},
ja: {
- title: "OPS-31 · 11 月の顧客感謝イベントを準備する",
- you: "あなた",
- assigneeLabel: "担当者",
- assignee: "李雷",
- earlier: {
- author: "李雷",
- body: "会場とケータリングは予約済みです。招待リストはマーケティング部の 20 人分がまだ足りません。",
- },
- section: "クイックアクション",
- actions: [
- {
- name: "週次ミーティング用にまとめる",
- agent: "運用アシスタント",
- description: "進捗を週次ミーティングの報告にまとめる",
- },
- { name: "招待状を下書き", agent: "ライティングアシスタント", description: "来賓向けの招待状を書く" },
- ] as Action[],
- note: "/note",
- noteDescription: "メモを追加 — エージェントをトリガーしません",
- prompt:
- "このタスクのこれまでの進捗を週次ミーティングの報告にまとめてください。完了したこと、進行中のこと、調整が必要なことをそれぞれ数行で。返信はここにお願いします。",
- slash: "/ クイックアクション",
- willStart: "送信後に作業を開始します",
- send: "送信",
- started: (name: string) => `${name} が作業を開始しました`,
- running: "実行中",
- completed: "完了",
- steps: ["タスクの説明とコメントを読む", "完了した項目と残っている項目を集める", "報告を書く"],
- reply:
- "週次報告です。完了:会場とケータリングの予約。進行中:招待リスト。要調整:マーケティング部の 20 人分の名前がまだ届いていません。",
- captions: {
- idle: "すでにコメントのやり取りが進んでいるタスクです。",
- start:
- "コメント欄に / を入力すると、保存済みのアクションを選べます。サイドバーのアクションをクリックした場合は、その場で投稿されます。",
- pick: "ワークスペースのクイックアクションが並んでいます。「週次ミーティング用にまとめる」を選びます。",
- draft:
- "保存済みの依頼が @運用アシスタント 付きで下書きに入りました。送信前に編集できます。送信をクリックします。",
- runningDraft: "あなたのコメントとして投稿され、運用アシスタントが作業を始めます。",
- runningSidebar: "サイドバーのアクションは下書きを経由せず、すぐに依頼を投稿しました。運用アシスタントが作業を始めます。",
- done: "完了しました。担当者もステータスも変わっていません。「もう一度」で別の入口も試せます。",
- },
+ title: "保存したクイックアクションをタスクから実行する",
+ chapters: ["クイックアクション", "テンプレート選択", "実行開始"],
+ caption: "よく使う依頼先とプロンプトを保存しておき、担当者を変えずにワンクリックで起動できます。",
},
ko: {
- title: "OPS-31 · 11월 고객 감사 행사 준비",
- you: "나",
- assigneeLabel: "담당자",
- assignee: "리레이",
- earlier: {
- author: "리레이",
- body: "장소와 케이터링은 예약했습니다. 초대 명단에는 아직 마케팅팀 20명이 빠져 있어요.",
- },
- section: "퀵 액션",
- actions: [
- { name: "주간 회의 보고로 정리", agent: "운영 도우미", description: "진행 상황을 주간 회의 보고로 정리" },
- { name: "초대장 초안 작성", agent: "글쓰기 도우미", description: "손님에게 보낼 초대장 작성" },
- ] as Action[],
- note: "/note",
- noteDescription: "메모 추가 — 에이전트를 트리거하지 않음",
- prompt:
- "이 태스크의 지금까지 진행 상황을 주간 회의 보고로 정리해 주세요. 완료된 일, 진행 중인 일, 조율이 필요한 일을 각각 몇 줄씩 쓰고, 답변은 여기에 남겨 주세요.",
- slash: "/ 퀵 액션",
- willStart: "전송 후 작업을 시작합니다",
- send: "보내기",
- started: (name: string) => `${name}이(가) 작업을 시작했습니다`,
- running: "실행 중",
- completed: "완료됨",
- steps: ["태스크 설명과 댓글 읽기", "완료된 일과 남은 일 정리", "보고 작성"],
- reply:
- "주간 회의 보고입니다. 완료: 장소와 케이터링 예약. 진행 중: 초대 명단. 조율 필요: 마케팅팀 20명의 명단이 아직 없습니다.",
- captions: {
- idle: "이미 댓글로 논의가 진행 중인 태스크입니다.",
- start: "댓글 입력란에 / 를 입력하면 저장된 액션을 고를 수 있습니다. 사이드바의 액션을 클릭하면 바로 게시됩니다.",
- pick: "워크스페이스의 퀵 액션 목록입니다. '주간 회의 보고로 정리'를 선택하세요.",
- draft: "저장된 요청이 @운영 도우미와 함께 초안에 들어갔습니다. 보내기 전에 고칠 수 있습니다. 보내기를 클릭하세요.",
- runningDraft: "내 댓글로 게시되었고, 운영 도우미가 작업을 시작합니다.",
- runningSidebar: "사이드바의 액션은 초안 없이 바로 요청을 게시했습니다. 운영 도우미가 작업을 시작합니다.",
- done: "완료되었습니다. 담당자와 상태는 바뀌지 않았습니다. '다시 보기'로 다른 진입점도 해 보세요.",
- },
+ title: "태스크에서 저장된 퀵 액션 실행하기",
+ chapters: ["퀵 액션 패널", "템플릿 선택", "실행 시작"],
+ caption: "자주 쓰는 요청과 대상 에이전트를 저장해 두면 담당자를 바꾸지 않고 클릭 한 번으로 실행할 수 있습니다.",
},
fr: {
- title: "OPS-31 · Préparer l'événement clients de novembre",
- you: "Vous",
- assigneeLabel: "Assigné à",
- assignee: "Lei Li",
- earlier: {
- author: "Lei Li",
- body: "Le lieu et le traiteur sont réservés. Il manque encore 20 personnes du marketing sur la liste des invités.",
- },
- section: "Actions rapides",
- actions: [
- {
- name: "Point pour la réunion hebdo",
- agent: "Assistant ops",
- description: "Résumer l'avancement pour la réunion hebdo",
- },
- { name: "Rédiger une invitation", agent: "Assistant rédaction", description: "Écrire une invitation pour les invités" },
- ] as Action[],
- note: "/note",
- noteDescription: "Ajouter une note — ne déclenchera aucun agent",
- prompt:
- "Faites le point sur l'avancement de cette tâche pour la réunion hebdo : ce qui est fait, ce qui est en cours et ce qui demande de l'aide, quelques lignes chacun. Répondez ici.",
- slash: "/ Action rapide",
- willStart: "Démarrera à l'envoi",
- send: "Envoyer",
- started: (name: string) => `${name} a commencé à travailler`,
- running: "En cours",
- completed: "Terminée",
- steps: [
- "Lire la description et la discussion de la tâche",
- "Rassembler ce qui est fait et ce qui reste",
- "Rédiger le point",
- ],
- reply:
- "Point pour la réunion hebdo. Fait : lieu et traiteur réservés. En cours : liste des invités. Besoin d'aide : le marketing doit encore fournir 20 noms.",
- captions: {
- idle: "Une tâche dont la discussion a déjà commencé.",
- start:
- "Tapez / dans la zone de commentaire pour choisir une action enregistrée. Ou cliquez sur une action dans la barre latérale : elle est publiée aussitôt.",
- pick: "Voici les actions rapides de l'espace de travail. Choisissez « Point pour la réunion hebdo ».",
- draft:
- "La demande enregistrée est dans le brouillon, précédée de @Assistant ops. Vous pouvez encore la modifier. Cliquez sur envoyer.",
- runningDraft: "Publiée comme votre commentaire. Assistant ops commence à la traiter.",
- runningSidebar:
- "L'action de la barre latérale a publié la demande aussitôt, sans brouillon. Assistant ops commence à la traiter.",
- done: "Terminé. Ni l'assigné ni le statut n'ont changé. Utilisez Rejouer pour essayer l'autre point d'entrée.",
- },
+ title: "Lancer une action rapide depuis une tâche",
+ chapters: ["Actions rapides", "Choisir modèle", "Démarrer"],
+ caption: "Enregistrez l'agent et le prompt une seule fois pour relancer la même demande en un clic.",
},
};
-type Phase = "idle" | "start" | "pick" | "draft" | "runningDraft" | "runningSidebar" | "done";
-
export function QuickActionDemo() {
const t = useDemoCopy(copy);
- const { after, clear } = useDemoTimers();
- const [frameRef, visible] = useStartWhenVisible<HTMLElement>();
- const [phase, setPhase] = useState<Exclude<Phase, "idle">>("start");
- const [posting, setPosting] = useState(false);
- const [stepsShown, setStepsShown] = useState(0);
-
- const shownPhase: Phase = visible ? phase : "idle";
- const action = t.actions[0]!;
- const posted = phase === "runningDraft" || phase === "runningSidebar" || phase === "done";
- const runActive = phase !== "done";
-
- const startRun = () => {
- t.steps.forEach((_, i) => after(600 + i * 1000, () => setStepsShown(i + 1)));
- after(600 + t.steps.length * 1000 + 600, () => setPhase("done"));
- };
-
- const send = () => {
- setPhase("runningDraft");
- startRun();
- };
-
- const runFromSidebar = () => {
- setPosting(true);
- after(500, () => {
- setPosting(false);
- setPhase("runningSidebar");
- startRun();
- });
- };
-
- const replay = () => {
- clear();
- setPhase("start");
- setPosting(false);
- setStepsShown(0);
- };
-
- const mention = <span className="font-medium text-brand">@{action.agent}</span>;
- const requestBody = (
- <>
- {mention}
- <span className="mt-1 block">{t.prompt}</span>
- </>
- );
-
- const sidebar = (
- <div className="sm:w-44 sm:shrink-0">
- <div className="mb-1 flex items-center gap-1 px-2 py-1 text-caption font-medium">
- {t.section}
- <ChevronRight aria-hidden className="size-3 rotate-90 text-muted-foreground" />
- </div>
- <div className="flex flex-col gap-0.5 pl-2">
- {t.actions.map((item, i) => (
- <button
- key={item.name}
- type="button"
- disabled={!visible || phase !== "start" || posting || i !== 0}
- onClick={runFromSidebar}
- className="flex w-full items-center gap-2 rounded-md px-2 py-1.5 text-left text-body hover:bg-accent/70 disabled:cursor-default disabled:hover:bg-transparent"
- >
- {posting && i === 0 ? (
- <Loader2 aria-hidden className="size-3.5 shrink-0 text-muted-foreground motion-safe:animate-spin" />
- ) : (
- <Zap aria-hidden className="size-3.5 shrink-0 text-muted-foreground" />
- )}
- <span className="min-w-0 flex-1 truncate">{item.name}</span>
- <DemoAvatar name={item.agent} agent />
- </button>
- ))}
- </div>
- </div>
- );
-
- return (
- <DemoFrame frameRef={frameRef} title={t.title} caption={t.captions[shownPhase]} onReplay={replay}>
- <div className="relative flex min-h-80 flex-col gap-4 p-4 sm:flex-row-reverse">
- {sidebar}
-
- <div className="flex min-w-0 flex-1 flex-col gap-3">
- <div className="flex items-center gap-2 text-caption text-muted-foreground">
- <span>{t.assigneeLabel}</span>
- <DemoAvatar name={t.assignee} />
- <span className="text-label text-foreground">{t.assignee}</span>
- </div>
-
- <DemoComment author={t.earlier.author}>{t.earlier.body}</DemoComment>
-
- {posted && (
- <>
- <DemoComment author={t.you}>{requestBody}</DemoComment>
- <DemoRun agent={action.agent} status={runActive ? t.running : t.completed} active={runActive}>
- {t.steps.slice(0, stepsShown).map((step, i) => (
- <DemoStep key={step} state={i === stepsShown - 1 && runActive ? "running" : "done"}>
- {step}
- </DemoStep>
- ))}
- </DemoRun>
- </>
- )}
-
- {phase === "done" && (
- <DemoComment author={action.agent} agent>
- {t.reply}
- </DemoComment>
- )}
-
- <div className="relative mt-auto rounded-lg border bg-background p-2">
- {phase === "pick" && (
- <div
- role="listbox"
- aria-label={t.section}
- className="absolute bottom-full left-2 z-10 mb-1 w-64 max-w-[calc(100%-1rem)] rounded-md border bg-popover py-1 text-popover-foreground shadow-md motion-safe:animate-in motion-safe:fade-in"
- >
- {[...t.actions.map((a) => ({ label: `/${a.name}`, description: a.description })), { label: t.note, description: t.noteDescription }].map(
- (item, i) => (
- <CoachMark
- quiet
- key={item.label}
- active={i === 0}
- ringClassName="rounded-md"
- className="flex w-full"
- >
- <button
- type="button"
- role="option"
- aria-selected={false}
- disabled={i !== 0}
- onClick={() => setPhase("draft")}
- className="flex w-full flex-col gap-0.5 px-3 py-1.5 text-left text-caption hover:bg-accent disabled:opacity-50 disabled:hover:bg-transparent"
- >
- <span className="font-medium">{item.label}</span>
- <span className="truncate text-muted-foreground">{item.description}</span>
- </button>
- </CoachMark>
- ),
- )}
- </div>
- )}
-
- <div className="min-h-12 px-1 text-body">
- {visible && (phase === "start" || phase === "pick") && (
- <CoachMark active={phase === "start"} side="right" ringClassName="rounded-md">
- <button
- type="button"
- disabled={phase !== "start"}
- onClick={() => setPhase("pick")}
- className="rounded-md border border-dashed border-brand/50 px-1.5 text-label font-medium text-brand hover:bg-brand/7 disabled:opacity-70"
- >
- {t.slash}
- </button>
- </CoachMark>
- )}
- {phase === "draft" && <div className="motion-safe:animate-in motion-safe:fade-in">{requestBody}</div>}
- </div>
-
- <div className="mt-1.5 flex items-center gap-2">
- {phase === "draft" && (
- <span className="inline-flex h-6 min-w-0 items-center gap-1.5 rounded-md bg-muted px-1.5 text-caption motion-safe:animate-in motion-safe:fade-in">
- <DemoAvatar name={action.agent} agent />
- <span className="truncate">{action.agent}</span>
- <span className="text-muted-foreground">· {t.willStart}</span>
- </span>
- )}
- <span className="ml-auto" />
- <CoachMark active={phase === "draft"} side="left" ringClassName="rounded-full">
- <DemoSendButton label={t.send} disabled={phase !== "draft"} onClick={send} />
- </CoachMark>
- </div>
- </div>
- </div>
-
- {phase === "runningSidebar" && (
- <div
- className="absolute right-4 bottom-4 z-20 flex items-center gap-2 rounded-lg border bg-popover px-3 py-2 text-caption text-popover-foreground shadow-md motion-safe:animate-in motion-safe:fade-in motion-safe:slide-in-from-bottom-2"
- >
- <CircleCheck aria-hidden className="size-3.5 text-success" />
- {t.started(action.agent)}
- </div>
- )}
- </div>
- </DemoFrame>
- );
+ const meta = CLIP_MANIFEST["quick-action"] ?? { duration: 5.5, chapters: [] };
+ const chapters = t.chapters.map((label, i) => ({
+ label,
+ at: meta.chapters[i]?.at ?? (i * meta.duration) / t.chapters.length,
+ }));
+ return <EditorialClip slug="quick-action" title={t.title} chapters={chapters} duration={meta.duration} caption={t.caption} />;
}
diff --git a/apps/docs/components/demos/resolve-thread-demo.tsx b/apps/docs/components/demos/resolve-thread-demo.tsx
index 2e101c0f99..231409dd59 100644
--- a/apps/docs/components/demos/resolve-thread-demo.tsx
+++ b/apps/docs/components/demos/resolve-thread-demo.tsx
@@ -1,413 +1,47 @@
"use client";
-import { type ReactNode, useState } from "react";
-import { CheckCircle2, ChevronRight, Copy, ListChevronsDownUp, MoreHorizontal } from "@multica/ui/icons";
-import { CoachMark, DemoAvatar, DemoFrame, useDemoCopy, useStartWhenVisible } from "./demo-kit";
-
-type Entry = { author: string; agent: boolean; body: string };
+import { CLIP_MANIFEST } from "./clip-manifest";
+import { EditorialClip, useDemoCopy } from "./demo-kit";
const copy = {
en: {
- title: "OPS-21 · Pick the venue for the annual party",
- root: {
- author: "Lei Li",
- agent: false,
- body: "Which venue should we book? The options are the Riverside Expo Center and the Westside Hotel.",
- } as Entry,
- replies: [
- {
- author: "Ops helper",
- agent: true,
- body: "I compared both: Riverside seats 300. Westside is 20% cheaper but seats at most 200.",
- },
- { author: "Lei Li", agent: false, body: "260 people have signed up already, so Westside is too small." },
- {
- author: "Ops helper",
- agent: true,
- body: "Then book the Riverside Expo Center: it fits all 260 and costs 12,000 more than Westside.",
- },
- ] as Entry[],
- moreActions: "Comment actions",
- resolveThread: "Resolve thread",
- resolveWithComment: "Resolve thread with comment",
- copyAction: "Copy",
- resolution: "Resolution",
- collapse: "Collapse",
- // Mirrors comment.resolve.bar / fold, with the author list the product builds.
- bar: (count: number, authors: string) => `${count} resolved comments from ${authors}`,
- fold: (count: number, authors: string) => `${count} comments from ${authors}`,
- captions: {
- idle: "A thread that has reached a decision.",
- start:
- "The thread has its answer. Open the menu on the first comment to resolve the whole thread, or open the last reply's menu to mark it as the resolution.",
- rootMenu: "Choose Resolve thread.",
- replyMenu: "Choose Resolve thread with comment: this reply becomes the thread's resolution.",
- rootResolved: "The whole thread folded into one line. Click it to read the thread again.",
- rootExpanded:
- "Nothing was lost. Collapse folds it again, and replying in the thread reopens it. Use Replay to try the other way.",
- replyResolved:
- "The first comment and the resolution stay visible, and the replies in between fold away. A thread keeps only one resolution at a time.",
- replyExpanded:
- "The resolution keeps its place in the thread, marked Resolution. Use Replay to try the other way.",
- },
+ title: "Resolve a finished comment thread",
+ chapters: ["Open thread", "Resolve action", "Collapsed summary"],
+ caption: "Resolving a thread folds settled back-and-forth into one quiet summary bar while keeping the full history expandable.",
},
zh: {
- title: "OPS-21 · 确定年会场地",
- root: {
- author: "李雷",
- agent: false,
- body: "年会场地定哪家?备选是滨江会展中心和城西酒店。",
- } as Entry,
- replies: [
- {
- author: "运营助手",
- agent: true,
- body: "两家都问过了:滨江能坐 300 人;城西报价低两成,但最多坐 200 人。",
- },
- { author: "李雷", agent: false, body: "报名已经 260 人了,城西坐不下。" },
- {
- author: "运营助手",
- agent: true,
- body: "那就定滨江会展中心:坐得下 260 人,比城西多花 1.2 万元。",
- },
- ] as Entry[],
- moreActions: "评论操作",
- resolveThread: "解决该讨论",
- resolveWithComment: "以此评论解决讨论",
- copyAction: "复制",
- resolution: "结论",
- collapse: "收起",
- bar: (count: number, authors: string) => `来自 ${authors} 的 ${count} 条已解决评论`,
- fold: (count: number, authors: string) => `来自 ${authors} 的 ${count} 条评论`,
- captions: {
- idle: "一条已经有结论的讨论。",
- start:
- "讨论有了答案。打开第一条评论的菜单可以解决整条讨论;打开最后一条回复的菜单,可以把它设为结论。",
- rootMenu: "选择\"解决该讨论\"。",
- replyMenu: "选择\"以此评论解决讨论\",这条回复会成为讨论的结论。",
- rootResolved: "整条讨论折叠成了一行。点它可以重新展开。",
- rootExpanded: "内容都还在。点\"收起\"再折叠;在讨论里继续回复会自动重新打开它。点右上角可以换另一种方式再试。",
- replyResolved: "第一条评论和结论留在原处,中间的回复折叠起来。一条讨论同时只保留一个结论。",
- replyExpanded: "结论留在原来的位置,带着\"结论\"标记。点右上角可以换另一种方式再试。",
- },
+ title: "解决已达成结论的讨论串",
+ chapters: ["查看讨论串", "标记为已解决", "折叠为简洁摘要"],
+ caption: "解决讨论后会把已定案的往复对话折叠成一行摘要,保持任务时间线清爽,同时随时可以展开回看。",
+ },
+ "zh-Hant": {
+ title: "解決已達成結論的討論串",
+ chapters: ["檢視討論串", "標記為已解決", "折疊為摘要列"],
+ caption: "解決討論後會把定案的來回對話折疊為一行摘要,維持時間線整潔且隨時可展開。",
},
ja: {
- title: "OPS-21 · 年次パーティーの会場を決める",
- root: {
- author: "李雷",
- agent: false,
- body: "パーティー会場はどちらにしますか?候補はリバーサイド展示センターとウエストサイドホテルです。",
- } as Entry,
- replies: [
- {
- author: "運用アシスタント",
- agent: true,
- body: "両方に問い合わせました。リバーサイドは 300 人まで入れます。ウエストサイドは 2 割安いものの、最大 200 人です。",
- },
- { author: "李雷", agent: false, body: "申し込みがもう 260 人なので、ウエストサイドでは入りきりません。" },
- {
- author: "運用アシスタント",
- agent: true,
- body: "それならリバーサイド展示センターにしましょう。260 人が入り、費用はウエストサイドより 12,000 多くかかります。",
- },
- ] as Entry[],
- moreActions: "コメントの操作",
- resolveThread: "スレッドを解決",
- resolveWithComment: "このコメントでスレッドを解決",
- copyAction: "コピー",
- resolution: "解決",
- collapse: "折りたたむ",
- bar: (count: number, authors: string) => `${authors} による解決済みコメント ${count} 件`,
- fold: (count: number, authors: string) => `${authors} のコメント ${count} 件`,
- captions: {
- idle: "結論が出たスレッドです。",
- start:
- "スレッドに答えが出ました。最初のコメントのメニューからはスレッド全体を解決できます。最後の返信のメニューからは、その返信をスレッドの解決にできます。",
- rootMenu: "「スレッドを解決」を選びます。",
- replyMenu: "「このコメントでスレッドを解決」を選びます。この返信がスレッドの解決になります。",
- rootResolved: "スレッド全体が 1 行に折りたたまれました。クリックすると読み返せます。",
- rootExpanded:
- "内容はそのまま残っています。「折りたたむ」でまた畳め、スレッドに返信すると自動で開き直されます。「もう一度」で別の方法も試せます。",
- replyResolved:
- "最初のコメントと解決はそのまま表示され、間の返信が折りたたまれます。1 つのスレッドに残る解決は常に 1 つだけです。",
- replyExpanded: "解決はスレッド内の元の位置に「解決」の印付きで残ります。「もう一度」で別の方法も試せます。",
- },
+ title: "結論が出たコメントスレッドを解決する",
+ chapters: ["スレッドを確認", "スレッドを解決", "折りたたまれた要約"],
+ caption: "スレッドを解決するとやり取りが 1 行に折りたたまれ、必要なときにいつでも展開できます。",
},
ko: {
- title: "OPS-21 · 연례 파티 장소 정하기",
- root: {
- author: "리레이",
- agent: false,
- body: "파티 장소는 어디로 할까요? 후보는 리버사이드 전시센터와 웨스트사이드 호텔입니다.",
- } as Entry,
- replies: [
- {
- author: "운영 도우미",
- agent: true,
- body: "두 곳 다 알아봤습니다. 리버사이드는 300명까지 앉을 수 있고, 웨스트사이드는 20% 저렴하지만 최대 200명입니다.",
- },
- { author: "리레이", agent: false, body: "벌써 260명이 신청해서 웨스트사이드는 자리가 모자라요." },
- {
- author: "운영 도우미",
- agent: true,
- body: "그럼 리버사이드 전시센터로 하죠. 260명이 모두 앉을 수 있고, 비용은 웨스트사이드보다 12,000 더 듭니다.",
- },
- ] as Entry[],
- moreActions: "댓글 작업",
- resolveThread: "스레드 해결",
- resolveWithComment: "이 댓글로 스레드 해결",
- copyAction: "복사",
- resolution: "해결",
- collapse: "접기",
- bar: (count: number, authors: string) => `${authors}님의 해결된 댓글 ${count}개`,
- fold: (count: number, authors: string) => `${authors}님의 댓글 ${count}개`,
- captions: {
- idle: "결론이 난 스레드입니다.",
- start:
- "스레드에 답이 나왔습니다. 첫 댓글의 메뉴에서는 스레드 전체를 해결할 수 있고, 마지막 답글의 메뉴에서는 그 답글을 스레드의 해결로 지정할 수 있습니다.",
- rootMenu: "'스레드 해결'을 선택하세요.",
- replyMenu: "'이 댓글로 스레드 해결'을 선택하세요. 이 답글이 스레드의 해결이 됩니다.",
- rootResolved: "스레드 전체가 한 줄로 접혔습니다. 클릭하면 다시 읽을 수 있습니다.",
- rootExpanded:
- "내용은 그대로 남아 있습니다. '접기'로 다시 접을 수 있고, 스레드에 답글을 달면 자동으로 다시 열립니다. '다시 보기'로 다른 방법도 해 보세요.",
- replyResolved: "첫 댓글과 해결은 그대로 보이고, 그 사이의 답글은 접힙니다. 한 스레드에는 해결이 하나만 남습니다.",
- replyExpanded: "해결은 스레드 안 원래 자리에 '해결' 표시와 함께 남습니다. '다시 보기'로 다른 방법도 해 보세요.",
- },
+ title: "결론이 난 댓글 스레드 해결하기",
+ chapters: ["스레드 확인", "스레드 해결", "접힌 요약 표시"],
+ caption: "스레드를 해결하면 완료된 논의가 한 줄 요약으로 접히고, 필요할 때 언제든 다시 펼칠 수 있습니다.",
},
fr: {
- title: "OPS-21 · Choisir le lieu de la soirée annuelle",
- root: {
- author: "Lei Li",
- agent: false,
- body: "Quel lieu réserve-t-on ? Les options sont le Riverside Expo Center et l'hôtel Westside.",
- } as Entry,
- replies: [
- {
- author: "Assistant ops",
- agent: true,
- body: "J'ai comparé les deux : le Riverside accueille 300 personnes. Le Westside est 20 % moins cher, mais 200 places au maximum.",
- },
- { author: "Lei Li", agent: false, body: "260 personnes sont déjà inscrites, le Westside est trop petit." },
- {
- author: "Assistant ops",
- agent: true,
- body: "Alors réservons le Riverside Expo Center : il accueille les 260 personnes et coûte 12 000 de plus que le Westside.",
- },
- ] as Entry[],
- moreActions: "Actions du commentaire",
- resolveThread: "Résoudre le fil",
- resolveWithComment: "Résoudre le fil avec un commentaire",
- copyAction: "Copier",
- resolution: "Résolution",
- collapse: "Replier",
- bar: (count: number, authors: string) => `${count} commentaires résolus de ${authors}`,
- fold: (count: number, authors: string) => `${count} commentaires de ${authors}`,
- captions: {
- idle: "Un fil qui a abouti à une décision.",
- start:
- "Le fil a sa réponse. Ouvrez le menu du premier commentaire pour résoudre tout le fil, ou celui de la dernière réponse pour en faire la résolution.",
- rootMenu: "Choisissez « Résoudre le fil ».",
- replyMenu: "Choisissez « Résoudre le fil avec un commentaire » : cette réponse devient la résolution du fil.",
- rootResolved: "Tout le fil tient maintenant sur une ligne. Cliquez dessus pour le relire.",
- rootExpanded:
- "Rien n'est perdu. « Replier » le referme, et répondre dans le fil le rouvre. Utilisez Rejouer pour essayer l'autre méthode.",
- replyResolved:
- "Le premier commentaire et la résolution restent visibles, les réponses intermédiaires sont repliées. Un fil ne garde qu'une résolution à la fois.",
- replyExpanded:
- "La résolution garde sa place dans le fil, marquée « Résolution ». Utilisez Rejouer pour essayer l'autre méthode.",
- },
+ title: "Résoudre un fil de discussion terminé",
+ chapters: ["Fil ouvert", "Résoudre", "Résumé replié"],
+ caption: "Résoudre un fil replie l'échange en une ligne tout en gardant l'historique consultable à tout moment.",
},
};
-type Phase =
- | "idle"
- | "start"
- | "rootMenu"
- | "replyMenu"
- | "rootResolved"
- | "rootExpanded"
- | "replyResolved"
- | "replyExpanded";
-
-// Distinct authors in first-seen order, joined the way the product's resolved
-// bars name them (two names fit, so no "and N others" here).
-function authorsOf(entries: Entry[]): string {
- return [...new Set(entries.map((e) => e.author))].join(", ");
-}
-
export function ResolveThreadDemo() {
const t = useDemoCopy(copy);
- const [frameRef, visible] = useStartWhenVisible<HTMLElement>();
- const [phase, setPhase] = useState<Exclude<Phase, "idle">>("start");
-
- const shownPhase: Phase = visible ? phase : "idle";
- const replay = () => setPhase("start");
-
- const lastIndex = t.replies.length - 1;
- const resolution = t.replies[lastIndex]!;
- const folded = t.replies.slice(0, lastIndex);
- const replyMode = phase === "replyResolved" || phase === "replyExpanded";
-
- const menu = (items: { label: string; onClick?: () => void }[]) => (
- <div
- role="menu"
- aria-label={t.moreActions}
- className="absolute top-full right-0 z-10 mt-1 w-52 rounded-lg border bg-popover p-1 text-popover-foreground shadow-md motion-safe:animate-in motion-safe:fade-in"
- >
- {items.map((item) => {
- const Icon = item.onClick ? CheckCircle2 : Copy;
- const row = (
- <button
- type="button"
- role="menuitem"
- disabled={!item.onClick}
- onClick={item.onClick}
- className="flex w-full items-center gap-2 rounded-md px-2 py-1.5 text-left text-body hover:bg-accent disabled:opacity-50 disabled:hover:bg-transparent"
- >
- <Icon aria-hidden className="size-3.5 shrink-0" />
- {item.label}
- </button>
- );
- return item.onClick ? (
- <CoachMark quiet
- key={item.label}
- active
- ringClassName="rounded-md"
- className="flex w-full"
- >
- {row}
- </CoachMark>
- ) : (
- <div key={item.label}>{row}</div>
- );
- })}
- </div>
- );
-
- const menuButton = (open: boolean, onClick: () => void, coach: boolean) => (
- <CoachMark active={coach} side="left" ringClassName="rounded-md">
- <button
- type="button"
- aria-label={t.moreActions}
- aria-haspopup="menu"
- aria-expanded={open}
- disabled={!visible}
- onClick={onClick}
- className="inline-flex size-6 items-center justify-center rounded-md text-muted-foreground hover:bg-muted"
- >
- <MoreHorizontal aria-hidden className="size-4" />
- </button>
- </CoachMark>
- );
-
- const rootActions =
- phase === "start" || phase === "rootMenu" ? (
- <div className="relative">
- {menuButton(phase === "rootMenu", () => setPhase(phase === "rootMenu" ? "start" : "rootMenu"), shownPhase === "start")}
- {phase === "rootMenu" &&
- menu([
- { label: t.resolveThread, onClick: () => setPhase("rootResolved") },
- { label: t.copyAction },
- ])}
- </div>
- ) : null;
-
- const resolutionActions =
- phase === "start" || phase === "replyMenu" ? (
- <div className="relative">
- {menuButton(phase === "replyMenu", () => setPhase(phase === "replyMenu" ? "start" : "replyMenu"), false)}
- {phase === "replyMenu" &&
- menu([
- { label: t.resolveWithComment, onClick: () => setPhase("replyResolved") },
- { label: t.copyAction },
- ])}
- </div>
- ) : null;
-
- const resolutionBadge = replyMode ? (
- <span className="text-caption font-medium text-success motion-safe:animate-in motion-safe:fade-in">
- {t.resolution}
- </span>
- ) : null;
-
- const thread = (
- <div className="overflow-hidden rounded-lg border bg-background motion-safe:animate-in motion-safe:fade-in">
- {(phase === "rootExpanded" || phase === "replyExpanded") && (
- <button
- type="button"
- onClick={() => setPhase(phase === "rootExpanded" ? "rootResolved" : "replyResolved")}
- className="flex w-full items-center gap-2.5 border-b border-border/50 bg-muted px-3 py-2 text-left text-body text-muted-foreground hover:bg-accent hover:text-accent-foreground"
- >
- <ListChevronsDownUp aria-hidden className="size-3.5" />
- {t.collapse}
- </button>
- )}
- <ThreadEntry entry={t.root} actions={rootActions} />
- <div className="flex flex-col gap-1 pb-2 pl-7">
- {phase === "replyResolved" ? (
- <>
- <CoachMark active side="bottom" align="end" className="flex w-full pr-3" ringClassName="rounded-md">
- <button
- type="button"
- onClick={() => setPhase("replyExpanded")}
- className="flex w-full items-center gap-2.5 rounded-md bg-muted/45 px-3 py-2 text-left text-body text-muted-foreground hover:bg-muted"
- >
- <ChevronRight aria-hidden className="size-3.5 shrink-0 rotate-90" />
- <span className="truncate">{t.fold(folded.length, authorsOf(folded))}</span>
- </button>
- </CoachMark>
- <ThreadEntry entry={resolution} badge={resolutionBadge} />
- </>
- ) : (
- t.replies.map((reply, i) => (
- <ThreadEntry
- key={reply.body}
- entry={reply}
- badge={i === lastIndex ? resolutionBadge : null}
- actions={i === lastIndex ? resolutionActions : null}
- />
- ))
- )}
- </div>
- </div>
- );
-
- return (
- <DemoFrame frameRef={frameRef} title={t.title} caption={t.captions[shownPhase]} onReplay={replay}>
- <div className="flex min-h-80 flex-col gap-3 p-4">
- {phase === "rootResolved" ? (
- <CoachMark active side="bottom" align="start" className="mt-1 flex w-full" ringClassName="rounded-lg">
- <button
- type="button"
- onClick={() => setPhase("rootExpanded")}
- className="flex w-full items-center justify-between gap-2 rounded-lg border bg-background px-3 py-3 text-left hover:bg-muted/50 motion-safe:animate-in motion-safe:fade-in"
- >
- <span className="flex min-w-0 items-center gap-2.5 text-body text-muted-foreground">
- <CheckCircle2 aria-hidden className="size-4 shrink-0" />
- <span className="truncate">{t.bar(1 + t.replies.length, authorsOf([t.root, ...t.replies]))}</span>
- </span>
- <ChevronRight aria-hidden className="size-3.5 shrink-0 rotate-90 text-muted-foreground" />
- </button>
- </CoachMark>
- ) : (
- thread
- )}
- </div>
- </DemoFrame>
- );
-}
-
-function ThreadEntry({ entry, badge, actions }: { entry: Entry; badge?: ReactNode; actions?: ReactNode }) {
- return (
- <div className="min-w-0 px-3 py-2">
- <div className="flex min-h-6 items-center gap-2">
- <DemoAvatar name={entry.author} agent={entry.agent} />
- <span className="truncate text-label font-medium">{entry.author}</span>
- {badge}
- <span className="ml-auto" />
- {actions}
- </div>
- <div className="mt-0.5 pl-7 text-body break-words">{entry.body}</div>
- </div>
- );
+ const meta = CLIP_MANIFEST["resolve-thread"] ?? { duration: 5.5, chapters: [] };
+ const chapters = t.chapters.map((label, i) => ({
+ label,
+ at: meta.chapters[i]?.at ?? (i * meta.duration) / t.chapters.length,
+ }));
+ return <EditorialClip slug="resolve-thread" title={t.title} chapters={chapters} duration={meta.duration} caption={t.caption} />;
}
diff --git a/apps/docs/components/demos/roles-demo.tsx b/apps/docs/components/demos/roles-demo.tsx
index 1a7913e42c..6bd784de12 100644
--- a/apps/docs/components/demos/roles-demo.tsx
+++ b/apps/docs/components/demos/roles-demo.tsx
@@ -1,17 +1,16 @@
"use client";
import { useState } from "react";
-import { Check, Crown, Minus, MoreHorizontal, Plus, Shield, User, UserMinus } from "@multica/ui/icons";
-import { Button } from "@multica/ui/components/ui/button";
+import { Check, Crown, Minus, Shield, User } from "@multica/ui/icons";
import { cn } from "@multica/ui/lib/utils";
-import { CoachMark, DemoAvatar, DemoFrame, useDemoCopy, useStartWhenVisible } from "./demo-kit";
+import { EditorialUtility, useDemoCopy } from "./demo-kit";
type Role = "owner" | "admin" | "member";
const ROLES: Role[] = ["owner", "admin", "member"];
+const ROLE_ICONS = { owner: Crown, admin: Shield, member: User } as const;
-// Mirrors the role matrix on the members & roles page and the server checks in
-// server/internal/handler/workspace.go and invitation.go.
+// Mirrors the server checks in server/internal/handler/workspace.go & invitation.go.
const CAN: Role[][] = [
["owner", "admin", "member"],
["owner", "admin"],
@@ -21,415 +20,174 @@ const CAN: Role[][] = [
["owner"],
];
-const ROLE_ICONS = { owner: Crown, admin: Shield, member: User } as const;
-
const copy = {
en: {
- title: "Settings · Members",
- yourRole: "Your role",
+ title: "Compare workspace roles",
roles: {
- owner: { label: "Owner", description: "Full access, manage all settings" },
- admin: { label: "Admin", description: "Manage members and settings" },
- member: { label: "Member", description: "Create and work on issues" },
- } as Record<Role, { label: string; description: string }>,
- canDo: "What this role can do",
+ owner: { label: "Owner", desc: "Full control, including ownership transfer and deletion." },
+ admin: { label: "Admin", desc: "Manage members, invitations, workflows, and settings." },
+ member: { label: "Member", desc: "Create and collaborate on issues, projects, and agents." },
+ } as Record<Role, { label: string; desc: string }>,
abilities: [
- "View the workspace and take part in everyday work",
- "Change workspace settings",
- "Invite an admin or member",
+ "View workspace, create issues, comment, and run permitted agents",
+ "Edit workspace settings, repositories, and workflows",
+ "Invite new admins, members, or project guests",
"Change or remove an admin or member",
- "Grant, revoke or remove owner",
+ "Grant, revoke, or remove Owner",
"Delete the workspace",
],
- members: "Members",
- invite: "Invite member",
- readOnlyTitle: "View only",
- readOnlyBody: "Only workspace owners and admins can change these settings.",
- you: "You",
- people: { owner: "Meimei Han", other: "Lei Li" },
- actions: (name: string) => `${name} actions`,
- changeRole: "Change role",
- remove: "Remove from workspace",
- roleUpdated: "Role updated",
- captions: {
- idle: "The members page as a member sees it.",
- member: "A member creates issues and comments like everyone else, but can only view the settings. Click Admin.",
- admin: "An admin also changes settings, invites people and manages members. Meimei Han is an owner, so her row has no menu. Open the menu next to Lei Li.",
- menu: "An admin can move people between admin and member only, so Owner is not in the list. Pick Admin.",
- changed: "The change takes effect right away. Click Owner to see what only an owner can do.",
- owner: "An owner can also grant and revoke owner and delete the workspace. A workspace always keeps at least one owner. Switch roles to compare, or use Replay.",
- },
+ note: "A workspace always keeps at least one Owner. Guests are scoped strictly to the projects shared with them.",
},
zh: {
- title: "设置 · 成员",
- yourRole: "你的角色",
+ title: "工作区角色权限对照",
roles: {
- owner: { label: "所有者", description: "完全访问权限,可管理所有设置" },
- admin: { label: "管理员", description: "管理成员与设置" },
- member: { label: "成员", description: "创建并处理任务" },
- } as Record<Role, { label: string; description: string }>,
- canDo: "这个角色能做的事",
+ owner: { label: "所有者 (Owner)", desc: "完全权限,包含授予/收回所有者与删除工作区。" },
+ admin: { label: "管理员 (Admin)", desc: "管理成员、邀请、工作流与工作区设置。" },
+ member: { label: "成员 (Member)", desc: "参与日常协作,创建任务、评论与运行有权限的智能体。" },
+ } as Record<Role, { label: string; desc: string }>,
abilities: [
- "查看工作区并参与日常协作",
- "修改工作区设置",
- "邀请 admin 或 member",
- "调整或移除 admin、member",
- "授予、收回或移除 owner",
+ "查看工作区、创建任务、评论并调用有权限的智能体",
+ "修改工作区设置、仓库连接与工作流",
+ "邀请管理员、成员或项目访客(Guest)",
+ "调整或移除管理员与成员",
+ "授予、收回或移除所有者角色",
"删除工作区",
],
- members: "成员",
- invite: "邀请成员",
- readOnlyTitle: "你只能查看此页",
- readOnlyBody: "只有工作区所有者和管理员可以修改这些设置。",
- you: "你",
- people: { owner: "韩梅梅", other: "李雷" },
- actions: (name: string) => `${name} 的操作`,
- changeRole: "更改角色",
- remove: "从工作区移除",
- roleUpdated: "已更新角色",
- captions: {
- idle: "以成员身份打开的成员页。",
- member: "成员和其他人一样创建任务、发表评论,但设置只能查看。点击管理员。",
- admin: "管理员多了修改设置、邀请和管理成员的权限。韩梅梅是所有者,她那一行没有操作菜单。打开李雷旁边的菜单。",
- menu: "管理员只能在管理员和成员之间调整,列表里没有所有者。选择管理员。",
- changed: "角色立即生效。点击所有者,看看只有 owner 能做的事。",
- owner: "所有者还能授予、收回 owner,也能删除工作区;工作区至少要保留一位所有者。可以切换角色再对比,或点右上角重新演示。",
- },
+ note: "工作区至少保留一位所有者;访客(Guest)仅可访问被明确共享的项目。",
+ },
+ "zh-Hant": {
+ title: "工作區角色權限對照",
+ roles: {
+ owner: { label: "擁有者 (Owner)", desc: "完整權限,包含授予/收回擁有者與刪除工作區。" },
+ admin: { label: "管理員 (Admin)", desc: "管理成員、邀請、工作流與工作區設定。" },
+ member: { label: "成員 (Member)", desc: "參與日常協作,建立任務、評論與執行有權限的智能體。" },
+ } as Record<Role, { label: string; desc: string }>,
+ abilities: [
+ "檢視工作區、建立任務、評論並呼叫有權限的智能體",
+ "修改工作區設定、倉庫連接與工作流",
+ "邀請管理員、成員或專案訪客(Guest)",
+ "調整或移除管理員與成員",
+ "授予、收回或移除擁有者角色",
+ "刪除工作區",
+ ],
+ note: "工作區至少保留一位擁有者;訪客(Guest)僅可存取被明確共享的專案。",
},
ja: {
- title: "設定 · メンバー",
- yourRole: "あなたのロール",
+ title: "ワークスペースロールの権限比較",
roles: {
- owner: { label: "オーナー", description: "フルアクセス、すべての設定を管理" },
- admin: { label: "管理者", description: "メンバーと設定を管理" },
- member: { label: "メンバー", description: "タスクの作成と作業" },
- } as Record<Role, { label: string; description: string }>,
- canDo: "このロールでできること",
+ owner: { label: "オーナー", desc: "オーナー権限の付与・剥奪やワークスペース削除を含むフルアクセス。" },
+ admin: { label: "管理者", desc: "メンバー、招待、ワークフロー、設定を管理。" },
+ member: { label: "メンバー", desc: "タスク作成、コメント、許可されたエージェントの実行。" },
+ } as Record<Role, { label: string; desc: string }>,
abilities: [
- "ワークスペースの閲覧と日常のコラボレーション",
- "ワークスペース設定の変更",
- "admin または member の招待",
- "admin、member の変更・削除",
- "owner の付与・剥奪・削除",
+ "ワークスペースの閲覧、タスク作成、コメント、エージェント実行",
+ "ワークスペース設定・リポジトリ・ワークフローの変更",
+ "管理者・メンバー・プロジェクトゲストの招待",
+ "管理者およびメンバーの変更・削除",
+ "オーナー権限の付与・剥奪・削除",
"ワークスペースの削除",
],
- members: "メンバー",
- invite: "メンバーを招待",
- readOnlyTitle: "閲覧のみ",
- readOnlyBody: "これらの設定を変更できるのはワークスペースのオーナーと管理者だけです。",
- you: "あなた",
- people: { owner: "韓梅梅", other: "李雷" },
- actions: (name: string) => `${name} の操作`,
- changeRole: "ロールを変更",
- remove: "ワークスペースから削除",
- roleUpdated: "ロールを更新しました",
- captions: {
- idle: "メンバーの立場で開いたメンバーページ。",
- member: "メンバーもほかの人と同じようにタスクを作り、コメントできますが、設定は閲覧だけです。管理者をクリックしてください。",
- admin: "管理者は設定の変更、招待、メンバー管理もできます。韓梅梅はオーナーなので、その行には操作メニューがありません。李雷の横のメニューを開いてください。",
- menu: "管理者が切り替えられるのは管理者とメンバーの間だけなので、一覧にオーナーはありません。管理者を選んでください。",
- changed: "変更はすぐに反映されます。オーナーをクリックして、オーナーだけができることを見てみましょう。",
- owner: "オーナーは owner の付与・剥奪やワークスペースの削除もできます。ワークスペースには常に 1 人以上のオーナーが必要です。ロールを切り替えて比べるか、右上から最初に戻せます。",
- },
+ note: "ワークスペースには常に 1 名以上のオーナーが必要です。ゲストは共有プロジェクトのみ閲覧できます。",
},
ko: {
- title: "설정 · 멤버",
- yourRole: "내 역할",
+ title: "워크스페이스 역할별 권한 비교",
roles: {
- owner: { label: "소유자", description: "전체 접근 권한, 모든 설정 관리" },
- admin: { label: "관리자", description: "멤버와 설정 관리" },
- member: { label: "멤버", description: "태스크 생성 및 작업" },
- } as Record<Role, { label: string; description: string }>,
- canDo: "이 역할로 할 수 있는 일",
+ owner: { label: "소유자", desc: "소유권 부여·회수 및 워크스페이스 삭제 포함 전체 권한." },
+ admin: { label: "관리자", desc: "멤버, 초대, 워크플로 및 워크스페이스 설정 관리." },
+ member: { label: "멤버", desc: "태스크 생성, 댓글 작성 및 허용된 에이전트 실행." },
+ } as Record<Role, { label: string; desc: string }>,
abilities: [
- "워크스페이스를 보고 일상적인 협업에 참여",
- "워크스페이스 설정 변경",
- "admin 또는 member 초대",
- "admin, member의 역할 변경 또는 제거",
- "owner 부여, 회수 또는 제거",
+ "워크스페이스 보기, 태스크 생성, 댓글 및 허용된 에이전트 실행",
+ "워크스페이스 설정, 저장소 및 워크플로 변경",
+ "관리자·멤버·프로젝트 게스트 초대",
+ "관리자 및 멤버 역할 변경 또는 제거",
+ "소유자 권한 부여, 회수 또는 제거",
"워크스페이스 삭제",
],
- members: "멤버",
- invite: "멤버 초대",
- readOnlyTitle: "보기 전용",
- readOnlyBody: "이 설정은 워크스페이스 소유자와 관리자만 변경할 수 있습니다.",
- you: "나",
- people: { owner: "한메이메이", other: "리레이" },
- actions: (name: string) => `${name} 작업`,
- changeRole: "역할 변경",
- remove: "워크스페이스에서 제거",
- roleUpdated: "역할을 업데이트했습니다",
- captions: {
- idle: "멤버로 연 멤버 페이지입니다.",
- member: "멤버도 다른 사람처럼 태스크를 만들고 댓글을 달 수 있지만, 설정은 보기만 할 수 있습니다. 관리자를 클릭하세요.",
- admin: "관리자는 설정 변경, 초대, 멤버 관리까지 할 수 있습니다. 한메이메이는 소유자라서 그 행에는 작업 메뉴가 없습니다. 리레이 옆의 메뉴를 여세요.",
- menu: "관리자는 관리자와 멤버 사이에서만 바꿀 수 있어 목록에 소유자가 없습니다. 관리자를 선택하세요.",
- changed: "변경은 바로 적용됩니다. 소유자를 클릭해 소유자만 할 수 있는 일을 확인하세요.",
- owner: "소유자는 owner를 부여하거나 회수하고 워크스페이스를 삭제할 수도 있습니다. 워크스페이스에는 항상 소유자가 한 명 이상 있어야 합니다. 역할을 바꿔 가며 비교하거나 오른쪽 위에서 다시 볼 수 있습니다.",
- },
+ note: "워크스페이스에는 항상 최소 1명의 소유자가 필요합니다. 게스트는 공유된 프로젝트만 볼 수 있습니다.",
},
fr: {
- title: "Paramètres · Membres",
- yourRole: "Votre rôle",
+ title: "Comparer les rôles de l'espace de travail",
roles: {
- owner: { label: "Propriétaire", description: "Accès complet, gestion de tous les paramètres" },
- admin: { label: "Administrateur", description: "Gestion des membres et des paramètres" },
- member: { label: "Membre", description: "Créer des tâches et y travailler" },
- } as Record<Role, { label: string; description: string }>,
- canDo: "Ce que ce rôle permet",
+ owner: { label: "Propriétaire", desc: "Accès complet, y compris transfert de propriété et suppression." },
+ admin: { label: "Admin", desc: "Gérer les membres, invitations, workflows et paramètres." },
+ member: { label: "Membre", desc: "Créer des tâches, commenter et lancer les agents autorisés." },
+ } as Record<Role, { label: string; desc: string }>,
abilities: [
- "Consulter l'espace de travail et collaborer au quotidien",
- "Modifier les paramètres de l'espace de travail",
- "Inviter un admin ou un member",
- "Modifier ou retirer un admin ou un member",
- "Accorder, révoquer ou retirer le rôle owner",
+ "Consulter l'espace, créer des tâches, commenter et lancer des agents autorisés",
+ "Modifier les paramètres, dépôts et workflows",
+ "Inviter des admins, membres ou invités de projet",
+ "Modifier ou retirer un admin ou un membre",
+ "Accorder, révoquer ou retirer le rôle Propriétaire",
"Supprimer l'espace de travail",
],
- members: "Membres",
- invite: "Inviter un membre",
- readOnlyTitle: "Lecture seule",
- readOnlyBody: "Seuls les propriétaires et administrateurs de l'espace de travail peuvent modifier ces paramètres.",
- you: "Vous",
- people: { owner: "Meimei Han", other: "Lei Li" },
- actions: (name: string) => `Actions pour ${name}`,
- changeRole: "Changer de rôle",
- remove: "Retirer de l'espace de travail",
- roleUpdated: "Rôle mis à jour",
- captions: {
- idle: "La page des membres, vue par un membre.",
- member: "Un membre crée des tâches et commente comme tout le monde, mais ne peut que consulter les paramètres. Cliquez sur Administrateur.",
- admin: "Un administrateur peut aussi modifier les paramètres, inviter et gérer les membres. Meimei Han est propriétaire : sa ligne n'a pas de menu. Ouvrez le menu à côté de Lei Li.",
- menu: "Un administrateur ne passe quelqu'un que d'administrateur à membre et inversement, d'où l'absence de Propriétaire dans la liste. Choisissez Administrateur.",
- changed: "Le changement s'applique immédiatement. Cliquez sur Propriétaire pour voir ce que lui seul peut faire.",
- owner: "Un propriétaire peut aussi accorder et révoquer le rôle owner, et supprimer l'espace de travail. Un espace de travail garde toujours au moins un propriétaire. Changez de rôle pour comparer, ou relancez la démo.",
- },
+ note: "Un espace conserve toujours au moins un Propriétaire. Les invités sont limités aux projets partagés.",
},
};
-type Phase = "idle" | "member" | "admin" | "menu" | "changed" | "owner";
-
export function RolesDemo() {
const t = useDemoCopy(copy);
- const [frameRef, visible] = useStartWhenVisible<HTMLElement>();
- const [phase, setPhase] = useState<Exclude<Phase, "idle">>("member");
- const [viewer, setViewer] = useState<Role>("member");
- const [changedFrom, setChangedFrom] = useState<Role | null>(null);
- const [otherRole, setOtherRole] = useState<Role>("member");
-
- const shownPhase: Phase = visible ? phase : "idle";
- const canManage = viewer === "owner" || viewer === "admin";
-
- const switchTo = (role: Role) => {
- setChangedFrom(viewer);
- setViewer(role);
- if (phase === "member" && role === "admin") setPhase("admin");
- if (phase === "changed" && role === "owner") setPhase("owner");
- };
-
- const promote = () => {
- setOtherRole("admin");
- setChangedFrom(null);
- setPhase("changed");
- };
-
- const replay = () => {
- setPhase("member");
- setViewer("member");
- setChangedFrom(null);
- setOtherRole("member");
- };
-
- // Which role chip the script waits on; once finished every chip is open.
- const nextRole: Role | null = phase === "member" ? "admin" : phase === "changed" ? "owner" : null;
- const chipEnabled = (role: Role) => visible && (phase === "owner" || role === nextRole);
-
- const roster: { key: string; name: string; role: Role; self: boolean }[] = [
- { key: "owner", name: t.people.owner, role: "owner", self: false },
- { key: "self", name: t.you, role: viewer, self: true },
- { key: "other", name: t.people.other, role: otherRole, self: false },
- ];
+ const [role, setRole] = useState<Role>("admin");
return (
- <DemoFrame frameRef={frameRef} title={t.title} caption={t.captions[shownPhase]} onReplay={replay}>
- <div className="flex min-h-96 flex-col gap-4 p-4">
- {/* Bottom padding leaves room for the coach label under the role chips. */}
- <div className="flex flex-wrap items-center gap-x-3 gap-y-2 pb-5">
- <span className="text-caption text-muted-foreground">{t.yourRole}</span>
- <div role="radiogroup" aria-label={t.yourRole} className="flex gap-1 rounded-lg bg-muted p-0.5">
- {ROLES.map((role) => {
- const Icon = ROLE_ICONS[role];
- return (
- <CoachMark
- key={role}
- active={visible && role === nextRole}
- side="bottom"
- ringClassName="rounded-md"
- >
- <button
- type="button"
- role="radio"
- aria-checked={viewer === role}
- disabled={!chipEnabled(role) && viewer !== role}
- onClick={() => viewer !== role && switchTo(role)}
- className={cn(
- "inline-flex h-7 items-center gap-1.5 rounded-md px-2.5 text-label transition-colors",
- viewer === role
- ? "bg-background font-medium text-foreground shadow-sm"
- : "text-muted-foreground hover:text-foreground disabled:hover:text-muted-foreground",
- )}
- >
- <Icon aria-hidden className="size-3.5" />
- {t.roles[role].label}
- </button>
- </CoachMark>
- );
- })}
- </div>
+ <EditorialUtility title={t.title}>
+ <div className="flex flex-col gap-4">
+ <div role="tablist" aria-label={t.title} className="grid gap-2 sm:grid-cols-3">
+ {ROLES.map((r) => {
+ const Icon = ROLE_ICONS[r];
+ const active = role === r;
+ return (
+ <button
+ key={r}
+ type="button"
+ role="tab"
+ aria-selected={active}
+ onClick={() => setRole(r)}
+ className={cn(
+ "flex flex-col gap-1 rounded-[4px] border px-3 py-2.5 text-left transition-colors focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-ring",
+ active
+ ? "border-[var(--primary)] bg-accent"
+ : "border-border bg-card hover:border-[var(--docs-rule)]",
+ )}
+ >
+ <span className="flex items-center gap-1.5 text-[0.84375rem] font-medium text-foreground">
+ <Icon
+ aria-hidden
+ className={cn("size-3.5", active ? "text-[var(--primary)]" : "text-muted-foreground")}
+ />
+ {t.roles[r].label}
+ </span>
+ <span className="text-[0.75rem] leading-[1.45] text-muted-foreground">
+ {t.roles[r].desc}
+ </span>
+ </button>
+ );
+ })}
</div>
- <div className="grid gap-4 md:grid-cols-2">
- <section className="min-w-0 rounded-lg border bg-background p-3">
- <div className="flex items-baseline justify-between gap-2">
- <div className="text-label font-medium">{t.canDo}</div>
- <code className="text-micro text-muted-foreground">{viewer}</code>
- </div>
- <p className="mt-0.5 text-caption text-muted-foreground">{t.roles[viewer].description}</p>
- <ul className="mt-2 flex flex-col gap-0.5">
- {t.abilities.map((ability, i) => {
- const allowed = CAN[i]!.includes(viewer);
- const changed = changedFrom !== null && CAN[i]!.includes(changedFrom) !== allowed;
- return (
- <li
- key={`${ability}-${viewer}`}
- className={cn(
- "m-0 flex items-start gap-2 rounded-md px-1.5 py-1 text-caption",
- allowed ? "text-foreground" : "text-muted-foreground",
- changed && allowed && "bg-success/10 motion-safe:animate-in motion-safe:fade-in",
- )}
- >
- {allowed ? (
- <Check aria-hidden className="mt-px size-3.5 shrink-0 text-success" />
- ) : (
- <Minus aria-hidden className="mt-px size-3.5 shrink-0" />
- )}
- <span className="min-w-0">{ability}</span>
- </li>
- );
- })}
- </ul>
- </section>
-
- <section className="relative min-w-0 rounded-lg border bg-background">
- <div className="flex h-11 items-center justify-between gap-2 border-b px-3">
- <div className="text-label font-medium">{t.members}</div>
- {canManage && (
- <Button type="button" size="xs" disabled tabIndex={-1} className="disabled:opacity-100">
- <Plus />
- {t.invite}
- </Button>
- )}
- </div>
- {!canManage && (
- <div className="border-b bg-muted/40 px-3 py-2">
- <div className="text-caption font-medium">{t.readOnlyTitle}</div>
- <div className="text-caption text-muted-foreground">{t.readOnlyBody}</div>
- </div>
- )}
- <ul>
- {roster.map((person) => {
- const RoleIcon = ROLE_ICONS[person.role];
- // Same rule as MemberRow in packages/views/settings/components/members-tab.tsx.
- const showMenu = canManage && !person.self && (person.role !== "owner" || viewer === "owner");
- const menuTarget = person.key === "other" && phase === "admin";
- return (
- <li key={person.key} className="relative m-0 flex h-11 items-center gap-2 px-3">
- <DemoAvatar name={person.name} />
- <span className="min-w-0 flex-1 truncate text-body">{person.name}</span>
- <span
- key={person.role}
- className="flex w-20 shrink-0 items-center gap-1 text-caption motion-safe:animate-in motion-safe:fade-in"
- >
- <RoleIcon aria-hidden className="size-3.5 text-muted-foreground" />
- {t.roles[person.role].label}
- </span>
- <span className="flex size-7 shrink-0 items-center justify-center">
- {showMenu && (
- <CoachMark active={menuTarget} side="bottom" align="end" ringClassName="rounded-md">
- <button
- type="button"
- aria-label={t.actions(person.name)}
- aria-expanded={person.key === "other" && phase === "menu"}
- disabled={!menuTarget}
- onClick={() => setPhase("menu")}
- className="inline-flex size-7 items-center justify-center rounded-md text-muted-foreground hover:bg-muted disabled:hover:bg-transparent"
- >
- <MoreHorizontal className="size-4" />
- </button>
- </CoachMark>
- )}
- </span>
- {person.key === "other" && phase === "menu" && (
- <div
- role="menu"
- aria-label={t.changeRole}
- className="absolute right-2 bottom-full z-10 mb-1 w-56 rounded-lg border bg-popover p-1 text-popover-foreground shadow-md motion-safe:animate-in motion-safe:fade-in"
- >
- <div className="flex items-center gap-1.5 px-2 pt-1 pb-0.5 text-micro text-muted-foreground">
- <Shield aria-hidden className="size-3" />
- {t.changeRole}
- </div>
- {(["admin", "member"] as const).map((role) => {
- const Icon = ROLE_ICONS[role];
- const current = otherRole === role;
- return (
- <CoachMark quiet
- key={role}
- active={role === "admin"}
- ringClassName="rounded-md"
- className="flex w-full"
- >
- <button
- type="button"
- role="menuitem"
- disabled={role !== "admin"}
- onClick={promote}
- className="flex w-full items-start gap-2 rounded-md px-2 py-1.5 text-left hover:bg-accent disabled:hover:bg-transparent"
- >
- <Icon aria-hidden className="mt-0.5 size-3.5 shrink-0" />
- <span className="flex min-w-0 flex-1 flex-col">
- <span className="text-body">{t.roles[role].label}</span>
- <span className="text-caption text-muted-foreground">
- {t.roles[role].description}
- </span>
- </span>
- {current && <span className="text-caption text-muted-foreground">✓</span>}
- </button>
- </CoachMark>
- );
- })}
- <div className="-mx-1 my-1 h-px bg-border" />
- <div className="flex items-center gap-2 px-2 py-1.5 text-body text-destructive/60">
- <UserMinus aria-hidden className="size-3.5" />
- {t.remove}
- </div>
- </div>
- )}
- </li>
- );
- })}
- </ul>
- {/* Holds the coach label under the menu button and the update toast. */}
- <div className="flex h-9 items-center justify-end border-t px-3">
- {phase === "changed" && (
- <span className="flex items-center gap-1.5 text-caption text-muted-foreground motion-safe:animate-in motion-safe:fade-in">
- <Check aria-hidden className="size-3.5 text-success" />
- {t.roleUpdated}
+ <ul className="m-0 flex list-none flex-col border-t border-border p-0">
+ {t.abilities.map((ability, i) => {
+ const allowed = CAN[i]!.includes(role);
+ return (
+ <li
+ key={ability}
+ className="m-0 flex items-center justify-between gap-4 border-b border-border py-2 text-[0.84375rem]"
+ >
+ <span className={allowed ? "text-foreground" : "text-muted-foreground/70"}>
+ {ability}
</span>
- )}
- </div>
- </section>
- </div>
+ {allowed ? (
+ <Check aria-hidden className="size-4 shrink-0 text-success" />
+ ) : (
+ <Minus aria-hidden className="size-4 shrink-0 text-muted-foreground/40" />
+ )}
+ </li>
+ );
+ })}
+ </ul>
+
+ <p className="text-[0.8125rem] leading-[1.5] text-muted-foreground">{t.note}</p>
</div>
- </DemoFrame>
+ </EditorialUtility>
);
}
diff --git a/apps/docs/components/demos/run-lifecycle-demo.tsx b/apps/docs/components/demos/run-lifecycle-demo.tsx
index 5db49541ea..892ddedd06 100644
--- a/apps/docs/components/demos/run-lifecycle-demo.tsx
+++ b/apps/docs/components/demos/run-lifecycle-demo.tsx
@@ -1,537 +1,199 @@
"use client";
-import { useCallback, useEffect, useRef, useState } from "react";
-import { Ban, CheckCircle2, ChevronRight, Loader2, RotateCcw, Square, XCircle } from "@multica/ui/icons";
-import { Button } from "@multica/ui/components/ui/button";
-import { cn } from "@multica/ui/lib/utils";
-import {
- CoachMark,
- DemoAvatar,
- DemoComment,
- DemoFrame,
- useDemoCopy,
- useDemoTimers,
- useStartWhenVisible,
-} from "./demo-kit";
+import { useState } from "react";
+import { EditorialFigure, useDemoCopy } from "./demo-kit";
-type RunStatus = "queued" | "dispatched" | "running" | "completed" | "failed" | "cancelled";
-type IssueStatus = "todo" | "in_progress" | "in_review";
-type Run = { id: number; status: RunStatus; runningSince?: number };
+type StateId = "queued" | "dispatched" | "running" | "completed" | "failed" | "cancelled";
const copy = {
en: {
- title: "OPS-21 · Compare the office-supply quotes from five suppliers",
- agent: "Ops helper",
- you: "You",
- statusLabel: "Status",
- issueStatus: { todo: "Todo", in_progress: "In Progress", in_review: "In Review" } as Record<IssueStatus, string>,
- isWorking: (name: string) => `${name} is working`,
- isQueued: (name: string) => `${name} is queued`,
- request: "@Ops helper Put the five suppliers' quotes into one comparison table.",
- trigger: "@Ops helper Put the five suppliers' quotes into one comparison table.",
- section: "Execution log",
- latest: "Latest",
- runStatus: {
- queued: "Queued",
- dispatched: "Starting",
- running: "Working",
- completed: "Completed",
- failed: "Failed",
- cancelled: "Cancelled",
- } as Record<RunStatus, string>,
- failedReason: "Rate limited by provider",
- cancelledBy: "Cancelled by You",
- duration: "1m 48s",
- retry: "Retry run",
- cancel: "Cancel run",
- dialogTitle: "Stop this run?",
- dialogBody: "The run will be cancelled and cannot be resumed. Running work may take a few seconds to fully halt.",
- keep: "Keep running",
- stop: "Stop run",
- reply:
- "The comparison table is ready: five suppliers side by side on unit price, minimum order and delivery time. Please review.",
- captions: {
- idle: "You asked Ops helper in a comment to compare the quotes.",
- queued: "The comment created a run. It waits in the queue for the runtime to claim it.",
- dispatched: "The runtime claimed the run and is starting the AI coding tool.",
- running: "Ops helper is working and moved the issue to In Progress.",
- failed:
- "The run failed: the model provider was rate limiting requests. This kind of failure is not retried automatically, so the issue went back to Todo. Click Retry run.",
- retryQueued: "Retrying created a new run. The failed one stays under Latest.",
- retryRunning: "The new run is working. To stop it midway, click the stop button; otherwise let it finish.",
- confirm: "Stopping cancels this run, and it cannot be resumed.",
- cancelled:
- "The run was cancelled. Stopping a run does not change the issue status, and a cancelled run can be retried too. Use Replay to start over.",
- done: "The new run completed and Ops helper moved the issue to In Review. Each attempt kept its own record. Use Replay to try another path.",
- },
+ kicker: "STATE MACHINE",
+ title: "Run lifecycle and retry paths",
+ retryLabel: "Manual retry → new run",
+ stopLabel: "Stop run",
+ states: {
+ queued: { label: "Queued", detail: "Created by an assignment, @mention, chat, or autopilot. Waits until the agent's bound runtime is online and free." },
+ dispatched: { label: "Starting", detail: "The online runtime claimed the run, prepared the working directory, and is launching the local AI coding tool." },
+ running: { label: "Working", detail: "The tool is actively executing. Live steps stream into the Execution log; you can steer mid-run or stop it." },
+ completed: { label: "Completed", detail: "This run finished cleanly. A completed run does not automatically mark the issue Done — status stays with the workflow." },
+ failed: { label: "Failed", detail: "Stopped with an error (e.g. provider rate limit or auth error). The failed record stays in Latest; Retry creates a fresh run." },
+ cancelled: { label: "Cancelled", detail: "Stopped manually by a member. Cancelling leaves the issue status untouched and can be retried anytime." },
+ } as Record<StateId, { label: string; detail: string }>,
},
zh: {
- title: "OPS-21 · 整理五家供应商的办公用品报价",
- agent: "运营助手",
- you: "你",
- statusLabel: "状态",
- issueStatus: { todo: "待办", in_progress: "进行中", in_review: "审核中" } as Record<IssueStatus, string>,
- isWorking: (name: string) => `${name} 在工作`,
- isQueued: (name: string) => `${name} 排队中`,
- request: "@运营助手 把五家供应商的报价整理成一张对比表。",
- trigger: "@运营助手 把五家供应商的报价整理成一张对比表。",
- section: "执行日志",
- latest: "最近",
- runStatus: {
- queued: "排队中",
- dispatched: "启动中",
- running: "正在工作",
- completed: "已完成",
- failed: "失败",
- cancelled: "已取消",
- } as Record<RunStatus, string>,
- failedReason: "受到提供商速率限制",
- cancelledBy: "已由 你 取消",
- duration: "1m 48s",
- retry: "重试运行",
- cancel: "取消运行",
- dialogTitle: "确定停止本次运行?",
- dialogBody: "本次运行会被取消且无法恢复。进行中的运行可能需要几秒才能完全停止。",
- keep: "保留运行",
- stop: "停止运行",
- reply: "对比表已整理好:五家供应商按单价、起订量和交货周期并排列出,请检查。",
- captions: {
- idle: "你在评论里请 运营助手 整理报价。",
- queued: "评论触发了一次运行,先进入队列,等运行时领取。",
- dispatched: "运行时已领取,正在启动 AI 编程工具。",
- running: "运营助手 开始工作,把任务改为进行中。",
- failed: "运行失败:模型服务限流了。这类失败不会自动重试,任务回到待办。点击重试运行。",
- retryQueued: "重试创建了一条新的运行,失败的那条留在\"最近\"里。",
- retryRunning: "新的运行正在工作。想中途停下,可以点停止按钮;不停就等它完成。",
- confirm: "停止后,这次运行会被取消,无法恢复。",
- cancelled: "运行已取消。停止运行不会改变任务状态;已取消的运行同样可以重试。点右上角可以重新演示。",
- done: "新的运行完成,运营助手 把任务改为审核中。两次运行各留一条记录。点右上角可以换一条路径再试。",
- },
+ kicker: "状态机",
+ title: "运行的生命周期与重试路径",
+ retryLabel: "手动重试 → 创建新运行",
+ stopLabel: "手动停止",
+ states: {
+ queued: { label: "排队中", detail: "由分配、@提及、对话或自动化创建,等待智能体绑定的运行时在线并空闲后领取。" },
+ dispatched: { label: "启动中", detail: "在线运行时已领取运行,正在准备本地工作目录并启动 AI 编程工具。" },
+ running: { label: "正在工作", detail: "工具正在执行,步骤实时写入执行日志;期间可以插话纠偏,也可以随时停止。" },
+ completed: { label: "已完成", detail: "本次运行正常结束。运行完成不等于任务完成,任务状态由工作流或人工验收决定。" },
+ failed: { label: "失败", detail: "因限流、凭据失效等原因中止;失败记录保留在「最近」中,点击重试会创建新运行。" },
+ cancelled: { label: "已取消", detail: "由成员手动停止;停止运行不会修改任务状态,已取消的运行同样支持重试。" },
+ } as Record<StateId, { label: string; detail: string }>,
+ },
+ "zh-Hant": {
+ kicker: "狀態機",
+ title: "執行的生命週期與重試路徑",
+ retryLabel: "手動重試 → 建立新執行",
+ stopLabel: "手動停止",
+ states: {
+ queued: { label: "排隊中", detail: "由指派、@提及、對話或自動化建立,等待綁定的執行環境上線領取。" },
+ dispatched: { label: "啟動中", detail: "執行環境已領取,正在準備工作目錄並啟動 AI 程式設計工具。" },
+ running: { label: "正在工作", detail: "工具執行中,步驟即時寫入執行日誌;期間可插話或手動停止。" },
+ completed: { label: "已完成", detail: "本次執行正常結束,不等於任務本身完成。" },
+ failed: { label: "失敗", detail: "因速率限制或憑證錯誤中止;重試會建立一條新的執行記錄。" },
+ cancelled: { label: "已取消", detail: "由成員手動停止,不改變任務狀態,且可隨時重試。" },
+ } as Record<StateId, { label: string; detail: string }>,
},
ja: {
- title: "OPS-21 · 5 社の事務用品の見積もりを比較する",
- agent: "運用アシスタント",
- you: "あなた",
- statusLabel: "ステータス",
- issueStatus: { todo: "未着手", in_progress: "進行中", in_review: "レビュー中" } as Record<IssueStatus, string>,
- isWorking: (name: string) => `${name} が作業中`,
- isQueued: (name: string) => `${name} が待機中`,
- request: "@運用アシスタント 5 社の見積もりを 1 枚の比較表にまとめてください。",
- trigger: "@運用アシスタント 5 社の見積もりを 1 枚の比較表にまとめてください。",
- section: "実行ログ",
- latest: "最新",
- runStatus: {
- queued: "待機中",
- dispatched: "開始中",
- running: "作業中",
- completed: "完了",
- failed: "失敗",
- cancelled: "キャンセル済み",
- } as Record<RunStatus, string>,
- failedReason: "プロバイダーによるレート制限",
- cancelledBy: "あなた がキャンセル",
- duration: "1m 48s",
- retry: "実行を再試行",
- cancel: "実行をキャンセル",
- dialogTitle: "この実行を停止しますか?",
- dialogBody: "実行はキャンセルされ、再開できません。実行中の処理が完全に停止するまで数秒かかる場合があります。",
- keep: "実行を続ける",
- stop: "実行を停止",
- reply: "比較表ができました。5 社を単価、最小発注数、納期で並べています。確認をお願いします。",
- captions: {
- idle: "コメントで 運用アシスタント に見積もりの比較を頼みました。",
- queued: "コメントから実行が 1 件作られ、ランタイムが受け取るまでキューで待ちます。",
- dispatched: "ランタイムが実行を受け取り、AI コーディングツールを起動しています。",
- running: "運用アシスタント が作業を始め、タスクを進行中にしました。",
- failed:
- "実行が失敗しました。モデルプロバイダーのレート制限です。この種の失敗は自動では再試行されず、タスクは未着手に戻りました。「実行を再試行」をクリックしてください。",
- retryQueued: "再試行で新しい実行が作られました。失敗した実行は「最新」に残ります。",
- retryRunning: "新しい実行が作業中です。途中で止めたいときは停止ボタンを、止めなければ完了を待ちます。",
- confirm: "停止するとこの実行はキャンセルされ、再開できません。",
- cancelled:
- "実行がキャンセルされました。実行を止めてもタスクのステータスは変わらず、キャンセルした実行も再試行できます。「もう一度」で最初から見られます。",
- done: "新しい実行が完了し、運用アシスタント がタスクをレビュー中にしました。2 回の実行はそれぞれ記録に残ります。「もう一度」で別の流れも試せます。",
- },
+ kicker: "STATE MACHINE",
+ title: "実行のライフサイクルと再試行",
+ retryLabel: "手動リトライ → 新規実行",
+ stopLabel: "停止",
+ states: {
+ queued: { label: "待機中", detail: "割り当て・@メンション・チャット・自動化で作成され、ランタイムの取得を待ちます。" },
+ dispatched: { label: "開始中", detail: "オンラインのランタイムが取得し、AI コーディングツールを起動しています。" },
+ running: { label: "作業中", detail: "実行ログに手順がリアルタイム記録されます。途中で指示を追加したり停止できます。" },
+ completed: { label: "完了", detail: "この実行は正常終了しました。タスク完了とは別管理です。" },
+ failed: { label: "失敗", detail: "レート制限などで中断。履歴は残り、リトライすると新しい実行が作成されます。" },
+ cancelled: { label: "キャンセル", detail: "メンバーが手動停止。タスクのステータスは変更されず、再試行も可能です。" },
+ } as Record<StateId, { label: string; detail: string }>,
},
ko: {
- title: "OPS-21 · 공급업체 다섯 곳의 사무용품 견적 비교",
- agent: "운영 도우미",
- you: "나",
- statusLabel: "상태",
- issueStatus: { todo: "할 일", in_progress: "진행 중", in_review: "리뷰 중" } as Record<IssueStatus, string>,
- isWorking: (name: string) => `${name} 작업 중`,
- isQueued: (name: string) => `${name} 대기 중`,
- request: "@운영 도우미 공급업체 다섯 곳의 견적을 비교표 하나로 정리해 주세요.",
- trigger: "@운영 도우미 공급업체 다섯 곳의 견적을 비교표 하나로 정리해 주세요.",
- section: "실행 로그",
- latest: "최근",
- runStatus: {
- queued: "대기 중",
- dispatched: "시작 중",
- running: "작업 중",
- completed: "완료됨",
- failed: "실패함",
- cancelled: "취소됨",
- } as Record<RunStatus, string>,
- failedReason: "공급자 요청 한도에 도달함",
- cancelledBy: "내가 취소함",
- duration: "1m 48s",
- retry: "실행 다시 시도",
- cancel: "실행 취소",
- dialogTitle: "이 실행을 중지할까요?",
- dialogBody: "실행이 취소되며 재개할 수 없습니다. 진행 중인 실행이 완전히 멈추기까지 몇 초가 걸릴 수 있습니다.",
- keep: "계속 실행",
- stop: "실행 중지",
- reply: "비교표를 정리했습니다. 다섯 곳을 단가, 최소 주문량, 납기 기준으로 나란히 놓았으니 확인해 주세요.",
- captions: {
- idle: "댓글로 운영 도우미에게 견적 비교를 요청했습니다.",
- queued: "댓글이 실행을 하나 만들었습니다. 런타임이 가져갈 때까지 대기열에서 기다립니다.",
- dispatched: "런타임이 실행을 가져가 AI 코딩 도구를 시작하고 있습니다.",
- running: "운영 도우미가 작업을 시작하고 태스크를 진행 중으로 바꿨습니다.",
- failed:
- "실행이 실패했습니다. 모델 공급자가 요청 한도를 걸었습니다. 이런 실패는 자동으로 다시 시도되지 않아 태스크가 할 일로 돌아갔습니다. 실행 다시 시도를 클릭하세요.",
- retryQueued: "다시 시도하면 새 실행이 만들어집니다. 실패한 실행은 \"최근\"에 남습니다.",
- retryRunning: "새 실행이 작업 중입니다. 중간에 멈추려면 중지 버튼을 누르고, 아니면 끝날 때까지 기다리세요.",
- confirm: "중지하면 이 실행은 취소되고 재개할 수 없습니다.",
- cancelled:
- "실행이 취소되었습니다. 실행을 중지해도 태스크 상태는 바뀌지 않으며, 취소된 실행도 다시 시도할 수 있습니다. \"다시 보기\"로 처음부터 볼 수 있습니다.",
- done: "새 실행이 완료되었고 운영 도우미가 태스크를 리뷰 중으로 바꿨습니다. 두 번의 실행이 각각 기록으로 남습니다. \"다시 보기\"로 다른 흐름도 시도해 보세요.",
- },
+ kicker: "STATE MACHINE",
+ title: "실행 생명주기와 재시도 경로",
+ retryLabel: "수동 재시도 → 새 실행",
+ stopLabel: "중지",
+ states: {
+ queued: { label: "대기 중", detail: "할당·@멘션·채팅·오토파일럿으로 생성되어 연결된 런타임이 수락하기를 기다립니다." },
+ dispatched: { label: "시작 중", detail: "온라인 런타임이 실행을 받아 작업 디렉터리와 AI 코딩 도구를 준비합니다." },
+ running: { label: "작업 중", detail: "실시간 단계가 실행 로그에 기록됩니다. 중간에 방향을 수정하거나 중지할 수 있습니다." },
+ completed: { label: "완료됨", detail: "이번 실행이 정상 종료되었습니다. 태스크 완료 여부와는 별개입니다." },
+ failed: { label: "실패", detail: "속도 제한 등으로 중단되었습니다. 기록은 유지되며 재시도 시 새 실행을 만듭니다." },
+ cancelled: { label: "취소됨", detail: "멤버가 수동 중지했습니다. 태스크 상태는 유지되며 언제든 재시도할 수 있습니다." },
+ } as Record<StateId, { label: string; detail: string }>,
},
fr: {
- title: "OPS-21 · Comparer les devis de fournitures de cinq fournisseurs",
- agent: "Assistant ops",
- you: "Vous",
- statusLabel: "Statut",
- issueStatus: { todo: "À faire", in_progress: "En cours", in_review: "En relecture" } as Record<IssueStatus, string>,
- isWorking: (name: string) => `${name} travaille`,
- isQueued: (name: string) => `${name} est en file d'attente`,
- request: "@Assistant ops Regroupe les devis des cinq fournisseurs dans un seul tableau comparatif.",
- trigger: "@Assistant ops Regroupe les devis des cinq fournisseurs dans un seul tableau comparatif.",
- section: "Journal d'exécution",
- latest: "Récentes",
- runStatus: {
- queued: "En file d'attente",
- dispatched: "Démarrage",
- running: "Au travail",
- completed: "Terminée",
- failed: "En échec",
- cancelled: "Annulée",
- } as Record<RunStatus, string>,
- failedReason: "Limite de requêtes du fournisseur atteinte",
- cancelledBy: "Annulée par Vous",
- duration: "1m 48s",
- retry: "Relancer l'exécution",
- cancel: "Annuler l'exécution",
- dialogTitle: "Arrêter cette exécution ?",
- dialogBody: "L'exécution sera annulée et ne pourra pas être reprise. Le travail en cours peut mettre quelques secondes à s'arrêter complètement.",
- keep: "Laisser tourner",
- stop: "Arrêter l'exécution",
- reply:
- "Le tableau comparatif est prêt : les cinq fournisseurs côte à côte selon le prix unitaire, la quantité minimale et le délai de livraison. Merci de vérifier.",
- captions: {
- idle: "Dans un commentaire, vous avez demandé à Assistant ops de comparer les devis.",
- queued: "Le commentaire a créé une exécution. Elle attend dans la file qu'un runtime la prenne.",
- dispatched: "Le runtime a pris l'exécution et démarre l'outil de code IA.",
- running: "Assistant ops travaille et a passé la tâche à En cours.",
- failed:
- "L'exécution a échoué : le fournisseur du modèle limitait les requêtes. Ce type d'échec n'est pas relancé automatiquement, la tâche est donc revenue à À faire. Cliquez sur Relancer l'exécution.",
- retryQueued: "La relance a créé une nouvelle exécution. Celle en échec reste sous Récentes.",
- retryRunning: "La nouvelle exécution travaille. Pour l'arrêter en cours de route, cliquez sur le bouton d'arrêt ; sinon, laissez-la finir.",
- confirm: "Arrêter annule cette exécution, sans possibilité de reprise.",
- cancelled:
- "L'exécution est annulée. Arrêter une exécution ne change pas le statut de la tâche, et une exécution annulée peut elle aussi être relancée. Rejouer recommence depuis le début.",
- done: "La nouvelle exécution est terminée et Assistant ops a passé la tâche à En relecture. Chaque tentative garde sa propre trace. Rejouer permet d'essayer un autre chemin.",
- },
+ kicker: "MACHINE D'ÉTATS",
+ title: "Cycle de vie d'une exécution et relance",
+ retryLabel: "Relance manuelle → nouvelle exécution",
+ stopLabel: "Arrêter",
+ states: {
+ queued: { label: "En file", detail: "Créée par assignation, @mention, chat ou automatisation ; attend le runtime lié." },
+ dispatched: { label: "Démarrage", detail: "Le runtime en ligne récupère l'exécution et lance l'outil de codage IA." },
+ running: { label: "En cours", detail: "Les étapes s'affichent en direct ; vous pouvez réorienter ou arrêter l'exécution." },
+ completed: { label: "Terminée", detail: "L'exécution s'est achevée. Cela ne marque pas automatiquement la tâche comme finie." },
+ failed: { label: "Échec", detail: "Interrompue par une erreur (ex. limite de débit). Relancer crée une nouvelle exécution." },
+ cancelled: { label: "Annulée", detail: "Arrêtée manuellement. Le statut de la tâche ne change pas et la relance reste possible." },
+ } as Record<StateId, { label: string; detail: string }>,
},
};
-type Phase = "idle" | "first" | "failed" | "second" | "confirm" | "cancelled" | "done";
-
-const ACTIVE: RunStatus[] = ["queued", "dispatched", "running"];
-
-const issueDot: Record<IssueStatus, string> = {
- todo: "border-muted-foreground",
- in_progress: "border-warning bg-warning/40",
- in_review: "border-brand bg-brand/40",
-};
-
-const activeTone: Partial<Record<RunStatus, string>> = {
- queued: "text-warning",
- dispatched: "text-warning",
-};
-
export function RunLifecycleDemo() {
const t = useDemoCopy(copy);
- const { after, clear } = useDemoTimers();
- const [frameRef, visible] = useStartWhenVisible<HTMLElement>();
- const [cycle, setCycle] = useState(0);
- const [phase, setPhase] = useState<Phase>("idle");
- const [runs, setRuns] = useState<Run[]>([]);
- const [issueStatus, setIssueStatus] = useState<IssueStatus>("todo");
- const [now, setNow] = useState(0);
- // Index of the next scripted step of the retried run, so closing the stop
- // dialog with "Keep running" resumes where the script paused.
- const secondStep = useRef(0);
+ const [selected, setSelected] = useState<StateId>("running");
- const setRun = useCallback((id: number, status: RunStatus) => {
- setRuns((rs) =>
- rs.map((r) => (r.id === id ? { ...r, status, runningSince: status === "running" ? Date.now() : r.runningSince } : r)),
- );
- }, []);
-
- // Opening: the first run moves through the queue and fails.
- useEffect(() => {
- if (!visible) return;
- clear();
- setPhase("first");
- setIssueStatus("todo");
- setRuns([{ id: 1, status: "queued" }]);
- after(1400, () => setRun(1, "dispatched"));
- after(2500, () => {
- setRun(1, "running");
- setIssueStatus("in_progress");
- });
- after(5500, () => {
- setRun(1, "failed");
- setIssueStatus("todo");
- setPhase("failed");
- });
- }, [visible, cycle, after, clear, setRun]);
-
- const anyRunning = runs.some((r) => r.status === "running");
- useEffect(() => {
- if (!anyRunning) return;
- setNow(Date.now());
- const id = window.setInterval(() => setNow(Date.now()), 1000);
- return () => window.clearInterval(id);
- }, [anyRunning]);
-
- const secondScript: Array<[number, () => void]> = [
- [1400, () => setRun(2, "dispatched")],
- [1100, () => {
- setRun(2, "running");
- setIssueStatus("in_progress");
- }],
- [6500, () => {
- setRun(2, "completed");
- setIssueStatus("in_review");
- setPhase("done");
- }],
- ];
-
- const playSecond = (from: number) => {
- const step = secondScript[from];
- if (!step) return;
- after(step[0], () => {
- step[1]();
- secondStep.current = from + 1;
- playSecond(from + 1);
- });
+ const accentFor = (id: StateId) => {
+ if (id === "completed") return "var(--success)";
+ if (id === "failed") return "var(--destructive)";
+ if (id === "cancelled") return "var(--muted-foreground)";
+ return "var(--primary)";
};
- const retry = () => {
- setRuns((rs) => [...rs, { id: 2, status: "queued" }]);
- setPhase("second");
- secondStep.current = 0;
- playSecond(0);
- };
-
- const openStop = () => {
- clear();
- setPhase("confirm");
- };
-
- const keepRunning = () => {
- setPhase("second");
- playSecond(secondStep.current);
- };
-
- const stopRun = () => {
- setRun(2, "cancelled");
- setPhase("cancelled");
- };
-
- const replay = () => {
- clear();
- secondStep.current = 0;
- setRuns([]);
- setIssueStatus("todo");
- setPhase("idle");
- setCycle((c) => c + 1);
+ const box = (id: StateId, x: number, y: number, w: number, h: number) => {
+ const active = selected === id;
+ const tone = accentFor(id);
+ return (
+ <g key={id} style={{ cursor: "pointer" }} onClick={() => setSelected(id)}>
+ <rect
+ x={x}
+ y={y}
+ width={w}
+ height={h}
+ rx="4"
+ fill={active ? "var(--accent)" : "var(--card)"}
+ stroke={active ? tone : "var(--border)"}
+ strokeWidth={active ? 1.6 : 1}
+ />
+ <circle cx={x + 15} cy={y + h / 2} r="3.5" fill={tone} />
+ <text
+ x={x + 26}
+ y={y + h / 2 + 4}
+ fill="var(--foreground)"
+ fontSize="12"
+ fontWeight={active ? "600" : "500"}
+ >
+ {t.states[id].label}
+ </text>
+ </g>
+ );
};
- const active = runs.filter((r) => ACTIVE.includes(r.status));
- const past = runs.filter((r) => !ACTIVE.includes(r.status)).reverse();
- const second = runs.find((r) => r.id === 2);
- const first = runs.find((r) => r.id === 1);
-
- const shownPhase: Phase = visible ? phase : "idle";
- let caption: string = t.captions.idle;
- if (shownPhase === "first" && first) {
- caption = first.status === "queued" ? t.captions.queued : first.status === "dispatched" ? t.captions.dispatched : t.captions.running;
- } else if (shownPhase === "second") {
- caption = second?.status === "running" ? t.captions.retryRunning : t.captions.retryQueued;
- } else if (shownPhase !== "idle" && shownPhase !== "first") {
- caption = t.captions[shownPhase];
- }
-
- const liveRun = active[0];
-
return (
- <DemoFrame frameRef={frameRef} title={t.title} caption={caption} onReplay={replay}>
- <div className="relative grid min-h-80 gap-4 p-4 sm:grid-cols-[minmax(0,1fr)_15rem]">
- <div className="flex min-w-0 flex-col gap-3">
- <div className="flex flex-wrap items-center gap-x-4 gap-y-2">
- <span className="flex items-center gap-2 text-body">
- <span className="text-caption text-muted-foreground">{t.statusLabel}</span>
- <span aria-hidden className={cn("size-3 rounded-full border-2 transition-colors", issueDot[issueStatus])} />
- <span key={issueStatus} className="motion-safe:animate-in motion-safe:fade-in">
- {t.issueStatus[issueStatus]}
- </span>
- </span>
- {liveRun && (
- <span className="inline-flex h-6 items-center gap-1.5 rounded-full border px-2 text-caption motion-safe:animate-in motion-safe:fade-in">
- {liveRun.status === "running" ? (
- <Loader2 aria-hidden className="size-3 text-info motion-safe:animate-spin" />
- ) : (
- <span aria-hidden className="size-1.5 rounded-full bg-warning" />
- )}
- {liveRun.status === "running" ? t.isWorking(t.agent) : t.isQueued(t.agent)}
- </span>
- )}
- </div>
- <DemoComment author={t.you}>{t.request}</DemoComment>
- {phase === "done" && (
- <DemoComment author={t.agent} agent>
- {t.reply}
- </DemoComment>
- )}
- </div>
-
- <section aria-label={t.section} className="min-w-0 rounded-lg border bg-background p-2 sm:self-start">
- <div className="mb-1 flex items-center gap-1 px-1">
- <span className="text-caption font-medium">{t.section}</span>
- <ChevronRight aria-hidden className="size-3 rotate-90 text-muted-foreground" />
- {active.length > 0 && (
- <span className="ml-auto inline-flex items-center gap-1 text-info">
- <span aria-hidden className="size-1.5 animate-pulse rounded-full bg-info" />
- <span className="font-mono text-caption tabular-nums">{active.length}</span>
- </span>
- )}
- </div>
-
- {active.map((run) => (
- <div
- key={run.id}
- className="flex min-w-0 items-center gap-2 rounded-xs px-1 py-1.5 motion-safe:animate-in motion-safe:fade-in"
- >
- <DemoAvatar name={t.agent} agent />
- <span className="min-w-0 flex-1 truncate text-caption text-muted-foreground">{t.trigger}</span>
- <span className={cn("shrink-0 text-caption tabular-nums", activeTone[run.status] ?? "text-info")}>
- {run.status === "running"
- ? `${Math.max(0, Math.round((now - (run.runningSince ?? now)) / 1000))}s`
- : t.runStatus[run.status]}
- {run.status === "running" && <span className="sr-only">{t.runStatus.running}</span>}
- </span>
- <button
- type="button"
- aria-label={t.cancel}
- title={t.cancel}
- disabled={run.id !== 2 || phase !== "second"}
- onClick={openStop}
- className="flex shrink-0 items-center justify-center rounded-xs p-1 text-destructive transition-colors hover:bg-destructive/10 disabled:cursor-not-allowed disabled:opacity-40 disabled:hover:bg-transparent"
- >
- <Square className="size-3.5" />
- </button>
- </div>
- ))}
-
- {active.length > 0 && past.length > 0 && <div className="my-1.5 border-t border-border/60" />}
-
- {past.length > 0 && (
- <>
- <div className="px-1 pt-1 pb-0.5 text-micro text-muted-foreground">{t.latest}</div>
- {past.map((run) => (
- <div
- key={run.id}
- className="flex min-w-0 items-start gap-2 rounded-xs px-1 py-1.5 motion-safe:animate-in motion-safe:fade-in"
- >
- <span className="mt-1 flex shrink-0">
- <DemoAvatar name={t.agent} agent />
- </span>
- <div className="min-w-0 flex-1">
- <div className="flex min-h-7 min-w-0 items-center gap-2">
- <span className="min-w-0 flex-1 truncate text-caption">{t.trigger}</span>
- <span title={t.runStatus[run.status]} className="flex shrink-0 items-center">
- {run.status === "completed" && <CheckCircle2 aria-hidden className="size-3.5 text-success" />}
- {run.status === "failed" && <XCircle aria-hidden className="size-3.5 text-destructive" />}
- {run.status === "cancelled" && <Ban aria-hidden className="size-3.5 text-muted-foreground" />}
- <span className="sr-only">{t.runStatus[run.status]}</span>
- </span>
- {run.status !== "completed" && (
- <CoachMark
- quiet
- active={shownPhase === "failed" && run.id === 1}
- ringClassName="rounded-md"
- >
- <button
- type="button"
- aria-label={t.retry}
- title={t.retry}
- disabled={!(phase === "failed" && run.id === 1)}
- onClick={retry}
- className="flex items-center justify-center rounded-xs p-1 text-muted-foreground transition-colors hover:bg-accent/50 hover:text-foreground disabled:cursor-not-allowed disabled:opacity-40 disabled:hover:bg-transparent"
- >
- <RotateCcw className="size-3.5" />
- </button>
- </CoachMark>
- )}
- </div>
- <p className="-mt-1 truncate text-micro text-muted-foreground">
- {t.agent}
- <span className="text-faint-foreground"> · </span>
- {run.status === "failed" ? (
- <span className="text-destructive">{t.failedReason}</span>
- ) : run.status === "cancelled" ? (
- t.cancelledBy
- ) : (
- t.duration
- )}
- </p>
- </div>
- </div>
- ))}
- </>
- )}
- </section>
-
- {phase === "confirm" && (
- <div className="absolute inset-0 z-20 flex items-center justify-center bg-background/60 p-4 backdrop-blur-[2px] motion-safe:animate-in motion-safe:fade-in">
- <div
- role="dialog"
- aria-modal="false"
- aria-labelledby="run-lifecycle-demo-title"
- className="w-full max-w-sm rounded-xl border bg-popover text-popover-foreground shadow-lg motion-safe:animate-in motion-safe:zoom-in-95"
- >
- <div className="p-4 pb-3">
- <div id="run-lifecycle-demo-title" className="text-title-sm font-medium">
- {t.dialogTitle}
- </div>
- <div className="mt-1 text-body text-muted-foreground">{t.dialogBody}</div>
- </div>
- <div className="flex justify-end gap-2 rounded-b-xl border-t bg-muted/40 px-4 py-3">
- <Button type="button" variant="outline" size="sm" onClick={keepRunning}>
- {t.keep}
- </Button>
- <Button type="button" variant="destructive" size="sm" onClick={stopRun}>
- {t.stop}
- </Button>
- </div>
- </div>
- </div>
- )}
- </div>
- </DemoFrame>
+ <EditorialFigure
+ kicker={t.kicker}
+ title={t.title}
+ caption={
+ <span>
+ <strong className="font-semibold text-foreground">{t.states[selected].label}</strong>
+ {" — "}
+ {t.states[selected].detail}
+ </span>
+ }
+ >
+ <svg viewBox="0 0 640 218" className="block h-auto w-full select-none" role="img" aria-label={t.title}>
+ <defs>
+ <marker id="rl-arr" viewBox="0 0 8 8" refX="7" refY="4" markerWidth="6" markerHeight="6" orient="auto">
+ <path d="M0 1 L7 4 L0 7" fill="none" stroke="var(--docs-faint)" strokeWidth="1.3" strokeLinecap="round" strokeLinejoin="round" />
+ </marker>
+ <marker id="rl-arr-p" viewBox="0 0 8 8" refX="7" refY="4" markerWidth="6" markerHeight="6" orient="auto">
+ <path d="M0 1 L7 4 L0 7" fill="none" stroke="var(--primary)" strokeWidth="1.4" strokeLinecap="round" strokeLinejoin="round" />
+ </marker>
+ </defs>
+
+ {/* Main forward spine */}
+ <path d="M120 96 H162" fill="none" stroke="var(--primary)" strokeWidth="1.5" markerEnd="url(#rl-arr-p)" />
+ <path d="M270 96 H312" fill="none" stroke="var(--primary)" strokeWidth="1.5" markerEnd="url(#rl-arr-p)" />
+
+ {/* Fan-out from Working to Completed / Failed / Cancelled */}
+ <path d="M424 84 H456 V40 H492" fill="none" stroke="var(--docs-faint)" strokeWidth="1.3" markerEnd="url(#rl-arr)" />
+ <path d="M424 96 H492" fill="none" stroke="var(--docs-faint)" strokeWidth="1.3" markerEnd="url(#rl-arr)" />
+ <path d="M424 108 H456 V152 H492" fill="none" stroke="var(--docs-faint)" strokeWidth="1.3" markerEnd="url(#rl-arr)" />
+ <text x="456" y="145" textAnchor="middle" fill="var(--muted-foreground)" fontSize="9.5">
+ {t.stopLabel}
+ </text>
+
+ {/* Manual retry loop from Failed & Cancelled back to Queued */}
+ <path
+ d="M558 116 V136 M614 96 H626 V196 H68 V118"
+ fill="none"
+ stroke={selected === "failed" || selected === "cancelled" ? "var(--primary)" : "var(--docs-faint)"}
+ strokeWidth={selected === "failed" || selected === "cancelled" ? 1.5 : 1.2}
+ strokeDasharray="4 3"
+ markerEnd={selected === "failed" || selected === "cancelled" ? "url(#rl-arr-p)" : "url(#rl-arr)"}
+ />
+ <path
+ d="M614 152 H626"
+ fill="none"
+ stroke={selected === "cancelled" ? "var(--primary)" : "var(--docs-faint)"}
+ strokeWidth="1.2"
+ strokeDasharray="4 3"
+ />
+ <rect x="244" y="186" width="176" height="20" rx="3" fill="var(--card)" />
+ <text x="332" y="199" textAnchor="middle" fill="var(--muted-foreground)" fontSize="10" fontWeight="500">
+ {t.retryLabel}
+ </text>
+
+ {box("queued", 16, 76, 104, 40)}
+ {box("dispatched", 164, 76, 106, 40)}
+ {box("running", 314, 76, 110, 40)}
+ {box("completed", 494, 20, 120, 40)}
+ {box("failed", 494, 76, 120, 40)}
+ {box("cancelled", 494, 132, 120, 40)}
+ </svg>
+ </EditorialFigure>
);
}
diff --git a/apps/docs/components/demos/run-path-demo.tsx b/apps/docs/components/demos/run-path-demo.tsx
index 0caa23b00a..7aba36beb8 100644
--- a/apps/docs/components/demos/run-path-demo.tsx
+++ b/apps/docs/components/demos/run-path-demo.tsx
@@ -1,474 +1,240 @@
"use client";
-import { useState, type ReactNode } from "react";
-import { ArrowRight, Laptop, Loader2 } from "@multica/ui/icons";
-import { Button } from "@multica/ui/components/ui/button";
+import { useState } from "react";
import { cn } from "@multica/ui/lib/utils";
-import {
- CoachMark,
- DemoAvatar,
- DemoComment,
- DemoFrame,
- DemoStep,
- useDemoCopy,
- useDemoTimers,
- useStartWhenVisible,
-} from "./demo-kit";
-
-// Run statuses in the order the execution log shows them.
-type RunStatus = "queued" | "dispatched" | "running" | "completed";
+import { EditorialFigure, useDemoCopy } from "./demo-kit";
const copy = {
en: {
- title: "OPS-31 · Compile this week's customer support FAQ",
- multicaLane: "Multica",
- multicaRole: "Records and coordinates",
- computerLane: "Your computer",
- computerRole: "Executes",
- issueTitle: "OPS-31 · Compile this week's customer support FAQ",
- issueDesc: "Turn the questions that came up again and again in last week's support tickets into an FAQ document.",
- assigneeLabel: "Assignee",
- agent: "Ops helper",
- configLabel: "Configuration used",
- config: ["Instructions", "Model", "Skills", "Runtime"],
- executionLog: "Execution log",
- status: { queued: "Queued", dispatched: "Starting", running: "Working", completed: "Completed" } as Record<RunStatus, string>,
- toolCount: (n: number) => (n === 1 ? "1 tool" : `${n} tools`),
- tool: "Claude Code",
- online: "Online",
- claimed: "Claimed the OPS-31 run and started Claude Code",
- actions: [
- "Read last week's ticket export in the working directory",
- "Count the questions that came up repeatedly",
- "Write the FAQ document",
- ],
- wroteBack: "Wrote the results back to the issue",
- reply: "The FAQ is ready: 12 questions grouped by account, orders and refunds. Please review.",
- stepOf: (n: number, total: number) => `Step ${n} of ${total}`,
+ kicker: "EXECUTION BOUNDARY",
+ title: "How a run moves between Multica and your computer",
+ leftZone: "MULTICA · RECORDS & COORDINATES",
+ rightZone: "YOUR COMPUTER · EXECUTES LOCALLY",
+ nodes: {
+ issue: { tag: "01", title: "Issue & agent config", sub: "Description, thread, skills, model" },
+ queue: { tag: "02", title: "Queued run", sub: "Waiting for the bound runtime" },
+ daemon: { tag: "03", title: "Daemon claims run", sub: "Checks out workspace & syncs skills" },
+ tool: { tag: "04", title: "AI coding tool", sub: "Reads files, runs commands locally" },
+ writeback: "05 · Progress, comments & PRs stream back",
+ },
steps: [
- "The issue provides the context",
- "Multica creates a run",
- "A runtime claims the run",
- "The AI coding tool executes locally",
- "Results are written back to the issue",
+ { label: "01 Context", detail: "The issue holds the prompt and discussion; Multica pairs it with the agent's instructions, skills, and model." },
+ { label: "02 Queue", detail: "Triggering creates a run in Multica's queue, bound to the agent's configured runtime." },
+ { label: "03 Claim", detail: "The online daemon on your computer claims the run and prepares the local workspace." },
+ { label: "04 Execute", detail: "Your local AI coding tool (Claude Code, Codex, etc.) edits files and runs tests using your local credentials." },
+ { label: "05 Write back", detail: "Live logs, comments, status updates, and linked PRs stream back to the original issue." },
],
- next: "Next",
- captions: {
- idle: "An issue just assigned to an agent.",
- steps: [
- "The issue holds the work description, the discussion, and the assignee; the run uses the agent's instructions, model, skills, and runtime. Click Next.",
- "The run enters the queue; if no runtime is online, it waits there. Click Next.",
- "An online runtime on your computer claims the run and invokes the AI coding tool the agent is configured to use. Click Next.",
- "The tool reads the working directory, runs commands, and produces results; progress streams back to the execution log.",
- "Results appear in the issue's timeline and execution log. Completed only means this run has ended. Use Replay to watch again.",
- ],
- working: "The tool reads the working directory, runs commands, and produces results; progress streams back to the execution log. Click Next.",
- },
},
zh: {
- title: "OPS-31 · 整理本周客服常见问题",
- multicaLane: "Multica",
- multicaRole: "记录与协调",
- computerLane: "你的电脑",
- computerRole: "负责执行",
- issueTitle: "OPS-31 · 整理本周客服常见问题",
- issueDesc: "把上周客服工单里反复出现的问题整理成一份常见问题文档。",
- assigneeLabel: "负责人",
- agent: "运营助手",
- configLabel: "使用的配置",
- config: ["指令", "模型", "skill", "运行时"],
- executionLog: "执行日志",
- status: { queued: "排队中", dispatched: "启动中", running: "正在工作", completed: "已完成" } as Record<RunStatus, string>,
- toolCount: (n: number) => `${n} 次工具调用`,
- tool: "Claude Code",
- online: "在线",
- claimed: "领取 OPS-31 的运行,启动 Claude Code",
- actions: ["读取工作目录里的上周工单导出文件", "统计反复出现的问题", "写出常见问题文档"],
- wroteBack: "把结果写回任务",
- reply: "常见问题文档已整理好:共 12 个问题,按账号、订单、退款分组,请检查。",
- stepOf: (n: number, total: number) => `第 ${n} 步,共 ${total} 步`,
- steps: ["任务提供上下文", "Multica 创建运行", "运行时领取运行", "AI 编程工具在本地执行", "结果写回任务"],
- next: "下一步",
- captions: {
- idle: "一条刚分配给智能体的任务。",
- steps: [
- "任务保存工作说明、讨论和负责人;运行会使用智能体的指令、模型、skill 和运行时配置。点下一步。",
- "运行进入队列;没有在线运行时时,它会在队列中等待。点下一步。",
- "你电脑上的在线运行时领取运行,调用智能体配置的 AI 编程工具。点下一步。",
- "工具读取工作目录、运行命令并生成结果,进度实时流回执行日志。",
- "结果显示在任务的时间线和执行日志中。已完成只表示这一次运行结束。点右上角可以重新演示。",
- ],
- working: "工具读取工作目录、运行命令并生成结果,进度实时流回执行日志。点下一步。",
+ kicker: "执行边界",
+ title: "一次运行如何在 Multica 与你的电脑之间流转",
+ leftZone: "MULTICA · 记录与协调",
+ rightZone: "你的电脑 · 本地执行",
+ nodes: {
+ issue: { tag: "01", title: "任务与智能体配置", sub: "描述、评论、Skills 与模型" },
+ queue: { tag: "02", title: "运行队列", sub: "等待绑定的运行时领取" },
+ daemon: { tag: "03", title: "守护进程领取", sub: "准备目录并下发 Skills" },
+ tool: { tag: "04", title: "本地 AI 编程工具", sub: "读写代码、执行命令与测试" },
+ writeback: "05 · 进度日志、评论与 PR 实时写回任务",
},
- },
- ja: {
- title: "OPS-31 · 今週のカスタマーサポートのよくある質問をまとめる",
- multicaLane: "Multica",
- multicaRole: "記録と調整",
- computerLane: "あなたのコンピュータ",
- computerRole: "実行を担当",
- issueTitle: "OPS-31 · 今週のカスタマーサポートのよくある質問をまとめる",
- issueDesc: "先週のサポートチケットで繰り返し出た質問を、よくある質問のドキュメントにまとめる。",
- assigneeLabel: "担当者",
- agent: "運用アシスタント",
- configLabel: "使われる設定",
- config: ["指示", "モデル", "スキル", "ランタイム"],
- executionLog: "実行ログ",
- status: { queued: "待機中", dispatched: "開始中", running: "作業中", completed: "完了" } as Record<RunStatus, string>,
- toolCount: (n: number) => `ツール ${n} 件`,
- tool: "Claude Code",
- online: "オンライン",
- claimed: "OPS-31 の実行を引き受け、Claude Code を起動",
- actions: [
- "作業ディレクトリにある先週のチケットのエクスポートを読む",
- "繰り返し出た質問を集計する",
- "よくある質問のドキュメントを書く",
+ steps: [
+ { label: "01 上下文", detail: "任务保存描述与讨论,Multica 结合智能体的指令、Skills 与模型配置组装上下文。" },
+ { label: "02 入队", detail: "触发后在 Multica 创建一条运行并进入队列,绑定到该智能体配置的运行时。" },
+ { label: "03 领取", detail: "你电脑上的在线守护进程领取运行,检出仓库或准备本地工作目录。" },
+ { label: "04 本地执行", detail: "本机 AI 编程工具(Claude Code、Codex 等)使用本地凭据修改代码并运行命令。" },
+ { label: "05 结果回写", detail: "实时执行日志、评论、状态变更与 PR 链接同步写回原任务时间线。" },
],
- wroteBack: "結果をタスクに書き戻す",
- reply: "よくある質問のドキュメントができました。全 12 問を、アカウント、注文、返金に分けています。確認をお願いします。",
- stepOf: (n: number, total: number) => `ステップ ${n} / ${total}`,
+ },
+ "zh-Hant": {
+ kicker: "執行邊界",
+ title: "一次執行如何在 Multica 與你的電腦之間流轉",
+ leftZone: "MULTICA · 記錄與協調",
+ rightZone: "你的電腦 · 本機執行",
+ nodes: {
+ issue: { tag: "01", title: "任務與智能體設定", sub: "描述、評論、Skills 與模型" },
+ queue: { tag: "02", title: "執行佇列", sub: "等待綁定的執行環境領取" },
+ daemon: { tag: "03", title: "守護行程領取", sub: "準備目錄並同步 Skills" },
+ tool: { tag: "04", title: "本機 AI 程式設計工具", sub: "讀寫程式碼、執行指令與測試" },
+ writeback: "05 · 進度日誌、評論與 PR 即時寫回任務",
+ },
steps: [
- "タスクがコンテキストを提供する",
- "Multica が実行を作成する",
- "ランタイムが実行を引き受ける",
- "AI コーディングツールがローカルで実行する",
- "結果がタスクに書き戻される",
+ { label: "01 上下文", detail: "任務保存描述與討論,Multica 結合智能體的指令、Skills 與模型組裝上下文。" },
+ { label: "02 入列", detail: "觸發後在 Multica 建立一條執行並進入佇列,綁定至該智能體設定的執行環境。" },
+ { label: "03 領取", detail: "你電腦上的線上守護行程領取執行並準備本機工作目錄。" },
+ { label: "04 本機執行", detail: "本機 AI 程式設計工具使用本機憑證修改檔案並執行命令。" },
+ { label: "05 結果回寫", detail: "即時執行日誌、評論、狀態更新與 PR 同步寫回原任務時間線。" },
],
- next: "次へ",
- captions: {
- idle: "エージェントに割り当てたばかりのタスクです。",
- steps: [
- "タスクには作業の説明、議論、担当者が保存されています。実行にはエージェントの指示、モデル、スキル、ランタイム設定が使われます。「次へ」をクリックしてください。",
- "実行はキューに入ります。オンラインのランタイムがなければ、キューで待機します。「次へ」をクリックしてください。",
- "あなたのコンピュータ上のオンラインのランタイムが実行を引き受け、エージェントに設定された AI コーディングツールを呼び出します。「次へ」をクリックしてください。",
- "ツールは作業ディレクトリを読み、コマンドを実行して結果を生成します。進捗はリアルタイムで実行ログに流れます。",
- "結果はタスクのタイムラインと実行ログに表示されます。「完了」は、この 1 回の実行が終わったことを示すだけです。「もう一度」で最初から見られます。",
- ],
- working: "ツールは作業ディレクトリを読み、コマンドを実行して結果を生成します。進捗はリアルタイムで実行ログに流れます。「次へ」をクリックしてください。",
+ },
+ ja: {
+ kicker: "EXECUTION BOUNDARY",
+ title: "Multica とローカル PC の間の実行フロー",
+ leftZone: "MULTICA · 記録と調整",
+ rightZone: "あなたの PC · ローカル実行",
+ nodes: {
+ issue: { tag: "01", title: "タスクとエージェント設定", sub: "説明・コメント・Skills・モデル" },
+ queue: { tag: "02", title: "実行キュー", sub: "紐づくランタイムの取得待ち" },
+ daemon: { tag: "03", title: "デーモンが取得", sub: "作業ディレクトリと Skills を準備" },
+ tool: { tag: "04", title: "AI コーディングツール", sub: "ファイル編集・コマンド実行" },
+ writeback: "05 · ログ・コメント・PR をタスクへ書き戻す",
},
+ steps: [
+ { label: "01 コンテキスト", detail: "タスクの説明と議論に、エージェントの指示・Skills・モデルを組み合わせて渡します。" },
+ { label: "02 キュー", detail: "トリガーにより実行が作成され、指定ランタイム向けのキューに入ります。" },
+ { label: "03 取得", detail: "PC 上のオンラインデーモンが実行を取得し、作業ディレクトリを準備します。" },
+ { label: "04 ローカル実行", detail: "PC に導入済みの AI コーディングツールがローカル認証情報で作業します。" },
+ { label: "05 書き戻し", detail: "進捗ログ、コメント、ステータス更新、PR が元のタスクに反映されます。" },
+ ],
},
ko: {
- title: "OPS-31 · 이번 주 고객 지원 자주 묻는 질문 정리",
- multicaLane: "Multica",
- multicaRole: "기록과 조율",
- computerLane: "내 컴퓨터",
- computerRole: "실행 담당",
- issueTitle: "OPS-31 · 이번 주 고객 지원 자주 묻는 질문 정리",
- issueDesc: "지난주 고객 지원 티켓에서 반복해서 나온 질문을 자주 묻는 질문 문서로 정리합니다.",
- assigneeLabel: "담당자",
- agent: "운영 도우미",
- configLabel: "사용하는 설정",
- config: ["지침", "모델", "스킬", "런타임"],
- executionLog: "실행 로그",
- status: { queued: "대기 중", dispatched: "시작 중", running: "작업 중", completed: "완료됨" } as Record<RunStatus, string>,
- toolCount: (n: number) => `도구 ${n}개`,
- tool: "Claude Code",
- online: "온라인",
- claimed: "OPS-31의 실행을 가져와 Claude Code 시작",
- actions: [
- "작업 디렉터리에서 지난주 티켓 내보내기 파일 읽기",
- "반복해서 나온 질문 집계",
- "자주 묻는 질문 문서 작성",
- ],
- wroteBack: "결과를 태스크에 다시 기록",
- reply: "자주 묻는 질문 문서를 정리했습니다. 질문 12개를 계정, 주문, 환불로 나눴으니 확인해 주세요.",
- stepOf: (n: number, total: number) => `${total}단계 중 ${n}단계`,
+ kicker: "EXECUTION BOUNDARY",
+ title: "Multica와 내 컴퓨터 사이의 실행 흐름",
+ leftZone: "MULTICA · 기록 및 조율",
+ rightZone: "내 컴퓨터 · 로컬 실행",
+ nodes: {
+ issue: { tag: "01", title: "태스크 및 에이전트 구성", sub: "설명, 댓글, Skills, 모델" },
+ queue: { tag: "02", title: "실행 대기열", sub: "연결된 런타임 수신 대기" },
+ daemon: { tag: "03", title: "데몬이 실행 수신", sub: "작업 디렉터리 및 Skills 동기화" },
+ tool: { tag: "04", title: "AI 코딩 도구", sub: "로컬 파일 수정 및 명령 실행" },
+ writeback: "05 · 로그·댓글·PR이 원래 태스크로 기록됨",
+ },
steps: [
- "태스크가 컨텍스트 제공",
- "Multica가 실행 생성",
- "런타임이 실행을 가져감",
- "AI 코딩 도구가 로컬에서 실행",
- "결과를 태스크에 기록",
+ { label: "01 컨텍스트", detail: "태스크 설명·댓글과 에이전트 지침·Skills·모델 설정을 결합합니다." },
+ { label: "02 대기열", detail: "트리거 시 실행이 생성되어 해당 런타임 전용 대기열에 들어갑니다." },
+ { label: "03 수신", detail: "컴퓨터의 온라인 데몬이 실행을 받아 로컬 작업 환경을 준비합니다." },
+ { label: "04 로컬 실행", detail: "로컬 AI 코딩 도구가 내 인증 정보로 파일을 읽고 명령을 실행합니다." },
+ { label: "05 결과 반환", detail: "실시간 로그, 댓글, 상태 변경, PR 링크가 태스크 타임라인에 기록됩니다." },
],
- next: "다음",
- captions: {
- idle: "에이전트에게 방금 할당한 태스크입니다.",
- steps: [
- "태스크에는 작업 설명, 논의, 담당자가 저장됩니다. 실행에는 에이전트의 지침, 모델, 스킬, 런타임 설정이 사용됩니다. 다음을 클릭하세요.",
- "실행이 큐에 들어갑니다. 온라인 런타임이 없으면 큐에서 기다립니다. 다음을 클릭하세요.",
- "내 컴퓨터의 온라인 런타임이 실행을 가져와 에이전트에 설정된 AI 코딩 도구를 호출합니다. 다음을 클릭하세요.",
- "도구가 작업 디렉터리를 읽고 명령을 실행해 결과를 만듭니다. 진행 상황은 실행 로그로 실시간 전송됩니다.",
- "결과가 태스크 타임라인과 실행 로그에 표시됩니다. 완료됨은 이번 실행이 끝났다는 뜻일 뿐입니다. 다시 보기를 누르면 처음부터 볼 수 있습니다.",
- ],
- working: "도구가 작업 디렉터리를 읽고 명령을 실행해 결과를 만듭니다. 진행 상황은 실행 로그로 실시간 전송됩니다. 다음을 클릭하세요.",
- },
},
fr: {
- title: "OPS-31 · Compiler la FAQ du support client de la semaine",
- multicaLane: "Multica",
- multicaRole: "Consigne et coordonne",
- computerLane: "Votre ordinateur",
- computerRole: "Exécute",
- issueTitle: "OPS-31 · Compiler la FAQ du support client de la semaine",
- issueDesc: "Transformer les questions revenues sans cesse dans les tickets de support de la semaine dernière en un document FAQ.",
- assigneeLabel: "Assigné à",
- agent: "Assistant ops",
- configLabel: "Configuration utilisée",
- config: ["Instructions", "Modèle", "Skills", "Runtime"],
- executionLog: "Journal d'exécution",
- status: { queued: "En file d'attente", dispatched: "Démarrage", running: "Au travail", completed: "Terminée" } as Record<RunStatus, string>,
- toolCount: (n: number) => (n === 1 ? "1 outil" : `${n} outils`),
- tool: "Claude Code",
- online: "En ligne",
- claimed: "A pris en charge l'exécution d'OPS-31 et lancé Claude Code",
- actions: [
- "Lire l'export des tickets de la semaine dernière dans le répertoire de travail",
- "Compter les questions qui reviennent",
- "Rédiger le document FAQ",
- ],
- wroteBack: "A réécrit les résultats dans la tâche",
- reply: "La FAQ est prête : 12 questions regroupées par compte, commandes et remboursements. Merci de la relire.",
- stepOf: (n: number, total: number) => `Étape ${n} sur ${total}`,
+ kicker: "FRONTIÈRE D'EXÉCUTION",
+ title: "Circulation d'une exécution entre Multica et votre ordinateur",
+ leftZone: "MULTICA · ENREGISTRE ET COORDONNE",
+ rightZone: "VOTRE ORDINATEUR · EXÉCUTE LOCALEMENT",
+ nodes: {
+ issue: { tag: "01", title: "Tâche & config agent", sub: "Description, fil, skills, modèle" },
+ queue: { tag: "02", title: "File d'exécution", sub: "En attente du runtime lié" },
+ daemon: { tag: "03", title: "Le daemon prend la tâche", sub: "Prépare le dossier & skills" },
+ tool: { tag: "04", title: "Outil de codage IA", sub: "Édite et exécute localement" },
+ writeback: "05 · Journaux, commentaires et PR réécrits",
+ },
steps: [
- "La tâche fournit le contexte",
- "Multica crée une exécution",
- "Un runtime prend en charge l'exécution",
- "L'outil de codage IA s'exécute localement",
- "Les résultats sont réécrits dans la tâche",
+ { label: "01 Contexte", detail: "La tâche fournit le contexte, combiné aux instructions, skills et modèle de l'agent." },
+ { label: "02 File", detail: "Chaque déclenchement crée une exécution liée au runtime configuré." },
+ { label: "03 Prise en charge", detail: "Le daemon en ligne sur votre machine récupère l'exécution et prépare le dépôt." },
+ { label: "04 Exécution locale", detail: "Votre outil IA local modifie les fichiers et lance les commandes avec vos propres accès." },
+ { label: "05 Retour", detail: "Journaux en direct, commentaires, statut et PR reviennent sur la tâche." },
],
- next: "Suivant",
- captions: {
- idle: "Une tâche qui vient d'être assignée à un agent.",
- steps: [
- "La tâche contient la description du travail, la discussion et l'assigné ; l'exécution utilise les instructions, le modèle, les skills et le runtime de l'agent. Cliquez sur Suivant.",
- "L'exécution entre dans la file d'attente ; si aucun runtime n'est en ligne, elle y patiente. Cliquez sur Suivant.",
- "Un runtime en ligne sur votre ordinateur prend en charge l'exécution et appelle l'outil de codage IA configuré pour l'agent. Cliquez sur Suivant.",
- "L'outil lit le répertoire de travail, exécute des commandes et produit des résultats ; l'avancement remonte en temps réel dans le journal d'exécution.",
- "Les résultats apparaissent dans le fil d'activité et le journal d'exécution de la tâche. Terminée signifie seulement que cette exécution est finie. Cliquez sur Rejouer pour revoir la démo.",
- ],
- working: "L'outil lit le répertoire de travail, exécute des commandes et produit des résultats ; l'avancement remonte en temps réel dans le journal d'exécution. Cliquez sur Suivant.",
- },
},
};
-const STATUS_AT_STEP: RunStatus[] = ["queued", "queued", "dispatched", "running", "completed"];
-const LAST = 4;
-
-function Lane({
- icon,
- name,
- role,
- active,
- children,
-}: {
- icon: ReactNode;
- name: string;
- role: string;
- active: boolean;
- children: ReactNode;
-}) {
- return (
- <section
- className={cn(
- "flex min-w-0 flex-col gap-2 rounded-lg border p-3 transition-colors",
- active ? "border-brand/60 bg-brand/5" : "bg-muted/30",
- )}
- >
- <div className="flex items-center gap-1.5">
- {icon}
- <span className="text-label font-medium">{name}</span>
- <span className="text-caption text-muted-foreground">· {role}</span>
- </div>
- {children}
- </section>
- );
-}
-
-/** The piece of the lane the current step is about. */
-function Focus({ on, children }: { on: boolean; children: ReactNode }) {
- return (
- <div
- className={cn(
- "rounded-md border bg-background px-2.5 py-2 transition-shadow motion-safe:animate-in motion-safe:fade-in",
- on && "ring-2 ring-brand/60",
- )}
- >
- {children}
- </div>
- );
-}
-
export function RunPathDemo() {
const t = useDemoCopy(copy);
- const { after, clear } = useDemoTimers();
- const [frameRef, visible] = useStartWhenVisible<HTMLElement>();
const [step, setStep] = useState(0);
- const [actionsShown, setActionsShown] = useState(0);
-
- const executing = step === 3 && actionsShown < t.actions.length;
- const status = STATUS_AT_STEP[step] ?? "queued";
-
- const next = () => {
- const to = step + 1;
- setStep(to);
- if (to === 3) {
- t.actions.forEach((_, i) => after(700 + i * 900, () => setActionsShown(i + 1)));
- }
- };
-
- const replay = () => {
- clear();
- setStep(0);
- setActionsShown(0);
- };
-
- const caption = !visible
- ? t.captions.idle
- : step === 3 && !executing
- ? t.captions.working
- : t.captions.steps[step];
- const onComputer = step === 2 || step === 3;
+ const on = (i: number) => step === i;
+ const stroke = (i: number) => (on(i) ? "var(--primary)" : "var(--border)");
+ const fill = (i: number) => (on(i) ? "var(--accent)" : "var(--card)");
return (
- <DemoFrame frameRef={frameRef} title={t.title} caption={caption} onReplay={replay}>
- <div className="flex flex-col gap-3 p-4">
- <ol className="hidden grid-cols-5 gap-2 sm:grid" aria-label={t.stepOf(step + 1, t.steps.length)}>
- {t.steps.map((label, i) => (
- <li
- key={label}
- aria-current={i === step ? "step" : undefined}
+ <EditorialFigure
+ kicker={t.kicker}
+ title={t.title}
+ actions={
+ <div className="flex flex-wrap items-center gap-1" role="tablist" aria-label={t.title}>
+ {t.steps.map((s, i) => (
+ <button
+ key={s.label}
+ type="button"
+ role="tab"
+ aria-selected={step === i}
+ onClick={() => setStep(i)}
className={cn(
- "flex flex-col gap-1 border-t-2 pt-1.5 text-caption transition-colors",
- i < step && "border-brand/50 text-muted-foreground",
- i === step && "border-brand font-medium text-foreground",
- i > step && "border-border text-muted-foreground",
+ "border-b-[1.5px] px-2 pb-1 font-mono text-[0.7rem] transition-colors",
+ step === i
+ ? "border-[var(--primary)] font-medium text-foreground"
+ : "border-transparent text-muted-foreground hover:text-foreground",
)}
>
- <span className="text-micro">{i + 1}</span>
- {label}
- </li>
+ {s.label}
+ </button>
))}
- </ol>
- <div className="text-caption sm:hidden">
- <span className="text-muted-foreground">{t.stepOf(step + 1, t.steps.length)} · </span>
- <span className="font-medium">{t.steps[step]}</span>
</div>
-
- <div className="grid gap-3 sm:grid-cols-2">
- <Lane
- icon={<span aria-hidden className="size-2 rounded-full bg-brand" />}
- name={t.multicaLane}
- role={t.multicaRole}
- active={!onComputer}
- >
- <Focus on={step === 0}>
- <div className="text-body font-medium">{t.issueTitle}</div>
- <p className="mt-0.5 text-caption text-muted-foreground">{t.issueDesc}</p>
- <div className="mt-2 flex items-center gap-1.5 text-caption">
- <span className="text-muted-foreground">{t.assigneeLabel}</span>
- <DemoAvatar name={t.agent} agent />
- <span>{t.agent}</span>
- </div>
- {step === 0 && (
- <div className="mt-2 flex flex-wrap items-center gap-1 motion-safe:animate-in motion-safe:fade-in">
- <span className="mr-0.5 text-micro text-muted-foreground">{t.configLabel}</span>
- {t.config.map((item) => (
- <span key={item} className="rounded-sm bg-brand/10 px-1.5 py-0.5 text-micro font-medium text-brand">
- {item}
- </span>
- ))}
- </div>
- )}
- </Focus>
-
- {step >= 1 && (
- <Focus on={step === 1}>
- <div className="text-micro text-muted-foreground">{t.executionLog}</div>
- <div className="mt-1 flex min-w-0 flex-wrap items-center gap-x-2 gap-y-0.5">
- <DemoAvatar name={t.agent} agent />
- <span className="text-label font-medium">{t.agent}</span>
- <span
- key={status}
- className={cn(
- "inline-flex items-center gap-1 rounded-sm px-1.5 py-0.5 text-micro font-medium motion-safe:animate-in motion-safe:fade-in",
- status === "completed" ? "bg-success/12 text-success" : "bg-muted text-muted-foreground",
- )}
- >
- {status !== "completed" && (
- <Loader2 aria-hidden className="size-3 motion-safe:animate-spin" />
- )}
- {t.status[status]}
- </span>
- {actionsShown > 0 && (
- <span className="text-caption text-muted-foreground">{t.toolCount(actionsShown)}</span>
- )}
- </div>
- </Focus>
- )}
-
- {step === LAST && (
- <div className="ring-2 ring-brand/60 rounded-lg">
- <DemoComment author={t.agent} agent>
- {t.reply}
- </DemoComment>
- </div>
- )}
- </Lane>
-
- <Lane
- icon={<Laptop aria-hidden className="size-3.5 text-muted-foreground" />}
- name={t.computerLane}
- role={t.computerRole}
- active={onComputer}
- >
- <Focus on={step === 2}>
- <div className="flex items-center gap-2 text-label">
- <span className="font-medium">{t.tool}</span>
- <span className="inline-flex items-center gap-1 text-caption text-muted-foreground">
- <span aria-hidden className="size-1.5 rounded-full bg-success" />
- {t.online}
- </span>
- </div>
- {step >= 2 && (
- <ul className="mt-1.5">
- <DemoStep state="done">{t.claimed}</DemoStep>
- </ul>
- )}
- </Focus>
-
- {step >= 3 && (
- <Focus on={step === 3}>
- <ul className="flex flex-col gap-0.5">
- {t.actions.slice(0, actionsShown).map((action, i) => (
- <DemoStep key={action} state={i === actionsShown - 1 && executing ? "running" : "done"}>
- {action}
- </DemoStep>
- ))}
- {actionsShown === 0 && (
- <li className="flex items-center gap-2 py-0.5 text-caption text-muted-foreground">
- <Loader2 aria-hidden className="size-3.5 text-brand motion-safe:animate-spin" />
- {t.status.running}
- </li>
- )}
- </ul>
- </Focus>
- )}
-
- {step === LAST && (
- <ul className="px-1">
- <DemoStep state="done">
- <span className="inline-flex items-center gap-1">
- {t.wroteBack}
- <ArrowRight aria-hidden className="size-3 max-sm:-rotate-90" />
- </span>
- </DemoStep>
- </ul>
- )}
- </Lane>
- </div>
-
- {step < LAST && (
- <div className="flex justify-end">
- <CoachMark active={visible && !executing} side="left" ringClassName="rounded-lg">
- <Button type="button" size="sm" disabled={!visible || executing} onClick={next}>
- {t.next}
- <ArrowRight />
- </Button>
- </CoachMark>
- </div>
- )}
- </div>
- </DemoFrame>
+ }
+ caption={t.steps[step]!.detail}
+ >
+ <svg viewBox="0 0 640 248" className="block h-auto w-full select-none" role="img" aria-label={t.title}>
+ <defs>
+ <marker id="rp-hi" viewBox="0 0 8 8" refX="7" refY="4" markerWidth="6" markerHeight="6" orient="auto">
+ <path d="M0 1 L7 4 L0 7" fill="none" stroke="var(--primary)" strokeWidth="1.4" strokeLinecap="round" strokeLinejoin="round" />
+ </marker>
+ <marker id="rp-lo" viewBox="0 0 8 8" refX="7" refY="4" markerWidth="5.5" markerHeight="5.5" orient="auto">
+ <path d="M0 1 L7 4 L0 7" fill="none" stroke="var(--docs-faint)" strokeWidth="1.3" strokeLinecap="round" strokeLinejoin="round" />
+ </marker>
+ </defs>
+
+ {/* Left & Right boundary zones */}
+ <rect x="8" y="8" width="296" height="186" rx="5" fill="var(--background)" stroke="var(--border)" />
+ <rect x="336" y="8" width="296" height="186" rx="5" fill="var(--background)" stroke="var(--border)" />
+ <line x1="320" y1="8" x2="320" y2="194" stroke="var(--docs-rule)" strokeDasharray="4 4" />
+
+ <text x="22" y="27" fill="var(--muted-foreground)" fontFamily="var(--font-mono)" fontSize="9.5" letterSpacing="0.8">
+ {t.leftZone}
+ </text>
+ <text x="350" y="27" fill="var(--muted-foreground)" fontFamily="var(--font-mono)" fontSize="9.5" letterSpacing="0.8">
+ {t.rightZone}
+ </text>
+
+ {/* Connectors */}
+ <path d="M156 96 V120" fill="none" stroke={on(1) ? "var(--primary)" : "var(--docs-faint)"} strokeWidth={on(1) ? 1.75 : 1.25} markerEnd={on(1) ? "url(#rp-hi)" : "url(#rp-lo)"} />
+ <path d="M286 148 H318 V69 H350" fill="none" stroke={on(2) ? "var(--primary)" : "var(--docs-faint)"} strokeWidth={on(2) ? 1.75 : 1.25} markerEnd={on(2) ? "url(#rp-hi)" : "url(#rp-lo)"} />
+ <path d="M484 96 V120" fill="none" stroke={on(3) ? "var(--primary)" : "var(--docs-faint)"} strokeWidth={on(3) ? 1.75 : 1.25} markerEnd={on(3) ? "url(#rp-hi)" : "url(#rp-lo)"} />
+
+ {/* Write-back return */}
+ <path
+ d="M484 176 V222 H40 V69 H24"
+ fill="none"
+ stroke={on(4) ? "var(--primary)" : "var(--docs-faint)"}
+ strokeWidth={on(4) ? 1.75 : 1.25}
+ strokeDasharray="4 3"
+ markerEnd={on(4) ? "url(#rp-hi)" : "url(#rp-lo)"}
+ />
+ <rect x="176" y="212" width="288" height="20" rx="3" fill="var(--card)" />
+ <text
+ x="320"
+ y="225"
+ textAnchor="middle"
+ fill={on(4) ? "var(--primary)" : "var(--muted-foreground)"}
+ fontSize="10.5"
+ fontWeight={on(4) ? "600" : "500"}
+ style={{ cursor: "pointer" }}
+ onClick={() => setStep(4)}
+ >
+ {t.nodes.writeback}
+ </text>
+
+ {/* 4 Stage Boxes */}
+ {(
+ [
+ [0, 26, 42, 260, 54, t.nodes.issue],
+ [1, 26, 122, 260, 54, t.nodes.queue],
+ [2, 354, 42, 260, 54, t.nodes.daemon],
+ [3, 354, 122, 260, 54, t.nodes.tool],
+ ] as [number, number, number, number, number, { tag: string; title: string; sub: string }][]
+ ).map(([idx, x, y, w, h, node]) => (
+ <g key={idx} style={{ cursor: "pointer" }} onClick={() => setStep(idx)}>
+ <rect x={x} y={y} width={w} height={h} rx="4" fill={fill(idx)} stroke={stroke(idx)} strokeWidth={on(idx) ? 1.6 : 1} />
+ <text x={x + 12} y={y + 21} fill="var(--primary)" fontFamily="var(--font-mono)" fontSize="9.5" fontWeight="600">
+ {node.tag}
+ </text>
+ <text x={x + 32} y={y + 21} fill="var(--foreground)" fontSize="12.5" fontWeight="600">
+ {node.title}
+ </text>
+ <text x={x + 12} y={y + 40} fill="var(--muted-foreground)" fontSize="11">
+ {node.sub}
+ </text>
+ </g>
+ ))}
+ </svg>
+ </EditorialFigure>
);
}
diff --git a/apps/docs/components/demos/runtime-offline-demo.tsx b/apps/docs/components/demos/runtime-offline-demo.tsx
index 4c501171ce..ed5183a277 100644
--- a/apps/docs/components/demos/runtime-offline-demo.tsx
+++ b/apps/docs/components/demos/runtime-offline-demo.tsx
@@ -1,380 +1,255 @@
"use client";
-import { useEffect, useState } from "react";
-import { Laptop, Loader2, Power } from "@multica/ui/icons";
-import { Button } from "@multica/ui/components/ui/button";
+import { useState } from "react";
import { cn } from "@multica/ui/lib/utils";
-import {
- CoachMark,
- DemoAvatar,
- DemoComment,
- DemoFrame,
- DemoRun,
- DemoStep,
- useDemoCopy,
- useDemoTimers,
- useStartWhenVisible,
-} from "./demo-kit";
+import { EditorialFigure, useDemoCopy } from "./demo-kit";
-type IssueStatus = "todo" | "in_progress" | "in_review";
-type Machine = "offline" | "connecting" | "online";
+type Mode = "offline" | "online";
const copy = {
en: {
- title: "OPS-23 · Collect this month's supply requests from every store",
- agent: "Ops helper",
- statusLabel: "Status",
- issueStatus: { todo: "Todo", in_progress: "In Progress", in_review: "In Review" } as Record<IssueStatus, string>,
- isQueued: (name: string) => `${name} is queued`,
- queuedFor: "queued for 42m",
- runtimesTitle: "Runtimes",
- office: "Office computer",
- lei: "Lei Li's computer",
- tool: "Claude Code",
- boundAgent: "Ops helper runs here",
- online: "Online",
- offline: "Offline",
- connecting: "Connecting to workspace...",
- bringOnline: "Bring this computer online",
- bringOnlineHint: "Same as opening Multica Desktop or running multica daemon start",
- queued: "Queued",
- starting: "Starting",
- working: "Working",
- completed: "Completed",
- steps: [
- "Read the issue description and discussion",
- "Set the status to In Progress",
- "Open the supply request sheets from 12 stores",
- "Total the requests by item and flag unusual quantities",
- "Set the status to In Review",
- ],
- reply: "The summary is ready: 12 stores, 37 items, and 3 unusually large requests marked for a second look. Please review.",
+ kicker: "RUNTIME BINDING",
+ title: "What happens when a runtime is offline",
+ tabs: { offline: "Bound machine offline", online: "Bound machine reconnects" } as Record<Mode, string>,
+ queueTitle: "MULTICA QUEUE",
+ runTag: "Run #42 · Engineer",
+ queuedState: "Waiting in queue",
+ claimedState: "Claimed → Working",
+ boundTitle: "Maya's MacBook Pro",
+ boundRole: "Bound runtime · Claude Code",
+ otherTitle: "Alex's Mac Studio",
+ otherRole: "Other workspace machine · Online",
+ neverMigrates: "Never migrates to another machine",
+ drains: "Daemon reconnects → claims queued run",
+ status: { offline: "Offline", online: "Online" },
captions: {
- idle: "You assigned the issue to Ops helper, whose runtime is on the office computer.",
- waiting:
- "The office computer is offline, so the run waits in the queue. Lei Li's computer is online, but the run does not move there. Click \"Bring this computer online\".",
- connecting: "The daemon starts and registers the computer's runtimes again.",
- claimed: "Back online, the runtime claims the queued run and starts the AI coding tool.",
- running: "Ops helper is working on the office computer.",
- done: "The run completed and the issue moved to In Review. Use Replay to watch again.",
+ offline: "Runs stay pinned to the agent's bound runtime. Even when another teammate's machine is online, the run waits in the queue until the bound machine returns.",
+ online: "As soon as Desktop opens or `multica daemon start` reconnects the bound machine, the queued run is claimed automatically.",
},
},
zh: {
- title: "OPS-23 · 汇总本月各门店的物料申请",
- agent: "运营助手",
- statusLabel: "状态",
- issueStatus: { todo: "待办", in_progress: "进行中", in_review: "审核中" } as Record<IssueStatus, string>,
- isQueued: (name: string) => `${name} 排队中`,
- queuedFor: "已排队 42m",
- runtimesTitle: "运行时",
- office: "办公室电脑",
- lei: "李雷的电脑",
- tool: "Claude Code",
- boundAgent: "运营助手 在这里运行",
- online: "在线",
- offline: "离线",
- connecting: "正在连接工作区...",
- bringOnline: "让这台电脑上线",
- bringOnlineHint: "相当于打开 Multica Desktop,或运行 multica daemon start",
- queued: "排队中",
- starting: "启动中",
- working: "正在工作",
- completed: "已完成",
- steps: [
- "读取任务描述和讨论",
- "把状态改为 进行中",
- "打开 12 家门店的物料申请表",
- "按物料汇总数量,标出异常的申请",
- "把状态改为 审核中",
- ],
- reply: "汇总已完成:12 家门店共 37 种物料,其中 3 笔申请量明显偏大,已标出待复核。请检查。",
+ kicker: "运行时绑定",
+ title: "绑定的电脑离线时会发生什么",
+ tabs: { offline: "绑定电脑离线", online: "绑定电脑重新上线" } as Record<Mode, string>,
+ queueTitle: "MULTICA 运行队列",
+ runTag: "Run #42 · Engineer",
+ queuedState: "在队列中等待",
+ claimedState: "已领取 → 正在工作",
+ boundTitle: "Maya 的 MacBook Pro",
+ boundRole: "绑定的运行时 · Claude Code",
+ otherTitle: "队友的 Mac Studio",
+ otherRole: "其他在线电脑 · 在线",
+ neverMigrates: "不会转移到其他电脑执行",
+ drains: "守护进程重连 → 自动领取排队运行",
+ status: { offline: "离线", online: "在线" },
captions: {
- idle: "你把任务分配给了 运营助手,它的运行时在办公室电脑上。",
- waiting: "办公室电脑离线,运行留在队列里等待。李雷的电脑在线,运行也不会转过去。点击\"让这台电脑上线\"。",
- connecting: "守护进程启动,重新注册这台电脑的运行时。",
- claimed: "运行时上线后领取了排队的运行,开始启动 AI 编程工具。",
- running: "运营助手 正在办公室电脑上工作。",
- done: "运行完成,任务改为审核中。点右上角可以重新演示。",
+ offline: "运行严格绑定到智能体配置的运行时。即使团队其他电脑在线,运行也会留在队列中等待,不会转移过去。",
+ online: "打开 Multica Desktop 或运行 multica daemon start 重新上线后,守护进程会自动领取队列中的运行并开始执行。",
+ },
+ },
+ "zh-Hant": {
+ kicker: "執行環境綁定",
+ title: "綁定的電腦離線時會發生什麼",
+ tabs: { offline: "綁定電腦離線", online: "綁定電腦重新上線" } as Record<Mode, string>,
+ queueTitle: "MULTICA 執行佇列",
+ runTag: "Run #42 · Engineer",
+ queuedState: "在佇列中等待",
+ claimedState: "已領取 → 正在工作",
+ boundTitle: "Maya 的 MacBook Pro",
+ boundRole: "綁定的執行環境 · Claude Code",
+ otherTitle: "隊友的 Mac Studio",
+ otherRole: "其他線上電腦 · 線上",
+ neverMigrates: "不會轉移到其他電腦執行",
+ drains: "守護行程重連 → 自動領取排隊執行",
+ status: { offline: "離線", online: "線上" },
+ captions: {
+ offline: "執行嚴格綁定到智能體設定的執行環境。即使其他電腦在線上,執行也不會轉移過去。",
+ online: "重新開啟 Multica Desktop 或執行 multica daemon start 上線後,佇列中的執行會自動被領取。",
},
},
ja: {
- title: "OPS-23 · 今月の各店舗の備品申請を集計する",
- agent: "運用アシスタント",
- statusLabel: "ステータス",
- issueStatus: { todo: "未着手", in_progress: "進行中", in_review: "レビュー中" } as Record<IssueStatus, string>,
- isQueued: (name: string) => `${name} が待機中`,
- queuedFor: "42m 待機中",
- runtimesTitle: "ランタイム",
- office: "オフィスのパソコン",
- lei: "李雷のパソコン",
- tool: "Claude Code",
- boundAgent: "運用アシスタント はここで動きます",
- online: "オンライン",
- offline: "オフライン",
- connecting: "ワークスペースに接続中...",
- bringOnline: "このパソコンをオンラインにする",
- bringOnlineHint: "Multica Desktop を開くか、multica daemon start を実行するのと同じです",
- queued: "待機中",
- starting: "開始中",
- working: "作業中",
- completed: "完了",
- steps: [
- "タスクの説明と議論を読む",
- "ステータスを 進行中 にする",
- "12 店舗の備品申請シートを開く",
- "品目ごとに数量を集計し、異常な申請に印を付ける",
- "ステータスを レビュー中 にする",
- ],
- reply: "集計が終わりました。12 店舗で 37 品目、数量が明らかに多い申請 3 件に再確認の印を付けています。確認をお願いします。",
+ kicker: "RUNTIME BINDING",
+ title: "ランタイムがオフラインのときの動作",
+ tabs: { offline: "紐づく PC がオフライン", online: "再接続後" } as Record<Mode, string>,
+ queueTitle: "MULTICA キュー",
+ runTag: "Run #42 · Engineer",
+ queuedState: "キューで待機中",
+ claimedState: "取得済み → 作業中",
+ boundTitle: "Maya の MacBook Pro",
+ boundRole: "紐づくランタイム · Claude Code",
+ otherTitle: "別メンバーの Mac Studio",
+ otherRole: "他の PC · オンライン",
+ neverMigrates: "他の PC へは移動しない",
+ drains: "再接続 → 待機中の実行を自動取得",
+ status: { offline: "オフライン", online: "オンライン" },
captions: {
- idle: "タスクを 運用アシスタント に割り当てました。そのランタイムはオフィスのパソコンにあります。",
- waiting:
- "オフィスのパソコンがオフラインなので、実行はキューで待ちます。李雷のパソコンはオンラインですが、実行はそちらへ移りません。「このパソコンをオンラインにする」をクリックしてください。",
- connecting: "デーモンが起動し、このパソコンのランタイムを登録し直します。",
- claimed: "オンラインに戻ったランタイムが待機中の実行を受け取り、AI コーディングツールを起動します。",
- running: "運用アシスタント がオフィスのパソコンで作業しています。",
- done: "実行が完了し、タスクはレビュー中になりました。「もう一度」で最初から見られます。",
+ offline: "実行は指定ランタイムに固定されます。別の PC がオンラインでも移動せずキューで待機します。",
+ online: "Desktop を開くか multica daemon start で再接続すると、待機中の実行が自動的に開始されます。",
},
},
ko: {
- title: "OPS-23 · 이번 달 매장별 비품 신청 취합",
- agent: "운영 도우미",
- statusLabel: "상태",
- issueStatus: { todo: "할 일", in_progress: "진행 중", in_review: "리뷰 중" } as Record<IssueStatus, string>,
- isQueued: (name: string) => `${name} 대기 중`,
- queuedFor: "42m 동안 대기 중",
- runtimesTitle: "런타임",
- office: "사무실 컴퓨터",
- lei: "리레이의 컴퓨터",
- tool: "Claude Code",
- boundAgent: "운영 도우미가 여기서 실행됨",
- online: "온라인",
- offline: "오프라인",
- connecting: "워크스페이스에 연결 중...",
- bringOnline: "이 컴퓨터를 온라인으로",
- bringOnlineHint: "Multica Desktop을 열거나 multica daemon start를 실행하는 것과 같습니다",
- queued: "대기 중",
- starting: "시작 중",
- working: "작업 중",
- completed: "완료됨",
- steps: [
- "태스크 설명과 논의 읽기",
- "상태를 진행 중으로 변경",
- "매장 12곳의 비품 신청서 열기",
- "품목별로 수량을 합산하고 이상한 신청 표시",
- "상태를 리뷰 중으로 변경",
- ],
- reply: "취합을 마쳤습니다. 매장 12곳, 품목 37개이며 수량이 눈에 띄게 많은 신청 3건은 재확인 대상으로 표시했습니다. 확인해 주세요.",
+ kicker: "RUNTIME BINDING",
+ title: "연결된 런타임이 오프라인일 때",
+ tabs: { offline: "바인딩 PC 오프라인", online: "다시 온라인 전환" } as Record<Mode, string>,
+ queueTitle: "MULTICA 대기열",
+ runTag: "Run #42 · Engineer",
+ queuedState: "대기열에서 대기 중",
+ claimedState: "수신 완료 → 작업 중",
+ boundTitle: "Maya의 MacBook Pro",
+ boundRole: "바인딩 런타임 · Claude Code",
+ otherTitle: "팀원의 Mac Studio",
+ otherRole: "다른 컴퓨터 · 온라인",
+ neverMigrates: "다른 컴퓨터로 이동하지 않음",
+ drains: "재연결 → 대기 중인 실행 자동 수신",
+ status: { offline: "오프라인", online: "온라인" },
captions: {
- idle: "태스크를 운영 도우미에게 할당했습니다. 이 에이전트의 런타임은 사무실 컴퓨터에 있습니다.",
- waiting:
- "사무실 컴퓨터가 오프라인이라 실행은 대기열에서 기다립니다. 리레이의 컴퓨터는 온라인이지만 실행이 그쪽으로 넘어가지 않습니다. \"이 컴퓨터를 온라인으로\"를 클릭하세요.",
- connecting: "데몬이 시작되면서 이 컴퓨터의 런타임을 다시 등록합니다.",
- claimed: "다시 온라인이 된 런타임이 대기 중인 실행을 가져가 AI 코딩 도구를 시작합니다.",
- running: "운영 도우미가 사무실 컴퓨터에서 작업하고 있습니다.",
- done: "실행이 완료되어 태스크가 리뷰 중으로 바뀌었습니다. \"다시 보기\"로 처음부터 볼 수 있습니다.",
+ offline: "실행은 에이전트에 지정된 런타임에 고정됩니다. 다른 컴퓨터가 온라인이어도 옮겨 가지 않습니다.",
+ online: "Desktop을 열거나 multica daemon start로 다시 연결되면 대기 중인 실행을 자동으로 가져옵니다.",
},
},
fr: {
- title: "OPS-23 · Rassembler les demandes de fournitures du mois de chaque magasin",
- agent: "Assistant ops",
- statusLabel: "Statut",
- issueStatus: { todo: "À faire", in_progress: "En cours", in_review: "En relecture" } as Record<IssueStatus, string>,
- isQueued: (name: string) => `${name} est en file d'attente`,
- queuedFor: "en file d'attente depuis 42m",
- runtimesTitle: "Runtimes",
- office: "Ordinateur du bureau",
- lei: "Ordinateur de Lei Li",
- tool: "Claude Code",
- boundAgent: "Assistant ops s'exécute ici",
- online: "En ligne",
- offline: "Hors ligne",
- connecting: "Connexion à l’espace de travail...",
- bringOnline: "Mettre cet ordinateur en ligne",
- bringOnlineHint: "Revient à ouvrir Multica Desktop ou à lancer multica daemon start",
- queued: "En file d'attente",
- starting: "Démarrage",
- working: "Au travail",
- completed: "Terminée",
- steps: [
- "Lire la description et la discussion de la tâche",
- "Passer le statut à En cours",
- "Ouvrir les fiches de demande de fournitures des 12 magasins",
- "Totaliser les demandes par article et signaler les quantités inhabituelles",
- "Passer le statut à En relecture",
- ],
- reply:
- "La synthèse est prête : 12 magasins, 37 articles, et 3 demandes anormalement élevées marquées pour une seconde vérification. Merci de relire.",
+ kicker: "LIAISON RUNTIME",
+ title: "Comportement lorsqu'un runtime est hors ligne",
+ tabs: { offline: "Machine liée hors ligne", online: "Machine reconnectée" } as Record<Mode, string>,
+ queueTitle: "FILE MULTICA",
+ runTag: "Run #42 · Engineer",
+ queuedState: "En attente dans la file",
+ claimedState: "Prise en charge → En cours",
+ boundTitle: "MacBook Pro de Maya",
+ boundRole: "Runtime lié · Claude Code",
+ otherTitle: "Mac Studio d'Alex",
+ otherRole: "Autre machine · En ligne",
+ neverMigrates: "Ne migre jamais vers une autre machine",
+ drains: "Reconnexion → reprend la file automatiquement",
+ status: { offline: "Hors ligne", online: "En ligne" },
captions: {
- idle: "Vous avez assigné la tâche à Assistant ops, dont le runtime se trouve sur l'ordinateur du bureau.",
- waiting:
- "L'ordinateur du bureau est hors ligne, l'exécution attend donc dans la file. L'ordinateur de Lei Li est en ligne, mais l'exécution n'y est pas transférée. Cliquez sur « Mettre cet ordinateur en ligne ».",
- connecting: "Le daemon démarre et réenregistre les runtimes de cet ordinateur.",
- claimed: "De retour en ligne, le runtime prend l'exécution en attente et démarre l'outil de code IA.",
- running: "Assistant ops travaille sur l'ordinateur du bureau.",
- done: "L'exécution est terminée et la tâche est passée à En relecture. Rejouer recommence depuis le début.",
+ offline: "L'exécution reste liée au runtime choisi et attend en file même si d'autres machines sont en ligne.",
+ online: "Dès que Multica Desktop ou multica daemon start se reconnecte, l'exécution en file démarre.",
},
},
};
-type Phase = "idle" | "waiting" | "connecting" | "claimed" | "running" | "done";
-
-// Index of the step at which the agent updates the issue status.
-const STATUS_STEPS: Partial<Record<number, IssueStatus>> = { 2: "in_progress", 5: "in_review" };
-
-const issueDot: Record<IssueStatus, string> = {
- todo: "border-muted-foreground",
- in_progress: "border-warning bg-warning/40",
- in_review: "border-brand bg-brand/40",
-};
-
-function StatusDot({ state }: { state: Machine }) {
- return (
- <span
- aria-hidden
- className={cn(
- "size-2 shrink-0 rounded-full",
- state === "online" && "bg-success",
- state === "offline" && "bg-muted-foreground/50",
- state === "connecting" && "bg-warning",
- )}
- />
- );
-}
-
export function RuntimeOfflineDemo() {
const t = useDemoCopy(copy);
- const { after, clear } = useDemoTimers();
- const [frameRef, visible] = useStartWhenVisible<HTMLElement>();
- const [cycle, setCycle] = useState(0);
- const [phase, setPhase] = useState<Phase>("idle");
- const [issueStatus, setIssueStatus] = useState<IssueStatus>("todo");
- const [stepsShown, setStepsShown] = useState(0);
-
- useEffect(() => {
- if (!visible) return;
- clear();
- after(600, () => setPhase("waiting"));
- }, [visible, cycle, after, clear]);
-
- const bringOnline = () => {
- setPhase("connecting");
- after(1800, () => setPhase("claimed"));
- after(3200, () => setPhase("running"));
- t.steps.forEach((_, i) =>
- after(3200 + i * 1000, () => {
- setStepsShown(i + 1);
- const next = STATUS_STEPS[i + 1];
- if (next) setIssueStatus(next);
- }),
- );
- after(3200 + t.steps.length * 1000 + 600, () => setPhase("done"));
- };
-
- const replay = () => {
- clear();
- setPhase("idle");
- setIssueStatus("todo");
- setStepsShown(0);
- setCycle((c) => c + 1);
- };
-
- const shownPhase: Phase = visible ? phase : "idle";
- const office: Machine =
- shownPhase === "connecting" ? "connecting" : shownPhase === "idle" || shownPhase === "waiting" ? "offline" : "online";
- const queued = shownPhase === "idle" || shownPhase === "waiting" || shownPhase === "connecting";
- const runStatus =
- shownPhase === "done" ? t.completed : shownPhase === "claimed" ? t.starting : shownPhase === "running" ? t.working : t.queued;
-
- const machines = [
- { name: t.office, state: office, bound: true },
- { name: t.lei, state: "online" as Machine, bound: false },
- ];
+ const [mode, setMode] = useState<Mode>("offline");
+ const online = mode === "online";
return (
- <DemoFrame frameRef={frameRef} title={t.title} caption={t.captions[shownPhase]} onReplay={replay}>
- <div className="grid min-h-80 gap-4 p-4 sm:grid-cols-[minmax(0,1fr)_15rem]">
- <div className="flex min-w-0 flex-col gap-3">
- <div className="flex flex-wrap items-center gap-x-4 gap-y-2">
- <span className="flex items-center gap-2 text-body">
- <span className="text-caption text-muted-foreground">{t.statusLabel}</span>
- <span aria-hidden className={cn("size-3 rounded-full border-2 transition-colors", issueDot[issueStatus])} />
- <span key={issueStatus} className="motion-safe:animate-in motion-safe:fade-in">
- {t.issueStatus[issueStatus]}
- </span>
- </span>
- {queued && (
- <span className="inline-flex h-6 min-w-0 items-center gap-1.5 rounded-full border px-2 text-caption">
- <span aria-hidden className="size-1.5 shrink-0 rounded-full bg-warning" />
- <span className="truncate">{t.isQueued(t.agent)}</span>
- <span className="shrink-0 text-muted-foreground">· {t.queuedFor}</span>
- </span>
- )}
- </div>
-
- <DemoRun agent={t.agent} status={runStatus} active={shownPhase !== "done"}>
- {t.steps.slice(0, stepsShown).map((step, i) => (
- <DemoStep key={step} state={i === stepsShown - 1 && shownPhase !== "done" ? "running" : "done"}>
- {step}
- </DemoStep>
- ))}
- </DemoRun>
-
- {shownPhase === "done" && (
- <DemoComment author={t.agent} agent>
- {t.reply}
- </DemoComment>
- )}
- </div>
-
- <section aria-label={t.runtimesTitle} className="flex min-w-0 flex-col gap-2 sm:self-start">
- <div className="px-1 text-caption font-medium text-muted-foreground">{t.runtimesTitle}</div>
- {machines.map((m) => (
- <div
- key={m.name}
+ <EditorialFigure
+ kicker={t.kicker}
+ title={t.title}
+ actions={
+ <div className="flex items-center gap-3" role="tablist" aria-label={t.title}>
+ {(["offline", "online"] as Mode[]).map((m) => (
+ <button
+ key={m}
+ type="button"
+ role="tab"
+ aria-selected={mode === m}
+ onClick={() => setMode(m)}
className={cn(
- "min-w-0 rounded-lg border bg-background p-2.5",
- m.bound && m.state === "offline" && "border-dashed",
+ "border-b-[1.5px] pb-1 text-[0.75rem] transition-colors",
+ mode === m
+ ? "border-[var(--primary)] font-medium text-foreground"
+ : "border-transparent text-muted-foreground hover:text-foreground",
)}
>
- <div className="flex min-w-0 items-center gap-2">
- <Laptop aria-hidden className="size-4 shrink-0 text-muted-foreground" />
- <span className="min-w-0 flex-1 truncate text-label font-medium">{m.name}</span>
- </div>
- <div className="mt-1.5 flex min-w-0 items-center gap-2 pl-6 text-caption">
- <span className="min-w-0 flex-1 truncate text-muted-foreground">{t.tool}</span>
- <span className="inline-flex shrink-0 items-center gap-1.5">
- {m.state === "connecting" ? (
- <Loader2 aria-hidden className="size-3 text-warning motion-safe:animate-spin" />
- ) : (
- <StatusDot state={m.state} />
- )}
- <span key={m.state} className="motion-safe:animate-in motion-safe:fade-in">
- {m.state === "online" ? t.online : m.state === "offline" ? t.offline : t.connecting}
- </span>
- </span>
- </div>
- {m.bound && (
- <div className="mt-1 flex items-center gap-1.5 pl-6 text-micro text-muted-foreground">
- <DemoAvatar name={t.agent} agent />
- {t.boundAgent}
- </div>
- )}
- {m.bound && (shownPhase === "idle" || shownPhase === "waiting") && (
- <div className="mt-2.5 flex flex-col items-start gap-1.5 pl-6">
- <p className="text-micro text-muted-foreground">{t.bringOnlineHint}</p>
- <CoachMark active={shownPhase === "waiting"} side="left" ringClassName="rounded-lg">
- <Button type="button" size="sm" disabled={shownPhase !== "waiting"} onClick={bringOnline}>
- <Power />
- {t.bringOnline}
- </Button>
- </CoachMark>
- </div>
- )}
- </div>
+ {t.tabs[m]}
+ </button>
))}
- </section>
- </div>
- </DemoFrame>
+ </div>
+ }
+ caption={t.captions[mode]}
+ >
+ <svg viewBox="0 0 640 198" className="block h-auto w-full select-none" role="img" aria-label={t.title}>
+ <defs>
+ <marker id="ro-hi" viewBox="0 0 8 8" refX="7" refY="4" markerWidth="6" markerHeight="6" orient="auto">
+ <path d="M0 1 L7 4 L0 7" fill="none" stroke="var(--primary)" strokeWidth="1.4" strokeLinecap="round" strokeLinejoin="round" />
+ </marker>
+ </defs>
+
+ {/* Left: Multica Queue */}
+ <rect x="14" y="42" width="194" height="114" rx="5" fill="var(--background)" stroke="var(--border)" />
+ <text x="28" y="63" fill="var(--muted-foreground)" fontFamily="var(--font-mono)" fontSize="9.5" letterSpacing="0.8">
+ {t.queueTitle}
+ </text>
+ <rect
+ x="26"
+ y="76"
+ width="170"
+ height="62"
+ rx="4"
+ fill={online ? "var(--accent)" : "var(--card)"}
+ stroke={online ? "var(--primary)" : "var(--docs-rule)"}
+ strokeWidth={online ? 1.5 : 1}
+ />
+ <text x="38" y="99" fill="var(--foreground)" fontSize="12" fontWeight="600">
+ {t.runTag}
+ </text>
+ <text x="38" y="121" fill={online ? "var(--primary)" : "var(--muted-foreground)"} fontSize="11" fontWeight="500">
+ {online ? t.claimedState : t.queuedState}
+ </text>
+
+ {/* Top connector to Bound Machine */}
+ <path
+ d="M208 72 H382"
+ fill="none"
+ stroke={online ? "var(--primary)" : "var(--docs-faint)"}
+ strokeWidth={online ? 1.75 : 1.25}
+ strokeDasharray={online ? undefined : "4 4"}
+ markerEnd={online ? "url(#ro-hi)" : undefined}
+ />
+ <text
+ x="295"
+ y="63"
+ textAnchor="middle"
+ fill={online ? "var(--primary)" : "var(--muted-foreground)"}
+ fontSize="10"
+ fontWeight="500"
+ >
+ {online ? t.drains : t.queuedState}
+ </text>
+
+ {/* Bottom blocked connector to Other Machine */}
+ <path d="M208 144 H382" fill="none" stroke="var(--border)" strokeWidth="1.2" strokeDasharray="3 4" />
+ <line x1="289" y1="138" x2="301" y2="150" stroke="var(--destructive)" strokeWidth="1.6" strokeLinecap="round" />
+ <line x1="301" y1="138" x2="289" y2="150" stroke="var(--destructive)" strokeWidth="1.6" strokeLinecap="round" />
+ <text x="295" y="166" textAnchor="middle" fill="var(--muted-foreground)" fontSize="10">
+ {t.neverMigrates}
+ </text>
+
+ {/* Right Top: Bound Machine */}
+ <rect
+ x="384"
+ y="22"
+ width="242"
+ height="74"
+ rx="5"
+ fill={online ? "var(--accent)" : "var(--card)"}
+ stroke={online ? "var(--primary)" : "var(--border)"}
+ strokeWidth={online ? 1.5 : 1}
+ />
+ <circle cx="402" cy="46" r="4" fill={online ? "var(--success)" : "var(--muted-foreground)"} />
+ <text x="414" y="50" fill="var(--foreground)" fontSize="12.5" fontWeight="600">
+ {t.boundTitle}
+ </text>
+ <text x="612" y="50" textAnchor="end" fill={online ? "var(--success)" : "var(--muted-foreground)"} fontFamily="var(--font-mono)" fontSize="10" fontWeight="600">
+ {online ? t.status.online : t.status.offline}
+ </text>
+ <text x="400" y="74" fill="var(--muted-foreground)" fontSize="11">
+ {t.boundRole}
+ </text>
+
+ {/* Right Bottom: Other Online Machine */}
+ <rect x="384" y="114" width="242" height="64" rx="5" fill="var(--card)" stroke="var(--border)" opacity="0.72" />
+ <circle cx="402" cy="138" r="4" fill="var(--success)" />
+ <text x="414" y="142" fill="var(--foreground)" fontSize="12" fontWeight="500">
+ {t.otherTitle}
+ </text>
+ <text x="400" y="162" fill="var(--muted-foreground)" fontSize="11">
+ {t.otherRole}
+ </text>
+ </svg>
+ </EditorialFigure>
);
}
diff --git a/apps/docs/components/demos/skill-demo.tsx b/apps/docs/components/demos/skill-demo.tsx
index f6c99fad7a..158a1e1a19 100644
--- a/apps/docs/components/demos/skill-demo.tsx
+++ b/apps/docs/components/demos/skill-demo.tsx
@@ -1,448 +1,47 @@
"use client";
-import { useState } from "react";
-import { Check, Plus, Search } from "@multica/ui/icons";
-import { Button } from "@multica/ui/components/ui/button";
-import { cn } from "@multica/ui/lib/utils";
-import {
- CoachMark,
- DemoComment,
- DemoFrame,
- DemoRun,
- DemoSendButton,
- DemoStep,
- useDemoCopy,
- useDemoTimers,
- useStartWhenVisible,
-} from "./demo-kit";
-
-type SkillOption = { name: string; desc: string };
-
-const SKILL_NAME = "weekly-report";
+import { CLIP_MANIFEST } from "./clip-manifest";
+import { EditorialClip, useDemoCopy } from "./demo-kit";
const copy = {
en: {
- title: "Ops helper · Skills",
- assignedTitle: "Assigned to agent",
- assignedHint: "Turn off a skill to pause its use without removing it.",
- addAction: "Add skill",
- emptyTitle: "No skills assigned",
- workspaceBadge: "Workspace",
- dialogTitle: "Add skill",
- searchPlaceholder: "Search skills",
- skills: [
- { name: SKILL_NAME, desc: "Weekly reports in three parts: Done this week, Next week, Risks. At most three points each." },
- { name: "event-recap", desc: "Event recap template with sign-ups, turnout and follow-ups." },
- { name: "support-reply", desc: "Tone and structure for replying to customer tickets." },
- ] as SkillOption[],
- cancel: "Cancel",
- confirmDefault: "Add",
- confirmOne: "Add 1 skill",
- issueTitle: "OPS-17 · Write this week's ops report",
- agent: "Ops helper",
- you: "You",
- draft: "write up this week's ops report.",
- send: "Send",
- running: "Running",
- completed: "Completed",
- steps: [
- "Read this comment and the issue description",
- `Skill · ${SKILL_NAME}`,
- "Collect this week's event, support and content numbers",
- `Write the report in the ${SKILL_NAME} format`,
- ],
- reply: [
- { head: "Done this week", body: "Ran the members' day event, 326 sign-ups; first support response down to 4 minutes." },
- { head: "Next week", body: "Publish the event recap; sort October's customer feedback." },
- { head: "Risks", body: "8% of the event budget is left, so next week's materials may need more." },
- ],
- coachPick: `Pick ${SKILL_NAME}`,
- captions: {
- idle: "Ops helper has no skills yet.",
- start: "Give Ops helper a weekly-report method it can reuse: click Add skill.",
- pick: "These are the workspace's skills. Pick weekly-report.",
- confirm: "Selected. Click Add 1 skill.",
- added: "Assigned. Runs from now on can use it. Now ask Ops helper for this week's report: click send.",
- running: "In the run, the agent loads the skill before writing; that call shows up as a step.",
- done: "The report follows the skill's three parts. Edits to the skill apply from the next run. Use Replay to watch again.",
- },
+ title: "Inspect and reuse workspace Skills",
+ chapters: ["Workspace skills", "SKILL.md & files", "Mounted agents"],
+ caption: "Each skill packages SKILL.md and optional supporting files; mounting it syncs the method to every run automatically.",
},
zh: {
- title: "运营助手 · Skills",
- assignedTitle: "分配给智能体",
- assignedHint: "关闭后暂停使用,仍保留分配。",
- addAction: "添加 skill",
- emptyTitle: "尚未分配 skill",
- workspaceBadge: "工作区",
- dialogTitle: "添加 skill",
- searchPlaceholder: "搜索 skill",
- skills: [
- { name: SKILL_NAME, desc: "周报按\"本周完成 / 下周计划 / 风险\"三段写,每段最多三条。" },
- { name: "event-recap", desc: "活动复盘模板:报名、到场和后续跟进。" },
- { name: "support-reply", desc: "回复客户工单的语气和结构。" },
- ] as SkillOption[],
- cancel: "取消",
- confirmDefault: "添加",
- confirmOne: "添加 1 个 skill",
- issueTitle: "OPS-17 · 写本周运营周报",
- agent: "运营助手",
- you: "你",
- draft: "写一下本周的运营周报。",
- send: "发送",
- running: "运行中",
- completed: "已完成",
- steps: [
- "读取这条评论和任务描述",
- `Skill · ${SKILL_NAME}`,
- "汇总本周的活动、客服和内容数据",
- `按 ${SKILL_NAME} 的格式写周报`,
- ],
- reply: [
- { head: "本周完成", body: "会员日活动上线,报名 326 人;客服首次响应缩短到 4 分钟。" },
- { head: "下周计划", body: "发布活动复盘;整理 10 月客户反馈。" },
- { head: "风险", body: "活动预算只剩 8%,下周物料可能要追加。" },
- ],
- coachPick: `选择 ${SKILL_NAME}`,
- captions: {
- idle: "运营助手 还没有分配任何 skill。",
- start: "给运营助手一套可以复用的周报写法:点击\"添加 skill\"。",
- pick: "这里列出工作区里的 skill。选择 weekly-report。",
- confirm: "已选中。点击\"添加 1 个 skill\"。",
- added: "分配完成,之后的运行都能用它。到任务里请运营助手写本周周报:点击发送。",
- running: "运行中,智能体先加载 skill 再动笔,这次调用会作为一个步骤出现在运行记录里。",
- done: "周报按 skill 规定的三段交付。之后修改 skill,从下一次运行开始生效。点右上角可以重新演示。",
- },
+ title: "管理并复用工作区 Skills",
+ chapters: ["工作区 Skills 列表", "SKILL.md 与文件", "挂载的智能体"],
+ caption: "每个 Skill 以 SKILL.md 为核心打包可复用方法;挂载给智能体后,Multica 会在执行时自动同步到运行时。",
+ },
+ "zh-Hant": {
+ title: "管理並複用工作區 Skills",
+ chapters: ["工作區 Skills 列表", "SKILL.md 與檔案", "掛載的智能體"],
+ caption: "每個 Skill 以 SKILL.md 打包可複用方法;掛載給智能體後,執行時會自動同步至執行環境。",
},
ja: {
- title: "運用アシスタント · スキル",
- assignedTitle: "エージェントに割り当て済み",
- assignedHint: "オフにすると割り当てを残したまま使用を停止できます。",
- addAction: "スキルを追加",
- emptyTitle: "割り当てられたスキルがありません",
- workspaceBadge: "ワークスペース",
- dialogTitle: "スキルを追加",
- searchPlaceholder: "スキルを検索",
- skills: [
- { name: SKILL_NAME, desc: "週報を「今週やったこと / 来週の予定 / リスク」の 3 部で書きます。各部は最大 3 項目。" },
- { name: "event-recap", desc: "イベント振り返りのテンプレート:申込数、参加数、フォローアップ。" },
- { name: "support-reply", desc: "顧客チケットに返信するときのトーンと構成。" },
- ] as SkillOption[],
- cancel: "キャンセル",
- confirmDefault: "追加",
- confirmOne: "スキル 1 件を追加",
- issueTitle: "OPS-17 · 今週の運用週報を書く",
- agent: "運用アシスタント",
- you: "あなた",
- draft: "今週の運用週報をまとめてください。",
- send: "送信",
- running: "実行中",
- completed: "完了",
- steps: [
- "このコメントとタスクの説明を読む",
- `Skill · ${SKILL_NAME}`,
- "今週のイベント、サポート、コンテンツの数字を集める",
- `${SKILL_NAME} の形式で週報を書く`,
- ],
- reply: [
- { head: "今週やったこと", body: "会員デーのイベントを実施し、申込は 326 人。サポートの初回応答は 4 分まで短縮しました。" },
- { head: "来週の予定", body: "イベントの振り返りを公開し、10 月の顧客フィードバックを整理します。" },
- { head: "リスク", body: "イベント予算の残りが 8% なので、来週の資材は追加が必要になるかもしれません。" },
- ],
- coachPick: `${SKILL_NAME} を選ぶ`,
- captions: {
- idle: "運用アシスタントにはまだスキルがありません。",
- start: "運用アシスタントに、使い回せる週報の書き方を渡します。「スキルを追加」をクリックします。",
- pick: "ワークスペースにあるスキルが並んでいます。weekly-report を選びます。",
- confirm: "選択しました。「スキル 1 件を追加」をクリックします。",
- added: "割り当てが済み、これ以降の実行で使えます。タスクで運用アシスタントに今週の週報を頼みます。送信をクリックします。",
- running: "実行の中で、エージェントは書き始める前にスキルを読み込みます。この呼び出しは 1 つのステップとして記録に残ります。",
- done: "週報はスキルが決めた 3 部構成で届きました。スキルを編集すると、次の実行から反映されます。「もう一度」で最初から見られます。",
- },
+ title: "ワークスペースの Skills を管理・再利用する",
+ chapters: ["Skills 一覧", "SKILL.md 詳細", "割り当て先"],
+ caption: "SKILL.md と付属ファイルをパッケージ化し、エージェントへ紐づけると実行時に自動同期されます。",
},
ko: {
- title: "운영 도우미 · 스킬",
- assignedTitle: "에이전트에 할당됨",
- assignedHint: "끄면 할당은 유지한 채 사용을 중지합니다.",
- addAction: "스킬 추가",
- emptyTitle: "할당된 스킬이 없습니다",
- workspaceBadge: "워크스페이스",
- dialogTitle: "스킬 추가",
- searchPlaceholder: "스킬 검색",
- skills: [
- { name: SKILL_NAME, desc: "주간 보고를 '이번 주 완료 / 다음 주 계획 / 리스크' 세 부분으로 씁니다. 부분마다 최대 세 항목." },
- { name: "event-recap", desc: "행사 회고 템플릿: 신청, 참석, 후속 조치." },
- { name: "support-reply", desc: "고객 티켓에 답할 때의 어조와 구성." },
- ] as SkillOption[],
- cancel: "취소",
- confirmDefault: "추가",
- confirmOne: "스킬 1개 추가",
- issueTitle: "OPS-17 · 이번 주 운영 주간 보고 작성",
- agent: "운영 도우미",
- you: "나",
- draft: "이번 주 운영 주간 보고를 정리해 주세요.",
- send: "보내기",
- running: "실행 중",
- completed: "완료됨",
- steps: [
- "이 댓글과 태스크 설명 읽기",
- `Skill · ${SKILL_NAME}`,
- "이번 주 행사, 고객 지원, 콘텐츠 수치 모으기",
- `${SKILL_NAME} 형식으로 주간 보고 작성`,
- ],
- reply: [
- { head: "이번 주 완료", body: "회원의 날 행사를 진행했고 신청은 326명입니다. 고객 지원 첫 응답 시간은 4분으로 줄었습니다." },
- { head: "다음 주 계획", body: "행사 회고를 공개하고 10월 고객 피드백을 정리합니다." },
- { head: "리스크", body: "행사 예산이 8%만 남아 다음 주 물품은 추가 예산이 필요할 수 있습니다." },
- ],
- coachPick: `${SKILL_NAME} 선택`,
- captions: {
- idle: "운영 도우미에게는 아직 스킬이 없습니다.",
- start: "운영 도우미에게 다시 쓸 수 있는 주간 보고 작성법을 줍니다. 스킬 추가를 클릭하세요.",
- pick: "워크스페이스에 있는 스킬 목록입니다. weekly-report를 고르세요.",
- confirm: "선택했습니다. 스킬 1개 추가를 클릭하세요.",
- added: "할당이 끝나 이후 실행부터 쓸 수 있습니다. 이제 태스크에서 운영 도우미에게 이번 주 보고를 부탁합니다. 보내기를 클릭하세요.",
- running: "실행 중에 에이전트는 글을 쓰기 전에 스킬부터 불러옵니다. 이 호출은 하나의 단계로 기록됩니다.",
- done: "보고는 스킬이 정한 세 부분으로 나왔습니다. 스킬을 수정하면 다음 실행부터 반영됩니다. 다시 보기를 누르면 처음부터 볼 수 있습니다.",
- },
+ title: "워크스페이스 Skills 관리 및 재사용하기",
+ chapters: ["Skills 목록", "SKILL.md 상세", "연결된 에이전트"],
+ caption: "SKILL.md와 보조 파일을 패키지로 묶어 여러 에이전트에 장착하면 실행 시 자동으로 동기화됩니다.",
},
fr: {
- title: "Assistant ops · Skills",
- assignedTitle: "Assignés à l'agent",
- assignedHint: "Désactivez un skill pour suspendre son utilisation sans le retirer.",
- addAction: "Ajouter un skill",
- emptyTitle: "Aucun skill assigné",
- workspaceBadge: "Espace de travail",
- dialogTitle: "Ajouter un skill",
- searchPlaceholder: "Rechercher des skills",
- skills: [
- { name: SKILL_NAME, desc: "Rapport hebdomadaire en trois parties : Fait cette semaine, Semaine prochaine, Risques. Trois points maximum par partie." },
- { name: "event-recap", desc: "Modèle de bilan d'événement : inscriptions, participation et suites à donner." },
- { name: "support-reply", desc: "Ton et structure pour répondre aux tickets clients." },
- ] as SkillOption[],
- cancel: "Annuler",
- confirmDefault: "Ajouter",
- confirmOne: "Ajouter 1 skill",
- issueTitle: "OPS-17 · Rédiger le rapport ops de la semaine",
- agent: "Assistant ops",
- you: "Vous",
- draft: "rédige le rapport ops de cette semaine.",
- send: "Envoyer",
- running: "En cours",
- completed: "Terminée",
- steps: [
- "Lire ce commentaire et la description de la tâche",
- `Skill · ${SKILL_NAME}`,
- "Rassembler les chiffres de la semaine : événements, support, contenu",
- `Rédiger le rapport au format ${SKILL_NAME}`,
- ],
- reply: [
- { head: "Fait cette semaine", body: "Journée membres organisée, 326 inscriptions ; premier délai de réponse du support ramené à 4 minutes." },
- { head: "Semaine prochaine", body: "Publier le bilan de l'événement ; trier les retours clients d'octobre." },
- { head: "Risques", body: "Il reste 8 % du budget événementiel ; le matériel de la semaine prochaine pourrait demander une rallonge." },
- ],
- coachPick: `Choisir ${SKILL_NAME}`,
- captions: {
- idle: "Assistant ops n'a encore aucun skill.",
- start: "Donnez à Assistant ops une méthode de rapport hebdomadaire réutilisable : cliquez sur Ajouter un skill.",
- pick: "Voici les skills de l'espace de travail. Choisissez weekly-report.",
- confirm: "Sélectionné. Cliquez sur Ajouter 1 skill.",
- added: "C'est assigné : les exécutions suivantes peuvent l'utiliser. Demandez maintenant le rapport de la semaine à Assistant ops : cliquez sur envoyer.",
- running: "Pendant l'exécution, l'agent charge le skill avant de rédiger ; cet appel apparaît comme une étape.",
- done: "Le rapport suit les trois parties du skill. Une modification du skill s'applique à partir de l'exécution suivante. Cliquez sur Rejouer pour revoir la démo.",
- },
+ title: "Gérer et réutiliser les Skills de l'espace",
+ chapters: ["Liste des Skills", "Détail SKILL.md", "Agents associés"],
+ caption: "Chaque Skill regroupe SKILL.md et ses fichiers annexes, synchronisés automatiquement à chaque exécution.",
},
};
-type Phase = "idle" | "start" | "pick" | "confirm" | "added" | "running" | "done";
-
-// One scripted path: attach the skill on the agent's Skills tab, then watch a
-// run use it. The composer and the dialog's search are fixed text.
export function SkillDemo() {
const t = useDemoCopy(copy);
- const { after, clear } = useDemoTimers();
- const [frameRef, visible] = useStartWhenVisible<HTMLElement>();
- const [phase, setPhase] = useState<Exclude<Phase, "idle">>("start");
- const [stepsShown, setStepsShown] = useState(0);
-
- const shownPhase: Phase = visible ? phase : "idle";
- const attached = phase === "added" || phase === "running" || phase === "done";
- const sent = phase === "running" || phase === "done";
- const dialogOpen = phase === "pick" || phase === "confirm";
- const skill = t.skills[0]!;
-
- const send = () => {
- setPhase("running");
- t.steps.forEach((_, i) => after(500 + i * 1000, () => setStepsShown(i + 1)));
- after(500 + t.steps.length * 1000 + 600, () => setPhase("done"));
- };
-
- const replay = () => {
- clear();
- setPhase("start");
- setStepsShown(0);
- };
-
- return (
- <DemoFrame frameRef={frameRef} title={t.title} caption={t.captions[shownPhase]} onReplay={replay}>
- <div className="relative flex min-h-80 flex-col gap-4 p-4">
- <section className="rounded-lg border bg-background">
- <div className="flex flex-wrap items-center gap-x-3 gap-y-2 border-b px-3 py-2">
- <div className="min-w-0 flex-1">
- <div className="text-label font-medium">{t.assignedTitle}</div>
- <div className="text-caption text-muted-foreground">{t.assignedHint}</div>
- </div>
- <CoachMark active={shownPhase === "start"} side="left" ringClassName="rounded-md">
- <Button
- type="button"
- variant="outline"
- size="sm"
- disabled={shownPhase !== "start"}
- onClick={() => setPhase("pick")}
- >
- <Plus aria-hidden className="size-3.5" />
- {t.addAction}
- </Button>
- </CoachMark>
- </div>
- {attached ? (
- <div className="flex items-start gap-3 px-3 py-2.5 motion-safe:animate-in motion-safe:fade-in">
- <div className="min-w-0 flex-1">
- <div className="flex flex-wrap items-center gap-2">
- <span className="font-mono text-label font-medium">{skill.name}</span>
- <span className="rounded-xs bg-muted px-1 text-micro text-muted-foreground">{t.workspaceBadge}</span>
- </div>
- <div className="mt-0.5 text-caption text-muted-foreground">{skill.desc}</div>
- </div>
- <span aria-hidden className="mt-0.5 inline-flex h-4 w-7 shrink-0 items-center rounded-full bg-foreground p-0.5">
- <span className="ml-auto size-3 rounded-full bg-background" />
- </span>
- </div>
- ) : (
- <div className="px-3 py-5 text-center text-caption text-muted-foreground">{t.emptyTitle}</div>
- )}
- </section>
-
- {attached && (
- <section className="flex flex-col gap-3 motion-safe:animate-in motion-safe:fade-in">
- <div className="text-label font-medium">{t.issueTitle}</div>
-
- {sent && (
- <>
- <DemoComment author={t.you}>
- <span className="font-medium text-brand">@{t.agent}</span> {t.draft}
- </DemoComment>
- <DemoRun agent={t.agent} status={phase === "done" ? t.completed : t.running} active={phase !== "done"}>
- {t.steps.slice(0, stepsShown).map((step, i) => (
- <DemoStep key={step} state={i === stepsShown - 1 && phase !== "done" ? "running" : "done"}>
- {i === 1 ? <span className="font-mono text-foreground">{step}</span> : step}
- </DemoStep>
- ))}
- </DemoRun>
- </>
- )}
-
- {phase === "done" && (
- <DemoComment author={t.agent} agent>
- <div className="flex flex-col gap-1">
- {t.reply.map((part) => (
- <p key={part.head}>
- <span className="font-medium">{part.head}</span>
- <span className="text-muted-foreground"> · </span>
- {part.body}
- </p>
- ))}
- </div>
- </DemoComment>
- )}
-
- {!sent && (
- <div className="rounded-lg border bg-background p-2">
- <div className="min-h-10 px-1 text-body">
- <span className="font-medium text-brand">@{t.agent}</span> {t.draft}
- </div>
- <div className="mt-1 flex justify-end">
- <CoachMark active={phase === "added"} side="left" ringClassName="rounded-full">
- <DemoSendButton label={t.send} disabled={phase !== "added"} onClick={send} />
- </CoachMark>
- </div>
- </div>
- )}
- </section>
- )}
-
- {dialogOpen && (
- <div className="absolute inset-0 z-20 flex items-start justify-center bg-background/60 p-4 backdrop-blur-[2px] motion-safe:animate-in motion-safe:fade-in">
- <div
- role="dialog"
- aria-modal="false"
- aria-labelledby="skill-demo-dialog-title"
- className="w-full max-w-sm rounded-xl border bg-popover text-popover-foreground shadow-lg motion-safe:animate-in motion-safe:zoom-in-95"
- >
- <div id="skill-demo-dialog-title" className="px-4 pt-4 text-body font-medium">
- {t.dialogTitle}
- </div>
- <div className="px-4 pt-3">
- <div className="flex h-8 items-center gap-2 rounded-md border px-2 text-body text-muted-foreground">
- <Search aria-hidden className="size-3.5" />
- {t.searchPlaceholder}
- </div>
- </div>
- <div className="flex flex-col gap-0.5 p-2">
- {t.skills.map((option, i) => {
- const checked = i === 0 && phase === "confirm";
- const enabled = i === 0 && phase === "pick";
- return (
- <CoachMark quiet key={option.name} active={enabled} ringClassName="rounded-md" className="flex w-full">
- <button
- type="button"
- role="checkbox"
- aria-checked={checked}
- disabled={!enabled}
- onClick={() => setPhase("confirm")}
- className={cn(
- "flex w-full items-start gap-2.5 rounded-md px-2 py-1.5 text-left hover:bg-accent disabled:hover:bg-transparent",
- checked && "bg-accent/60",
- )}
- >
- <span
- aria-hidden
- className={cn(
- "mt-0.5 flex size-4 shrink-0 items-center justify-center rounded-sm border",
- checked ? "border-foreground bg-foreground text-background" : "border-muted-foreground/50",
- )}
- >
- {checked && <Check className="size-3" />}
- </span>
- <span className="min-w-0 flex-1">
- <span className="flex flex-wrap items-baseline gap-x-2">
- <span className="font-mono text-label font-medium">{option.name}</span>
- {enabled && (
- <span aria-hidden className="text-caption font-medium text-brand">
- {t.coachPick}
- </span>
- )}
- </span>
- <span className="block truncate text-caption text-muted-foreground">{option.desc}</span>
- </span>
- </button>
- </CoachMark>
- );
- })}
- </div>
- <div className="flex justify-end gap-2 rounded-b-xl border-t bg-muted/40 px-4 py-3">
- <Button type="button" variant="ghost" size="sm" disabled>
- {t.cancel}
- </Button>
- <CoachMark active={phase === "confirm"} side="bottom" align="end" ringClassName="rounded-lg">
- <Button type="button" size="sm" disabled={phase !== "confirm"} onClick={() => setPhase("added")}>
- {phase === "confirm" ? t.confirmOne : t.confirmDefault}
- </Button>
- </CoachMark>
- </div>
- </div>
- </div>
- )}
- </div>
- </DemoFrame>
- );
+ const meta = CLIP_MANIFEST.skill ?? { duration: 5.5, chapters: [] };
+ const chapters = t.chapters.map((label, i) => ({
+ label,
+ at: meta.chapters[i]?.at ?? (i * meta.duration) / t.chapters.length,
+ }));
+ return <EditorialClip slug="skill" title={t.title} chapters={chapters} duration={meta.duration} caption={t.caption} />;
}
diff --git a/apps/docs/components/demos/squad-demo.tsx b/apps/docs/components/demos/squad-demo.tsx
index 67a3a76d27..7a97587451 100644
--- a/apps/docs/components/demos/squad-demo.tsx
+++ b/apps/docs/components/demos/squad-demo.tsx
@@ -1,594 +1,47 @@
"use client";
-import { useState } from "react";
-import { ChevronDown, Users, X } from "@multica/ui/icons";
-import { Button } from "@multica/ui/components/ui/button";
-import { cn } from "@multica/ui/lib/utils";
-import {
- CoachMark,
- DemoAvatar,
- DemoComment,
- DemoFrame,
- DemoRun,
- DemoSendButton,
- DemoStep,
- useDemoCopy,
- useDemoTimers,
- useStartWhenVisible,
-} from "./demo-kit";
-
-type Status = "todo" | "in_progress" | "in_review";
-type Candidate = { name: string; kind: "member" | "agent" | "squad" };
+import { CLIP_MANIFEST } from "./clip-manifest";
+import { EditorialClip, useDemoCopy } from "./demo-kit";
const copy = {
en: {
- title: "OPS-21 · Prepare the end-of-month customer thank-you event",
- statusLabel: "Status",
- assigneeLabel: "Assignee",
- unassigned: "Unassigned",
- status: { todo: "Todo", in_progress: "In Progress", in_review: "In Review" } as Record<Status, string>,
- groups: { member: "Members", agent: "Agents", squad: "Squads" },
- squad: "Events squad",
- leader: "Ops helper",
- writer: "Writing helper",
- you: "You",
- leaderTag: "Leader",
- candidates: [
- { name: "You", kind: "member" },
- { name: "Lei Li", kind: "member" },
- { name: "Ops helper", kind: "agent" },
- { name: "Writing helper", kind: "agent" },
- { name: "Events squad", kind: "squad" },
- ] as Candidate[],
- confirmTitle: "Confirm assignment?",
- confirmBody: (name: string) => `Assign this issue to ${name}. They'll start right away if the run conditions are met.`,
- close: "Close",
- dontStart: "Don't start yet",
- confirm: "Confirm assignment",
- running: "Running",
- completed: "Completed",
- leaderSteps: [
- "Read the issue description and discussion",
- "Match the work against the squad roster",
- "Set the status to In Progress",
- "Post the dispatch comment",
- "Record this evaluation",
- ],
- dispatch: { writer: "draft the invitation, first version by Wednesday.", you: "please confirm the venue and the catering quote." },
- dispatchActivity: "evaluated and took action: handed off to Writing helper and You",
- writerSteps: ["Read the issue and the dispatch comment", "Draft the invitation"],
- writerReply: "The invitation draft is ready, with the time, the place and an RSVP link.",
- recheckSteps: ["Read the new comment"],
- noActionActivity: "evaluated: no action needed (waiting on You for the venue)",
- yourDraft: "Venue is the third-floor event hall; catering quote is 4,800 and confirmed.",
- send: "Send",
- finalSteps: ["Read the new comment", "Pull the invitation and venue details together", "Set the status to In Review"],
- summary: "The event is ready: the invitation draft is done, and the venue and catering are confirmed. Please review before we send it out.",
- finalActivity: "evaluated and took action: work is complete, moved to In Review",
- captions: {
- idle: "An issue that needs both writing and on-site coordination.",
- start: "Hand the whole issue to a squad: click Assignee.",
- pick: "Squads are listed with members and agents. Pick Events squad.",
- confirm: "The squad becomes the assignee. Confirm to start.",
- leader: "Only the leader starts. It reads the issue and the roster, then dispatches by @mention instead of doing the work.",
- leaderPosted: "The @mentions are the handoff: Writing helper gets a run, and you get a notification. The leader has stopped.",
- writer: "Writing helper works in its own run on the same issue.",
- writerPosted: "A squad member posted an update without @mentioning anyone, so the leader wakes up.",
- recheck: "The leader re-evaluates.",
- yourTurn: "Your part isn't in yet, so the leader records no action and posts nothing. Your reply is written: click send.",
- final: "Your reply wakes the leader again. Everything it asked for is in.",
- done: "The leader sums up and moves the issue to In Review; Done is left for a person to decide. Use Replay to watch again.",
- },
+ title: "Coordinate multiple agents with a Squad",
+ chapters: ["Squad list", "Leader & roster", "Workflow instructions"],
+ caption: "Assigning an issue to a squad hands coordination to its leader, who routes work across specialist members.",
},
zh: {
- title: "OPS-21 · 筹备月底的客户答谢会",
- statusLabel: "状态",
- assigneeLabel: "负责人",
- unassigned: "未分配",
- status: { todo: "待办", in_progress: "进行中", in_review: "审核中" } as Record<Status, string>,
- groups: { member: "成员", agent: "智能体", squad: "小队" },
- squad: "活动小队",
- leader: "运营助手",
- writer: "文案助手",
- you: "你",
- leaderTag: "队长",
- candidates: [
- { name: "你", kind: "member" },
- { name: "李雷", kind: "member" },
- { name: "运营助手", kind: "agent" },
- { name: "文案助手", kind: "agent" },
- { name: "活动小队", kind: "squad" },
- ] as Candidate[],
- confirmTitle: "确认指派?",
- confirmBody: (name: string) => `将这个任务指派给 ${name};符合运行条件时会立即开始处理。`,
- close: "关闭",
- dontStart: "暂不开始",
- confirm: "确认指派",
- running: "运行中",
- completed: "已完成",
- leaderSteps: ["读取任务描述和讨论", "对照小队花名册挑选成员", "把状态改为 进行中", "发出派活评论", "记录这次评估"],
- dispatch: { writer: "写答谢会邀请函,周三前给初稿。", you: "确认一下场地和餐饮报价。" },
- dispatchActivity: "已评估并采取了操作:派给文案助手和你",
- writerSteps: ["读取任务和派活评论", "起草邀请函"],
- writerReply: "邀请函初稿写好了,时间、地点和回执链接都在里面。",
- recheckSteps: ["读取新评论"],
- noActionActivity: "已评估:无需操作(等你确认场地)",
- yourDraft: "场地定在三楼多功能厅,餐饮报价 4,800 元,已确认。",
- send: "发送",
- finalSteps: ["读取新评论", "汇总邀请函和场地信息", "把状态改为 审核中"],
- summary: "答谢会准备好了:邀请函初稿已完成,场地和餐饮已确认。请检查后再发出邀请。",
- finalActivity: "已评估并采取了操作:工作已完成,改为审核中",
- captions: {
- idle: "一条既要写文案、又要跑现场的任务。",
- start: "把整条任务交给小队:点击负责人。",
- pick: "小队和成员、智能体列在一起。选择\"活动小队\"。",
- confirm: "小队会成为负责人。确认后开始。",
- leader: "只有队长开始运行。它读任务和花名册,用 @ 派活,自己不动手。",
- leaderPosted: "@ 就是交接:文案助手入队了一次运行,你收到一条通知。队长到这里就停下了。",
- writer: "文案助手在同一条任务上开始自己的运行。",
- writerPosted: "小队成员发了进展,没有 @ 任何人,所以队长被唤醒。",
- recheck: "队长重新评估下一步。",
- yourTurn: "你那部分还没交,队长记一条\"无需操作\",不发评论。你的回复已经写好:点击发送。",
- final: "你的回复再次唤醒队长,它要的东西都齐了。",
- done: "队长汇总结果,把任务改为审核中;改成已完成留给人来决定。点右上角可以重新演示。",
- },
+ title: "用小队统筹多名智能体协作",
+ chapters: ["小队列表", "队长与成员分工", "协作工作流指令"],
+ caption: "把任务分配给小队后,队长智能体负责拆解约束、调度专业成员并汇总最终交付。",
+ },
+ "zh-Hant": {
+ title: "用小隊統籌多名智能體協作",
+ chapters: ["小隊列表", "隊長與成員分工", "協作工作流指令"],
+ caption: "將任務指派給小隊後,隊長智能體負責拆解需求、調度成員並彙整最終交付。",
},
ja: {
- title: "OPS-21 · 月末の顧客感謝イベントを準備する",
- statusLabel: "ステータス",
- assigneeLabel: "担当者",
- unassigned: "未割り当て",
- status: { todo: "未着手", in_progress: "進行中", in_review: "レビュー中" } as Record<Status, string>,
- groups: { member: "メンバー", agent: "エージェント", squad: "スクワッド" },
- squad: "イベントスクワッド",
- leader: "運用アシスタント",
- writer: "ライティングアシスタント",
- you: "あなた",
- leaderTag: "リーダー",
- candidates: [
- { name: "あなた", kind: "member" },
- { name: "李雷", kind: "member" },
- { name: "運用アシスタント", kind: "agent" },
- { name: "ライティングアシスタント", kind: "agent" },
- { name: "イベントスクワッド", kind: "squad" },
- ] as Candidate[],
- confirmTitle: "割り当てを確認しますか?",
- confirmBody: (name: string) => `このタスクを ${name} に割り当てます。実行条件を満たす場合はすぐに作業を開始します。`,
- close: "閉じる",
- dontStart: "まだ開始しない",
- confirm: "割り当てを確認",
- running: "実行中",
- completed: "完了",
- leaderSteps: [
- "タスクの説明と議論を読む",
- "スクワッドの名簿と照らし合わせてメンバーを選ぶ",
- "ステータスを 進行中 に変更",
- "割り振りのコメントを投稿",
- "今回の評価を記録",
- ],
- dispatch: { writer: "招待状の文面をお願いします。初稿は水曜までに。", you: "会場とケータリングの見積もりを確認してください。" },
- dispatchActivity: "評価してアクションを実行しました: ライティングアシスタントとあなたに割り振り",
- writerSteps: ["タスクと割り振りのコメントを読む", "招待状の下書きを書く"],
- writerReply: "招待状の初稿ができました。日時、場所、出欠フォームへのリンクを入れています。",
- recheckSteps: ["新しいコメントを読む"],
- noActionActivity: "評価完了: 必要なアクションはありません(会場の確認をあなたに依頼中)",
- yourDraft: "会場は 3 階のイベントホールに決まりました。ケータリングは 4,800 の見積もりで確定です。",
- send: "送信",
- finalSteps: ["新しいコメントを読む", "招待状と会場の情報をまとめる", "ステータスを レビュー中 に変更"],
- summary: "イベントの準備が整いました。招待状の初稿ができ、会場とケータリングも確定しています。送付前に確認をお願いします。",
- finalActivity: "評価してアクションを実行しました: 作業が完了したのでレビュー中に変更",
- captions: {
- idle: "文面づくりと現地の手配、両方が必要なタスクです。",
- start: "タスク全体をスクワッドに任せます。担当者をクリックします。",
- pick: "スクワッドはメンバーやエージェントと同じ一覧に並びます。イベントスクワッドを選びます。",
- confirm: "スクワッドが担当者になります。確認すると開始します。",
- leader: "動き出すのはリーダーだけです。タスクと名簿を読み、自分では作業せず @メンションで割り振ります。",
- leaderPosted: "@メンションが引き継ぎの合図です。ライティングアシスタントには実行が入り、あなたには通知が届きます。リーダーはここで止まります。",
- writer: "ライティングアシスタントが同じタスクで自分の実行を始めます。",
- writerPosted: "スクワッドのメンバーが誰も @メンションせずに進捗を投稿したので、リーダーが起こされます。",
- recheck: "リーダーが次の一手を評価し直します。",
- yourTurn: "あなたの担当分がまだなので、リーダーは「アクションなし」を記録し、コメントは投稿しません。返信は入力済みです。送信をクリックします。",
- final: "あなたの返信でリーダーがもう一度起こされます。頼んだものはすべて揃いました。",
- done: "リーダーが結果をまとめ、タスクをレビュー中にします。完了にするかどうかは人が決めます。「もう一度」で最初から見られます。",
- },
+ title: "スクワッドで複数エージェントを連携させる",
+ chapters: ["スクワッド一覧", "リーダーとメンバー", "連携ワークフロー"],
+ caption: "タスクをスクワッドに割り当てるとリーダーが窓口になり、専門メンバーへ仕事を振り分けます。",
},
ko: {
- title: "OPS-21 · 월말 고객 감사 행사 준비",
- statusLabel: "상태",
- assigneeLabel: "담당자",
- unassigned: "담당자 없음",
- status: { todo: "할 일", in_progress: "진행 중", in_review: "리뷰 중" } as Record<Status, string>,
- groups: { member: "멤버", agent: "에이전트", squad: "스쿼드" },
- squad: "행사 스쿼드",
- leader: "운영 도우미",
- writer: "글쓰기 도우미",
- you: "나",
- leaderTag: "리더",
- candidates: [
- { name: "나", kind: "member" },
- { name: "리레이", kind: "member" },
- { name: "운영 도우미", kind: "agent" },
- { name: "글쓰기 도우미", kind: "agent" },
- { name: "행사 스쿼드", kind: "squad" },
- ] as Candidate[],
- confirmTitle: "할당을 확인할까요?",
- confirmBody: (name: string) => `이 태스크를 ${name}에게 할당합니다. 실행 조건을 충족하면 바로 시작합니다.`,
- close: "닫기",
- dontStart: "아직 시작 안 함",
- confirm: "할당 확인",
- running: "실행 중",
- completed: "완료됨",
- leaderSteps: [
- "태스크 설명과 논의 읽기",
- "스쿼드 명단과 비교해 멤버 고르기",
- "상태를 진행 중으로 변경",
- "작업 배정 댓글 남기기",
- "이번 평가 기록하기",
- ],
- dispatch: { writer: "초대장 문안을 써 주세요. 초안은 수요일까지 부탁합니다.", you: "행사장과 케이터링 견적을 확인해 주세요." },
- dispatchActivity: "평가 후 작업을 수행했습니다: 글쓰기 도우미와 나에게 배정",
- writerSteps: ["태스크와 배정 댓글 읽기", "초대장 초안 작성"],
- writerReply: "초대장 초안을 다 썼습니다. 일시, 장소, 참석 회신 링크를 넣었습니다.",
- recheckSteps: ["새 댓글 읽기"],
- noActionActivity: "평가 완료: 필요한 작업 없음(행사장 확인은 나에게서 대기 중)",
- yourDraft: "행사장은 3층 다목적홀로 정했고, 케이터링 견적 4,800으로 확정했습니다.",
- send: "보내기",
- finalSteps: ["새 댓글 읽기", "초대장과 행사장 정보 정리", "상태를 리뷰 중으로 변경"],
- summary: "행사 준비가 끝났습니다. 초대장 초안이 나왔고 행사장과 케이터링도 확정됐습니다. 발송 전에 검토해 주세요.",
- finalActivity: "평가 후 작업을 수행했습니다: 작업이 끝나 리뷰 중으로 변경",
- captions: {
- idle: "문안 작성과 현장 준비가 모두 필요한 태스크입니다.",
- start: "태스크 전체를 스쿼드에 맡깁니다. 담당자를 클릭하세요.",
- pick: "스쿼드는 멤버, 에이전트와 같은 목록에 있습니다. 행사 스쿼드를 고르세요.",
- confirm: "스쿼드가 담당자가 됩니다. 확인하면 시작합니다.",
- leader: "리더만 실행을 시작합니다. 태스크와 명단을 읽고, 직접 일하지 않고 @멘션으로 배정합니다.",
- leaderPosted: "@멘션이 곧 인계입니다. 글쓰기 도우미에게는 실행이 들어가고 나에게는 알림이 옵니다. 리더는 여기서 멈춥니다.",
- writer: "글쓰기 도우미가 같은 태스크에서 자기 실행을 시작합니다.",
- writerPosted: "스쿼드 멤버가 아무도 @멘션하지 않고 진행 상황을 올렸으므로 리더가 깨어납니다.",
- recheck: "리더가 다음 단계를 다시 평가합니다.",
- yourTurn: "내 몫이 아직 들어오지 않아 리더는 '작업 없음'을 기록하고 댓글은 남기지 않습니다. 답장은 작성되어 있습니다. 보내기를 클릭하세요.",
- final: "내 답장이 리더를 다시 깨웁니다. 요청한 내용이 모두 모였습니다.",
- done: "리더가 결과를 정리하고 태스크를 리뷰 중으로 옮깁니다. 완료 처리는 사람이 결정합니다. 다시 보기를 누르면 처음부터 볼 수 있습니다.",
- },
+ title: "스쿼드로 여러 에이전트 협업 조율하기",
+ chapters: ["스쿼드 목록", "리더와 멤버 구성", "협업 지침"],
+ caption: "태스크를 스쿼드에 할당하면 리더 에이전트가 전문 멤버들에게 작업을 분배하고 결과를 취합합니다.",
},
fr: {
- title: "OPS-21 · Préparer la soirée de remerciement clients de fin de mois",
- statusLabel: "Statut",
- assigneeLabel: "Assigné à",
- unassigned: "Non assigné",
- status: { todo: "À faire", in_progress: "En cours", in_review: "En relecture" } as Record<Status, string>,
- groups: { member: "Membres", agent: "Agents", squad: "Squads" },
- squad: "Squad événements",
- leader: "Assistant ops",
- writer: "Assistant rédaction",
- you: "Vous",
- leaderTag: "Chef",
- candidates: [
- { name: "Vous", kind: "member" },
- { name: "Lei Li", kind: "member" },
- { name: "Assistant ops", kind: "agent" },
- { name: "Assistant rédaction", kind: "agent" },
- { name: "Squad événements", kind: "squad" },
- ] as Candidate[],
- confirmTitle: "Confirmer l'assignation ?",
- confirmBody: (name: string) => `Assigner cette tâche à ${name}. Le travail démarrera immédiatement si les conditions d'exécution sont réunies.`,
- close: "Fermer",
- dontStart: "Ne pas démarrer maintenant",
- confirm: "Confirmer l'assignation",
- running: "En cours",
- completed: "Terminée",
- leaderSteps: [
- "Lire la description et la discussion de la tâche",
- "Comparer le travail au roster du squad",
- "Passer le statut à En cours",
- "Publier le commentaire de délégation",
- "Consigner cette évaluation",
- ],
- dispatch: { writer: "rédige l'invitation, première version pour mercredi.", you: "merci de confirmer la salle et le devis du traiteur." },
- dispatchActivity: "a évalué et agi : délégué à Assistant rédaction et à Vous",
- writerSteps: ["Lire la tâche et le commentaire de délégation", "Rédiger l'invitation"],
- writerReply: "Le brouillon de l'invitation est prêt, avec la date, le lieu et un lien de réponse.",
- recheckSteps: ["Lire le nouveau commentaire"],
- noActionActivity: "a évalué : aucune action nécessaire (en attente de Vous pour la salle)",
- yourDraft: "La salle sera celle du troisième étage ; le devis du traiteur est de 4 800 et il est validé.",
- send: "Envoyer",
- finalSteps: ["Lire le nouveau commentaire", "Rassembler l'invitation et les infos sur la salle", "Passer le statut à En relecture"],
- summary: "La soirée est prête : le brouillon de l'invitation est fait, la salle et le traiteur sont confirmés. Merci de relire avant l'envoi.",
- finalActivity: "a évalué et agi : travail terminé, passé En relecture",
- captions: {
- idle: "Une tâche qui demande à la fois de la rédaction et de l'organisation sur place.",
- start: "Confiez toute la tâche à un squad : cliquez sur Assigné à.",
- pick: "Les squads sont listés avec les membres et les agents. Choisissez Squad événements.",
- confirm: "Le squad devient l'assigné. Confirmez pour démarrer.",
- leader: "Seul le chef démarre. Il lit la tâche et le roster, puis délègue par @mention au lieu de faire le travail.",
- leaderPosted: "Les @mentions servent de passation : Assistant rédaction reçoit une exécution, et vous une notification. Le chef s'arrête là.",
- writer: "Assistant rédaction travaille dans sa propre exécution, sur la même tâche.",
- writerPosted: "Un membre du squad a publié un point d'avancement sans @mentionner personne : le chef se réveille.",
- recheck: "Le chef réévalue la suite.",
- yourTurn: "Votre partie n'est pas encore arrivée : le chef consigne « aucune action » et ne publie rien. Votre réponse est rédigée : cliquez sur envoyer.",
- final: "Votre réponse réveille de nouveau le chef. Tout ce qu'il avait demandé est là.",
- done: "Le chef fait la synthèse et passe la tâche En relecture ; c'est à une personne de la passer à Terminé. Cliquez sur Rejouer pour revoir la démo.",
- },
+ title: "Coordonner plusieurs agents avec un Squad",
+ chapters: ["Liste des squads", "Leader et membres", "Instructions d'équipe"],
+ caption: "Assigner une tâche à un squad confie la coordination à son leader, qui répartit le travail entre spécialistes.",
},
};
-const ORDER = [
- "start",
- "pick",
- "confirm",
- "leader",
- "leaderPosted",
- "writer",
- "writerPosted",
- "recheck",
- "yourTurn",
- "final",
- "done",
-] as const;
-type Phase = (typeof ORDER)[number];
-
-const STEP_MS = 800;
-const PAUSE_MS = 1200;
-
-const statusDot: Record<Status, string> = {
- todo: "border-muted-foreground",
- in_progress: "border-warning bg-warning/40",
- in_review: "border-brand bg-brand/40",
-};
-
-// The squad flow as the server runs it: assigning enqueues only the leader;
-// the leader dispatches with @mentions and stops; a member's plain update wakes
-// it again; it moves the parent to in_review once the goal is met.
export function SquadDemo() {
const t = useDemoCopy(copy);
- const { after, clear } = useDemoTimers();
- const [frameRef, visible] = useStartWhenVisible<HTMLElement>();
- const [phase, setPhase] = useState<Phase>("start");
- const [status, setStatus] = useState<Status>("todo");
- const [stepsShown, setStepsShown] = useState(0);
-
- const at = (p: Phase) => ORDER.indexOf(phase) >= ORDER.indexOf(p);
- const assigned = at("leader");
-
- // Plays one run's steps, then hands over to `next` after a pause.
- const playRun = (start: number, steps: string[], next: Phase, onStep?: (i: number) => void) => {
- after(start, () => setStepsShown(0));
- steps.forEach((_, i) =>
- after(start + 300 + i * STEP_MS, () => {
- setStepsShown(i + 1);
- onStep?.(i + 1);
- }),
- );
- const end = start + 300 + steps.length * STEP_MS + 300;
- after(end, () => setPhase(next));
- return end;
- };
-
- const confirm = () => {
- setPhase("leader");
- let time = playRun(0, t.leaderSteps, "leaderPosted", (n) => n === 3 && setStatus("in_progress"));
- time += PAUSE_MS + 800;
- after(time, () => setPhase("writer"));
- time = playRun(time, t.writerSteps, "writerPosted");
- time += PAUSE_MS + 800;
- after(time, () => setPhase("recheck"));
- playRun(time, t.recheckSteps, "yourTurn");
- };
-
- const send = () => {
- setPhase("final");
- playRun(0, t.finalSteps, "done", (n) => n === 3 && setStatus("in_review"));
- };
-
- const replay = () => {
- clear();
- setPhase("start");
- setStatus("todo");
- setStepsShown(0);
- };
-
- const caption = visible ? t.captions[phase] : t.captions.idle;
-
- const run = (agent: string, steps: string[], active: boolean, leader = false) => (
- <DemoRun agent={leader ? `${agent} · ${t.leaderTag}` : agent} status={active ? t.running : t.completed} active={active}>
- {active &&
- steps.slice(0, stepsShown).map((step, i) => (
- <DemoStep key={step} state={i === stepsShown - 1 ? "running" : "done"}>
- {step}
- </DemoStep>
- ))}
- </DemoRun>
- );
-
- const mention = (name: string) => <span className="font-medium text-brand">@{name}</span>;
-
- return (
- <DemoFrame frameRef={frameRef} title={t.title} caption={caption} onReplay={replay}>
- <div className="relative flex min-h-96 flex-col gap-3 p-4">
- <dl className="grid w-fit grid-cols-[auto_auto] items-center gap-x-6 gap-y-2 text-body">
- <dt className="text-caption text-muted-foreground">{t.statusLabel}</dt>
- <dd className="flex items-center gap-1.5">
- <span aria-hidden className={cn("size-3 rounded-full border-2 transition-colors", statusDot[status])} />
- <span key={status} className="motion-safe:animate-in motion-safe:fade-in">
- {t.status[status]}
- </span>
- </dd>
- <dt className="text-caption text-muted-foreground">{t.assigneeLabel}</dt>
- <dd className="relative">
- <CoachMark active={visible && phase === "start"} side="right" ringClassName="rounded-md">
- <button
- type="button"
- aria-haspopup="listbox"
- aria-expanded={phase === "pick"}
- disabled={!visible || (phase !== "start" && phase !== "pick")}
- onClick={() => setPhase(phase === "pick" ? "start" : "pick")}
- className="-mx-1.5 inline-flex h-7 items-center gap-1.5 rounded-md px-1.5 hover:bg-muted disabled:hover:bg-transparent"
- >
- {assigned ? (
- <>
- <SquadAvatar />
- {t.squad}
- </>
- ) : (
- <span className="text-muted-foreground">{t.unassigned}</span>
- )}
- {(phase === "start" || phase === "pick") && (
- <ChevronDown aria-hidden className="size-3.5 text-muted-foreground" />
- )}
- </button>
- </CoachMark>
- {phase === "pick" && (
- <div
- role="listbox"
- aria-label={t.assigneeLabel}
- className="absolute top-full left-0 z-10 mt-1 w-52 rounded-lg border bg-popover p-1 text-popover-foreground shadow-md motion-safe:animate-in motion-safe:fade-in"
- >
- {(["member", "agent", "squad"] as const).map((kind) => (
- <div key={kind}>
- <div className="px-2 pt-1 pb-0.5 text-micro text-muted-foreground">{t.groups[kind]}</div>
- {t.candidates
- .filter((c) => c.kind === kind)
- .map((candidate) => {
- const target = kind === "squad";
- return (
- <CoachMark
- key={candidate.name}
- active={target}
- side="right"
- ringClassName="rounded-md"
- className="flex w-full"
- >
- <button
- type="button"
- role="option"
- aria-selected={false}
- disabled={!target}
- onClick={() => setPhase("confirm")}
- className="flex w-full items-center gap-2 rounded-md px-2 py-1.5 text-left text-body hover:bg-accent disabled:hover:bg-transparent"
- >
- {kind === "squad" ? <SquadAvatar /> : <DemoAvatar name={candidate.name} agent={kind === "agent"} />}
- {candidate.name}
- </button>
- </CoachMark>
- );
- })}
- </div>
- ))}
- </div>
- )}
- </dd>
- </dl>
-
- {at("leader") && run(t.leader, t.leaderSteps, phase === "leader", true)}
- {at("leaderPosted") && (
- <>
- <DemoComment author={t.leader} agent>
- <span className="block">
- {mention(t.writer)} {t.dispatch.writer}
- </span>
- <span className="block">
- {mention(t.you)} {t.dispatch.you}
- </span>
- </DemoComment>
- <Activity actor={t.leader}>{t.dispatchActivity}</Activity>
- </>
- )}
- {at("writer") && run(t.writer, t.writerSteps, phase === "writer")}
- {at("writerPosted") && (
- <DemoComment author={t.writer} agent>
- {t.writerReply}
- </DemoComment>
- )}
- {at("recheck") && run(t.leader, t.recheckSteps, phase === "recheck", true)}
- {at("yourTurn") && <Activity actor={t.leader}>{t.noActionActivity}</Activity>}
-
- {phase === "yourTurn" && (
- <div className="rounded-lg border bg-background p-2 motion-safe:animate-in motion-safe:fade-in">
- <div className="min-h-10 px-1 text-body">{t.yourDraft}</div>
- <div className="mt-1 flex justify-end">
- <CoachMark active side="left" ringClassName="rounded-full">
- <DemoSendButton label={t.send} onClick={send} />
- </CoachMark>
- </div>
- </div>
- )}
-
- {at("final") && (
- <>
- <DemoComment author={t.you}>{t.yourDraft}</DemoComment>
- {run(t.leader, t.finalSteps, phase === "final", true)}
- </>
- )}
- {phase === "done" && (
- <>
- <DemoComment author={t.leader} agent>
- {t.summary}
- </DemoComment>
- <Activity actor={t.leader}>{t.finalActivity}</Activity>
- </>
- )}
-
- {phase === "confirm" && (
- <div className="absolute inset-0 z-20 flex items-center justify-center bg-background/60 p-4 backdrop-blur-[2px] motion-safe:animate-in motion-safe:fade-in">
- <div
- role="dialog"
- aria-modal="false"
- aria-labelledby="squad-demo-title"
- className="w-full max-w-sm rounded-xl border bg-popover text-popover-foreground shadow-lg motion-safe:animate-in motion-safe:zoom-in-95"
- >
- <div className="flex items-start gap-2 p-4 pb-3">
- <div className="min-w-0 flex-1">
- <div id="squad-demo-title" className="text-title-sm font-medium">
- {t.confirmTitle}
- </div>
- <div className="mt-1 text-body text-muted-foreground">{t.confirmBody(t.squad)}</div>
- </div>
- <button
- type="button"
- aria-label={t.close}
- onClick={replay}
- className="rounded-md p-1 text-muted-foreground hover:bg-muted"
- >
- <X className="size-4" />
- </button>
- </div>
- <div className="flex justify-end gap-2 rounded-b-xl border-t bg-muted/40 px-4 py-3">
- <Button type="button" variant="outline" size="sm" disabled>
- {t.dontStart}
- </Button>
- <CoachMark active side="bottom" align="end" ringClassName="rounded-lg">
- <Button type="button" size="sm" onClick={confirm}>
- {t.confirm}
- </Button>
- </CoachMark>
- </div>
- </div>
- </div>
- )}
- </div>
- </DemoFrame>
- );
-}
-
-function SquadAvatar() {
- return (
- <span
- aria-hidden
- className="inline-flex size-5 shrink-0 items-center justify-center rounded-md bg-muted text-foreground"
- >
- <Users className="size-3" />
- </span>
- );
-}
-
-/** A line in the issue's activity timeline, e.g. the leader's recorded evaluation. */
-function Activity({ actor, children }: { actor: string; children: string }) {
- return (
- <div className="flex min-w-0 items-start gap-2 px-1 text-caption text-muted-foreground motion-safe:animate-in motion-safe:fade-in">
- <DemoAvatar name={actor} agent />
- <span className="min-w-0 pt-0.5">
- <span className="font-medium text-foreground">{actor}</span> {children}
- </span>
- </div>
- );
+ const meta = CLIP_MANIFEST.squad ?? { duration: 5.5, chapters: [] };
+ const chapters = t.chapters.map((label, i) => ({
+ label,
+ at: meta.chapters[i]?.at ?? (i * meta.duration) / t.chapters.length,
+ }));
+ return <EditorialClip slug="squad" title={t.title} chapters={chapters} duration={meta.duration} caption={t.caption} />;
}
diff --git a/apps/docs/components/demos/steer-demo.tsx b/apps/docs/components/demos/steer-demo.tsx
index ac84f92292..46587c3a83 100644
--- a/apps/docs/components/demos/steer-demo.tsx
+++ b/apps/docs/components/demos/steer-demo.tsx
@@ -1,306 +1,47 @@
"use client";
-import { useEffect, useState } from "react";
-import { CornerDownRight } from "@multica/ui/icons";
-import {
- CoachMark,
- DemoAvatar,
- DemoComment,
- DemoFrame,
- DemoReceipt,
- DemoRun,
- DemoSendButton,
- DemoSteerMarker,
- DemoStep,
- useDemoCopy,
- useDemoTimers,
- useStartWhenVisible,
-} from "./demo-kit";
-
-const FEEDBACK_TOTAL = 86;
+import { CLIP_MANIFEST } from "./clip-manifest";
+import { EditorialClip, useDemoCopy } from "./demo-kit";
const copy = {
en: {
- title: "OPS-12 · Turn this month's customer feedback into a weekly-meeting summary",
- agent: "Ops helper",
- you: "You",
- running: "Running",
- completed: "Completed",
- readTask: "Read the issue description and discussion",
- openSheet: `Open the feedback sheet (${FEEDBACK_TOTAL} entries)`,
- perItem: (n: number) => `Write a summary for each entry (${n}/${FEEDBACK_TOTAL})`,
- afterSteer: [
- "Group the feedback by theme: pricing, getting started, support response",
- "Write one takeaway per theme and pick 1–2 customer quotes",
- "Put it together on a single page",
- ],
- draft:
- "No need to summarize every entry. Group them by theme, give each theme one takeaway and 1–2 quotes, and keep it to one page.",
- placeholder: "Leave a comment...",
- chip: "Add to current run",
- send: "Send",
- waiting: "Waiting for Ops helper to read it",
- read: "Read by Ops helper · after step 3",
- steerLabel: "You steered",
- steerDetail: "Read",
- reply:
- "The summary is ready: three themes, each with one takeaway and two customer quotes, all on one page.",
- captions: {
- idle: "Ops helper is working on this issue.",
- working: "Ops helper is heading the wrong way: it is summarizing all 86 entries one by one.",
- ready: "The correction is already in the composer, and its recipient says \"Add to current run\". Click send.",
- sent: "Sent. Ops helper reads it as soon as the current step ends.",
- read: "It read the message and kept going in the new direction instead of starting over.",
- done: "Same run, new direction, original task finished. Use Replay to watch again.",
- },
+ title: "Steer a running agent mid-turn",
+ chapters: ["Active run", "Send correction", "Redirected output"],
+ caption: "Send a comment while the agent is working to add it to the current run instead of stopping and starting over.",
},
zh: {
- title: "OPS-12 · 把本月客户反馈整理成周会汇报",
- agent: "运营助手",
- you: "你",
- running: "运行中",
- completed: "已完成",
- readTask: "读取任务描述和讨论",
- openSheet: `打开客户反馈表(共 ${FEEDBACK_TOTAL} 条)`,
- perItem: (n: number) => `逐条撰写反馈摘要(${n}/${FEEDBACK_TOTAL})`,
- afterSteer: [
- "按主题归类:价格、上手难度、客服响应",
- "每类写一句结论,挑 1–2 条客户原话",
- "整理成一页汇报",
- ],
- draft: "不用逐条写摘要。按主题分几类,每类一句结论加 1–2 条原话,一页纸以内。",
- placeholder: "留下评论...",
- chip: "插话到当前运行",
- send: "发送",
- waiting: "等待 运营助手 读取",
- read: "运营助手 已读取 · 第 3 步后",
- steerLabel: "你 插话",
- steerDetail: "已读取",
- reply: "汇报已整理好:反馈分成 3 类,每类一句结论和 2 条客户原话,控制在一页内。",
- captions: {
- idle: "运营助手 正在执行这条任务。",
- working: "运营助手 的方向跑偏了:它在给 86 条反馈逐条写摘要。",
- ready: "评论框里已经写好了修正,收件人标签是\"插话到当前运行\"。点击发送。",
- sent: "插话已发出。运营助手 会在当前步骤结束后读到。",
- read: "它读到插话后没有从头开始,而是沿着新方向继续执行原任务。",
- done: "同一次运行、换了方向、完成了原任务。点右上角可以重新演示。",
- },
+ title: "给运行中的智能体插话纠偏",
+ chapters: ["运行进行中", "发送插话修正", "沿新方向完成"],
+ caption: "在智能体执行期间直接发送修正评论,消息会加入当前运行并在下一步边界生效,无需中断重来。",
+ },
+ "zh-Hant": {
+ title: "給執行中的智能體插話糾偏",
+ chapters: ["執行進行中", "發送插話修正", "沿新方向完成"],
+ caption: "在智能體執行期間直接發送修正評論,訊息會加入目前執行,無需中斷重來。",
},
ja: {
- title: "OPS-12 · 今月の顧客フィードバックを週次ミーティング用にまとめる",
- agent: "運用アシスタント",
- you: "あなた",
- running: "実行中",
- completed: "完了",
- readTask: "タスクの説明とコメントを読む",
- openSheet: `フィードバック表を開く(全 ${FEEDBACK_TOTAL} 件)`,
- perItem: (n: number) => `1 件ずつ要約を書く(${n}/${FEEDBACK_TOTAL})`,
- afterSteer: [
- "テーマ別に分ける:価格、使い始めやすさ、サポートの対応",
- "テーマごとに結論を 1 文書き、顧客の声を 1〜2 件選ぶ",
- "1 ページにまとめる",
- ],
- draft:
- "1 件ずつ要約しなくて大丈夫です。テーマ別に分けて、テーマごとに結論 1 文と顧客の声 1〜2 件、全体で 1 ページ以内にしてください。",
- placeholder: "コメントを残す...",
- chip: "現在の実行に追加",
- send: "送信",
- waiting: "運用アシスタント が読むのを待っています",
- read: "運用アシスタント が読みました · ステップ 3 の後",
- steerLabel: "あなた が追加",
- steerDetail: "既読",
- reply: "まとめができました。フィードバックを 3 つのテーマに分け、それぞれ結論 1 文と顧客の声 2 件を付けて 1 ページに収めています。",
- captions: {
- idle: "運用アシスタント がこのタスクを実行しています。",
- working: "運用アシスタント の進め方がずれています。86 件のフィードバックを 1 件ずつ要約しています。",
- ready: "修正の指示はもうコメント欄に書いてあり、送り先は「現在の実行に追加」になっています。送信をクリックします。",
- sent: "送信しました。運用アシスタント は今のステップが終わりしだい読みます。",
- read: "メッセージを読んだあと、最初からやり直さずに新しい方向で作業を続けています。",
- done: "同じ実行のまま方向を変え、元のタスクを終えました。「もう一度」で最初から見られます。",
- },
+ title: "実行中のエージェントに途中で指示を追加",
+ chapters: ["実行中", "修正コメント送信", "方向転換して完了"],
+ caption: "実行を止めずにコメントで修正を送ると、現在の実行に取り込まれて新しい方針で完了します。",
},
ko: {
- title: "OPS-12 · 이번 달 고객 피드백을 주간 회의 보고로 정리",
- agent: "운영 도우미",
- you: "나",
- running: "실행 중",
- completed: "완료됨",
- readTask: "태스크 설명과 댓글 읽기",
- openSheet: `고객 피드백 시트 열기(총 ${FEEDBACK_TOTAL}건)`,
- perItem: (n: number) => `피드백을 한 건씩 요약(${n}/${FEEDBACK_TOTAL})`,
- afterSteer: [
- "주제별로 분류: 가격, 시작 난이도, 고객 지원 응답",
- "주제마다 결론 한 문장을 쓰고 고객 발언 1~2개 고르기",
- "한 페이지로 정리",
- ],
- draft:
- "한 건씩 요약할 필요 없어요. 주제별로 나누고, 주제마다 결론 한 문장과 고객 발언 1~2개만 넣어 한 페이지 안으로 정리해 주세요.",
- placeholder: "댓글 남기기...",
- chip: "현재 실행에 추가",
- send: "보내기",
- waiting: "운영 도우미가 읽기를 기다리는 중",
- read: "운영 도우미가 읽음 · 3단계 후",
- steerLabel: "내가 추가",
- steerDetail: "읽음",
- reply: "보고를 정리했습니다. 피드백을 3개 주제로 나누고, 주제마다 결론 한 문장과 고객 발언 2개를 붙여 한 페이지에 담았습니다.",
- captions: {
- idle: "운영 도우미가 이 태스크를 실행하고 있습니다.",
- working: "운영 도우미가 엉뚱한 방향으로 가고 있습니다. 피드백 86건을 한 건씩 요약하는 중입니다.",
- ready: "수정 내용은 이미 댓글 입력란에 있고, 받는 사람 표시는 '현재 실행에 추가'입니다. 보내기를 클릭하세요.",
- sent: "보냈습니다. 운영 도우미는 현재 단계가 끝나는 대로 읽습니다.",
- read: "메시지를 읽은 뒤 처음부터 다시 하지 않고 새 방향으로 이어서 작업합니다.",
- done: "같은 실행에서 방향만 바꿔 원래 태스크를 끝냈습니다. '다시 보기'로 다시 볼 수 있습니다.",
- },
+ title: "실행 중인 에이전트 방향 수정하기",
+ chapters: ["실행 중", "수정 지시 전송", "새 방향으로 완료"],
+ caption: "실행을 멈추지 않고 댓글을 보내면 현재 실행에 합류해 수정된 방향으로 작업을 마무리합니다.",
},
fr: {
- title: "OPS-12 · Résumer les retours clients du mois pour la réunion hebdo",
- agent: "Assistant ops",
- you: "Vous",
- running: "En cours",
- completed: "Terminée",
- readTask: "Lire la description et la discussion de la tâche",
- openSheet: `Ouvrir le tableau des retours (${FEEDBACK_TOTAL} entrées)`,
- perItem: (n: number) => `Résumer chaque entrée (${n}/${FEEDBACK_TOTAL})`,
- afterSteer: [
- "Regrouper les retours par thème : prix, prise en main, réactivité du support",
- "Écrire une conclusion par thème et choisir 1 à 2 citations de clients",
- "Tout rassembler sur une seule page",
- ],
- draft:
- "Inutile de résumer chaque entrée. Regroupez-les par thème, avec une conclusion et 1 à 2 citations par thème, sur une page au maximum.",
- placeholder: "Laisser un commentaire...",
- chip: "Ajouter à l'exécution en cours",
- send: "Envoyer",
- waiting: "En attente de lecture par Assistant ops",
- read: "Lu par Assistant ops · après l'étape 3",
- steerLabel: "Vous avez ajouté",
- steerDetail: "Lu",
- reply: "Le résumé est prêt : trois thèmes, chacun avec une conclusion et deux citations de clients, le tout sur une page.",
- captions: {
- idle: "Assistant ops travaille sur cette tâche.",
- working: "Assistant ops part dans la mauvaise direction : il résume les 86 entrées une par une.",
- ready:
- "La correction est déjà dans la zone de commentaire, et son destinataire indique « Ajouter à l'exécution en cours ». Cliquez sur envoyer.",
- sent: "Envoyé. Assistant ops le lira dès la fin de l'étape en cours.",
- read: "Il a lu le message et poursuit dans la nouvelle direction au lieu de tout recommencer.",
- done: "Même exécution, nouvelle direction, tâche d'origine terminée. Utilisez Rejouer pour revoir la démo.",
- },
+ title: "Réorienter un agent en cours d'exécution",
+ chapters: ["Exécution active", "Envoyer correction", "Résultat ajusté"],
+ caption: "Envoyez une correction pendant le travail : elle s'ajoute à l'exécution en cours sans tout redémarrer.",
},
};
-type Phase = "idle" | "working" | "ready" | "sent" | "read" | "done";
-
export function SteerDemo() {
const t = useDemoCopy(copy);
- const { after, clear } = useDemoTimers();
- const [frameRef, visible] = useStartWhenVisible<HTMLElement>();
- const [run, setRun] = useState(0);
- const [phase, setPhase] = useState<Phase>("idle");
- const [stepsShown, setStepsShown] = useState(0);
- const [count, setCount] = useState(1);
- const [newSteps, setNewSteps] = useState(0);
-
- // Opening: the agent works through its first steps, then starts the
- // item-by-item loop the reader is about to correct.
- useEffect(() => {
- if (!visible) return;
- clear();
- setPhase("working");
- setStepsShown(1);
- after(900, () => setStepsShown(2));
- after(1900, () => setStepsShown(3));
- after(2600, () => setPhase("ready"));
- }, [visible, run, after, clear]);
-
- // The wrong-direction loop keeps ticking until the steer is read.
- const looping = stepsShown >= 3 && (phase === "working" || phase === "ready" || phase === "sent");
- useEffect(() => {
- if (!looping) return;
- const id = window.setInterval(() => setCount((n) => Math.min(n + 1, 5)), 900);
- return () => window.clearInterval(id);
- }, [looping]);
-
- const send = () => {
- setPhase("sent");
- after(1800, () => setPhase("read"));
- for (let i = 1; i <= t.afterSteer.length; i++) after(1800 + i * 900, () => setNewSteps(i));
- after(1800 + t.afterSteer.length * 900 + 900, () => setPhase("done"));
- };
-
- const replay = () => {
- clear();
- setStepsShown(0);
- setCount(1);
- setNewSteps(0);
- setPhase("idle");
- setRun((r) => r + 1);
- };
-
- const sent = phase === "sent" || phase === "read" || phase === "done";
- const read = phase === "read" || phase === "done";
- // Only once the opening has finished: its last timer moves the phase to
- // "ready" and would otherwise overwrite a steer sent during the opening.
- const canSend = phase === "ready";
- const caption =
- phase === "working" && stepsShown >= 3 ? t.captions.working : t.captions[phase];
-
- return (
- <DemoFrame frameRef={frameRef} title={t.title} caption={caption} onReplay={replay}>
- <div className="flex min-h-80 flex-col gap-3 p-4">
- <DemoRun
- agent={t.agent}
- status={phase === "done" ? t.completed : t.running}
- active={phase !== "done"}
- >
- {stepsShown >= 1 && <DemoStep state={stepsShown > 1 ? "done" : "running"}>{t.readTask}</DemoStep>}
- {stepsShown >= 2 && <DemoStep state={stepsShown > 2 ? "done" : "running"}>{t.openSheet}</DemoStep>}
- {stepsShown >= 3 && (
- <DemoStep state={read ? "done" : "running"}>{t.perItem(count)}</DemoStep>
- )}
- {read && <DemoSteerMarker label={t.steerLabel} detail={t.steerDetail} />}
- {t.afterSteer.slice(0, newSteps).map((step, i) => (
- <DemoStep key={step} state={i === newSteps - 1 && phase !== "done" ? "running" : "done"}>
- {step}
- </DemoStep>
- ))}
- </DemoRun>
-
- {sent && (
- <DemoComment
- author={t.you}
- footer={<DemoReceipt read={read}>{read ? t.read : t.waiting}</DemoReceipt>}
- >
- {t.draft}
- </DemoComment>
- )}
-
- {phase === "done" && (
- <DemoComment author={t.agent} agent>
- {t.reply}
- </DemoComment>
- )}
-
- <div className="mt-auto rounded-lg border bg-background p-2">
- {/* Static text, not an input: the demo is scripted around this exact correction. */}
- <div className="min-h-12 px-1 text-body">
- {sent || phase === "idle" ? <span className="text-muted-foreground">{t.placeholder}</span> : t.draft}
- </div>
- <div className="mt-1.5 flex items-center gap-2">
- {!sent && phase !== "idle" && (
- <span className="inline-flex h-6 min-w-0 items-center gap-1.5 rounded-md border border-brand/28 bg-brand/7 px-1.5 text-caption dark:border-brand/45 dark:bg-brand/12">
- <DemoAvatar name={t.agent} agent />
- <span className="truncate">{t.agent}</span>
- <CornerDownRight aria-hidden className="size-3 shrink-0 text-brand" />
- <span className="truncate font-medium">{t.chip}</span>
- </span>
- )}
- <span className="ml-auto" />
- <CoachMark active={phase === "ready" && canSend} side="left" ringClassName="rounded-full">
- <DemoSendButton label={t.send} disabled={!canSend} onClick={send} />
- </CoachMark>
- </div>
- </div>
- </div>
- </DemoFrame>
- );
+ const meta = CLIP_MANIFEST.steer ?? { duration: 7.0, chapters: [] };
+ const chapters = t.chapters.map((label, i) => ({
+ label,
+ at: meta.chapters[i]?.at ?? (i * meta.duration) / t.chapters.length,
+ }));
+ return <EditorialClip slug="steer" title={t.title} chapters={chapters} duration={meta.duration} caption={t.caption} />;
}
diff --git a/apps/docs/components/demos/trigger-chooser-demo.tsx b/apps/docs/components/demos/trigger-chooser-demo.tsx
index bc9bcba727..2cf6f8643e 100644
--- a/apps/docs/components/demos/trigger-chooser-demo.tsx
+++ b/apps/docs/components/demos/trigger-chooser-demo.tsx
@@ -1,13 +1,12 @@
"use client";
import { useState } from "react";
-import { ArrowRight, Check } from "@multica/ui/icons";
+import { ArrowRight } from "@multica/ui/icons";
import { cn } from "@multica/ui/lib/utils";
import { LocaleLink } from "@/components/locale-link";
-import { CoachMark, DemoFrame, useDemoCopy, useStartWhenVisible } from "./demo-kit";
+import { EditorialUtility, useDemoCopy } from "./demo-kit";
type Choice = {
- /** The situation, worded as in the page's table. */
need: string;
method: string;
how: string;
@@ -19,8 +18,6 @@ type Choice = {
const copy = {
en: {
title: "Which way should I start the work?",
- needsLabel: "What you need",
- useLabel: "Use",
howLabel: "How",
whyLabel: "Why",
choices: [
@@ -44,7 +41,7 @@ const copy = {
need: "Send the same kind of request often",
method: "Quick action",
how: "Save the request as a quick action and use it from the issue.",
- why: "Save who to ask and what to say once, then use the same request on other issues.",
+ why: "Save who to ask and what to say once, then reuse the same request on other issues.",
page: "Quick Actions",
href: "/quick-actions",
},
@@ -52,7 +49,7 @@ const copy = {
need: "Pass work through a repeatable set of steps",
method: "Workflow",
how: "Choose a project workflow and who takes over at each step.",
- why: "The description, discussion, and earlier results stay on the same issue, so whoever handles the next step picks up where the last one left off.",
+ why: "The description, discussion, and earlier results stay on the same issue so the next handler picks up in place.",
page: "Workflows",
href: "/workflows",
},
@@ -60,7 +57,7 @@ const copy = {
need: "Ask a question without creating an issue",
method: "Chat",
how: "Start a chat with the agent.",
- why: "A chat is not bound to any issue, and the entire conversation is private to you.",
+ why: "A chat is not bound to any issue, and the entire conversation stays private to you.",
page: "Chat with agents",
href: "/chat",
},
@@ -68,30 +65,23 @@ const copy = {
need: "Start recurring work by time or an outside event",
method: "Autopilot",
how: "Create an autopilot with an assignee and one or more triggers.",
- why: "When triggered, Multica creates an issue or runs the agent directly, and keeps a record of every run.",
+ why: "When triggered, Multica creates an issue or runs the agent directly and records every run.",
page: "Autopilots",
href: "/autopilots",
},
{
need: "Have an agent come back to an issue later",
method: "Wakeup",
- how: "In the issue sidebar, add a wakeup with a time or an event to wait for.",
- why: "When the time comes or the event happens, the agent starts a new run on the same issue and continues from where things stand.",
+ how: "In the issue sidebar, add a wakeup with a time or event condition.",
+ why: "When the condition holds, the agent starts a new run on the same issue from where things stand.",
page: "Issue wakeups",
href: "/issue-wakeups",
},
] as Choice[],
readMore: (page: string) => `Read: ${page}`,
- captions: {
- idle: "Seven things you might want an agent to do.",
- start: "Pick what you need to see which way fits.",
- picked: (method: string) => `Use ${method}. Pick another need to compare.`,
- },
},
zh: {
title: "该用哪种方式让智能体开始工作?",
- needsLabel: "你想做什么",
- useLabel: "使用",
howLabel: "怎么做",
whyLabel: "为什么",
choices: [
@@ -115,7 +105,7 @@ const copy = {
need: "经常发送同一类请求",
method: "快捷操作",
how: "把请求保存成快捷操作,在任务中直接使用。",
- why: "保存一次\"请谁来做、做什么\",之后就能在其他任务上重复使用。",
+ why: "保存一次「请谁来做、做什么」,之后就能在其他任务上重复使用。",
page: "快捷操作",
href: "/quick-actions",
},
@@ -153,17 +143,73 @@ const copy = {
},
] as Choice[],
readMore: (page: string) => `详见${page}`,
- captions: {
- idle: "你可能想让智能体做的七类事。",
- start: "选一件你想做的事,看看该用哪种方式。",
- // Space before a method that starts with "@" or a Latin letter, e.g. "用 @提及".
- picked: (method: string) => `用${/^[@A-Za-z]/.test(method) ? " " : ""}${method}。换一件事可以对比。`,
- },
+ },
+ "zh-Hant": {
+ title: "該用哪種方式讓智能體開始工作?",
+ howLabel: "怎麼做",
+ whyLabel: "為什麼",
+ choices: [
+ {
+ need: "讓智能體負責一條任務",
+ method: "指派任務",
+ how: "開啟任務,點擊負責人,選擇智能體或小隊。",
+ why: "智能體會讀取任務的說明和討論,並把進展和結果寫回原來的任務。",
+ page: "指派任務給智能體",
+ href: "/assigning-issues",
+ },
+ {
+ need: "請求協助,保留原來的負責人",
+ method: "@提及",
+ how: "在評論中 @智能體,或回覆它的評論繼續討論。",
+ why: "評論會成為這次執行的起點,任務的負責人和狀態都不會改變。",
+ page: "在評論中 @智能體",
+ href: "/mentioning-agents",
+ },
+ {
+ need: "經常發送同一類請求",
+ method: "快捷操作",
+ how: "把請求儲存成快捷操作,在任務中直接使用。",
+ why: "儲存一次「請誰來做、做什麼」,之後就能在其他任務上重複使用。",
+ page: "快捷操作",
+ href: "/quick-actions",
+ },
+ {
+ need: "讓任務按固定步驟交給不同處理人",
+ method: "工作流",
+ how: "為專案選擇工作流,安排每一步由誰接手。",
+ why: "任務的描述、討論和之前的結果都留在原處,下一位處理人可以接著做。",
+ page: "工作流",
+ href: "/workflows",
+ },
+ {
+ need: "問一個問題,不需要新建任務",
+ method: "對話",
+ how: "與智能體開始對話。",
+ why: "對話不綁定某一條任務,整段對話完全私人。",
+ page: "與智能體對話",
+ href: "/chat",
+ },
+ {
+ need: "按時間或外部事件展開重複性工作",
+ method: "自動化",
+ how: "建立自動化,選好執行方和觸發器。",
+ why: "觸發後,Multica 會建立任務或直接執行智能體,並保留每一次執行記錄。",
+ page: "自動化",
+ href: "/autopilots",
+ },
+ {
+ need: "讓智能體之後再回到某條任務",
+ method: "任務喚醒",
+ how: "在任務側欄新增喚醒,設好要等的時間或事件。",
+ why: "時間到了或事件發生後,智能體在同一條任務上開始新的執行,接著現在的進度做。",
+ page: "任務喚醒",
+ href: "/issue-wakeups",
+ },
+ ] as Choice[],
+ readMore: (page: string) => `詳見${page}`,
},
ja: {
title: "どの方法でエージェントに作業を始めてもらう?",
- needsLabel: "やりたいこと",
- useLabel: "使うもの",
howLabel: "やり方",
whyLabel: "理由",
choices: [
@@ -225,16 +271,9 @@ const copy = {
},
] as Choice[],
readMore: (page: string) => `詳しくは${page}`,
- captions: {
- idle: "エージェントに頼みたいことは、主に 7 種類あります。",
- start: "やりたいことを選ぶと、合う方法が表示されます。",
- picked: (method: string) => `${method}を使います。別の項目を選ぶと比べられます。`,
- },
},
ko: {
title: "어떤 방식으로 작업을 시작할까요?",
- needsLabel: "하고 싶은 일",
- useLabel: "사용할 기능",
howLabel: "방법",
whyLabel: "이유",
choices: [
@@ -296,17 +335,9 @@ const copy = {
},
] as Choice[],
readMore: (page: string) => `자세히: ${page}`,
- captions: {
- idle: "에이전트에게 맡길 만한 일 일곱 가지입니다.",
- start: "하고 싶은 일을 고르면 맞는 방법을 보여 줍니다.",
- // Phrased so no particle has to agree with the method's final consonant.
- picked: (method: string) => `${method} 기능을 사용하세요. 다른 일을 골라 비교해 보세요.`,
- },
},
fr: {
title: "Comment lancer le travail ?",
- needsLabel: "Votre besoin",
- useLabel: "À utiliser",
howLabel: "Comment",
whyLabel: "Pourquoi",
choices: [
@@ -368,88 +399,80 @@ const copy = {
},
] as Choice[],
readMore: (page: string) => `Voir : ${page}`,
- captions: {
- idle: "Sept choses que vous pourriez demander à un agent.",
- start: "Choisissez votre besoin pour voir la méthode adaptée.",
- picked: (method: string) => `À utiliser : ${method}. Choisissez un autre besoin pour comparer.`,
- },
},
};
export function TriggerChooserDemo() {
const t = useDemoCopy(copy);
- const [frameRef, visible] = useStartWhenVisible<HTMLElement>();
- const [picked, setPicked] = useState<number | null>(null);
-
- const choice = picked === null ? null : t.choices[picked];
- const caption = !visible ? t.captions.idle : choice ? t.captions.picked(choice.method) : t.captions.start;
+ const [picked, setPicked] = useState(0);
+ const choice = t.choices[picked] ?? t.choices[0]!;
return (
- <DemoFrame frameRef={frameRef} title={t.title} caption={caption} onReplay={() => setPicked(null)}>
- <div className="grid gap-4 p-4 sm:grid-cols-[minmax(0,1fr)_minmax(0,1.1fr)]">
- <div className="min-w-0">
- <div id="trigger-chooser-needs" className="mb-1.5 text-micro text-muted-foreground">
- {t.needsLabel}
- </div>
- <ul aria-labelledby="trigger-chooser-needs" className="flex flex-col gap-1">
- {t.choices.map((c, i) => (
- <li key={c.need} className="flex">
- <CoachMark
- active={visible && picked === null && i === 0}
- side="right"
- ringClassName="rounded-md"
- className="flex w-full"
- >
- <button
- type="button"
- aria-pressed={picked === i}
- disabled={!visible}
- onClick={() => setPicked(i)}
- className={cn(
- "flex w-full items-center gap-2 rounded-md border px-2.5 py-1.5 text-left text-body transition-colors outline-none focus-visible:ring-3 focus-visible:ring-ring/50",
- picked === i ? "border-brand bg-brand/10 font-medium" : "bg-background hover:bg-muted",
- )}
- >
- <span className="min-w-0 flex-1">{c.need}</span>
- {picked === i && <Check aria-hidden className="size-3.5 shrink-0 text-brand" />}
- </button>
- </CoachMark>
- </li>
- ))}
- </ul>
+ <EditorialUtility title={t.title}>
+ <div className="grid gap-5 md:grid-cols-[minmax(0,1.15fr)_minmax(0,1fr)]">
+ <div role="tablist" aria-label={t.title} className="flex flex-col border-t border-border">
+ {t.choices.map((c, i) => {
+ const active = picked === i;
+ return (
+ <button
+ key={c.href}
+ type="button"
+ role="tab"
+ aria-selected={active}
+ onClick={() => setPicked(i)}
+ className={cn(
+ "flex items-center justify-between gap-3 border-b border-border px-2.5 py-2 text-left text-[0.84375rem] transition-colors focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-ring",
+ active
+ ? "bg-accent font-medium text-foreground"
+ : "text-muted-foreground hover:bg-muted/60 hover:text-foreground",
+ )}
+ >
+ <span className="min-w-0 flex-1">{c.need}</span>
+ <span className="shrink-0 font-mono text-[0.7rem] text-[var(--primary)]">
+ → {c.method}
+ </span>
+ </button>
+ );
+ })}
</div>
- <div className={cn("min-w-0", !choice && "max-sm:hidden")}>
- {choice ? (
- <div
- key={picked}
- className="flex h-full flex-col gap-2.5 rounded-lg border bg-background p-3 motion-safe:animate-in motion-safe:fade-in"
- >
- <div>
- <div className="text-micro text-muted-foreground">{t.useLabel}</div>
- <div className="text-title-sm font-medium text-brand">{choice.method}</div>
+ <div
+ role="tabpanel"
+ className="flex flex-col justify-between gap-4 rounded-r-[4px] border border-border border-l-2 border-l-[var(--primary)] bg-card px-4 py-4"
+ >
+ <div className="flex flex-col gap-3">
+ <div>
+ <div className="font-mono text-[0.6875rem] font-semibold uppercase tracking-[0.08em] text-[var(--primary)]">
+ {choice.method}
</div>
- <div>
- <div className="text-micro text-muted-foreground">{t.howLabel}</div>
- <p className="text-body">{choice.how}</p>
+ <div className="mt-1 font-[family-name:var(--font-serif)] text-[1.125rem] leading-[1.35] text-foreground">
+ {choice.need}
</div>
- <div>
- <div className="text-micro text-muted-foreground">{t.whyLabel}</div>
- <p className="text-body text-muted-foreground">{choice.why}</p>
+ </div>
+ <div>
+ <div className="font-mono text-[0.6875rem] uppercase tracking-[0.06em] text-muted-foreground">
+ {t.howLabel}
</div>
- <LocaleLink
- href={choice.href}
- className="mt-auto inline-flex w-fit items-center gap-1 text-label font-medium text-brand hover:underline"
- >
- {t.readMore(choice.page)}
- <ArrowRight aria-hidden className="size-3.5" />
- </LocaleLink>
+ <p className="mt-0.5 text-[0.875rem] leading-[1.55] text-foreground">{choice.how}</p>
+ </div>
+ <div>
+ <div className="font-mono text-[0.6875rem] uppercase tracking-[0.06em] text-muted-foreground">
+ {t.whyLabel}
+ </div>
+ <p className="mt-0.5 text-[0.84375rem] leading-[1.55] text-muted-foreground">
+ {choice.why}
+ </p>
</div>
- ) : (
- <div aria-hidden className="h-full rounded-lg border border-dashed" />
- )}
+ </div>
+ <LocaleLink
+ href={choice.href}
+ className="inline-flex w-fit items-center gap-1.5 text-[0.8125rem] font-medium text-[var(--primary)] hover:underline"
+ >
+ {t.readMore(choice.page)}
+ <ArrowRight aria-hidden className="size-3.5" />
+ </LocaleLink>
</div>
</div>
- </DemoFrame>
+ </EditorialUtility>
);
}
diff --git a/apps/docs/components/demos/usage-demo.tsx b/apps/docs/components/demos/usage-demo.tsx
index 15b28bbde8..528cf0f46a 100644
--- a/apps/docs/components/demos/usage-demo.tsx
+++ b/apps/docs/components/demos/usage-demo.tsx
@@ -1,925 +1,47 @@
"use client";
-import { useEffect, useState, type CSSProperties } from "react";
-import { BarChart3, CalendarDays, ChevronDown, FolderKanban, RefreshCw } from "@multica/ui/icons";
-import { Button } from "@multica/ui/components/ui/button";
-import { cn } from "@multica/ui/lib/utils";
-import {
- CoachMark,
- DemoAvatar,
- DemoFrame,
- useDemoCopy,
- useDemoTimers,
- useStartWhenVisible,
-} from "./demo-kit";
-
-type Metric = "tokens" | "cost" | "time" | "runs";
-type Dim = "daily" | "weekly";
-type Tab = "usage" | "errors";
-type AgentKey = "ops" | "writing" | "support";
-type FailureClass = "auth" | "rate_limit" | "timeout";
-type Phase = "idle" | "metric" | "weekly" | "sort" | "errors" | "codes" | "done";
-
-// The product formats chart dates in English for every locale
-// (formatShortDate in packages/views/runtimes/utils.ts), so the demo does too.
-const MONTHS = ["Jan", "Feb", "Mar", "Apr", "May", "Jun", "Jul", "Aug", "Sep", "Oct", "Nov", "Dec"];
-const shortDate = (month: number, day: number) => `${MONTHS[month - 1]} ${day}`;
+import { CLIP_MANIFEST } from "./clip-manifest";
+import { EditorialClip, useDemoCopy } from "./demo-kit";
const copy = {
en: {
- title: "Analytics · Ops team, last 30 days",
- pageTitle: "Analytics",
- freshness: "GMT+8 · updated 10:30",
- refresh: "Refresh",
- tabs: { usage: "Usage", errors: "Errors" } as Record<Tab, string>,
- periodLabel: "Time range",
- projectLabel: "Project",
- allProjects: "All projects",
- kpi: {
- cost: "Cost · 30D",
- tokens: "Tokens · 30D",
- tokensHint: "Input 1.1M · Output 0.3M",
- time: "Run time · 30D",
- timeHint: "Across 143 runs",
- runs: "Runs · 30D",
- runsHint: "9 failed",
- },
- metricLabel: "Metric",
- dimLabel: "Dimension",
- metrics: { tokens: "Tokens", cost: "Cost", time: "Time", runs: "Runs" } as Record<Metric, string>,
- dims: { daily: "Daily", weekly: "Weekly" } as Record<Dim, string>,
- chartTitle: {
- daily: { tokens: "Daily tokens", cost: "Daily cost" },
- weekly: { tokens: "Weekly tokens", cost: "Weekly cost" },
- },
- shortDate,
- partial: (range: string, covered: number) => `${range} (partial · ${covered} / 7 days)`,
- leaderboard: {
- title: "Leaderboard",
- sortLabel: "Rank agents by",
- caption: "3 agents",
- agent: "Agent",
- },
- agents: { ops: "Ops helper", writing: "Writing helper", support: "Support helper" } as Record<AgentKey, string>,
- errors: {
- failedLabel: "Failed runs · 30D",
- failedHint: "Of 143 runs",
- rateLabel: "Failure rate · 30D",
- rateHint: "9 of 143 runs failed · 6.3%",
- agentsLabel: "Agents affected · 30D",
- agentsHint: "Worst Support helper · 6",
- mixTitle: "Failure mix · 9",
- showCodes: "Show error codes",
- hideCodes: "Hide error codes",
- classes: { auth: "Auth", rate_limit: "Rate limit", timeout: "Timeout" } as Record<FailureClass, string>,
- byAgent: "Top offenders",
- sortLabel: "Rank offenders by",
- sortFailed: "Failures",
- sortRate: "Rate",
- headerFailed: "Failed",
- headerRuns: "Runs",
- headerRate: "Rate",
- },
- captions: {
- idle: "Analytics for an operations team's three agents over the last 30 days.",
- metric: "The trend card charts tokens per day by default. Click Cost to see what each day cost.",
- weekly: "Weekdays cost more than weekends. Click Weekly to see each week's total.",
- sort: "Cost rises week over week; the faded bar is this week, still in progress. The leaderboard below ranks by tokens. Click Cost to re-rank it.",
- errors:
- "Writing helper uses the most tokens, yet Ops helper costs the most: its model has a higher rate. Click the Errors tab to see which runs failed.",
- codes: "9 of 143 runs failed, 6 of them Support helper's. Click Show error codes to see the exact reasons.",
- done: "5 failures are agent_error.provider_auth_or_access, and the bars show they all belong to Support helper: sign in to its AI coding tool again on its runtime, then retry. Use Replay to watch again.",
- } as Record<Phase, string>,
+ title: "Inspect token usage, cost, and error breakdowns",
+ chapters: ["Usage overview", "Switch metrics", "Errors tab"],
+ caption: "Analytics aggregates tokens, cost, runtime duration, and failure classes across projects and agents.",
},
zh: {
- title: "统计 · 运营团队近 30 天",
- pageTitle: "统计",
- freshness: "GMT+8 · 更新于 10:30",
- refresh: "刷新",
- tabs: { usage: "用量", errors: "错误" } as Record<Tab, string>,
- periodLabel: "时间范围",
- projectLabel: "项目",
- allProjects: "全部项目",
- kpi: {
- cost: "费用 · 30天",
- tokens: "Token · 30天",
- tokensHint: "输入 1.1M · 输出 0.3M",
- time: "耗时 · 30天",
- timeHint: "共 143 次运行",
- runs: "运行数 · 30天",
- runsHint: "失败 9 个",
- },
- metricLabel: "指标",
- dimLabel: "维度",
- metrics: { tokens: "Token", cost: "费用", time: "耗时", runs: "运行数" } as Record<Metric, string>,
- dims: { daily: "按天", weekly: "按周" } as Record<Dim, string>,
- chartTitle: {
- daily: { tokens: "每日 Token", cost: "每日费用" },
- weekly: { tokens: "每周 Token", cost: "每周费用" },
- },
- shortDate,
- partial: (range: string, covered: number) => `${range}(未满 · 已过 ${covered} / 7 天)`,
- leaderboard: {
- title: "排行榜",
- sortLabel: "智能体排序依据",
- caption: "3 个智能体",
- agent: "智能体",
- },
- agents: { ops: "运营助手", writing: "文案助手", support: "客服助手" } as Record<AgentKey, string>,
- errors: {
- failedLabel: "失败运行 · 30天",
- failedHint: "共 143 次运行",
- rateLabel: "失败率 · 30天",
- rateHint: "143 次运行中有 9 次失败 · 6.3%",
- agentsLabel: "受影响智能体 · 30天",
- agentsHint: "最多 客服助手 · 6 次",
- mixTitle: "失败构成 · 9",
- showCodes: "展开错误码",
- hideCodes: "收起错误码",
- classes: { auth: "认证", rate_limit: "限流", timeout: "超时" } as Record<FailureClass, string>,
- byAgent: "问题最多的智能体",
- sortLabel: "错误榜排序依据",
- sortFailed: "失败数",
- sortRate: "失败率",
- headerFailed: "失败数",
- headerRuns: "运行数",
- headerRate: "失败率",
- },
- captions: {
- idle: "运营团队三个智能体近 30 天的统计。",
- metric: "趋势卡片默认按天画 Token 用量。点击\"费用\",看每天花了多少钱。",
- weekly: "工作日花得多,周末花得少。点击\"按周\",看每周合计。",
- sort: "费用一周比一周高,颜色浅的那根是还没过完的本周。下面的排行榜按 Token 排序,点击\"费用\"重新排。",
- errors: "Token 用得最多的是文案助手,花钱最多的却是运营助手:它用的模型单价更高。点击\"错误\"页签,看哪些运行失败了。",
- codes: "143 次运行里失败了 9 次,其中 6 次是客服助手。点击\"展开错误码\"看具体原因。",
- done: "有 5 次失败是 agent_error.provider_auth_or_access,看条形图都出在客服助手:到它所在的运行时上重新登录 AI 编程工具,再重试。点右上角可以重新演示。",
- } as Record<Phase, string>,
+ title: "在统计页查看 Token、费用与错误分类",
+ chapters: ["用量总览", "切换指标与周期", "错误分类排查"],
+ caption: "统计页汇总各项目与智能体的 Token 消耗、费用、运行时长及失败类型分布,便于快速定位瓶颈。",
+ },
+ "zh-Hant": {
+ title: "在統計頁檢視 Token、費用與錯誤分類",
+ chapters: ["用量總覽", "切換指標與週期", "錯誤分類排查"],
+ caption: "統計頁彙整各專案與智能體的 Token 消耗、費用、執行時長與失敗類型分佈。",
},
ja: {
- title: "分析 · 運用チームの直近 30 日",
- pageTitle: "分析",
- freshness: "GMT+8 · 10:30 更新",
- refresh: "更新",
- tabs: { usage: "使用量", errors: "エラー" } as Record<Tab, string>,
- periodLabel: "期間",
- projectLabel: "プロジェクト",
- allProjects: "すべてのプロジェクト",
- kpi: {
- cost: "コスト · 30日",
- tokens: "トークン · 30日",
- tokensHint: "入力 1.1M · 出力 0.3M",
- time: "実行時間 · 30日",
- timeHint: "143 件の実行全体",
- runs: "実行 · 30日",
- runsHint: "9 件失敗",
- },
- metricLabel: "指標",
- dimLabel: "単位",
- metrics: { tokens: "トークン", cost: "コスト", time: "時間", runs: "実行" } as Record<Metric, string>,
- dims: { daily: "日別", weekly: "週別" } as Record<Dim, string>,
- chartTitle: {
- daily: { tokens: "日別トークン", cost: "日別コスト" },
- weekly: { tokens: "週別トークン", cost: "週別コスト" },
- },
- shortDate,
- partial: (range: string, covered: number) => `${range} (一部 · 7日中 ${covered}日)`,
- leaderboard: {
- title: "リーダーボード",
- sortLabel: "エージェントの並び順",
- caption: "3 件のエージェント",
- agent: "エージェント",
- },
- agents: {
- ops: "運用アシスタント",
- writing: "ライティングアシスタント",
- support: "サポートアシスタント",
- } as Record<AgentKey, string>,
- errors: {
- failedLabel: "失敗した実行 · 30日",
- failedHint: "143 回の実行中",
- rateLabel: "失敗率 · 30日",
- rateHint: "143 回中 9 回が失敗 · 6.3%",
- agentsLabel: "影響を受けたエージェント · 30日",
- agentsHint: "最多 サポートアシスタント · 6 回",
- mixTitle: "失敗の内訳 · 9",
- showCodes: "エラーコードを表示",
- hideCodes: "エラーコードを隠す",
- classes: { auth: "認証", rate_limit: "レート制限", timeout: "タイムアウト" } as Record<FailureClass, string>,
- byAgent: "失敗の多いエージェント",
- sortLabel: "失敗の多いエージェントの並び順",
- sortFailed: "失敗数",
- sortRate: "失敗率",
- headerFailed: "失敗",
- headerRuns: "実行",
- headerRate: "失敗率",
- },
- captions: {
- idle: "運用チームの 3 つのエージェントについて、直近 30 日の分析です。",
- metric: "推移カードは既定で日別のトークンを表示します。「コスト」をクリックして、日ごとの費用を見ます。",
- weekly: "平日は多く、週末は少なめです。「週別」をクリックして、週ごとの合計を見ます。",
- sort: "コストは週を追うごとに増えています。色の薄い棒はまだ途中の今週です。下のリーダーボードはトークン順なので、「コスト」をクリックして並べ替えます。",
- errors:
- "トークンが最も多いのはライティングアシスタントですが、コストが最も高いのは運用アシスタントです。使っているモデルの単価が高いためです。「エラー」タブをクリックして、失敗した実行を見ます。",
- codes: "143 回中 9 回が失敗し、そのうち 6 回はサポートアシスタントです。「エラーコードを表示」をクリックして、具体的な理由を見ます。",
- done: "5 回は agent_error.provider_auth_or_access で、棒を見るとすべてサポートアシスタントのものです。そのランタイムで AI コーディングツールに再ログインしてから再試行します。「もう一度」で最初から見られます。",
- } as Record<Phase, string>,
+ title: "トークン使用量・コスト・エラー内訳を確認する",
+ chapters: ["使用量サマリー", "指標を切替", "エラータブ"],
+ caption: "プロジェクトやエージェントごとのトークン数・コスト・実行時間・エラー種別を一覧で確認できます。",
},
ko: {
- title: "분석 · 운영팀 최근 30일",
- pageTitle: "분석",
- freshness: "GMT+8 · 10:30 업데이트",
- refresh: "새로고침",
- tabs: { usage: "사용량", errors: "오류" } as Record<Tab, string>,
- periodLabel: "기간",
- projectLabel: "프로젝트",
- allProjects: "모든 프로젝트",
- kpi: {
- cost: "비용 · 30일",
- tokens: "토큰 · 30일",
- tokensHint: "입력 1.1M · 출력 0.3M",
- time: "실행 시간 · 30일",
- timeHint: "실행 143개 기준",
- runs: "실행 · 30일",
- runsHint: "실패 9개",
- },
- metricLabel: "지표",
- dimLabel: "단위",
- metrics: { tokens: "토큰", cost: "비용", time: "시간", runs: "실행" } as Record<Metric, string>,
- dims: { daily: "일별", weekly: "주별" } as Record<Dim, string>,
- chartTitle: {
- daily: { tokens: "일별 토큰", cost: "일별 비용" },
- weekly: { tokens: "주별 토큰", cost: "주별 비용" },
- },
- shortDate,
- partial: (range: string, covered: number) => `${range} (부분 · 7일 중 ${covered}일)`,
- leaderboard: {
- title: "리더보드",
- sortLabel: "에이전트 순위 기준",
- caption: "에이전트 3개",
- agent: "에이전트",
- },
- agents: { ops: "운영 도우미", writing: "글쓰기 도우미", support: "고객지원 도우미" } as Record<AgentKey, string>,
- errors: {
- failedLabel: "실패한 실행 · 30일",
- failedHint: "실행 143회 중",
- rateLabel: "실패율 · 30일",
- rateHint: "실행 143회 중 9회 실패 · 6.3%",
- agentsLabel: "영향받은 에이전트 · 30일",
- agentsHint: "최다 고객지원 도우미 · 6회",
- mixTitle: "실패 구성 · 9",
- showCodes: "오류 코드 표시",
- hideCodes: "오류 코드 숨기기",
- classes: { auth: "인증", rate_limit: "속도 제한", timeout: "시간 초과" } as Record<FailureClass, string>,
- byAgent: "실패가 많은 에이전트",
- sortLabel: "오류 순위 기준",
- sortFailed: "실패 수",
- sortRate: "실패율",
- headerFailed: "실패",
- headerRuns: "실행",
- headerRate: "실패율",
- },
- captions: {
- idle: "운영팀 에이전트 3개의 최근 30일 분석입니다.",
- metric: "추이 카드는 기본으로 일별 토큰을 보여 줍니다. \"비용\"을 클릭해 날마다 얼마를 썼는지 보세요.",
- weekly: "평일에는 많이, 주말에는 적게 씁니다. \"주별\"을 클릭해 주마다 합계를 보세요.",
- sort: "비용이 주마다 늘고 있고, 색이 옅은 막대는 아직 끝나지 않은 이번 주입니다. 아래 리더보드는 토큰 순이니 \"비용\"을 클릭해 다시 정렬하세요.",
- errors:
- "토큰을 가장 많이 쓴 것은 글쓰기 도우미지만 비용이 가장 큰 것은 운영 도우미입니다. 쓰는 모델의 단가가 더 높기 때문입니다. \"오류\" 탭을 클릭해 실패한 실행을 보세요.",
- codes: "실행 143회 중 9회가 실패했고, 그중 6회가 고객지원 도우미입니다. \"오류 코드 표시\"를 클릭해 구체적인 원인을 보세요.",
- done: "5회는 agent_error.provider_auth_or_access이고, 막대를 보면 모두 고객지원 도우미에서 났습니다. 그 런타임에서 AI 코딩 도구에 다시 로그인한 뒤 재시도하세요. \"다시 보기\"로 처음부터 볼 수 있습니다.",
- } as Record<Phase, string>,
+ title: "토큰 사용량·비용·오류 분포 확인하기",
+ chapters: ["사용량 개요", "지표 전환", "오류 탭"],
+ caption: "프로젝트와 에이전트별 토큰, 비용, 실행 시간, 실패 유형을 한눈에 집계해 보여 줍니다.",
},
fr: {
- title: "Statistiques · Équipe ops, 30 derniers jours",
- pageTitle: "Statistiques",
- freshness: "GMT+8 · mis à jour 10:30",
- refresh: "Actualiser",
- tabs: { usage: "Consommation", errors: "Erreurs" } as Record<Tab, string>,
- periodLabel: "Période",
- projectLabel: "Projet",
- allProjects: "Tous les projets",
- kpi: {
- cost: "Coût · 30 j",
- tokens: "Tokens · 30 j",
- tokensHint: "Entrée 1.1M · Sortie 0.3M",
- time: "Temps d'exécution · 30 j",
- timeHint: "Sur 143 exécutions",
- runs: "Exécutions · 30 j",
- runsHint: "9 en échec",
- },
- metricLabel: "Métrique",
- dimLabel: "Dimension",
- metrics: { tokens: "Tokens", cost: "Coût", time: "Temps", runs: "Exécutions" } as Record<Metric, string>,
- dims: { daily: "Quotidien", weekly: "Hebdomadaire" } as Record<Dim, string>,
- chartTitle: {
- daily: { tokens: "Tokens quotidiens", cost: "Coût quotidien" },
- weekly: { tokens: "Tokens hebdomadaires", cost: "Coût hebdomadaire" },
- },
- shortDate,
- partial: (range: string, covered: number) => `${range} (partiel · ${covered} / 7 jours)`,
- leaderboard: {
- title: "Classement",
- sortLabel: "Classer les agents par",
- caption: "3 agents",
- agent: "Agent",
- },
- agents: {
- ops: "Assistant ops",
- writing: "Assistant rédaction",
- support: "Assistant support",
- } as Record<AgentKey, string>,
- errors: {
- failedLabel: "Exécutions en échec · 30 j",
- failedHint: "Sur 143 exécutions",
- rateLabel: "Taux d'échec · 30 j",
- rateHint: "9 exécutions sur 143 en échec · 6.3%",
- agentsLabel: "Agents touchés · 30 j",
- agentsHint: "Pire : Assistant support · 6",
- mixTitle: "Répartition des échecs · 9",
- showCodes: "Afficher les codes d'erreur",
- hideCodes: "Masquer les codes d'erreur",
- classes: {
- auth: "Authentification",
- rate_limit: "Limite de débit",
- timeout: "Délai dépassé",
- } as Record<FailureClass, string>,
- byAgent: "Principaux fautifs",
- sortLabel: "Classer les fautifs par",
- sortFailed: "Échecs",
- sortRate: "Taux",
- headerFailed: "Échecs",
- headerRuns: "Exécutions",
- headerRate: "Taux",
- },
- captions: {
- idle: "Les statistiques des trois agents d'une équipe ops sur les 30 derniers jours.",
- metric: "La carte de tendance affiche par défaut les tokens par jour. Cliquez sur « Coût » pour voir ce que chaque journée a coûté.",
- weekly: "Les jours ouvrés coûtent plus que le week-end. Cliquez sur « Hebdomadaire » pour voir le total de chaque semaine.",
- sort: "Le coût augmente d'une semaine à l'autre ; la barre plus pâle est la semaine en cours. Le classement ci-dessous trie par tokens : cliquez sur « Coût » pour le reclasser.",
- errors:
- "Assistant rédaction consomme le plus de tokens, mais c'est Assistant ops qui coûte le plus : son modèle a un tarif plus élevé. Cliquez sur l'onglet « Erreurs » pour voir les exécutions en échec.",
- codes: "9 exécutions sur 143 ont échoué, dont 6 pour Assistant support. Cliquez sur « Afficher les codes d'erreur » pour voir les motifs exacts.",
- done: "5 échecs sont des agent_error.provider_auth_or_access, et les barres montrent qu'ils viennent tous d'Assistant support : reconnectez son outil de codage IA sur son runtime, puis relancez. Rejouer permet de recommencer.",
- } as Record<Phase, string>,
- },
-};
-
-// ─── Scenario data ──────────────────────────────────────────────────────────
-// "Today" is Saturday Oct 24. Like the product, the weekly view covers whole
-// calendar weeks (Monday first), so the series starts on Monday Sep 21 and the
-// daily view shows its last 30 days.
-const FIRST_DAY = { month: 9, day: 21 };
-const DAILY_COST = [
- 1.56, 1.47, 1.84, 1.46, 1.81, 0.55, 0.47, 1.87, 1.54, 1.87, 1.61, 1.65, 0.56, 0.65, 1.74, 1.85, 2.2,
- 2.51, 2.21, 0.56, 0.68, 1.83, 2.58, 2.09, 1.98, 1.97, 0.54, 0.65, 2.11, 2.52, 2.6, 2.36, 2.57, 0.47,
-];
-// In units of 10K tokens.
-const DAILY_TOKENS = [
- 34, 34, 48, 36, 43, 14, 12, 44, 42, 50, 37, 42, 14, 18, 46, 43, 64, 57, 55, 15, 15, 46, 57, 56, 54, 50,
- 15, 15, 57, 66, 68, 59, 73, 13,
-];
-const DAILY_WINDOW = 30;
-const WEEKS = 5;
-// Days of the current week that have elapsed (Mon Oct 19 – Sat Oct 24).
-const CURRENT_WEEK_COVERED = 6;
-
-function dateAt(offset: number) {
- const d = new Date(Date.UTC(2026, FIRST_DAY.month - 1, FIRST_DAY.day + offset));
- return { month: d.getUTCMonth() + 1, day: d.getUTCDate() };
-}
-
-function weeklySums(series: number[]) {
- return Array.from({ length: WEEKS }, (_, w) =>
- series.slice(w * 7, w * 7 + 7).reduce((sum, v) => sum + v, 0),
- );
-}
-
-const fmtUsd = (n: number) => `$${n.toFixed(2)}`;
-const fmtTokens = (tenK: number) => `${Number((tenK / 100).toFixed(2))}M`;
-
-// Axis ceilings leave headroom above the tallest bar so the hint under the
-// card's toggles never sits on a bar.
-const CHART = {
- daily: {
- cost: { ticks: [0, 2, 4], format: (v: number) => `$${v}` },
- tokens: { ticks: [0, 60, 120], format: (v: number) => (v === 0 ? "0" : fmtTokens(v)) },
+ title: "Suivre la consommation, les coûts et les erreurs",
+ chapters: ["Vue d'ensemble", "Changer de métrique", "Onglet Erreurs"],
+ caption: "Analytics regroupe tokens, coûts, durée d'exécution et types d'erreurs par projet et par agent.",
},
- weekly: {
- cost: { ticks: [0, 10, 20], format: (v: number) => `$${v}` },
- tokens: { ticks: [0, 300, 600], format: (v: number) => (v === 0 ? "0" : fmtTokens(v)) },
- },
-} as const;
-
-type AgentRow = { key: AgentKey; tokens: number; cost: number; time: string; seconds: number; runs: number };
-const AGENT_ROWS: AgentRow[] = [
- { key: "writing", tokens: 620, cost: 14.8, time: "6h 10m", seconds: 22200, runs: 41 },
- { key: "ops", tokens: 410, cost: 25.3, time: "11h 5m", seconds: 39900, runs: 72 },
- { key: "support", tokens: 210, cost: 8.5, time: "4h 25m", seconds: 15900, runs: 30 },
-];
-
-type OffenderRow = { key: AgentKey; failed: number; runs: number; rate: string; classes: Partial<Record<FailureClass, number>> };
-const OFFENDERS: OffenderRow[] = [
- { key: "support", failed: 6, runs: 30, rate: "20%", classes: { auth: 5, rate_limit: 1 } },
- { key: "ops", failed: 3, runs: 72, rate: "4.2%", classes: { rate_limit: 2, timeout: 1 } },
-];
-const CLASS_COUNTS: { cls: FailureClass; count: number }[] = [
- { cls: "auth", count: 5 },
- { cls: "rate_limit", count: 3 },
- { cls: "timeout", count: 1 },
-];
-const REASON_COUNTS: { reason: string; cls: FailureClass; count: number }[] = [
- { reason: "agent_error.provider_auth_or_access", cls: "auth", count: 5 },
- { reason: "agent_error.provider_capacity_or_rate_limit", cls: "rate_limit", count: 3 },
- { reason: "timeout", cls: "timeout", count: 1 },
-];
-const TOTAL_FAILED = 9;
-
-// The product's failure palette: steps down a --destructive ramp toward the
-// card colour, so every class reads as "errors" in both themes.
-const CLASS_COLOR: Record<FailureClass, string> = {
- auth: "var(--destructive)",
- rate_limit: "color-mix(in oklch, var(--destructive) 86%, var(--card))",
- timeout: "color-mix(in oklch, var(--destructive) 72%, var(--card))",
};
-// ─── Small product pieces ───────────────────────────────────────────────────
-
-/** The card-local pill toggle; only `live` can be pressed, and only when `open`. */
-function Segmented<T extends string>({
- label,
- value,
- options,
- live,
- open,
- onPick,
- coachSide = "bottom",
- coachAlign = "center",
-}: {
- label: string;
- value: T;
- options: { value: T; label: string }[];
- live?: T;
- open: boolean;
- onPick?: (value: T) => void;
- coachSide?: "top" | "bottom";
- coachAlign?: "start" | "center" | "end";
-}) {
- return (
- <div role="group" aria-label={label} className="inline-flex items-center gap-0.5 rounded-md bg-muted p-0.5">
- {options.map((o) => {
- const enabled = open && o.value === live;
- return (
- <CoachMark key={o.value} active={enabled} side={coachSide} align={coachAlign} ringClassName="rounded-md">
- <button
- type="button"
- aria-pressed={o.value === value}
- disabled={!enabled}
- onClick={() => onPick?.(o.value)}
- className={cn(
- "rounded-sm px-2.5 py-1 text-caption font-medium transition-colors",
- o.value === value ? "bg-background text-foreground shadow-sm" : "text-muted-foreground",
- enabled && "hover:text-foreground",
- )}
- >
- {o.label}
- </button>
- </CoachMark>
- );
- })}
- </div>
- );
-}
-
-function Kpi({ label, value, hint }: { label: string; value: string; hint?: string }) {
- return (
- <div className="min-w-0 bg-card px-3 py-2.5">
- <div className="text-caption text-muted-foreground">{label}</div>
- <div className="mt-0.5 text-title font-semibold tabular-nums">{value}</div>
- {hint && <div className="mt-0.5 text-caption text-muted-foreground">{hint}</div>}
- </div>
- );
-}
-
-function TrendChart({
- values,
- ticks,
- format,
- labels,
- fadedLast,
- everyLabel,
-}: {
- values: number[];
- ticks: readonly number[];
- format: (v: number) => string;
- labels: string[];
- fadedLast: boolean;
- /** Label every bar (weekly) instead of the first, middle and last (daily). */
- everyLabel: boolean;
-}) {
- const max = ticks[ticks.length - 1] ?? 1;
- return (
- <div aria-hidden className="flex gap-2">
- <div className="relative h-32 w-9 shrink-0 text-micro text-muted-foreground tabular-nums">
- {ticks.map((tick) => (
- <span
- key={tick}
- className="absolute right-0 -translate-y-1/2"
- style={{ bottom: `calc(${(tick / max) * 100}% - 0.5em)` }}
- >
- {format(tick)}
- </span>
- ))}
- </div>
- <div className="min-w-0 flex-1">
- <div className="relative h-32">
- {ticks.map((tick) => (
- <div
- key={tick}
- className="absolute inset-x-0 border-t border-dashed border-border"
- style={{ bottom: `${(tick / max) * 100}%` }}
- />
- ))}
- <div className={cn("absolute inset-0 flex items-end", everyLabel ? "gap-1 px-1 sm:gap-6" : "gap-px")}>
- {values.map((v, i) => (
- <div
- key={i}
- className={cn(
- "min-w-0 flex-1 rounded-t-[2px] bg-chart-1 transition-[height] duration-300 ease-out",
- fadedLast && i === values.length - 1 && "opacity-50",
- )}
- style={{ height: `${(v / max) * 100}%` }}
- />
- ))}
- </div>
- </div>
- <div
- className={cn(
- "mt-1.5 text-micro text-muted-foreground",
- everyLabel ? "flex gap-1 px-1 sm:gap-6" : "flex justify-between",
- )}
- >
- {labels.map((label) => (
- <span key={label} className={cn("whitespace-nowrap", everyLabel && "min-w-0 flex-1 text-center")}>
- {label}
- </span>
- ))}
- </div>
- </div>
- </div>
- );
-}
-
-// ─── Demo ───────────────────────────────────────────────────────────────────
-
export function UsageDemo() {
const t = useDemoCopy(copy);
- const { after, clear } = useDemoTimers();
- const [frameRef, visible] = useStartWhenVisible<HTMLElement>();
- const [cycle, setCycle] = useState(0);
- const [phase, setPhase] = useState<Phase>("idle");
- const [metric, setMetric] = useState<Metric>("tokens");
- const [dim, setDim] = useState<Dim>("daily");
- const [sortBy, setSortBy] = useState<Metric>("tokens");
- const [tab, setTab] = useState<Tab>("usage");
- const [showCodes, setShowCodes] = useState(false);
-
- useEffect(() => {
- if (!visible) return;
- clear();
- after(600, () => setPhase("metric"));
- }, [visible, cycle, after, clear]);
-
- const replay = () => {
- clear();
- setPhase("idle");
- setMetric("tokens");
- setDim("daily");
- setSortBy("tokens");
- setTab("usage");
- setShowCodes(false);
- setCycle((c) => c + 1);
- };
-
- const shownPhase: Phase = visible ? phase : "idle";
- const chartMetric = metric === "cost" ? "cost" : "tokens";
- const series = chartMetric === "cost" ? DAILY_COST : DAILY_TOKENS;
- const daily = series.slice(-DAILY_WINDOW);
- const values = dim === "weekly" ? weeklySums(series) : daily;
- const chart = CHART[dim][chartMetric];
- const firstShown = DAILY_COST.length - DAILY_WINDOW;
- const label = (offset: number) => {
- const d = dateAt(offset);
- return t.shortDate(d.month, d.day);
- };
- const labels =
- dim === "weekly"
- ? Array.from({ length: WEEKS }, (_, w) => label(w * 7))
- : [label(firstShown), label(firstShown + 15), label(DAILY_COST.length - 1)];
- const currentWeek = `${label((WEEKS - 1) * 7)} – ${label((WEEKS - 1) * 7 + 6)}`;
- const totalCost = DAILY_COST.slice(-DAILY_WINDOW).reduce((sum, v) => sum + v, 0);
- const totalTokens = DAILY_TOKENS.slice(-DAILY_WINDOW).reduce((sum, v) => sum + v, 0);
-
- const sortValue = (r: AgentRow) => (sortBy === "cost" ? r.cost : r.tokens);
- const ranked = AGENT_ROWS.toSorted((a, b) => sortValue(b) - sortValue(a));
- const leader = ranked[0] ? sortValue(ranked[0]) : 1;
- const leaderFailed = OFFENDERS[0]?.failed ?? 1;
-
- const metricOptions = (["tokens", "cost", "time", "runs"] as const).map((m) => ({ value: m, label: t.metrics[m] }));
- const col = (key: Metric) => (sortBy === key ? "text-foreground" : "text-muted-foreground");
-
- return (
- <DemoFrame frameRef={frameRef} title={t.title} caption={t.captions[shownPhase]} onReplay={replay}>
- <div className="flex min-h-[44rem] flex-col">
- {/* Page header */}
- <div className="flex h-11 items-center gap-2 border-b px-4">
- <BarChart3 aria-hidden className="size-4 text-muted-foreground" />
- <span className="text-body font-medium">{t.pageTitle}</span>
- <span className="ml-auto hidden text-caption text-muted-foreground sm:inline">{t.freshness}</span>
- <Button type="button" size="icon-sm" variant="ghost" aria-label={t.refresh} disabled className="max-sm:ml-auto">
- <RefreshCw />
- </Button>
- </div>
-
- {/* Toolbar: tabs on the left, page-scoped filters on the right */}
- <div className="flex flex-wrap items-center justify-between gap-x-2 gap-y-1 border-b px-4">
- <div role="tablist" className="flex h-11 items-stretch">
- {(["usage", "errors"] as const).map((key) => {
- const live = key === "errors" && shownPhase === "errors";
- return (
- <CoachMark key={key} active={live} side="right" ringClassName="rounded-md" className="items-stretch">
- <button
- type="button"
- role="tab"
- aria-selected={tab === key}
- disabled={!live}
- onClick={() => {
- setTab("errors");
- setPhase("codes");
- }}
- className={cn(
- "relative px-2.5 text-label transition-colors",
- tab === key ? "font-medium text-foreground" : "text-muted-foreground",
- live && "hover:text-foreground",
- )}
- >
- {t.tabs[key]}
- {tab === key && <span aria-hidden className="absolute inset-x-2 bottom-0 h-0.5 rounded-full bg-foreground" />}
- </button>
- </CoachMark>
- );
- })}
- </div>
- <div className="flex items-center gap-2 py-1.5">
- <Button type="button" size="sm" variant="outline" disabled aria-label={t.periodLabel} className="gap-1 px-2.5">
- <CalendarDays className="size-3.5 text-muted-foreground" />
- <span className="tabular-nums">30d</span>
- <ChevronDown className="size-3 text-muted-foreground" />
- </Button>
- <Button type="button" size="sm" variant="outline" disabled aria-label={t.projectLabel} className="gap-1 px-2.5 text-muted-foreground">
- <FolderKanban className="size-3.5" />
- <span className="truncate">{t.allProjects}</span>
- <ChevronDown className="size-3" />
- </Button>
- </div>
- </div>
-
- <div className="flex flex-1 flex-col gap-4 bg-muted/20 p-4">
- {tab === "usage" ? (
- <>
- <div className="grid grid-cols-2 gap-px overflow-hidden rounded-lg border bg-border sm:grid-cols-4">
- <Kpi label={t.kpi.cost} value={fmtUsd(totalCost)} />
- <Kpi label={t.kpi.tokens} value={fmtTokens(totalTokens)} hint={t.kpi.tokensHint} />
- <Kpi label={t.kpi.time} value="21h 40m" hint={t.kpi.timeHint} />
- <Kpi label={t.kpi.runs} value="143" hint={t.kpi.runsHint} />
- </div>
-
- {/* Trend card */}
- <section className="rounded-lg border bg-card p-4">
- <div className="mb-3 flex flex-wrap items-center justify-between gap-3">
- <div key={`${dim}-${chartMetric}`} className="text-body font-semibold motion-safe:animate-in motion-safe:fade-in">
- {t.chartTitle[dim][chartMetric]}
- </div>
- <div className="flex flex-wrap items-center gap-2">
- <Segmented
- label={t.metricLabel}
- value={metric}
- options={metricOptions}
- live="cost"
- open={shownPhase === "metric"}
- onPick={() => {
- setMetric("cost");
- setPhase("weekly");
- }}
- />
- <Segmented
- label={t.dimLabel}
- value={dim}
- options={(["daily", "weekly"] as const).map((d) => ({ value: d, label: t.dims[d] }))}
- live="weekly"
- open={shownPhase === "weekly"}
- coachAlign="end"
- onPick={() => {
- setDim("weekly");
- setPhase("sort");
- }}
- />
- </div>
- </div>
- <TrendChart
- values={values}
- ticks={chart.ticks}
- format={chart.format}
- labels={labels}
- fadedLast={dim === "weekly"}
- everyLabel={dim === "weekly"}
- />
- {dim === "weekly" && (
- <div className="mt-2 flex items-center gap-1.5 text-caption text-muted-foreground motion-safe:animate-in motion-safe:fade-in">
- <span aria-hidden className="size-2 shrink-0 rounded-[2px] bg-chart-1 opacity-50" />
- {t.partial(currentWeek, CURRENT_WEEK_COVERED)}
- <span className="ml-auto font-medium text-foreground tabular-nums">{fmtUsd(values[WEEKS - 1] ?? 0)}</span>
- </div>
- )}
- </section>
-
- {/* Leaderboard */}
- <section className="mt-4 rounded-lg border bg-card">
- <div className="flex flex-wrap items-center justify-between gap-3 border-b px-4 pt-4 pb-3">
- <div className="text-body font-semibold">{t.leaderboard.title}</div>
- <div className="flex flex-wrap items-center justify-end gap-3">
- <Segmented
- label={t.leaderboard.sortLabel}
- value={sortBy}
- options={metricOptions}
- live="cost"
- open={shownPhase === "sort"}
- coachSide="top"
- onPick={() => {
- setSortBy("cost");
- setPhase("errors");
- }}
- />
- <span className="text-caption text-muted-foreground">{t.leaderboard.caption}</span>
- </div>
- </div>
- <div className="grid grid-cols-[minmax(0,1fr)_4rem_4rem] items-center gap-x-2 sm:gap-x-3 border-b px-4 py-2 text-caption font-medium text-muted-foreground sm:grid-cols-[minmax(0,1.6fr)_minmax(0,1fr)_4rem_4rem_4rem_3rem]">
- <span>{t.leaderboard.agent}</span>
- <span className="max-sm:hidden" />
- <span className={cn("text-right", col("tokens"))}>{t.metrics.tokens}</span>
- <span className={cn("text-right", col("cost"))}>{t.metrics.cost}</span>
- <span className="text-right max-sm:hidden">{t.metrics.time}</span>
- <span className="text-right max-sm:hidden">{t.metrics.runs}</span>
- </div>
- <ul className="m-0 list-none divide-y p-0">
- {ranked.map((row) => (
- <li
- key={row.key}
- className="m-0 grid grid-cols-[minmax(0,1fr)_4rem_4rem] items-center gap-x-2 sm:gap-x-3 px-4 py-2 sm:grid-cols-[minmax(0,1.6fr)_minmax(0,1fr)_4rem_4rem_4rem_3rem] motion-safe:animate-in motion-safe:fade-in"
- >
- <span className="flex min-w-0 items-center gap-2">
- <DemoAvatar name={t.agents[row.key]} agent />
- <span className="min-w-0 text-body font-medium break-words sm:truncate">{t.agents[row.key]}</span>
- </span>
- <span className="relative h-2 overflow-hidden rounded-full bg-muted max-sm:hidden">
- <span
- className="absolute inset-y-0 left-0 rounded-full bg-chart-1 transition-[width] duration-300 ease-out"
- style={{ width: `${(sortValue(row) / leader) * 100}%` }}
- />
- </span>
- <span className={cn("text-right text-caption tabular-nums", sortBy === "tokens" ? "font-medium text-foreground" : "text-muted-foreground")}>
- {fmtTokens(row.tokens)}
- </span>
- <span className={cn("text-right tabular-nums", sortBy === "cost" ? "text-body font-medium" : "text-caption text-muted-foreground")}>
- {fmtUsd(row.cost)}
- </span>
- <span className="text-right text-caption text-muted-foreground tabular-nums max-sm:hidden">{row.time}</span>
- <span className="text-right text-caption text-muted-foreground tabular-nums max-sm:hidden">{row.runs}</span>
- </li>
- ))}
- </ul>
- </section>
- </>
- ) : (
- <div className="flex flex-col gap-4 motion-safe:animate-in motion-safe:fade-in">
- <div className="grid grid-cols-1 gap-px overflow-hidden rounded-lg border bg-border sm:grid-cols-3">
- <Kpi label={t.errors.failedLabel} value={String(TOTAL_FAILED)} hint={t.errors.failedHint} />
- <Kpi label={t.errors.rateLabel} value="6.3%" hint={t.errors.rateHint} />
- <Kpi label={t.errors.agentsLabel} value={String(OFFENDERS.length)} hint={t.errors.agentsHint} />
- </div>
-
- {/* Failure mix */}
- <section className="rounded-lg border bg-card">
- <div className="flex flex-wrap items-center justify-between gap-3 border-b px-4 pt-4 pb-3">
- <div className="text-body font-semibold">{t.errors.mixTitle}</div>
- <CoachMark active={shownPhase === "codes"} side="left" ringClassName="rounded-md">
- <button
- type="button"
- disabled={shownPhase !== "codes"}
- onClick={() => {
- setShowCodes(true);
- setPhase("done");
- }}
- className="rounded-sm px-1 text-caption text-muted-foreground underline-offset-2 enabled:hover:text-foreground enabled:hover:underline"
- >
- {showCodes ? t.errors.hideCodes : t.errors.showCodes}
- </button>
- </CoachMark>
- </div>
- <div className="p-4">
- {showCodes ? (
- <ul className="m-0 grid list-none grid-cols-1 gap-1.5 p-0 motion-safe:animate-in motion-safe:fade-in">
- {REASON_COUNTS.map((r) => (
- <li key={r.reason} className="m-0 flex items-start justify-between gap-3">
- <span className="flex min-w-0 items-start gap-2">
- <span aria-hidden className="mt-1 size-2 shrink-0 rounded-[2px]" style={{ backgroundColor: CLASS_COLOR[r.cls] }} />
- <span className="min-w-0 font-mono text-caption break-all text-muted-foreground">{r.reason}</span>
- </span>
- <span className="shrink-0 text-caption tabular-nums">{r.count}</span>
- </li>
- ))}
- </ul>
- ) : (
- <div className="space-y-2.5">
- <div className="flex h-2 w-full overflow-hidden rounded-full bg-muted">
- {CLASS_COUNTS.map((c) => (
- <div
- key={c.cls}
- className="h-full"
- style={{ width: `${(c.count / TOTAL_FAILED) * 100}%`, backgroundColor: CLASS_COLOR[c.cls] }}
- />
- ))}
- </div>
- <ul className="m-0 flex list-none flex-wrap items-center gap-x-4 gap-y-1.5 p-0">
- {CLASS_COUNTS.map((c) => (
- <li key={c.cls} className="m-0 flex items-center gap-1.5">
- <span aria-hidden className="size-2 shrink-0 rounded-[2px]" style={{ backgroundColor: CLASS_COLOR[c.cls] }} />
- <span className="text-caption">{t.errors.classes[c.cls]}</span>
- <span className="text-caption text-muted-foreground tabular-nums">{c.count}</span>
- </li>
- ))}
- </ul>
- </div>
- )}
- </div>
- </section>
-
- {/* Offenders */}
- <section className="rounded-lg border bg-card">
- <div className="flex flex-wrap items-center justify-between gap-3 border-b px-4 pt-4 pb-3">
- <div className="text-body font-semibold">{t.errors.byAgent}</div>
- <Segmented
- label={t.errors.sortLabel}
- value="failed"
- options={[
- { value: "failed", label: t.errors.sortFailed },
- { value: "rate", label: t.errors.sortRate },
- ]}
- open={false}
- />
- </div>
- <div className="px-4 pb-2">
- <div className="grid grid-cols-[minmax(0,1fr)_3.5rem_3.5rem] items-center gap-x-2 border-b py-2 text-caption font-medium text-muted-foreground sm:grid-cols-[minmax(0,1.4fr)_minmax(0,1fr)_4rem_4rem_4rem] sm:gap-x-3">
- <span>{t.leaderboard.agent}</span>
- <span className="max-sm:hidden" />
- <span className="text-right text-foreground">{t.errors.headerFailed}</span>
- <span className="truncate text-right max-sm:hidden">{t.errors.headerRuns}</span>
- <span className="truncate text-right">{t.errors.headerRate}</span>
- </div>
- <ul className="m-0 list-none divide-y p-0">
- {OFFENDERS.map((row) => (
- <li
- key={row.key}
- className="m-0 grid grid-cols-[minmax(0,1fr)_3.5rem_3.5rem] items-center gap-x-2 gap-y-1.5 py-2 sm:grid-cols-[minmax(0,1.4fr)_minmax(0,1fr)_4rem_4rem_4rem] sm:gap-x-3"
- >
- <span className="min-w-0 text-caption break-words sm:truncate">{t.agents[row.key]}</span>
- <span className="order-last col-span-3 h-1.5 overflow-hidden rounded-full bg-muted sm:order-none sm:col-span-1">
- <span className="flex h-full overflow-hidden rounded-full" style={{ width: `${(row.failed / leaderFailed) * 100}%` }}>
- {(Object.keys(row.classes) as FailureClass[]).map((cls) => (
- <span
- key={cls}
- className="h-full"
- style={
- {
- width: `${((row.classes[cls] ?? 0) / row.failed) * 100}%`,
- backgroundColor: CLASS_COLOR[cls],
- } satisfies CSSProperties
- }
- />
- ))}
- </span>
- </span>
- <span className="text-right text-caption font-medium text-foreground tabular-nums">{row.failed}</span>
- <span className="text-right text-caption text-muted-foreground tabular-nums max-sm:hidden">{row.runs}</span>
- <span className="text-right text-caption text-muted-foreground tabular-nums">{row.rate}</span>
- </li>
- ))}
- </ul>
- </div>
- </section>
- </div>
- )}
- </div>
- </div>
- </DemoFrame>
- );
+ const meta = CLIP_MANIFEST.usage ?? { duration: 5.5, chapters: [] };
+ const chapters = t.chapters.map((label, i) => ({
+ label,
+ at: meta.chapters[i]?.at ?? (i * meta.duration) / t.chapters.length,
+ }));
+ return <EditorialClip slug="usage" title={t.title} chapters={chapters} duration={meta.duration} caption={t.caption} />;
}
diff --git a/apps/docs/components/demos/wakeup-demo.tsx b/apps/docs/components/demos/wakeup-demo.tsx
index 25cbda6722..2af702f275 100644
--- a/apps/docs/components/demos/wakeup-demo.tsx
+++ b/apps/docs/components/demos/wakeup-demo.tsx
@@ -1,808 +1,47 @@
"use client";
-import { useEffect, useState, type ReactNode } from "react";
-import { Bell, ChevronDown, ChevronRight, Clock3, FastForward, Info, Plus, RefreshCw } from "@multica/ui/icons";
-import { Button } from "@multica/ui/components/ui/button";
-import { cn } from "@multica/ui/lib/utils";
-import {
- CoachMark,
- DemoAvatar,
- DemoComment,
- DemoFrame,
- DemoRun,
- DemoStep,
- useDemoCopy,
- useDemoTimers,
- useStartWhenVisible,
-} from "./demo-kit";
-
-type Choice = "at" | "recurring";
+import { CLIP_MANIFEST } from "./clip-manifest";
+import { EditorialClip, useDemoCopy } from "./demo-kit";
const copy = {
en: {
- title: "OPS-56 · Confirm supplier quotes for trade-show materials",
- agent: "Ops helper",
- running: "Running",
- completed: "Completed",
- opening:
- "I've sent quote requests to 3 suppliers and asked them to reply by end of day. I can't compare prices until the quotes are in, so I'm stopping here for now.",
- section: "Wakeups",
- newWakeup: "New wakeup",
- formTitle: "New wakeup",
- when: "When",
- wake: "Wake",
- chooseCondition: "Choose a condition",
- groupTime: "Time",
- condAt: "At a time",
- condAtHint: "In 10 min, tomorrow 09:00",
- condRecurring: "Check regularly",
- condRecurringHint: "Hourly or daily, with an end date",
- atPresets: ["In 10 minutes", "In 1 hour", "Tomorrow 09:00", "Pick a time"],
- daily: "Every day 09:00",
- until: "Until",
- untilValue: "10/27/2026",
- instructionTitle: "What to do when woken",
- instruction:
- "Check the quote emails to see whether all 3 suppliers have replied. If they have, put the quotes in a comparison table and recommend one.",
- onBehalf: "Runs act on your behalf",
- cancel: "Cancel",
- create: "Create",
- rule: { at: "Wake at Oct 21, 09:00 AM", recurring: "At 09:00 · Every day" } as Record<Choice, string>,
- summaryOnce: "Wake Ops helper · Trigger once",
- summaryFired: "Wake Ops helper · Trigger once · Triggered",
- summaryNext: (date: number) =>
- `Wake Ops helper · Next: Oct ${date}, 09:00 AM · until Oct 27`,
- summaryOff: "Wake Ops helper · Turned off",
- thisRun: (done: boolean) => `This execution: ${done ? "Run succeeded" : "Running"}`,
- lastRun: "Last execution: Run succeeded",
- history: "Wakeup history 1",
- chip: (date: number) => `Oct ${date}, 09:00 AM · wakes Ops helper`,
- source: { at: "Wakeup · Wake at Oct 21, 09:00 AM", recurring: "Wakeup · At 09:00 · Every day" } as Record<Choice, string>,
- steps: {
- read: "Read the issue, comments and wakeup instruction",
- found: "Check the quote emails: all 3 have replied",
- none: "Check the quote emails: no replies yet",
- compare: "Build the quote comparison table",
- checkin: "Nothing needs a reply: end with a silent check",
- disable: "Quotes are in: turn off this regular check",
- },
- checkin: "silent check: None of the 3 suppliers has sent a quote yet; checking again tomorrow",
- reply:
- "All 3 quotes are in: A is $260 a set with delivery in 10 days, B $240 in 14 days, C $275 in 7 days. The show is 3 weeks away, so I recommend B. The comparison table is attached to the issue.",
- fastForward: (date: number) => `Skip ahead to Oct ${date}, 09:00 AM`,
- captions: {
- idle: "Ops helper has asked 3 suppliers for quotes and is waiting for their replies.",
- ready: "The quotes won't arrive before tomorrow. Click + in the Wakeups section so Ops helper comes back to this issue later.",
- form: "The issue's assignee, Ops helper, is already selected, and the instruction is filled in. Open the condition menu.",
- menu: "Either time condition works here: \"At a time\" wakes Ops helper once; \"Check regularly\" wakes it every day until the end date.",
- preset: "The time defaults to one hour from now. Change it to tomorrow 09:00.",
- presetMenu: "Pick \"Tomorrow 09:00\".",
- filled: {
- at: "Ops helper will be woken once, tomorrow at 09:00. Click Create.",
- recurring: "Ops helper will be woken every day at 09:00 until Oct 27. Click Create.",
- } as Record<Choice, string>,
- scheduled:
- "The rule is saved on the issue, and the header shows what the issue is waiting for. No run is active in the meantime. Skip ahead to the wakeup time.",
- running: "It's 09:00: Ops helper starts a new run on this issue with the wakeup's instruction.",
- checked:
- "No replies yet. This run posted no comment; it left a silent check in the timeline instead. Skip ahead another day.",
- running2: "The next day's check starts.",
- done: {
- at: "Ops helper found the quotes and finished the comparison. A one-time wakeup ends after it fires and moves to Wakeup history. Use Replay to try the other condition.",
- recurring:
- "The quotes arrived. Ops helper posted the comparison and turned off the regular check. Use Replay to try the other condition.",
- } as Record<Choice, string>,
- },
+ title: "Schedule a follow-up wakeup on an issue",
+ chapters: ["Open Wakeups", "Pick time or event", "Rule scheduled"],
+ caption: "Add a time or event wakeup in the issue sidebar so the agent returns to the same issue automatically when the condition holds.",
},
zh: {
- title: "OPS-56 · 确认展会物料的供应商报价",
- agent: "运营助手",
- running: "运行中",
- completed: "已完成",
- opening: "已向 3 家供应商发出询价,请他们今天下班前回复。报价到齐前没法比价,先停在这里。",
- section: "唤醒",
- newWakeup: "新建唤醒",
- formTitle: "新建唤醒",
- when: "当",
- wake: "唤醒",
- chooseCondition: "选择条件",
- groupTime: "时间",
- condAt: "在某个时间",
- condAtHint: "10 分钟后、明天 09:00",
- condRecurring: "定期检查",
- condRecurringHint: "每小时、每天,需设截止日",
- atPresets: ["10 分钟后", "1 小时后", "明天 09:00", "自定义时间"],
- daily: "每天 09:00",
- until: "截止",
- untilValue: "2026/10/27",
- instructionTitle: "唤醒后要做什么",
- instruction: "查看询价邮件,看 3 家供应商是否都回了报价。回齐了就整理成对比表,给出建议。",
- onBehalf: "唤醒后的运行将代表你执行",
- cancel: "取消",
- create: "创建",
- rule: { at: "10月21日 09:00 唤醒", recurring: "09:00 · 每天" } as Record<Choice, string>,
- summaryOnce: "唤醒 运营助手 · 仅触发一次",
- summaryFired: "唤醒 运营助手 · 仅触发一次 · 已触发",
- summaryNext: (date: number) => `唤醒 运营助手 · 下次 10月${date}日 09:00 · 至 10月27日`,
- summaryOff: "唤醒 运营助手 · 已关闭",
- thisRun: (done: boolean) => `本次执行:${done ? "运行成功" : "运行中"}`,
- lastRun: "最近一次:运行成功",
- history: "历史唤醒 1",
- chip: (date: number) => `10月${date}日 09:00 唤醒 运营助手`,
- source: { at: "由唤醒触发 · 10月21日 09:00 唤醒", recurring: "由唤醒触发 · 09:00 · 每天" } as Record<Choice, string>,
- steps: {
- read: "读取任务、评论和唤醒指令",
- found: "查看询价邮件:3 家都已回复",
- none: "查看询价邮件:还没有回复",
- compare: "整理报价对比表",
- checkin: "没有需要回复的内容,以静默检查结束",
- disable: "报价已齐,关闭这条定期检查",
- },
- checkin: "静默检查:3 家供应商都还没回复报价,明天再看",
- reply:
- "3 家报价都到了:A 每套 2,600 元,10 天交货;B 每套 2,400 元,14 天交货;C 每套 2,750 元,7 天交货。离展会还有 3 周,建议选 B。对比表已附在任务里。",
- fastForward: (date: number) => `快进到 10月${date}日 09:00`,
- captions: {
- idle: "运营助手 已向 3 家供应商询价,正在等回复。",
- ready: "报价明天之前到不了。点唤醒区域的 +,让 运营助手 之后再回到这条任务。",
- form: "唤醒对象已预选为任务负责人 运营助手,指令也写好了。打开条件菜单。",
- menu: "这里两种时间条件都能用:\"在某个时间\"只唤醒一次,\"定期检查\"每天唤醒一次,直到截止日。",
- preset: "时间默认是 1 小时后,改成明天 09:00。",
- presetMenu: "选择\"明天 09:00\"。",
- filled: {
- at: "明天 09:00 唤醒 运营助手 一次。点击创建。",
- recurring: "每天 09:00 唤醒 运营助手,到 10月27日 截止。点击创建。",
- } as Record<Choice, string>,
- scheduled: "规则存在任务上,标题旁显示这条任务在等什么。这期间没有运行在跑。快进到唤醒时间。",
- running: "到 09:00 了:运营助手 带着唤醒指令,在这条任务上开始一次新的运行。",
- checked: "还没有回复。这次运行没有发评论,只在时间线留下一条静默检查。再快进一天。",
- running2: "第二天的检查开始了。",
- done: {
- at: "运营助手 读到了报价,把比价做完。单次唤醒触发后就结束,移到了历史唤醒。点右上角重新演示,可以试另一种条件。",
- recurring: "报价到了。运营助手 发出比价结果,并关掉了这条定期检查。点右上角重新演示,可以试另一种条件。",
- } as Record<Choice, string>,
- },
+ title: "在任务侧栏配置定时或事件唤醒",
+ chapters: ["打开任务唤醒", "设置时间或事件条件", "规则生效"],
+ caption: "在任务右侧栏添加唤醒规则后,到期或条件满足时智能体会自动在同一条任务上续跑,无需人工盯守。",
+ },
+ "zh-Hant": {
+ title: "在任務側欄設定定時或事件喚醒",
+ chapters: ["開啟任務喚醒", "設定時間或事件條件", "規則生效"],
+ caption: "在任務右側欄新增喚醒規則後,到期或條件滿足時智能體會自動在同一條任務上繼續執行。",
},
ja: {
- title: "OPS-56 · 展示会資材の仕入れ先見積もりを確認する",
- agent: "運用アシスタント",
- running: "実行中",
- completed: "完了",
- opening:
- "仕入れ先 3 社に見積もりを依頼し、今日の終業までに返信をお願いしました。見積もりがそろうまで比較できないので、いったんここで止めます。",
- section: "ウェイクアップ",
- newWakeup: "新しいウェイクアップ",
- formTitle: "新しいウェイクアップ",
- when: "条件",
- wake: "起こす",
- chooseCondition: "条件を選択",
- groupTime: "時間",
- condAt: "指定した時刻",
- condAtHint: "10 分後、明日 09:00",
- condRecurring: "定期チェック",
- condRecurringHint: "毎時・毎日、終了日を設定",
- atPresets: ["10 分後", "1 時間後", "明日 09:00", "時刻を指定"],
- daily: "毎日 09:00",
- until: "終了日",
- untilValue: "2026/10/27",
- instructionTitle: "起動後に行うこと",
- instruction:
- "見積もりメールを確認し、3 社すべてから返信が来ているか見てください。そろっていれば比較表にまとめ、おすすめを示してください。",
- onBehalf: "起動された実行はあなたの代理として動きます",
- cancel: "キャンセル",
- create: "作成",
- rule: { at: "10月21日 09:00 に起動", recurring: "09:00 · 毎日" } as Record<Choice, string>,
- summaryOnce: "運用アシスタント を起動 · 一度だけ起動",
- summaryFired: "運用アシスタント を起動 · 一度だけ起動 · 起動済み",
- summaryNext: (date: number) =>
- `運用アシスタント を起動 · 次回:10月${date}日 09:00 · 10月27日 まで`,
- summaryOff: "運用アシスタント を起動 · 無効",
- thisRun: (done: boolean) => `今回の実行:${done ? "実行成功" : "実行中"}`,
- lastRun: "前回の実行:実行成功",
- history: "ウェイクアップ履歴 1",
- chip: (date: number) => `10月${date}日 09:00 に 運用アシスタント を起こす`,
- source: { at: "起動 · 10月21日 09:00 に起動", recurring: "起動 · 09:00 · 毎日" } as Record<Choice, string>,
- steps: {
- read: "タスク、コメント、ウェイクアップの指示を読む",
- found: "見積もりメールを確認:3 社とも返信あり",
- none: "見積もりメールを確認:まだ返信なし",
- compare: "見積もりの比較表を作る",
- checkin: "返信が必要な内容はないので、サイレントチェックで終える",
- disable: "見積もりがそろったので、この定期チェックをオフにする",
- },
- checkin: "サイレントチェック:3 社ともまだ見積もりの返信なし。明日また確認",
- reply:
- "3 社の見積もりがそろいました。A は 1 セット 52,000 円で納期 10 日、B は 48,000 円で 14 日、C は 55,000 円で 7 日です。展示会まで 3 週間あるので B をおすすめします。比較表はタスクに添付しました。",
- fastForward: (date: number) => `10月${date}日 09:00 まで早送り`,
- captions: {
- idle: "運用アシスタント は仕入れ先 3 社に見積もりを依頼し、返信を待っています。",
- ready: "見積もりは明日まで届きません。ウェイクアップ欄の + をクリックして、運用アシスタント が後でこのタスクに戻るようにします。",
- form: "起こす相手にはタスクの担当者 運用アシスタント が選ばれていて、指示も入力済みです。条件メニューを開きます。",
- menu: "ここではどちらの時間条件も使えます。「指定した時刻」は一度だけ、「定期チェック」は終了日まで毎日起こします。",
- preset: "時刻の既定は 1 時間後です。明日 09:00 に変えます。",
- presetMenu: "「明日 09:00」を選びます。",
- filled: {
- at: "明日 09:00 に 運用アシスタント を一度だけ起こします。作成をクリックします。",
- recurring: "10月27日 まで毎日 09:00 に 運用アシスタント を起こします。作成をクリックします。",
- } as Record<Choice, string>,
- scheduled:
- "ルールはタスクに保存され、ヘッダーにはこのタスクが何を待っているかが表示されます。その間に動いている実行はありません。起動時刻まで早送りします。",
- running: "09:00 になりました。運用アシスタント がウェイクアップの指示を持って、このタスクで新しい実行を始めます。",
- checked:
- "まだ返信はありません。この実行はコメントを投稿せず、タイムラインにサイレントチェックを 1 件残しました。もう 1 日早送りします。",
- running2: "翌日のチェックが始まりました。",
- done: {
- at: "運用アシスタント は見積もりを読み、比較を仕上げました。一度だけのウェイクアップは起動後に終わり、履歴に移ります。「もう一度」でもう一方の条件も試せます。",
- recurring:
- "見積もりが届きました。運用アシスタント は比較結果を投稿し、定期チェックをオフにしました。「もう一度」でもう一方の条件も試せます。",
- } as Record<Choice, string>,
- },
+ title: "タスクのサイドバーでウェイクアップを設定する",
+ chapters: ["ウェイクアップを開く", "時刻・条件を設定", "ルール登録完了"],
+ caption: "指定した時刻や条件を満たすと、エージェントが同じタスクへ自動で戻って作業を再開します。",
},
ko: {
- title: "OPS-56 · 전시회 물품 공급업체 견적 확인",
- agent: "운영 도우미",
- running: "실행 중",
- completed: "완료됨",
- opening:
- "공급업체 3곳에 견적을 요청하고 오늘 퇴근 전까지 회신해 달라고 했습니다. 견적이 다 모여야 비교할 수 있어서 일단 여기서 멈춥니다.",
- section: "깨우기",
- newWakeup: "새 웨이크업",
- formTitle: "새 웨이크업",
- when: "조건",
- wake: "깨울 대상",
- chooseCondition: "조건 선택",
- groupTime: "시간",
- condAt: "특정 시각",
- condAtHint: "10분 후, 내일 09:00",
- condRecurring: "정기 확인",
- condRecurringHint: "매시간·매일, 종료일 필요",
- atPresets: ["10분 후", "1시간 후", "내일 09:00", "시간 지정"],
- daily: "매일 09:00",
- until: "종료일",
- untilValue: "2026. 10. 27.",
- instructionTitle: "깨운 후 수행할 일",
- instruction: "견적 메일을 확인해 3곳 모두 회신했는지 봐 주세요. 다 모였으면 비교표로 정리하고 추천안을 제시해 주세요.",
- onBehalf: "시작된 실행은 사용자를 대신해 동작합니다",
- cancel: "취소",
- create: "만들기",
- rule: { at: "10월 21일 오전 09:00에 깨우기", recurring: "09:00 · 매일" } as Record<Choice, string>,
- summaryOnce: "운영 도우미 깨우기 · 한 번만 트리거",
- summaryFired: "운영 도우미 깨우기 · 한 번만 트리거 · 트리거됨",
- summaryNext: (date: number) =>
- `운영 도우미 깨우기 · 다음: 10월 ${date}일 오전 09:00 · 10월 27일까지`,
- summaryOff: "운영 도우미 깨우기 · 꺼짐",
- thisRun: (done: boolean) => `이번 실행: ${done ? "실행 성공" : "실행 중"}`,
- lastRun: "최근 실행: 실행 성공",
- history: "깨우기 기록 1",
- chip: (date: number) => `10월 ${date}일 오전 09:00에 운영 도우미 깨우기`,
- source: { at: "깨우기 · 10월 21일 오전 09:00에 깨우기", recurring: "깨우기 · 09:00 · 매일" } as Record<Choice, string>,
- steps: {
- read: "태스크, 댓글, 깨우기 지시 읽기",
- found: "견적 메일 확인: 3곳 모두 회신함",
- none: "견적 메일 확인: 아직 회신 없음",
- compare: "견적 비교표 만들기",
- checkin: "답할 내용이 없어 조용한 확인으로 종료",
- disable: "견적이 모였으니 이 정기 확인 끄기",
- },
- checkin: "조용한 확인: 3곳 모두 아직 견적 회신 없음. 내일 다시 확인",
- reply:
- "견적 3건이 모두 도착했습니다. A는 세트당 52만 원에 납기 10일, B는 48만 원에 14일, C는 55만 원에 7일입니다. 전시회까지 3주 남아서 B를 추천합니다. 비교표는 태스크에 첨부했습니다.",
- fastForward: (date: number) => `10월 ${date}일 오전 09:00으로 건너뛰기`,
- captions: {
- idle: "운영 도우미가 공급업체 3곳에 견적을 요청하고 회신을 기다리고 있습니다.",
- ready: "견적은 내일 전에는 오지 않습니다. 깨우기 섹션의 +를 클릭해 운영 도우미가 나중에 이 태스크로 돌아오게 하세요.",
- form: "깨울 대상에는 태스크 담당자인 운영 도우미가 미리 선택되어 있고, 지시도 적혀 있습니다. 조건 메뉴를 여세요.",
- menu: "여기서는 두 시간 조건 모두 쓸 수 있습니다. '특정 시각'은 한 번만, '정기 확인'은 종료일까지 매일 깨웁니다.",
- preset: "시간은 기본값이 1시간 후입니다. 내일 09:00으로 바꾸세요.",
- presetMenu: "'내일 09:00'을 선택하세요.",
- filled: {
- at: "내일 09:00에 운영 도우미를 한 번 깨웁니다. 만들기를 클릭하세요.",
- recurring: "10월 27일까지 매일 09:00에 운영 도우미를 깨웁니다. 만들기를 클릭하세요.",
- } as Record<Choice, string>,
- scheduled:
- "규칙이 태스크에 저장되고, 헤더에 이 태스크가 무엇을 기다리는지 표시됩니다. 그동안 돌아가는 실행은 없습니다. 깨우는 시각으로 건너뛰세요.",
- running: "09:00이 되었습니다. 운영 도우미가 깨우기 지시를 가지고 이 태스크에서 새 실행을 시작합니다.",
- checked:
- "아직 회신이 없습니다. 이번 실행은 댓글을 남기지 않고 타임라인에 조용한 확인 기록만 남겼습니다. 하루 더 건너뛰세요.",
- running2: "다음 날 확인이 시작됩니다.",
- done: {
- at: "운영 도우미가 견적을 읽고 비교를 마쳤습니다. 한 번만 깨우는 규칙은 트리거된 뒤 끝나고 기록으로 옮겨집니다. '다시 보기'로 다른 조건도 해 보세요.",
- recurring:
- "견적이 도착했습니다. 운영 도우미가 비교 결과를 올리고 정기 확인을 껐습니다. '다시 보기'로 다른 조건도 해 보세요.",
- } as Record<Choice, string>,
- },
+ title: "태스크 사이드바에서 깨우기 예약하기",
+ chapters: ["깨우기 열기", "시각·조건 설정", "규칙 등록"],
+ caption: "설정한 시각이 되거나 조건이 충족되면 에이전트가 같은 태스크로 자동 복귀해 이어서 작업합니다.",
},
fr: {
- title: "OPS-56 · Confirmer les devis fournisseurs pour le matériel du salon",
- agent: "Assistant ops",
- running: "En cours",
- completed: "Terminée",
- opening:
- "J'ai demandé un devis à 3 fournisseurs, avec une réponse attendue d'ici ce soir. Je ne peux pas comparer les prix avant d'avoir tous les devis, je m'arrête donc ici pour l'instant.",
- section: "Réveils",
- newWakeup: "Nouveau réveil",
- formTitle: "Nouveau réveil",
- when: "Quand",
- wake: "Réveiller",
- chooseCondition: "Choisir une condition",
- groupTime: "Temps",
- condAt: "À une heure donnée",
- condAtHint: "Dans 10 min, demain 09:00",
- condRecurring: "Vérifier régulièrement",
- condRecurringHint: "Toutes les heures ou chaque jour, avec une date de fin",
- atPresets: ["Dans 10 minutes", "Dans 1 heure", "Demain 09:00", "Choisir une heure"],
- daily: "Chaque jour 09:00",
- until: "Jusqu’au",
- untilValue: "27/10/2026",
- instructionTitle: "Action au réveil",
- instruction:
- "Consultez les e-mails de devis pour voir si les 3 fournisseurs ont répondu. Si c'est le cas, rassemblez les devis dans un tableau comparatif et recommandez-en un.",
- onBehalf: "Les exécutions agissent en votre nom",
- cancel: "Annuler",
- create: "Créer",
- rule: { at: "Réveil à 21 oct., 09:00", recurring: "À 09:00 · Tous les jours" } as Record<Choice, string>,
- summaryOnce: "Réveiller Assistant ops · Déclencher une fois",
- summaryFired: "Réveiller Assistant ops · Déclencher une fois · Déclenché",
- summaryNext: (date: number) =>
- `Réveiller Assistant ops · Prochain : ${date} oct., 09:00 · jusqu’au 27 oct.`,
- summaryOff: "Réveiller Assistant ops · Désactivé",
- thisRun: (done: boolean) => `Cette exécution : ${done ? "Exécution réussie" : "En cours"}`,
- lastRun: "Dernière exécution : Exécution réussie",
- history: "Historique des réveils 1",
- chip: (date: number) => `${date} oct., 09:00 · réveille Assistant ops`,
- source: { at: "Réveil · Réveil à 21 oct., 09:00", recurring: "Réveil · À 09:00 · Tous les jours" } as Record<Choice, string>,
- steps: {
- read: "Lire la tâche, les commentaires et l'instruction du réveil",
- found: "Consulter les e-mails de devis : les 3 ont répondu",
- none: "Consulter les e-mails de devis : aucune réponse pour l'instant",
- compare: "Préparer le tableau comparatif des devis",
- checkin: "Rien qui demande une réponse : terminer par une vérification silencieuse",
- disable: "Devis reçus : désactiver cette vérification régulière",
- },
- checkin: "vérification silencieuse : aucun des 3 fournisseurs n'a encore envoyé de devis ; nouvelle vérification demain",
- reply:
- "Les 3 devis sont arrivés : A à 260 € le lot, livré en 10 jours ; B à 240 € en 14 jours ; C à 275 € en 7 jours. Le salon a lieu dans 3 semaines, je recommande donc B. Le tableau comparatif est joint à la tâche.",
- fastForward: (date: number) => `Avancer au ${date} oct., 09:00`,
- captions: {
- idle: "Assistant ops a demandé des devis à 3 fournisseurs et attend leurs réponses.",
- ready: "Les devis n'arriveront pas avant demain. Cliquez sur + dans la section Réveils pour qu'Assistant ops revienne plus tard sur cette tâche.",
- form: "L'assigné de la tâche, Assistant ops, est déjà sélectionné et l'instruction est rédigée. Ouvrez le menu des conditions.",
- menu: "Les deux conditions de temps conviennent ici : « À une heure donnée » réveille Assistant ops une fois ; « Vérifier régulièrement » le réveille chaque jour jusqu'à la date de fin.",
- preset: "L'heure par défaut est dans une heure. Remplacez-la par demain 09:00.",
- presetMenu: "Choisissez « Demain 09:00 ».",
- filled: {
- at: "Assistant ops sera réveillé une fois, demain à 09:00. Cliquez sur Créer.",
- recurring: "Assistant ops sera réveillé chaque jour à 09:00 jusqu'au 27 oct. Cliquez sur Créer.",
- } as Record<Choice, string>,
- scheduled:
- "La règle est enregistrée sur la tâche, et l'en-tête indique ce que la tâche attend. Aucune exécution ne tourne entre-temps. Avancez jusqu'à l'heure du réveil.",
- running: "Il est 09:00 : Assistant ops démarre une nouvelle exécution sur cette tâche, avec l'instruction du réveil.",
- checked:
- "Pas encore de réponse. Cette exécution n'a publié aucun commentaire ; elle a seulement laissé une vérification silencieuse dans l'historique. Avancez d'un jour de plus.",
- running2: "La vérification du lendemain commence.",
- done: {
- at: "Assistant ops a trouvé les devis et terminé la comparaison. Un réveil unique s'arrête après s'être déclenché et passe dans l'historique. Utilisez Rejouer pour essayer l'autre condition.",
- recurring:
- "Les devis sont arrivés. Assistant ops a publié la comparaison et désactivé la vérification régulière. Utilisez Rejouer pour essayer l'autre condition.",
- } as Record<Choice, string>,
- },
+ title: "Planifier un réveil sur une tâche",
+ chapters: ["Ouvrir Réveils", "Choisir condition", "Règle enregistrée"],
+ caption: "Ajoutez un réveil temporel ou événementiel pour que l'agent reprenne la même tâche automatiquement.",
},
};
-type Phase =
- | "idle"
- | "ready"
- | "form"
- | "menu"
- | "preset"
- | "presetMenu"
- | "filled"
- | "scheduled"
- | "running"
- | "checked"
- | "done";
-
-const pillClass =
- "inline-flex h-7 max-w-full min-w-0 items-center gap-1.5 rounded-md border bg-background px-2 text-label outline-none transition-colors enabled:hover:bg-muted focus-visible:ring-3 focus-visible:ring-ring/50 disabled:cursor-default [&_svg]:shrink-0";
-
-/** The rule's on/off switch; shown, not operated, in this demo. */
-function SwitchMark({ on }: { on: boolean }) {
- return (
- <span
- aria-hidden
- className={cn(
- "inline-flex h-4 w-7 shrink-0 items-center rounded-full p-0.5 transition-colors",
- on ? "bg-brand" : "bg-muted-foreground/30",
- )}
- >
- <span className={cn("size-3 rounded-full bg-background transition-transform", on && "translate-x-3")} />
- </span>
- );
-}
-
-function RuleRow({
- icon,
- title,
- on,
- children,
-}: {
- icon: ReactNode;
- title: string;
- on: boolean;
- children: ReactNode;
-}) {
- return (
- <div className="grid grid-cols-[minmax(0,1fr)_auto] gap-x-2 rounded-md py-1.5 text-caption motion-safe:animate-in motion-safe:fade-in">
- <span className="flex min-w-0 items-start gap-2 pl-2">
- {icon}
- <span className="min-w-0 font-medium break-words">{title}</span>
- </span>
- <span className="row-span-2 self-start pt-0.5 pr-2">
- <SwitchMark on={on} />
- </span>
- <span className="min-w-0 pl-7.5 break-words text-muted-foreground">{children}</span>
- </div>
- );
-}
-
export function WakeupDemo() {
const t = useDemoCopy(copy);
- const { after, clear } = useDemoTimers();
- const [frameRef, visible] = useStartWhenVisible<HTMLElement>();
- const [cycle, setCycle] = useState(0);
- const [phase, setPhase] = useState<Phase>("idle");
- const [choice, setChoice] = useState<Choice | null>(null);
- const [round, setRound] = useState<1 | 2>(1);
- const [stepsShown, setStepsShown] = useState(0);
-
- useEffect(() => {
- if (!visible) return;
- clear();
- after(600, () => setPhase("ready"));
- }, [visible, cycle, after, clear]);
-
- const stepsFor = (c: Choice, r: 1 | 2) =>
- c === "at"
- ? [t.steps.read, t.steps.found, t.steps.compare]
- : r === 1
- ? [t.steps.read, t.steps.none, t.steps.checkin]
- : [t.steps.read, t.steps.found, t.steps.compare, t.steps.disable];
-
- const pick = (c: Choice) => {
- setChoice(c);
- setPhase(c === "at" ? "preset" : "filled");
- };
-
- const fastForward = () => {
- if (!choice) return;
- const r: 1 | 2 = phase === "checked" ? 2 : 1;
- const steps = stepsFor(choice, r);
- setRound(r);
- setStepsShown(1);
- setPhase("running");
- steps.forEach((_, i) => {
- if (i > 0) after(i * 1000, () => setStepsShown(i + 1));
- });
- after(steps.length * 1000 + 300, () => setPhase(choice === "recurring" && r === 1 ? "checked" : "done"));
- };
-
- const replay = () => {
- clear();
- setPhase("idle");
- setChoice(null);
- setRound(1);
- setStepsShown(0);
- setCycle((c) => c + 1);
- };
-
- const shown: Phase = visible ? phase : "idle";
- const created = ["scheduled", "running", "checked", "done"].includes(shown) && choice !== null;
- const formOpen = ["form", "menu", "preset", "presetMenu", "filled"].includes(shown);
- const running = shown === "running";
- // A one-time rule turns off once it has fired; the regular check stays on
- // until the agent turns it off at the end.
- const ruleOn = created && (choice === "recurring" ? shown !== "done" : shown === "scheduled");
- const current = created && (ruleOn || running);
- // The day of the rule's next firing: the 21st until the first run starts.
- const next = shown === "scheduled" ? 21 : running && round === 2 ? 23 : 22;
- const steps = choice ? stepsFor(choice, round) : [];
- const showRun = choice !== null && (running || shown === "checked" || shown === "done");
- const showCheckin = choice === "recurring" && (shown === "checked" || round === 2);
-
- const caption = (() => {
- switch (shown) {
- case "filled":
- return t.captions.filled[choice ?? "at"];
- case "done":
- return t.captions.done[choice ?? "at"];
- case "running":
- return round === 2 ? t.captions.running2 : t.captions.running;
- default:
- return t.captions[shown];
- }
- })();
-
- const ruleLines = (() => {
- if (!choice) return null;
- if (choice === "at") {
- return (
- <>
- <span className="block">{shown === "scheduled" ? t.summaryOnce : t.summaryFired}</span>
- {shown !== "scheduled" && <span className="block">{t.thisRun(shown === "done")}</span>}
- </>
- );
- }
- return (
- <>
- <span className="block">{shown === "done" ? t.summaryOff : t.summaryNext(next)}</span>
- {running && <span className="block">{t.thisRun(false)}</span>}
- {(shown === "checked" || shown === "done") && <span className="block">{t.lastRun}</span>}
- </>
- );
- })();
-
- return (
- <DemoFrame frameRef={frameRef} title={t.title} caption={caption} onReplay={replay}>
- <div className="grid gap-4 p-4 sm:grid-cols-[minmax(0,1fr)_17rem]">
- {/* Issue: header and timeline */}
- <div className="flex min-w-0 flex-col gap-3">
- <div className="flex min-h-7 flex-wrap items-center gap-2">
- <span className="min-w-0 truncate text-body font-medium">{t.title}</span>
- {ruleOn && (
- <span
- key={next}
- className="inline-flex h-7 max-w-full min-w-0 items-center gap-1.5 rounded-full border px-2.5 text-caption motion-safe:animate-in motion-safe:fade-in"
- >
- <Bell aria-hidden className="size-3.5 shrink-0" />
- <span className="min-w-0 truncate">{t.chip(next)}</span>
- </span>
- )}
- </div>
-
- <DemoComment author={t.agent} agent>
- {t.opening}
- </DemoComment>
-
- {/* The check-in follows its own run, then stays above the next day's run. */}
- {showCheckin && round === 2 && (
- <div className="flex min-w-0 items-start gap-2 px-1 text-caption text-muted-foreground motion-safe:animate-in motion-safe:fade-in">
- <RefreshCw aria-hidden className="mt-px size-4 shrink-0" />
- <span className="min-w-0 flex-1 break-words">
- <span className="font-medium text-foreground">{t.agent}</span> {t.checkin}
- </span>
- <span className="hidden shrink-0 rounded-sm bg-muted px-1.5 py-0.5 text-micro sm:inline">
- {t.rule.recurring}
- </span>
- </div>
- )}
-
- {showRun && choice && (
- <div key={round} className="flex min-w-0 flex-col gap-1.5 motion-safe:animate-in motion-safe:fade-in">
- <span className="inline-flex w-fit max-w-full min-w-0 items-center gap-1 rounded-sm bg-muted px-1.5 py-0.5 text-micro text-muted-foreground">
- <Bell aria-hidden className="size-3 shrink-0" />
- <span className="truncate">{t.source[choice]}</span>
- </span>
- <DemoRun agent={t.agent} status={running ? t.running : t.completed} active={running}>
- {steps.slice(0, stepsShown).map((step, i) => (
- <DemoStep key={step} state={running && i === stepsShown - 1 ? "running" : "done"}>
- {step}
- </DemoStep>
- ))}
- </DemoRun>
- </div>
- )}
-
- {showCheckin && round === 1 && (
- <div className="flex min-w-0 items-start gap-2 px-1 text-caption text-muted-foreground motion-safe:animate-in motion-safe:fade-in">
- <RefreshCw aria-hidden className="mt-px size-4 shrink-0" />
- <span className="min-w-0 flex-1 break-words">
- <span className="font-medium text-foreground">{t.agent}</span> {t.checkin}
- </span>
- <span className="hidden shrink-0 rounded-sm bg-muted px-1.5 py-0.5 text-micro sm:inline">
- {t.rule.recurring}
- </span>
- </div>
- )}
-
- {shown === "done" && (
- <DemoComment author={t.agent} agent>
- {t.reply}
- </DemoComment>
- )}
-
- {(shown === "scheduled" || shown === "checked") && (
- <div className="mt-auto">
- <CoachMark active side="right" ringClassName="rounded-md">
- <Button type="button" size="sm" variant="outline" onClick={fastForward}>
- <FastForward />
- {t.fastForward(shown === "checked" ? 22 : 21)}
- </Button>
- </CoachMark>
- </div>
- )}
- </div>
-
- {/* Issue sidebar: the Wakeups section */}
- <aside className="min-w-0 border-t pt-3 sm:border-t-0 sm:border-l sm:pt-0 sm:pl-4">
- <div className="mb-1 flex items-center gap-1">
- <span className="flex min-h-8 flex-1 items-center gap-1 px-2 text-caption font-medium">
- {t.section}
- <span className="text-muted-foreground tabular-nums">{current ? 1 : 0}</span>
- <ChevronRight aria-hidden className="size-3 rotate-90 text-muted-foreground" />
- </span>
- <CoachMark active={shown === "ready"} side="bottom" align="end" ringClassName="rounded-md">
- <button
- type="button"
- aria-label={t.newWakeup}
- title={t.newWakeup}
- disabled={shown !== "ready"}
- onClick={() => setPhase("form")}
- className="inline-flex size-6 items-center justify-center rounded-md text-muted-foreground outline-none enabled:hover:bg-muted focus-visible:ring-3 focus-visible:ring-ring/50 disabled:opacity-50"
- >
- <Plus className="size-4" />
- </button>
- </CoachMark>
- </div>
-
- {formOpen && (
- <div className="rounded-lg border bg-popover p-3 text-popover-foreground shadow-md motion-safe:animate-in motion-safe:fade-in motion-safe:zoom-in-95">
- <div className="text-label font-semibold">{t.formTitle}</div>
- <div className="mt-3 grid grid-cols-[auto_minmax(0,1fr)] items-start gap-x-3 gap-y-2">
- <span className="flex h-7 items-center text-label text-muted-foreground">{t.when}</span>
- <div className="flex min-w-0 flex-wrap items-center gap-1.5">
- <CoachMark active={shown === "form"} quiet ringClassName="rounded-md">
- <button
- type="button"
- disabled={shown !== "form"}
- onClick={() => setPhase("menu")}
- className={cn(pillClass, !choice && "border-ring")}
- >
- {choice === "recurring" ? (
- <RefreshCw aria-hidden className="size-3.5 text-muted-foreground" />
- ) : (
- <Clock3 aria-hidden className="size-3.5 text-muted-foreground" />
- )}
- <span className={cn("truncate", !choice && "text-muted-foreground")}>
- {choice === "at" ? t.condAt : choice === "recurring" ? t.condRecurring : t.chooseCondition}
- </span>
- <ChevronDown aria-hidden className="size-3 text-muted-foreground" />
- </button>
- </CoachMark>
- {choice === "at" && (
- <CoachMark active={shown === "preset"} quiet ringClassName="rounded-md">
- <button
- type="button"
- disabled={shown !== "preset"}
- onClick={() => setPhase("presetMenu")}
- className={pillClass}
- >
- <span className="truncate">{shown === "filled" ? t.atPresets[2] : t.atPresets[1]}</span>
- <ChevronDown aria-hidden className="size-3 text-muted-foreground" />
- </button>
- </CoachMark>
- )}
- {choice === "recurring" && (
- <span className={pillClass}>
- <span className="truncate">{t.daily}</span>
- <ChevronDown aria-hidden className="size-3 text-muted-foreground" />
- </span>
- )}
- </div>
-
- {shown === "menu" && (
- <div className="col-span-2 rounded-md border bg-popover p-1 shadow-sm motion-safe:animate-in motion-safe:fade-in">
- <div className="px-2 py-1 text-micro text-muted-foreground">{t.groupTime}</div>
- {(
- [
- ["at", Clock3, t.condAt, t.condAtHint],
- ["recurring", RefreshCw, t.condRecurring, t.condRecurringHint],
- ] as const
- ).map(([key, Icon, label, hint]) => (
- <CoachMark key={key} active quiet ringClassName="rounded-sm" className="flex w-full">
- <button
- type="button"
- onClick={() => pick(key)}
- className="flex w-full items-start gap-2 rounded-sm px-2 py-1.5 text-left outline-none hover:bg-muted focus-visible:ring-3 focus-visible:ring-ring/50"
- >
- <Icon aria-hidden className="mt-0.5 size-3.5 shrink-0 text-muted-foreground" />
- <span className="flex min-w-0 flex-col gap-0.5">
- <span className="text-label">{label}</span>
- <span className="text-caption text-muted-foreground">{hint}</span>
- </span>
- </button>
- </CoachMark>
- ))}
- </div>
- )}
-
- {shown === "presetMenu" && (
- <div className="col-span-2 rounded-md border bg-popover p-1 shadow-sm motion-safe:animate-in motion-safe:fade-in">
- {t.atPresets.map((label, i) =>
- i === 2 ? (
- <CoachMark key={label} active quiet ringClassName="rounded-sm" className="flex w-full">
- <button
- type="button"
- onClick={() => setPhase("filled")}
- className="flex w-full rounded-sm px-2 py-1 text-left text-label outline-none hover:bg-muted focus-visible:ring-3 focus-visible:ring-ring/50"
- >
- {label}
- </button>
- </CoachMark>
- ) : (
- <span key={label} className="flex px-2 py-1 text-label text-muted-foreground">
- {label}
- </span>
- ),
- )}
- </div>
- )}
-
- <span className="flex h-7 items-center text-label text-muted-foreground">{t.wake}</span>
- <span className={cn(pillClass, "w-fit")}>
- <DemoAvatar name={t.agent} agent />
- <span className="truncate">{t.agent}</span>
- <ChevronDown aria-hidden className="size-3 text-muted-foreground" />
- </span>
- </div>
-
- <div className="mt-3 text-caption font-medium">{t.instructionTitle}</div>
- {/* Static text, not a textarea: the demo is scripted around this instruction. */}
- <div className="mt-1 rounded-md border bg-background px-2 py-1.5 text-label">{t.instruction}</div>
-
- {choice === "recurring" && (
- <div className="mt-3 flex items-center gap-3 text-caption">
- <span className="text-muted-foreground">{t.until}</span>
- <span className="rounded-md border bg-background px-2 py-1 tabular-nums">{t.untilValue}</span>
- </div>
- )}
-
- <div className="mt-3 flex flex-col gap-2 border-t pt-2.5">
- <span className="flex min-w-0 items-center gap-1 text-caption text-muted-foreground">
- <Info aria-hidden className="size-3 shrink-0" />
- {t.onBehalf}
- </span>
- <span className="flex items-center justify-end gap-1.5 sm:pb-7">
- <Button type="button" size="sm" variant="ghost" disabled>
- {t.cancel}
- </Button>
- <CoachMark active={shown === "filled"} side="bottom" align="end" ringClassName="rounded-lg">
- <Button type="button" size="sm" disabled={shown !== "filled"} onClick={() => setPhase("scheduled")}>
- {t.create}
- </Button>
- </CoachMark>
- </span>
- </div>
- </div>
- )}
-
- {created && choice && current && (
- <RuleRow
- icon={<Clock3 aria-hidden className="mt-px size-3.5 shrink-0 text-muted-foreground" />}
- title={t.rule[choice]}
- on={ruleOn}
- >
- {ruleLines}
- </RuleRow>
- )}
-
- {created && choice && !current && (
- <>
- <div className="flex min-h-8 items-center gap-1 px-2 text-caption text-muted-foreground">
- <ChevronRight aria-hidden className="size-3 rotate-90" />
- {t.history}
- </div>
- <RuleRow
- icon={<Clock3 aria-hidden className="mt-px size-3.5 shrink-0 text-muted-foreground" />}
- title={t.rule[choice]}
- on={false}
- >
- {ruleLines}
- </RuleRow>
- </>
- )}
-
- </aside>
- </div>
- </DemoFrame>
- );
+ const meta = CLIP_MANIFEST.wakeup ?? { duration: 6.0, chapters: [] };
+ const chapters = t.chapters.map((label, i) => ({
+ label,
+ at: meta.chapters[i]?.at ?? (i * meta.duration) / t.chapters.length,
+ }));
+ return <EditorialClip slug="wakeup" title={t.title} chapters={chapters} duration={meta.duration} caption={t.caption} />;
}
diff --git a/apps/docs/components/demos/workflow-demo.tsx b/apps/docs/components/demos/workflow-demo.tsx
index f94f2e7c7e..24d33e2bf3 100644
--- a/apps/docs/components/demos/workflow-demo.tsx
+++ b/apps/docs/components/demos/workflow-demo.tsx
@@ -1,585 +1,47 @@
"use client";
-import { useRef, useState } from "react";
-import { ArrowRight, ChevronDown, ChevronRight, CornerDownRight, X } from "@multica/ui/icons";
-import { Button } from "@multica/ui/components/ui/button";
-import { cn } from "@multica/ui/lib/utils";
-import {
- CoachMark,
- DemoAvatar,
- DemoComment,
- DemoFrame,
- DemoRun,
- DemoStep,
- useDemoCopy,
- useDemoTimers,
- useStartWhenVisible,
-} from "./demo-kit";
-
-// The Content template's middle columns (packages/views/workflows/templates.ts)
-// between the fixed todo / done / cancelled columns every workflow lists.
-type Status = "todo" | "drafting" | "editing" | "scheduled" | "done" | "cancelled";
-type Handler = "you" | "agent" | "member";
-
-const PICKER: Status[] = ["todo", "drafting", "editing", "scheduled", "done", "cancelled"];
-const STEPS: Status[] = ["drafting", "editing", "scheduled"];
-const HANDLERS: Partial<Record<Status, Handler>> = { drafting: "you", editing: "agent", scheduled: "member" };
-
-const statusDot: Record<Status, string> = {
- todo: "border-muted-foreground",
- drafting: "border-warning bg-warning/40",
- editing: "border-brand bg-brand/40",
- scheduled: "border-success bg-success/40",
- done: "border-success bg-success",
- cancelled: "border-muted-foreground bg-muted-foreground/50",
-};
+import { CLIP_MANIFEST } from "./clip-manifest";
+import { EditorialClip, useDemoCopy } from "./demo-kit";
const copy = {
en: {
- title: "OPS-31 · Write the anniversary event announcement",
- issue: "OPS-31",
- workflow: "Content",
- project: "Anniversary online event",
- statusLabel: "Status",
- assigneeLabel: "Assignee",
- names: { you: "You", agent: "Writing helper", member: "Lei Li" } as Record<Handler, string>,
- status: {
- todo: "Todo",
- drafting: "Drafting",
- editing: "Editing",
- scheduled: "Scheduled",
- done: "Done",
- cancelled: "Cancelled",
- } as Record<Status, string>,
- handsOffTo: (name: string) => `Hands off to ${name}`,
- then: (status: string) => `Then → ${status}`,
- pickerHeader: (workflow: string, project: string) => `${workflow} · from project "${project}"`,
- pickerFooter: "Only this issue's workflow statuses are shown. The right side is who entering the status hands it to.",
- confirmTitle: (issue: string, status: string) => `Move ${issue} to "${status}"?`,
- reassignRun: (from: string, to: string) => [`The assignee changes from `, from, ` to `, to, `, who starts working right away.`],
- briefToggle: (name: string) => `What ${name} receives`,
- brief: "Polish the title and body in the brand voice, fix typos, check the event dates and prize rules, then move the issue to Scheduled.",
- cancel: "Cancel",
- confirm: (status: string) => `Move to ${status}`,
- close: "Close",
- changed: (from: string, to: string) => `changed status from ${from} to ${to}`,
- handedTo: "Handed to",
- runStarted: "and started a run",
- memberNoRun: "(member, no run)",
- queued: "Queued",
- running: "Running",
- completed: "Completed",
- steps: [
- "Read the issue description, comments and handoff brief",
- "Tighten the title and fix two typos",
- "Check the event dates, prize rules and sign-up link",
- "Set the status to Scheduled",
- ],
- reply: "The post is edited: a shorter title and two date fixes. Lei Li, it is ready to schedule.",
- captions: {
- idle: "An issue in a project that uses the Content workflow.",
- start: "Your draft is written. Click Status to pass the issue to the next step.",
- pick: "The list only has this workflow's steps, and shows who each one hands to. Pick Editing.",
- confirm: "The confirmation names the new assignee, and you can read the brief it will receive. Confirm, or cancel to keep the issue where it is.",
- kept: "Nothing moved: the issue stays in Drafting and you are still the assignee. Click Status to try again.",
- running: "Writing helper took over and started a run. The description, comments and earlier work stay on the issue.",
- done: "Writing helper followed \"Then\" and moved the issue to Scheduled, which hands it to Lei Li. A member handoff only changes the assignee and starts no run.",
- },
+ title: "Hand off an issue through a project workflow",
+ chapters: ["Workflow statuses", "Confirm handoff", "Next owner runs"],
+ caption: "Moving an issue to a step with an agent handler confirms the handoff brief and starts the next agent in place.",
},
zh: {
- title: "OPS-31 · 写周年庆活动推文",
- issue: "OPS-31",
- workflow: "内容生产",
- project: "周年庆线上活动",
- statusLabel: "状态",
- assigneeLabel: "负责人",
- names: { you: "你", agent: "文案助手", member: "李雷" } as Record<Handler, string>,
- status: {
- todo: "待办",
- drafting: "撰写中",
- editing: "编辑中",
- scheduled: "已排期",
- done: "已完成",
- cancelled: "已取消",
- } as Record<Status, string>,
- handsOffTo: (name: string) => `交给 ${name}`,
- then: (status: string) => `完成后 → ${status}`,
- pickerHeader: (workflow: string, project: string) => `${workflow} · 跟随项目"${project}"`,
- pickerFooter: "只显示这个任务所在工作流里的状态。右侧是进入该状态时的处理人。",
- confirmTitle: (issue: string, status: string) => `将 ${issue} 移到"${status}"?`,
- reassignRun: (from: string, to: string) => [`负责人将从 `, from, ` 改为 `, to, `,它会立即开始运行。`],
- briefToggle: (name: string) => `${name} 会收到的说明`,
- brief: "按品牌语气润色标题和正文,改掉错别字,核对活动时间和抽奖规则,改好后把任务移到已排期。",
- cancel: "取消",
- confirm: (status: string) => `移到${status}`,
- close: "关闭",
- changed: (from: string, to: string) => `状态从 ${from} 改为 ${to}`,
- handedTo: "已交给",
- runStarted: "并开始运行",
- memberNoRun: "(成员,不启动运行)",
- queued: "排队中",
- running: "运行中",
- completed: "已完成",
- steps: [
- "读取任务描述、评论和交接说明",
- "缩短标题,改掉两处错别字",
- "核对活动时间、抽奖规则和报名链接",
- "把状态改为 已排期",
- ],
- reply: "推文已改好:标题换成了更短的版本,修正了两处日期。李雷,可以安排发布了。",
- captions: {
- idle: "一条任务,所在项目使用内容生产工作流。",
- start: "你的初稿写完了。点击状态,把任务交给下一步。",
- pick: "列表里只有这个工作流的步骤,右侧标出进入后交给谁。选择编辑中。",
- confirm: "确认窗口写明了新的负责人,还能查看它会收到的说明。确认交接,或取消留在原处。",
- kept: "没有交接:任务留在撰写中,负责人还是你。点击状态可以再试一次。",
- running: "文案助手接手并开始运行。任务的描述、评论和之前的成果都留在原处。",
- done: "文案助手按\"完成后进入\"把任务移到已排期,负责人随之换成李雷。交给成员只改负责人,不启动运行。",
- },
+ title: "按项目工作流把任务交给下一步",
+ chapters: ["查看工作流状态", "确认交接说明", "下一位智能体执行"],
+ caption: "将任务移入配置了处理人的状态列时,确认窗展示交接对象与说明,确认后立即在原任务上接力运行。",
+ },
+ "zh-Hant": {
+ title: "按專案工作流將任務交給下一步",
+ chapters: ["檢視工作流狀態", "確認交接說明", "下一位智能體執行"],
+ caption: "將任務移入設定了處理人的狀態列時,確認視窗會展示交接對象與說明,確認後立即接力執行。",
},
ja: {
- title: "OPS-31 · 周年記念イベントの告知投稿を書く",
- issue: "OPS-31",
- workflow: "コンテンツ制作",
- project: "周年記念オンラインイベント",
- statusLabel: "ステータス",
- assigneeLabel: "担当者",
- names: { you: "あなた", agent: "ライティングアシスタント", member: "李雷" } as Record<Handler, string>,
- status: {
- todo: "未着手",
- drafting: "執筆中",
- editing: "編集中",
- scheduled: "公開予約済み",
- done: "完了",
- cancelled: "キャンセル済み",
- } as Record<Status, string>,
- handsOffTo: (name: string) => `${name} に引き継ぐ`,
- then: (status: string) => `完了後 → ${status}`,
- pickerHeader: (workflow: string, project: string) => `${workflow} · プロジェクト「${project}」に従う`,
- pickerFooter: "このタスクのワークフローのステータスだけを表示しています。右側はそのステータスに入ったときの引き継ぎ先です。",
- confirmTitle: (issue: string, status: string) => `${issue} を「${status}」に移動しますか?`,
- reassignRun: (from: string, to: string) => [`担当者が `, from, ` から `, to, ` に変わり、すぐに実行を始めます。`],
- briefToggle: (name: string) => `${name} が受け取る説明`,
- brief: "ブランドのトーンに合わせてタイトルと本文を整え、誤字を直し、イベントの日程と抽選ルールを確認してから、タスクを公開予約済みに移動する。",
- cancel: "キャンセル",
- confirm: (status: string) => `${status}に移動`,
- close: "閉じる",
- changed: (from: string, to: string) => `ステータスを ${from} から ${to} に変更しました`,
- handedTo: "引き継ぎ先",
- runStarted: "実行を開始",
- memberNoRun: "(メンバー、実行なし)",
- queued: "待機中",
- running: "実行中",
- completed: "完了",
- steps: [
- "タスクの説明、コメント、引き継ぎの説明を読む",
- "タイトルを短くし、誤字を 2 か所直す",
- "イベントの日程、抽選ルール、申し込みリンクを確認する",
- "ステータスを 公開予約済み に変更",
- ],
- reply: "投稿を直しました。タイトルを短くし、日付を 2 か所修正しています。李雷さん、公開の予約をお願いします。",
- captions: {
- idle: "コンテンツ制作ワークフローを使うプロジェクトのタスク。",
- start: "下書きが書き終わりました。ステータスをクリックして、タスクを次のステップに渡します。",
- pick: "一覧にはこのワークフローのステップだけが並び、右側にそれぞれの引き継ぎ先が出ます。編集中を選んでください。",
- confirm: "確認ダイアログに新しい担当者が表示され、その担当者が受け取る説明も読めます。確定するか、キャンセルしてそのままにします。",
- kept: "何も動いていません。タスクは執筆中のままで、担当者もあなたのままです。ステータスをクリックしてもう一度試せます。",
- running: "ライティングアシスタントが引き継いで実行を始めました。説明、コメント、それまでの成果はタスクに残っています。",
- done: "ライティングアシスタントは「完了したら移動」に従ってタスクを公開予約済みに移し、担当者は李雷に替わりました。メンバーへの引き継ぎは担当者を変えるだけで、実行は始まりません。",
- },
+ title: "プロジェクトのワークフローで次のステップへ引き継ぐ",
+ chapters: ["ワークフロー状態", "引き継ぎを確認", "次の担当が実行"],
+ caption: "エージェントが割り当てられたステップへ移すと確認画面が開き、同じタスク上で次の実行が始まります。",
},
ko: {
- title: "OPS-31 · 창립 기념 이벤트 공지 게시물 작성",
- issue: "OPS-31",
- workflow: "콘텐츠 제작",
- project: "창립 기념 온라인 이벤트",
- statusLabel: "상태",
- assigneeLabel: "담당자",
- names: { you: "나", agent: "글쓰기 도우미", member: "리레이" } as Record<Handler, string>,
- status: {
- todo: "할 일",
- drafting: "작성 중",
- editing: "편집 중",
- scheduled: "예약됨",
- done: "완료",
- cancelled: "취소됨",
- } as Record<Status, string>,
- handsOffTo: (name: string) => `${name}에게 인계`,
- then: (status: string) => `완료 후 → ${status}`,
- pickerHeader: (workflow: string, project: string) => `${workflow} · 프로젝트 “${project}” 기준`,
- pickerFooter: "이 태스크 워크플로의 상태만 표시합니다. 오른쪽은 해당 상태에 들어갈 때의 처리자입니다.",
- confirmTitle: (issue: string, status: string) => `${issue}을(를) “${status}”(으)로 옮길까요?`,
- reassignRun: (from: string, to: string) => [`담당자가 `, from, `에서 `, to, `(으)로 바뀌고 바로 실행을 시작합니다.`],
- briefToggle: (name: string) => `${name}이(가) 받는 설명`,
- brief: "브랜드 말투에 맞춰 제목과 본문을 다듬고, 오탈자를 고치고, 이벤트 일정과 추첨 규칙을 확인한 뒤 태스크를 예약됨으로 옮긴다.",
- cancel: "취소",
- confirm: (status: string) => `${status}(으)로 이동`,
- close: "닫기",
- changed: (from: string, to: string) => `상태를 ${from}에서 ${to}로 변경했습니다`,
- handedTo: "인계 대상",
- runStarted: "실행 시작",
- memberNoRun: "(멤버, 실행 없음)",
- queued: "대기 중",
- running: "실행 중",
- completed: "완료됨",
- steps: [
- "태스크 설명, 댓글, 인계 설명 읽기",
- "제목을 줄이고 오탈자 두 곳 수정",
- "이벤트 일정, 추첨 규칙, 신청 링크 확인",
- "상태를 예약됨으로 변경",
- ],
- reply: "게시물을 다듬었습니다. 제목을 더 짧게 바꾸고 날짜 두 곳을 고쳤습니다. 리레이 님, 게시 예약을 부탁드립니다.",
- captions: {
- idle: "콘텐츠 제작 워크플로를 쓰는 프로젝트의 태스크입니다.",
- start: "초안을 다 썼습니다. 상태를 클릭해 태스크를 다음 단계로 넘기세요.",
- pick: "목록에는 이 워크플로의 단계만 있고, 오른쪽에 각 단계의 인계 대상이 표시됩니다. 편집 중을 선택하세요.",
- confirm: "확인 창에 새 담당자가 표시되고, 그 담당자가 받을 설명도 볼 수 있습니다. 확인하거나, 취소해서 그대로 두세요.",
- kept: "아무것도 바뀌지 않았습니다. 태스크는 작성 중에 그대로 있고 담당자도 여전히 나입니다. 상태를 클릭해 다시 해 보세요.",
- running: "글쓰기 도우미가 넘겨받아 실행을 시작했습니다. 설명, 댓글, 이전 결과는 태스크에 그대로 남아 있습니다.",
- done: "글쓰기 도우미가 “완료 후 이동”에 따라 태스크를 예약됨으로 옮겼고, 담당자는 리레이로 바뀌었습니다. 멤버에게 넘기면 담당자만 바뀌고 실행은 시작되지 않습니다.",
- },
+ title: "프로젝트 워크플로로 다음 단계 인계하기",
+ chapters: ["워크플로 상태", "인계 확인", "다음 담당자 실행"],
+ caption: "에이전트가 지정된 단계로 옮기면 인계 확인 후 같은 태스크에서 바로 다음 실행이 시작됩니다.",
},
fr: {
- title: "OPS-31 · Rédiger l'annonce de l'événement anniversaire",
- issue: "OPS-31",
- workflow: "Contenu",
- project: "Événement en ligne de l'anniversaire",
- statusLabel: "Statut",
- assigneeLabel: "Assigné à",
- names: { you: "Vous", agent: "Assistant rédaction", member: "Lei Li" } as Record<Handler, string>,
- status: {
- todo: "À faire",
- drafting: "Rédaction",
- editing: "Relecture",
- scheduled: "Planifié",
- done: "Terminé",
- cancelled: "Annulé",
- } as Record<Status, string>,
- handsOffTo: (name: string) => `Confiée à ${name}`,
- then: (status: string) => `puis → ${status}`,
- pickerHeader: (workflow: string, project: string) => `${workflow} · selon le projet « ${project} »`,
- pickerFooter: "Seuls les états du workflow de cette tâche sont affichés. À droite : à qui elle est confiée en entrant dans l’état.",
- confirmTitle: (issue: string, status: string) => `Déplacer ${issue} vers « ${status} » ?`,
- reassignRun: (from: string, to: string) => [`L’assigné passe de `, from, ` à `, to, `, qui commence aussitôt.`],
- briefToggle: (name: string) => `Ce que reçoit ${name}`,
- brief: "Retravailler le titre et le texte dans le ton de la marque, corriger les coquilles, vérifier les dates de l'événement et le règlement du tirage, puis passer la tâche à Planifié.",
- cancel: "Annuler",
- confirm: (status: string) => `Déplacer vers ${status}`,
- close: "Fermer",
- changed: (from: string, to: string) => `a changé le statut de ${from} à ${to}`,
- handedTo: "Confiée à",
- runStarted: "exécution lancée",
- memberNoRun: "(membre, sans exécution)",
- queued: "En file d'attente",
- running: "En cours",
- completed: "Terminée",
- steps: [
- "Lire la description de la tâche, les commentaires et les consignes de relais",
- "Raccourcir le titre et corriger deux coquilles",
- "Vérifier les dates, le règlement du tirage et le lien d'inscription",
- "Passer le statut à Planifié",
- ],
- reply: "L'annonce est relue : un titre plus court et deux dates corrigées. Lei Li, elle est prête à être planifiée.",
- captions: {
- idle: "Une tâche dans un projet qui utilise le workflow Contenu.",
- start: "Votre brouillon est écrit. Cliquez sur Statut pour passer la tâche à l'étape suivante.",
- pick: "La liste ne contient que les étapes de ce workflow et indique à qui chacune confie la tâche. Choisissez Relecture.",
- confirm: "La confirmation indique le nouvel assigné, et vous pouvez lire les consignes qu'il recevra. Confirmez, ou annulez pour laisser la tâche où elle est.",
- kept: "Rien n'a bougé : la tâche reste en Rédaction et vous en êtes toujours l'assigné. Cliquez sur Statut pour réessayer.",
- running: "Assistant rédaction a pris le relais et lancé une exécution. La description, les commentaires et le travail déjà fait restent sur la tâche.",
- done: "Assistant rédaction a suivi « Une fois terminé, passer à » et déplacé la tâche vers Planifié, qui la confie à Lei Li. Un relais vers un membre ne change que l'assigné et ne lance aucune exécution.",
- },
+ title: "Transmettre une tâche via un workflow de projet",
+ chapters: ["Étapes du workflow", "Confirmer le relais", "Exécution suivante"],
+ caption: "Passer à une étape assignée à un agent confirme le brief de relais et démarre l'étape suivante sur place.",
},
};
-type Phase = "idle" | "start" | "pick" | "confirm" | "kept" | "running" | "done";
-
-type Entry = { actor: Handler; from: Status; to: Status; handedTo: Handler };
-
export function WorkflowDemo() {
const t = useDemoCopy(copy);
- const { after, clear } = useDemoTimers();
- const [frameRef, visible] = useStartWhenVisible<HTMLElement>();
- const [phase, setPhase] = useState<Exclude<Phase, "idle">>("start");
- const [status, setStatus] = useState<Status>("drafting");
- const [assignee, setAssignee] = useState<Handler>("you");
- const [entries, setEntries] = useState<Entry[]>([]);
- const [briefOpen, setBriefOpen] = useState(false);
- const [queued, setQueued] = useState(true);
- const [stepsShown, setStepsShown] = useState(0);
- const statusRef = useRef<Status>("drafting");
-
- const shownPhase: Phase = visible ? phase : "idle";
-
- // A status change that enters a handoff step reassigns the issue in the same write.
- const enter = (to: Status, actor: Handler) => {
- const from = statusRef.current;
- const handedTo = HANDLERS[to]!;
- statusRef.current = to;
- setStatus(to);
- setAssignee(handedTo);
- setEntries((items) => [...items, { actor, from, to, handedTo }]);
- };
-
- const confirm = () => {
- enter("editing", "you");
- setPhase("running");
- after(900, () => setQueued(false));
- t.steps.forEach((_, i) =>
- after(900 + i * 1000, () => {
- setStepsShown(i + 1);
- if (i === t.steps.length - 1) enter("scheduled", "agent");
- }),
- );
- after(900 + t.steps.length * 1000 + 500, () => setPhase("done"));
- };
-
- const replay = () => {
- clear();
- setPhase("start");
- statusRef.current = "drafting";
- setStatus("drafting");
- setAssignee("you");
- setEntries([]);
- setBriefOpen(false);
- setQueued(true);
- setStepsShown(0);
- };
-
- const canOpenPicker = visible && (phase === "start" || phase === "kept" || phase === "pick");
- const runActive = phase === "running";
- const showRun = phase === "running" || phase === "done";
- const name = (h: Handler) => t.names[h];
-
- return (
- <DemoFrame frameRef={frameRef} title={t.title} caption={t.captions[shownPhase]} onReplay={replay}>
- <div className="relative flex min-h-[28rem] flex-col gap-3 p-4">
- <ol className="flex flex-wrap items-stretch gap-1.5" aria-label={t.workflow}>
- {STEPS.map((step, i) => {
- const handler = HANDLERS[step]!;
- const next = STEPS[i + 1];
- return (
- <li key={step} className="m-0 flex min-w-0 items-center gap-1.5">
- <div
- className={cn(
- "min-w-0 rounded-lg border px-2 py-1 transition-colors",
- status === step ? "border-brand/40 bg-brand/5" : "bg-background",
- )}
- >
- <div className="flex items-center gap-1.5 text-label font-medium">
- <span aria-hidden className={cn("size-2.5 rounded-full border-2", statusDot[step])} />
- {t.status[step]}
- </div>
- <div className="flex items-center gap-1 text-micro text-muted-foreground">
- <DemoAvatar name={name(handler)} agent={handler === "agent"} />
- <span className="truncate">{t.handsOffTo(name(handler))}</span>
- </div>
- {handler === "agent" && next && (
- <div className="text-micro text-muted-foreground">{t.then(t.status[next])}</div>
- )}
- </div>
- {next && <ArrowRight aria-hidden className="size-3.5 shrink-0 text-muted-foreground" />}
- </li>
- );
- })}
- </ol>
-
- <dl className="grid w-fit grid-cols-[auto_auto] items-center gap-x-6 gap-y-2 text-body">
- <dt className="text-caption text-muted-foreground">{t.statusLabel}</dt>
- <dd className="relative">
- <CoachMark
- active={visible && (phase === "start" || phase === "kept")}
- side="right"
- ringClassName="rounded-md"
- >
- <button
- type="button"
- aria-haspopup="listbox"
- aria-expanded={phase === "pick"}
- disabled={!canOpenPicker}
- onClick={() => setPhase(phase === "pick" ? "start" : "pick")}
- className="-mx-1.5 inline-flex h-7 items-center gap-1.5 rounded-md px-1.5 hover:bg-muted disabled:hover:bg-transparent"
- >
- <span aria-hidden className={cn("size-3 rounded-full border-2 transition-colors", statusDot[status])} />
- <span key={status} className="motion-safe:animate-in motion-safe:fade-in">
- {t.status[status]}
- </span>
- {canOpenPicker && <ChevronDown aria-hidden className="size-3.5 text-muted-foreground" />}
- </button>
- </CoachMark>
- {phase === "pick" && (
- <div
- role="listbox"
- aria-label={t.statusLabel}
- className="absolute top-full left-0 z-10 mt-1 w-72 max-w-[calc(100vw-7.5rem)] rounded-lg border bg-popover p-1 text-popover-foreground shadow-md motion-safe:animate-in motion-safe:fade-in"
- >
- <div className="truncate px-2 pt-1 pb-1 text-micro text-muted-foreground">
- {t.pickerHeader(t.workflow, t.project)}
- </div>
- {PICKER.map((s) => {
- const handler = HANDLERS[s];
- return (
- <CoachMark quiet key={s} active={s === "editing"} ringClassName="rounded-md" className="flex w-full">
- <button
- type="button"
- role="option"
- aria-selected={s === status}
- disabled={s !== "editing"}
- onClick={() => setPhase("confirm")}
- className="flex w-full items-center gap-2 rounded-md px-2 py-1 text-left text-body hover:bg-accent disabled:opacity-45 disabled:hover:bg-transparent"
- >
- <span aria-hidden className={cn("size-3 shrink-0 rounded-full border-2", statusDot[s])} />
- <span className="min-w-0 flex-1 truncate">{t.status[s]}</span>
- {s === status ? (
- <span className="text-caption text-muted-foreground">✓</span>
- ) : (
- handler && (
- <span className="flex shrink-0 items-center gap-1 text-caption text-muted-foreground">
- <DemoAvatar name={name(handler)} agent={handler === "agent"} />
- {name(handler)}
- </span>
- )
- )}
- </button>
- </CoachMark>
- );
- })}
- <div className="mt-1 border-t px-2 pt-1.5 pb-1 text-micro text-muted-foreground">{t.pickerFooter}</div>
- </div>
- )}
- </dd>
- <dt className="text-caption text-muted-foreground">{t.assigneeLabel}</dt>
- <dd key={assignee} className="flex items-center gap-1.5 motion-safe:animate-in motion-safe:fade-in">
- <DemoAvatar name={name(assignee)} agent={assignee === "agent"} />
- {name(assignee)}
- </dd>
- </dl>
-
- {entries.length > 0 && (
- <ul className="flex list-none flex-col gap-1.5 p-0">
- {entries.map((entry, i) => (
- <li key={i} className="m-0 min-w-0 text-caption text-muted-foreground motion-safe:animate-in motion-safe:fade-in">
- <div className="flex min-w-0 items-center gap-1.5">
- <DemoAvatar name={name(entry.actor)} agent={entry.actor === "agent"} />
- <span className="font-medium text-foreground">{name(entry.actor)}</span>
- <span className="min-w-0 truncate">{t.changed(t.status[entry.from], t.status[entry.to])}</span>
- </div>
- <div className="mt-0.5 flex flex-wrap items-center gap-1.5 pl-6">
- <CornerDownRight aria-hidden className="size-3 shrink-0" />
- <span>{t.handedTo}</span>
- <DemoAvatar name={name(entry.handedTo)} agent={entry.handedTo === "agent"} />
- <span className="font-medium text-foreground">{name(entry.handedTo)}</span>
- <span>{entry.handedTo === "member" ? t.memberNoRun : t.runStarted}</span>
- </div>
- </li>
- ))}
- </ul>
- )}
-
- {showRun && (
- <DemoRun
- agent={name("agent")}
- status={runActive ? (queued ? t.queued : t.running) : t.completed}
- active={runActive}
- >
- {t.steps.slice(0, stepsShown).map((step, i) => (
- <DemoStep key={step} state={i === stepsShown - 1 && runActive ? "running" : "done"}>
- {step}
- </DemoStep>
- ))}
- </DemoRun>
- )}
-
- {phase === "done" && (
- <DemoComment author={name("agent")} agent>
- {t.reply}
- </DemoComment>
- )}
-
- {phase === "confirm" && (
- <div className="absolute inset-0 z-20 flex items-center justify-center bg-background/60 p-4 backdrop-blur-[2px] motion-safe:animate-in motion-safe:fade-in">
- <div
- role="dialog"
- aria-modal="false"
- aria-labelledby="workflow-demo-title"
- className="w-full max-w-md rounded-xl border bg-popover text-popover-foreground shadow-lg motion-safe:animate-in motion-safe:zoom-in-95"
- >
- <div className="flex items-start gap-2 p-4 pb-3">
- <div className="min-w-0 flex-1">
- <div id="workflow-demo-title" className="text-title-sm font-medium">
- {t.confirmTitle(t.issue, t.status.editing)}
- </div>
- <div className="mt-1 flex flex-wrap items-center gap-1.5 text-caption text-muted-foreground">
- <span className="inline-flex items-center gap-1">
- <span aria-hidden className={cn("size-2.5 rounded-full border-2", statusDot.drafting)} />
- {t.status.drafting}
- </span>
- <ArrowRight aria-hidden className="size-3" />
- <span className="inline-flex items-center gap-1">
- <span aria-hidden className={cn("size-2.5 rounded-full border-2", statusDot.editing)} />
- {t.status.editing}
- </span>
- <span aria-hidden>·</span>
- <span>{t.workflow}</span>
- </div>
- </div>
- <button
- type="button"
- aria-label={t.close}
- onClick={() => setPhase("kept")}
- className="rounded-md p-1 text-muted-foreground hover:bg-muted"
- >
- <X className="size-4" />
- </button>
- </div>
- <div className="space-y-3 px-4 pb-4">
- <p className="text-body leading-7">
- {t.reassignRun(name("you"), name("agent")).map((part, i) =>
- i % 2 === 1 ? (
- <span key={i} className="mx-0.5 inline-flex items-center gap-1 align-middle font-medium">
- <DemoAvatar name={part} agent={i === 3} />
- {part}
- </span>
- ) : (
- <span key={i}>{part}</span>
- ),
- )}
- </p>
- <div>
- <button
- type="button"
- aria-expanded={briefOpen}
- onClick={() => setBriefOpen((v) => !v)}
- className="flex items-center gap-1 text-caption font-medium text-brand hover:underline"
- >
- {briefOpen ? (
- <ChevronDown aria-hidden className="size-3.5" />
- ) : (
- <ChevronRight aria-hidden className="size-3.5" />
- )}
- {t.briefToggle(name("agent"))}
- </button>
- {briefOpen && (
- <div className="mt-2 rounded-lg border bg-muted/40 px-3 py-2 text-caption motion-safe:animate-in motion-safe:fade-in">
- {t.brief}
- </div>
- )}
- </div>
- </div>
- <div className="flex justify-end gap-2 rounded-b-xl border-t bg-muted/40 px-4 py-3">
- <Button type="button" variant="outline" size="sm" onClick={() => setPhase("kept")}>
- {t.cancel}
- </Button>
- <CoachMark active side="bottom" align="end" ringClassName="rounded-lg">
- <Button type="button" size="sm" onClick={confirm}>
- {t.confirm(t.status.editing)}
- </Button>
- </CoachMark>
- </div>
- </div>
- </div>
- )}
- </div>
- </DemoFrame>
- );
+ const meta = CLIP_MANIFEST.workflow ?? { duration: 6.5, chapters: [] };
+ const chapters = t.chapters.map((label, i) => ({
+ label,
+ at: meta.chapters[i]?.at ?? (i * meta.duration) / t.chapters.length,
+ }));
+ return <EditorialClip slug="workflow" title={t.title} chapters={chapters} duration={meta.duration} caption={t.caption} />;
}
diff --git a/apps/docs/content/docs/analytics.fr.mdx b/apps/docs/content/docs/analytics.fr.mdx
index 3d7ebc83f8..1d897bdc37 100644
--- a/apps/docs/content/docs/analytics.fr.mdx
+++ b/apps/docs/content/docs/analytics.fr.mdx
@@ -45,7 +45,7 @@ Le **Classement** liste les tokens, le coût, le temps et les exécutions, trié
Quand une partie des exécutions d'un agent ou d'un squad n'a pas transmis de tokens, ses Tokens et son Coût sont précédés de `≥`, et une ligne sous son nom indique combien d'exécutions n'ont pas transmis leur consommation.
-Dans la démo ci-dessous, une équipe ops a trois agents. Regardez d'abord la tendance du coût, puis qui dépense le plus, et cherchez enfin la cause des échecs dans l'onglet Erreurs.
+La séquence ci-dessous présente un espace de travail avec trois agents (Engineer, Reviewer et Docs) : elle parcourt les tokens quotidiens et le classement, bascule vers le coût, puis examine les échecs dans l'onglet Errors.
<UsageDemo />
diff --git a/apps/docs/content/docs/analytics.ja.mdx b/apps/docs/content/docs/analytics.ja.mdx
index cb1770673f..7301a323fc 100644
--- a/apps/docs/content/docs/analytics.ja.mdx
+++ b/apps/docs/content/docs/analytics.ja.mdx
@@ -45,7 +45,7 @@ import { UsageDemo } from "@/components/demos/usage-demo";
あるエージェントやスクワッドの実行の一部がトークンを報告していないと、そのトークンとコストの前に `≥` が付き、名前の下に使用量が報告されていない実行の数が出ます。
-下のデモでは、運用チームに 3 つのエージェントがいます。まずコストの推移を見て、次に誰が一番使っているかを確認し、最後にエラータブで失敗の理由を探します。
+下のクリップでは、3 つのエージェント(Engineer・Reviewer・Docs)が稼働するワークスペースで日別トークン推移とリーダーボードを確認し、コスト表示へ切り替えた後、Errors タブで失敗原因を調べます。
<UsageDemo />
diff --git a/apps/docs/content/docs/analytics.ko.mdx b/apps/docs/content/docs/analytics.ko.mdx
index 2f5b0e823c..ebbb61ffc8 100644
--- a/apps/docs/content/docs/analytics.ko.mdx
+++ b/apps/docs/content/docs/analytics.ko.mdx
@@ -45,7 +45,7 @@ import { UsageDemo } from "@/components/demos/usage-demo";
어떤 에이전트나 스쿼드의 실행 중 일부가 토큰을 보고하지 않았으면 토큰과 비용 앞에 `≥`가 붙고, 이름 아래에 사용량을 보고하지 않은 실행 수가 표시됩니다.
-아래 데모에서는 운영팀에 에이전트가 세 개 있습니다. 먼저 비용 추이를 보고, 누가 가장 많이 쓰는지 확인한 뒤, 오류 탭에서 실패 원인을 찾아봅니다.
+아래 영상에서는 세 에이전트(Engineer·Reviewer·Docs)가 있는 워크스페이스에서 일별 토큰 추이와 리더보드를 확인하고 비용 보기로 전환한 뒤 Errors 탭에서 실패 원인을 살펴봅니다.
<UsageDemo />
diff --git a/apps/docs/content/docs/analytics.mdx b/apps/docs/content/docs/analytics.mdx
index bab113a290..f563d0e47d 100644
--- a/apps/docs/content/docs/analytics.mdx
+++ b/apps/docs/content/docs/analytics.mdx
@@ -45,7 +45,7 @@ The **Leaderboard** lists tokens, cost, run time, and runs, ranked by whichever
When some of an agent's or squad's runs did not report tokens, its Tokens and Cost carry a `≥` prefix and a line under its name says how many runs did not report usage.
-In the demo below, an operations team has three agents. Check the cost trend first, then who spends the most, and finally find the reasons for failures on the Errors tab.
+In the clip below, a workspace with three agents (Engineer, Reviewer, and Docs) reviews daily token usage, switches to cost and the leaderboard, then inspects failures on the Errors tab.
<UsageDemo />
diff --git a/apps/docs/content/docs/analytics.zh-Hant.mdx b/apps/docs/content/docs/analytics.zh-Hant.mdx
index 89dfc4c09c..da0286a7a7 100644
--- a/apps/docs/content/docs/analytics.zh-Hant.mdx
+++ b/apps/docs/content/docs/analytics.zh-Hant.mdx
@@ -45,7 +45,7 @@ import { UsageDemo } from "@/components/demos/usage-demo";
某個 AI 代理或小隊有執行沒上報 token 時,它的 Token 和費用前面會加 `≥`,名字下方註明有幾次執行未上報用量。
-下面的演示裡,運營團隊有三個 AI 代理。先看費用趨勢,再看誰花得最多,最後在錯誤頁籤裡找失敗原因。
+下面的錄影展示包含三個 AI 代理(Engineer、Reviewer、Docs)的工作區統計:先看每日 token 趨勢與排行榜,再切到費用檢視,最後在 Errors 分頁檢視失敗原因。
<UsageDemo />
diff --git a/apps/docs/content/docs/analytics.zh.mdx b/apps/docs/content/docs/analytics.zh.mdx
index 2c59408732..e6c0fb0394 100644
--- a/apps/docs/content/docs/analytics.zh.mdx
+++ b/apps/docs/content/docs/analytics.zh.mdx
@@ -45,7 +45,7 @@ import { UsageDemo } from "@/components/demos/usage-demo";
某个智能体或小队有运行没上报 token 时,它的 Token 和费用前面会加 `≥`,名字下方注明有几次运行未上报用量。
-下面的演示里,运营团队有三个智能体。先看费用趋势,再看谁花得最多,最后在错误页签里找失败原因。
+下面的录屏展示包含三个智能体(Engineer、Reviewer、Docs)的工作区统计:先看每日 token 趋势与排行榜,再切到费用视图,最后在 Errors 页签查看失败原因。
<UsageDemo />
diff --git a/apps/docs/content/docs/autopilots.fr.mdx b/apps/docs/content/docs/autopilots.fr.mdx
index b76ef171e9..843e02a946 100644
--- a/apps/docs/content/docs/autopilots.fr.mdx
+++ b/apps/docs/content/docs/autopilots.fr.mdx
@@ -28,7 +28,7 @@ Ouvrez **Auto** dans la barre de navigation, choisissez un modèle ou partez de
Une automatisation est activée par défaut après l'enregistrement. **Exécuter maintenant** lance le flux complet une fois, à tout moment, sans attendre la planification.
-Voici une automatisation dont le mode de sortie est Créer une tâche. Cliquez sur **Exécuter maintenant**, ou avancez jusqu'à la prochaine exécution planifiée, et regardez-la créer une tâche, la confier à l'agent, puis terminer l'exécution.
+La séquence ci-dessous ouvre une automatisation en mode Créer une tâche (**Weekly dead-code audit**), déclenche **Run now** et montre la tâche créée apparaître dans l'historique d'exécution.
<AutopilotDemo />
diff --git a/apps/docs/content/docs/autopilots.ja.mdx b/apps/docs/content/docs/autopilots.ja.mdx
index 2d906167ee..24e3a272b8 100644
--- a/apps/docs/content/docs/autopilots.ja.mdx
+++ b/apps/docs/content/docs/autopilots.ja.mdx
@@ -28,7 +28,7 @@ import { AutopilotDemo } from "@/components/demos/autopilot-demo";
保存すると、オートパイロットはデフォルトで有効になります。**今すぐ実行**を使えば、スケジュールを待たずにいつでも一連の処理を手動で 1 回実行できます。
-下は出力モードが「タスクを作成」のオートパイロットです。**今すぐ実行**をクリックするか、次回の実行時刻まで早送りすると、タスクの作成、エージェントへの割り当て、実行の完了までを確認できます。
+下のクリップでは、出力モードが「タスクを作成」のオートパイロット(**Weekly dead-code audit**)を開き、**Run now** で実行して実行履歴に作成されたタスクが紐づく様子を確認できます。
<AutopilotDemo />
diff --git a/apps/docs/content/docs/autopilots.ko.mdx b/apps/docs/content/docs/autopilots.ko.mdx
index b0376d2fab..497351fe24 100644
--- a/apps/docs/content/docs/autopilots.ko.mdx
+++ b/apps/docs/content/docs/autopilots.ko.mdx
@@ -28,7 +28,7 @@ import { AutopilotDemo } from "@/components/demos/autopilot-demo";
저장하면 오토파일럿이 기본적으로 활성화됩니다. **지금 실행**으로 일정을 기다리지 않고 언제든 전체 과정을 한 번 수동 실행할 수 있습니다.
-아래는 출력 모드가 "태스크 생성"인 오토파일럿입니다. **지금 실행**을 클릭하거나 다음 실행 시간으로 건너뛰어, 태스크를 만들고 에이전트에게 맡긴 뒤 이번 실행이 완료되는 과정을 확인해 보세요.
+아래 영상에서는 출력 모드가 "태스크 생성"인 오토파일럿(**Weekly dead-code audit**)을 열고 **Run now**로 즉시 실행해, 실행 기록에 새 태스크가 연결되는 과정을 보여 줍니다.
<AutopilotDemo />
diff --git a/apps/docs/content/docs/autopilots.mdx b/apps/docs/content/docs/autopilots.mdx
index 1451d0638d..a8c8feb800 100644
--- a/apps/docs/content/docs/autopilots.mdx
+++ b/apps/docs/content/docs/autopilots.mdx
@@ -28,7 +28,7 @@ Open **Auto** in the app rail, pick a template or start from scratch, then confi
An autopilot is enabled by default after saving. **Run now** executes the full flow once at any time, without waiting for the schedule.
-Below is an autopilot whose execution mode is Create issue. Click **Run now**, or skip ahead to the next scheduled time, and watch it create an issue, hand it to the agent, and complete the run.
+The clip below opens a Create-issue autopilot (**Weekly dead-code audit**), triggers **Run now**, and follows the created run and linked issue in Run history.
<AutopilotDemo />
diff --git a/apps/docs/content/docs/autopilots.zh-Hant.mdx b/apps/docs/content/docs/autopilots.zh-Hant.mdx
index 6aad937741..fcc3eda641 100644
--- a/apps/docs/content/docs/autopilots.zh-Hant.mdx
+++ b/apps/docs/content/docs/autopilots.zh-Hant.mdx
@@ -28,7 +28,7 @@ import { AutopilotDemo } from "@/components/demos/autopilot-demo";
儲存後自動化預設啟用。**立即執行**隨時手動執行一次完整流程,不用等時間表。
-下面是一條輸出模式為"建立任務"的自動化。點**立即執行**,或者快進到下次執行時間,看它建立任務、交給 AI 代理,再到這次執行完成。
+下面的錄影開啟一條輸出模式為「建立任務」的自動化(**Weekly dead-code audit**),點 **Run now** 立即觸發,並展示執行紀錄中自動建立並關聯的新任務。
<AutopilotDemo />
diff --git a/apps/docs/content/docs/autopilots.zh.mdx b/apps/docs/content/docs/autopilots.zh.mdx
index 1d9579da9e..46c8bd61b9 100644
--- a/apps/docs/content/docs/autopilots.zh.mdx
+++ b/apps/docs/content/docs/autopilots.zh.mdx
@@ -28,7 +28,7 @@ import { AutopilotDemo } from "@/components/demos/autopilot-demo";
保存后自动化默认启用。**立即运行**随时手动执行一次完整流程,不用等时间表。
-下面是一条输出模式为"创建任务"的自动化。点**立即运行**,或者快进到下次运行时间,看它创建任务、交给智能体,再到这次运行完成。
+下面的录屏打开一条输出模式为「创建任务」的自动化(**Weekly dead-code audit**),点击 **Run now** 立即触发,并展示运行记录中自动创建并关联的新任务。
<AutopilotDemo />
diff --git a/apps/docs/content/docs/issue-wakeups.fr.mdx b/apps/docs/content/docs/issue-wakeups.fr.mdx
index ecb858cb3e..ae728d8d1b 100644
--- a/apps/docs/content/docs/issue-wakeups.fr.mdx
+++ b/apps/docs/content/docs/issue-wakeups.fr.mdx
@@ -42,7 +42,7 @@ Cliquez sur **Créer**.
Les exécutions lancées par un réveil agissent au nom de la personne qui l'a créé, et Multica vérifie de nouveau, avant que l'exécution ne démarre, que cette personne peut toujours exécuter l'agent.
-Dans la tâche ci-dessous, Assistant ops a demandé des devis et attend les réponses des fournisseurs. Ajoutez un réveil, puis avancez jusqu'à l'heure prévue. Avec « Vérifier régulièrement », vous verrez aussi comment l'agent termine une vérification sans commenter quand rien n'est encore arrivé.
+La séquence ci-dessous ajoute un réveil dans une heure pour Engineer depuis la barre latérale de la tâche, renseigne l'instruction à exécuter puis enregistre la règle.
<WakeupDemo />
diff --git a/apps/docs/content/docs/issue-wakeups.ja.mdx b/apps/docs/content/docs/issue-wakeups.ja.mdx
index 89a86d0e3a..95412157ca 100644
--- a/apps/docs/content/docs/issue-wakeups.ja.mdx
+++ b/apps/docs/content/docs/issue-wakeups.ja.mdx
@@ -42,7 +42,7 @@ import { WakeupDemo } from "@/components/demos/wakeup-demo";
ウェイクアップが始める実行は作成者の代理として動きます。実行が始まる前に、作成者がまだそのエージェントを実行できるかどうかを Multica が確認し直します。
-次のタスクでは、運用アシスタントが見積もりを依頼し、仕入れ先の返信を待っています。ウェイクアップを追加して、起動時刻まで早送りしてみてください。「定期チェック」を選ぶと、まだ何も届いていない日にエージェントがコメントせずに確認を終える様子も見られます。
+下のクリップでは、タスクのサイドバーから Engineer 向けに 1 時間後のウェイクアップを追加し、起動時の指示を入力して保存する手順を示しています。
<WakeupDemo />
diff --git a/apps/docs/content/docs/issue-wakeups.ko.mdx b/apps/docs/content/docs/issue-wakeups.ko.mdx
index 0ab78a7ec2..973a2e9813 100644
--- a/apps/docs/content/docs/issue-wakeups.ko.mdx
+++ b/apps/docs/content/docs/issue-wakeups.ko.mdx
@@ -42,7 +42,7 @@ import { WakeupDemo } from "@/components/demos/wakeup-demo";
깨우기가 시작한 실행은 규칙을 만든 사람을 대신해 동작합니다. 실행이 시작되기 전에 Multica는 그 사람이 아직 이 에이전트를 실행할 수 있는지 다시 확인합니다.
-아래 태스크에서 운영 도우미는 견적을 요청해 두고 공급업체의 회신을 기다리고 있습니다. 깨우기를 추가한 뒤 깨우는 시각으로 건너뛰어 보세요. '정기 확인'을 고르면 아직 아무것도 오지 않은 날 에이전트가 댓글 없이 확인을 끝내는 모습도 볼 수 있습니다.
+아래 영상에서는 태스크 사이드바에서 Engineer에게 1시간 뒤 깨우기를 추가하고, 실행할 지시 사항을 입력해 저장하는 과정을 보여 줍니다.
<WakeupDemo />
diff --git a/apps/docs/content/docs/issue-wakeups.mdx b/apps/docs/content/docs/issue-wakeups.mdx
index 5710bd076b..c5660a955f 100644
--- a/apps/docs/content/docs/issue-wakeups.mdx
+++ b/apps/docs/content/docs/issue-wakeups.mdx
@@ -42,7 +42,7 @@ Click **Create**.
Runs a wakeup starts act on behalf of the person who created it, and Multica checks again before the run starts that this person may still run the agent.
-In the issue below, Ops helper has asked suppliers for quotes and is waiting for their replies. Add a wakeup, then skip ahead to the wakeup time. Choose "Check regularly" to also see how the agent ends a check without commenting when nothing has arrived yet.
+The clip below adds a one-hour wakeup for Engineer from the issue sidebar, specifying what to check when the wakeup fires and saving the scheduled rule onto the issue.
<WakeupDemo />
diff --git a/apps/docs/content/docs/issue-wakeups.zh-Hant.mdx b/apps/docs/content/docs/issue-wakeups.zh-Hant.mdx
index cc4b33301b..452b884a65 100644
--- a/apps/docs/content/docs/issue-wakeups.zh-Hant.mdx
+++ b/apps/docs/content/docs/issue-wakeups.zh-Hant.mdx
@@ -42,7 +42,7 @@ import { WakeupDemo } from "@/components/demos/wakeup-demo";
喚醒開始的執行代表建立者執行,開始前會再確認建立者仍有權限執行這個 AI 代理。
-下面這條任務裡,運營助手已經發出詢價,正在等供應商回覆。給它加一條喚醒,再快進到喚醒時間。選"定期檢查"還能看到第一天沒有訊息時,AI 代理怎樣不發評論就結束。
+下面的錄影展示如何從任務側欄為 Engineer 新增一條 1 小時後的定時喚醒:選擇觸發條件與喚醒對象、填寫喚醒說明並儲存到任務中。
<WakeupDemo />
diff --git a/apps/docs/content/docs/issue-wakeups.zh.mdx b/apps/docs/content/docs/issue-wakeups.zh.mdx
index d22b3734af..df06f3ff2b 100644
--- a/apps/docs/content/docs/issue-wakeups.zh.mdx
+++ b/apps/docs/content/docs/issue-wakeups.zh.mdx
@@ -42,7 +42,7 @@ import { WakeupDemo } from "@/components/demos/wakeup-demo";
唤醒开始的运行代表创建者执行,开始前会再确认创建者仍有权限运行这个智能体。
-下面这条任务里,运营助手已经发出询价,正在等供应商回复。给它加一条唤醒,再快进到唤醒时间。选"定期检查"还能看到第一天没有消息时,智能体怎样不发评论就结束。
+下面的录屏展示如何从任务侧栏为 Engineer 添加一条 1 小时后的定时唤醒:选择触发条件和唤醒对象、填写唤醒说明并保存到任务中。
<WakeupDemo />
diff --git a/apps/docs/content/docs/squads.fr.mdx b/apps/docs/content/docs/squads.fr.mdx
index d75da49e1c..ec2402976e 100644
--- a/apps/docs/content/docs/squads.fr.mdx
+++ b/apps/docs/content/docs/squads.fr.mdx
@@ -40,7 +40,7 @@ Lorsqu'une tâche qui n'est pas dans À planifier est assignée à un squad, Mul
Si la tâche est dans **À planifier**, le chef n'est pas déclenché : À planifier est une zone d'attente, selon la même règle que pour une assignation directe à un agent.
-La démo ci-dessous confie une tâche de préparation d'événement au Squad événements. Son chef est Assistant ops ; les membres sont Assistant rédaction et vous.
+La séquence ci-dessous ouvre **Platform Team** (chef : Engineer ; membres : Reviewer et Docs) puis assigne une tâche au squad afin que le chef coordonne le travail.
<SquadDemo />
diff --git a/apps/docs/content/docs/squads.ja.mdx b/apps/docs/content/docs/squads.ja.mdx
index bbc851e87e..be550743f2 100644
--- a/apps/docs/content/docs/squads.ja.mdx
+++ b/apps/docs/content/docs/squads.ja.mdx
@@ -40,7 +40,7 @@ import { SquadDemo } from "@/components/demos/squad-demo";
タスクがまだ `backlog` にある間は、割り当てだけではリーダーはトリガーされません。`backlog` を出た時点で実行が始まります。
-下のデモでは、イベント準備のタスクを「イベントスクワッド」に任せます。リーダーは運用アシスタント、メンバーはライティングアシスタントとあなたです。
+下のクリップでは **Platform Team**(リーダー: Engineer、メンバー: Reviewer・Docs)を開き、タスクをスクワッドに割り当ててリーダーが進行をまとめる流れを確認できます。
<SquadDemo />
diff --git a/apps/docs/content/docs/squads.ko.mdx b/apps/docs/content/docs/squads.ko.mdx
index cd0a2bb19b..8a182ca2cc 100644
--- a/apps/docs/content/docs/squads.ko.mdx
+++ b/apps/docs/content/docs/squads.ko.mdx
@@ -40,7 +40,7 @@ import { SquadDemo } from "@/components/demos/squad-demo";
태스크가 여전히 `backlog`이면 할당만으로 리더가 트리거되지 않습니다. `backlog`에서 벗어난 뒤에 실행이 시작됩니다.
-아래 데모는 행사 준비 태스크를 "행사 스쿼드"에 맡깁니다. 리더는 운영 도우미이고, 멤버는 글쓰기 도우미와 나입니다.
+아래 영상에서는 **Platform Team**(리더: Engineer, 멤버: Reviewer·Docs)을 열고 태스크를 스쿼드에 할당해 리더가 협업을 조율하는 과정을 보여 줍니다.
<SquadDemo />
diff --git a/apps/docs/content/docs/squads.mdx b/apps/docs/content/docs/squads.mdx
index bc25b425e9..71b855f490 100644
--- a/apps/docs/content/docs/squads.mdx
+++ b/apps/docs/content/docs/squads.mdx
@@ -40,7 +40,7 @@ When a non-Backlog issue is assigned to a squad, Multica immediately enqueues a
If the issue is in **Backlog**, the leader is not triggered: Backlog is a parking lot, same rule as for direct agent assignment.
-The demo below hands an event-prep issue to the Events squad. Ops helper is the leader; the members are Writing helper and you.
+The clip below opens **Platform Team** (leader: Engineer; members: Reviewer and Docs) and assigns an issue to the squad so the leader plans and coordinates the handoff.
<SquadDemo />
diff --git a/apps/docs/content/docs/squads.zh-Hant.mdx b/apps/docs/content/docs/squads.zh-Hant.mdx
index 6b4e6e1144..6c50920ae7 100644
--- a/apps/docs/content/docs/squads.zh-Hant.mdx
+++ b/apps/docs/content/docs/squads.zh-Hant.mdx
@@ -40,7 +40,7 @@ import { SquadDemo } from "@/components/demos/squad-demo";
如果任務仍在 `backlog`,分配本身不會觸發隊長。移出 `backlog` 後才會開始執行。
-下面的演示把一條籌備活動的任務交給"活動小隊":隊長是運營助手,成員是文案助手和你。
+下面的錄影展示 **Platform Team** 小隊(隊長為 Engineer,成員為 Reviewer 與 Docs),並將一條任務指派給該小隊,由隊長接手推進協作。
<SquadDemo />
diff --git a/apps/docs/content/docs/squads.zh.mdx b/apps/docs/content/docs/squads.zh.mdx
index a22ba435ab..c969f6284a 100644
--- a/apps/docs/content/docs/squads.zh.mdx
+++ b/apps/docs/content/docs/squads.zh.mdx
@@ -40,7 +40,7 @@ import { SquadDemo } from "@/components/demos/squad-demo";
如果任务仍在 `backlog`,分配本身不会触发队长。移出 `backlog` 后才会开始执行。
-下面的演示把一条筹备活动的任务交给"活动小队":队长是运营助手,成员是文案助手和你。
+下面的录屏展示 **Platform Team** 小队(队长为 Engineer,成员为 Reviewer 和 Docs),并将一条任务分配给该小队,由队长接手推进协作。
<SquadDemo />
diff --git a/apps/docs/content/docs/tasks.fr.mdx b/apps/docs/content/docs/tasks.fr.mdx
index 0e7f037e0a..1ae69347c4 100644
--- a/apps/docs/content/docs/tasks.fr.mdx
+++ b/apps/docs/content/docs/tasks.fr.mdx
@@ -70,7 +70,7 @@ Dans le journal d'exécution, vous pouvez :
- Arrêter les exécutions en file d'attente, en démarrage, en attente d'un répertoire local ou au travail.
- Relancer une exécution en échec ou annulée.
-La démo ci-dessous parcourt un cycle complet : une exécution entre en file, démarre et échoue ; vous la relancez et la nouvelle exécution se termine. Une fois la nouvelle exécution lancée, vous pouvez aussi essayer de l'arrêter en cours de route.
+Le schéma ci-dessous présente chaque transition du cycle de vie d'une exécution, y compris la relance après échec et l'annulation en file ou en cours. Cliquez sur un état pour inspecter ses transitions.
<RunLifecycleDemo />
diff --git a/apps/docs/content/docs/tasks.ja.mdx b/apps/docs/content/docs/tasks.ja.mdx
index 272bf51730..eb7013d622 100644
--- a/apps/docs/content/docs/tasks.ja.mdx
+++ b/apps/docs/content/docs/tasks.ja.mdx
@@ -70,7 +70,7 @@ import { RunLifecycleDemo } from "@/components/demos/run-lifecycle-demo";
- 待機中・開始中・ローカルディレクトリ待ち・作業中の実行を停止する。
- 失敗またはキャンセルされた実行をリトライする。
-下のデモでは、実行がキューに入り、始まり、失敗し、リトライした新しい実行が完了するまでを一通りたどります。新しい実行が始まったら、途中で停止することもできます。
+下の状態遷移図は、失敗後のリトライ経路やキュー待ち・実行中のキャンセル分岐を含め、実行ライフサイクルのすべての遷移を示しています。各状態をクリックすると詳細を確認できます。
<RunLifecycleDemo />
diff --git a/apps/docs/content/docs/tasks.ko.mdx b/apps/docs/content/docs/tasks.ko.mdx
index 5cae534093..e86e8a774c 100644
--- a/apps/docs/content/docs/tasks.ko.mdx
+++ b/apps/docs/content/docs/tasks.ko.mdx
@@ -70,7 +70,7 @@ import { RunLifecycleDemo } from "@/components/demos/run-lifecycle-demo";
- 대기 중, 시작 중, 로컬 디렉터리 대기 중, 작업 중인 실행 중지
- 실패하거나 취소된 실행 재시도
-아래 데모는 실행이 큐에 들어가고, 시작하고, 실패한 뒤 다시 시도한 새 실행이 완료되는 전체 과정을 보여 줍니다. 새 실행이 시작되면 중간에 중지해 볼 수도 있습니다.
+아래 상태 다이어그램은 실패 후 재시도 경로와 대기·실행 중 취소 분기를 포함해 실행 수명 주기의 모든 상태 전이를 보여 줍니다. 각 상태를 클릭하면 상세 설명을 확인할 수 있습니다.
<RunLifecycleDemo />
diff --git a/apps/docs/content/docs/tasks.mdx b/apps/docs/content/docs/tasks.mdx
index 93e8ec2568..37eb90cddf 100644
--- a/apps/docs/content/docs/tasks.mdx
+++ b/apps/docs/content/docs/tasks.mdx
@@ -70,7 +70,7 @@ In the execution log you can:
- Stop runs that are queued, starting, waiting for a local directory, or working.
- Retry a failed or cancelled run.
-The demo below walks through a full cycle: a run queues, starts, and fails; you retry it and the new run completes. Once the new run starts, you can also try stopping it midway.
+The diagram below maps every state transition in a run's lifecycle, including the retry path after failure and cancellation while queued or running. Select any state to inspect its transitions.
<RunLifecycleDemo />
diff --git a/apps/docs/content/docs/tasks.zh-Hant.mdx b/apps/docs/content/docs/tasks.zh-Hant.mdx
index 8fcca7e8c4..33b07135cf 100644
--- a/apps/docs/content/docs/tasks.zh-Hant.mdx
+++ b/apps/docs/content/docs/tasks.zh-Hant.mdx
@@ -70,7 +70,7 @@ AI 代理工作期間,任務頂部還有一個實時狀態條,例如 "Engine
- 停止排隊中、啟動中、等待本地目錄或正在工作的執行。
- 對失敗或已取消的執行發起重試。
-下面的演示走一遍完整過程:執行排隊、開始、失敗,你重試後新的執行完成。新的執行開始後,也可以試試中途停止。
+下面的狀態機圖展示了執行生命週期的每一條流轉路徑,包括失敗後的重試迴圈以及排隊或執行中的取消分支。點選任意狀態可查看對應的觸發條件與說明。
<RunLifecycleDemo />
diff --git a/apps/docs/content/docs/tasks.zh.mdx b/apps/docs/content/docs/tasks.zh.mdx
index 6e3a0f3a76..3cca3a82f7 100644
--- a/apps/docs/content/docs/tasks.zh.mdx
+++ b/apps/docs/content/docs/tasks.zh.mdx
@@ -70,7 +70,7 @@ import { RunLifecycleDemo } from "@/components/demos/run-lifecycle-demo";
- 停止排队中、启动中、等待本地目录或正在工作的运行。
- 对失败或已取消的运行发起重试。
-下面的演示走一遍完整过程:运行排队、开始、失败,你重试后新的运行完成。新的运行开始后,也可以试试中途停止。
+下面的状态机图展示了运行生命周期的每一条流转路径,包括失败后的重试回环以及排队或执行中的取消分支。点击任意状态可查看对应的触发条件与说明。
<RunLifecycleDemo />
diff --git a/apps/docs/lib/translations.ts b/apps/docs/lib/translations.ts
index 4d663d7745..7f5a708c5c 100644
--- a/apps/docs/lib/translations.ts
+++ b/apps/docs/lib/translations.ts
@@ -127,13 +127,13 @@ export const homeCopy = {
},
} as const satisfies Record<Lang, unknown>;
-// Chrome around the interactive demos embedded in docs pages. Each demo keeps
+// Chrome around the editorial demos embedded in docs pages. Each demo keeps
// its own scenario copy next to its component.
export const demoChromeCopy = {
- en: { label: "Try it", replay: "Replay", click: "Click" },
- zh: { label: "动手试试", replay: "重新演示", click: "点击" },
- "zh-Hant": { label: "動手試試", replay: "重新播放", click: "點擊" },
- ko: { label: "직접 해보기", replay: "다시 보기", click: "클릭" },
- ja: { label: "試してみる", replay: "もう一度", click: "クリック" },
- fr: { label: "Essayez", replay: "Rejouer", click: "Cliquez" },
+ en: { play: "Play", pause: "Pause", replay: "Replay", reset: "Reset" },
+ zh: { play: "播放", pause: "暂停", replay: "重播", reset: "重置" },
+ "zh-Hant": { play: "播放", pause: "暫停", replay: "重播", reset: "重設" },
+ ko: { play: "재생", pause: "일시정지", replay: "다시 보기", reset: "초기화" },
+ ja: { play: "再生", pause: "一時停止", replay: "もう一度", reset: "リセット" },
+ fr: { play: "Lire", pause: "Pause", replay: "Rejouer", reset: "Réinitialiser" },
} as const satisfies Record<Lang, unknown>;
diff --git a/apps/docs/proxy.test.ts b/apps/docs/proxy.test.ts
index ee7ccac76e..0fad28c4b1 100644
--- a/apps/docs/proxy.test.ts
+++ b/apps/docs/proxy.test.ts
@@ -8,8 +8,13 @@ import nextConfig from "./next.config.mjs";
import { config, markdownRewritePath, proxy } from "./proxy";
describe("docs locale proxy matcher", () => {
- it.each(["/docs/icon.svg", "/docs/icon.svg?icon.1234.svg"])(
- "serves the favicon without a locale rewrite at %s",
+ it.each([
+ "/docs/icon.svg",
+ "/docs/icon.svg?icon.1234.svg",
+ "/docs/videos/demos/assign-light.mp4",
+ "/docs/videos/demos/assign-light.jpg",
+ ])(
+ "serves static assets without a locale rewrite at %s",
(url) => {
expect(unstable_doesMiddlewareMatch({ config, nextConfig, url })).toBe(false);
},
diff --git a/apps/docs/proxy.ts b/apps/docs/proxy.ts
index 4bafac4ec2..f8dbdfd45a 100644
--- a/apps/docs/proxy.ts
+++ b/apps/docs/proxy.ts
@@ -98,7 +98,7 @@ export const config = {
// such as `icon.svg` are not under `[lang]/` and must bypass locale routing
// so browsers and crawlers can fetch the original resources.
matcher: [
- "/((?!api|_next/static|_next/image|images|favicon.ico|icon\\.svg$|sitemap.xml|robots.txt).*)",
+ "/((?!api|_next/static|_next/image|images|videos|favicon.ico|icon\\.svg$|sitemap.xml|robots.txt).*)",
"/",
],
};
diff --git a/apps/docs/public/videos/demos/assign-dark.jpg b/apps/docs/public/videos/demos/assign-dark.jpg
new file mode 100644
index 0000000000..ddaab6ffe5
Binary files /dev/null and b/apps/docs/public/videos/demos/assign-dark.jpg differ
diff --git a/apps/docs/public/videos/demos/assign-dark.mp4 b/apps/docs/public/videos/demos/assign-dark.mp4
new file mode 100644
index 0000000000..13de8c1e1b
Binary files /dev/null and b/apps/docs/public/videos/demos/assign-dark.mp4 differ
diff --git a/apps/docs/public/videos/demos/assign-light.jpg b/apps/docs/public/videos/demos/assign-light.jpg
new file mode 100644
index 0000000000..9bee9bf642
Binary files /dev/null and b/apps/docs/public/videos/demos/assign-light.jpg differ
diff --git a/apps/docs/public/videos/demos/assign-light.mp4 b/apps/docs/public/videos/demos/assign-light.mp4
new file mode 100644
index 0000000000..c995685f28
Binary files /dev/null and b/apps/docs/public/videos/demos/assign-light.mp4 differ
diff --git a/apps/docs/public/videos/demos/autopilot-dark.jpg b/apps/docs/public/videos/demos/autopilot-dark.jpg
new file mode 100644
index 0000000000..b5efbc9d4b
Binary files /dev/null and b/apps/docs/public/videos/demos/autopilot-dark.jpg differ
diff --git a/apps/docs/public/videos/demos/autopilot-dark.mp4 b/apps/docs/public/videos/demos/autopilot-dark.mp4
new file mode 100644
index 0000000000..e01c823fe3
Binary files /dev/null and b/apps/docs/public/videos/demos/autopilot-dark.mp4 differ
diff --git a/apps/docs/public/videos/demos/autopilot-light.jpg b/apps/docs/public/videos/demos/autopilot-light.jpg
new file mode 100644
index 0000000000..40a758a93c
Binary files /dev/null and b/apps/docs/public/videos/demos/autopilot-light.jpg differ
diff --git a/apps/docs/public/videos/demos/autopilot-light.mp4 b/apps/docs/public/videos/demos/autopilot-light.mp4
new file mode 100644
index 0000000000..a25ffa891b
Binary files /dev/null and b/apps/docs/public/videos/demos/autopilot-light.mp4 differ
diff --git a/apps/docs/public/videos/demos/chat-dark.jpg b/apps/docs/public/videos/demos/chat-dark.jpg
new file mode 100644
index 0000000000..ed21e4d6a3
Binary files /dev/null and b/apps/docs/public/videos/demos/chat-dark.jpg differ
diff --git a/apps/docs/public/videos/demos/chat-dark.mp4 b/apps/docs/public/videos/demos/chat-dark.mp4
new file mode 100644
index 0000000000..958a931af9
Binary files /dev/null and b/apps/docs/public/videos/demos/chat-dark.mp4 differ
diff --git a/apps/docs/public/videos/demos/chat-light.jpg b/apps/docs/public/videos/demos/chat-light.jpg
new file mode 100644
index 0000000000..b188227980
Binary files /dev/null and b/apps/docs/public/videos/demos/chat-light.jpg differ
diff --git a/apps/docs/public/videos/demos/chat-light.mp4 b/apps/docs/public/videos/demos/chat-light.mp4
new file mode 100644
index 0000000000..9d153d3dab
Binary files /dev/null and b/apps/docs/public/videos/demos/chat-light.mp4 differ
diff --git a/apps/docs/public/videos/demos/create-agent-dark.jpg b/apps/docs/public/videos/demos/create-agent-dark.jpg
new file mode 100644
index 0000000000..40ae8a9bfb
Binary files /dev/null and b/apps/docs/public/videos/demos/create-agent-dark.jpg differ
diff --git a/apps/docs/public/videos/demos/create-agent-dark.mp4 b/apps/docs/public/videos/demos/create-agent-dark.mp4
new file mode 100644
index 0000000000..77b4b02837
Binary files /dev/null and b/apps/docs/public/videos/demos/create-agent-dark.mp4 differ
diff --git a/apps/docs/public/videos/demos/create-agent-light.jpg b/apps/docs/public/videos/demos/create-agent-light.jpg
new file mode 100644
index 0000000000..8ab848d678
Binary files /dev/null and b/apps/docs/public/videos/demos/create-agent-light.jpg differ
diff --git a/apps/docs/public/videos/demos/create-agent-light.mp4 b/apps/docs/public/videos/demos/create-agent-light.mp4
new file mode 100644
index 0000000000..e017e9128e
Binary files /dev/null and b/apps/docs/public/videos/demos/create-agent-light.mp4 differ
diff --git a/apps/docs/public/videos/demos/deliverables-dark.jpg b/apps/docs/public/videos/demos/deliverables-dark.jpg
new file mode 100644
index 0000000000..2efa93f1fc
Binary files /dev/null and b/apps/docs/public/videos/demos/deliverables-dark.jpg differ
diff --git a/apps/docs/public/videos/demos/deliverables-dark.mp4 b/apps/docs/public/videos/demos/deliverables-dark.mp4
new file mode 100644
index 0000000000..92c1d51533
Binary files /dev/null and b/apps/docs/public/videos/demos/deliverables-dark.mp4 differ
diff --git a/apps/docs/public/videos/demos/deliverables-light.jpg b/apps/docs/public/videos/demos/deliverables-light.jpg
new file mode 100644
index 0000000000..247a245b65
Binary files /dev/null and b/apps/docs/public/videos/demos/deliverables-light.jpg differ
diff --git a/apps/docs/public/videos/demos/deliverables-light.mp4 b/apps/docs/public/videos/demos/deliverables-light.mp4
new file mode 100644
index 0000000000..3bcd5a5144
Binary files /dev/null and b/apps/docs/public/videos/demos/deliverables-light.mp4 differ
diff --git a/apps/docs/public/videos/demos/inbox-dark.jpg b/apps/docs/public/videos/demos/inbox-dark.jpg
new file mode 100644
index 0000000000..4bad967f19
Binary files /dev/null and b/apps/docs/public/videos/demos/inbox-dark.jpg differ
diff --git a/apps/docs/public/videos/demos/inbox-dark.mp4 b/apps/docs/public/videos/demos/inbox-dark.mp4
new file mode 100644
index 0000000000..8da0f9b31c
Binary files /dev/null and b/apps/docs/public/videos/demos/inbox-dark.mp4 differ
diff --git a/apps/docs/public/videos/demos/inbox-light.jpg b/apps/docs/public/videos/demos/inbox-light.jpg
new file mode 100644
index 0000000000..c1ca14afe5
Binary files /dev/null and b/apps/docs/public/videos/demos/inbox-light.jpg differ
diff --git a/apps/docs/public/videos/demos/inbox-light.mp4 b/apps/docs/public/videos/demos/inbox-light.mp4
new file mode 100644
index 0000000000..b03e5de4a3
Binary files /dev/null and b/apps/docs/public/videos/demos/inbox-light.mp4 differ
diff --git a/apps/docs/public/videos/demos/issue-draft-dark.jpg b/apps/docs/public/videos/demos/issue-draft-dark.jpg
new file mode 100644
index 0000000000..d97243d97f
Binary files /dev/null and b/apps/docs/public/videos/demos/issue-draft-dark.jpg differ
diff --git a/apps/docs/public/videos/demos/issue-draft-dark.mp4 b/apps/docs/public/videos/demos/issue-draft-dark.mp4
new file mode 100644
index 0000000000..c9bae0ecae
Binary files /dev/null and b/apps/docs/public/videos/demos/issue-draft-dark.mp4 differ
diff --git a/apps/docs/public/videos/demos/issue-draft-light.jpg b/apps/docs/public/videos/demos/issue-draft-light.jpg
new file mode 100644
index 0000000000..a85d48aae5
Binary files /dev/null and b/apps/docs/public/videos/demos/issue-draft-light.jpg differ
diff --git a/apps/docs/public/videos/demos/issue-draft-light.mp4 b/apps/docs/public/videos/demos/issue-draft-light.mp4
new file mode 100644
index 0000000000..e58c1c79bc
Binary files /dev/null and b/apps/docs/public/videos/demos/issue-draft-light.mp4 differ
diff --git a/apps/docs/public/videos/demos/issue-status-dark.jpg b/apps/docs/public/videos/demos/issue-status-dark.jpg
new file mode 100644
index 0000000000..93b2a47ea6
Binary files /dev/null and b/apps/docs/public/videos/demos/issue-status-dark.jpg differ
diff --git a/apps/docs/public/videos/demos/issue-status-dark.mp4 b/apps/docs/public/videos/demos/issue-status-dark.mp4
new file mode 100644
index 0000000000..d07ad4a0cc
Binary files /dev/null and b/apps/docs/public/videos/demos/issue-status-dark.mp4 differ
diff --git a/apps/docs/public/videos/demos/issue-status-light.jpg b/apps/docs/public/videos/demos/issue-status-light.jpg
new file mode 100644
index 0000000000..d9f35ca49a
Binary files /dev/null and b/apps/docs/public/videos/demos/issue-status-light.jpg differ
diff --git a/apps/docs/public/videos/demos/issue-status-light.mp4 b/apps/docs/public/videos/demos/issue-status-light.mp4
new file mode 100644
index 0000000000..cdbd308ae3
Binary files /dev/null and b/apps/docs/public/videos/demos/issue-status-light.mp4 differ
diff --git a/apps/docs/public/videos/demos/mention-dark.jpg b/apps/docs/public/videos/demos/mention-dark.jpg
new file mode 100644
index 0000000000..97d7f7c412
Binary files /dev/null and b/apps/docs/public/videos/demos/mention-dark.jpg differ
diff --git a/apps/docs/public/videos/demos/mention-dark.mp4 b/apps/docs/public/videos/demos/mention-dark.mp4
new file mode 100644
index 0000000000..b25d1b22eb
Binary files /dev/null and b/apps/docs/public/videos/demos/mention-dark.mp4 differ
diff --git a/apps/docs/public/videos/demos/mention-light.jpg b/apps/docs/public/videos/demos/mention-light.jpg
new file mode 100644
index 0000000000..abab5e3d86
Binary files /dev/null and b/apps/docs/public/videos/demos/mention-light.jpg differ
diff --git a/apps/docs/public/videos/demos/mention-light.mp4 b/apps/docs/public/videos/demos/mention-light.mp4
new file mode 100644
index 0000000000..0bce24e691
Binary files /dev/null and b/apps/docs/public/videos/demos/mention-light.mp4 differ
diff --git a/apps/docs/public/videos/demos/pr-link-dark.jpg b/apps/docs/public/videos/demos/pr-link-dark.jpg
new file mode 100644
index 0000000000..876d6da64e
Binary files /dev/null and b/apps/docs/public/videos/demos/pr-link-dark.jpg differ
diff --git a/apps/docs/public/videos/demos/pr-link-dark.mp4 b/apps/docs/public/videos/demos/pr-link-dark.mp4
new file mode 100644
index 0000000000..de33a73c33
Binary files /dev/null and b/apps/docs/public/videos/demos/pr-link-dark.mp4 differ
diff --git a/apps/docs/public/videos/demos/pr-link-light.jpg b/apps/docs/public/videos/demos/pr-link-light.jpg
new file mode 100644
index 0000000000..e26950aa1d
Binary files /dev/null and b/apps/docs/public/videos/demos/pr-link-light.jpg differ
diff --git a/apps/docs/public/videos/demos/pr-link-light.mp4 b/apps/docs/public/videos/demos/pr-link-light.mp4
new file mode 100644
index 0000000000..dad2b1ad15
Binary files /dev/null and b/apps/docs/public/videos/demos/pr-link-light.mp4 differ
diff --git a/apps/docs/public/videos/demos/project-dark.jpg b/apps/docs/public/videos/demos/project-dark.jpg
new file mode 100644
index 0000000000..17987646d2
Binary files /dev/null and b/apps/docs/public/videos/demos/project-dark.jpg differ
diff --git a/apps/docs/public/videos/demos/project-dark.mp4 b/apps/docs/public/videos/demos/project-dark.mp4
new file mode 100644
index 0000000000..5d1936a7aa
Binary files /dev/null and b/apps/docs/public/videos/demos/project-dark.mp4 differ
diff --git a/apps/docs/public/videos/demos/project-light.jpg b/apps/docs/public/videos/demos/project-light.jpg
new file mode 100644
index 0000000000..813b8710b3
Binary files /dev/null and b/apps/docs/public/videos/demos/project-light.jpg differ
diff --git a/apps/docs/public/videos/demos/project-light.mp4 b/apps/docs/public/videos/demos/project-light.mp4
new file mode 100644
index 0000000000..d2845e4958
Binary files /dev/null and b/apps/docs/public/videos/demos/project-light.mp4 differ
diff --git a/apps/docs/public/videos/demos/quick-action-dark.jpg b/apps/docs/public/videos/demos/quick-action-dark.jpg
new file mode 100644
index 0000000000..ce8e3b3685
Binary files /dev/null and b/apps/docs/public/videos/demos/quick-action-dark.jpg differ
diff --git a/apps/docs/public/videos/demos/quick-action-dark.mp4 b/apps/docs/public/videos/demos/quick-action-dark.mp4
new file mode 100644
index 0000000000..b2b006444f
Binary files /dev/null and b/apps/docs/public/videos/demos/quick-action-dark.mp4 differ
diff --git a/apps/docs/public/videos/demos/quick-action-light.jpg b/apps/docs/public/videos/demos/quick-action-light.jpg
new file mode 100644
index 0000000000..3affb82845
Binary files /dev/null and b/apps/docs/public/videos/demos/quick-action-light.jpg differ
diff --git a/apps/docs/public/videos/demos/quick-action-light.mp4 b/apps/docs/public/videos/demos/quick-action-light.mp4
new file mode 100644
index 0000000000..a7a55341ff
Binary files /dev/null and b/apps/docs/public/videos/demos/quick-action-light.mp4 differ
diff --git a/apps/docs/public/videos/demos/resolve-thread-dark.jpg b/apps/docs/public/videos/demos/resolve-thread-dark.jpg
new file mode 100644
index 0000000000..bcd9230843
Binary files /dev/null and b/apps/docs/public/videos/demos/resolve-thread-dark.jpg differ
diff --git a/apps/docs/public/videos/demos/resolve-thread-dark.mp4 b/apps/docs/public/videos/demos/resolve-thread-dark.mp4
new file mode 100644
index 0000000000..d4986173e8
Binary files /dev/null and b/apps/docs/public/videos/demos/resolve-thread-dark.mp4 differ
diff --git a/apps/docs/public/videos/demos/resolve-thread-light.jpg b/apps/docs/public/videos/demos/resolve-thread-light.jpg
new file mode 100644
index 0000000000..23775e5742
Binary files /dev/null and b/apps/docs/public/videos/demos/resolve-thread-light.jpg differ
diff --git a/apps/docs/public/videos/demos/resolve-thread-light.mp4 b/apps/docs/public/videos/demos/resolve-thread-light.mp4
new file mode 100644
index 0000000000..357c3ad943
Binary files /dev/null and b/apps/docs/public/videos/demos/resolve-thread-light.mp4 differ
diff --git a/apps/docs/public/videos/demos/skill-dark.jpg b/apps/docs/public/videos/demos/skill-dark.jpg
new file mode 100644
index 0000000000..3b1ababd85
Binary files /dev/null and b/apps/docs/public/videos/demos/skill-dark.jpg differ
diff --git a/apps/docs/public/videos/demos/skill-dark.mp4 b/apps/docs/public/videos/demos/skill-dark.mp4
new file mode 100644
index 0000000000..815a1ea778
Binary files /dev/null and b/apps/docs/public/videos/demos/skill-dark.mp4 differ
diff --git a/apps/docs/public/videos/demos/skill-light.jpg b/apps/docs/public/videos/demos/skill-light.jpg
new file mode 100644
index 0000000000..4e107ee77c
Binary files /dev/null and b/apps/docs/public/videos/demos/skill-light.jpg differ
diff --git a/apps/docs/public/videos/demos/skill-light.mp4 b/apps/docs/public/videos/demos/skill-light.mp4
new file mode 100644
index 0000000000..fb7c55306a
Binary files /dev/null and b/apps/docs/public/videos/demos/skill-light.mp4 differ
diff --git a/apps/docs/public/videos/demos/squad-dark.jpg b/apps/docs/public/videos/demos/squad-dark.jpg
new file mode 100644
index 0000000000..69a039fe2a
Binary files /dev/null and b/apps/docs/public/videos/demos/squad-dark.jpg differ
diff --git a/apps/docs/public/videos/demos/squad-dark.mp4 b/apps/docs/public/videos/demos/squad-dark.mp4
new file mode 100644
index 0000000000..e65befb116
Binary files /dev/null and b/apps/docs/public/videos/demos/squad-dark.mp4 differ
diff --git a/apps/docs/public/videos/demos/squad-light.jpg b/apps/docs/public/videos/demos/squad-light.jpg
new file mode 100644
index 0000000000..c73ded3f95
Binary files /dev/null and b/apps/docs/public/videos/demos/squad-light.jpg differ
diff --git a/apps/docs/public/videos/demos/squad-light.mp4 b/apps/docs/public/videos/demos/squad-light.mp4
new file mode 100644
index 0000000000..14575b1a5f
Binary files /dev/null and b/apps/docs/public/videos/demos/squad-light.mp4 differ
diff --git a/apps/docs/public/videos/demos/steer-dark.jpg b/apps/docs/public/videos/demos/steer-dark.jpg
new file mode 100644
index 0000000000..5b4a1f8170
Binary files /dev/null and b/apps/docs/public/videos/demos/steer-dark.jpg differ
diff --git a/apps/docs/public/videos/demos/steer-dark.mp4 b/apps/docs/public/videos/demos/steer-dark.mp4
new file mode 100644
index 0000000000..1566e9afaf
Binary files /dev/null and b/apps/docs/public/videos/demos/steer-dark.mp4 differ
diff --git a/apps/docs/public/videos/demos/steer-light.jpg b/apps/docs/public/videos/demos/steer-light.jpg
new file mode 100644
index 0000000000..05d640bd00
Binary files /dev/null and b/apps/docs/public/videos/demos/steer-light.jpg differ
diff --git a/apps/docs/public/videos/demos/steer-light.mp4 b/apps/docs/public/videos/demos/steer-light.mp4
new file mode 100644
index 0000000000..abb929f79b
Binary files /dev/null and b/apps/docs/public/videos/demos/steer-light.mp4 differ
diff --git a/apps/docs/public/videos/demos/usage-dark.jpg b/apps/docs/public/videos/demos/usage-dark.jpg
new file mode 100644
index 0000000000..629a57832f
Binary files /dev/null and b/apps/docs/public/videos/demos/usage-dark.jpg differ
diff --git a/apps/docs/public/videos/demos/usage-dark.mp4 b/apps/docs/public/videos/demos/usage-dark.mp4
new file mode 100644
index 0000000000..07146ddbd7
Binary files /dev/null and b/apps/docs/public/videos/demos/usage-dark.mp4 differ
diff --git a/apps/docs/public/videos/demos/usage-light.jpg b/apps/docs/public/videos/demos/usage-light.jpg
new file mode 100644
index 0000000000..1d24c47376
Binary files /dev/null and b/apps/docs/public/videos/demos/usage-light.jpg differ
diff --git a/apps/docs/public/videos/demos/usage-light.mp4 b/apps/docs/public/videos/demos/usage-light.mp4
new file mode 100644
index 0000000000..d592ac9001
Binary files /dev/null and b/apps/docs/public/videos/demos/usage-light.mp4 differ
diff --git a/apps/docs/public/videos/demos/wakeup-dark.jpg b/apps/docs/public/videos/demos/wakeup-dark.jpg
new file mode 100644
index 0000000000..6d8a7c8897
Binary files /dev/null and b/apps/docs/public/videos/demos/wakeup-dark.jpg differ
diff --git a/apps/docs/public/videos/demos/wakeup-dark.mp4 b/apps/docs/public/videos/demos/wakeup-dark.mp4
new file mode 100644
index 0000000000..94d6c1d925
Binary files /dev/null and b/apps/docs/public/videos/demos/wakeup-dark.mp4 differ
diff --git a/apps/docs/public/videos/demos/wakeup-light.jpg b/apps/docs/public/videos/demos/wakeup-light.jpg
new file mode 100644
index 0000000000..09a0bfb8cc
Binary files /dev/null and b/apps/docs/public/videos/demos/wakeup-light.jpg differ
diff --git a/apps/docs/public/videos/demos/wakeup-light.mp4 b/apps/docs/public/videos/demos/wakeup-light.mp4
new file mode 100644
index 0000000000..c6e83abc05
Binary files /dev/null and b/apps/docs/public/videos/demos/wakeup-light.mp4 differ
diff --git a/apps/docs/public/videos/demos/workflow-dark.jpg b/apps/docs/public/videos/demos/workflow-dark.jpg
new file mode 100644
index 0000000000..77ee2b575c
Binary files /dev/null and b/apps/docs/public/videos/demos/workflow-dark.jpg differ
diff --git a/apps/docs/public/videos/demos/workflow-dark.mp4 b/apps/docs/public/videos/demos/workflow-dark.mp4
new file mode 100644
index 0000000000..0a0a30b615
Binary files /dev/null and b/apps/docs/public/videos/demos/workflow-dark.mp4 differ
diff --git a/apps/docs/public/videos/demos/workflow-light.jpg b/apps/docs/public/videos/demos/workflow-light.jpg
new file mode 100644
index 0000000000..79c8473c89
Binary files /dev/null and b/apps/docs/public/videos/demos/workflow-light.jpg differ
diff --git a/apps/docs/public/videos/demos/workflow-light.mp4 b/apps/docs/public/videos/demos/workflow-light.mp4
new file mode 100644
index 0000000000..7c2c961919
Binary files /dev/null and b/apps/docs/public/videos/demos/workflow-light.mp4 differ
diff --git a/scripts/docs-demos/record.mjs b/scripts/docs-demos/record.mjs
new file mode 100644
index 0000000000..b80c0ccd1a
--- /dev/null
+++ b/scripts/docs-demos/record.mjs
@@ -0,0 +1,1524 @@
+#!/usr/bin/env node
+/**
+ * Record real Multica Web App demo clips (English UI, light + dark) for Multica Docs.
+ *
+ * Usage (inside a `make up C=api,web ARGS="--ephemeral"` environment):
+ * make env-exec ARGS="-- node scripts/docs-demos/record.mjs"
+ * make env-exec ARGS="-- node scripts/docs-demos/record.mjs --only assign,mention"
+ *
+ * Outputs for each clip <slug>:
+ * apps/docs/public/videos/demos/<slug>-light.mp4
+ * apps/docs/public/videos/demos/<slug>-dark.mp4
+ * apps/docs/public/videos/demos/<slug>-light.jpg (representative poster frame)
+ * apps/docs/public/videos/demos/<slug>-dark.jpg
+ * And updates apps/docs/components/demos/clip-manifest.ts with exact durations & chapter timestamps.
+ */
+import { createRequire } from "node:module";
+import { execFileSync, spawnSync } from "node:child_process";
+import { existsSync, mkdirSync, readFileSync, rmSync, writeFileSync } from "node:fs";
+import { homedir } from "node:os";
+import { join } from "node:path";
+
+const repoRoot = execFileSync("git", ["rev-parse", "--show-toplevel"]).toString().trim();
+const { chromium } = createRequire(join(repoRoot, "package.json"))("@playwright/test");
+
+const env = process.env;
+if (!env.PORT || !/^dev-/.test(env.MULTICA_DEV_PROFILE ?? "")) {
+ console.error('[docs-demos] run through `make env-exec ARGS="-- node scripts/docs-demos/record.mjs"`.');
+ process.exit(1);
+}
+
+const outDir = join(repoRoot, "apps/docs/public/videos/demos");
+const manifestJsonPath = join(outDir, "manifest.json");
+const manifestTsPath = join(repoRoot, "apps/docs/components/demos/clip-manifest.ts");
+mkdirSync(outDir, { recursive: true });
+
+const argv = process.argv.slice(2);
+let onlySet = null;
+for (let i = 0; i < argv.length; i++) {
+ if (argv[i] === "--only" && argv[i + 1]) {
+ onlySet = new Set(argv[++i].split(",").map((s) => s.trim()).filter(Boolean));
+ }
+}
+
+const base = `http://localhost:${env.FRONTEND_PORT}`;
+const apiBase = `http://localhost:${env.PORT}`;
+const profilesHome = env.MULTICA_DEV_PROFILES_HOME || join(homedir(), ".multica", "profiles");
+const profile = JSON.parse(readFileSync(join(profilesHome, env.MULTICA_DEV_PROFILE, "config.json"), "utf8"));
+const slug = JSON.parse(execFileSync("bash", [join(repoRoot, "scripts", "dev-env.sh"), "status", "--json"]).toString()).workspace_slug;
+
+const sleep = (ms) => new Promise((r) => setTimeout(r, ms));
+const log = (m) => console.log(`[docs-demos] ${m}`);
+
+function psql(sql) {
+ if (!env.DATABASE_URL) return "";
+ const res = spawnSync("psql", [env.DATABASE_URL, "-v", "ON_ERROR_STOP=0", "-tAc", sql], { encoding: "utf8" });
+ if (res.status !== 0 && res.stderr) log(`psql warn: ${res.stderr.trim().slice(0, 200)}`);
+ return (res.stdout || "").trim();
+}
+
+async function api(method, path, body, extraHeaders = {}) {
+ const res = await fetch(`${apiBase}${path}`, {
+ method,
+ headers: {
+ Authorization: `Bearer ${profile.token}`,
+ "X-Workspace-ID": profile.workspace_id,
+ "Content-Type": "application/json",
+ ...extraHeaders,
+ },
+ body: body === undefined ? undefined : JSON.stringify(body),
+ });
+ const text = await res.text();
+ if (!res.ok) throw new Error(`${method} ${path} -> ${res.status} ${text.slice(0, 260)}`);
+ return text ? JSON.parse(text) : null;
+}
+
+async function safeApi(method, path, body, extraHeaders = {}) {
+ try {
+ return await api(method, path, body, extraHeaders);
+ } catch (err) {
+ log(`warn: ${err.message}`);
+ return null;
+ }
+}
+
+// ---------------------------------------------------------------------------
+// Daemon helper: keep ALL workspace runtimes online & answer queued runs
+// ---------------------------------------------------------------------------
+const DAEMON_ID = "docs-demo-recorder";
+let demoRuntime = null;
+let heartbeatTimer = null;
+
+async function pulseAllRuntimes() {
+ const raw = (await safeApi("GET", "/api/runtimes")) ?? [];
+ const list = Array.isArray(raw) ? raw : raw.runtimes ?? [];
+ for (const rt of list) {
+ if (rt?.id) {
+ await safeApi("POST", "/api/daemon/heartbeat", { runtime_id: rt.id });
+ }
+ }
+ if (demoRuntime?.id) {
+ await safeApi("POST", "/api/daemon/heartbeat", { runtime_id: demoRuntime.id });
+ }
+}
+
+async function ensureDemoRuntime() {
+ const reg = await api("POST", "/api/daemon/register", {
+ workspace_id: profile.workspace_id,
+ daemon_id: DAEMON_ID,
+ device_name: "Maya's MacBook Pro",
+ cli_version: "v0.12.0",
+ runtimes: [{ name: "Claude Code", type: "claude", version: "2.1.0", status: "online" }],
+ });
+ demoRuntime = reg?.runtimes?.[0];
+ if (!demoRuntime?.id) throw new Error("failed to register demo runtime");
+ await pulseAllRuntimes();
+ heartbeatTimer = setInterval(() => {
+ pulseAllRuntimes().catch(() => {});
+ }, 12_000);
+ return demoRuntime;
+}
+
+async function ensureAgent(name, description, instructions) {
+ const raw = (await api("GET", "/api/agents")) ?? [];
+ const list = Array.isArray(raw) ? raw : raw.agents ?? [];
+ const existing = list.find((a) => a.name === name && a.runtime_id === demoRuntime.id);
+ if (existing) return existing;
+ return api("POST", "/api/agents", {
+ name,
+ description,
+ instructions,
+ runtime_id: demoRuntime.id,
+ visibility: "workspace",
+ max_concurrent_tasks: 20,
+ });
+}
+
+function clearStaleQueuedTasks() {
+ psql("UPDATE agent_task_queue SET status = 'completed', completed_at = NOW() WHERE status IN ('queued', 'dispatched', 'running');");
+}
+
+async function claimTaskMatching(predicate, timeoutMs = 6000) {
+ const deadline = Date.now() + timeoutMs;
+ while (Date.now() < deadline) {
+ const claimed = await safeApi("POST", `/api/daemon/runtimes/${demoRuntime.id}/tasks/claim`, {});
+ const task = claimed?.task;
+ if (task) {
+ if (predicate(task)) return task;
+ await safeApi("POST", `/api/daemon/tasks/${task.id}/start`);
+ await safeApi("POST", `/api/daemon/tasks/${task.id}/complete`, { output: "Completed." });
+ continue;
+ }
+ await sleep(200);
+ }
+ return null;
+}
+
+async function startTask(taskId) {
+ await api("POST", `/api/daemon/tasks/${taskId}/start`);
+}
+
+async function reportMessage(taskId, msg) {
+ await safeApi("POST", `/api/daemon/tasks/${taskId}/messages`, msg);
+}
+
+async function completeTask(taskId, output) {
+ await api("POST", `/api/daemon/tasks/${taskId}/complete`, { output });
+}
+
+async function failTask(taskId, error) {
+ await safeApi("POST", `/api/daemon/tasks/${taskId}/fail`, { error });
+}
+
+async function reportUsage(taskId, inputTokens, outputTokens, costUsd = 0.24) {
+ await safeApi("POST", `/api/daemon/tasks/${taskId}/usage`, {
+ usage: [
+ {
+ provider: "anthropic",
+ model: "claude-sonnet-4-6",
+ input_tokens: inputTokens,
+ output_tokens: outputTokens,
+ cache_read_tokens: Math.round(inputTokens * 0.45),
+ cache_write_tokens: Math.round(inputTokens * 0.12),
+ cost_usd_ticks: Math.round(costUsd * 1e10),
+ },
+ ],
+ });
+}
+
+// ---------------------------------------------------------------------------
+// Cursor + Recorder helpers
+// ---------------------------------------------------------------------------
+const VIEWPORT = { width: 1280, height: 800 };
+const CAPTURE_SCALE = 2;
+
+const CURSOR_CSS = `
+ nextjs-portal { display: none !important; }
+ #__demo_cursor {
+ position: fixed;
+ left: -40px;
+ top: -40px;
+ width: 22px;
+ height: 22px;
+ pointer-events: none;
+ z-index: 2147483647;
+ transform: translate(-2px, -2px);
+ transition: left 240ms cubic-bezier(0.22, 1, 0.36, 1), top 240ms cubic-bezier(0.22, 1, 0.36, 1);
+ filter: drop-shadow(0 2px 4px rgba(0,0,0,0.28));
+ }
+ #__demo_ripple {
+ position: fixed;
+ left: -40px;
+ top: -40px;
+ width: 28px;
+ height: 28px;
+ margin-left: -14px;
+ margin-top: -14px;
+ border-radius: 999px;
+ border: 2px solid oklch(0.56 0.19 256);
+ pointer-events: none;
+ z-index: 2147483646;
+ opacity: 0;
+ transform: scale(0.4);
+ }
+ #__demo_ripple.pop {
+ animation: __demo_pop 360ms cubic-bezier(0.16, 1, 0.3, 1) forwards;
+ }
+ @keyframes __demo_pop {
+ 0% { opacity: 0.9; transform: scale(0.35); }
+ 100% { opacity: 0; transform: scale(1.45); }
+ }
+`;
+
+async function injectCursor(page) {
+ await page.addStyleTag({ content: CURSOR_CSS }).catch(() => {});
+ await page.evaluate(() => {
+ if (document.getElementById("__demo_cursor")) return;
+ const c = document.createElement("div");
+ c.id = "__demo_cursor";
+ c.innerHTML = `<svg viewBox="0 0 24 24" width="22" height="22" fill="none" xmlns="http://www.w3.org/2000/svg"><path d="M5.5 3.2L18.8 12.6L12.6 13.7L9.5 19.6L5.5 3.2Z" fill="#111113" stroke="#ffffff" stroke-width="1.6" stroke-linejoin="round"/></svg>`;
+ const r = document.createElement("div");
+ r.id = "__demo_ripple";
+ document.body.append(r, c);
+ }).catch(() => {});
+}
+
+async function moveCursor(page, x, y) {
+ await page.evaluate(([cx, cy]) => {
+ const c = document.getElementById("__demo_cursor");
+ if (c) { c.style.left = `${cx}px`; c.style.top = `${cy}px`; }
+ }, [x, y]).catch(() => {});
+ await page.mouse.move(x, y, { steps: 6 });
+ await sleep(230);
+}
+
+async function clickAt(page, x, y, { pauseBefore = 100, pauseAfter = 420 } = {}) {
+ await moveCursor(page, x, y);
+ await sleep(pauseBefore);
+ await page.evaluate(([cx, cy]) => {
+ const r = document.getElementById("__demo_ripple");
+ if (!r) return;
+ r.classList.remove("pop");
+ r.style.left = `${cx}px`;
+ r.style.top = `${cy}px`;
+ void r.offsetWidth;
+ r.classList.add("pop");
+ }, [x, y]).catch(() => {});
+ await page.mouse.click(x, y);
+ await sleep(pauseAfter);
+}
+
+async function smoothClick(page, locator, opts = {}) {
+ const el = typeof locator === "string" ? page.locator(locator).first() : locator.first();
+ await el.waitFor({ state: "visible", timeout: 4500 });
+ const box = await el.boundingBox();
+ if (!box) throw new Error("smoothClick: no boundingBox");
+ await clickAt(page, Math.round(box.x + box.width / 2), Math.round(box.y + box.height / 2), opts);
+}
+
+async function trySmoothClick(page, locator, opts = {}) {
+ try {
+ await smoothClick(page, locator, opts);
+ return true;
+ } catch {
+ return false;
+ }
+}
+
+/** Find a visible button inside a horizontal x range (e.g., right properties panel x > 860). */
+async function clickButtonInZone(page, nameRegex, { minX = 0, maxX = 1280, minY = 0, maxY = 800, pauseAfter = 450 } = {}) {
+ const loc = page.getByRole("button", { name: nameRegex });
+ const count = await loc.count();
+ for (let i = 0; i < count; i++) {
+ const el = loc.nth(i);
+ if (!(await el.isVisible().catch(() => false))) continue;
+ const box = await el.boundingBox();
+ if (!box) continue;
+ const cx = box.x + box.width / 2;
+ const cy = box.y + box.height / 2;
+ if (cx >= minX && cx <= maxX && cy >= minY && cy <= maxY) {
+ await clickAt(page, Math.round(cx), Math.round(cy), { pauseAfter });
+ return true;
+ }
+ }
+ return false;
+}
+
+/** Click an option/menuitem inside the open popover (avoiding left sidebar matches). */
+async function clickPopoverItem(page, textRegex, { pauseAfter = 450 } = {}) {
+ const selectors = [
+ page.locator('[role="listbox"], [role="menu"], [data-slot="popover-content"], [data-base-ui-portal]').getByText(textRegex),
+ page.getByRole("option", { name: textRegex }),
+ page.getByRole("menuitem", { name: textRegex }),
+ ];
+ for (const loc of selectors) {
+ const count = await loc.count();
+ for (let i = count - 1; i >= 0; i--) {
+ const el = loc.nth(i);
+ if (!(await el.isVisible().catch(() => false))) continue;
+ const box = await el.boundingBox();
+ if (!box || box.x < 280) continue;
+ await clickAt(page, Math.round(box.x + box.width / 2), Math.round(box.y + box.height / 2), { pauseAfter });
+ return true;
+ }
+ }
+ return false;
+}
+
+async function focusAndTypeComment(page, text) {
+ const shell = page.locator('[data-testid="comment-composer-shell"]').first();
+ const shellReady = await shell.waitFor({ state: "visible", timeout: 8000 }).then(() => true).catch(() => false);
+ if (shellReady) {
+ const box = await shell.boundingBox();
+ if (box) await moveCursor(page, Math.round(box.x + box.width / 2), Math.round(box.y + box.height / 2));
+ await shell.click();
+ await sleep(350);
+ }
+ const editor = page.locator('[data-mc="comment-composer"] [contenteditable="true"], [data-mc="comment-composer"] textarea').first();
+ await editor.waitFor({ state: "visible", timeout: 8000 });
+ await editor.click();
+ await sleep(150);
+ await page.keyboard.type(text, { delay: 16 });
+ await sleep(260);
+}
+
+async function submitActiveComment(page) {
+ const sendBtn = page
+ .locator('[data-mc="comment-composer"] button[aria-label*="Send" i], [data-mc="comment-composer"] button[type="submit"]')
+ .last();
+ if (!(await trySmoothClick(page, sendBtn, { pauseAfter: 450 }))) {
+ await page.keyboard.press("Meta+Enter");
+ await sleep(450);
+ }
+}
+
+async function openPage(browser, path, theme) {
+ const context = await browser.newContext({
+ viewport: VIEWPORT,
+ locale: "en-US",
+ deviceScaleFactor: CAPTURE_SCALE,
+ colorScheme: theme,
+ });
+ await context.addInitScript(
+ ([token, t]) => {
+ localStorage.setItem("multica_token", token);
+ localStorage.setItem("theme", t);
+ localStorage.setItem("multica:chat:isOpen", "false");
+ },
+ [profile.token, theme],
+ );
+ const page = await context.newPage();
+ await page.goto(`${base}/${slug}${path}`, { waitUntil: "domcontentloaded", timeout: 30_000 });
+ await page.locator("h1, h2, [data-testid='comment-composer-shell'], [role='tablist'], table, textarea").first().waitFor({ state: "visible", timeout: 15_000 }).catch(() => {});
+ await sleep(900);
+ // Dismiss any one-time onboarding/announcement dialog before recording starts
+ if (await page.locator('[data-slot="dialog-portal"] [role="dialog"]').first().isVisible().catch(() => false)) {
+ await page.keyboard.press("Escape");
+ await sleep(300);
+ }
+ await injectCursor(page);
+ return { context, page };
+}
+
+async function recordClip(browser, clipSlug, theme, path, run) {
+ const { context, page } = await openPage(browser, path, theme);
+ const cdp = await context.newCDPSession(page);
+ const shots = [];
+ const marks = [];
+ let posterIdx = null;
+ let startedAt = 0;
+ let stopped = false;
+
+ const mark = (id) => {
+ const at = startedAt ? Math.max(0, (Date.now() - startedAt) / 1000) : 0;
+ marks.push({ id, at: Math.round(at * 10) / 10 });
+ };
+ const setPoster = () => {
+ posterIdx = Math.max(0, shots.length - 1);
+ };
+
+ const loop = (async () => {
+ const interval = 1000 / 12;
+ while (!stopped) {
+ const t = Date.now();
+ if (!startedAt) startedAt = t;
+ try {
+ const { data } = await cdp.send("Page.captureScreenshot", {
+ format: "jpeg",
+ quality: 94,
+ clip: { x: 0, y: 0, width: VIEWPORT.width, height: VIEWPORT.height, scale: CAPTURE_SCALE },
+ optimizeForSpeed: true,
+ });
+ shots.push({ t, data });
+ } catch {
+ break;
+ }
+ const wait = interval - (Date.now() - t);
+ if (wait > 0) await sleep(wait);
+ }
+ })();
+
+ try {
+ await sleep(280);
+ await run({ page, mark, setPoster });
+ await sleep(650);
+ } finally {
+ stopped = true;
+ await loop.catch(() => {});
+ await cdp.detach().catch(() => {});
+ await context.close().catch(() => {});
+ }
+
+ if (shots.length < 2) throw new Error(`${clipSlug}-${theme}: too few frames`);
+
+ const tmpDir = join(outDir, `.tmp-${clipSlug}-${theme}`);
+ rmSync(tmpDir, { recursive: true, force: true });
+ mkdirSync(tmpDir, { recursive: true });
+
+ const lines = ["ffconcat version 1.0"];
+ shots.forEach((s, i) => {
+ const fname = `${String(i).padStart(5, "0")}.jpg`;
+ writeFileSync(join(tmpDir, fname), Buffer.from(s.data, "base64"));
+ const nextT = shots[i + 1]?.t ?? s.t + 650;
+ const dur = Math.max(0.04, (nextT - s.t) / 1000);
+ lines.push(`file '${fname}'`, `duration ${dur.toFixed(3)}`);
+ });
+ lines.push(`file '${String(shots.length - 1).padStart(5, "0")}.jpg'`);
+ writeFileSync(join(tmpDir, "frames.ffconcat"), `${lines.join("\n")}\n`);
+
+ const mp4 = join(outDir, `${clipSlug}-${theme}.mp4`);
+ const jpg = join(outDir, `${clipSlug}-${theme}.jpg`);
+
+ const enc = spawnSync(
+ "ffmpeg",
+ [
+ "-y", "-loglevel", "error",
+ "-f", "concat", "-safe", "0", "-i", join(tmpDir, "frames.ffconcat"),
+ "-vf", "scale=1280:800:flags=lanczos",
+ "-c:v", "libx264",
+ "-pix_fmt", "yuv420p",
+ "-profile:v", "high",
+ "-crf", "24",
+ "-preset", "slow",
+ "-movflags", "+faststart",
+ mp4,
+ ],
+ { stdio: "inherit" },
+ );
+ if (enc.status !== 0) throw new Error(`ffmpeg mp4 failed for ${clipSlug}-${theme}`);
+
+ const chosenPoster = posterIdx !== null ? posterIdx : Math.floor(shots.length * 0.65);
+ const posterJpg = join(tmpDir, `${String(Math.min(chosenPoster, shots.length - 1)).padStart(5, "0")}.jpg`);
+ const pEnc = spawnSync(
+ "ffmpeg",
+ ["-y", "-loglevel", "error", "-i", posterJpg, "-vf", "scale=1280:800:flags=lanczos", "-q:v", "4", jpg],
+ { stdio: "inherit" },
+ );
+ if (pEnc.status !== 0) throw new Error(`ffmpeg poster failed for ${clipSlug}-${theme}`);
+
+ rmSync(tmpDir, { recursive: true, force: true });
+
+ const probe = spawnSync(
+ "ffprobe",
+ ["-v", "error", "-show_entries", "format=duration", "-of", "default=noprint_wrappers=1:nokey=1", mp4],
+ { encoding: "utf8" },
+ );
+ const probed = Number.parseFloat((probe.stdout || "").trim());
+ const fallbackDur = Math.round(((shots.at(-1).t - shots[0].t) / 1000 + 0.65) * 10) / 10;
+ const duration = Number.isFinite(probed) && probed > 0 ? Math.round(probed * 10) / 10 : fallbackDur;
+ const clampedMarks = marks.map((m) => ({ id: m.id, at: Math.min(m.at, Math.max(0, Math.round((duration - 0.3) * 10) / 10)) }));
+ const sizeKb = Math.round(readFileSync(mp4).length / 1024);
+ log(`${clipSlug}-${theme}: ${shots.length} frames, ${duration}s, ${sizeKb} KB`);
+ return { duration, marks: clampedMarks };
+}
+
+// ---------------------------------------------------------------------------
+// Seed shared realistic workspace objects
+// ---------------------------------------------------------------------------
+async function seedShared() {
+ clearStaleQueuedTasks();
+ await ensureDemoRuntime();
+ await safeApi("POST", "/api/notification-preferences/auto-archive-prompt", { preferences: {} });
+ // Mark acquisition survey permanently skipped so SourceBackfillModal never interrupts recordings
+ psql(`UPDATE "user" SET onboarding_questionnaire = COALESCE(onboarding_questionnaire, '{}'::jsonb) || '{"source":[],"source_skipped":true}'::jsonb;`);
+
+ const me = await api("GET", "/api/me");
+
+ const engineer = await ensureAgent(
+ "Engineer",
+ "Builds features, runs tests, and opens pull requests.",
+ "Read the issue and discussion, implement with tests, and move the issue to In Review when ready.",
+ );
+ const reviewer = await ensureAgent(
+ "Reviewer",
+ "Read-only code review for diffs, edge cases, and regressions.",
+ "Review PR diffs carefully and return actionable findings with file paths and line numbers.",
+ );
+ const docsAgent = await ensureAgent(
+ "Docs",
+ "Keeps API docs and release notes in sync with shipped changes.",
+ "Write concise technical documentation matching the editorial style guide.",
+ );
+
+ // Skills
+ const existingSkills = (await safeApi("GET", "/api/skills")) ?? [];
+ const skillsList = Array.isArray(existingSkills) ? existingSkills : existingSkills.skills ?? [];
+ const ensureSkill = async (name, description, content) => {
+ const found = skillsList.find((s) => s.name === name);
+ if (found) return found;
+ return safeApi("POST", "/api/skills", { name, description, content });
+ };
+ const tddSkill = await ensureSkill(
+ "tdd",
+ "Write a failing test first, make it pass with minimal changes, then refactor.",
+ "# Test-Driven Development\n\n1. Add a focused failing test that reproduces the behavior.\n2. Implement the smallest change to make the suite pass.\n3. Refactor while keeping every check green.",
+ );
+ await ensureSkill(
+ "delivery-brief",
+ "Format handoff updates with outcome first, PR summary, and open decisions.",
+ "# Delivery Brief\n\nOpen with the conclusion in one line, list the PR link and verification results, and highlight any decisions that need human approval.",
+ );
+ if (tddSkill?.id) {
+ await safeApi("POST", `/api/agents/${engineer.id}/skills/add`, { skill_ids: [tddSkill.id] });
+ }
+
+ // Squad
+ const existingSquads = (await safeApi("GET", "/api/squads")) ?? [];
+ const squadsList = Array.isArray(existingSquads) ? existingSquads : existingSquads.squads ?? [];
+ let squad = squadsList.find((s) => s.name === "Platform Team");
+ if (!squad) {
+ squad = await safeApi("POST", "/api/squads", {
+ name: "Platform Team",
+ description: "Implements, reviews, and documents backend & API changes end to end.",
+ leader_id: engineer.id,
+ });
+ if (squad?.id) {
+ await safeApi("PUT", `/api/squads/${squad.id}`, {
+ instructions: "Engineer implements and opens a PR; Reviewer checks the diff; Docs updates reference pages before handoff.",
+ });
+ await safeApi("POST", `/api/squads/${squad.id}/members`, { member_type: "agent", member_id: reviewer.id, role: "member" });
+ await safeApi("POST", `/api/squads/${squad.id}/members`, { member_type: "agent", member_id: docsAgent.id, role: "member" });
+ }
+ }
+
+ // Quick Action
+ const existingQA = (await safeApi("GET", "/api/quick-actions")) ?? [];
+ const qaList = Array.isArray(existingQA) ? existingQA : existingQA.quick_actions ?? [];
+ let quickAction = qaList.find((q) => q.name === "PR review");
+ if (!quickAction) {
+ quickAction = await safeApi("POST", "/api/quick-actions", {
+ name: "PR review",
+ description: "Ask Reviewer to inspect the linked pull request for regressions.",
+ assignee_type: "agent",
+ assignee_id: reviewer.id,
+ prompt: "Review the linked pull request for edge cases, missing tests, and API compatibility.",
+ visibility: "public",
+ });
+ }
+
+ // Autopilot
+ const existingAP = (await safeApi("GET", "/api/autopilots")) ?? [];
+ const apList = Array.isArray(existingAP) ? existingAP : existingAP.autopilots ?? [];
+ let autopilot = apList.find((a) => a.title === "Weekly dead-code audit");
+ if (!autopilot) {
+ autopilot = await safeApi("POST", "/api/autopilots", {
+ title: "Weekly dead-code audit",
+ description: "Scan packages/ and server/ for unused exports, stale feature flags, and outdated dependencies.",
+ assignee_type: "agent",
+ assignee_id: reviewer.id,
+ execution_mode: "create_issue",
+ issue_title_template: "Weekly audit · {{date}}",
+ });
+ if (autopilot?.id) {
+ await safeApi("POST", `/api/autopilots/${autopilot.id}/triggers`, {
+ kind: "schedule",
+ cron_expression: "0 9 * * 1",
+ timezone: "UTC",
+ label: "Mondays at 09:00 UTC",
+ });
+ }
+ }
+
+ // Project
+ const existingProjects = (await safeApi("GET", "/api/projects")) ?? [];
+ const projList = Array.isArray(existingProjects) ? existingProjects : existingProjects.projects ?? [];
+ let project = projList.find((p) => p.title === "API reliability") ?? projList[0];
+ if (!project) {
+ project = await api("POST", "/api/projects", {
+ title: "API reliability",
+ description: "Keep p95 claim latency under 10s and enforce rate limits across public endpoints.",
+ status: "in_progress",
+ priority: "high",
+ });
+ } else if (!project.description) {
+ await safeApi("PUT", `/api/projects/${project.id}`, {
+ description: "Keep p95 claim latency under 10s and enforce rate limits across public endpoints.",
+ });
+ }
+
+ // Workflow project
+ let wfProject = projList.find((p) => p.title === "Release Pipeline");
+ if (!wfProject) {
+ wfProject = await api("POST", "/api/projects", {
+ title: "Release Pipeline",
+ description: "Structured engineering handoffs from implementation to automated review and QA.",
+ status: "in_progress",
+ priority: "medium",
+ });
+ }
+ const wfsRaw = (await safeApi("GET", "/api/issue-workflows")) ?? [];
+ const wfs = Array.isArray(wfsRaw) ? wfsRaw : wfsRaw.workflows ?? [];
+ let wf = wfs.find((w) => w.name === "Engineering Delivery");
+ if (!wf) {
+ wf = await safeApi("POST", "/api/issue-workflows", {
+ name: "Engineering Delivery",
+ description: "Engineer implements in In Progress, Reviewer audits in In Review.",
+ steps: [
+ { status_key: "todo", handler: { type: "none" } },
+ {
+ status_key: "in_progress",
+ handler: { type: "agent", id: engineer.id },
+ instructions: "Implement the change with unit tests, then move to In Review.",
+ next_status_key: "in_review",
+ },
+ {
+ status_key: "in_review",
+ handler: { type: "agent", id: reviewer.id },
+ instructions: "Review the diff and tests, then hand off for final sign-off.",
+ next_status_key: "done",
+ back_status_key: "in_progress",
+ },
+ { status_key: "done", handler: { type: "none" } },
+ { status_key: "cancelled", handler: { type: "none" } },
+ ],
+ });
+ }
+ if (wf?.id && wfProject?.id) {
+ await safeApi("POST", `/api/projects/${wfProject.id}/workflow`, { workflow_id: wf.id });
+ }
+
+ // Seed rich deliverable issue
+ const deliverableIssue = await api("POST", "/api/issues", {
+ title: "Benchmark claim latency across all five runtimes",
+ description: "Measure p50/p95 claim latency and queue depth across our five build runtimes, then attach a summary table and fix diff.",
+ status: "in_review",
+ priority: "high",
+ project_id: project?.id,
+ allow_duplicate: true,
+ });
+ await api("POST", `/api/issues/${deliverableIssue.id}/comments`, {
+ content: `Here is the 24-hour runtime comparison. **cloud-pool-b** is the outlier (p95 2.7× fleet median).\n\n| Runtime | Provider | p50 | p95 | Queue depth |\n| --- | --- | ---: | ---: | ---: |\n| build-mac-01 | Claude Code | 1.8 s | 7.4 s | 3 |\n| cloud-pool-a | Claude Code | 1.2 s | 4.9 s | 0 |\n| cloud-pool-b | Gemini CLI | 2.6 s | 11.3 s | 12 |\n\n\`\`\`diff\n--- a/server/internal/daemon/prepare.go\n+++ b/server/internal/daemon/prepare.go\n@@ -112,4 +112,4 @@\n- p.client.ExtendPrepareLease(ctx, task.RuntimeID, task.ID)\n p.cache.CopyInto(ctx, task.WorkDir, opts)\n+ p.client.ExtendPrepareLease(ctx, task.RuntimeID, task.ID)\n\`\`\`\n\nMoving lease extension after dependency copy cuts p95 from **11.3 s → 4.1 s**.`,
+ });
+
+ // Ensure workspace has a connected repo so Pull Requests appear in the sidebar add-row
+ psql(`
+ UPDATE workspace
+ SET repos = '[{"url":"https://github.com/multica-ai/multica","description":"Multica platform monorepo"}]'::jsonb
+ WHERE id = '${profile.workspace_id}' AND (repos IS NULL OR jsonb_array_length(repos) = 0);
+ `);
+
+ // Seed realistic token usage over last 6 days (+ 2 failed runs for the Errors tab)
+ const usageRows = [
+ { agent: engineer, title: "Add request ID correlation to gateway logs", inTok: 48200, outTok: 9400, cost: 0.31, daysAgo: 5 },
+ { agent: reviewer, title: "Review OAuth PKCE state validation PR", inTok: 31500, outTok: 5200, cost: 0.19, daysAgo: 4 },
+ { agent: engineer, title: "Tune webhook exponential backoff limits", inTok: 62400, outTok: 12100, cost: 0.42, daysAgo: 3 },
+ { agent: docsAgent, title: "Update OpenAPI spec for /v2/search", inTok: 24800, outTok: 6400, cost: 0.17, daysAgo: 2 },
+ { agent: engineer, title: "Fix stale cache invalidation on issue moves", inTok: 79100, outTok: 14800, cost: 0.54, daysAgo: 1 },
+ { agent: reviewer, title: "Audit SQL migration lock safety", inTok: 41200, outTok: 7300, cost: 0.27, daysAgo: 0 },
+ ];
+ const existingUsageCount = Number(psql("SELECT count(*) FROM task_usage;") || "0");
+ if (existingUsageCount < 4) {
+ const seedIssueIds = [];
+ for (const row of usageRows) {
+ const iss = await api("POST", "/api/issues", {
+ title: row.title,
+ description: "Completed run with usage metrics.",
+ status: "done",
+ priority: "low",
+ assignee_type: "agent",
+ assignee_id: row.agent.id,
+ allow_duplicate: true,
+ });
+ seedIssueIds.push(iss.id);
+ const t = await claimTaskMatching((x) => x.issue_id === iss.id, 4000);
+ if (t) {
+ await startTask(t.id);
+ await reportUsage(t.id, row.inTok, row.outTok, row.cost);
+ await completeTask(t.id, "Completed.");
+ if (row.daysAgo > 0) {
+ psql(`UPDATE agent_task_queue SET created_at = NOW() - INTERVAL '${row.daysAgo} days', started_at = NOW() - INTERVAL '${row.daysAgo} days', completed_at = NOW() - INTERVAL '${row.daysAgo} days' + INTERVAL '42 seconds' WHERE id = '${t.id}';`);
+ psql(`UPDATE task_usage SET created_at = NOW() - INTERVAL '${row.daysAgo} days' WHERE task_id = '${t.id}';`);
+ }
+ }
+ }
+ // Seed 2 realistic failed runs so Analytics > Errors tab is informative
+ const failedRuns = [
+ { agent: engineer, title: "Run integration suite against staging webhook receiver", error: "Command exited with code 1: webhook signature verification timed out after 30s", daysAgo: 2 },
+ { agent: reviewer, title: "Verify migration rollback on large issue table", error: "Provider rate limit exceeded (HTTP 429) while fetching diff context", daysAgo: 1 },
+ ];
+ for (const row of failedRuns) {
+ const iss = await api("POST", "/api/issues", {
+ title: row.title,
+ description: "Run failure diagnostics for Analytics > Errors.",
+ status: "todo",
+ priority: "medium",
+ assignee_type: "agent",
+ assignee_id: row.agent.id,
+ allow_duplicate: true,
+ });
+ seedIssueIds.push(iss.id);
+ const t = await claimTaskMatching((x) => x.issue_id === iss.id, 4000);
+ if (t) {
+ await startTask(t.id);
+ await reportUsage(t.id, 14200, 1800, 0.08);
+ await failTask(t.id, row.error);
+ psql(`UPDATE agent_task_queue SET created_at = NOW() - INTERVAL '${row.daysAgo} days', started_at = NOW() - INTERVAL '${row.daysAgo} days', completed_at = NOW() - INTERVAL '${row.daysAgo} days' + INTERVAL '28 seconds' WHERE id = '${t.id}';`);
+ psql(`UPDATE task_usage SET created_at = NOW() - INTERVAL '${row.daysAgo} days' WHERE task_id = '${t.id}';`);
+ }
+ }
+ // Keep background analytics seed noise out of the user's Inbox
+ if (seedIssueIds.length > 0) {
+ const idList = seedIssueIds.map((id) => `'${id}'`).join(", ");
+ psql(`DELETE FROM inbox_item WHERE issue_id IN (${idList});`);
+ }
+ }
+ // Remove any leftover starter/fixture issues and inbox noise so the workspace is 100% clean
+ psql("DELETE FROM inbox_item WHERE details::text LIKE '%Analytics seed%' OR details::text LIKE '%Fixture%';");
+ psql("DELETE FROM issue WHERE title LIKE 'Fixture:%';");
+ clearStaleQueuedTasks();
+
+ return { me, engineer, reviewer, docsAgent, tddSkill, squad, quickAction, autopilot, project, wfProject, deliverableIssue };
+}
+
+// ---------------------------------------------------------------------------
+// 19 Scenarios
+// ---------------------------------------------------------------------------
+function buildScenarios(ctx) {
+ return {
+ assign: async (browser, theme) => {
+ clearStaleQueuedTasks();
+ const issue = await api("POST", "/api/issues", {
+ title: "Add sliding-window rate limiting to /v2/search",
+ description: "Enforce 120 req/min per API key on `/v2/search` and return `Retry-After` headers when exceeded.",
+ status: "todo",
+ priority: "high",
+ project_id: ctx.project?.id,
+ allow_duplicate: true,
+ });
+ return recordClip(browser, "assign", theme, `/issues/${issue.identifier}`, async ({ page, mark, setPoster }) => {
+ mark("pick");
+ await sleep(450);
+ await clickButtonInZone(page, /Unassigned|Assignee/i, { minX: 860, pauseAfter: 450 });
+ await clickPopoverItem(page, /^Engineer$/, { pauseAfter: 450 });
+
+ mark("confirm");
+ const confirmBtn = page.getByRole("button", { name: /Confirm assignment/i });
+ if (await confirmBtn.isVisible({ timeout: 2000 }).catch(() => false)) {
+ await sleep(450);
+ await smoothClick(page, confirmBtn, { pauseAfter: 450 });
+ }
+
+ mark("running");
+ const task = await claimTaskMatching((t) => t.issue_id === issue.id, 6000);
+ if (task) {
+ const asAgent = task.auth_token ? { Authorization: `Bearer ${task.auth_token}` } : {};
+ await startTask(task.id);
+ await reportMessage(task.id, { type: "text", content: "Checking current rate limiter middleware in server/internal/middleware." });
+ await api("PUT", `/api/issues/${issue.id}`, { status: "in_progress" }, asAgent);
+ await sleep(1000);
+
+ mark("done");
+ await api("POST", `/api/issues/${issue.id}/comments`, {
+ content: "Implemented sliding-window rate limiting (120 req/min per key) with `Retry-After` headers and unit tests. Ready for review.",
+ }, asAgent);
+ await api("PUT", `/api/issues/${issue.id}`, { status: "in_review" }, asAgent);
+ await completeTask(task.id, "Implemented sliding-window rate limiting on /v2/search.");
+ await reportUsage(task.id, 21400, 4100, 0.16);
+ await sleep(1100);
+ setPoster();
+ } else {
+ setPoster();
+ await sleep(900);
+ }
+ });
+ },
+
+ mention: async (browser, theme) => {
+ clearStaleQueuedTasks();
+ const issue = await api("POST", "/api/issues", {
+ title: "Investigate intermittent 502s on EU webhook proxy",
+ description: "EU customers saw brief 502 spikes during the 14:00 UTC deploy window.",
+ status: "in_progress",
+ priority: "high",
+ assignee_type: "member",
+ assignee_id: ctx.me.id,
+ project_id: ctx.project?.id,
+ allow_duplicate: true,
+ });
+ return recordClip(browser, "mention", theme, `/issues/${issue.identifier}`, async ({ page, mark, setPoster }) => {
+ mark("compose");
+ await focusAndTypeComment(page, "Please check proxy timeout logs @Reviewer");
+ await sleep(450);
+ // Accept TipTap's highlighted mention suggestion so @Reviewer becomes a real mention node
+ // and reveals the trigger-preview bar above the composer.
+ await page.keyboard.press("Enter");
+ await sleep(450);
+
+ mark("preview");
+ await sleep(850);
+ await submitActiveComment(page);
+
+ mark("reply");
+ const task = await claimTaskMatching((t) => t.issue_id === issue.id, 6000);
+ if (task) {
+ const asAgent = task.auth_token ? { Authorization: `Bearer ${task.auth_token}` } : {};
+ await startTask(task.id);
+ await sleep(750);
+ await api("POST", `/api/issues/${issue.id}/comments`, {
+ content: "Checked nginx upstream logs: idle keepalive timeout was 60s vs ALB 65s, causing reset-on-reuse 502s. Assignee unchanged.",
+ ...(task.trigger_comment_id ? { parent_id: task.trigger_comment_id } : {}),
+ }, asAgent);
+ await completeTask(task.id, "Diagnosed keepalive timeout mismatch.");
+ await sleep(1100);
+ setPoster();
+ } else {
+ setPoster();
+ await sleep(750);
+ }
+ });
+ },
+
+ steer: async (browser, theme) => {
+ clearStaleQueuedTasks();
+ const issue = await api("POST", "/api/issues", {
+ title: "Summarize last month's customer support tickets",
+ description: "Review all 86 tickets from October and write an executive summary for Monday's standup.",
+ status: "todo",
+ priority: "medium",
+ assignee_type: "agent",
+ assignee_id: ctx.engineer.id,
+ allow_duplicate: true,
+ });
+ const task = await claimTaskMatching((t) => t.issue_id === issue.id, 6000);
+ let asAgent = {};
+ if (task) {
+ asAgent = task.auth_token ? { Authorization: `Bearer ${task.auth_token}` } : {};
+ await startTask(task.id);
+ await api("PUT", `/api/issues/${issue.id}`, { status: "in_progress" }, asAgent);
+ await reportMessage(task.id, { type: "text", content: "Reading 86 tickets one by one and drafting per-ticket summaries (4/86)..." });
+ }
+ return recordClip(browser, "steer", theme, `/issues/${issue.identifier}`, async ({ page, mark, setPoster }) => {
+ mark("working");
+ await sleep(850);
+
+ mark("steer");
+ await focusAndTypeComment(page, "Skip per-ticket summaries — group into 3 themes with 2 quotes each, one page max.");
+ setPoster();
+ await sleep(600);
+ await submitActiveComment(page);
+
+ mark("redirected");
+ if (task) {
+ await reportMessage(task.id, { type: "text", content: "Received steering note — switching to 3-theme executive summary." });
+ await sleep(750);
+ await api("POST", `/api/issues/${issue.id}/comments`, {
+ content: "Grouped all 86 tickets into 3 themes (Onboarding, Webhook retries, Pricing) with 2 customer quotes each — condensed to one page.",
+ }, asAgent);
+ await api("PUT", `/api/issues/${issue.id}`, { status: "in_review" }, asAgent);
+ await completeTask(task.id, "Delivered 1-page themed summary.");
+ await sleep(1050);
+ }
+ });
+ },
+
+ inbox: async (browser, theme) => {
+ // Ensure at least two fresh realistic unread inbox notifications exist so archiving advances visibly
+ const seedUnread = async (title, commentBody, agent) => {
+ const iss = await api("POST", "/api/issues", {
+ title,
+ description: "Track implementation and verification before release.",
+ status: "in_review",
+ priority: "high",
+ project_id: ctx.project?.id,
+ assignee_type: "agent",
+ assignee_id: agent.id,
+ allow_duplicate: true,
+ });
+ const task = await claimTaskMatching((t) => t.issue_id === iss.id, 4000);
+ if (task) {
+ const asAgent = task.auth_token ? { Authorization: `Bearer ${task.auth_token}` } : {};
+ await startTask(task.id);
+ await api("POST", `/api/issues/${iss.id}/comments`, { content: commentBody }, asAgent);
+ await completeTask(task.id, commentBody);
+ }
+ return iss;
+ };
+ await seedUnread(
+ "Retry webhook deliveries with jittered backoff",
+ "Added capped exponential backoff (5 retries, full jitter) and unit tests. Ready for review.",
+ ctx.engineer,
+ );
+ await seedUnread(
+ "Audit OAuth PKCE state validation on callback",
+ "Verified PKCE verifier check rejects replayed state tokens across tabs.",
+ ctx.reviewer,
+ );
+
+ return recordClip(browser, "inbox", theme, "/issues", async ({ page, mark, setPoster }) => {
+ // Wait for the Inbox sidebar rows to finish loading (past skeleton state)
+ await page.getByText(/Audit OAuth|Retry webhook/i).first().waitFor({ state: "visible", timeout: 8000 }).catch(() => {});
+ await sleep(300);
+ mark("unread");
+ // Click first notification row under Inbox in Work panel (left sidebar x: 50..300, y: 70..520)
+ const rows = page.locator("a, button, [role='button']").filter({
+ hasText: /Audit OAuth|Retry webhook|sliding-window|Summarize last month/i,
+ });
+ const n = await rows.count();
+ for (let i = 0; i < n; i++) {
+ const el = rows.nth(i);
+ if (!(await el.isVisible().catch(() => false))) continue;
+ const box = await el.boundingBox();
+ if (box && box.x >= 50 && box.x < 300 && box.y >= 70 && box.y < 520) {
+ await clickAt(page, Math.round(box.x + box.width / 2), Math.round(box.y + box.height / 2), { pauseAfter: 900 });
+ await page.locator('[data-inbox-bar="open"]').first().waitFor({ state: "visible", timeout: 5000 }).catch(() => {});
+ await sleep(500);
+ break;
+ }
+ }
+ setPoster();
+
+ mark("archive");
+ const archiveBtn = page.locator('[data-inbox-bar="open"] button[aria-label="Archive"]').first();
+ if (!(await trySmoothClick(page, archiveBtn, { pauseAfter: 900 }))) {
+ await page.keyboard.press("e");
+ await sleep(900);
+ }
+
+ mark("archived");
+ const archivedTab = page.locator('button[aria-label*="Archived" i], button[title*="Archived" i]').first();
+ if (!(await trySmoothClick(page, archivedTab, { pauseAfter: 900 }))) {
+ await clickButtonInZone(page, /Archived/i, { minX: 50, maxX: 340, minY: 40, maxY: 220, pauseAfter: 900 });
+ }
+ });
+ },
+
+ workflow: async (browser, theme) => {
+ clearStaleQueuedTasks();
+ const issue = await api("POST", "/api/issues", {
+ title: "Ship idempotency keys on POST /v1/invoices",
+ description: "Ensure retried invoice requests return the original response safely.",
+ status: "in_progress",
+ priority: "high",
+ project_id: ctx.wfProject?.id ?? ctx.project?.id,
+ assignee_type: "member",
+ assignee_id: ctx.me.id,
+ allow_duplicate: true,
+ });
+ return recordClip(browser, "workflow", theme, `/issues/${issue.identifier}`, async ({ page, mark, setPoster }) => {
+ mark("picker");
+ await sleep(450);
+ await clickButtonInZone(page, /In Progress/i, { minX: 860, maxY: 220, pauseAfter: 550 });
+ setPoster();
+
+ mark("handoff");
+ await clickPopoverItem(page, /In Review/i, { pauseAfter: 500 });
+ const confirmBtn = page.getByRole("button", { name: /Move to|Confirm/i }).first();
+ if (await confirmBtn.isVisible({ timeout: 2000 }).catch(() => false)) {
+ await sleep(450);
+ await smoothClick(page, confirmBtn, { pauseAfter: 450 });
+ }
+
+ mark("next");
+ const task = await claimTaskMatching((t) => t.issue_id === issue.id, 4500);
+ if (task) {
+ const asAgent = task.auth_token ? { Authorization: `Bearer ${task.auth_token}` } : {};
+ await startTask(task.id);
+ await sleep(700);
+ await api("POST", `/api/issues/${issue.id}/comments`, {
+ content: "Reviewed idempotency key store and TTL tests — no regressions found. Ready to ship.",
+ }, asAgent);
+ await completeTask(task.id, "Review passed.");
+ await sleep(1000);
+ } else {
+ await sleep(800);
+ }
+ });
+ },
+
+ "issue-status": async (browser, theme) => {
+ clearStaleQueuedTasks();
+ const issue = await api("POST", "/api/issues", {
+ title: "Add CSV export to the invoices table",
+ description: "Allow billing admins to download filtered monthly invoices as UTF-8 CSV.",
+ status: "backlog",
+ priority: "medium",
+ assignee_type: "agent",
+ assignee_id: ctx.engineer.id,
+ project_id: ctx.project?.id,
+ allow_duplicate: true,
+ });
+ return recordClip(browser, "issue-status", theme, `/issues/${issue.identifier}`, async ({ page, mark, setPoster }) => {
+ mark("backlog");
+ await sleep(550);
+ await clickButtonInZone(page, /Backlog/i, { minX: 860, maxY: 220, pauseAfter: 450 });
+ await clickPopoverItem(page, /^In Progress$/, { pauseAfter: 550 });
+ // Moving an agent-assigned issue out of Backlog opens the "Start work now?" confirmation modal
+ const startNowBtn = page.getByRole("button", { name: /Move and start/i }).first();
+ if (await startNowBtn.waitFor({ state: "visible", timeout: 2500 }).then(() => true).catch(() => false)) {
+ await sleep(350);
+ await smoothClick(page, startNowBtn, { pauseAfter: 550 });
+ }
+
+ mark("progress");
+ const task = await claimTaskMatching((t) => t.issue_id === issue.id, 4500);
+ if (task) {
+ const asAgent = task.auth_token ? { Authorization: `Bearer ${task.auth_token}` } : {};
+ await startTask(task.id);
+ await reportMessage(task.id, { type: "text", content: "Adding UTF-8 BOM CSV export endpoint and download button." });
+ await sleep(800);
+ setPoster();
+ await api("POST", `/api/issues/${issue.id}/comments`, {
+ content: "Implemented UTF-8 CSV export for filtered monthly invoices with tests.",
+ }, asAgent);
+ await api("PUT", `/api/issues/${issue.id}`, { status: "in_review" }, asAgent);
+ await completeTask(task.id, "CSV export implemented.");
+ await sleep(700);
+ } else {
+ setPoster();
+ await clickButtonInZone(page, /In Progress/i, { minX: 860, maxY: 220, pauseAfter: 450 });
+ await clickPopoverItem(page, /^In Review$/, { pauseAfter: 650 });
+ }
+
+ mark("done");
+ await clickButtonInZone(page, /In Review/i, { minX: 860, maxY: 220, pauseAfter: 450 });
+ await clickPopoverItem(page, /^Done$/, { pauseAfter: 900 });
+ });
+ },
+
+ "issue-draft": async (browser, theme) => {
+ return recordClip(browser, "issue-draft", theme, "/issues", async ({ page, mark, setPoster }) => {
+ mark("open");
+ await sleep(450);
+ await page.keyboard.press("c");
+ await sleep(600);
+
+ mark("draft");
+ const input = page.locator('[role="dialog"] textarea, [role="dialog"] [contenteditable="true"], [role="dialog"] input[type="text"]').first();
+ if (await input.isVisible({ timeout: 2500 }).catch(() => false)) {
+ await smoothClick(page, input, { pauseAfter: 120 });
+ await page.keyboard.type("Add dark mode contrast check to CI and fail if any token drops below WCAG AA.", { delay: 14 });
+ setPoster();
+ await sleep(500);
+ }
+
+ mark("create");
+ const submit = page.locator('[role="dialog"]').getByRole("button", { name: /Create|Submit|Send/i }).last();
+ await trySmoothClick(page, submit, { pauseAfter: 1050 });
+ });
+ },
+
+ deliverables: async (browser, theme) => {
+ return recordClip(browser, "deliverables", theme, `/issues/${ctx.deliverableIssue.identifier}`, async ({ page, mark, setPoster }) => {
+ mark("overview");
+ await sleep(650);
+ setPoster();
+
+ mark("table");
+ await page.mouse.move(620, 420);
+ await page.mouse.wheel(0, 260);
+ await sleep(950);
+
+ mark("diff");
+ await page.mouse.wheel(0, 260);
+ await sleep(1050);
+ });
+ },
+
+ "resolve-thread": async (browser, theme) => {
+ const issue = await api("POST", "/api/issues", {
+ title: "Choose pagination cursor format for /v2/issues",
+ description: "Decide between opaque base64 cursors and offset tokens before freezing the v2 API spec.",
+ status: "in_review",
+ priority: "medium",
+ allow_duplicate: true,
+ });
+ const root = await api("POST", `/api/issues/${issue.id}/comments`, {
+ content: "Should `/v2/issues` use opaque base64 cursors or numeric offsets?",
+ });
+ await api("POST", `/api/issues/${issue.id}/comments`, {
+ content: "Opaque base64 keyset cursors avoid skipped rows when issues move between statuses under concurrent writes.",
+ parent_id: root.id,
+ });
+ await api("POST", `/api/issues/${issue.id}/comments`, {
+ content: "Agreed — freezing keyset cursors in the v2 OpenAPI spec.",
+ parent_id: root.id,
+ });
+
+ return recordClip(browser, "resolve-thread", theme, `/issues/${issue.identifier}`, async ({ page, mark, setPoster }) => {
+ mark("thread");
+ await sleep(650);
+ setPoster();
+
+ mark("resolve");
+ // Hover the root comment so the action menu button becomes visible
+ const rootText = page.getByText("opaque base64 cursors or numeric offsets", { exact: false }).first();
+ const box = await rootText.boundingBox();
+ if (box) await moveCursor(page, Math.round(box.x + 120), Math.round(box.y));
+ await sleep(250);
+ await clickButtonInZone(page, /Comment actions|More/i, { minX: 360, maxX: 900, minY: 280, maxY: 600, pauseAfter: 450 });
+ await clickPopoverItem(page, /Resolve thread/i, { pauseAfter: 850 });
+
+ mark("collapsed");
+ await sleep(850);
+ });
+ },
+
+ chat: async (browser, theme) => {
+ clearStaleQueuedTasks();
+ const session = await api("POST", "/api/chat/sessions", {
+ agent_id: ctx.engineer.id,
+ title: "Release readiness check",
+ });
+ return recordClip(browser, "chat", theme, `/chat?session=${encodeURIComponent(session.id)}`, async ({ page, mark, setPoster }) => {
+ mark("prompt");
+ await sleep(450);
+ const box = page.locator('textarea, [contenteditable="true"]').last();
+ await smoothClick(page, box, { pauseAfter: 120 });
+ await page.keyboard.type("List our open high-priority issues and flag any blockers before v0.13.", { delay: 14 });
+ await sleep(250);
+ // Click the round send button at bottom-right of chat composer
+ const sendBtn = page.locator('button[aria-label*="Send" i], button[type="submit"]').last();
+ if (!(await trySmoothClick(page, sendBtn, { pauseAfter: 450 }))) {
+ await page.keyboard.press("Meta+Enter");
+ await sleep(450);
+ }
+
+ mark("thinking");
+ const task = await claimTaskMatching(() => true, 5000);
+ if (task) {
+ await startTask(task.id);
+ await sleep(750);
+ mark("reply");
+ await completeTask(
+ task.id,
+ `Three high-priority issues remain before **v0.13**:\n\n| Issue | Status | Note |\n| --- | --- | --- |\n| Rate-limit \`/v2/search\` | In Review | PR checks green |\n| Retry webhook deliveries | Todo | Needs backoff cap decision |\n| Slow claims on \`cloud-pool-b\` | In Progress | Cache pre-warm patch in testing |`,
+ );
+ await sleep(1100);
+ setPoster();
+ } else {
+ setPoster();
+ await sleep(800);
+ }
+ });
+ },
+
+ "create-agent": async (browser, theme) => {
+ return recordClip(browser, "create-agent", theme, "/agents", async ({ page, mark, setPoster }) => {
+ mark("start");
+ await sleep(500);
+ const newBtn = page.getByRole("button", { name: /New agent|Create agent/i }).or(page.getByRole("link", { name: /New agent|Create agent/i })).first();
+ await trySmoothClick(page, newBtn, { pauseAfter: 650 });
+
+ mark("runtime");
+ // Wait for wizard Step 1 heading, expand Maya's MacBook Pro if collapsed, then pick Claude Code 2.1.0
+ await page.getByText("Where should this agent run?").waitFor({ state: "visible", timeout: 5000 }).catch(() => {});
+ const versionRow = page.getByText(/2\.1\.0/).first();
+ if (!(await versionRow.isVisible().catch(() => false))) {
+ await trySmoothClick(page, page.getByText("Maya's MacBook Pro", { exact: false }).first(), { pauseAfter: 500 });
+ }
+ await trySmoothClick(page, page.getByText(/2\.1\.0/).first(), { pauseAfter: 500 });
+ await trySmoothClick(page, page.getByRole("button", { name: /^Next/i }).first(), { pauseAfter: 750 });
+
+ mark("configure");
+ const nameInput = page.locator('input[placeholder*="name" i], input[name="name"], input[type="text"]').first();
+ if (await nameInput.isVisible({ timeout: 2500 }).catch(() => false)) {
+ await smoothClick(page, nameInput, { pauseAfter: 120 });
+ await page.keyboard.type("Release QA", { delay: 18 });
+ await sleep(500);
+ setPoster();
+ await sleep(550);
+ } else {
+ setPoster();
+ await sleep(750);
+ }
+ });
+ },
+
+ project: async (browser, theme) => {
+ return recordClip(browser, "project", theme, `/projects/${ctx.project.id}`, async ({ page, mark, setPoster }) => {
+ mark("overview");
+ await sleep(750);
+ setPoster();
+
+ mark("issues");
+ if (!(await clickButtonInZone(page, /^Issues/i, { minX: 300, maxY: 80, pauseAfter: 900 }))) {
+ await trySmoothClick(page, page.getByRole("tab", { name: /^Issues/i }).first(), { pauseAfter: 900 });
+ }
+
+ mark("resources");
+ if (!(await clickButtonInZone(page, /^Activity$/i, { minX: 300, maxY: 80, pauseAfter: 900 }))) {
+ await clickButtonInZone(page, /^Overview$/i, { minX: 300, maxY: 80, pauseAfter: 900 });
+ }
+ });
+ },
+
+ skill: async (browser, theme) => {
+ return recordClip(browser, "skill", theme, "/skills", async ({ page, mark, setPoster }) => {
+ mark("list");
+ await sleep(600);
+ await trySmoothClick(page, page.getByText("tdd", { exact: true }).first(), { pauseAfter: 850 });
+
+ mark("detail");
+ setPoster();
+ await sleep(850);
+
+ mark("mounted");
+ await page.mouse.wheel(0, 220);
+ await sleep(850);
+ });
+ },
+
+ squad: async (browser, theme) => {
+ clearStaleQueuedTasks();
+ const issue = await api("POST", "/api/issues", {
+ title: "Ship webhook signing key rotation with zero downtime",
+ description: "Support dual-key verification during rotation, review edge cases, and update webhook docs.",
+ status: "todo",
+ priority: "high",
+ project_id: ctx.project?.id,
+ allow_duplicate: true,
+ });
+ return recordClip(browser, "squad", theme, "/squads", async ({ page, mark, setPoster }) => {
+ mark("list");
+ await sleep(550);
+ await trySmoothClick(page, page.getByText("Platform Team", { exact: false }).first(), { pauseAfter: 750 });
+
+ mark("detail");
+ setPoster();
+ await sleep(850);
+
+ mark("workflow");
+ // Navigate to the issue and assign it to Platform Team so Engineer (leader) starts coordinating
+ await page.goto(`${base}/${slug}/issues/${issue.identifier}`, { waitUntil: "domcontentloaded", timeout: 30_000 });
+ await page.locator('[data-testid="comment-composer-shell"]').first().waitFor({ state: "visible", timeout: 10_000 }).catch(() => {});
+ await sleep(500);
+ await injectCursor(page);
+ await clickButtonInZone(page, /Unassigned|Assignee/i, { minX: 860, pauseAfter: 450 });
+ await clickPopoverItem(page, /Platform Team/i, { pauseAfter: 450 });
+ const confirmBtn = page.getByRole("button", { name: /Confirm assignment/i });
+ if (await confirmBtn.isVisible({ timeout: 2000 }).catch(() => false)) {
+ await smoothClick(page, confirmBtn, { pauseAfter: 450 });
+ }
+ const task = await claimTaskMatching((t) => t.issue_id === issue.id, 5000);
+ if (task) {
+ const asAgent = task.auth_token ? { Authorization: `Bearer ${task.auth_token}` } : {};
+ await startTask(task.id);
+ await api("PUT", `/api/issues/${issue.id}`, { status: "in_progress" }, asAgent);
+ await api("POST", `/api/issues/${issue.id}/comments`, {
+ content: "Squad plan: Engineer implements dual-key verification, then Reviewer audits the PR and Docs updates the webhook guide.",
+ }, asAgent);
+ await completeTask(task.id, "Coordinated squad handoff.");
+ await sleep(1000);
+ } else {
+ await sleep(850);
+ }
+ });
+ },
+
+ autopilot: async (browser, theme) => {
+ clearStaleQueuedTasks();
+ return recordClip(browser, "autopilot", theme, "/autopilots", async ({ page, mark, setPoster }) => {
+ mark("list");
+ await sleep(550);
+ await trySmoothClick(page, page.getByText("Weekly dead-code audit", { exact: false }).first(), { pauseAfter: 750 });
+
+ mark("detail");
+ await sleep(750);
+
+ mark("run");
+ await trySmoothClick(page, page.getByRole("button", { name: /Run now/i }).first(), { pauseAfter: 1200 });
+ // Complete the triggered autopilot run so Run history shows the created issue live
+ const task = await claimTaskMatching(() => true, 4500);
+ if (task) {
+ const asAgent = task.auth_token ? { Authorization: `Bearer ${task.auth_token}` } : {};
+ await startTask(task.id);
+ if (task.issue_id) {
+ await api("POST", `/api/issues/${task.issue_id}/comments`, {
+ content: "Audit complete: found 3 unused exports in `packages/core/legacy` and 1 stale flag ready for removal.",
+ }, asAgent);
+ }
+ await completeTask(task.id, "Weekly dead-code audit completed.");
+ }
+ await sleep(900);
+ setPoster();
+ // Click the linked issue link in Run history if visible to show the created issue
+ const linkedIssue = page.locator("a, button").filter({ hasText: /Weekly audit|Issue linked/i }).first();
+ await trySmoothClick(page, linkedIssue, { pauseAfter: 950 });
+ });
+ },
+
+ wakeup: async (browser, theme) => {
+ clearStaleQueuedTasks();
+ const issue = await api("POST", "/api/issues", {
+ title: "Verify canary error rate 1 hour after deploy",
+ description: "Check p99 latency and 5xx rate once EU canary has served traffic for an hour.",
+ status: "in_progress",
+ priority: "medium",
+ assignee_type: "member",
+ assignee_id: ctx.me.id,
+ allow_duplicate: true,
+ });
+ return recordClip(browser, "wakeup", theme, `/issues/${issue.identifier}`, async ({ page, mark, setPoster }) => {
+ mark("sidebar");
+ await sleep(550);
+ // Slimmed sidebar (#11352): empty Wakeups section is opened via issue-sidebar-add-row
+ const addRow = page.locator('[data-testid="issue-sidebar-add-row"] button').first();
+ if (await addRow.isVisible({ timeout: 2500 }).catch(() => false)) {
+ await smoothClick(page, addRow, { pauseAfter: 450 });
+ // If multiple addable sections exist, pick Wakeup from the menu
+ const wakeItem = page.getByRole("menuitem", { name: /Wakeup/i }).first();
+ if (await wakeItem.isVisible({ timeout: 1200 }).catch(() => false)) {
+ await smoothClick(page, wakeItem, { pauseAfter: 550 });
+ }
+ } else {
+ await trySmoothClick(page, page.getByRole("button", { name: /Add wakeup/i }).first(), { pauseAfter: 550 });
+ }
+
+ mark("configure");
+ // Choose condition: At a time (defaults to In 1 hour)
+ const condBtn = page.getByRole("button", { name: /Choose a condition/i }).first();
+ await trySmoothClick(page, condBtn, { pauseAfter: 400 });
+ const atItem = page.getByRole("menuitem", { name: /At a time/i }).first();
+ await trySmoothClick(page, atItem, { pauseAfter: 450 });
+
+ // Choose agent: Engineer
+ const agentBtn = page.getByRole("button", { name: /Choose an agent/i }).first();
+ await trySmoothClick(page, agentBtn, { pauseAfter: 400 });
+ await clickPopoverItem(page, /^Engineer$/, { pauseAfter: 400 });
+
+ // Fill instruction
+ const instr = page.locator('form textarea').first();
+ if (await instr.isVisible({ timeout: 2000 }).catch(() => false)) {
+ await smoothClick(page, instr, { pauseAfter: 120 });
+ await page.keyboard.type("Check EU canary p99 latency and 5xx rate, then post a summary.", { delay: 14 });
+ await sleep(450);
+ }
+ setPoster();
+
+ mark("saved");
+ const createBtn = page.locator('form button[type="submit"]').last();
+ await trySmoothClick(page, createBtn, { pauseAfter: 1100 });
+ });
+ },
+
+ "quick-action": async (browser, theme) => {
+ clearStaleQueuedTasks();
+ const issue = await api("POST", "/api/issues", {
+ title: "Refactor OAuth token refresh locking",
+ description: "Prevent thundering herd refresh calls when multiple tabs wake from sleep.",
+ status: "in_review",
+ priority: "high",
+ allow_duplicate: true,
+ });
+ return recordClip(browser, "quick-action", theme, `/issues/${issue.identifier}`, async ({ page, mark, setPoster }) => {
+ mark("sidebar");
+ await sleep(600);
+ setPoster();
+
+ mark("trigger");
+ await clickButtonInZone(page, /PR review/i, { minX: 860, pauseAfter: 700 });
+
+ mark("run");
+ const sendBtn = page.getByRole("button", { name: /Run|Send|Confirm/i }).last();
+ await trySmoothClick(page, sendBtn, { pauseAfter: 900 });
+ });
+ },
+
+ "pr-link": async (browser, theme) => {
+ const issue = await api("POST", "/api/issues", {
+ title: "Highlight actionable UI areas in tutorial screenshots",
+ description: "Add soft spotlight crops and numbered badges to Complete tutorial screenshots.",
+ status: "in_review",
+ priority: "medium",
+ project_id: ctx.project?.id,
+ allow_duplicate: true,
+ });
+ // Seed the synced GitHub PR row in the local DB WITHOUT linking it yet so the UI links it live
+ psql(`
+ INSERT INTO github_pull_request (
+ workspace_id, installation_id, repo_owner, repo_name, pr_number,
+ title, state, html_url, branch, author_login,
+ pr_created_at, pr_updated_at, head_sha, mergeable_state,
+ additions, deletions, changed_files
+ ) VALUES (
+ '${profile.workspace_id}', 1001, 'multica-ai', 'multica', 11306,
+ 'Highlight actionable UI areas in tutorial screenshots', 'open',
+ 'https://github.com/multica-ai/multica/pull/11306', 'feat/tutorial-spotlights', 'engineer-bot',
+ NOW() - INTERVAL '2 hours', NOW() - INTERVAL '5 minutes', '665b4cd8e1a', 'clean',
+ 184, 42, 6
+ )
+ ON CONFLICT (workspace_id, repo_owner, repo_name, pr_number) DO UPDATE SET
+ title = EXCLUDED.title, state = EXCLUDED.state;
+ `);
+
+ return recordClip(browser, "pr-link", theme, `/issues/${issue.identifier}`, async ({ page, mark, setPoster }) => {
+ mark("panel");
+ await sleep(550);
+ // Slimmed sidebar (#11352): open Pull request link form via issue-sidebar-add-row
+ const addRow = page.locator('[data-testid="issue-sidebar-add-row"] button').first();
+ if (await addRow.isVisible({ timeout: 2500 }).catch(() => false)) {
+ await smoothClick(page, addRow, { pauseAfter: 450 });
+ const prItem = page.getByRole("menuitem", { name: /Pull request/i }).first();
+ if (await prItem.isVisible({ timeout: 1200 }).catch(() => false)) {
+ await smoothClick(page, prItem, { pauseAfter: 550 });
+ }
+ }
+
+ mark("add");
+ const urlInput = page.locator('input[inputmode="url"], input[id^="link-pr-"]').first();
+ if (await urlInput.isVisible({ timeout: 2500 }).catch(() => false)) {
+ await smoothClick(page, urlInput, { pauseAfter: 120 });
+ await page.keyboard.type("https://github.com/multica-ai/multica/pull/11306", { delay: 14 });
+ await sleep(450);
+ const submitBtn = page.locator('form button[type="submit"]').last();
+ await trySmoothClick(page, submitBtn, { pauseAfter: 900 });
+ }
+
+ mark("synced");
+ await sleep(950);
+ setPoster();
+ });
+ },
+
+ usage: async (browser, theme) => {
+ return recordClip(browser, "usage", theme, "/usage", async ({ page, mark, setPoster }) => {
+ mark("overview");
+ await sleep(850);
+ setPoster();
+
+ mark("metrics");
+ await clickButtonInZone(page, /^Cost$/, { minX: 600, maxY: 450, pauseAfter: 950 });
+
+ mark("errors");
+ const errorsTab = page.getByRole("tab", { name: /^Errors$/i }).first();
+ if (!(await trySmoothClick(page, errorsTab, { pauseAfter: 1100 }))) {
+ await trySmoothClick(page, page.getByText(/^Errors$/).first(), { pauseAfter: 1100 });
+ }
+ });
+ },
+ };
+}
+
+function writeManifest(manifest) {
+ writeFileSync(manifestJsonPath, `${JSON.stringify(manifest, null, 2)}\n`);
+ const ts = `// Auto-generated by scripts/docs-demos/record.mjs — do not edit by hand.
+export interface ClipManifestTiming {
+ duration: number;
+ chapters: { id: string; at: number }[];
+}
+
+export interface ClipManifestEntry extends ClipManifestTiming {
+ dark?: ClipManifestTiming;
+}
+
+export const CLIP_MANIFEST: Record<string, ClipManifestEntry> = ${JSON.stringify(manifest, null, 2)};
+`;
+ writeFileSync(manifestTsPath, ts);
+}
+
+async function main() {
+ const existingManifest = existsSync(manifestJsonPath)
+ ? JSON.parse(readFileSync(manifestJsonPath, "utf8"))
+ : {};
+ const shared = await seedShared();
+ const scenarios = buildScenarios(shared);
+ const browser = await chromium.launch();
+
+ try {
+ const names = Object.keys(scenarios).filter((n) => !onlySet || onlySet.has(n));
+ for (const name of names) {
+ log(`=== Recording ${name} ===`);
+ const light = await scenarios[name](browser, "light");
+ const dark = await scenarios[name](browser, "dark");
+ existingManifest[name] = {
+ duration: light.duration,
+ chapters: light.marks,
+ dark: {
+ duration: dark.duration,
+ chapters: dark.marks,
+ },
+ };
+ writeManifest(existingManifest);
+ }
+ } finally {
+ if (heartbeatTimer) clearInterval(heartbeatTimer);
+ await browser.close();
+ }
+
+ log(`Done! Manifest written to ${manifestTsPath}`);
+}
+
+main().catch((err) => {
+ console.error(err);
+ process.exit(1);
+});