cc-haha/docs/en/desktop/03-features.md
程序员阿江(Relakkes) fc9f5d554e feat(desktop): let a nine-row action sheet become a pet instead of demanding an exact atlas
Importing an animated pet required a file that was exactly 1536x2288, laid
out as 88 seamless cells, with the last two rows holding sixteen distinct
gaze angles. No image model emits that. Whatever a user got back from Jimeng
or ChatGPT was some fixed size like 1024x1536, so the path ended at "the
animation atlas must be exactly 1536x2288 pixels" every time. The third card
was worse: "AI-generate full animation" was hardcoded `disabled`, so the one
entry point named after what people actually wanted to do was dead.

The fix was already in the tree. `scripts/assemble-generated-pet-atlas.py`
landed in the same commit as the four built-in pets, which is to say the
built-ins were produced this way — it takes an action sheet at any size,
slices it on an 8x9 grid, fits each cell to 192x208, mirrors the run row to
make run-left, and reuses rows to reach eleven. That capability was never
wired to anything a user could reach.

`petAtlasNormalize.ts` reimplements it on a canvas in the renderer, so an
author draws nine rows and the app derives the rest. Verified against the
reference assembler by reversing dada-code's atlas into a nine-row sheet and
re-normalizing it: every difference lands on semi-transparent antialiased
edges (2314 pixels, max channel delta 14/255) and opaque regions are
identical. That residue is canvas premultiplied-alpha round-tripping, not a
slicing bug.

Three contract details worth stating. Row frame counts are now derived from
`PET_ANIMATION_DEFINITIONS` rather than typed out a fourth time; they come
out equal to the assembler's `(6,8,8,4,5,8,6,6,6,8,8)`. A sheet already at
1536x2288 passes through byte-for-byte instead of being resliced, because
resampling finished artwork buys nothing. And since the validator never
inspects the alpha channel, a flattened white background used to import
happily and render as a rectangle on the desktop — the renderer now rejects
sheets whose atlas is under 5% transparent (the built-ins sit near 78%) with
a message that names the actual problem.

The copy stops describing the implementation. "Animate one image" and
"Import professional animation atlas / exact 1536x2288 v2 PNG" become "use a
picture you already have" and "I already have an action sheet"; the dead AI
card becomes a three-step walkthrough carrying a copyable prompt, a labelled
8x9 reference grid that can be saved locally, and the checks that catch the
common failures. Reference images are generated by a script rather than hand-
placed, in both languages. All five locales move together.

Caught while reviewing the real dialog in Electron: after finishing the
walkthrough the form heading fell through to the atlas branch and announced
"I already have an action sheet" to someone who had just been walked through
drawing one. Covered by a test now.

Not done: docs/images/desktop_ui/15_pet_create_methods.png still shows the
old dialog and needs a fresh capture from a running app to match the styling
of the shots around it.
2026-07-27 07:20:09 +08:00

8.9 KiB
Raw Blame History

Desktop Feature Guide

This page summarizes the current user-visible Desktop surface.

Sessions and chat

  • Multiple tabs and project-filtered session history
  • Streaming Markdown, code, Mermaid, tool calls, thinking blocks, and permission requests
  • Image, file, directory, and PDF attachments with context preserved across restart and resume
  • Slash commands, @ file search, model selection, and supported reasoning-effort levels
  • Stop, resume, search, navigation outline, and checkpoint-based undo for the current turn
  • Restored scroll position and stable search in long, virtualized conversations

Permission controls

Desktop supports Ask, Accept Edits, Plan, Auto, and Bypass Permissions. Auto evaluates operations according to its policy; Bypass skips only approvals that are eligible to be skipped. Explicit denials, protected boundaries, and tools that require direct user interaction remain enforced.

The New Session permission menu showing all five execution modes

The selected mode is visible in the session composer. Higher-autonomy modes require an explicit warning confirmation.

Workspace and code review

The workspace panel combines:

The expanded workbench listing changed files, file types, and Git line counts

  • full-project file search using the packaged ripgrep binary;
  • a file tree, previews, and external-editor actions;
  • changed-file summaries and inline diffs;
  • single-line or contiguous-line review comments sent back into chat;
  • embedded terminal and local browser preview.

Branch and Current/Isolated Worktree selection belongs to the new-session launch controls. The workspace then shows the selected session's files, Git status, and diffs.

A real code diff with the inline local-comment editor open

Browser Preview

Switch the workbench from Files to Browser to open a local development page or HTTPS URL inside the app.

The embedded Browser Preview showing a safe documentation example page, address bar, screenshot action, and element picker

  • Screenshot sends the current page image back to the session.
  • Select element captures a page element, selector, and screenshot as explicit Agent context.
  • Treat authenticated pages, cookies, and external-site content as sensitive. Use a public demo page for documentation screenshots.

Tasks, SubAgents, and activity

The activity panel collects foreground tasks, background tasks, SubAgents, team members, and sources without flooding the main transcript.

Running SubAgents can be opened before they finish. Their status, output, tool activity, duration, and terminal state continue to refresh. Completed, failed, and stopped terminal states are persisted so they do not revert to “running” after restart.

The scheduled-task form with prompt, model, working directory, full-permission warning, frequency, and notification controls

Scheduled tasks support cron-based runs, model selection, enable/disable controls, manual execution, notifications, and history. New scheduled tasks currently run with Bypass Permissions; the form does not provide a permission selector. Use the smallest practical working directory and review the prompt before saving. Tasks run only while the Desktop app and computer remain available.

Providers and models

Provider settings support:

  • Claude, OpenAI, and Grok official login;
  • editable built-in presets;
  • Custom Anthropic, OpenAI Chat, and OpenAI Responses endpoints;
  • per-provider model mappings, context metadata, proxy mode, and supported effort levels;
  • connection testing and runtime model discovery where available.

The visible model catalog and supported effort levels depend on the current account, provider, and runtime response. Release-specific model names belong in release notes rather than this evergreen guide.

Skills and marketplace

The Skills area groups local Skills by source and exposes their metadata and files. The marketplace aggregates supported third-party sources with search, filters, details, file previews, installation confirmation, local installation state, and risk information.

The Skills marketplace showing source health, the third-party warning, filters, security status, and install state

Marketplace metadata is not a security guarantee. Review the source and requested behavior before installing a Skill.

Agent management

The Agents page shows built-in, user, project, plugin, and policy sources together with override and effective-state information.

Create Agent dialog showing scope, prompt, model, effort, and tool controls

Editable user and project Agents support:

  • reusable user scope or current-project scope;
  • model inheritance or an explicit model ID;
  • supported effort from low through max;
  • searchable tool selection plus custom and MCP tool rules;
  • a system prompt and description.

User Agents are stored in ~/.claude/agents/, while project Agents are stored in the current project's .claude/agents/. Built-in, plugin, and policy definitions remain read-only. Saving a definition and refreshing a running session are separate outcomes; a refresh failure does not silently discard a saved file.

Desktop pets

The optional pet window is a native transparent Electron surface. Open Settings → Pets, enable the window, and choose one of the four built-in companions: Dada, Huhu, Bubu, or Huihui.

Desktop Pet settings with the enable switch, built-in companions, and appearance controls

The pet reflects working, waiting-for-you, failed, and idle states. While a task is active, its task panel can show the session title and status; selecting a row returns to that session. The panel remains hidden when no task is active. If automatic display is disabled, an activity-count badge lets you open it when work is running.

The window also supports direct interaction:

  • hover to trigger a small reaction and idle gaze tracking;
  • click to wave and focus the main window;
  • drag to move the window, with its position restored after restart;
  • right-click to close it, then use Settings → Pets to show it again.

Add a custom pet

Select Add pet to choose a local creation path.

Add pet dialog with three ways to make a pet

  • Use a picture you already have turns a static transparent PNG or WebP into a lightweight locally animated pet. It will not run or track the cursor.
  • Draw one with AI that runs and jumps supplies a copyable prompt, a reference template and a checklist, so any drawing AI can produce an 8-column × 9-row action sheet you then pick.
  • I already have an action sheet skips the walkthrough and imports a sheet or finished atlas directly.

The last two paths slice, rescale and mirror the sheet locally on import, so exact source dimensions are not required; a finished 1536×2288 atlas is kept as-is.

Imports stay local and do not call the selected chat model. After a successful import, the custom companion appears under Your pets and becomes the selected pet.

A locally imported custom pet selected in the Your pets list

Size, animation, active-task-panel, and window-position preferences are restored between launches. Pets run only in the Electron desktop app and are not supported in H5. See the Desktop Pet Guide for image limits, atlas layout, storage, and troubleshooting.

A rebuildable SQLite projection accelerates session lists, global search, activity statistics, scheduled runs, teams, and traces. Original JSON and JSONL files remain authoritative. If the index is unavailable or damaged, readers can fall back to source files, and Diagnostics provides a confirmed rebuild action.

Rebuilding the index does not delete chats, settings, Skills, memory, tasks, or traces.

IM and H5

The desktop can launch sidecar adapters for WeChat, DingTalk, WhatsApp, Telegram, and Feishu. Each platform is private-chat oriented and requires an allowlisted or paired user. See IM Integrations.

H5 Access serves the browser UI from the local server for a trusted LAN or controlled reverse proxy. It uses a separate token and origin policy and is not a public multi-user account system.

Diagnostics and recovery

Diagnostics surfaces local-index health, sidecar and runtime information, fallback state, storage information, and safe rebuild actions. Startup failures that cannot be recovered automatically should remain visible rather than leaving only a background process.

Doctor and repair flows are intentionally conservative: protected user data is not silently reset.