Skip to content

A local-first multi-agent app development platform, built on PenguinHarness

refactor(web): 新建对话页去掉底部的示例任务区块

lmliheng53f63077d4ec
diff --git a/packages/web/src/features/chat/draft-view.tsx b/packages/web/src/features/chat/draft-view.tsx
index c21e9b62..878e8f39 100644
--- a/packages/web/src/features/chat/draft-view.tsx
+++ b/packages/web/src/features/chat/draft-view.tsx
@@ -56,7 +56,6 @@ import {
AgentAvatar,
Chevron,
Dropdown,
- ICONS,
MenuItem,
AppLogo,
toastError,
@@ -80,10 +79,7 @@ import type { ComposerControl } from "./chat-input";
import { APPROVAL_MODES } from "./approval-mode";
import { adoptDockScope } from "../dock/dock-state";
import { setDockCwd } from "../dock/dock-terminal";
-import { EXAMPLE_FOLDERS } from "./example-tasks";
-import type { ExampleFolderId, ExampleTask } from "./example-tasks";
-import { ExampleFolderRow, exampleRowClass } from "./example-folder-row";
-import { SHORTCUTS_FOLDER_ID, ShortcutsFolder } from "./shortcuts-folder";
+import { ShortcutsFolder } from "./shortcuts-folder";
import { clearDraft, draftKey, loadDraft, saveDraft } from "./draft-cache";
import type { DraftCache } from "./draft-cache";
import {
@@ -132,25 +128,6 @@ function saveAppliedRouteKey(field: RouteStateField, key: string): void {
}
}
-/**
- * One glyph per example folder, 16×16. Icons live on the folder rather than on each example:
- * with the examples reduced to single-line titles, a column of per-row icons was noise
- * competing with the titles, while the folder row is exactly where a glyph earns its place —
- * it is what you scan to pick a category.
- *
- * webapps: a browser window (chrome bar + two dots). agents: the registry's robot itself — the
- * one glyph in the app that means "agent", worn by the sidebar's Agents entry and its grouping
- * option — imported rather than copied, because a hand-copied duplicate is what silently drifts
- * the day that glyph is redrawn. schedules: a clock face with hands — the plainest mark for
- * "fires on a timer", and distinct from the hourglass that already means a Session is waiting.
- */
-const FOLDER_GLYPHS: Record<ExampleFolderId, string> = {
- webapps:
- "M3 6a2 2 0 0 1 2-2h14a2 2 0 0 1 2 2v12a2 2 0 0 1-2 2H5a2 2 0 0 1-2-2V6zM3 9h18M6 6.5h.01M9 6.5h.01",
- agents: ICONS.robot,
- schedules: "M12 2a10 10 0 1 0 0 20 10 10 0 1 0 0-20M12 6.5V12l3.5 2",
-};
-
export function DraftView({
projectId,
models,
@@ -523,11 +500,8 @@ export function DraftView({
// mount render would trigger ChatInput's pruning effect and wrongly clear the
// quick-invoke preselection.
const [agentSkills, setAgentSkills] = useState<SkillMetadataItem[]>([]);
- /** Whether the skills fetch for the current Agent has settled — the example task waits for it so its `[use_skills]` pinning doesn't silently depend on network timing. */
- const [skillsLoaded, setSkillsLoaded] = useState(false);
useEffect(() => {
setAgentSkills((prev) => (prev.length > 0 ? [] : prev));
- setSkillsLoaded(false);
if (!agentId) return;
let cancelled = false;
api
@@ -535,10 +509,7 @@ export function DraftView({
.then((res) => {
if (!cancelled) setAgentSkills(res.skills);
})
- .catch(() => undefined)
- .finally(() => {
- if (!cancelled) setSkillsLoaded(true);
- });
+ .catch(() => undefined);
return () => {
cancelled = true;
};
@@ -825,40 +796,32 @@ export function DraftView({
);
/**
- * Example tasks: a click FILLS the composer — the prompt into the text body, the example's
- * skills into the skills dropdown — and sends nothing. The user reads what landed, edits it
- * if they want, and presses Send, which then builds the very message this card used to
- * submit by itself (the `[use_skills]` block is the send path's job, so the textarea never
- * shows a marker block). Filling is instant and local: there is no busy state and no
- * in-flight guard to keep here, and everything else — where the prompt goes when text is
- * already typed, focus, the caret — is the composer's, reached through this handle.
+ * The composer handle this page drives. The dock's panels reach the same draft through it,
+ * and the shortcuts folder below the input card fills the composer with it.
*/
const ownComposerRef = useRef<ComposerControl | null>(null);
const composerRef = pageComposerRef ?? ownComposerRef;
- const fillExample = useCallback((task: ExampleTask) => {
- // S is a live binding swapped on locale change: read the prompt at click time, not at render.
- composerRef.current?.fillPrompt(S.chat.exampleTasks[task.id].prompt, task.skills);
- }, []);
/**
- * A saved shortcut takes the same path with no Skills to pin: its prompt is the user's own text,
- * not a card authored against the Skill catalog this product ships (see user-shortcuts.ts). An
- * empty pin list leaves the composer's Skill selection exactly as the user set it.
+ * A saved shortcut FILLS the composer — its prompt into the text body, no Skills pinned —
+ * and sends nothing; the user reads what landed, edits it if they want, and presses Send.
+ * Filling is instant and local: there is no busy state and no in-flight guard to keep here,
+ * and everything else — where the prompt goes when text is already typed, focus, the caret —
+ * is the composer's, reached through this handle. No Skills are pinned because the prompt is
+ * the user's own text, not a card authored against the Skill catalog this product ships (see
+ * user-shortcuts.ts).
*/
const fillShortcut = useCallback((prompt: string) => {
composerRef.current?.fillPrompt(prompt, []);
}, []);
/**
- * The open example folder — bookmark-style, and ALWAYS exactly one: selecting another closes
- * the previous, and clicking the open one is a no-op rather than collapsing it. Never
- * nullable on purpose. With the folders kept within one row of each other, "one open" is
- * what keeps the block's height near-constant: the examples area can neither collapse to
- * bare folder rows nor grow to the whole catalog, so switching folders moves what sits
- * below it by at most one row.
+ * Whether the shortcuts folder below the input card is open. Closed on arrival: the new-chat
+ * screen offers nothing to click but the input card, and a block of canned or saved prompts
+ * under it is one more thing to read past. Opening it is a one-way move — the row is a tab,
+ * not a disclosure (see shortcuts-folder.tsx), and with a single folder there is nothing to
+ * switch to.
*/
- const [openFolder, setOpenFolder] = useState<ExampleFolderId | typeof SHORTCUTS_FOLDER_ID>(
- EXAMPLE_FOLDERS[0].id,
- );
+ const [shortcutsOpen, setShortcutsOpen] = useState(false);
const selectedAgent = agents.find((a) => a.agentId === agentId) ?? null;
@@ -870,11 +833,11 @@ export function DraftView({
return (
<div className="anim-fade flex min-h-0 flex-1 flex-col overflow-y-auto px-3 py-6 md:px-4">
{/*
- * Vertical layout: everything visible — brand, input card, ownership pills, example tasks —
- * lives in ONE block between two empty flex-1 spacers, so the block is centred and the free
- * space above and below it is exactly equal. The brand deliberately sits inside that block
- * rather than in the upper spacer: keeping it in the spacer made the upper gap shorter than
- * the lower one by the brand's own height, which pushed the card up the viewport and left
+ * Vertical layout: everything visible — brand, input card, ownership pills, the shortcuts
+ * folder — lives in ONE block between two empty flex-1 spacers, so the block is centred and
+ * the free space above and below it is exactly equal. The brand deliberately sits inside that
+ * block rather than in the upper spacer: keeping it in the spacer made the upper gap shorter
+ * than the lower one by the brand's own height, which pushed the card up the viewport and left
* the slash menu — it opens upward, `bottom-full` — too little room, so it clipped against
* the top of this scroll container. When the viewport is too short the spacers collapse to
* nothing, the container's own py-6 keeps the content off the edges, and the page falls back
@@ -951,59 +914,14 @@ export function DraftView({
<FilesPanelToggle available={workspace.trim() !== ""} />
</div>
- {/* Example tasks: canned builds showing off the one-sentence → app flow; a click fills
- the composer with the prompt and the user sends it (see fillPrompt). The last folder
- is the user's own saved prompts (see shortcuts-folder.tsx).
- Bookmark-style folders with ALWAYS exactly one open — selecting another closes the
- previous, and the open one cannot be collapsed. The block is therefore four folder
- rows plus one folder's rows, with every folder kept within one row of the others
- (3–4 examples each; the user folder is capped so its shortcuts plus its add row come
- to the same), so switching folders moves what sits below by at most one row and no
- folder needs a scroll container — a scrollbar inside a short showcase reads as a
- defect. Each example is a single-line title; its one-sentence description rides in
- the row tooltip rather than a second line. Rows stay disabled until the Agent's
- installed skills are known — that is all a fill still waits for, and without it the
- preselect would silently drop the example's skills (a saved shortcut pins none, so
- it never waits). */}
+ {/* The user's own saved prompts, the only folder left under the input card (see
+ shortcuts-folder.tsx): a click fills the composer with the prompt and the user
+ sends it. Closed on arrival, so the new-chat screen is the brand, the input card
+ and the two ownership pills unless the reader asks for more. */}
<div className="mt-6 space-y-1">
- {EXAMPLE_FOLDERS.map((folder) => {
- const open = folder.id === openFolder;
- return (
- <div key={folder.id}>
- <ExampleFolderRow
- open={open}
- glyph={FOLDER_GLYPHS[folder.id]}
- label={S.chat.exampleFolders[folder.id]}
- count={folder.tasks.length}
- onOpen={() => setOpenFolder(folder.id)}
- />
-
- {open && (
- <ul className="mt-0.5 space-y-1 pl-4">
- {folder.tasks.map((task) => {
- const copy = S.chat.exampleTasks[task.id];
- return (
- <li key={task.id}>
- <button
- type="button"
- data-tooltip={`${copy.desc}\n${S.chat.exampleFillHint}`}
- disabled={!skillsLoaded}
- onClick={() => fillExample(task)}
- className={`flex w-full items-center gap-2 ${exampleRowClass}`}
- >
- <span className="min-w-0 flex-1 truncate">{copy.label}</span>
- </button>
- </li>
- );
- })}
- </ul>
- )}
- </div>
- );
- })}
<ShortcutsFolder
- open={openFolder === SHORTCUTS_FOLDER_ID}
- onOpen={() => setOpenFolder(SHORTCUTS_FOLDER_ID)}
+ open={shortcutsOpen}
+ onOpen={() => setShortcutsOpen(true)}
readComposerText={() => textRef.current}
onFill={fillShortcut}
/>
diff --git a/packages/web/src/features/chat/example-tasks.ts b/packages/web/src/features/chat/example-tasks.ts
deleted file mode 100644
index 2fdfa42a..00000000
--- a/packages/web/src/features/chat/example-tasks.ts
+++ /dev/null
@@ -1,62 +0,0 @@
-/**
- * Draft-screen example cards, filed into collapsible folders in display order.
- *
- * Folders are what lets the showcase grow past a flat list: exactly ONE folder is open at a
- * time (bookmark-style — opening one closes the other), so the block's height is one row per
- * folder plus the open folder's own rows, never the whole catalog. Adding an example means
- * appending it to the folder it belongs to, not lengthening the page.
- *
- * Keep the folders within one row of each other (3–4 examples each today): the draft page
- * reserves no scroll area for this block, so its height is the folder rows plus the open
- * folder's rows — a folder much longer than its siblings is what would make that height jump
- * as folders are switched. The draft screen appends one more folder that this registry does not
- * describe — the user's own saved shortcuts, whose length is theirs and not ours; it is exempt
- * from the rule by capping how many shortcuts it holds, not by scrolling (shortcuts-folder.tsx).
- *
- * Copy and prompts live in the active locale dictionary at `S.chat.exampleFolders[id]` and
- * `S.chat.exampleTasks[id]`, which is also where the rule for how long a prompt may get is
- * stated. Skills listed here are preselected in the composer only when the selected Agent has
- * them installed; an empty list fills the prompt alone.
- */
-export const EXAMPLE_FOLDERS = [
- {
- id: "webapps",
- tasks: [
- { id: "game", skills: ["web-design"] },
- { id: "gamecenter", skills: ["web-design"] },
- { id: "lol", skills: ["web-design"] },
- { id: "rhythmRunner", skills: ["web-design"] },
- ],
- },
- {
- id: "agents",
- tasks: [
- { id: "investmentCopilot", skills: ["penguin-sdk", "web-design"] },
- { id: "missionControl", skills: ["penguin-sdk", "web-design"] },
- { id: "agentBenchmarkBuild", skills: [] },
- { id: "agentOptimization", skills: [] },
- ],
- },
- {
- id: "schedules",
- tasks: [
- { id: "dailyPlan", skills: [] },
- { id: "githubDigest", skills: [] },
- { id: "memoryReview", skills: [] },
- ],
- },
-] as const;
-
-export type ExampleFolder = (typeof EXAMPLE_FOLDERS)[number];
-export type ExampleFolderId = ExampleFolder["id"];
-export type ExampleTask = ExampleFolder["tasks"][number];
-export type ExampleTaskId = ExampleTask["id"];
-
-/**
- * Flat view of every example across folders, in display order. The folders drive the UI; this
- * is for whole-catalog work that doesn't care which folder an example sits in — looking one up
- * by id, or asserting across all of them.
- */
-export const EXAMPLE_TASKS: readonly ExampleTask[] = EXAMPLE_FOLDERS.flatMap((folder) => [
- ...folder.tasks,
-]);
diff --git a/packages/web/src/features/chat/example-folder-row.tsx b/packages/web/src/features/chat/folder-row.tsx
similarity index 66%
rename from packages/web/src/features/chat/example-folder-row.tsx
rename to packages/web/src/features/chat/folder-row.tsx
index 41d170f7..87a03f33 100644
--- a/packages/web/src/features/chat/example-folder-row.tsx
+++ b/packages/web/src/features/chat/folder-row.tsx
@@ -1,15 +1,10 @@
/**
- * The header row of one draft-screen example folder.
- *
- * A tab, not a disclosure: the open folder stays open (clicking it is a no-op) and carries the
- * block's whole body, so exactly one folder's rows are ever on screen. It lives in its own module
- * because two callers render it — the built-in folders in draft-view.tsx and the user's own
- * shortcuts folder in shortcuts-folder.tsx — and a folder row that reads differently from its
- * neighbours would be read as a different kind of thing.
+ * The header row of the draft screen's folder of saved prompts: a tab, not a disclosure — the
+ * open folder stays open (clicking it is a no-op) and carries the body below it.
*/
import { Chevron, ICON_SIZE } from "@lmliheng/penguin-ui";
-export function ExampleFolderRow({
+export function FolderRow({
open,
glyph,
label,
@@ -58,11 +53,10 @@ export function ExampleFolderRow({
}
/**
- * The class string of one row inside an open folder — an example, or a saved shortcut. Shared for
- * the same reason as the header: the two lists sit in the same block and must read as one list
- * shape. Layout (flex, width) is the caller's, since a shortcut row also carries its own actions.
+ * The class string of one shortcut row — shared with the header above so the two read as one
+ * block. Layout (flex, width) is the caller's, since a row also carries its own actions.
*/
-export const exampleRowClass =
+export const folderRowClass =
"rounded-md px-2 py-1.5 text-left text-sm text-gray-600 transition-colors duration-150 " +
"hover:bg-gray-100 hover:text-gray-900 disabled:cursor-default disabled:opacity-60 " +
"disabled:hover:bg-transparent dark:text-gray-400 dark:hover:bg-gray-800/70 dark:hover:text-gray-200";
diff --git a/packages/web/src/features/chat/shortcuts-folder.tsx b/packages/web/src/features/chat/shortcuts-folder.tsx
index 108e82f6..babe922b 100644
--- a/packages/web/src/features/chat/shortcuts-folder.tsx
+++ b/packages/web/src/features/chat/shortcuts-folder.tsx
@@ -1,18 +1,15 @@
/**
- * The examples block's last folder: the shortcuts the user saved themselves.
+ * The folder under the new-chat input card: the shortcuts the user saved themselves.
*
- * It behaves like a built-in folder on the way out — a click FILLS the composer and sends
- * nothing — and differs from one in three ways, each of which is why it lives here rather than in
- * the registry:
+ * A click FILLS the composer and sends nothing — the composer keeps the text until the user
+ * sends it. Three things about it are its own rather than a built-in folder's:
*
* - **Its rows are server state**, per user (`ui_prefs.draftShortcuts`), fetched on mount and
* written back on every change. Optimistic: the list updates first and rolls back with a toast
* if the write fails, because the value being written is already on screen.
- * - **Its length is the user's**, not the registry's — but bounded to SHORTCUT_MAX_COUNT, chosen
- * so the folder plus its New-shortcut row stays within a row of a built-in folder's height. The
- * examples block reserves no scroll area, and rather than pinning a height and scrolling inside
- * it, the cap is what keeps this folder the same shape as its siblings: no scrollbar, and the
- * block below moves by at most one row.
+ * - **Its length is the user's**, bounded to SHORTCUT_MAX_COUNT. There is no scroll area and no
+ * pinned height: past the cap the New-shortcut row is what the editor refuses, so the folder
+ * cannot grow into a list that needs scrolling.
* - **Its rows carry their own actions.** Edit and delete are plain icon buttons that are always
* visible, deliberately not the sidebar's hover-revealed pair: those rows have a long-press menu
* behind them on touch, and these have nothing, so hover-gating would put a user's own prompts
@@ -34,7 +31,7 @@ import {
import * as api from "../../api/endpoints";
import { S } from "../../lib/strings";
import { apiErrorText } from "../../lib/api-error";
-import { ExampleFolderRow, exampleRowClass } from "./example-folder-row";
+import { FolderRow, folderRowClass } from "./folder-row";
import {
SHORTCUT_MAX_COUNT,
SHORTCUT_PROMPT_MAX,
@@ -49,16 +46,9 @@ import {
import type { ShortcutDraft, UserShortcut } from "./user-shortcuts";
/**
- * Folder id for the user's shortcuts. Not a member of EXAMPLE_FOLDERS: that registry is the
- * catalog this product ships, and everything in it resolves its copy through the locale
- * dictionary — this folder's rows are the user's own text in whatever language they wrote it.
- */
-export const SHORTCUTS_FOLDER_ID = "shortcuts";
-
-/**
- * Lightning bolt (lucide zap): the folder's mark. Not the bookmark it might suggest — the folders
- * themselves already behave bookmark-style (exactly one open), so that glyph would name the
- * mechanism every folder shares instead of what this one holds.
+ * Lightning bolt (lucide zap): the folder's mark. Not the bookmark it might suggest — the row
+ * itself already behaves bookmark-style (open once, then it stays open), so that glyph would
+ * name the mechanism instead of what this folder holds.
*/
const SHORTCUTS_GLYPH =
"M4 14a1 1 0 0 1-.78-1.63l9.9-10.2a.5.5 0 0 1 .86.46l-1.92 6.02A1 1 0 0 0 13 10h7a1 1 0 0 1 .78 1.63l-9.9 10.2a.5.5 0 0 1-.86-.46l1.92-6.02A1 1 0 0 0 11 14z";
@@ -157,7 +147,7 @@ export function ShortcutsFolder({
return (
<div>
- <ExampleFolderRow
+ <FolderRow
open={open}
glyph={SHORTCUTS_GLYPH}
label={S.chat.shortcuts.folder}
@@ -166,8 +156,8 @@ export function ShortcutsFolder({
/>
{open && (
- /* No fixed height and no scroll: SHORTCUT_MAX_COUNT bounds this folder to a built-in
- folder's height plus the New-shortcut row. */
+ /* No fixed height and no scroll: SHORTCUT_MAX_COUNT bounds the folder, so it cannot grow
+ into a list that needs one. */
<div className="mt-0.5 pl-4">
{loaded && (
<ul className="space-y-1">
@@ -175,9 +165,9 @@ export function ShortcutsFolder({
<li key={shortcut.id} className="flex items-center gap-1">
<button
type="button"
- data-tooltip={`${shortcut.title}\n${S.chat.exampleFillHint}`}
+ data-tooltip={`${shortcut.title}\n${S.chat.shortcutFillHint}`}
onClick={() => onFill(shortcut.prompt)}
- className={`flex min-w-0 flex-1 items-center gap-2 ${exampleRowClass}`}
+ className={`flex min-w-0 flex-1 items-center gap-2 ${folderRowClass}`}
>
<span className="min-w-0 flex-1 truncate">{shortcut.title}</span>
</button>
@@ -202,7 +192,7 @@ export function ShortcutsFolder({
type="button"
data-tooltip={S.chat.shortcuts.newFromComposer}
onClick={startCreate}
- className={`flex w-full items-center gap-2 ${exampleRowClass}`}
+ className={`flex w-full items-center gap-2 ${folderRowClass}`}
>
<PlusIcon size={ICON_SIZE.inlineGlyph} />
<span className="min-w-0 flex-1 truncate">{S.chat.shortcuts.new}</span>
diff --git a/packages/web/src/features/chat/user-shortcuts.ts b/packages/web/src/features/chat/user-shortcuts.ts
index 673daa8e..381f956d 100644
--- a/packages/web/src/features/chat/user-shortcuts.ts
+++ b/packages/web/src/features/chat/user-shortcuts.ts
@@ -8,13 +8,12 @@
* doing the thing again; a prompt the user typed and named cannot. Losing it by opening the app
* on another machine, or by clearing site data, would be losing their work.
*
- * **A shortcut is a title and a prompt, and pins no Skills.** A built-in example is authored
- * against the Skill catalog this product ships, so it can name the Skills its prompt depends on;
- * a prompt the user saved has no such guarantee, and the Agent it will eventually run under is
- * picked *after* the click. Pinning would therefore mean either silently dropping names the
- * selected Agent lacks, or growing the editor a Skill picker whose contents change with a
- * selection made elsewhere on the page. The composer's own Skills dropdown is one click away and
- * keeps working: a shortcut fills the text and leaves the selection exactly as the user set it.
+ * **A shortcut is a title and a prompt, and pins no Skills.** The prompt is the user's own text,
+ * written before the Agent it will run under is picked; pinning would therefore mean either
+ * silently dropping names the selected Agent lacks, or growing the editor a Skill picker whose
+ * contents change with a selection made elsewhere on the page. The composer's own Skills dropdown
+ * is one click away and keeps working: a shortcut fills the text and leaves the selection exactly
+ * as the user set it.
*
* **The caps are duplicated on the server on purpose** (`services/draft-shortcuts.ts`), which is
* where they are enforced — ui_prefs is a free-form JSON column, so a bound that lives only in
@@ -31,7 +30,7 @@ export type UserShortcut = DraftShortcut;
export const SHORTCUT_MAX_COUNT = 3;
/** Longest title, in characters: what one folder row shows without truncating. */
export const SHORTCUT_TITLE_MAX = 40;
-/** Longest prompt body, in characters: about three times the longest built-in example. */
+/** Longest prompt body, in characters: a saved prompt is one thing to ask, not a brief. */
export const SHORTCUT_PROMPT_MAX = 4000;
/**
diff --git a/packages/web/src/lib/strings-en.ts b/packages/web/src/lib/strings-en.ts
index fe40982c..ffedb736 100644
--- a/packages/web/src/lib/strings-en.ts
+++ b/packages/web/src/lib/strings-en.ts
@@ -2579,14 +2579,9 @@ export const en: Strings = {
machineTag: (machine: string) => `[SSH: ${machine}]`,
newSessionInWorkspace: "New chat in this workspace",
draftSubtitle: "The self-evolving agent that excels at AI development tasks",
- /** Folder names for the draft page's collapsible examples (bookmark-style: exactly one open at a time). */
- exampleFolders: {
- webapps: "Build web apps",
- agents: "Build and optimize agents",
- schedules: "Create scheduled tasks",
- },
- /** Second tooltip line on an example row: the click fills the composer, it does not send. */
- exampleFillHint: "Click to fill the composer — edit it if you like, then send",
+ /** Second tooltip line on a shortcut row: the click fills the composer, it does not send. */
+ shortcutFillHint: "Click to fill the composer — edit it if you like, then send",
+ /** The draft screen's saved-prompt folder: prompts the user wrote and saved, stored per user on the server. */
shortcuts: {
folder: "My shortcuts",
new: "New shortcut",
@@ -2605,165 +2600,6 @@ export const en: Strings = {
deleteConfirm: (title: string) =>
`Delete "${title}"? The shortcut disappears from every device you use.`,
},
- exampleTasks: {
- game: {
- label: "2D penguin sled game",
- desc: "A cute Antarctic penguin sleds over rocks, easy start with a gentle difficulty ramp — a 2D pure-frontend mini game",
- prompt:
- "Build a cute Antarctic penguin sledding 2D game: press Space to jump over the rocks " +
- "coming up on the ice; start easy and forgiving, with sled speed and obstacle density " +
- "ramping up smoothly and gradually over time (no sudden spikes), live scoring, and " +
- "hitting a rock ending the run with one-click restart. " +
- "A 2D side-scroller with a cute cartoon look, pure frontend (a single HTML file is " +
- "fine), styled per the web-design skill. " +
- "When done, test it in a browser once, confirm the first few seconds are easy to " +
- "clear, and tell me how to open it and how to play.",
- },
- gamecenter: {
- label: "A mini-game center built by multiple agents",
- desc: "Ten pure-frontend games with no repeated mechanics, built in parallel behind one index page",
- prompt: `Build a web mini-game center with multiple agents working in parallel: 10 pure-frontend games with no two sharing the same mechanic, plus an index page.
-
-## How to split the work
-- First plan the 10 games (say snake, 2048, tetris, breakout, minesweeper, memory match, sokoban, space shooter, platform jumper, rhythm tap), confirm no two mechanics repeat, and fix a shared directory layout, palette and interaction spec.
-- Then hand the 10 games to several subagents to implement in parallel — each subagent owns exactly one game, follows the agreed spec, and never edits another's files.
-
-## Each game
-- Its own \`games/<slug>/index.html\`: pure frontend, a single file that runs straight from file://, with no backend and no CDN assets.
-- Start / restart, live score or timer, a lose-or-clear summary, both keyboard and touch controls, and the rules written on the page.
-- A way back to the index page.
-
-## Index page
-- \`index.html\` at the root: a card grid listing all 10 games (name + one-line mechanic + controls), each card opening its game.
-- One design language shared with every game, following the web-design skill.
-
-## Wrap-up
-- Review as a whole: the 10 mechanics really are distinct, the styling is consistent, and every index link resolves.
-- Self-test each game in a browser — it starts, it ends, it restarts — then tell me how to open it.`,
- },
- lol: {
- label: "League of Legends music player",
- desc: "Worlds anthems on the SoundCloud Widget API — a single file that opens from file://",
- prompt: `Build a League of Legends Worlds anthem player with the SoundCloud Widget API (see https://developers.soundcloud.com/docs/api/html5-widget): a single index.html that works when opened from file://.
-
-## Technical constraints
-- Use the SC.Widget JS API (widget.load / widget.toggle / widget.setVolume / widget.seekTo), loading https://w.soundcloud.com/player/api.js
-- The iframe must stay visible (180px tall), with visual=true color=f0b90b single_active=true
-- Include ONLY these 8 tracks confirmed playable (oEmbed-verified); do not add tracks that are not oEmbed-verified:
- - Warriors (S4) — soundcloud.com/leagueoflegends/warriors
- - Worlds Collide (S5) — soundcloud.com/leagueoflegends/worlds-collide
- - Legends Never Die (S7) — soundcloud.com/leagueoflegends/legends-never-die
- - Phoenix (S9) — soundcloud.com/leagueoflegends/phoenix
- - Burn It All Down (S11) — soundcloud.com/leagueoflegends/burn-it-all-down
- - GODS (S13) — soundcloud.com/leagueoflegends/gods
- - Heavy Is The Crown (S14) — soundcloud.com/linkinpark/heavy-is-the-crown
- - Sacrifice (S15) — soundcloud.com/leagueoflegends/sacrifice
-
-## Layout
-- Left 260px sticky sidebar: the track list (S4/S5/… badge + emoji + title + year); clicking highlights with a gold border and switches tracks via SC.Widget.load() with auto_play
-- Right main area: hero title + a desktop clock (80px monospace gold HH:MM:SS, refreshed every second, blinking colons) + a mood tag
-- Player card: the SoundCloud iframe + a custom control bar (⏮ ▶/⏸ ⏭ + track info + a volume slider; clicking the speaker icon toggles mute)
-- Mood-wave section: 15 gold animated bars, re-randomized on every track switch
-- Keyboard shortcuts: Space play/pause, ← → previous/next, ↑ ↓ volume
-
-## Design
-Penguin visual style (see the web-design skill), dark by default. On phones the sidebar becomes a horizontally scrolling top bar.
-
-When done, open index.html in a browser and self-test once.`,
- },
- rhythmRunner: {
- label: "Rhythm runner mini game",
- desc: "A Muse Dash-style rhythm runner: a penguin lead, notes locked to the beat, graded Perfect / Great / Miss",
- prompt:
- "Build a Muse Dash-style rhythm runner: a penguin runs forward on its own, and notes — " +
- "drawn as music-note icons — fly in locked to the beat for me to hit. Show Perfect / " +
- "Great / Miss for each hit, score combos, and let the difficulty climb as the track goes " +
- "on. Pure front end, one file, playable straight from file://.",
- },
- investmentCopilot: {
- label: "Conversational investment analyst",
- desc: "A conversational market Copilot on the Penguin SDK: the home page lists what is trending, with the market factors behind every call",
- prompt:
- "Build a conversational stock-market Copilot on the Penguin SDK, along the lines of " +
- "perplexity.ai/finance: from startup it pulls live market data every 5 minutes, and the " +
- "home page lists the stocks trending strongest lately alongside how the sectors compare. " +
- "Every call has to name the market factors behind it — policy, sector news, fund flows, " +
- "earnings, macro data — rather than technical indicators. Analysis of public data, not " +
- "investment advice. Its stock-lookup tool has to handle questions like \"look up Zhipu's " +
- 'stock for me": resolve a company name to its ticker itself, and when there is no match ' +
- "or the company is not listed, say so rather than inventing a quote.",
- },
- missionControl: {
- label: "Build a custom workflow UI: mission control",
- desc: "A workflow tab beside the chat: dispatch a task to several agents at once and watch every Session's live status",
- prompt:
- "Build yourself a workflow: a mission-control tab beside this chat. I type a task and pick " +
- "one or more of this Project's Agents; it opens a Session for each and runs them in " +
- "parallel. Every run is a card with a live, animated status (queued, running, done) and " +
- "its elapsed time, and the board survives a reload. Add a second tab with the numbers — " +
- "runs per Agent, average duration — and a button that fills the whole app, like a wall " +
- "display. Take every colour from the theme variables so it looks right in light and dark.",
- },
- agentBenchmarkBuild: {
- label: "Build a general-purpose decision agent and its benchmark",
- desc: "Create a general decision Agent and test it on football, after-sales, and investment tasks",
- prompt: `Use \`agent-initialization\` followed by \`benchmark-design\` to create a decision Agent and produce a frozen Benchmark with a Formal Baseline.
-
-Agent:
-- id: \`finite_choice_agent\`
-- capability: make stable, explainable finite choices when public information is incomplete or conflicting
-- installed_skills: \`[]\`
-
-Benchmark:
-- id: \`contextual-choice-adaptation\`
-- capability: form and transfer a stable finite-choice decision process from public rules, historical examples, and current facts
-- desired_baseline_score: \`<75\`
-- pilot_iteration_limit: \`5\`
-
-Scenarios:
-1. Make football betting decisions from historical matches and current information.
-2. Choose after-sales actions from policy and ticket facts.
-3. Choose investment actions from a strategy, historical markets, and current indicators.`,
- },
- agentOptimization: {
- label: "Improve the general-purpose decision agent's accuracy",
- desc: "Improve an Agent from existing evaluation results and verify that the new version is better",
- prompt: `Use \`agent-optimization\` to optimize a decision Agent against its frozen Benchmark.
-
-- test_agent_id: \`finite_choice_agent\`
-- benchmark_id: \`contextual-choice-adaptation\`
-- capability_direction: improve stability under incomplete information, conflicting rules, and finite choices
-- runs: \`3\`
-- desired_score: \`>=95\`
-- candidate_round_limit: \`5\``,
- },
- dailyPlan: {
- label: "A 9am daily planning check-in",
- desc: "09:00 every day: talk through the day's plan in this same chat, and review yesterday's progress",
- prompt:
- "Set up a scheduled task: every day at 9am, in this same conversation, plan today's work " +
- "with me. Read back over the conversation first and say what yesterday's plan got done and " +
- "where it stuck, then offer an ordered shortlist for today with a line of reasoning each, " +
- "and write up what I confirm as a checklist.",
- },
- githubDigest: {
- label: "Daily GitHub project digest",
- desc: "A daily pass over one repo's issues, PRs and CI, ending in prioritized recommendations",
- prompt:
- "Set up a scheduled task: every morning, use gh to digest one GitHub repo's issues, PRs " +
- "and CI — surface what has stalled, what is waiting on review and what is failing — and " +
- "end with recommendations ranked by priority, each saying why it sits where it does.",
- },
- memoryReview: {
- label: "Friday memory review",
- desc: "Friday evening: go through what is worth remembering from the week and write it into Memory",
- prompt:
- "Set up a scheduled task: every Friday evening, in this same conversation, go through " +
- "what is worth remembering from the week with me. Check the existing memory index first so " +
- "nothing is duplicated, then take it item by item — what to record, what to revise — and " +
- "write what I confirm into Memory.",
- },
- },
sessionList: "Sessions",
sessionListByMode: { workspace: "Workspaces", agent: "Agents", time: "Recent" },
defaultSessionTitle: "New chat",
diff --git a/packages/web/src/lib/strings.ts b/packages/web/src/lib/strings.ts
index 9afd9caa..c208623f 100644
--- a/packages/web/src/lib/strings.ts
+++ b/packages/web/src/lib/strings.ts
@@ -2629,15 +2629,9 @@ export const zh = {
machineTag: (machine: string) => `[SSH: ${machine}]`,
newSessionInWorkspace: "在此工作区新建对话",
draftSubtitle: "最擅长 AI 开发任务的自进化 Agent",
- /** Collapsed group names for the home-page examples (bookmark style; only one open at a time). */
- exampleFolders: {
- webapps: "搭建网页应用",
- agents: "搭建和优化智能体",
- schedules: "创建定时任务",
- },
- /** Second tooltip line on an example row: the click fills the composer, it does not send. */
- exampleFillHint: "点击填入输入框,可修改后自行发送",
- /** The examples block's last folder: prompts the user wrote and saved, stored per user on the server. */
+ /** Second tooltip line on a shortcut row: the click fills the composer, it does not send. */
+ shortcutFillHint: "点击填入输入框,可修改后自行发送",
+ /** The draft screen's saved-prompt folder: prompts the user wrote and saved, stored per user on the server. */
shortcuts: {
folder: "我的快捷指令",
new: "新建快捷指令",
@@ -2661,160 +2655,6 @@ export const zh = {
deleteTitle: "删除快捷指令",
deleteConfirm: (title: string) => `确定删除「${title}」?该快捷指令会从你的所有设备上消失。`,
},
- /**
- * Example task cards on the draft screen: one click fills the composer with the canned
- * prompt, which the user reads, edits and sends. That is why a prompt is SHORT — a short
- * paragraph, around 100 Chinese characters, carrying what to build plus the constraints the
- * result would be wrong without. File layouts, field lists, step-by-step headings and
- * self-test instructions are what the Agent works out or asks about, so they stay out; the
- * older briefs below are still far longer and are being trimmed to match.
- */
- exampleTasks: {
- game: {
- label: "2D 企鹅雪橇越野小游戏",
- desc: "可爱南极企鹅滑雪橇跳石头,难度由易到难的 2D 纯前端小游戏",
- prompt:
- "做一个可爱的南极企鹅滑雪橇越野 2D 小游戏:按空格键起跳,跃过冰面上迎面而来的石头;" +
- "开局要足够简单、上手无压力,滑行速度与障碍密度随时间平滑、循序渐进地上升,避免突然变难," +
- "实时计分,撞上石头即结束并可一键重新开始。" +
- "2D 横版画面、可爱卡通风,纯前端实现(单个 HTML 文件即可),界面遵循 web-design 技能。" +
- "完成后在浏览器里自测一次,确认开局能轻松玩过几秒,并告诉我怎么打开和怎么玩。",
- },
- gamecenter: {
- label: "多智能体搭建小游戏中心",
- desc: "并行产出 10 个玩法互不重复的纯前端小游戏,配一个统一风格的索引首页",
- prompt: `用多智能体并行搭建一个网页小游戏中心:10 个玩法互不重复的纯前端小游戏,外加一个索引首页。
-
-## 分工方式
-- 先规划这 10 个游戏(例如贪吃蛇、2048、俄罗斯方块、打砖块、扫雷、记忆翻牌、推箱子、太空射击、跳跃平台、节奏点击),确认玩法确实互不重复,并定好统一的目录结构、配色与交互规范。
-- 再把 10 个游戏分派给多个子智能体并行实现,每个子智能体只负责自己的那一个游戏,严格按既定规范产出,互不改动他人的文件。
-
-## 每个游戏
-- 独立的 \`games/<slug>/index.html\`,纯前端单文件、file:// 直接打开即可运行,不依赖后端与任何 CDN 资源。
-- 具备开始 / 重新开始、实时计分或计时、失败或通关结算,并同时支持键盘与触摸操作,页面内写明玩法说明。
-- 提供返回索引首页的入口。
-
-## 索引首页
-- 根目录 \`index.html\`:卡片网格列出全部 10 个游戏(名称 + 一句话玩法 + 操作方式),点击进入对应游戏。
-- 与所有游戏共用一套设计语言,遵循 web-design 技能。
-
-## 收尾
-- 统一验收:10 个游戏玩法确实不重复、风格一致,索引页的链接全部可达。
-- 在浏览器里逐个自测,确认都能开始、能结束、能重开,然后告诉我怎么打开。`,
- },
- lol: {
- label: "英雄联盟音乐播放器",
- desc: "用 SoundCloud Widget API 播放历届 Worlds 主题曲,单文件即开即用",
- prompt: `用 SoundCloud Widget API(见 https://developers.soundcloud.com/docs/api/html5-widget)做一个英雄联盟 Worlds 主题曲播放器,单文件 index.html,file:// 打开即用。
-
-## 技术约束
-- 使用 SC.Widget JS API(widget.load / widget.toggle / widget.setVolume / widget.seekTo),引入 https://w.soundcloud.com/player/api.js
-- iframe 必须可见(180px 高),visual=true color=f0b90b single_active=true
-- 仅包含以下 8 首已确认可播曲目(oEmbed 验证通过),不要添加未经 oEmbed 验证的曲目:
- - Warriors (S4) — soundcloud.com/leagueoflegends/warriors
- - Worlds Collide (S5) — soundcloud.com/leagueoflegends/worlds-collide
- - Legends Never Die (S7) — soundcloud.com/leagueoflegends/legends-never-die
- - Phoenix (S9) — soundcloud.com/leagueoflegends/phoenix
- - Burn It All Down (S11) — soundcloud.com/leagueoflegends/burn-it-all-down
- - GODS (S13) — soundcloud.com/leagueoflegends/gods
- - Heavy Is The Crown (S14) — soundcloud.com/linkinpark/heavy-is-the-crown
- - Sacrifice (S15) — soundcloud.com/leagueoflegends/sacrifice
-
-## 布局
-- 左侧 260px 粘性侧边栏:曲目列表(S4/S5/… 标签 + emoji + 曲名 + 年份),点击高亮金色边框,SC.Widget.load() 切歌 + auto_play
-- 右侧主区域:Hero 标题 + 桌面时钟(80px 等宽金色 HH:MM:SS,每秒刷新,冒号闪烁)+ 心情标签
-- 播放器卡片:SoundCloud iframe + 自定义控制栏(⏮ ▶/⏸ ⏭ + 曲目信息 + 音量滑块,点击喇叭图标静音切换)
-- 心情波动区:15 根金色动画柱,切歌时重新随机生成
-- 键盘快捷键:空格播放暂停、← → 切歌、↑ ↓ 调音量
-
-## 设计
-Penguin 视觉风格(见 web-design 技能),默认深色。手机端侧边栏变为顶部横向滚动。
-
-完成后在浏览器打开 index.html 自测一次。`,
- },
- rhythmRunner: {
- label: "音乐节奏跑酷小游戏",
- desc: "喵斯快跑式的音乐节奏跑酷:企鹅主角,音符踩着节拍飞来,判定分 Perfect / Great / Miss",
- prompt:
- "做一个喵斯快跑(Muse Dash)式的音乐节奏跑酷小游戏:主角是一只企鹅,自动向前跑;" +
- "音符画成音符图标,严格踩着节拍飞来,玩家按键击打,判定显示 Perfect / Great / Miss 三档," +
- "连击计分,难度随曲子推进。纯前端单文件,file:// 直接打开即玩。",
- },
- investmentCopilot: {
- label: "对话式投资分析助理",
- desc: "用 Penguin SDK 做对话式看盘 Copilot:首页列出近期走势较好的股票,每个判断都说清市场因素",
- prompt:
- "用 Penguin SDK 做一个对话式的股市 Copilot,形态参考 perplexity.ai/finance:启动后每 5 分钟实时抓取大盘行情," +
- "首页直接列出近期走势较好的股票和板块强弱,每个判断都要说清背后的市场因素——政策、行业消息、" +
- "资金流向、财报或宏观数据,而不是技术指标," +
- "只做分析不是投资建议。它的查股工具要能答「帮我查一下智谱的股票」这类问题:" +
- "按公司名(中文也行)自己对应到股票代码,查不到或没上市就直说,不要编。",
- },
- missionControl: {
- label: "搭建自定义工作流界面:Agent 指挥台",
- desc: "聊天旁的 Workflow 标签页:把一个任务同时派给多个 Agent,实时看每个 Session 的状态",
- prompt:
- "给你自己做一个 Workflow:聊天旁边的一张「指挥台」标签页。我输入一个任务、勾选本项目里的一个或多个 Agent," +
- "它就为每个 Agent 开一个 Session 并行跑起来。每次运行是一张卡片,带实时的动态状态(排队、运行中、完成)和耗时," +
- "刷新页面后看板仍在。再加第二张标签页放统计——各 Agent 的运行次数与平均耗时——以及一个占满整个应用的按钮,当作大屏来用。" +
- "颜色一律取自主题变量,明暗两种主题下都要好看。",
- },
- agentBenchmarkBuild: {
- label: "构建通用决策智能体和评测基准",
- desc: "创建一个通用决策 Agent,并用足球、售后和投资任务检验它",
- prompt: `请依次使用 \`agent-initialization\` 和 \`benchmark-design\`,创建决策 Agent,并产出 Frozen Benchmark 与 Formal Baseline。
-
-Agent:
-- id:\`finite_choice_agent\`
-- 能力:面对有限选项,在公开信息不足或冲突时仍能给出稳定、可解释的选择
-- installed_skills:\`[]\`
-
-Benchmark:
-- id:\`contextual-choice-adaptation\`
-- capability:从公开规则、历史案例和当前事实中形成并迁移稳定的有限选择决策过程
-- desired_baseline_score:\`<75\`
-- pilot_iteration_limit:\`5\`
-
-场景:
-1. 根据历史比赛与当前信息进行足球投注决策。
-2. 根据售后政策与工单事实选择处置动作。
-3. 根据投资策略、历史市场与当前指标选择投资动作。`,
- },
- agentOptimization: {
- label: "优化通用决策智能体的准确率",
- desc: "根据已有评测结果改进 Agent,并验证新版本是否真正提升",
- prompt: `请使用 \`agent-optimization\`,根据 Frozen Benchmark 优化决策 Agent。
-
-- test_agent_id:\`finite_choice_agent\`
-- benchmark_id:\`contextual-choice-adaptation\`
-- capability_direction:提高信息不完整、规则冲突和有限选项决策中的稳定性
-- runs:\`3\`
-- desired_score:\`>=95\`
-- candidate_round_limit:\`5\``,
- },
- dailyPlan: {
- label: "每天早 9 点的计划对话",
- desc: "每天 09:00 在同一个会话里聊当天计划,并回顾昨天的进展",
- prompt:
- "建一个定时任务:每天早上 9 点在这个会话里和我聊今天的计划。" +
- "先回看上文说清昨天定的事做完了多少、哪些卡住,再给我一份排好序的今日候选、每条一句理由," +
- "我确认后写成清单。",
- },
- githubDigest: {
- label: "每天汇总 GitHub 项目状态",
- desc: "定时跑一遍仓库的 Issue、PR 与 CI,日报结尾给出按优先级排序的建议",
- prompt:
- "建一个定时任务:每天早上用 gh 汇总一个 GitHub 仓库的 Issue、PR 与 CI 状态," +
- "挑出停滞的、待评审的和挂掉的,结尾给出按优先级排序的建议,每条说清为什么排在这个位置。",
- },
- memoryReview: {
- label: "每周五晚回顾并记录 Memory",
- desc: "周五傍晚一起过一遍这周值得长期记住的事,确认后由你写进 Memory",
- prompt:
- "建一个定时任务:每周五傍晚在这个会话里和我过一遍这周值得长期记住的事。" +
- "先看已有记忆索引避免重复,再逐条问我该记什么、要不要改已有的,我确认后你写进 Memory。",
- },
- },
sessionList: "Session",
/** The Session list's heading, named for how the list is grouped. */
sessionListByMode: { workspace: "工作区", agent: "智能体", time: "最近" },
diff --git a/packages/web/test/example-tasks.test.ts b/packages/web/test/example-tasks.test.ts
deleted file mode 100644
index 2d44fcd3..00000000
--- a/packages/web/test/example-tasks.test.ts
+++ /dev/null
@@ -1,233 +0,0 @@
-/**
- * The draft screen's example prompts (features/chat/example-tasks.ts and the dictionaries).
- * They are sent to an Agent as written, so what they must carry is a contract with the skills
- * and schedules that read them, held in both languages alike.
- *
- * - The two agent-evolution prompts carry the ids and targets the build and optimization skills
- * read, name the skills in the order they run, stay short, and leave out what the Agent works
- * out itself.
- * - The folders stay within one row of each other, so the draft page's height does not jump.
- * - Every scheduled-task example says when it fires (never in cron syntax), and the two that
- * need an answer run in the conversation the user is in.
- * - The short example prompts stay under their length ceilings and keep their core in both
- * locales.
- * - The investment Copilot example keeps its "not investment advice" framing.
- */
-import { describe, expect, it } from "vitest";
-import { EXAMPLE_FOLDERS } from "../src/features/chat/example-tasks";
-import { en } from "../src/lib/strings-en";
-import { zh } from "../src/lib/strings";
-
-describe("draft example tasks", () => {
- it.each([
- {
- locale: "zh",
- buildPrompt: zh.chat.exampleTasks.agentBenchmarkBuild.prompt,
- optimizationPrompt: zh.chat.exampleTasks.agentOptimization.prompt,
- buildMarkers: [
- "id:`finite_choice_agent`",
- "installed_skills:`[]`",
- "id:`contextual-choice-adaptation`",
- "desired_baseline_score:`<75`",
- "pilot_iteration_limit:`5`",
- ],
- buildForbiddenMarkers: ["thinking_level", "provider", "model_id", "runs:"],
- optimizationMarkers: [
- "test_agent_id:`finite_choice_agent`",
- "benchmark_id:`contextual-choice-adaptation`",
- "runs:`3`",
- "desired_score:`>=95`",
- "candidate_round_limit:`5`",
- ],
- },
- {
- locale: "en",
- buildPrompt: en.chat.exampleTasks.agentBenchmarkBuild.prompt,
- optimizationPrompt: en.chat.exampleTasks.agentOptimization.prompt,
- buildMarkers: [
- "id: `finite_choice_agent`",
- "installed_skills: `[]`",
- "id: `contextual-choice-adaptation`",
- "desired_baseline_score: `<75`",
- "pilot_iteration_limit: `5`",
- ],
- buildForbiddenMarkers: ["thinking_level", "provider", "model_id", "runs:"],
- optimizationMarkers: [
- "test_agent_id: `finite_choice_agent`",
- "benchmark_id: `contextual-choice-adaptation`",
- "runs: `3`",
- "desired_score: `>=95`",
- "candidate_round_limit: `5`",
- ],
- },
- ])(
- "$locale preserves the two-session agent evolution contract",
- ({
- buildPrompt,
- optimizationPrompt,
- buildMarkers,
- buildForbiddenMarkers,
- optimizationMarkers,
- }) => {
- const normalizedBuild = buildPrompt.replace(/\s+/g, " ");
- const normalizedOptimization = optimizationPrompt.replace(/\s+/g, " ");
-
- for (const marker of buildMarkers) {
- expect(normalizedBuild).toContain(marker);
- }
- for (const marker of buildForbiddenMarkers) {
- expect(normalizedBuild).not.toContain(marker);
- }
- for (const marker of optimizationMarkers) {
- expect(normalizedOptimization).toContain(marker);
- }
-
- // The build draft names both skills, in the order it runs them; the scenario copy each
- // one is described with is free to change.
- expect(normalizedBuild).toContain("`agent-initialization`");
- expect(normalizedBuild.indexOf("`agent-initialization`")).toBeLessThan(
- normalizedBuild.indexOf("`benchmark-design`"),
- );
- expect(normalizedOptimization).toContain("`agent-optimization`");
-
- expect(normalizedBuild).not.toContain("penguin run");
- expect(normalizedOptimization).not.toContain("penguin run");
- expect(normalizedBuild).not.toContain("run_subagent");
- expect(normalizedOptimization).not.toContain("run_subagent");
- expect(normalizedBuild).not.toContain("Scoreboard");
- expect(normalizedOptimization).not.toContain("Scoreboard");
- expect(normalizedBuild.length).toBeLessThan(1600);
- expect(normalizedOptimization.length).toBeLessThan(600);
- expect(normalizedBuild).not.toContain("Phase 1");
- expect(normalizedOptimization).not.toContain("Phase 3");
- },
- );
-});
-
-describe("draft example catalog", () => {
- // The draft page reserves no scroll area: its height is the folder rows plus the open
- // folder's rows, so a folder much longer than its siblings makes that height jump.
- it("keeps the folders within one row of each other", () => {
- const sizes = EXAMPLE_FOLDERS.map((folder) => folder.tasks.length);
- expect(Math.max(...sizes) - Math.min(...sizes)).toBeLessThanOrEqual(1);
- });
-});
-
-describe("scheduled-task examples", () => {
- // Two things a shortened schedule brief cannot lose. WHEN it fires: a schedule with no time
- // in it is not a schedule, and the Agent has nothing to ask about it that would not be a
- // guess. And, for the two check-ins that need the user to answer, that they run in the
- // conversation the user is already in — the default is a fresh Session per run, which for
- // those two would be wrong. How the schedule is written (TOML under agent_state/schedule/,
- // `enabled`, `start_at`) is in the Agent's own Scheduled Tasks section; the prompt no longer
- // repeats it. `period` is a fixed interval (30m / 12h / 7d), so cron syntax is always wrong.
- it.each([
- {
- id: "dailyPlan",
- zhMarkers: ["每天", "9 点", "这个会话"],
- enMarkers: ["every day", "9am", "this same conversation"],
- },
- { id: "githubDigest", zhMarkers: ["每天"], enMarkers: ["every morning"] },
- {
- id: "memoryReview",
- zhMarkers: ["每周五", "这个会话"],
- enMarkers: ["every Friday", "this same conversation"],
- },
- ] as const)("$id says when it fires in both locales", ({ id, zhMarkers, enMarkers }) => {
- const zhPrompt = zh.chat.exampleTasks[id].prompt;
- const enPrompt = en.chat.exampleTasks[id].prompt;
- for (const marker of zhMarkers) {
- expect(zhPrompt).toContain(marker);
- }
- for (const marker of enMarkers) {
- expect(enPrompt).toContain(marker);
- }
- expect(zhPrompt).not.toContain("cron");
- expect(enPrompt).not.toContain("cron");
- });
-});
-
-/**
- * These five are written to be read by the user before they run, so each is a short paragraph —
- * around 100 Chinese characters — carrying what to build plus the constraints the result would be
- * wrong without, and none of the step-by-step detail the Agent works out or asks about. The caps
- * below are a ceiling against re-inflation, not a target. Only these five are covered: the older
- * briefs in the catalog are still far longer and are being shortened separately.
- */
-describe("short example prompts", () => {
- const shortExamples = [
- {
- id: "rhythmRunner",
- zhMarkers: ["喵斯快跑", "企鹅", "音符图标", "节拍", "Perfect", "Great", "Miss"],
- enMarkers: ["Muse Dash", "penguin", "music-note icons", "beat", "Perfect", "Great", "Miss"],
- },
- {
- id: "investmentCopilot",
- zhMarkers: [
- "Penguin SDK",
- "perplexity.ai/finance",
- "对话式",
- "启动后",
- "实时抓取",
- "首页",
- "走势较好的股票",
- "市场因素",
- "查股工具",
- "公司名",
- "不要编",
- ],
- enMarkers: [
- "Penguin SDK",
- "perplexity.ai/finance",
- "conversational",
- "from startup",
- "live market",
- "home page",
- "trending strongest",
- "market factors",
- "stock-lookup tool",
- "company name",
- "not listed",
- ],
- },
- { id: "dailyPlan", zhMarkers: ["计划"], enMarkers: ["plan"] },
- { id: "githubDigest", zhMarkers: ["GitHub", "优先级"], enMarkers: ["GitHub", "priority"] },
- { id: "memoryReview", zhMarkers: ["Memory"], enMarkers: ["Memory"] },
- ] as const;
-
- it.each(shortExamples)("$id stays within the length ceiling", ({ id }) => {
- // investmentCopilot sits highest by a wide margin: seven requirements plus a reference URL and
- // a quoted sample question, both literals no rewording compresses. The English ceiling is the
- // wider one because English runs about three times the character count of the same Chinese,
- // not because the English is allowed to say more.
- expect(zh.chat.exampleTasks[id].prompt.length).toBeLessThanOrEqual(230);
- expect(en.chat.exampleTasks[id].prompt.length).toBeLessThanOrEqual(700);
- });
-
- // What is left after the cut: what to build, and the constraints without which the result
- // would be the wrong thing (a rhythm game is a game synced to music; the investment Copilot
- // is a Penguin SDK app that refreshes from startup, surfaces trending stocks on its home page,
- // and gives the assistant a name-resolving stock-lookup tool).
- it.each(shortExamples)("$id keeps its core in both locales", ({ id, zhMarkers, enMarkers }) => {
- for (const marker of zhMarkers) {
- expect(zh.chat.exampleTasks[id].prompt).toContain(marker);
- }
- for (const marker of enMarkers) {
- expect(en.chat.exampleTasks[id].prompt).toContain(marker);
- }
- });
-});
-
-describe("investment copilot example", () => {
- // Short as it is, the brief stays analysis with stated evidence, never a call to act.
- it.each([
- { locale: "zh", prompt: zh.chat.exampleTasks.investmentCopilot.prompt, marker: "不是投资建议" },
- {
- locale: "en",
- prompt: en.chat.exampleTasks.investmentCopilot.prompt,
- marker: "not investment advice",
- },
- ])("$locale keeps the not-advice framing", ({ prompt, marker }) => {
- expect(prompt).toContain(marker);
- });
-});
diff --git a/packages/web/test/user-shortcuts.test.ts b/packages/web/test/user-shortcuts.test.ts
index cea13590..bf5007cf 100644
--- a/packages/web/test/user-shortcuts.test.ts
+++ b/packages/web/test/user-shortcuts.test.ts
@@ -11,15 +11,12 @@
* cap; removing closes the gap and ignores unknown ids.
* - The suggested title is the first non-empty line, one line, capped; nothing for an empty
* composer.
- * - The user folder's tallest state stays within one row of the tallest built-in folder, so the
- * examples block does not move as folders are switched.
* - The caps match the server's copy, which enforces them (read from the server module's
* source: the server package is a type-only dependency of the Web App).
*/
import { describe, expect, it } from "vitest";
import { readFileSync } from "node:fs";
import { fileURLToPath } from "node:url";
-import { EXAMPLE_FOLDERS } from "../src/features/chat/example-tasks";
import {
SHORTCUT_MAX_COUNT,
SHORTCUT_PROMPT_MAX,
@@ -198,17 +195,6 @@ describe("defaultShortcutTitle — the name suggested when saving what was typed
});
});
-describe("the examples block keeps its height", () => {
- it("keeps the user folder within one row of the built-in ones", () => {
- // Its tallest state is either the cap with no add row, or one below the cap plus the add
- // row — both SHORTCUT_MAX_COUNT rows. The cap is what holds this, not a pinned height with
- // a scrollbar inside it.
- const tallestBuiltIn = Math.max(...EXAMPLE_FOLDERS.map((f) => f.tasks.length));
- const tallestUser = Math.max(SHORTCUT_MAX_COUNT, SHORTCUT_MAX_COUNT - 1 + 1);
- expect(tallestUser - tallestBuiltIn).toBeLessThanOrEqual(1);
- });
-});
-
describe("the caps the server enforces", () => {
it("matches the Web App's copy of them", () => {
// Two copies on purpose: the server owns enforcement (ui_prefs is a free-form JSON column),