Repository navigation
Commit 825bca4
feat(goal-loop): one goal loop per session, and a goal panel bound to its session
The desktop held a single goal loop (`active` in goal-loop.ts; start threw
"a goal loop is already running") and one app-wide record. The strip above
every session showed that loop, or the last goal anyone started, whatever
session you were on: Muse #1's goal on the Muse anomalyco#2 tab. And Muse anomalyco#2 could not
have a loop at all while Muse #1's ran. Design: docs/accuracy-ui.md section 1.
Engine (desktop main):
- goal-loops.ts: a manager holding one createGoalLoop instance per session.
start refuses only when that session already has a running loop; a cap
(4) bounds how many run at once. stop/status take a session id; stop with
none stops the only loop and refuses when several run. Ended loops stay
listed for their session until dismissed.
- goal-loop.ts: the state carries phase (turn | waiting), checkedAt and
promptedAt, reported through a new onProgress hook (on a phase change,
otherwise every 10s) and never persisted or sent as a lifecycle event, so
the terminal event sequence is unchanged.
- goal-loop-store.ts: one running record and one last input per session;
the legacy single record is migrated as an orphan and cleared. The last
input of a session is never another session's.
- ipc/preload/renderer: stop/status/last take a session id; list, dismiss.
App:
- pages/session/goal-panel.tsx replaces pages/layout/sidebar-goal-loop.tsx
(and last-input.ts, only used by it). It shows the page's own loop only:
session title, a state tag in theme tokens, the goal in full (clamped to
two lines, "Show all"), iteration, last check, last nudge, directory,
ticket, and real Start / Stop / Dismiss buttons from the ui library.
- goal-loop/panel-view.ts: the pure view (which loop belongs to the page,
label, tone, times) and the per-session event fold; loops-store.ts is the
one shared subscription behind the panel and the session-list badge.
- the goal manager dialog takes the session it was opened from: it shows
that loop, prefills that session's goal and directory, and starts there.
- the ticket queue stops its own ticket's loop by session.
- notifications fire only on terminal events; a progress event would
otherwise have been toasted as a failure and silenced the real ending.
Tests, red first: goal-loops.test.ts (13) and panel-view.test.ts (11) ran
red before their modules existed; queue.test.ts "stop stops the loop of the
ticket that is running, by its session" red before the queue change; one
goal-loop.test.ts case for onProgress. goal-loop-store.test.ts (4) was written
with its module. Typecheck: tsgo -b clean in packages/desktop and
packages/app. Full app unit suite: 807 pass, 1 fail (i18n parity, fails on
dev too; the new English keys add to its missing list). The desktop
wait-timeout resilience test failed once in four runs (known goal-loop timing
flake). Prettier also reflowed a few long lines it flagged in files touched
here. The panel's look is not yet checked in a running app: the running dev
app hosts the Muses and was not touched.
Refs LDE-43, LDE-35
Co-Authored-By: Claude Opus 5 (1M context) <[email protected]>
Claude-Session: https://claude.ai/code/session_01FekmejALvftCz87WMu2wY91 parent b71eca6 commit 825bca4
28 files changed
Lines changed: 1312 additions & 491 deletions
File tree
- packages
- app/src
- components
- goal-loop
- i18n
- pages
- layout
- session
- desktop/src
- main
- preload
- renderer
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
28 | 28 | | |
29 | 29 | | |
30 | 30 | | |
31 | | - | |
| 31 | + | |
| 32 | + | |
| 33 | + | |
| 34 | + | |
| 35 | + | |
| 36 | + | |
32 | 37 | | |
33 | 38 | | |
34 | 39 | | |
| |||
39 | 44 | | |
40 | 45 | | |
41 | 46 | | |
42 | | - | |
| 47 | + | |
43 | 48 | | |
44 | 49 | | |
45 | 50 | | |
| |||
53 | 58 | | |
54 | 59 | | |
55 | 60 | | |
56 | | - | |
| 61 | + | |
57 | 62 | | |
58 | 63 | | |
59 | 64 | | |
| |||
64 | 69 | | |
65 | 70 | | |
66 | 71 | | |
67 | | - | |
| 72 | + | |
68 | 73 | | |
69 | 74 | | |
70 | 75 | | |
71 | 76 | | |
72 | 77 | | |
73 | 78 | | |
74 | | - | |
75 | | - | |
76 | | - | |
| 79 | + | |
| 80 | + | |
| 81 | + | |
| 82 | + | |
| 83 | + | |
| 84 | + | |
| 85 | + | |
77 | 86 | | |
78 | 87 | | |
79 | 88 | | |
| |||
87 | 96 | | |
88 | 97 | | |
89 | 98 | | |
90 | | - | |
| 99 | + | |
| 100 | + | |
| 101 | + | |
| 102 | + | |
| 103 | + | |
91 | 104 | | |
92 | 105 | | |
93 | 106 | | |
| |||
107 | 120 | | |
108 | 121 | | |
109 | 122 | | |
110 | | - | |
| 123 | + | |
111 | 124 | | |
112 | 125 | | |
113 | 126 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
74 | 74 | | |
75 | 75 | | |
76 | 76 | | |
77 | | - | |
78 | | - | |
79 | | - | |
| 77 | + | |
80 | 78 | | |
81 | 79 | | |
82 | 80 | | |
| |||
183 | 181 | | |
184 | 182 | | |
185 | 183 | | |
186 | | - | |
| 184 | + | |
187 | 185 | | |
188 | | - | |
| 186 | + | |
189 | 187 | | |
190 | 188 | | |
191 | 189 | | |
| |||
248 | 246 | | |
249 | 247 | | |
250 | 248 | | |
251 | | - | |
252 | | - | |
253 | | - | |
254 | | - | |
| 249 | + | |
255 | 250 | | |
256 | 251 | | |
257 | 252 | | |
258 | 253 | | |
259 | 254 | | |
260 | | - | |
261 | | - | |
262 | | - | |
263 | | - | |
| 255 | + | |
264 | 256 | | |
265 | 257 | | |
266 | 258 | | |
| |||
295 | 287 | | |
296 | 288 | | |
297 | 289 | | |
298 | | - | |
299 | | - | |
300 | | - | |
301 | | - | |
| 290 | + | |
302 | 291 | | |
303 | 292 | | |
304 | 293 | | |
| |||
This file was deleted.
This file was deleted.
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
| 1 | + | |
| 2 | + | |
| 3 | + | |
| 4 | + | |
| 5 | + | |
| 6 | + | |
| 7 | + | |
| 8 | + | |
| 9 | + | |
| 10 | + | |
| 11 | + | |
| 12 | + | |
| 13 | + | |
| 14 | + | |
| 15 | + | |
| 16 | + | |
| 17 | + | |
| 18 | + | |
| 19 | + | |
| 20 | + | |
| 21 | + | |
| 22 | + | |
| 23 | + | |
| 24 | + | |
| 25 | + | |
| 26 | + | |
| 27 | + | |
| 28 | + | |
| 29 | + | |
| 30 | + | |
| 31 | + | |
| 32 | + | |
| 33 | + | |
| 34 | + | |
| 35 | + | |
| 36 | + | |
| 37 | + | |
| 38 | + | |
| 39 | + | |
| 40 | + | |
| 41 | + | |
| 42 | + | |
| 43 | + | |
| 44 | + | |
| 45 | + | |
| 46 | + | |
| 47 | + | |
| 48 | + | |
| 49 | + | |
| 50 | + | |
| 51 | + | |
| 52 | + | |
| 53 | + | |
| 54 | + | |
| 55 | + | |
| 56 | + | |
| 57 | + | |
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
2 | 2 | | |
3 | 3 | | |
4 | 4 | | |
5 | | - | |
| 5 | + | |
6 | 6 | | |
7 | 7 | | |
8 | 8 | | |
| |||
80 | 80 | | |
81 | 81 | | |
82 | 82 | | |
83 | | - | |
| 83 | + | |
| 84 | + | |
| 85 | + | |
84 | 86 | | |
85 | 87 | | |
86 | 88 | | |
87 | | - | |
88 | | - | |
89 | | - | |
| 89 | + | |
90 | 90 | | |
91 | 91 | | |
92 | 92 | | |
| |||
0 commit comments