Skip to content

feat!: Rest gets an end and Focus, the bubble says why she spoke, and her lines that cannot speak now wait and go out together - #2168

Merged
yw0nam merged 39 commits into
mainfrom
feat/2113-rest-and-waiting
Nov 27, 2026
Merged

yw0nam merged 39 commits into
mainfrom
feat/2113-rest-and-waiting

Conversation

@yw0nam

@yw0nam yw0nam commented Nov 27, 2026

Copy link
Copy Markdown
Owner

Summary

Rest gets an end time and Focus, the bubble says why she spoke, and her own lines that cannot speak now wait in one list instead of being dropped (D-79, D-88, D-71, D-73, D-89).

Character menu › Rest (right column)        tray "Do Not Disturb"      yui_run pace.rest
  status row · End now · choices · Focus         check = Rest|Focus           choice id | "off"
            └──────────── settings/rest (one record, end math) ────────────┘
                                   │ rest()  (read fresh)
self-started source ──► dispatcher admission ──► waiting list (ranked: now > scheduled > room)
  (schedule, idle cue,     arrive: debounce drop          │ free slot, present, no hold, cap room
   screen, first meeting,  addressed cap drop             ▼
   gesture, addressed)                           one turn: top entry + payload.waited + drained signals
user message ──────────────────────────────────► riders: entries that outlive user activity + signals
                                                          │
                                   client_context: do not disturb line · waited block · local signal stamp
                                   bubble: trigger line ("12:00 Lunch +2")

Rest and Focus (#2113, Task A). The Rest › list holds For 1 hour, Until tonight (00:00), Until tomorrow morning (08:00), Until I turn it off, and Focus 25 / 50 min. While one runs, a status row and End now lead the list. From 00:00 to 07:59 Until tonight is hidden, and yui_run refuses it then too. The Rest pill and the status pill show the end ("Rest · 08:00", "Focus · 18 min", "Quiet · 12:00" in an Active hours off span). The tray check follows a running Rest or Focus. client_context gets a do not disturb: line while Rest, Focus or an off span holds her own turns; backend-started turns are untouched (#1964).

  • Why 00:00 and 08:00: the owner's choice in the decision round (O2). Why 25 and 50: the Pomodoro lengths, chosen in the same round.

Trigger line (#2113, Task C). A turn she started shows why in the bubble's quote slot: a schedule cue's time and label, an idle cue's label, "First time today", a screen switch's app, or the character who spoke to her. Signal turns keep their source lines; touch, drag and drop show none. A waited turn adds +N.

Waiting list (#2166, Tasks E, F, F5). One ranked list at the admission point replaces the drops for Rest, the proactive gap, a live turn, playback and the hourly cap.

  • Keep rules: newest idle cue per cue, newest 3 screen reactions, 10 entries at most (lowest class, then oldest, leave first). Signal groups stay in their buffers and the list never drops one.
  • Expiry: the first meeting and addressed lines at the end of their local day; a schedule cue at the end of its grace window (stamped by the schedule source as expires_at); idle cues, gesture reactions and screen reactions on the next user activity (a user turn, a gesture, or Stop).
  • Release: at a free slot every admissible entry goes out as one turn, counted once against the hourly limit. guardrails splits into arrive (debounce, drops), canSpend (no spend) and spend (after the turn gate grants).
  • Batched signal groups go out alone only on the edge into a free slot (busy → idle, a hold ends, away → present), so today's 5-minute batching stays.
  • A user message carries the waiting entries that outlive user activity and the buffered signal groups. A self-started turn the user's message cancels returns to the list with its times; Stop cancels without returning it.
  • A schedule cue is marked fired only once its turn ends ok, so a restart inside its grace window brings it back. The list lives in memory.
  • client_context: a waited turn names its open candidates, each a past event with local time and age, its cue note and last together kept, and an idle cue's idle time counted up to send time. yui.waiting.list() / read(id) in yui_run show what waits, one short row each.

Breaking changes

Removed Replaced by
yui_run pace.rest boolean "hour" | "tonight" | "morning" | "until_off" | "focus_25" | "focus_50" | "off"
Stored yui.dnd {enabled} {choice?, startedAt?, endsAt?}; an old value reads as off (no migration)
client_context signal stamp @2026-11-27T03:31:00.000Z @12:31 local, 9min ago
client_context screen recent switches lines, TriggerMeta.screen.recent the waited block (each waited screen reaction is its own line)
configs/screen.json recent_cap, its Quick controls row, its yui_run row, screen.recent_cap_* i18n keys nothing (the list keeps the newest 3)
Drop reasons dnd, global_gap, stale_pending the waiting list; new reasons waiting_evicted, waiting_expired
The signal buffer's own catch-up flushes on present and busy → idle release() sends batched groups alone on the edge into a free slot
Log event dnd_toggle {enabled, via} rest_set {choice, via}

Related issues

Closes #2113
Closes #2166
Closes #1964
Part of #2108

Related decisions / docs

D-71, D-73, D-79, D-88, D-89.

Touched docs: docs/reference/client-context.md, docs/reference/client-tools.md, docs/reference/logging.md, docs/reference/signals-ingress.md, docs/reference/configuration.md, docs/agent-guide/architecture/map.js, docs/agent-guide/project-structure.md, docs/agent-guide/build-run.md, DESIGN.md, GLOSSARY.md, mocks/character-window/rest-and-trigger.html (+ mocks/README.md).

Runtime evidence (required for UI / DOM / runtime behavior)

  • Owner, verify bundle (2026-11-27): the Rest › list (rows, status row, End now) and its width, the status pill text, the tray check (follows Rest/Focus, unchecks at the end, a click ends or starts Until I turn it off), and a Focus counting down and ending (seeded with 3 min left). All confirmed.
  • Verify bundle log, waiting list: a Rest seeded to end at 21:35:40, a schedule cue due now and a fresh first meeting:
    21:31:49 [schedule-source] fire {"cue_id":"t-lunch","local_time":"21:31"}
    21:31:49 [milestone-source] fire {"name":"first_activity","local_time":"21:31"}
    21:31:49 [dispatcher] waiting_add {"id":"w1","event_name":"schedule.t-lunch","cls":"scheduled"}
    21:31:49 [dispatcher] waiting_add {"id":"w2","event_name":"time_milestone.first_activity","cls":"now"}
    21:35:40 [dispatcher] waiting_release {"ids":["w2","w1"],"signals":0}
    21:35:40 [dispatcher] fire {"seq_id":2,"event_name":"time_milestone.first_activity","tier":2}
    21:35:40 [dispatcher] turn {"trigger":"time_milestone.first_activity","outcome":"ok","spoke":true}
    
  • Real model (claude-sonnet-5-5 through a throwaway Hermes gateway, push transport):
    • A user message during Rest carried do not disturb: the character is resting at the user's request (for 10min); the rest ends at 22:31 local. The model answered the user turn normally, as intended (Rest holds only her own turns). One sample cannot show whether it read the line.
    • A waited turn's text, rendered by the shipped code (a schedule cue "Lunch" on top, a first meeting and an idle cue waited), drew "Hey, it's been quiet for a while." / "Have you eaten yet?" / "You wanted a reminder, so go grab something, even if it's small.": it took up two of the three candidates and left one, which the intro allows. This text was sent by a driver, not produced by the dispatcher end to end (the browser build has no OS idle ticks).
  • Not verified: hosts that report no OS idle time (Windows) read as away, so her own turns wait there; today's sources already ignore a null idle reading, so they did not fire there either.

Merge danger

Door: one-way for the stored Rest record (an old {enabled: true} reads as off after the update) and for the client_context / yui_run contract a backend may parse; two-way for everything else. Blast radius: every self-started turn in every pet window goes through the new admission; a defect there holds or bunches her own lines.

Verification

  • pnpm build passes (includes tsc typecheck)
  • pnpm test passes
  • pnpm lint passes (biome format + lint)
  • cargo test / cargo clippy pass (Rust changes) — no change under src-tauri/
  • Runtime evidence attached above, or N/A justified

pnpm gates on the integration branch at the final merge: all 16 gates exit 0 (cargo clippy/test skipped, no Rust change). Red runs, every new case red on an assertion before its implementation: Task A 78 + 2, Task C 19, Task E 43 + 2 + 2 + 3, Task F 11 + 6, F5 6.

Review: spec review before code (gpt-6.2 sol for #2113, glm-5.4 for #2166, one model per spec); Task A and Task E two-axis (standards + spec), Tasks C and F single, docs once. Each round's findings were fixed by the implementing agent.

Checklist (YUI principles)

  • Schema changes update docs/reference/client-context.md alongside the code
  • docs/agent-guide/architecture/map.js carries every module, part, and exchange this PR adds, removes, or changes (or none changed)
  • No unverified assumptions (docs first; web/context7 cross-check)
  • No brain in the client — judgment and mode live in the backend; persona text is client configuration (firing ≠ judgment)
  • No inline control tags — emotion/motion only via generate_express tool-call arguments
  • No hardcoding — endpoints/models/paths live in configs/
  • New/changed behavior ships a test in this PR (or skip-tests label justified)

…e she rests

Rest is one stored record with a choice and its end. The Character menu opens
it as a list in the right column, the status pill and the tray follow it, and
client_context carries a do not disturb line while a Rest, a Focus or an
active-hours quiet span holds her own turns.

BREAKING CHANGE: the yui_run pace.rest row takes "hour", "tonight", "morning",
"until_off", "focus_25", "focus_50" or "off" in place of a boolean.
…after midnight, and the tray sends only a change
A bundle's trigger now carries its own fire time and the other members it
waited with, projected through the same cue, milestone, screen and addressed
projections as a single trigger. The rendered block adds one `waited:` line per
member on a self-started turn and on the riders of a user turn, and the bubble
names a bundle by its first line plus the rest.

Breaking: the signal line stamps `HH:MM local, Nmin ago` instead of the ISO UTC
time. The screen `recent` buffer leaves the contract and the rendered block; the
waiting list keeps the newest three screen reactions instead.
The waited block opens with one line that names the character as the actor,
says the candidates are still open and have not been spoken to, and that the
backend picks among them. Item lines are past events with their age and local
clock, and a waited item keeps its cue note and last together line.

An idle cue's idle duration now includes its wait. A waited screen reaction
renders as a past event and drops the present-tense dwell clause, so its app
rides on the projection. The headline age appears only after a minute, the
signal clock helper is local to the renderer, and the bubble counts a waited
member only when it carries an event name and a numeric ts.
…st and go out together

A self-started candidate held by do-not-disturb, the proactive gap, a live turn,
playback, absence or the hourly cap now waits in the dispatcher's waiting list
instead of being dropped. At a free slot every admissible entry goes out as one
turn: the top-ranked envelope plus payload.waited, with the drained batched
signal groups as payload.signals. A user message carries every entry that does
not expire on user activity and the buffered groups. A self-started turn the
user cancels returns to the list with its original times.

- guardrails split into arrive (debounce), canSpend and spend; a bundle spends
  one slot once the turn lock grants
- the batched signals buffer leaves only through the dispatcher's drain and the
  batch timer; its edge catch-ups are gone
- a schedule cue is persisted as fired only once its turn ends ok (markSpoken)
- each pet window's dispatcher reads its own presence

BREAKING CHANGE: the drop reasons dnd, global_gap and stale_pending are gone
(waiting_evicted and waiting_expired join); Guardrails.evaluate is replaced by
arrive/canSpend/spend; the screen source no longer suppresses at the gap or
carries `recent`, and the screen.json `recent_cap` key, its setting row and its
Quick controls knob are deleted; ScheduleSource.restore is replaced by markSpoken.
…ctivity entries, and a buffered batched group leaves at the next edge
…stop expires the on-activity waiting entries
…ored fired Thread group leaves on the next drain
… Thread group handed back leaves on the next drain
…modules, and the schedule source stamps each cue's expires_at
…o yet

The yui API gains a waiting namespace in every Tauri pet window. list()
returns one short row per waiting entry and per buffered signal group: the id,
kind, label, local clock and minutes waited. read(id) answers the projected
waiting item or the signal group in full, and an unknown id as an error value.

The app wiring builds the plain rows from the dispatcher's waiting list and a
read-only peek of both signal buffers, late-bound because the tools exist
before the dispatcher and the sources. The screen projection exposes the app so
a waiting screen row names it.
…the glossary, design, architecture map and project structure

Adds the rest-and-trigger mock and its README row. The map drops the do-not-disturb store and gate names for Rest, and adds the waiting list, the trigger line and the yui.waiting rows. The Rest store keeps its yui.dnd key.
@yw0nam yw0nam added the breaking Breaking change: lists under Breaking changes in the release notes label Nov 27, 2026
@yw0nam
yw0nam merged commit e818e66 into main Nov 27, 2026
12 checks passed
@yw0nam
yw0nam deleted the feat/2113-rest-and-waiting branch November 27, 2026 12:48
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

breaking Breaking change: lists under Breaking changes in the release notes

Projects

None yet

1 participant