counterparts 0.3.27 → 0.3.29

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (93) hide show
  1. package/CHANGELOG.md +140 -0
  2. package/CONSTITUTION.md +7 -5
  3. package/docs/README.md +3 -1
  4. package/docs/module-map.md +12 -5
  5. package/package.json +1 -1
  6. package/src/adapters/claude-code/CONTRACT.md +12 -3
  7. package/src/adapters/claude-code/bin/runner.ts +10 -0
  8. package/src/adapters/claude-code/doctor-self-page.ts +71 -0
  9. package/src/adapters/claude-code/doctor.ts +23 -2
  10. package/src/adapters/claude-code/hooks.ts +10 -5
  11. package/src/adapters/claude-code/index.ts +3 -1
  12. package/src/adapters/claude-code/night-catch-up.ts +18 -19
  13. package/src/adapters/claude-code/night-run.ts +187 -59
  14. package/src/adapters/cli/CONTRACT.md +11 -2
  15. package/src/adapters/cli/catch-up.ts +10 -17
  16. package/src/adapters/cli/commands-note.ts +8 -0
  17. package/src/adapters/cli/commands-self.ts +53 -1
  18. package/src/adapters/cli/commands.ts +18 -0
  19. package/src/adapters/cli/dream-core.ts +28 -6
  20. package/src/adapters/cli/help.ts +2 -0
  21. package/src/adapters/cli/mechanisms.ts +4 -0
  22. package/src/adapters/dashboard/CONTRACT.md +7 -2
  23. package/src/adapters/dashboard/NOTES.md +31 -0
  24. package/src/adapters/dashboard/web/narrate.ts +5 -1
  25. package/src/adapters/dashboard/web/pages/self/index.js +3 -1
  26. package/src/adapters/dashboard/web/pages/self/sections/layers.js +160 -0
  27. package/src/adapters/dashboard/web/pages/self/self.css +11 -0
  28. package/src/adapters/dashboard/web/views/mechanisms.ts +4 -0
  29. package/src/adapters/dashboard/web/views/mind.ts +9 -0
  30. package/src/adapters/lifecycle.ts +34 -7
  31. package/src/adapters/log/CONTRACT.md +2 -0
  32. package/src/adapters/mcp/CONTRACT.md +44 -1
  33. package/src/adapters/mcp/NOTES.md +42 -0
  34. package/src/adapters/mcp/deliberate.ts +25 -1
  35. package/src/adapters/mcp/facts.ts +176 -8
  36. package/src/adapters/mcp/nights.ts +283 -0
  37. package/src/adapters/mcp/server-args.ts +42 -2
  38. package/src/adapters/mcp/server-self-tools.ts +50 -11
  39. package/src/adapters/mcp/server-session-end.ts +5 -0
  40. package/src/adapters/mcp/server-words.ts +7 -1
  41. package/src/adapters/mcp/server.ts +112 -13
  42. package/src/adapters/mcp/tools.ts +54 -24
  43. package/src/adapters/mechanism-evidence.ts +51 -7
  44. package/src/adapters/sidebar-status.ts +4 -3
  45. package/src/adapters/snapshots.ts +101 -2
  46. package/src/adapters/store-id.ts +68 -1
  47. package/src/core/associate/CONTRACT.md +2 -0
  48. package/src/core/briefing.ts +19 -1
  49. package/src/core/counterpart-deposit.ts +83 -2
  50. package/src/core/counterpart-types.ts +56 -0
  51. package/src/core/counterpart.ts +407 -90
  52. package/src/core/coverage/CONTRACT.md +2 -0
  53. package/src/core/dream/CONTRACT.md +73 -10
  54. package/src/core/dream/NOTES.md +158 -0
  55. package/src/core/dream/core-ask.ts +134 -0
  56. package/src/core/dream/index.ts +3 -1
  57. package/src/core/dream/reflect.ts +644 -111
  58. package/src/core/dream/unmarked.ts +135 -0
  59. package/src/core/embed/CONTRACT.md +2 -0
  60. package/src/core/encode/CONTRACT.md +2 -0
  61. package/src/core/fit/CONTRACT.md +2 -0
  62. package/src/core/handoff/CONTRACT.md +30 -1
  63. package/src/core/handoff/NOTES.md +86 -0
  64. package/src/core/handoff/last-here.ts +267 -59
  65. package/src/core/mint.ts +11 -0
  66. package/src/core/onboarding.ts +2 -1
  67. package/src/core/physics/CONTRACT.md +7 -1
  68. package/src/core/prospective/CONTRACT.md +13 -2
  69. package/src/core/prospective/NOTES.md +64 -0
  70. package/src/core/prospective/index.ts +143 -4
  71. package/src/core/recall/CONTRACT.md +11 -2
  72. package/src/core/recall/NOTES.md +53 -0
  73. package/src/core/recall/time-ask.ts +36 -6
  74. package/src/core/remember/CONTRACT.md +2 -0
  75. package/src/core/schemas/CONTRACT.md +11 -5
  76. package/src/core/seat.ts +93 -0
  77. package/src/core/self/CONTRACT.md +42 -9
  78. package/src/core/self/NOTES.md +184 -0
  79. package/src/core/self/briefing-delivery.ts +49 -0
  80. package/src/core/self/briefing.ts +20 -3
  81. package/src/core/self/identity.ts +23 -4
  82. package/src/core/self/index.ts +311 -9
  83. package/src/core/self/measures.ts +208 -0
  84. package/src/core/self/page.ts +211 -0
  85. package/src/core/self/tunables.ts +28 -1
  86. package/src/core/self/writer.ts +20 -8
  87. package/src/core/sleep/CONTRACT.md +9 -1
  88. package/src/core/sleep/core-standing.ts +50 -3
  89. package/src/core/sleep/index.ts +1 -1
  90. package/src/core/sleep/tunables.ts +13 -0
  91. package/src/core/store/CONTRACT.md +2 -0
  92. package/src/core/store/index.ts +31 -0
  93. package/src/core/store/reads-memories.ts +45 -1
package/CHANGELOG.md CHANGED
@@ -1,5 +1,145 @@
1
1
  # Changelog
2
2
 
3
+ ## 0.3.29 — 2026-10-21
4
+
5
+ Personal news now travels between your folders: each night the reflection looks at up to 24 memories nobody marked (it was 5), the personal-looking ones first, and marks the ones about you or the two of you so every folder's wake can show them, while work notes stay in the folder they came from; the morning share names what it re-marked and how to have one marked back, and nothing written in a folder you set off or paused is offered or carried out. In the plugin's sidebar the fox goes to work while Claude's turn runs and sits back down when it ends. The self page now keeps which memories each sentence rests on, doctor gains two reading-only lines ("Self page claims" and "Core"), and the dashboard's Self page shows the page in layers across its kept versions. The mechanism counts now include a dream's folds and band rises, so Consolidation and Interference read higher and Reconsolidation lower than before. Most of these are experiments, to be checked in a few days. Update the plugin with this release for the working fox and for sidebar mechanism counts that match the dashboard's; a 0.3.28 plugin keeps working beside this core, with the older counts. No store-format change (store v13, cache v7) and no wiring change: nothing to run after upgrading from 0.3.28, and `counterparts connect` is not needed.
6
+
7
+ - **A dream's folds count as Consolidation and Interference.** A fold gathers memories that
8
+ belong together into what they add up to; it now counts under both, as a dream's merges do,
9
+ on the dashboard, in `counterparts mechanisms` and in the sidebar. The settles a fold writes
10
+ over its parts count once, as the fold, and no longer under Reconsolidation.
11
+ - **"Rose a band" counts.** A memory that moves up a band now counts under Consolidation,
12
+ whichever pass recorded it. Before, the count looked only for a pass that never records a
13
+ crossing, so it was always 0. The crossing into the core is still counted once, as "became
14
+ core".
15
+ - **The exact-copy merge is worded for what reaches it**: "exact copy merged into the one
16
+ already held". A repeat in the same folder is turned away when it is written, which leaves no
17
+ row to count. A copy written from a second folder is merged at sleep, and a new test proves
18
+ that happens. Near-copies are still merged only in a dream; merging them at sleep too is
19
+ open.
20
+ - **The self page keeps what each claim rests on.** The nightly reflection can now cite memories
21
+ per sentence (`page.claims`) as well as for the whole page. The cites are kept beside the page,
22
+ and the page's words are unchanged. A sentence with no memory behind it is a hypothesis: it
23
+ is shown as one, never removed. An experiment.
24
+ - **Two new doctor lines, both readings only.** "Self page claims": how many claims the page
25
+ makes, how many memories it cites and how many of those are live, archived or missing, and how
26
+ many claims have no memory behind them. "Core": how many core elements there are, how many
27
+ have only one episode behind them, and the range of days and contexts their support spans.
28
+ `counterparts core --list` shows each element's returns, derivations and links.
29
+ - **The dashboard's Self page shows the page in layers.** It shows how each section read across
30
+ the page's kept versions, and how far back those versions reach. Below that it lists the
31
+ page's hypotheses. It is a view only; nothing is kept longer.
32
+ - **Personal news reaches your other folders more often.** The nightly reflection now looks
33
+ at up to 24 unmarked memories a night (it was 5), the ones that look personal first: a
34
+ feeling, someone's name, a weekend or a visit. When it marks one as about you or the two
35
+ of you, every folder's wake can show it. Work notes stay in the folder they were written
36
+ in. The morning share says what it re-marked: up to three by name; past that, two by
37
+ name and the rest as a count, and how to have one marked back. A memory written in a
38
+ folder you set off or paused is never offered, and never carried out of it by a mark.
39
+ An experiment.
40
+ - **The `about` field says what the mark does.** On `remember` and `session_end`: mark
41
+ anything personal owner or us, and it reaches every folder. Work belongs to its folder,
42
+ though sessions elsewhere may see its title. Left unmarked, a fact counts as this
43
+ folder's work.
44
+ - **The nightly run asks a seat.** For anyone embedding Counterparts: the package entry now
45
+ exports `Seat`, one interface for the model work the memory asks for at night (writing up
46
+ missed sessions, the dream, the reflection), with Claude Code's own night as its first
47
+ implementation. Nothing changes in how the night runs on Claude Code.
48
+ - **The sidebar's fox is at work while Claude's turn runs, as an experiment.** Send a prompt
49
+ and he gets up and goes to work: an alert face, with a tail wag, an ear twitch or a glance
50
+ every few seconds. He never lies down or naps mid-turn, and a dream or a saved memory still
51
+ plays and hands back to work. When the turn ends, for any reason, he blinks back to sitting
52
+ and lies down at 45 seconds and naps at 2 minutes, as before. In terminals that draw the
53
+ finer sextant fox, and on the desktop, he redraws about three times as often during a turn.
54
+
55
+ ## 0.3.28 — 2026-10-20
56
+
57
+ The morning share now closes the open threads that are plainly done, and says which and why; say one isn't done and it is reopened. The session-start wake repeats nothing: each session is named once, and "Today, elsewhere" and a new "Here, also open" say by title what the other open sessions are working on. Saying "done" to a weekly reminder closes just this week; it comes back on its next date. Last night's dream and reflection open by their ids, and `counterparts night` reads them without changing anything. The nightly run keeps the self page within its 4,600-byte room, the reflection answers core memories that have waited a week for keep or retire, and facts list the next twenty matches by title. Most of these are experiments, to be checked in a few days. If you use the plugin, update it with this release: the wake's head is now one tag, and a plugin of 0.3.27 or earlier reads the meeting and the store as unknown until it is updated, so its sidebar footer offers the 5-minute intro again and it skips its store check. No store-format change (store v13, cache v7) and no wiring change: nothing to run after upgrading from 0.3.27, and `counterparts connect` is not needed.
58
+
59
+ - **The nightly reflection closes open threads that are plainly done, and tells you, as an
60
+ experiment.** When a memory shows a thing finished, it closes the thread itself and the
61
+ morning share names it with why; say it isn't done and it is reopened, and then only
62
+ ever asked about. Threads it is unsure of, and private ones, are still asked about, as
63
+ before.
64
+ - **Last night opens by its id.** Recall now reads a dream's id (`drm_…`) or a
65
+ reflection's (`rfl_…`) — the ids the morning wake and the share name — as a short,
66
+ read-only summary: what the dream did, the memories it touched and its gists; the
67
+ reflection's entry, its share and whether it was told, what it cited, and any closes.
68
+ Opening one changes nothing. A night that rests on a confidential memory is withheld from
69
+ a session that isn't yours, and says so.
70
+ - **`counterparts night` reads the nights and changes nothing.** The recent dreams and
71
+ reflections, `last`, `last-reflection`, or one by id — the same lines as `dream --show`,
72
+ from a command with no undo, so a session can run it with you. Undo stays on
73
+ `counterparts dream`.
74
+ - **A weekly reminder can be marked done for this week.** Saying a repeating reminder was done
75
+ (a memory that updates it with `status: "done"`) closes just this time: it stops coming up
76
+ today, the reminder keeps its date and repeat, and it comes back on its next date. The answer
77
+ says which day was closed and when it returns. Dropping the date (`eventDate: null`) still
78
+ ends the repeat.
79
+ - **A "done" note written on its own points at the reminder it answers.** When a memory saying
80
+ something was done (or that you said it) lands next to a reminder due now, the answer names
81
+ the reminder and how to close it.
82
+ - **A memory a session just replaced still counts as drawn on.** Naming in `drewOn` a memory the
83
+ same session had just updated with a newer one (or one replaced that day) no longer refuses it.
84
+ One put away by a correction is still refused.
85
+ - **The session-start wake names each session once.** The Yesterday line leaves the newest
86
+ chapter written in this folder to "Last here", and "Last here"'s "Before it" and "+N more
87
+ here" lines, and the chapter-about-me line, leave out what Yesterday already names. A
88
+ Yesterday chapter with no room for its title is counted ("and 3 more"), never printed as a
89
+ bare id.
90
+ - **One tag at the top of the wake.** The meeting's state and the store's id are now fields of
91
+ the wake's own opening comment (`<!-- counterparts:wake meet=done store=st_… elements=…
92
+ bytes=… -->`), or of one `<!-- counterparts:session … -->` tag when there is no wake to
93
+ carry them. The sidebar reads both forms. An older sidebar (plugin 0.3.27 or before) reads
94
+ them as unknown until the plugin is updated: it skips its store check and keeps the
95
+ "5-minute intro" line in its footer.
96
+ - **The chapter-about-me line says where it is from first**: "A chapter about me from
97
+ ~/site: session …, Oct 19 — "…" (epi_…)."
98
+ - **"Coming up" at a session start lists what is due today.** A plain reminder due tomorrow is
99
+ counted with the other dates, as the evening's bundle still lists it for the next morning.
100
+ Every "Coming up" item now carries its own id, beside any "(earlier: …)" pointer.
101
+ - **One backup a day, even when two background runs start at once.** The daily snapshot
102
+ claims the day before it copies, so two runs at one boundary no longer leave two copies.
103
+ - **The nightly page writer and reflection keep your self page within its 4,600-byte room,
104
+ as an experiment.** The night's first page past the room is sent back to be cut, with how
105
+ many bytes over, rather than kept with a short version. A second try is kept, and a page
106
+ that was never sent again is kept when the night ends, so a night's rewrite is never lost.
107
+ A page past the room that has a short version now shows the short version in the wake, so
108
+ the lists beside it keep their room. Pages you or a session write are not held.
109
+ - **A core memory that has waited a week for "keep or retire" gets answered, as an
110
+ experiment.** The nightly reflection is offered up to three that have waited 7 lived
111
+ days, decides the ones it can with a reason, and the morning share says which, in one
112
+ line. Say one was wrong and it is undone: a memory a reflection retired comes back into
113
+ the core with a keep (`counterparts core --reaffirm <id> --reason "..."`, or just say
114
+ so in a session). Agree with one instead (`counterparts core --demote <id>`) and it
115
+ is recorded as your retire, which no session can undo; your own `--reaffirm` still
116
+ can. The wake's "Still open" leads with a week-old one, and still says
117
+ "keep or retire it" when the memory is also unsettled. Doctor's Reflection line counts
118
+ the ones waiting.
119
+ - **Asking for facts also lists the next matches by title.** After the ten results, the next
120
+ twenty are listed one line each (title, id and date), so a memory ranked a little lower is in
121
+ sight and can be opened by its id without asking for page 2. Being listed doesn't strengthen
122
+ a memory; opening it does.
123
+ - **"Lately" and "recently" no longer hide older facts.** A facts question with "lately",
124
+ "recently", "these days" or "nowadays" ranks the past week's matches first instead of keeping
125
+ only those, and says so. "What happened lately?" on its own still means the past week, and
126
+ "last week" or "in September" still keep only that time.
127
+ - **The sidebar's fox stays up while Claude is working, as an experiment.** Any tool call,
128
+ including one waiting on a permission prompt, starts his idle clock over, so he no longer
129
+ lies down or naps in the middle of a long call; he lies down at 45 seconds and naps at 2
130
+ minutes after the last activity, as before. A memory saved from a session shows his
131
+ notepad once.
132
+ - **"Today, elsewhere" and "Since you started" say what the other sessions are working on.**
133
+ Beside each folder's memory count they name up to two of its memories by title and id,
134
+ work in progress first ("planned" or "done" marks, then work memories), newest first:
135
+ `~/random open since 08:33 (live), 8 memories: "Wake check 10-20" (mem_…), "Spans out of
136
+ backups" (mem_…)`. Other sessions open in the same folder get a clause of their own:
137
+ `Here, also open: session 25e12e7d on Fable 5 since 10:05: "…" (mem_…)`. Never from a
138
+ folder that is off, paused or observed, never a confidential memory, a dated one, one about
139
+ you, about the two of you or about your counterpart itself, or small talk. "Since you
140
+ started" names only what was written since it last told you. Both lines stay within their
141
+ old size.
142
+
3
143
  ## 0.3.27 — 2026-10-19
4
144
 
5
145
  Recall learns from use, and finds "baking" when you say "bake". The memories a session rates useful, draws on or opens count as used, memories found useful together get linked, and one rated noise twice comes up less for a while; what the conversation has been about, and what is open in its folder, gives related memories a head start. Recall matches word forms and counts everyday words for less, a session's first prompt is matched by meaning too, footnotes skip what this session wrote, and a newer memory stands in for the one it replaced. Most of these are experiments, to be checked in a few days. `counterparts doctor` gains a Feedback loop line. No store migration (store v13) and no wiring change, so `counterparts connect` is not needed; the word index re-indexes itself once in the background (cache v6 to v7, under a second on a typical store). Going back to 0.3.26 is not a plain reinstall: its memory tools refuse the newer cache, and its hooks miss word matches without saying so. To go back, delete `~/.counterparts/store/cache/cache.sqlite*`, then run `counterparts verify --rebuild --keep-vectors --dir ~/.counterparts/store` on 0.3.26 (recall by meaning comes back over the next few sessions, as the background worker re-reads the memories); `counterparts rollback` does not cover a cache change.
package/CONSTITUTION.md CHANGED
@@ -1,9 +1,9 @@
1
1
  # The Counterparts Constitution
2
2
 
3
- _Ratified by the owner 2026-08-25; last amended 2026-10-11 (this file's git history is
3
+ _Ratified by the owner 2026-08-25; last amended 2026-10-20 (this file's git history is
4
4
  the amendment log). This is the ONE page with standing authority — everything else,
5
- including owner answers given during the build, is a working default, revisable without
6
- ceremony when it fights this page. Changing THIS page is deliberate and rare._
5
+ including owner answers given during the build, is a working default, open to discussion
6
+ at any time and revisable without ceremony. Changing THIS page is deliberate and rare._
7
7
 
8
8
  **Thesis — why this exists**
9
9
 
@@ -56,8 +56,10 @@ ceremony when it fights this page. Changing THIS page is deliberate and rare._
56
56
  deliberate, named, and defended. (Reference shelf: the owner's memory field guide,
57
57
  mikelapeter.com/lab/memory.)
58
58
  13. **Decisions are defaults.** Only this page is scripture, including this line.
59
- Everything else is revisable without ceremony when it fights the thesis. Changing
60
- this page is deliberate and rare.
59
+ Everything else (contracts, rulings, tunables, owner answers) guides the work
60
+ without limiting it. Any of it can be raised for discussion at any time, and it is
61
+ revised without ceremony when a better way shows up or it fights the thesis.
62
+ Changing this page is deliberate and rare.
61
63
  14. **Port the scars, not the code.** Learnings travel as acceptance criteria, never as
62
64
  copy-paste.
63
65
  15. **Complexity is earned.** Start with the simplest brain-faithful rule that could
package/docs/README.md CHANGED
@@ -15,7 +15,9 @@ has it; every other page is a working default or a record of what happened.
15
15
 
16
16
  ## Where the work is going
17
17
 
18
- - [`ROADMAP.md`](ROADMAP.md) — the plan for the current round.
18
+ - [`ROADMAP.md`](ROADMAP.md) — the plan for the current round, one line per thing to do.
19
+ - [`WORKLIST.md`](WORKLIST.md) — the details behind the roadmap's to-do list.
20
+ - [`CHECK-AFTER.md`](CHECK-AFTER.md) — experiments in use, each with a date to check.
19
21
  - `HANDOFF.md` — the note one session leaves for the next. It is written locally and is not in
20
22
  the repository (ignored since 2026-10-02).
21
23
  - [`IMPROVEMENTS.md`](IMPROVEMENTS.md) — things noticed while living on it, as opposed to
@@ -19,7 +19,7 @@ code and the `NOTES.md` / `INTERFACE-GAPS.md` next to it.*
19
19
  | `embed/` | — (a gist, not a reading) | Text in, vector out, on this machine, for nothing: the static embedding table (`static.ts`, potion-base-8M) that gives recall's semantic channel a source with no key. Zero code dependencies; its weights ship as the data-only package `counterparts-model-potion`, the one runtime dependency. The only embedder since 2026-09-24, when the paid Voyage seat was removed. **Added 2026-09-23 (roadmap C1).** |
20
20
  | `associate/` | Hebbian linking | Co-activation strengthens links; spreading activation at recall. **RESOLVED (owner, 2026-08-25): stays a module** — edge-level arithmetic keeps `physics/` one page; Hebbian plasticity/contiguity is its own mechanism in the field guide. |
21
21
  | `schemas/` | semantic memory | Entities and beliefs; birth by mention, death by decay; strength-weighted revision with row history. |
22
- | `self/` | autobiographical self | Identity documents, episodes, the wake briefing (v0's briefing, grown up). Governed: frozen self-reinforcement rules. |
22
+ | `self/` | autobiographical self | Identity documents, episodes, the wake briefing (v0's briefing, grown up). Governed: for now, the freeze guards only the crash-fallback sweep; the night is guarded by spacing, citations and visibility (self/CONTRACT §2(d)). |
23
23
  | `prospective/` | prospective memory | Future intentions, cued by time or context; fire / suppress / reference telemetry. |
24
24
  | `handoff/` | working context for a place | The per-directory handoff: where the work here stands, written as a field on the end-of-session ask, shown as a two-line pointer at the next wake in that directory, expiring in lived days. **Never a memory** — out of recall, out of credit, out of consolidation, out of identity. **Added 2026-09-20 (E1, spec §6.4 / §15 item 6).** |
25
25
  | `coverage/` | rehearsal debt | What is not written up yet, read in one place: per session, the unwritten stretch since its last claim in `coverage.jsonl`. The pacer's third ask (pieces and time), the one rule for what a session owes (retention, the next-session write-up), lapse after fourteen days of use (two until 2026-10-10), the handoff pointer's "how current", and one row per stretch per state. Changes nothing about how pieces are claimed. **Added 2026-09-30.** |
@@ -91,13 +91,15 @@ importers are pinned (`split-parts.test.ts`).
91
91
  ## Rulings — 2026-08-25 (check-in + adversarial review, all owner-ratified)
92
92
 
93
93
  Contracts are read subject to these; where a contract still says PROPOSED on a listed
94
- item, this section is the newer law.
94
+ item, this section is newer than the contracts, and like them open to discussion
95
+ (constitution line 13).
95
96
 
96
97
  1. `associate/` stays a module; observer is a mode (`docs/observer-mode.md`); `encode/`
97
98
  stays separate; `dashboard/` added as an adapter (constitution line 16, ratified).
98
99
  2. Physics: pressure-accumulator revision (§5.6 rewritten — field on target, one credited
99
100
  challenge/day, force = strength × sal, novelty at encoding only); nothing born into
100
- identity, N = 3 promotion at consolidation (§5.3 rewritten); bands 4→3 and one strength
101
+ identity, promotion through the core lanes (physics/CONTRACT.md §5.3, rewritten
102
+ 2026-09-26); bands 4→3 and one strength
101
103
  number both settled; decay is a three-way (flat/exponential/power-law) decided by
102
104
  replay; H = 90 is a TUNABLE default, not an owner ruling.
103
105
  3. Settled drops: identity-promotion surface, `protected.add` queue, model-seat pins,
@@ -112,7 +114,8 @@ item, this section is the newer law.
112
114
 
113
115
  Owner-decided (2026-08-25, bansai `docs/DECISIONS.md`): experiencer authorship with
114
116
  crash fallback; librarian-as-physics with zero standing model calls; strength-weighted
115
- revision (no ledger subsystem); only physics forgets; the three storage boxes;
117
+ revision (no ledger subsystem); only physics forgets (no model deletes; for now, a model
118
+ may archive, with a record and an undo); the three storage boxes;
116
119
  birth-by-mention entities; Amendment 15. Anything a CONTRACT drops beyond that list is
117
120
  marked **PROPOSED** and waits for the owner's check-in.
118
121
 
@@ -120,4 +123,8 @@ marked **PROPOSED** and waits for the owner's check-in.
120
123
  prose box is gone and the memory IS the row. That is the same owner, revising his own
121
124
  default — "going forward by 'readable' we mean if someone can view them" (2026-09-16),
122
125
  and `docs/storage-spec-2026-09-16.md` §15 item 9, "everything lives in the database for
123
- now; markdown is an export". The other seven entries above are untouched.*
126
+ now; markdown is an export". The other seven entries above were untouched by that change.*
127
+
128
+ *Everything here guides the work; it doesn't limit it. Anything here, RESOLVED items
129
+ included, can be raised for discussion at any time and revised when there's a better way
130
+ (constitution line 13).*
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "counterparts",
3
- "version": "0.3.27",
3
+ "version": "0.3.29",
4
4
  "license": "MIT",
5
5
  "description": "Memory that turns AI tools into counterparts - a local-first, human-memory-modeled memory layer for AI.",
6
6
  "repository": {
@@ -1,5 +1,7 @@
1
1
  # `adapters/claude-code/` — CONTRACT
2
2
 
3
+ *This contract guides the work; it doesn't limit it. Anything here, RESOLVED items included, can be raised for discussion at any time and revised when there's a better way (constitution line 13).*
4
+
3
5
  ## 1. Purpose
4
6
 
5
7
  The launch adapter: wake injection at session start, the end-of-session write, and crash
@@ -147,7 +149,7 @@ credential — belongs here, discovered at runtime, never assumed by the core.
147
149
  2026-09-24 there are no keys at all (§1a), so there is nothing to rotate and no credential
148
150
  source to configure. (Until then credentials came from one configured source the package
149
151
  owned, never an inherited shell environment — scar §2.18.)
150
- - **Model-seat pins are dropped.** **PROPOSED** — owner call at check-in. Constitution
152
+ - **Model-seat pins are dropped.** **Decided, for now** (owner, 2026-10-20; settled by module-map Rulings 3 of 2026-08-25). Constitution
151
153
  line 2 says which seat runs which job is a design choice, never doctrine, and the model
152
154
  lineup will have moved. What is **kept** is the bake-off *method* (earned-mechanism #20:
153
155
  real archived inputs through the real path, blind-judged, including the losing tier as a
@@ -413,7 +415,9 @@ row, saying which source answered, existed until the keys were removed — §1a.
413
415
  **AND, AT A PROMPT, WHAT CHANGED SINCE (2026-10-11).** A session already open
414
416
  never reads a wake again, so `userPromptSubmit` may add one "Since you started"
415
417
  line for the model (`Lifecycle#sinceLine` → `Counterpart#sinceElsewhere`): another
416
- directory's session started or ended, a chapter, new memories, since this session
418
+ directory's session started or ended, a chapter, new memories (since 2026-10-20 up
419
+ to two by title, only ones written since the line last told; and another session
420
+ open in this same folder that started or wrote something), since this session
417
421
  last heard. The same gate as "Today, elsewhere" (`elsewhereGate`, one code path)
418
422
  and the same registry hand-over (`elsewhereHere`). At most once an hour, never at
419
423
  the first prompt after a wake; the state is the session record's `sinceSeen`
@@ -628,7 +632,12 @@ row, saying which source answered, existed until the keys were removed — §1a.
628
632
  as "delete them all"); and **a half-copy is never a snapshot** — the copy is
629
633
  written under a `.partial-…` name and renamed into place, so a worker killed
630
634
  mid-copy leaves something that is not counted toward `keep`, does not satisfy
631
- "today's exists", and is swept once it is too old to be a live run's.
635
+ "today's exists", and is swept once it is too old to be a live run's. **One copy
636
+ a day when two runs start together** (2026-10-20): a run claims the day first
637
+ (`.taking-<date>`, a file created exclusively), looks again under the claim, and
638
+ lets it go once its copy is in place or has failed; the run that finds the claim
639
+ held writes nothing (`already-today`). A killed run's claim is stale, and taken
640
+ over or swept, by the partials' bound.
632
641
 
633
642
  *For now:* the default directory applies only inside the layout this package
634
643
  creates (the store is the `store/` subdirectory of a base directory). A store
@@ -72,6 +72,7 @@ import { fileURLToPath } from "node:url";
72
72
 
73
73
  import { Counterpart, RUNNER_FAILED_EVENT } from "../../../core/counterpart.js";
74
74
  import { recordCoverage } from "../../../core/coverage/index.js";
75
+ import { PAGE_HELD_SETTLE_MS } from "../../../core/self/index.js";
75
76
  import { clearIdleCarries } from "../../../core/recall/index.js";
76
77
  import { RETENTION_EVENT, retentionRow, retentionRuns } from "../../../core/remember/index.js";
77
78
  import type { HostSessionEvidence, RetentionReport } from "../../../core/remember/index.js";
@@ -454,6 +455,15 @@ export async function runOnce(input: {
454
455
  // render re-renders it now, not at the next lived day. After the cycle, whose own render already caught up to what was
455
456
  // marked before it; nothing marked, nothing rendered.
456
457
  // Its own try: a render that fails costs the refresh, and the mark stays.
458
+ // First, A HELD PAGE NO RUN END KEPT (review of #541): a night launched
459
+ // from a session (the default `ask`) or a run killed after the hold never
460
+ // reaches `runNight`'s keep, so a boundary keeps it once it has settled —
461
+ // only while the page still stands where it was held.
462
+ try {
463
+ counterpart.self.keepHeldPage({ settledMs: PAGE_HELD_SETTLE_MS });
464
+ } catch {
465
+ /* the held page stays on its refusal row for the next boundary */
466
+ }
457
467
  try {
458
468
  const wake = counterpart.refreshWake({ at: today });
459
469
  if (wake.reason !== "current") emit("runner.wake", { reason: wake.reason, triggers: wake.triggers.join(","), bytes: wake.bytes });
@@ -16,6 +16,8 @@ import {
16
16
  import type { DreamingSetting } from "../../core/dream/index.js";
17
17
  // The page's own reader, so this line cannot drift from what the wake prints.
18
18
  import { clearedMarker, findPageRow, readSelfPage } from "../../core/self/page.js";
19
+ import { coreSupport, pageTrace } from "../../core/self/measures.js";
20
+ import type { CoreSupportRow } from "../../core/self/measures.js";
19
21
  import {
20
22
  dayBefore,
21
23
  hasDayBefore,
@@ -266,6 +268,75 @@ export function selfPageFindings(store: Store): Finding[] {
266
268
  ];
267
269
  }
268
270
 
271
+ /**
272
+ * WHAT THE PAGE'S CLAIMS REST ON (2026-10-20, an experiment; `self/measures.ts`).
273
+ * A reading, always green: its claims (sentences), the memories it cites and
274
+ * where they stand now, and the claims with no memory behind them — hypotheses,
275
+ * shown as such, never removed. A page from before cites were kept with it says
276
+ * so rather than reading as all hypotheses. Silent with no page: the Self page
277
+ * line already says why.
278
+ */
279
+ export function selfPageTraceFindings(store: Store): Finding[] {
280
+ const page = readSelfPage(store);
281
+ if (page === null) return [];
282
+ const t = pageTrace(store, page);
283
+ const n = (k: number, one: string, many: string): string => `${String(k)} ${k === 1 ? one : many}`;
284
+ const cited =
285
+ t.source === "none"
286
+ ? `no cites kept with it (written by ${page.by ?? "an unrecorded door"})`
287
+ : `${t.source === "reflection" ? "its reflection's record cites" : "cites"} ${n(t.cites, "memory", "memories")}, ${String(t.live)} live, ${String(t.archivedOrMissing)} archived or missing`;
288
+ const perClaim =
289
+ t.uncited === null
290
+ ? t.source === "none"
291
+ ? ""
292
+ : "; cites were not kept per claim for this version"
293
+ : `; ${n(t.uncited, "claim", "claims")} with no memory behind ${t.uncited === 1 ? "it" : "them"}`;
294
+ return [
295
+ finding(
296
+ "self-page-trace",
297
+ "green",
298
+ "Self page claims",
299
+ `${n(t.claims, "claim", "claims")}; ${cited}${perClaim}`,
300
+ "",
301
+ { claims: t.claims, source: t.source, cites: t.cites, live: t.live, archivedOrMissing: t.archivedOrMissing, uncited: t.uncited },
302
+ ),
303
+ ];
304
+ }
305
+
306
+ /**
307
+ * WHAT STANDS BEHIND THE CORE (2026-10-20, an experiment; `self/measures.ts`).
308
+ * A reading, always green: nothing promotes or demotes on it. "One episode
309
+ * behind it" is an element whose returns and derivations all sit on one lived
310
+ * day; links are counted beside them and widen no span (review of #550). Reads every live row and every edge, so it stays out of the
311
+ * session-start reading.
312
+ */
313
+ export function coreSupportFindings(store: Store): Finding[] {
314
+ const s = coreSupport(store);
315
+ const els = s.elements;
316
+ if (els.length === 0) return [finding("core-support", "green", "Core", "no elements yet", "", { elements: 0 })];
317
+ const range = (pick: (e: CoreSupportRow) => number): string => {
318
+ const v = els.map(pick);
319
+ const lo = Math.min(...v);
320
+ const hi = Math.max(...v);
321
+ return lo === hi ? String(lo) : `${String(lo)}–${String(hi)}`;
322
+ };
323
+ return [
324
+ finding(
325
+ "core-support",
326
+ "green",
327
+ "Core",
328
+ `${String(els.length)} ${els.length === 1 ? "element" : "elements"}; ${String(s.oneEpisode)} with one episode behind ${s.oneEpisode === 1 ? "it" : "them"}; ` +
329
+ `span ${range((e) => e.days)} ${range((e) => e.days) === "1" ? "day" : "days"}, ${range((e) => e.contexts)} ${range((e) => e.contexts) === "1" ? "context" : "contexts"}; returns ${range((e) => e.returns)}, derivations ${range((e) => e.derivations)}, links ${range((e) => e.links)}`,
330
+ "",
331
+ {
332
+ elements: els.length,
333
+ oneEpisode: s.oneEpisode,
334
+ rows: els.map((e) => `${e.id}:${String(e.returns)}/${String(e.derivations)}/${String(e.links)}/${String(e.days)}d/${String(e.contexts)}c`).join(" "),
335
+ },
336
+ ),
337
+ ];
338
+ }
339
+
269
340
  /** How doctor names each rung the last wake printed the page on (`self/briefing.ts#PageRung`). */
270
341
  const PAGE_RUNG_WORDS: Readonly<Record<string, string>> = {
271
342
  whole: "it whole",
@@ -74,7 +74,7 @@ import {
74
74
  } from "../../core/store/index.js";
75
75
  import { heldCorrections } from "../../core/reconsolidation.js";
76
76
  import { bundledModelDir } from "../runtime.js";
77
- import { acceptsReflectedFeeling, laterFeelingWasAwake, laterFeelingWasReflections, selfRelevantFeeling } from "../../core/sleep/index.js";
77
+ import { TUNABLES as SLEEP_TUNABLES, acceptsReflectedFeeling, laterFeelingWasAwake, laterFeelingWasReflections, selfRelevantFeeling } from "../../core/sleep/index.js";
78
78
  import { TUNABLES as ASSOCIATE_TUNABLES, isDead, pairKey } from "../../core/associate/index.js";
79
79
  import type { EventRow } from "../../core/store/index.js";
80
80
  // The ask allowance the amber hint names, read rather than retyped: a number in
@@ -84,7 +84,7 @@ import { WORK_OVERFLOW_EVENT } from "../../core/self/work.js";
84
84
  import { HANDOFF_REFUSED_EVENT } from "../../core/handoff/index.js";
85
85
  import { LAST_HERE_NOROOM_EVENT } from "../../core/handoff/last-here.js";
86
86
  import { TOOL_RESULT_CEILING } from "../../core/fit/index.js";
87
- import { awakeFeelingCounts, nightRunOf } from "../../core/dream/index.js";
87
+ import { awakeFeelingCounts, coreWaiting, nightRunOf } from "../../core/dream/index.js";
88
88
  import type { DreamingSetting } from "../../core/dream/index.js";
89
89
  import type { AskReason } from "../../core/self/episodes.js";
90
90
  // The what-fired reading, shared with the console's `fired` command and the
@@ -134,6 +134,8 @@ import {
134
134
  } from "./doctor-upgrades.js";
135
135
  import {
136
136
  selfPageFindings,
137
+ selfPageTraceFindings,
138
+ coreSupportFindings,
137
139
  pageWriterFindings,
138
140
  dreamingFindings,
139
141
  nightRunFindings,
@@ -168,6 +170,8 @@ export {
168
170
  dreamingFindings,
169
171
  nightRunFindings,
170
172
  selfPageFindings,
173
+ selfPageTraceFindings,
174
+ coreSupportFindings,
171
175
  pageWriterFindings,
172
176
  PAGE_WRITER_STALE_DAYS,
173
177
  } from "./doctor-self-page.js";
@@ -2280,7 +2284,18 @@ export function reflectionFindings(input: DoctorInput, store: Store): Finding[]
2280
2284
  last.entry_id === null ? "nothing much" : "an entry"
2281
2285
  }${last.page_version === null ? "" : ", the self page rewritten"}, ${share[last.share_state] ?? last.share_state}`;
2282
2286
  const byHow = `returns this week — awake ${String(returns.awake)}, reflection ${String(returns.reflection)}, dream ${String(returns.dream)}`;
2287
+ // CORE QUESTIONS THAT WAITED (2026-10-20, an experiment): flagged a week
2288
+ // or more ago with no decision since — what the reflection is offered.
2289
+ let coreWaited = 0;
2290
+ try {
2291
+ coreWaited = coreWaiting(store, store.livedDay()).length;
2292
+ } catch {
2293
+ coreWaited = 0;
2294
+ }
2283
2295
  const aloneLine =
2296
+ (coreWaited > 0
2297
+ ? `; ${String(coreWaited)} core ${coreWaited === 1 ? "memory has" : "memories have"} waited ${String(SLEEP_TUNABLES.CORE_WAITING_DAYS)}+ lived days for a keep or retire (counterparts core --list shows them)`
2298
+ : "") +
2284
2299
  (promotionsUnread
2285
2300
  ? `; how many became core on reflection alone is unknown: more than ${String(PROMOTED_ROWS)} promotions in the log, and only the newest ${String(PROMOTED_ROWS)} were read`
2286
2301
  : "") +
@@ -2325,6 +2340,7 @@ export function reflectionFindings(input: DoctorInput, store: Store): Finding[]
2325
2340
  awakeFeelings: awake.total,
2326
2341
  awakeFeelingsFast: awake.fast,
2327
2342
  awakeFeelingsOwner: awake.owner,
2343
+ coreWaited,
2328
2344
  },
2329
2345
  ),
2330
2346
  ];
@@ -3346,6 +3362,11 @@ export function doctorFindings(input: DoctorInput): Finding[] {
3346
3362
  // line would grade a default nobody chose.
3347
3363
  ...(unread ? [] : [["snapshot", (): Finding[] => snapshotFindings(input, store)] as const]),
3348
3364
  ["self-page", () => selfPageFindings(store)],
3365
+ // 2026-10-20, two readings of the self (an experiment): the page's claims
3366
+ // and what they rest on, and what stands behind each core element. Never
3367
+ // amber. The second reads every live row and edge: not at session start.
3368
+ ["self-page-trace", () => selfPageTraceFindings(store)],
3369
+ ...(input.budgetMs !== undefined ? [] : [["core-support", (): Finding[] => coreSupportFindings(store)] as const]),
3349
3370
  ["page-writer", () => pageWriterFindings(store, input.config)],
3350
3371
  // C2's one line, `Write-ups` since 2026-09-30. Not in the session-start
3351
3372
  // reading: it is never red, which is all that notice prints, and it reads
@@ -82,7 +82,7 @@ import { nightRowTimeoutMs, planNightRunner } from "./night-run.js";
82
82
  import { NOTHING_OWED_BEFORE_KEY, catchUpOf, catchUpWords, owedBefore } from "./night-catch-up.js";
83
83
  import type { NightKind } from "./night-run.js";
84
84
  import { spawnDetached } from "../spawn.js";
85
- import { ONE_TAG_LINE, wakeTagLead } from "../store-id.js";
85
+ import { ONE_TAG_LINE, tagLead } from "../store-id.js";
86
86
  import type { SpawnOutcome } from "../spawn.js";
87
87
  import { NO_ARRIVAL, STOP_ASK_OPENER, readWakeArrival, startedByHost } from "./transcript.js";
88
88
  import type { WakeArrival } from "./transcript.js";
@@ -538,7 +538,7 @@ export const RESUME_WAKE_LINE =
538
538
  "Counterparts: this session was resumed; the wake it was handed when it started (above) still holds.";
539
539
 
540
540
  /** What `sessionStart` hands the host: a composed wake, or a resume's line. */
541
- type WokeHere = Pick<ReturnType<Lifecycle["composeWake"]>, "text" | "ok" | "bytes" | "sentinel" | "preface" | "lined"> & {
541
+ type WokeHere = Pick<ReturnType<Lifecycle["composeWake"]>, "text" | "ok" | "bytes" | "sentinel" | "preface" | "lined" | "tags" | "tagged"> & {
542
542
  readonly reason: string;
543
543
  };
544
544
 
@@ -642,7 +642,10 @@ export class ClaudeCodeAdapter extends Lifecycle {
642
642
  // the "Since you started" line says what changed elsewhere since it
643
643
  // last heard. No wake is composed, so no new expectation is written for
644
644
  // the delivery check, and the since-line's state is left to the line.
645
- const woke: WokeHere = resumed ? this.resumeWake(input) : this.composeWake(input, budget);
645
+ // The markers ride in the composed wake's head tag (2026-10-20, ONE
646
+ // TAG; `Lifecycle#composeWake`).
647
+ const markers = (): readonly string[] => [this.onboardingMarker(input), this.storeMarker()];
648
+ const woke: WokeHere = resumed ? this.resumeWake(input) : this.composeWake(input, budget, markers);
646
649
  // The wake has just said what the other directories did today, so the
647
650
  // prompt's "Since you started" line counts from here (2026-10-11).
648
651
  if (!resumed) this.noteSinceWoke(input);
@@ -701,8 +704,10 @@ export class ClaudeCodeAdapter extends Lifecycle {
701
704
  // says which store this session opened, so the mod can tell this
702
705
  // store's dashboard from another's. Since 2026-10-16 both ride on the
703
706
  // wake's own head line, just above its body (`wakeTagLead`, lightly
704
- // held); `ONE_TAG_LINE` off puts them back under the clock.
705
- const tags = wakeTagLead([this.onboardingMarker(input), this.storeMarker()], woke.text);
707
+ // held), and since 2026-10-20 inside its head tag (`ONE_TAG`), or as
708
+ // one tag of their own in front of a wake that has none (`tagLead`);
709
+ // `ONE_TAG_LINE` off puts them back under the clock.
710
+ const tags = tagLead(woke.tags ?? markers(), woke.text, woke.tagged === true);
706
711
  const lead = `${woke.text.length === 0 && plain.context.length === 0 && codeTab === null ? "" : `${this.nowLine()}\n`}${ONE_TAG_LINE ? "" : tags}${codeTab === null ? "" : `${codeTab}\n`}${plain.context}${ONE_TAG_LINE ? tags : ""}`;
707
712
  const sent = woke.bytes + Buffer.byteLength(lead, "utf8");
708
713
  const rides =
@@ -89,6 +89,8 @@ export {
89
89
  NIGHT_MCP_SERVER,
90
90
  NIGHT_RUN_ENV,
91
91
  NIGHT_TOOLS,
92
+ claudeCodeSeat,
93
+ hostToolName,
92
94
  kindValue,
93
95
  nightChildrenTimeoutMs,
94
96
  nightMaxTurns,
@@ -102,7 +104,7 @@ export {
102
104
  readNightSpills,
103
105
  runNight,
104
106
  } from "./night-run.js";
105
- export type { NightChild, NightChildPlan, NightKind, NightRunInput, NightRunnerPlan, NightStarter } from "./night-run.js";
107
+ export type { ClaudeCodeAnswer, ClaudeCodeSeatInput, NightAnswer, NightChild, NightChildPlan, NightKind, NightRunInput, NightRunnerPlan, NightStarter } from "./night-run.js";
106
108
 
107
109
  export { DATA_DIR_ENV, NIGHT_CHILD_ENV, SCOPE_ENV, SESSION_ENV, WATCHDOG_ENV, planSpawn, spawnDetached } from "../spawn.js";
108
110
  export type { PlanInput, SpawnOutcome, SpawnPlan, SpawnRefusal, Spawner } from "../spawn.js";
@@ -47,8 +47,8 @@
47
47
  import { Buffer } from "node:buffer";
48
48
  import { randomBytes } from "node:crypto";
49
49
 
50
- import { NIGHT_WRITE_UP_EVENT } from "../../core/counterpart.js";
51
- import type { Counterpart, CounterpartEvent } from "../../core/counterpart.js";
50
+ import { NIGHT_WRITE_UP_EVENT, seatAsk } from "../../core/counterpart.js";
51
+ import type { Counterpart, CounterpartEvent, Seat } from "../../core/counterpart.js";
52
52
  import { calendarDate } from "../../core/self/index.js";
53
53
  import { TUNABLES } from "../config.js";
54
54
  import type { AdapterConfig } from "../config.js";
@@ -72,7 +72,6 @@ import {
72
72
  } from "../sessions.js";
73
73
  import type { WriteUpProgress } from "../sessions.js";
74
74
  import type { HeldSession } from "../../core/remember/index.js";
75
- import type { ChildPlan, ChildResult } from "./child.js";
76
75
 
77
76
  /** The one tool the catch-up child may call, as the host names it. */
78
77
  export const CATCH_UP_TOOLS = ["mcp__counterparts__session_end"] as const;
@@ -537,10 +536,9 @@ export interface CatchUpInput {
537
536
  /** Where the runners' records are filed: the launching session's directory,
538
537
  * or the store's own for the command. */
539
538
  readonly scope: string;
540
- /** Decides one child (`night-run.ts#planNightChild`, with this phase's tools,
541
- * turns and watchdog). */
542
- readonly plan: (input: { prompt: string; runner: string }) => ChildPlan & { readonly ok: boolean; readonly reason: string };
543
- readonly start: (plan: ChildPlan) => Promise<ChildResult>;
539
+ /** Who answers each batch's ask (`core/seat.ts`, 2026-10-20): Claude Code's
540
+ * own (`night-run.ts#claudeCodeSeat`) for the night and the command. */
541
+ readonly seat: Seat;
544
542
  readonly now: () => number;
545
543
  /** The run's sanity ceiling, parts: the night's `NIGHT_WRITE_UP_PARTS`,
546
544
  * the command's `CATCH_UP_COMMAND_PARTS`; absent, the night's. */
@@ -556,19 +554,20 @@ export interface CatchUpInput {
556
554
 
557
555
  /** One child, started and waited on: what became of it. */
558
556
  async function runChild(input: CatchUpInput, plan: CatchUpPlan, prompt: string): Promise<{ state: CatchUpReport["state"]; code: number | null }> {
559
- const child = input.plan({ prompt, runner: plan.runner });
560
- if (!child.ok) return { state: "could-not-start", code: null };
557
+ // THE ASK (2026-10-20): the batch's prompt, filed under its runner, with
558
+ // the write-up's own turns and watchdog.
559
+ const ask = seatAsk("catch-up", {
560
+ prompt,
561
+ run: input.run,
562
+ session: plan.runner,
563
+ scope: input.scope,
564
+ limits: { turns: TUNABLES.NIGHT_WRITE_UP_MAX_TURNS, ms: TUNABLES.NIGHT_WRITE_UP_MS },
565
+ });
561
566
  try {
562
- const result = await input.start(child);
563
- const state =
564
- result.spawnCode !== undefined || (result.code === null && !result.timedOut && result.error !== null)
565
- ? "could-not-start"
566
- : result.timedOut
567
- ? "timed-out"
568
- : result.code === 0
569
- ? "done"
570
- : "failed";
571
- return { state, code: result.code };
567
+ const answer = await input.seat.answer(ask);
568
+ if (answer.refused !== null) return { state: "could-not-start", code: null };
569
+ const state = !answer.started ? "could-not-start" : answer.timedOut ? "timed-out" : answer.code === 0 ? "done" : "failed";
570
+ return { state, code: answer.code };
572
571
  } catch {
573
572
  return { state: "could-not-start", code: null };
574
573
  }