counterparts 0.3.11 → 0.3.13
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.
- package/CHANGELOG.md +326 -0
- package/docs/QUICKSTART.md +5 -0
- package/docs/README.md +2 -2
- package/docs/module-map.md +3 -3
- package/package.json +1 -1
- package/src/adapters/claude-code/CONTRACT.md +36 -10
- package/src/adapters/claude-code/INTERFACE-GAPS.md +116 -16
- package/src/adapters/claude-code/NOTES.md +182 -0
- package/src/adapters/claude-code/bin/hook.ts +46 -12
- package/src/adapters/claude-code/bin/runner.ts +7 -1
- package/src/adapters/claude-code/doctor.ts +632 -18
- package/src/adapters/claude-code/hooks.ts +61 -16
- package/src/adapters/claude-code/index.ts +11 -0
- package/src/adapters/claude-code/night-run.ts +150 -14
- package/src/adapters/claude-code/transcript.ts +268 -1
- package/src/adapters/cli/CONTRACT.md +5 -0
- package/src/adapters/cli/INTERFACE-GAPS.md +8 -4
- package/src/adapters/cli/NOTES.md +111 -0
- package/src/adapters/cli/commands.ts +134 -92
- package/src/adapters/cli/dream-core.ts +57 -42
- package/src/adapters/cli/export.ts +320 -21
- package/src/adapters/cli/help.ts +2 -1
- package/src/adapters/cli/index.ts +1 -0
- package/src/adapters/cli/install.ts +39 -7
- package/src/adapters/cli/mechanisms.ts +7 -1
- package/src/adapters/cli/uninstall.ts +13 -5
- package/src/adapters/cli/wire.ts +189 -63
- package/src/adapters/config.ts +2 -0
- package/src/adapters/dashboard/INTERFACE-GAPS.md +10 -1
- package/src/adapters/dashboard/NOTES.md +79 -0
- package/src/adapters/dashboard/registries.ts +34 -2
- package/src/adapters/dashboard/web/README.md +19 -14
- package/src/adapters/dashboard/web/actions.ts +23 -1
- package/src/adapters/dashboard/web/flow.ts +14 -0
- package/src/adapters/dashboard/web/lanes.ts +10 -0
- package/src/adapters/dashboard/web/narrate.ts +88 -2
- package/src/adapters/dashboard/web/pages/flow/sections/fired.js +1 -0
- package/src/adapters/dashboard/web/pages/health/sections/checks.js +2 -0
- package/src/adapters/dashboard/web/pages/health/sections/wake.js +3 -1
- package/src/adapters/dashboard/web/pages/memories/memories.css +17 -4
- package/src/adapters/dashboard/web/pages/memories/row.js +37 -21
- package/src/adapters/dashboard/web/pages/memories/sections/search.js +279 -60
- package/src/adapters/dashboard/web/pages/memories/state.js +2 -1
- package/src/adapters/dashboard/web/server.ts +0 -5
- package/src/adapters/dashboard/web/shared/memory-marks.css +7 -0
- package/src/adapters/dashboard/web/shared/memory-marks.js +33 -0
- package/src/adapters/dashboard/web/shared/memory-modal.js +5 -3
- package/src/adapters/dashboard/web/views/health.ts +21 -3
- package/src/adapters/dashboard/web/views/search.ts +4 -45
- package/src/adapters/dashboard/web/views.ts +2 -2
- package/src/adapters/fired.ts +430 -28
- package/src/adapters/host-wiring.ts +300 -0
- package/src/adapters/hosts.ts +11 -0
- package/src/adapters/lifecycle.ts +42 -2
- package/src/adapters/log/index.ts +9 -0
- package/src/adapters/mcp/CONTRACT.md +151 -11
- package/src/adapters/mcp/INTERFACE-GAPS.md +24 -2
- package/src/adapters/mcp/NOTES.md +313 -1
- package/src/adapters/mcp/bin/serve.ts +74 -1
- package/src/adapters/mcp/deliberate.ts +169 -651
- package/src/adapters/mcp/facts.ts +1094 -0
- package/src/adapters/mcp/index.ts +25 -7
- package/src/adapters/mcp/meaning.ts +1610 -0
- package/src/adapters/mcp/server.ts +835 -150
- package/src/adapters/mcp/stdio.ts +3 -1
- package/src/adapters/mcp/stood-down.ts +51 -0
- package/src/adapters/mcp/tools.ts +167 -41
- package/src/adapters/plugin-run.sh +133 -0
- package/src/adapters/plugin.ts +329 -0
- package/src/adapters/sessions.ts +18 -4
- package/src/core/associate/CONTRACT.md +2 -1
- package/src/core/associate/INTERFACE-GAPS.md +6 -1
- package/src/core/associate/NOTES.md +45 -0
- package/src/core/briefing.ts +12 -3
- package/src/core/contradictions.ts +184 -0
- package/src/core/counterpart.ts +797 -51
- package/src/core/dream/CONTRACT.md +36 -4
- package/src/core/dream/INTERFACE-GAPS.md +29 -6
- package/src/core/dream/NOTES.md +107 -0
- package/src/core/dream/feeling-weeks.ts +198 -0
- package/src/core/dream/index.ts +109 -18
- package/src/core/dream/reflect.ts +346 -87
- package/src/core/dream/tunables.ts +24 -4
- package/src/core/encode/INTERFACE-GAPS.md +3 -1
- package/src/core/encode/NOTES.md +7 -0
- package/src/core/encode/words.ts +45 -0
- package/src/core/fit/INTERFACE-GAPS.md +8 -2
- package/src/core/fit/NOTES.md +39 -1
- package/src/core/fit/index.ts +40 -0
- package/src/core/handoff/CONTRACT.md +37 -2
- package/src/core/handoff/INTERFACE-GAPS.md +10 -0
- package/src/core/handoff/NOTES.md +72 -0
- package/src/core/handoff/index.ts +214 -12
- package/src/core/handoff/last-here.ts +6 -4
- package/src/core/mint.ts +12 -2
- package/src/core/physics/CONTRACT.md +14 -2
- package/src/core/physics/NOTES.md +33 -1
- package/src/core/physics/index.ts +28 -5
- package/src/core/prospective/CONTRACT.md +45 -6
- package/src/core/prospective/INTERFACE-GAPS.md +4 -0
- package/src/core/prospective/NOTES.md +138 -0
- package/src/core/prospective/derive.ts +33 -5
- package/src/core/prospective/index.ts +90 -5
- package/src/core/prospective/windows.ts +72 -1
- package/src/core/recall/CONTRACT.md +31 -12
- package/src/core/recall/INTERFACE-GAPS.md +28 -4
- package/src/core/recall/NOTES.md +70 -1
- package/src/core/recall/feeling-ask.ts +10 -1
- package/src/core/recall/index.ts +3 -1
- package/src/core/recall/probe.ts +58 -0
- package/src/core/recall/session.ts +46 -2
- package/src/core/recall/time-ask.ts +487 -0
- package/src/core/remember/CONTRACT.md +4 -1
- package/src/core/remember/INTERFACE-GAPS.md +9 -1
- package/src/core/remember/NOTES.md +8 -0
- package/src/core/remember/proposals.ts +47 -5
- package/src/core/revision.ts +18 -1
- package/src/core/schemas/CONTRACT.md +21 -1
- package/src/core/schemas/INTERFACE-GAPS.md +20 -2
- package/src/core/schemas/NOTES.md +144 -0
- package/src/core/schemas/aliases.ts +55 -5
- package/src/core/schemas/index.ts +93 -1
- package/src/core/schemas/types.ts +2 -0
- package/src/core/self/CONTRACT.md +32 -5
- package/src/core/self/INTERFACE-GAPS.md +7 -2
- package/src/core/self/NOTES.md +102 -1
- package/src/core/self/behind.ts +43 -3
- package/src/core/self/briefing.ts +12 -2
- package/src/core/self/chapter-address.ts +254 -0
- package/src/core/self/episodes.ts +27 -0
- package/src/core/self/index.ts +83 -8
- package/src/core/self/page.ts +88 -0
- package/src/core/self/tunables.ts +5 -0
- package/src/core/self/work.ts +35 -2
- package/src/core/self/writer.ts +30 -0
- package/src/core/sleep/INTERFACE-GAPS.md +22 -3
- package/src/core/sleep/NOTES.md +20 -1
- package/src/core/sleep/consolidate.ts +59 -7
- package/src/core/sleep/index.ts +3 -0
- package/src/core/sleep/prune.ts +6 -2
- package/src/core/sleep/types.ts +7 -0
- package/src/core/store/CONTRACT.md +16 -0
- package/src/core/store/NOTES.md +66 -0
- package/src/core/store/feelings.ts +14 -1
- package/src/core/store/index.ts +483 -16
- package/src/core/store/operational.ts +95 -2
- package/src/core/store/owner-op-seam.ts +23 -0
- package/src/core/time.ts +152 -0
- package/tools/install-loop/run.sh +48 -12
- package/src/adapters/dashboard/web/pages/memories/fold.js +0 -53
|
@@ -29,7 +29,12 @@ root is doing exactly what the seam suite does.
|
|
|
29
29
|
path say what it is. One-line union change in `remember/proposals.ts`, plus the
|
|
30
30
|
places that switch on it (none today).
|
|
31
31
|
|
|
32
|
-
## 2. `Store.open({ dir })` does not run its own path guard — FOUND LIVE
|
|
32
|
+
## 2. `Store.open({ dir })` does not run its own path guard — FOUND LIVE — CLOSED 2026-08-25 (noted 2026-10-09)
|
|
33
|
+
|
|
34
|
+
**The honest fix below is in the code:** `Store`'s constructor runs
|
|
35
|
+
`this.dir = assertSafeDataDir(opts.dir ?? dataDir())` on every path (`store/index.ts`),
|
|
36
|
+
from `0361e4f`, the commit that filed this section ("two wounds closed at the root").
|
|
37
|
+
The text below is the gap as filed.
|
|
33
38
|
|
|
34
39
|
**What happened.** `dataDir()` calls `assertSafeDataDir()`, so the
|
|
35
40
|
environment-resolved path is guarded. An EXPLICIT `dir` goes straight into the
|
|
@@ -63,7 +68,11 @@ writes under a live store, deletions included. Removing a stray directory from a
|
|
|
63
68
|
live store is an operator action, not an agent one; that is the design, and the
|
|
64
69
|
guard above is what stops the next one being created.
|
|
65
70
|
|
|
66
|
-
## 3. `self.appendChapter` has no gate — FOUND BY THE CALLER-UNIVERSALITY TEST
|
|
71
|
+
## 3. `self.appendChapter` has no gate — FOUND BY THE CALLER-UNIVERSALITY TEST — CLOSED 2026-08-25 (noted 2026-10-09)
|
|
72
|
+
|
|
73
|
+
**The honest fix below is in the code:** `Self#appendChapter` runs its injected gate,
|
|
74
|
+
writes the gate's text and refuses with `self.episode.chapter.refused`
|
|
75
|
+
(`self/index.ts`), from the same commit, `0361e4f`. The text below is the gap as filed.
|
|
67
76
|
|
|
68
77
|
**What happened.** `SelfOptions.gate` is consulted by `ingestEpisode` and by
|
|
69
78
|
nothing else. `appendChapter` writes the chapter straight into the episode's
|
|
@@ -113,7 +122,7 @@ door. The fallback door reaches `encode/` through `gateSweepChunk`, which needs
|
|
|
113
122
|
(`DEFAULT_KIND`). Two spellings of one rule. The fix queued item 9 already
|
|
114
123
|
names — move the default behind the gate verdict — closes both.
|
|
115
124
|
|
|
116
|
-
## 7. The Stop ask has no RETURN CHANNEL in this host's hooks
|
|
125
|
+
## 7. The Stop ask has no RETURN CHANNEL in this host's hooks — CLOSED 2026-09-04
|
|
117
126
|
|
|
118
127
|
**What exists.** `stop()` raises `stopAsk(sessionId, chapter)` when `self/`'s pacer says a
|
|
119
128
|
chapter is due; the coverage read from `SpanBuffer.coverageReport` rides along as a
|
|
@@ -436,7 +445,8 @@ the end of the transcript it can see WITHOUT appending any of it
|
|
|
436
445
|
thing that writes a cursor, and it writes one as part of depositing.
|
|
437
446
|
|
|
438
447
|
**What the adapter does instead, and why it is a workaround rather than a
|
|
439
|
-
design.** `hooks.ts#sealJoinedLate`
|
|
448
|
+
design.** `hooks.ts#sealJoinedLate` (in `adapters/lifecycle.ts` since #292, 2026-09-30)
|
|
449
|
+
calls `captureSpans` with `turns.length`
|
|
440
450
|
PLACEHOLDER turns whose `source` is `tool`. `enters()` refuses that source, so
|
|
441
451
|
`SpanBuffer.captureInner` takes its ALL_EXCLUDED arm — "nothing conversational
|
|
442
452
|
happened: still advance, or the same tool output is re-scanned forever" — which
|
|
@@ -529,6 +539,9 @@ That is a different mechanism, not a wider parameter, and it is not built.
|
|
|
529
539
|
and two clocks in one store is a scar this repo already has a name for. The
|
|
530
540
|
fix, if the mid-evening reset is ever felt, is one per-owner zone read
|
|
531
541
|
wherever a day is decided — `self/INTERFACE-GAPS` carries the decision.
|
|
542
|
+
*(CLOSED 2026-09-23 by #189, noted 2026-10-09: the cap counts by
|
|
543
|
+
`Self#calendarToday`, the person's local day; and since #231 (2026-09-25)
|
|
544
|
+
`Store#today` and the dates stamped beside it are local too.)*
|
|
532
545
|
4. **The two poisoned titles are not repaired.** The embedder no longer chokes on
|
|
533
546
|
them and the backfill no longer stalls behind them, but the two memories on the
|
|
534
547
|
owner's store still hold a lone surrogate in their payload JSON,
|
|
@@ -563,7 +576,9 @@ That is a different mechanism, not a wider parameter, and it is not built.
|
|
|
563
576
|
costs a ladder of lived-day windows instead of one query. Filed in full as
|
|
564
577
|
`cli/INTERFACE-GAPS` §10, where the console's other asks against `store/`
|
|
565
578
|
live; the workaround is exact, not approximate, and the cost is up to five
|
|
566
|
-
queries on a 150 ms hot path.
|
|
579
|
+
queries on a 150 ms hot path. *(Noted 2026-10-09: the store side is built,
|
|
580
|
+
`order: "desc"`, 2026-09-24 (cli §10); doctor keeps its ladder on purpose, as
|
|
581
|
+
`doctor.ts#WINDOWS` says.)*
|
|
567
582
|
2. **`adapter.checkout` is a durable name in `core/counterpart.ts`.** The third
|
|
568
583
|
time the core has learned a string for an adapter's sake, and for the same
|
|
569
584
|
narrow reason the spawn names did: `dashboard/registries.ts` derives
|
|
@@ -597,7 +612,10 @@ That is a different mechanism, not a wider parameter, and it is not built.
|
|
|
597
612
|
All that is left behind is an `adapter.notice.dropped` ring row, and a ring row
|
|
598
613
|
dies with the process. Closing it properly means either a durable row (a write
|
|
599
614
|
on the wake's path, which §5 G2 argues against) or a second channel that is
|
|
600
|
-
not the wake's — neither was taken here.
|
|
615
|
+
not the wake's — neither was taken here. *(The record half CLOSED 2026-10-02 by
|
|
616
|
+
#318 (`8916e8c`), noted 2026-10-09: `adapter.notice.dropped` is a durable row,
|
|
617
|
+
one per hook, part and session a lived day, and doctor's Wake line reads it. The
|
|
618
|
+
terminal still says nothing on the day it happens.)*
|
|
601
619
|
7. **Three findings cannot say "I do not know" — they say green.** `Severity` is
|
|
602
620
|
red / amber / green, so the unknown-newest-row reading (`undetermined`) is
|
|
603
621
|
reported as GREEN with a sentence that explains it is not a grade. Right for
|
|
@@ -675,7 +693,18 @@ for: a per-owner zone read wherever a day is decided — one clock, moved once
|
|
|
675
693
|
second clock bolted onto this mechanism. Until then it belongs on the findings list for the
|
|
676
694
|
first blank-store trial, where it is a thing to notice rather than a thing to fix.
|
|
677
695
|
|
|
678
|
-
## 14. A prompt typed while the model is working never reaches the transcript reader (2026-09-23, B1 review M3)
|
|
696
|
+
## 14. A prompt typed while the model is working never reaches the transcript reader (2026-09-23, B1 review M3) — CLOSED for the reader 2026-09-24 by #213 (noted 2026-10-09)
|
|
697
|
+
|
|
698
|
+
**Closed for the reader by #213** (`0df2efe`, merged 2026-09-24, in 0.3.1). `transcript.ts`
|
|
699
|
+
reads a `queued_command` attachment the person typed (`commandMode: "prompt"`,
|
|
700
|
+
`origin.kind: "human"`) as a typed turn where it stands (`queuedPromptOf`); every other
|
|
701
|
+
attachment is still skipped. The dedupe was measured before it was written: of 33 queued
|
|
702
|
+
prompts on the owner's machine none was written again as a user entry, so a
|
|
703
|
+
`promptSource: "queued"` user entry with the same words is skipped defensively (NOTES,
|
|
704
|
+
"Prompts typed mid-turn"; `test/queued-prompts.test.ts`). **Still open: ask (1).** The
|
|
705
|
+
capture cursor is still an index into the turn list, so a session open across a deploy
|
|
706
|
+
that changes what counts as a turn re-captures its last few turns once (NOTES, "Deploy
|
|
707
|
+
note"). The text below is the gap as filed.
|
|
679
708
|
|
|
680
709
|
**Pre-existing; found by the adversarial review of PR #186, measured on the owner's
|
|
681
710
|
machine (shapes only).** When the person types while the model is still working, Claude
|
|
@@ -741,14 +770,53 @@ can push the envelope past `ENVELOPE_MAX_CHARS` and the doctor notice is the par
|
|
|
741
770
|
notice is dropped with or without it. Bounded: at most two starts a day carry a pointer,
|
|
742
771
|
and the notice returns at the next start.
|
|
743
772
|
|
|
744
|
-
**Residual cost (PR #192 review, n1):** the eligibility plan (`writeUpPlan
|
|
745
|
-
|
|
746
|
-
|
|
747
|
-
|
|
748
|
-
|
|
749
|
-
|
|
750
|
-
|
|
751
|
-
|
|
773
|
+
**Residual cost (PR #192 review, n1):** the eligibility plan (`writeUpPlan`) runs at EVERY
|
|
774
|
+
session start whose allowance is not spent — and when nothing is owed, the allowance is
|
|
775
|
+
never spent. Measured by the review on 400 held sessions (1.6 MB of spans, 20k ask rows):
|
|
776
|
+
~43 ms per start, 2 ms with the allowance spent.
|
|
777
|
+
|
|
778
|
+
**Re-measured 2026-10-09, and the skip looked at and not built.** Since 2026-09-30 the
|
|
779
|
+
plan is `core/coverage/`'s ledger over every scope's span files plus one registry read per
|
|
780
|
+
session holding text; the `adapter.ask` rows are no longer read. On a synthetic store of
|
|
781
|
+
400 held sessions in 20 projects (1.9 MB of conversation, nothing owed), one plan per
|
|
782
|
+
fresh process as a hook runs it: ~31 ms, which is ~32 of the ~37 ms `sessionStart` body
|
|
783
|
+
there. At 100 sessions it is ~10 ms. Where the time goes: the ledger takes ~23 ms of it
|
|
784
|
+
(~5,000 `localDate` calls, one per piece and one per Stop boundary, ~9 ms; the span files
|
|
785
|
+
~7 ms; 400 registry reads ~4 ms), and `planRetention` reads most of the same files a second
|
|
786
|
+
time (~5 ms). Retention deletes held text a week after a session ends, so the cost grows
|
|
787
|
+
with a week's use, not with the store's age.
|
|
788
|
+
|
|
789
|
+
- **A stamp of everything the plan reads** (date, zone, version, and a stat of every file
|
|
790
|
+
under `spans/` and `sessions/`, ~2.5 ms) would be safe, and it would almost never fire.
|
|
791
|
+
Every start writes its own registry record before the plan runs (`noteSession("start")`,
|
|
792
|
+
in Claude Code and in the Desktop wake). Every Stop, in any session, appends to the buffer
|
|
793
|
+
and rewrites that session's record. It fires only when two starts come with no turn
|
|
794
|
+
anywhere between them.
|
|
795
|
+
- **A stamp that fires** has to know what can make a debt appear. Under today's rule only
|
|
796
|
+
two things can: a session ending (a `session-end` boundary or a registry end) and the
|
|
797
|
+
date changing. A capture is stamped `now`, and that makes its session `active`. So the
|
|
798
|
+
design would be: every session end writes a fresh random token to meta, in
|
|
799
|
+
`captureBoundary` before the boundary itself (a hook that fails part-way then errs
|
|
800
|
+
toward a rescan). It is a token and not a counter, so two ends cannot write the same
|
|
801
|
+
value. A plan that found nothing owed and no progress entries stamps
|
|
802
|
+
`{date, zone, version, token}`, and a start skips when all four match. The costs: the
|
|
803
|
+
common flow (end one session, open the next) always rescans, and must, because that is
|
|
804
|
+
when a crashed or unanswered session gets pointed at. So it saves the ~30 ms only on starts
|
|
805
|
+
with no end since the last plan, such as a second terminal or a compaction. It is also a
|
|
806
|
+
second statement of `coverage/`'s rule, kept outside `coverage/`. If "active" ever stops
|
|
807
|
+
meaning "captured today", or something other than an end uncovers pieces (a retention
|
|
808
|
+
strike that fails part-way, a restored snapshot, a mark taken back), the stamp hides a
|
|
809
|
+
debt until the next date. Then the first start and the nightly run both plan in full, so
|
|
810
|
+
nothing waits more than a day. But the pointer it skipped is the one right after the crash.
|
|
811
|
+
- **What would make the plan cheaper for every caller** (the pointer, doctor, the night
|
|
812
|
+
run, the door), with nothing to invalidate: a cheaper `localDate` in the ledger, and one
|
|
813
|
+
read of the span files per plan instead of two. A memo by 15-minute bucket measured
|
|
814
|
+
~31 → ~24 ms; every zone offset in use today is a multiple of 15 minutes. That memo
|
|
815
|
+
belongs to `core/time.ts`, it is date-sensitive, and it is its own change. The single
|
|
816
|
+
read (~5 ms) is `remember/`'s to offer.
|
|
817
|
+
- **"Treat a plan that found nothing owed as spending the day's check"** (the suggestion
|
|
818
|
+
this section first carried): no. A session that ends later that day without an answer
|
|
819
|
+
would not be pointed at until tomorrow, and that is the case the pointer exists for.
|
|
752
820
|
|
|
753
821
|
## 16. For C3: the opt-in is `crashWriteUp: "api"` (2026-09-23, C2) — CLOSED 2026-09-24 by removal
|
|
754
822
|
|
|
@@ -762,7 +830,21 @@ and the key (`config.ts#apiSweepOn`). Doctor's two lines — `Crash write-up` an
|
|
|
762
830
|
are C2's and already read the knob (`not-opted-in` on the gate row, core's second skip
|
|
763
831
|
reason); nothing there is owed to C3.
|
|
764
832
|
|
|
765
|
-
## 17. An open-and-answered session's later words wait up to a week (2026-09-23, C2 re-review m-E)
|
|
833
|
+
## 17. An open-and-answered session's later words wait up to a week (2026-09-23, C2 re-review m-E) — CLOSED 2026-09-30 by #289 (noted 2026-10-09)
|
|
834
|
+
|
|
835
|
+
**Closed by #289** (`fc665c2`, merged 2026-09-30, in 0.3.8), by replacing the rule rather
|
|
836
|
+
than adding the ask below. `sessions.ts#openAndAnswered` is gone, with the asked /
|
|
837
|
+
answered predicate it guarded; what a session owes is `core/coverage/`'s ledger. An
|
|
838
|
+
answer claims only the pieces said before it, so words captured after it are an unwritten
|
|
839
|
+
stretch, and that stretch is owed once the session is not `active` (it ended, or it has
|
|
840
|
+
captured nothing since the date changed) and has not lapsed. So the case below is
|
|
841
|
+
pointed at from the next date, not after a week (CONTRACT, "A session that ended owing a
|
|
842
|
+
write-up"). The ask to `remember/` (its INTERFACE-GAPS §16) went with it. **The owner's
|
|
843
|
+
hand, last paragraph, is unchanged in one part:** there is still no console command that
|
|
844
|
+
marks a session written up `by: "owner"`. A stretch left in a directory nobody reopens no
|
|
845
|
+
longer waits on one, though: the nightly run's catch-up writes up any project's, and what
|
|
846
|
+
it leaves lapses after three days of use (coverage INTERFACE-GAPS §3). The text below is
|
|
847
|
+
the gap as filed.
|
|
766
848
|
|
|
767
849
|
**What happens.** A session answers its Stop ask (memories, a chapter, a handoff, or
|
|
768
850
|
"nothing new"), then captures more words at a later Stop that asks nothing, then goes
|
|
@@ -793,3 +875,21 @@ words the session left in another (`written-up-here`) owes until a session opens
|
|
|
793
875
|
Doctor's `Crash write-up` line names that project. A directory set `off` never opens
|
|
794
876
|
one; closing such a session by hand needs a console command that marks `by: "owner"`
|
|
795
877
|
(`WRITE_UP_BY` has the word; nothing may import the seam to use it) — filed, not built.
|
|
878
|
+
|
|
879
|
+
## 18. The host's cut is read only for the nightly run, and only as the host writes it today (2026-10-09, U14 item 3)
|
|
880
|
+
|
|
881
|
+
The nightly run reads its child's transcript for the host's marker on our results
|
|
882
|
+
(`night-run.ts#readNightSpills`, `transcript.ts#readToolSpills`). Three things it owes:
|
|
883
|
+
|
|
884
|
+
1. **Unmeasured on a real machine.** That `claude -p` honours `--session-id`, and that the
|
|
885
|
+
transcript lands under `projects/` where the lookup asks. Both were read from the host's
|
|
886
|
+
code (2.1.295), not seen. If either fails, the run's row says `transcript: "absent"` and
|
|
887
|
+
doctor's green line says the night was not checked — check that line after the first
|
|
888
|
+
night on a build with this. A host that refuses the flag outright is retried once without
|
|
889
|
+
it (review of #330), so the night itself is not lost to this check.
|
|
890
|
+
2. **The markers are the host's wording.** Read from 2.1.295's code; a host that rewords
|
|
891
|
+
them makes the check go quiet (a missed spill), never noisy. A new marker shape is one
|
|
892
|
+
regex in `transcript.ts`.
|
|
893
|
+
3. **Not read:** the morning catch-up's child (its write-up parts are far under any line)
|
|
894
|
+
and ordinary sessions. A cut in a session someone watches is in front of them; one in a
|
|
895
|
+
session nobody watches (a GitHub action) is not seen by anything.
|
|
@@ -1897,3 +1897,185 @@ Review of #313: Claude Code exports `CLAUDE_CODE_SESSION_ATTENDED` to the proces
|
|
|
1897
1897
|
starts. Measured in a terminal session's child: `1`, beside `CLAUDE_CODE_ENTRYPOINT=cli`. Not
|
|
1898
1898
|
measured under `claude -p`. When the variable says `1` or `0` it decides `isInteractive`; the
|
|
1899
1899
|
entrypoint list is the fallback when it is absent or unreadable (`bin/hook.ts#attendedOf`).
|
|
1900
|
+
|
|
1901
|
+
## 2026-10-02 — what reached the model, not what ran
|
|
1902
|
+
|
|
1903
|
+
The night of 10-02 the dream read a third of its bundle (Claude Code saved the rest to a file the
|
|
1904
|
+
run cannot open) and every doctor line stayed green: Lookups counts look-ups, Nightly run a run
|
|
1905
|
+
that finished. New lines: **Tool results** (`resultFindings`: amber on any `mcp.result.oversize`
|
|
1906
|
+
row in 14 lived days, or a run that finished without a part its begin promised, from `mcp.part`
|
|
1907
|
+
rows) and **Wake** (`wakeArrivalFindings`: the `adapter.wake.delivered` outcomes nobody read —
|
|
1908
|
+
amber on `truncated` or `mismatch`). The same review: Spawn goes amber on a worker that started
|
|
1909
|
+
and failed today or yesterday (`adapter.runner.failed`, which the counters never graded); Self
|
|
1910
|
+
page says when the wake shows only the page's start; Dreaming reads past a run of undone dreams;
|
|
1911
|
+
Reflection says its mark count is a floor when its read comes back full.
|
|
1912
|
+
|
|
1913
|
+
After the review of #315: Wake goes amber on `truncated` only — `mismatch` is what a session
|
|
1914
|
+
resumed after its record was pruned reads, so it is counted, not graded. Spawn's failure is
|
|
1915
|
+
standing only when the same step failed today and yesterday, or the failure is newer than the
|
|
1916
|
+
newest `adapter.spawn.started` (both latched once a date, so one transient failure clears at the
|
|
1917
|
+
next day's first start). The nightly child pins `MAX_MCP_OUTPUT_TOKENS=25000`.
|
|
1918
|
+
|
|
1919
|
+
## 2026-10-02 — what a delivery could not carry is durable, and doctor reads it
|
|
1920
|
+
|
|
1921
|
+
#315 listed four warnings that reached only the in-process ring: `adapter.envelope.overcap`
|
|
1922
|
+
(even the plain form past the host's 10,000-character cap), `adapter.notice.dropped`,
|
|
1923
|
+
`adapter.envelope.gave-way` and `adapter.injection.overbudget`. They are durable now
|
|
1924
|
+
(`Lifecycle#noteDeliveryWarning`, names in `counterpart.ts`, registered beside the other
|
|
1925
|
+
durable names and covered by the `wake-injected` mechanism), one row per name, hook, part and
|
|
1926
|
+
session per lived day, so a long session that gives way at every prompt writes one row. The
|
|
1927
|
+
Wake line reads them as clauses, with `handoff.refused` no-room, `handoff.lasthere.noroom` and
|
|
1928
|
+
the "Work here" overflow: amber only for a start over its reported ceiling or a hook past the
|
|
1929
|
+
cap (the host cut or previewed it), counted otherwise, and a line even when no wake was
|
|
1930
|
+
checked on arrival. Also from the list: the Reflection line says how many days ago a share
|
|
1931
|
+
stuck at `carried` was carried, from `share_at`; and the v9 upgrade line's mark read says
|
|
1932
|
+
"at least" when it comes back full.
|
|
1933
|
+
|
|
1934
|
+
Spawn's "same step failed today and yesterday" never fired on a real store: the failures were read
|
|
1935
|
+
with `newestRows`, which stops at the first window holding rows (today's), so yesterday's row was
|
|
1936
|
+
never read; the test passed only because every row sat on one lived day. The failures are now read
|
|
1937
|
+
as one window of the last three lived days, newest first under `RUNNER_FAILED_ROWS`, and the test
|
|
1938
|
+
puts yesterday's row on the previous lived day. One transient failure keeps Spawn amber from the
|
|
1939
|
+
failure until the next `adapter.spawn.started` row — latched once per calendar date, so the first
|
|
1940
|
+
worker start of the next date: at most the rest of that day and the next day's first turn-end.
|
|
1941
|
+
|
|
1942
|
+
## 2026-10-03 — doctor's `Write fields` line (schema v12)
|
|
1943
|
+
|
|
1944
|
+
Informational and green: of the memories written since the v12 upgrade (or all, on
|
|
1945
|
+
a store born at v12) by a door that takes the writer's three fields — `note`,
|
|
1946
|
+
`session_end`, a dream's gist; not a merge, a chapter copy, the sweep or a reflection's
|
|
1947
|
+
entry — the share that carries each field and all three, and how many subject links there
|
|
1948
|
+
are. Two aggregates, so it runs in the session-start reading too. Silent on a v11 file
|
|
1949
|
+
(the observer floor did not move). It is what the revisit a few days after the upgrade
|
|
1950
|
+
reads before recall starts reading the fields.
|
|
1951
|
+
|
|
1952
|
+
## 2026-10-08 — the wake check waits for the transcript
|
|
1953
|
+
|
|
1954
|
+
Since about 09-25 Claude Code creates a session's transcript only after the first prompt
|
|
1955
|
+
is handled, so the arrival check at that prompt found no file: on the owner's store 42 of
|
|
1956
|
+
43 sessions in a week read `not-found` / `transcript: "absent"`, and their files existed a
|
|
1957
|
+
moment later. The one `delivered` was a session where a local `/model` command had written
|
|
1958
|
+
the file first. Nothing acted on the verdict; doctor's Wake line said "42 not found".
|
|
1959
|
+
|
|
1960
|
+
When a wake was expected and the file is absent, the prompt now writes no row and does not
|
|
1961
|
+
mark the session; the next prompt or the first Stop reads again. The Stop is final: by the
|
|
1962
|
+
end of a turn the host has written the file, so an absent one there writes the row once,
|
|
1963
|
+
`checkedAt: "stop"`, rather than asking every turn. The check still never makes a record;
|
|
1964
|
+
at a Stop the boundary already has (`sealJoinedLate` for a session with none), so such a
|
|
1965
|
+
session says `no-wake-expected` there, as its second prompt used to. Doctor's Wake line
|
|
1966
|
+
counts a `not-found` with no transcript read as "not checked" and leaves it out of "N of M
|
|
1967
|
+
arrived whole" — which is also how the week of rows already in stores now reads.
|
|
1968
|
+
|
|
1969
|
+
After the review of #325: only an `absent` transcript at the first prompt is "not checked".
|
|
1970
|
+
`absent` at the Stop (no transcript by the end of a turn) and `unreadable` (a file that
|
|
1971
|
+
would not open) each have their own clause and stay in the "N of M" — counted, not graded,
|
|
1972
|
+
like `not-found`; amber would hold forever on a host build that never writes the file, with
|
|
1973
|
+
nothing to do by hand. The dashboard's narrator says the same split: the first calm, the
|
|
1974
|
+
other two amber. The prompt's wait is a ring event, `adapter.wake.check.deferred`.
|
|
1975
|
+
|
|
1976
|
+
## 2026-10-09 — the night run reads its own transcript for the host's cut (U14 item 3)
|
|
1977
|
+
|
|
1978
|
+
0.3.12 keeps every result under 40,000 characters, 20% under Claude Code's 50,000-character
|
|
1979
|
+
line, but the host can lower that line by a remote flag and nothing pins it. A result past
|
|
1980
|
+
it reaches the model as a 2 KB preview, and nothing in the store can tell: the server
|
|
1981
|
+
answered whole, the parts were fetched, every line was green. So the night now asks the
|
|
1982
|
+
host's own record. The child gets `--session-id` with a UUID the waiting process chose;
|
|
1983
|
+
when it exits the transcript is found by that name and read for the host's marker on
|
|
1984
|
+
results of ours. One `mcp.result.spilled` row per cut result; `transcript` and `spills` on
|
|
1985
|
+
the run's row; doctor's Tool results line amber; a plain line in the morning hand-back.
|
|
1986
|
+
|
|
1987
|
+
- **The markers were read from the host's code, 2.1.295** (strings in the binary, not a
|
|
1988
|
+
transcript): `<persisted-output>` + "Output too large (51.5KB). Full output saved to: …"
|
|
1989
|
+
+ "Preview (first 2KB):" + `</persisted-output>` is the one the nights of 10-01 to 10-07
|
|
1990
|
+
met. Three more: the same with "Output exceeded the … persist limit" (a result past the
|
|
1991
|
+
file cap), `<truncated-output>` + "It could not be saved" (the save failed), "Error:
|
|
1992
|
+
result (N characters) exceeds maximum allowed tokens. Output has been saved to …" (the MCP
|
|
1993
|
+
token line), and, with no file kept, the result cut and "[OUTPUT TRUNCATED - exceeded N
|
|
1994
|
+
token limit]" + "The tool output was truncated." appended. A host that rewords them
|
|
1995
|
+
makes the check go quiet, not wrong.
|
|
1996
|
+
- **Anchored, never a substring.** The morning's manual check (grep "Output too large" in
|
|
1997
|
+
the night's transcript) found two hits that were memories quoting the check, inside a
|
|
1998
|
+
recall answer. The first three markers are matched at the START of a `tool_result`, the
|
|
1999
|
+
token trailer at its very END with the real line breaks the host writes — a quoted line
|
|
2000
|
+
break inside our JSON is the two characters `\n`. Only `tool_result` blocks answering a
|
|
2001
|
+
`tool_use` named `mcp__counterparts__…`; the model's own text, the person's, and other
|
|
2002
|
+
tools' results are never read. The test carries exactly that recall answer.
|
|
2003
|
+
- **Found by name, not by guessing the host's spelling.** The host turns the directory into
|
|
2004
|
+
a name (every character but a letter or digit to "-"), shortens a long one with a hash of
|
|
2005
|
+
its own, and may start from a git worktree's root. The spelling is tried first, then
|
|
2006
|
+
every project directory is asked for `<id>.jsonl` — a fresh UUID, so only one file can
|
|
2007
|
+
answer. `absent` and `unreadable` go on the row and are said in doctor's green line ("not
|
|
2008
|
+
checked"), never read as clean.
|
|
2009
|
+
- **Amber, not red.** A spill is the same kind of fact as the two ambers already on the
|
|
2010
|
+
line (a result cut by our net, a part never fetched): the night has happened, and nothing
|
|
2011
|
+
can be done by hand. Red would be defensible — the run read through a keyhole — but the
|
|
2012
|
+
standing preference is loose first.
|
|
2013
|
+
- **Not covered:** the morning catch-up's child (its write-up parts are sized by
|
|
2014
|
+
`WRITE_UP_PART_BYTES`, far under any line), and ordinary sessions. A result cut in a
|
|
2015
|
+
session the owner watches is in front of him.
|
|
2016
|
+
- **Unmeasured on a real machine:** that `claude -p` honours `--session-id` (its help lists
|
|
2017
|
+
the flag with no print-mode caveat), and that the transcript lands where it is looked
|
|
2018
|
+
for. If either fails, the row says `absent` and doctor says the night was not checked.
|
|
2019
|
+
- The same change tightened the reflection's instructions when its bundle comes in parts
|
|
2020
|
+
(`dream/NOTES.md`, 2026-10-09).
|
|
2021
|
+
|
|
2022
|
+
## 2026-10-09 — the write-up plan at session start: measured, the skip not built
|
|
2023
|
+
|
|
2024
|
+
The plan behind the write-up pointer (`writeUpPlan`) runs at every start until the day's
|
|
2025
|
+
allowance is spent, and when nothing is owed that never happens. Re-measured on a synthetic
|
|
2026
|
+
400-session store with one plan per process: ~31 ms (it was ~43 ms in #192's review, when it
|
|
2027
|
+
still read the ask rows). The brief was a stamp that skips the scan when nothing has
|
|
2028
|
+
changed. It was not built. The stamp that is safe never fires, because every start writes
|
|
2029
|
+
its own registry record first and every Stop appends to the buffer. The stamp that fires
|
|
2030
|
+
has to restate `coverage/`'s rule (only an end or a new date makes a debt) and be bumped by
|
|
2031
|
+
every end. Even then, the usual flow (end one session, open the next) rescans anyway, and a
|
|
2032
|
+
missed bump hides a debt until the next date. The numbers, the design and the cheaper
|
|
2033
|
+
alternative (the ledger's date formatting and its second read of the span files) are in
|
|
2034
|
+
INTERFACE-GAPS §15.
|
|
2035
|
+
|
|
2036
|
+
## 2026-10-09 — the Fired line: one-time and occasion-driven rows; the Reflection week is local
|
|
2037
|
+
|
|
2038
|
+
- **The false amber.** On the owner's store (2026-10-09) the Fired line was amber on "2
|
|
2039
|
+
have gone quiet": `prospective.plain` (last 09-28, total 2) and
|
|
2040
|
+
`physics.upgrade.census` (total 1). The first fires only when a plain reminder falls
|
|
2041
|
+
due, and none did that week; the second runs once by design. Neither is a wiring
|
|
2042
|
+
fault, and the fix text said one was likely. The registry learned two kinds
|
|
2043
|
+
(`fired.ts#Cadence`): a one-time job that ran is `done`, and an occasion-driven row
|
|
2044
|
+
whose occasion has not come is `waiting`. Neither can be `quiet`, so neither reaches
|
|
2045
|
+
`wentQuiet`. The roll-call now counts both. The never-fired count never fed the
|
|
2046
|
+
colour, only the words; the owner-action and failure rows have moved from it to
|
|
2047
|
+
`waiting`. The classification is listed in `cli/NOTES.md` (same date).
|
|
2048
|
+
- **The one occasion the store can see stays a finding.** For a plain reminder,
|
|
2049
|
+
`fired.ts#plainDueReading` asks whether one fell due this week on a day a session ran
|
|
2050
|
+
(a briefing handed over or a turn decided, after the memory existed; today left out
|
|
2051
|
+
because its sessions may still say it) and was not said. If so, the row keeps
|
|
2052
|
+
`quiet`/`never`, is named in `FiredReport.missedOccasion`, and doctor grades amber on
|
|
2053
|
+
that list as on `wentQuiet` and `wentBlocked`, with a fix that says the occasion came.
|
|
2054
|
+
The beat rule is `Prospective#plainDue`'s restated as a read, because that method
|
|
2055
|
+
refuses an observer: if `prospective/` changes its beats, this copy has to follow.
|
|
2056
|
+
It reads memories, so `firedReport(…, { probes: false })` skips it with the probes and
|
|
2057
|
+
the row reads `waiting` (no caller in `src/` turns the probes off today).
|
|
2058
|
+
- **"A session ran" means one a person could be told something in** (review of #337).
|
|
2059
|
+
The headless nightly run, `claude -p` and Agent SDK sessions write a briefing row and
|
|
2060
|
+
turns too, but are never handed a plain reminder (`isInteractive`, `nightRun`), so
|
|
2061
|
+
counting them read every day the night run came as a day a reminder went unsaid. The
|
|
2062
|
+
briefing row (`adapter.wake.injected`) now carries `interactive`, the same test that
|
|
2063
|
+
decides plain delivery; a row from before the field is asked of the session registry's
|
|
2064
|
+
`entrypoint`, and a session nothing is known about reads as a person's. Desktop's
|
|
2065
|
+
`wake` tool writes no briefing row, so a Desktop-only day is never counted (it can
|
|
2066
|
+
hide a miss there, never invent one).
|
|
2067
|
+
- **What the owner's line says now (by reasoning, not run against his store).** Census
|
|
2068
|
+
`done`, plain `waiting` (nothing plain was due 10-03..10-08), so `wentQuiet` is empty
|
|
2069
|
+
and the line is green. "13 have never fired" drops by however many of those thirteen
|
|
2070
|
+
are now occasion rows (export, removal record, unmerge, snapshot failure, worker
|
|
2071
|
+
trouble, core demotion, declared replacement, dedup, and any of protection, revision,
|
|
2072
|
+
contradictions, result cut, quiet reminder fire); they read as waiting instead.
|
|
2073
|
+
- **The Reflection line's week started at UTC midnight** (`Date.parse(today +
|
|
2074
|
+
"T00:00:00Z") - 6 days`). It now starts at local midnight six days back in the
|
|
2075
|
+
reading's zone (`time.ts#startOfLocalDay`, new). In Denver the old window counted a
|
|
2076
|
+
return from the evening before the week; in Kiritimati it missed the week's first
|
|
2077
|
+
fourteen hours. Both are tested through the config's `timeZone`, so they fail on the
|
|
2078
|
+
old line on any machine. Two other `T00:00:00Z` parses in this file were left: the
|
|
2079
|
+
page writer's `calendarDaysSince` subtracts two such instants, which is date arithmetic
|
|
2080
|
+
and zone-free, and `futureNamesIn` compares snapshot folder names, which are UTC by
|
|
2081
|
+
design (`snapshots.ts`).
|
|
@@ -13,6 +13,7 @@
|
|
|
13
13
|
* trivia and may change with the host without touching a core contract (G9).
|
|
14
14
|
*/
|
|
15
15
|
import { readFileSync } from "node:fs";
|
|
16
|
+
import { homedir } from "node:os";
|
|
16
17
|
import { resolve } from "node:path";
|
|
17
18
|
import { fileURLToPath } from "node:url";
|
|
18
19
|
|
|
@@ -57,6 +58,8 @@ import {
|
|
|
57
58
|
import type { SaysSoHook, StandDownFault } from "../standdown.js";
|
|
58
59
|
import { readTranscript } from "../transcript.js";
|
|
59
60
|
import { scriptArgs } from "../../runtime.js";
|
|
61
|
+
import { npmWiring } from "../../host-wiring.js";
|
|
62
|
+
import { ensureFirstRun, hookGate, runningAsPlugin } from "../../plugin.js";
|
|
60
63
|
|
|
61
64
|
/**
|
|
62
65
|
* The host's own spellings of the two events that carry a notice — one
|
|
@@ -555,13 +558,40 @@ async function main(): Promise<void> {
|
|
|
555
558
|
wroteStdout: false,
|
|
556
559
|
didWork: false,
|
|
557
560
|
};
|
|
561
|
+
// THE PLUGIN'S PREAMBLE (`adapters/plugin.ts`), and only when Claude Code
|
|
562
|
+
// launched this process as the Counterparts plugin. Two questions before
|
|
563
|
+
// anything opens: is the npm install's wiring live in this host (then the
|
|
564
|
+
// plugin stands down, and says so once, at session start), and does this
|
|
565
|
+
// machine have an install at all (then the plugin makes one, the way
|
|
566
|
+
// `counterparts install` does). A settings-wired hook never gets here.
|
|
567
|
+
const pluginLines: string[] = [];
|
|
568
|
+
if (runningAsPlugin(process.env)) {
|
|
569
|
+
const home = homedir();
|
|
570
|
+
const projectDir = process.env["CLAUDE_PROJECT_DIR"] ?? eventDirectory(payload);
|
|
571
|
+
const gate = hookGate(npmWiring({ home, env: process.env, cwd: projectDir, read: { mcp: false } }), home);
|
|
572
|
+
if (gate.standDown) {
|
|
573
|
+
process.stderr.write("[counterparts] plugin hook stood down: the npm install's hooks are live in this host\n");
|
|
574
|
+
if (name === "session-start" && gate.line !== null) process.stdout.write(JSON.stringify({ systemMessage: gate.line }));
|
|
575
|
+
return;
|
|
576
|
+
}
|
|
577
|
+
if (gate.line !== null) pluginLines.push(gate.line);
|
|
578
|
+
try {
|
|
579
|
+
const first = ensureFirstRun({ choice, env: process.env, home });
|
|
580
|
+
if (first.detail !== undefined) process.stderr.write(`[counterparts] plugin first run ${first.state}: ${first.detail}\n`);
|
|
581
|
+
if (first.line !== null) pluginLines.push(first.line);
|
|
582
|
+
} catch (err) {
|
|
583
|
+
// A first run that threw is a stand-down further on (no configuration,
|
|
584
|
+
// so the default store's guard decides), never a failed session.
|
|
585
|
+
process.stderr.write(`[counterparts] plugin first run threw: ${err instanceof Error ? err.message : String(err)}\n`);
|
|
586
|
+
}
|
|
587
|
+
}
|
|
558
588
|
// THE FAULT HANDLER, HERE RATHER THAN AT THE ENTRY POINT, because this is
|
|
559
589
|
// where the event's own facts are in scope — which hook, which session, which
|
|
560
590
|
// store — and all three are needed to say a stand-down out loud once. The
|
|
561
591
|
// entry point's handler below stays exactly what it was: the last resort for
|
|
562
592
|
// anything that fails before any of this is known.
|
|
563
593
|
try {
|
|
564
|
-
await runHook(name, payload, choice, said);
|
|
594
|
+
await runHook(name, payload, choice, said, pluginLines);
|
|
565
595
|
} catch (err) {
|
|
566
596
|
// MASTER'S EXIT CODE, RESTORED EXACTLY. On master a throw out of `main`
|
|
567
597
|
// reached the entry point's rejection handler, which always exits 0 — so a
|
|
@@ -588,6 +618,9 @@ async function runHook(
|
|
|
588
618
|
payload: Record<string, unknown>,
|
|
589
619
|
choice: ConfigChoice,
|
|
590
620
|
said: Said,
|
|
621
|
+
/** The plugin's own session-start lines (first run, stale npm entries);
|
|
622
|
+
* empty for every hook the plugin did not launch. */
|
|
623
|
+
pluginLines: readonly string[] = [],
|
|
591
624
|
): Promise<void> {
|
|
592
625
|
// `namedConfigRefusal` covers the flag's own refusals AND the one the first
|
|
593
626
|
// review of this rule found: an absolute path to a file that is not there was
|
|
@@ -787,20 +820,10 @@ async function runHook(
|
|
|
787
820
|
name,
|
|
788
821
|
result,
|
|
789
822
|
payload,
|
|
790
|
-
name === "session-start" ? [adapter.notice(input), trouble] : null,
|
|
823
|
+
name === "session-start" ? [adapter.notice(input), ...pluginLines, trouble] : null,
|
|
791
824
|
adapter,
|
|
792
825
|
input,
|
|
793
826
|
);
|
|
794
|
-
// A notice the envelope could not carry leaves a row rather than nothing:
|
|
795
|
-
// "the terminal said nothing" and "there was nothing to say" are different
|
|
796
|
-
// facts about the same morning (scar §2.4).
|
|
797
|
-
if (delivery.dropped !== null) adapter.noteNoticeDropped(delivery.dropped);
|
|
798
|
-
// PAST THE HOST'S CAP EVEN IN PLAIN FORM: the host shows a preview. Said
|
|
799
|
-
// where a person can find it (the host's debug log), and on the ring.
|
|
800
|
-
if (delivery.overCap !== undefined) {
|
|
801
|
-
adapter.noteOverCap(delivery.overCap);
|
|
802
|
-
process.stderr.write(`[counterparts] adapter.envelope.overcap: ${JSON.stringify(delivery.overCap)}\n`);
|
|
803
|
-
}
|
|
804
827
|
if (delivery.stdout.length > 0) {
|
|
805
828
|
process.stdout.write(delivery.stdout);
|
|
806
829
|
// Recorded, not inferred: a fault thrown after this point (the close in
|
|
@@ -815,6 +838,17 @@ async function runHook(
|
|
|
815
838
|
// them. A SESSION THAT OPENS is stamped with the build that saw it open —
|
|
816
839
|
// never a compaction, which is the same session and server carrying on.
|
|
817
840
|
stampWhenOpened(payload, () => adapter.stampOpened(input));
|
|
841
|
+
// A notice the envelope could not carry leaves a row rather than nothing:
|
|
842
|
+
// "the terminal said nothing" and "there was nothing to say" are different
|
|
843
|
+
// facts about the same morning (scar §2.4). AFTER the write since the rows
|
|
844
|
+
// became durable (review of #318): a write lock may not delay the wake.
|
|
845
|
+
if (delivery.dropped !== null) adapter.noteNoticeDropped(delivery.dropped);
|
|
846
|
+
// PAST THE HOST'S CAP EVEN IN PLAIN FORM: the host shows a preview. Said
|
|
847
|
+
// where a person can find it (the host's debug log), and on the ring.
|
|
848
|
+
if (delivery.overCap !== undefined) {
|
|
849
|
+
adapter.noteOverCap(delivery.overCap);
|
|
850
|
+
process.stderr.write(`[counterparts] adapter.envelope.overcap: ${JSON.stringify(delivery.overCap)}\n`);
|
|
851
|
+
}
|
|
818
852
|
// The update notice's decisions, where a person can find them (the host's
|
|
819
853
|
// debug log): its ring rows die with this process otherwise. Written only
|
|
820
854
|
// on a turn that had something to decide — due, shown, dropped, failed.
|
|
@@ -77,7 +77,7 @@ import type { HostSessionEvidence, RetentionReport } from "../../../core/remembe
|
|
|
77
77
|
import { pruneRetention } from "../../../core/remember/retention.js";
|
|
78
78
|
import { dataDir, describeGuardRefusal } from "../../../core/store/index.js";
|
|
79
79
|
import type { Store } from "../../../core/store/index.js";
|
|
80
|
-
import { hostSessionEvidence, writeUpSources } from "../../sessions.js";
|
|
80
|
+
import { hostSessionEvidence, installedVersion, writeUpSources } from "../../sessions.js";
|
|
81
81
|
import { openLog } from "../../log/index.js";
|
|
82
82
|
|
|
83
83
|
import {
|
|
@@ -299,6 +299,9 @@ export async function runOnce(input: {
|
|
|
299
299
|
scope?: string;
|
|
300
300
|
/** Injected so the whole vector path is provable without the weights. */
|
|
301
301
|
embedder?: LiveEmbedder | null;
|
|
302
|
+
/** The package version this run is, for the wake's build stamp. Absent: the
|
|
303
|
+
* installed manifest's (`installedVersion`). Injected so a test can be an upgrade. */
|
|
304
|
+
build?: string | null;
|
|
302
305
|
onEvent?: (name: string, data: Record<string, string | number | boolean | null>) => void;
|
|
303
306
|
}): Promise<RunReport> {
|
|
304
307
|
const { config } = input;
|
|
@@ -328,6 +331,9 @@ export async function runOnce(input: {
|
|
|
328
331
|
: { budgetBytes: config.injectionBudgetBytes }),
|
|
329
332
|
...(config.owner === undefined ? {} : { owner: config.owner }),
|
|
330
333
|
...(config.timeZone === undefined ? {} : { timeZone: config.timeZone }),
|
|
334
|
+
// The build stamps the wake it publishes, and a wake another build
|
|
335
|
+
// published is re-rendered at step 3a (`version`, 2026-10-02).
|
|
336
|
+
build: input.build === undefined ? installedVersion() : input.build,
|
|
331
337
|
onEvent: (e) => emit(e.name, { ...(e.data ?? {}) }),
|
|
332
338
|
});
|
|
333
339
|
// ONE DATE FOR THE WHOLE RUN, resolved before the first step that could
|