DSH Dafeiyu State: Sessions, Tool Calls & Animation

Author
DeepSeekAgent.io Editorial Team
Published
Updated

The hard part of a DSH-aware pet is not playing animation. It is compressing multiple Sessions, concurrent tools, transient errors, and approvals into one stable and truthful character state. Without aggregation, the pet flickers between thinking, working, and done or reports idle while work continues.

Never infer state from UI text

Use structured Host events rather than chat DOM, labels, model keywords, or timers. Events can provide Session identity, turn lifecycle, Tool Call start/result/error, approval waits, upstream progress, tool family, and elapsed time.

A model sentence saying “tests passed” must never trigger a real success animation.

Normalize events first

EventStateFeedback
Turn started, no toolTHINKINGthinking motion and low-frequency bubble
File, shell, search, or other toolWORKINGtool-family motion
Approval or answer requiredWAITINGclear, non-flashing prompt
Turn completed normallySUCCESSshort celebration then re-aggregate
Tool or turn failedERRORerror pulse and link to details
No active taskIDLEbreathing and micro-motions

Success and error are pulses, not durable truth. After a few seconds, recompute all active Sessions rather than forcing idle.

Rank Sessions by attention value

When several tasks run, use an explicit priority:

input required
> blocked or failed
> completed and unread
> running a tool
> thinking
> idle

Show the highest-priority Session in the main bubble and collapse others behind +N. Let users pin a Session. Avoid switching on every streaming event; a short stabilization window prevents concurrent tasks from fighting for the character.

Show tool families, not private arguments

The pet may distinguish shell, editing, search, browser, tests, and file reads, but its always-on-top bubble should not reveal full commands, paths, queries, or page titles.

Use labels such as “running a command,” “editing files,” “searching,” “running tests,” and “waiting for approval.” Open the original Session for details.

Three animation layers

  1. Agent state: thinking, working, waiting, success, error.
  2. Character micro-motion: blinking, glancing, swaying.
  3. User interaction: pat, poke, drag, feed.

Agent state persists until real events change. Micro-motion fills permitted gaps. Interaction temporarily covers the screen, then reads the current Agent state. If an error occurs while dragging, releasing the pet should reveal the error rather than the stale pre-drag state.

Routing bubble input

A transparent routing order is:

  1. user-pinned Session;
  2. Session shown in the foreground DSH page;
  3. Session waiting for user input;
  4. most recently user-interacted Session;
  5. otherwise request selection or creation.

Recent activity alone is unsafe because background tool events may steal the target. Show Session, workspace, and permission mode before sending, then provide an “open Session” action.

Disconnect and recovery

When the Client loses the Host, do not leave “working” frozen. Show offline and degrade to a static character. On reconnect, request a full snapshot rather than waiting for the next delta.

After Host restart, reconstruct state from current DSH Sessions. Animation frames are not business truth and do not need persistence.

Regression matrix

Test one complete turn; failure, retry, and success; two concurrent Sessions; child Agent completion while the parent continues; approval wait plus another completion; interaction during state change; Client reload; Host restart; deleted or moved Session; and reduced motion.

See the full build-your-own Dafeiyu guide and the permission boundary guide.

References