counterparts 0.3.3 → 0.3.4

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 (128) hide show
  1. package/CHANGELOG.md +81 -0
  2. package/docs/module-map.md +3 -2
  3. package/package.json +1 -1
  4. package/src/adapters/claude-code/NOTES.md +16 -0
  5. package/src/adapters/claude-code/doctor.ts +146 -0
  6. package/src/adapters/claude-code/hooks.ts +31 -3
  7. package/src/adapters/claude-code/transcript.ts +7 -0
  8. package/src/adapters/cli/CONTRACT.md +11 -0
  9. package/src/adapters/cli/INTERFACE-GAPS.md +16 -0
  10. package/src/adapters/cli/NOTES.md +25 -0
  11. package/src/adapters/cli/commands.ts +173 -4
  12. package/src/adapters/cli/dream-core.ts +126 -0
  13. package/src/adapters/cli/help.ts +17 -0
  14. package/src/adapters/cli/mechanisms.ts +169 -101
  15. package/src/adapters/dashboard/CONTRACT.md +5 -0
  16. package/src/adapters/dashboard/INTERFACE-GAPS.md +12 -0
  17. package/src/adapters/dashboard/NOTES.md +38 -0
  18. package/src/adapters/dashboard/registries.ts +31 -1
  19. package/src/adapters/dashboard/web/README.md +45 -16
  20. package/src/adapters/dashboard/web/app.html +2 -0
  21. package/src/adapters/dashboard/web/flow.ts +12 -0
  22. package/src/adapters/dashboard/web/lanes.ts +141 -0
  23. package/src/adapters/dashboard/web/mechanisms/association/index.js +1 -2
  24. package/src/adapters/dashboard/web/mechanisms/consolidation/index.js +8 -5
  25. package/src/adapters/dashboard/web/mechanisms/consolidation/panel.js +7 -7
  26. package/src/adapters/dashboard/web/mechanisms/decay/index.js +1 -2
  27. package/src/adapters/dashboard/web/mechanisms/dreaming/index.js +19 -0
  28. package/src/adapters/dashboard/web/mechanisms/emotional/index.js +1 -2
  29. package/src/adapters/dashboard/web/mechanisms/episodic-semantic/index.js +4 -5
  30. package/src/adapters/dashboard/web/mechanisms/index.js +5 -3
  31. package/src/adapters/dashboard/web/mechanisms/interference/index.js +1 -2
  32. package/src/adapters/dashboard/web/mechanisms/prospective/index.js +1 -2
  33. package/src/adapters/dashboard/web/mechanisms/reconsolidation/index.js +1 -2
  34. package/src/adapters/dashboard/web/mechanisms/regions.js +1 -1
  35. package/src/adapters/dashboard/web/mechanisms/retrieval/index.js +1 -2
  36. package/src/adapters/dashboard/web/mechanisms/salience/index.js +1 -2
  37. package/src/adapters/dashboard/web/mechanisms/schema/index.js +1 -2
  38. package/src/adapters/dashboard/web/narrate.ts +68 -13
  39. package/src/adapters/dashboard/web/pages/home/home.css +29 -13
  40. package/src/adapters/dashboard/web/pages/home/index.js +2 -0
  41. package/src/adapters/dashboard/web/pages/home/sections/explorer.js +22 -7
  42. package/src/adapters/dashboard/web/pages/home/sections/hero.js +15 -3
  43. package/src/adapters/dashboard/web/pages/home/sections/live-activity.js +15 -9
  44. package/src/adapters/dashboard/web/pages/home/sections/recent-chapters.js +6 -2
  45. package/src/adapters/dashboard/web/pages/home/sections/tiles.js +35 -18
  46. package/src/adapters/dashboard/web/pages/memories/index.js +30 -36
  47. package/src/adapters/dashboard/web/pages/memories/memories.css +97 -72
  48. package/src/adapters/dashboard/web/pages/memories/row.js +51 -0
  49. package/src/adapters/dashboard/web/pages/memories/sections/feel.js +176 -0
  50. package/src/adapters/dashboard/web/pages/memories/sections/hold.js +67 -0
  51. package/src/adapters/dashboard/web/pages/memories/sections/list.js +65 -43
  52. package/src/adapters/dashboard/web/pages/memories/sections/search.js +26 -23
  53. package/src/adapters/dashboard/web/pages/memories/state.js +12 -5
  54. package/src/adapters/dashboard/web/pages/self/index.js +4 -2
  55. package/src/adapters/dashboard/web/pages/self/sections/dreams.js +76 -0
  56. package/src/adapters/dashboard/web/pages/self/sections/journal.js +1 -1
  57. package/src/adapters/dashboard/web/pages/self/sections/page.js +1 -1
  58. package/src/adapters/dashboard/web/pages/self/sections/settling.js +50 -20
  59. package/src/adapters/dashboard/web/pages/self/sections/wake.js +1 -1
  60. package/src/adapters/dashboard/web/pages/self/self.css +23 -20
  61. package/src/adapters/dashboard/web/pages/self/state.js +0 -2
  62. package/src/adapters/dashboard/web/server.ts +9 -0
  63. package/src/adapters/dashboard/web/shared/memory-marks.css +17 -0
  64. package/src/adapters/dashboard/web/shared/memory-marks.js +81 -0
  65. package/src/adapters/dashboard/web/shared/memory-modal.js +240 -62
  66. package/src/adapters/dashboard/web/shared/modal.css +67 -0
  67. package/src/adapters/dashboard/web/shared/tip.js +1 -1
  68. package/src/adapters/dashboard/web/shared/widgets/feed.css +4 -0
  69. package/src/adapters/dashboard/web/shared/widgets/feed.js +56 -14
  70. package/src/adapters/dashboard/web/shared/widgets/light.css +1 -0
  71. package/src/adapters/dashboard/web/shared/widgets/light.js +7 -5
  72. package/src/adapters/dashboard/web/shared/widgets/tips.css +19 -0
  73. package/src/adapters/dashboard/web/{pages/self → shared/widgets}/tips.js +15 -9
  74. package/src/adapters/dashboard/web/views/activity.ts +18 -2
  75. package/src/adapters/dashboard/web/views/archive-words.ts +27 -10
  76. package/src/adapters/dashboard/web/views/dreams.ts +199 -0
  77. package/src/adapters/dashboard/web/views/mechanism-panel.ts +116 -35
  78. package/src/adapters/dashboard/web/views/mechanisms.ts +81 -326
  79. package/src/adapters/dashboard/web/views/memories.ts +245 -43
  80. package/src/adapters/dashboard/web/views/memory-words.ts +133 -0
  81. package/src/adapters/dashboard/web/views/memory.ts +215 -7
  82. package/src/adapters/dashboard/web/views/mind.ts +133 -57
  83. package/src/adapters/dashboard/web/views/overview.ts +80 -42
  84. package/src/adapters/dashboard/web/views/search.ts +35 -1
  85. package/src/adapters/dashboard/web/views/shared.ts +14 -0
  86. package/src/adapters/dashboard/web/views.ts +2 -0
  87. package/src/adapters/fired.ts +85 -5
  88. package/src/adapters/mcp/NOTES.md +11 -0
  89. package/src/adapters/mcp/server.ts +90 -1
  90. package/src/adapters/mcp/tools.ts +129 -1
  91. package/src/adapters/mechanism-evidence.ts +465 -0
  92. package/src/core/counterpart.ts +113 -4
  93. package/src/core/dream/CONTRACT.md +143 -0
  94. package/src/core/dream/INTERFACE-GAPS.md +24 -0
  95. package/src/core/dream/NOTES.md +84 -0
  96. package/src/core/dream/index.ts +1067 -0
  97. package/src/core/dream/mark.ts +14 -0
  98. package/src/core/dream/tunables.ts +56 -0
  99. package/src/core/physics/CONTRACT.md +92 -24
  100. package/src/core/physics/NOTES.md +139 -0
  101. package/src/core/physics/index.ts +345 -68
  102. package/src/core/recall/NOTES.md +16 -0
  103. package/src/core/recall/index.ts +9 -2
  104. package/src/core/remember/CONTRACT.md +5 -0
  105. package/src/core/remember/spans.ts +11 -1
  106. package/src/core/self/CONTRACT.md +3 -0
  107. package/src/core/self/INTERFACE-GAPS.md +7 -0
  108. package/src/core/self/NOTES.md +30 -0
  109. package/src/core/self/identity.ts +95 -5
  110. package/src/core/self/index.ts +17 -0
  111. package/src/core/self/tunables.ts +17 -0
  112. package/src/core/sleep/CONTRACT.md +17 -1
  113. package/src/core/sleep/INTERFACE-GAPS.md +19 -0
  114. package/src/core/sleep/NOTES.md +36 -0
  115. package/src/core/sleep/consolidate.ts +149 -96
  116. package/src/core/sleep/decay.ts +11 -0
  117. package/src/core/sleep/index.ts +4 -1
  118. package/src/core/sleep/tunables.ts +9 -0
  119. package/src/core/sleep/types.ts +17 -0
  120. package/src/core/sleep/upgrade.ts +168 -0
  121. package/src/core/store/CONTRACT.md +12 -0
  122. package/src/core/store/NOTES.md +48 -0
  123. package/src/core/store/index.ts +610 -8
  124. package/src/core/store/operational.ts +314 -3
  125. package/src/core/store/owner-op-seam.ts +79 -1
  126. package/src/core/types.ts +28 -0
  127. package/src/adapters/dashboard/web/pages/memories/sections/constellation.js +0 -178
  128. package/src/adapters/dashboard/web/pages/memories/sections/kinds.js +0 -42
@@ -40,6 +40,8 @@ import type { EventRow, ReadOnlyStore } from "../../../core/store/index.js";
40
40
  import { num } from "../layout.js";
41
41
  import type { DurableEventName } from "../registries.js";
42
42
  import { nodeOf } from "./flow.js";
43
+ import { iconOf, laneOf } from "./lanes.js";
44
+ import type { Icon, Lane } from "./lanes.js";
43
45
  import type { NodeKey } from "./flow.js";
44
46
  import { reveal, revealHere, revealPayload, shortOf } from "./reveal.js";
45
47
 
@@ -173,10 +175,45 @@ function nameSome(t: Told, ids: readonly string[], cap = 2): string {
173
175
 
174
176
  export const NARRATORS = {
175
177
  // ── the sleep cycle ────────────────────────────────────────────────────────
176
- "band.promoted": (t) =>
177
- notable(
178
- `${subject(t)} crossed into identity — it had been in real use on ${n(t, "reinforcedDays") ?? 0} separate days.`,
179
- ),
178
+ "band.promoted": (t) => {
179
+ // Since 2026-09-26 a crossing names its LANE: strongly felt and back after
180
+ // a gap (fast), or back on several separate days over weeks (slow). A row
181
+ // written before then has no lane and reads as it always did.
182
+ const lane = s(t, "lane");
183
+ const days = n(t, "returnDays") ?? n(t, "reinforcedDays") ?? 0;
184
+ return notable(
185
+ lane === "fast"
186
+ ? `${subject(t)} became core — it was strongly felt, and it came back after a gap.`
187
+ : lane === "slow"
188
+ ? `${subject(t)} became core — it kept coming back, on ${days} separate days over weeks.`
189
+ : `${subject(t)} crossed into identity — it had been in real use on ${days} separate days.`,
190
+ );
191
+ },
192
+ "band.demoted": (t) =>
193
+ notable(`The owner sent ${subject(t)} back out of the core, to fade like any other memory from today.`),
194
+ "physics.upgrade.census": (t) => {
195
+ const down = n(t, "bandDown") ?? 0;
196
+ const sooner = n(t, "pruneSooner") ?? 0;
197
+ const checked = n(t, "checked") ?? 0;
198
+ const line = `After the v8 upgrade I measured ${checked} memories by the old arithmetic and the new: ${down} moved down a band, ${sooner} would be let go sooner.`;
199
+ return down + sooner === 0 ? calm(line) : amber(line);
200
+ },
201
+ // ── dreaming (2026-09-26) ──────────────────────────────────────────────────
202
+ "dream.begun": (t) =>
203
+ calm(`I began to dream, over ${n(t, "fresh") ?? 0} new memories and ${n(t, "shown") ?? 0} in all.`),
204
+ "dream.changed": (t) => {
205
+ const kinds = ["merge", "link", "replayed", "gist", "contradiction", "feeling-now", "nominate-core"]
206
+ .map((k) => [k, n(t, k) ?? 0] as const)
207
+ .filter(([, v]) => v > 0)
208
+ .map(([k, v]) => `${v} ${k}`);
209
+ return calm(
210
+ `In a dream I changed ${n(t, "applied") ?? 0} things${kinds.length > 0 ? ` (${kinds.join(", ")})` : ""}${(n(t, "refused") ?? 0) > 0 ? `; ${n(t, "refused") ?? 0} were refused` : ""}.`,
211
+ );
212
+ },
213
+ "dream.journaled": () => notable("I woke from a dream and wrote it in the dream journal."),
214
+ "dream.undone": (t) => notable(`The owner undid a dream — ${n(t, "reversed") ?? 0} of its changes were put back.`),
215
+ "dream.ask": (t) =>
216
+ calm(s(t, "state") === "declined" ? "The owner said not today to a dream." : "I asked whether I could dream."),
180
217
  "band.transition": (t) => {
181
218
  // The payload's key names are TAKEN FROM the core's own pinned field tuple
182
219
  // rather than retyped as literals — the same rule `registries.ts` keeps for
@@ -492,13 +529,10 @@ export const NARRATORS = {
492
529
  const pruned = n(t, "pruned") ?? 0;
493
530
  const merged = n(t, "merged") ?? 0;
494
531
  if (promoted + pruned + merged === 0) {
495
- return calm(
496
- "My nightly cycle ran end to end and changed nothing worth naming — nothing promoted, nothing let go, nothing merged. This line is here to prove the quiet is real.",
497
- );
532
+ // One short line (2026-09-26): the quiet night is still said, so the quiet is known to be real.
533
+ return calm("I slept: nothing to promote, let go or merge.");
498
534
  }
499
- return notable(
500
- `My nightly cycle ran: ${promoted} promoted, ${pruned} let go, ${merged} merged.`,
501
- );
535
+ return notable(`I slept: ${promoted} promoted, ${pruned} let go, ${merged} merged.`);
502
536
  },
503
537
  /**
504
538
  * THE WAKE RENDER'S ROW (U9). Neutral by rule: a trim is the budget working,
@@ -643,10 +677,16 @@ export const NARRATORS = {
643
677
  "adapter.semantic.lag": (t) => {
644
678
  const reason = s(t, "reason");
645
679
  const hits = n(t, "hits");
646
- if (hits !== null && hits >= 0 && reason === null) {
647
- return calm(`I left next turn's semantic cue ready — ${hits} neighbours precomputed.`);
680
+ // The writer ALWAYS sets `reason`, and "ok" is the normal case — reading
681
+ // only a missing reason as success painted every healthy turn orange
682
+ // (2026-09-26). Orange is for the one real failure: an embed that broke.
683
+ if (reason === null || reason === "ok") {
684
+ return calm(`I left next turn's semantic cue ready — ${hits ?? 0} neighbours precomputed.`);
648
685
  }
649
- return amber(`I could not leave next turn's semantic cue: ${reason ?? "no reason recorded"}.`);
686
+ if (reason === "embedder-off") return calm("No semantic cue for next turn: the embedder is off, by choice.");
687
+ if (reason === "no-text") return calm("No semantic cue for next turn: the turn had no words to look up.");
688
+ if (reason === "no-credentials") return calm("No semantic cue for next turn: this embedder needs a key, and none is set.");
689
+ return amber(`I could not leave next turn's semantic cue: ${reason}.`);
650
690
  },
651
691
 
652
692
  // ── waking ─────────────────────────────────────────────────────────────────
@@ -1018,6 +1058,15 @@ export const REF_KIND = {
1018
1058
  // A flush describes a SET of pairs, not one memory. The ids stay in the edge
1019
1059
  // rows, where they are the record; the row carries counts.
1020
1060
  "associate.flush": "none",
1061
+ // A dream's rows point at the DREAM, which is not a memory and never becomes
1062
+ // one; its id prints as the raw address, and the journal view opens it.
1063
+ "dream.begun": "none",
1064
+ "dream.changed": "none",
1065
+ "dream.journaled": "none",
1066
+ "dream.undone": "none",
1067
+ "dream.ask": "none",
1068
+ "band.demoted": "memory",
1069
+ "physics.upgrade.census": "none",
1021
1070
  } as const satisfies Record<
1022
1071
  DurableEventName,
1023
1072
  "memory" | "session" | "chunk" | "proposal" | "handoff" | "none"
@@ -1053,6 +1102,10 @@ export interface NarratedEvent {
1053
1102
  readonly text: string;
1054
1103
  readonly tone: Tone;
1055
1104
  readonly node: NodeKey | null;
1105
+ /** Which feed it belongs in: home (memory events) or flow (housekeeping). `lanes.ts`. */
1106
+ readonly lane: Lane;
1107
+ /** The small icon a home line carries, or null. `lanes.ts`. */
1108
+ readonly icon: Icon | null;
1056
1109
  /** The stored ref, resolved now — or null when the row named nothing. */
1057
1110
  readonly subject: string | null;
1058
1111
  /** The payload, every id in it resolved. Ids and counts only, never text. */
@@ -1095,6 +1148,8 @@ export function narrate(store: ReadOnlyStore, row: EventRow): NarratedEvent {
1095
1148
  text: line.text,
1096
1149
  tone: line.tone,
1097
1150
  node: nodeOf(row.name),
1151
+ lane: laneOf(row.name, p),
1152
+ icon: iconOf(row.name, p),
1098
1153
  // Resolved BY EVENT NAME — see `REF_KIND`.
1099
1154
  subject: subjectOf(store, row),
1100
1155
  detail: revealPayload(store, p, 40),
@@ -7,17 +7,27 @@
7
7
  min-height:min(500px,calc(100vh - 150px));margin:0 0 8px}
8
8
  .home-copy{position:relative;z-index:5;max-width:36rem}
9
9
  .home-eyebrow{font-size:12.5px;font-weight:500;letter-spacing:.3px;color:var(--dim);margin:0 0 10px}
10
- .home-headline{font-family:var(--sans);font-weight:700;font-size:clamp(26px,3vw,40px);line-height:1.2;
11
- letter-spacing:-.3px;color:#e8eef5;margin:0 0 24px}
12
- .home-counts{grid-template-columns:repeat(2,minmax(0,1fr));gap:10px;max-width:30rem}
13
- .home-counts .tile{padding:12px 14px}
14
- .home-counts a.tile-link{display:block;min-height:44px;color:inherit;text-decoration:none;cursor:pointer;transition:border-color .15s,box-shadow .15s,transform .15s}
15
- .home-counts a.tile-link:hover{transform:translateY(-1px)}
16
- .home-counts a.tile-link:focus-visible{outline:2px solid var(--cyan);outline-offset:2px}
17
- .home-counts .tile .n{font-size:26px;font-weight:700}
18
- .home-counts .tile .l{font-size:13.5px;color:var(--ink)}
19
- .home-counts .tile .s{font-size:12px}
20
- .home-counts .tile.quiet .n{color:var(--dim);text-shadow:none}
10
+ .home-headline{font-family:var(--sans);font-weight:700;font-size:clamp(24px,2.6vw,36px);line-height:1.25;
11
+ letter-spacing:-.3px;color:#e8eef5;margin:0 0 22px}
12
+ .home-headline .hh-part{display:inline-block;white-space:nowrap}
13
+
14
+ /* four small tiles: the number is the link; its words sit behind the `?` */
15
+ .home-counts{display:grid;grid-template-columns:repeat(4,minmax(0,1fr));gap:10px;max-width:34rem}
16
+ .home-counts .ht{position:relative;padding:11px 12px 10px;display:flex;flex-direction:column;gap:2px;min-width:0}
17
+ .home-counts .ht-link{display:flex;flex-direction:column;min-height:44px;color:inherit;text-decoration:none;cursor:pointer}
18
+ .home-counts .ht-link:focus-visible{outline:2px solid var(--cyan);outline-offset:2px;border-radius:4px}
19
+ .home-counts .ht:hover{border-color:var(--glow)}
20
+ .home-counts .ht .n{font-family:var(--mono);font-size:26px;font-weight:700;line-height:1.15}
21
+ .home-counts .ht .l{font-size:13px;color:var(--ink);text-transform:none;letter-spacing:0;margin-top:1px}
22
+ .home-counts .ht .q-wrap{position:absolute;top:8px;right:8px}
23
+ .home-counts .ht .q-wrap.open{position:static;display:block}
24
+ .home-counts .ht .s{font-size:12px;color:var(--dim);margin-top:4px;line-height:1.4}
25
+ .home-counts .ht.quiet .n{color:var(--dim);text-shadow:none}
26
+ .ht-pips{display:inline-flex;gap:3px;margin-right:6px;vertical-align:1px}
27
+ .ht-pip{width:7px;height:7px;border-radius:50%;border:1px solid rgba(179,136,255,.6)}
28
+ .ht-pip.on{background:var(--purple);border-color:var(--purple);box-shadow:0 0 6px rgba(179,136,255,.5)}
29
+ .ht-core .n{color:var(--purple);text-shadow:0 0 15px rgba(179,136,255,.2)}
30
+ .ht-replaced .n{color:var(--teal);text-shadow:0 0 15px rgba(0,191,165,.2)}
21
31
 
22
32
  /* ── the brain ────────────────────────────────────────── */
23
33
  .home-brain{position:relative;height:min(540px,calc(100vh - 150px));min-height:360px;width:100%}
@@ -42,7 +52,12 @@
42
52
  .home-panel{--reg:var(--cyan);border:1px solid var(--border);border-top:2px solid var(--reg);border-radius:6px;background:var(--card);
43
53
  padding:18px clamp(14px,2.2vw,28px) 24px;box-shadow:0 -20px 60px -30px var(--reg);transition:border-color .3s,box-shadow .3s;
44
54
  scroll-margin-top:12px}
55
+ .mech-top{display:flex;gap:12px;align-items:flex-start;margin:0 0 20px}
56
+ .mech-top .mechs{flex:1;min-width:0;margin:0}
57
+ .mech-legend{flex:none;padding-top:2px}
58
+ .mech-legend .q-wrap.open .q-pop{position:absolute;right:0;left:auto;top:calc(100% + 8px);width:min(22rem,calc(100vw - 48px));max-width:none}
45
59
  .mechs{display:flex;flex-wrap:wrap;gap:14px 22px;margin:0 0 20px}
60
+ .mech-pill.is-notbuilt{color:var(--dim);border-style:dashed}
46
61
  .mech-group{display:flex;flex-direction:column;gap:6px;flex:none;max-width:100%}
47
62
  .mech-fam{font-size:12.5px;font-weight:600;letter-spacing:.3px;color:var(--pin);padding-left:4px}
48
63
  .mech-row{display:flex;gap:5px;flex-wrap:wrap}
@@ -124,8 +139,9 @@
124
139
  }
125
140
  @media(max-width:560px){
126
141
  .home-brain{height:320px}
127
- .home-headline{font-size:26px;margin-bottom:18px}
128
- .home-counts .tile .n{font-size:22px}
142
+ .home-headline{font-size:22px;margin-bottom:18px}
143
+ .home-counts{grid-template-columns:repeat(2,minmax(0,1fr))}
144
+ .home-counts .ht .n{font-size:22px}
129
145
  }
130
146
  @media(max-width:720px),(pointer:coarse){
131
147
  .mech-pill{min-height:44px;padding:0 14px}
@@ -66,7 +66,9 @@ export default {
66
66
  mount(section) {
67
67
  section.innerHTML = markup;
68
68
  hero.mount();
69
+ explorer.mount();
69
70
  liveActivity.mount();
71
+ recentChapters.mount();
70
72
  // The brain is built once and kept; a failure to start is a calm sentence
71
73
  // in its place, never an error on the page.
72
74
  try {
@@ -1,6 +1,7 @@
1
1
  /* The mechanism panel, under the hero — the site's Explorer, with this store in
2
2
  it. Eleven pills in the site's four families, each with its light (from
3
- `/api/mechanisms`) and, where the site marks it so, an "in dev" tag. Picking
3
+ `/api/mechanisms`: fired lately, waiting, quiet, not built) and, when only
4
+ some of it is built, a "partly built" tag (the view's `build`). Picking
4
5
  one (here, or on the brain) shows it INLINE: what it is, what the store says
5
6
  it did, a small picture of this store's own data where one exists
6
7
  (`mechanisms/<id>/panel.js`, fed by `/api/mechanism?id=`), what is built and
@@ -15,13 +16,24 @@ import { $, esc } from "../../../shared/dom.js";
15
16
  import "../../../shared/memory-modal.js"; // window.openMemory, for the pictures' rows
16
17
  import { renderFeed } from "../../../shared/widgets/feed.js";
17
18
  import { LIGHT_WORD, light } from "../../../shared/widgets/light.js";
19
+ import { q, wireTips } from "../../../shared/widgets/tips.js";
20
+
21
+ const LEGEND =
22
+ "A green light fired in the last 7 lived days. A ring is waiting: its next run is ahead, or it has nothing to act on yet. " +
23
+ "Amber is built but quiet. Grey is not built yet. \"Partly built\" means some of it works and some is still to come.";
18
24
 
19
25
  export const markup = `
20
26
  <section class="home-panel" id="mech-panel" aria-labelledby="mech-title">
21
- <div class="mechs" id="mech-strip" role="group" aria-label="Memory mechanisms, by stage"></div>
27
+ <div class="mech-top">
28
+ <div class="mechs" id="mech-strip" role="group" aria-label="Memory mechanisms, by stage"></div>
29
+ <span class="mech-legend">${q("home-lights", LEGEND)}</span>
30
+ </div>
22
31
  <div class="mech-body" id="mech-body"></div>
23
32
  </section>`;
24
33
 
34
+ /** Wire the legend's `?` once the markup is in the page. */
35
+ export function mount() { wireTips($("mech-panel")); }
36
+
25
37
  const ORDER = MECHANISMS.map((m) => m.id);
26
38
  const byIdStatic = Object.fromEntries(MECHANISMS.map((m) => [m.id, m]));
27
39
  const familyOf = (m) => FAMILIES.find((f) => f.key === m.family) || FAMILIES[0];
@@ -34,7 +46,9 @@ let selected = null;
34
46
  let panelData = {}; // id → the /api/mechanism payload last read
35
47
  let asked = 0;
36
48
 
37
- const lightOf = (id) => lights[id] || { status: "grey", evidence: "", events: [] };
49
+ const lightOf = (id) => lights[id] || { status: "grey", build: "not", evidence: "", events: [] };
50
+ /** A pill's tag: only the partly built say so. Built needs no tag; grey is not built. */
51
+ const tagOf = (id) => lightOf(id).build === "partly" ? '<span class="mech-tag">partly built</span>' : "";
38
52
 
39
53
  /** Hand the explorer the brain it drives (and that drives it). */
40
54
  export function attachBrain(b) {
@@ -64,9 +78,10 @@ function paintStrip() {
64
78
  '<span class="mech-fam">' + esc(f.label) + "</span>" +
65
79
  '<div class="mech-row">' +
66
80
  MECHANISMS.filter((m) => m.family === f.key).map((m) =>
67
- '<button type="button" class="mech-pill' + (m.id === selected ? " is-on" : "") + '" data-id="' + esc(m.id) + '"' +
81
+ '<button type="button" class="mech-pill' + (m.id === selected ? " is-on" : "") +
82
+ (lightOf(m.id).build === "not" ? " is-notbuilt" : "") + '" data-id="' + esc(m.id) + '"' +
68
83
  ' aria-pressed="' + (m.id === selected ? "true" : "false") + '" title="' + esc(m.name) + '">' +
69
- light(lightOf(m.id).status) + esc(m.short) + (m.inDev ? '<span class="mech-tag">in dev</span>' : "") + "</button>"
84
+ light(lightOf(m.id).status) + esc(m.short) + tagOf(m.id) + "</button>"
70
85
  ).join("") +
71
86
  "</div></div>"
72
87
  ).join("");
@@ -100,7 +115,7 @@ function paintBody() {
100
115
  $("mech-body").innerHTML =
101
116
  '<div class="mech-grid">' +
102
117
  '<div class="mech-text">' +
103
- '<p class="mech-eyebrow">' + esc(m.name) + (m.inDev ? ' <span class="mech-dev">in development</span>' : "") + "</p>" +
118
+ '<p class="mech-eyebrow">' + esc(m.name) + (l.build === "partly" ? ' <span class="mech-dev">partly built</span>' : "") + "</p>" +
104
119
  '<h2 class="mech-title" id="mech-title">' + esc(m.tagline) + "</h2>" +
105
120
  '<p class="mech-explainer">' + esc(m.explainer) + "</p>" +
106
121
  '<p class="mech-evidence">' + light(l.status) + " <b>" + esc(LIGHT_WORD[l.status] || "") + "</b> — " + esc(l.evidence) + "</p>" +
@@ -164,7 +179,7 @@ function paint(view) {
164
179
  for (const r of REGIONS) {
165
180
  levels[r.key] = Math.max(0, ...r.mechanisms.map((id) => {
166
181
  const s = lightOf(id).status;
167
- return s === "green" ? 1 : s === "amber" ? 0.25 : 0;
182
+ return s === "green" ? 1 : s === "waiting" ? 0.45 : s === "amber" ? 0.25 : 0;
168
183
  }));
169
184
  }
170
185
  brain.levels(levels);
@@ -1,5 +1,5 @@
1
- /* The hero: one plain line about this memory and a few counts on the left, the
2
- brain on the right (`../brain.js`). The brain is mounted once; the words are
1
+ /* The hero: one short headline and four small tiles on the left, the brain on
2
+ the right (`../brain.js`). The brain is mounted once; the words are
3
3
  repainted whenever the store moves. */
4
4
  import { $ } from "../../../shared/dom.js";
5
5
  import * as tiles from "./tiles.js";
@@ -16,7 +16,19 @@ export const markup = `
16
16
 
17
17
  export function mount() { tiles.mount(); }
18
18
 
19
+ /** "Day 30 · 145 memories · 8 of 11 built · 6 active this week": each part is
20
+ * its own span, so a narrow screen breaks between parts, never inside one. */
19
21
  export function paint(d) {
20
- $("home-headline").textContent = d.hero.headline;
22
+ const el = $("home-headline");
23
+ const parts = d.hero.headline.split(" · ");
24
+ const nodes = [];
25
+ parts.forEach((part, i) => {
26
+ if (i > 0) nodes.push(document.createTextNode(" "));
27
+ const s = document.createElement("span");
28
+ s.className = "hh-part";
29
+ s.textContent = part + (i < parts.length - 1 ? " ·" : "");
30
+ nodes.push(s);
31
+ });
32
+ el.replaceChildren(...nodes);
21
33
  tiles.paint(d);
22
34
  }
@@ -1,20 +1,26 @@
1
- /* Live activity — the durable log in my own words. The one overview panel the
2
- pulse owns: it is registered as a live feed, so new events are prepended. */
1
+ /* Live activity — memory events only, in my own words (2026-09-26, an
2
+ experiment): something remembered, a memory stronger, replaced or let go, a
3
+ chapter, a handoff, the night's sleep, a reminder. Housekeeping lines go to
4
+ the flow tab's feed (`web/lanes.ts` is the split). The one home panel the
5
+ pulse owns: it is registered as a live feed that takes only home rows. */
3
6
  import { $ } from "../../../shared/dom.js";
4
7
  import { registerLiveFeed, renderFeed } from "../../../shared/widgets/feed.js";
8
+ import { q, wireTips } from "../../../shared/widgets/tips.js";
5
9
 
6
10
  export const markup = `
7
- <h2>Live activity <small style="color:var(--purple)">— in my own words · click any line for the record behind it</small></h2>
8
- <div class="card feed" id="ov-feed"></div>
9
- <p class="foot" id="ov-feednote"></p>`;
11
+ <h2 id="ov-feed-h">Live activity ${q("home-feed",
12
+ "What happened to my memories, newest first: what I wrote down, what got stronger, what was replaced or let go, " +
13
+ "chapters, handoffs, each night's sleep and reminders. The plumbing is on the flow tab. Click a line for the record behind it. " +
14
+ "Records hold ids, counts and bytes, never a memory's words or a turn of yours; names are filled in as the page is drawn.")}</h2>
15
+ <div class="card feed" id="ov-feed"></div>`;
10
16
 
11
- export function mount() { registerLiveFeed("ov-feed"); }
17
+ export function mount() {
18
+ registerLiveFeed("ov-feed", (e) => e.lane === "home");
19
+ wireTips($("ov-feed-h"));
20
+ }
12
21
 
13
22
  export function paint(d) {
14
23
  renderFeed($("ov-feed"), d.feed, d);
15
- $("ov-feednote").textContent =
16
- "Payloads are ids, counts and bytes — never a memory's words, and never a turn of yours. " +
17
- "The names above are resolved at the moment this page was drawn.";
18
24
  }
19
25
 
20
26
  /** True while the feed still shows its absence line — nothing of the pulse's
@@ -2,11 +2,15 @@
2
2
  on the self tab. */
3
3
  import { $ } from "../../../shared/dom.js";
4
4
  import { chapterRows } from "../../../shared/widgets/chapters.js";
5
+ import { q, wireTips } from "../../../shared/widgets/tips.js";
5
6
 
6
7
  export const markup = `
7
- <h2>Latest chapters <small>— the journal, in the first person; these do not decay</small></h2>
8
+ <h2 id="ov-chapters-h">Latest chapters ${q("home-chapters",
9
+ "My journal, written in the first person at the end of a session. Chapters do not fade.")}</h2>
8
10
  <div class="card rows" id="ov-chapters"></div>
9
- <p class="foot"><a href="#self" class="home-more">every chapter, on the self tab →</a></p>`;
11
+ <p class="foot"><a href="#self/journal" class="home-more">every chapter →</a></p>`;
12
+
13
+ export function mount() { wireTips($("ov-chapters-h")); }
10
14
 
11
15
  export function paint(d) {
12
16
  $("ov-chapters").innerHTML = chapterRows((d.chapters || []).slice(0, 3), d.chaptersAbsent);
@@ -1,35 +1,52 @@
1
- /* The few plain counts under the home page's headline (`/api/overview`'s
2
- `hero.counts`). Drawn with the tile classes, so the page reads its numbers
3
- the way it always did. Each is a link to where that number is shown in full
4
- (a hash route: `shell/tabs.js#parseRoute`). */
1
+ /* The four small tiles under the home page's headline (`/api/overview`'s
2
+ `hero.counts`, 2026-09-26, an experiment): memories, core, chapters,
3
+ replaced. Each number is a link to where it is shown in full (a hash route:
4
+ `shell/tabs.js#parseRoute`); the words that explain it sit behind its `?`. */
5
5
  import { $, esc } from "../../../shared/dom.js";
6
+ import { q, wireTips } from "../../../shared/widgets/tips.js";
6
7
 
7
8
  const GOES_TO = {
8
- "memories held": "memories?state=live",
9
- "core memories": "self/settling",
10
- "chapters written": "self/journal",
11
- "archived": "memories?state=archived",
9
+ "memories": "memories?state=live",
10
+ "core": "self/settling",
11
+ "chapters": "self/journal",
12
+ "replaced": "memories?state=archived",
12
13
  };
13
14
 
14
- export const markup = `<div class="tiles home-counts" id="ov-tiles"></div>`;
15
+ const TIPS = {
16
+ memories: "Everything I hold right now: memories, and the cards for the people and projects I know. The journal's chapters are counted apart.",
17
+ core: "Core memories don't fade. A memory gets there by being used on separate days with a high enough score. \"Closest\" is the one nearest to making it.",
18
+ chapters: "My journal, written in the first person at the end of a session. Chapters don't fade.",
19
+ replaced: "Older readings replaced by newer ones — nothing forgotten; the old version is kept. \"Let go\" is different: memories that faded until they were set aside.",
20
+ };
21
+
22
+ export const markup = `<div class="home-counts" id="ov-tiles"></div>`;
23
+
24
+ /** Filled pips for the closest candidate's days: a small picture of "1 of 3". */
25
+ function pips(p) {
26
+ if (!p || !p.of) return "";
27
+ let out = '<span class="ht-pips" aria-hidden="true">';
28
+ for (let i = 0; i < p.of; i++) out += '<span class="ht-pip' + (i < p.days ? " on" : "") + '"></span>';
29
+ return out + "</span>";
30
+ }
15
31
 
16
32
  export function paint(d) {
17
33
  $("ov-tiles").innerHTML = d.hero.counts.map((t) => {
18
- const to = GOES_TO[t.label];
19
- const open = to ? '<a class="tile tile-link' + (t.absent ? " quiet" : "") + '" href="#' + esc(to) + '">'
20
- : '<div class="tile' + (t.absent ? " quiet" : "") + '">';
21
- return open +
22
- '<div class="n">' + esc(t.value) + "</div>" +
23
- '<div class="l">' + esc(t.label) + "</div>" +
24
- '<div class="s">' + esc(t.note) + "</div>" + (to ? "</a>" : "</div>");
34
+ const to = GOES_TO[t.key];
35
+ const note = t.note ? '<div class="s">' + pips(t.progress) + esc(t.note) + "</div>" : "";
36
+ return '<div class="tile ht ht-' + esc(t.key) + (t.absent ? " quiet" : "") + '">' +
37
+ '<a class="ht-link" href="#' + esc(to) + '">' +
38
+ '<span class="n">' + esc(t.value) + "</span>" +
39
+ '<span class="l">' + esc(t.label) + "</span>" +
40
+ "</a>" + q("home-tile-" + t.key, TIPS[t.key] || "") + note + "</div>";
25
41
  }).join("");
42
+ wireTips($("ov-tiles"));
26
43
  }
27
44
 
28
45
  /** A link changes the hash and the nav follows it (`shell/tabs.js`). A second
29
- * click on the same card changes nothing, so it re-announces the hash itself. */
46
+ * click on the same tile changes nothing, so it re-announces the hash itself. */
30
47
  export function mount() {
31
48
  $("ov-tiles").addEventListener("click", (e) => {
32
- const a = e.target.closest("a.tile-link");
49
+ const a = e.target.closest("a.ht-link");
33
50
  if (!a || location.hash !== a.getAttribute("href")) return;
34
51
  e.preventDefault();
35
52
  dispatchEvent(new HashChangeEvent("hashchange"));
@@ -1,10 +1,16 @@
1
- /* The memories tab: find (search + ask), the page's buttons (note, back up,
2
- export), one picture of everything held, the kinds in words, and every
3
- memory as a paged list. `/api/memories` feeds the picture and the kinds;
4
- the list fetches its own page (`/api/memories/list`). */
1
+ /* The memories tab: everything it holds — find it (search + ask), see it (two
2
+ small pictures: how firmly it's held, and how it feels), read and manage it
3
+ (every memory as a paged list, the page's buttons). `/api/memories` feeds the
4
+ pictures; the list fetches its own page (`/api/memories/list`).
5
+
6
+ LIVE. The pulse calls `refresh()` when the store moves. Everything is re-read
7
+ and redrawn from `state.js`, so the chosen filters, sort and page (and any
8
+ pinned `?`, kept by the shared tip widget) come back as they were; an open memory card lives in the overlay
9
+ and is left alone; the scroll position is put back. */
5
10
  import { api, fail } from "../../shared/api.js";
6
- import * as constellation from "./sections/constellation.js";
7
- import * as kinds from "./sections/kinds.js";
11
+ import { $ } from "../../shared/dom.js";
12
+ import * as feel from "./sections/feel.js";
13
+ import * as hold from "./sections/hold.js";
8
14
  import * as list from "./sections/list.js";
9
15
  import * as search from "./sections/search.js";
10
16
  import * as tools from "./sections/tools.js";
@@ -12,45 +18,38 @@ import { setFilter } from "./state.js";
12
18
 
13
19
  const markup = `
14
20
  <div class="mem-top">
15
- <p class="mem-lede" id="mem-lede">Everything I remember, and why it is where it is.</p>${tools.markup}
21
+ <p class="mem-count" id="mem-lede"></p>${tools.markup}
16
22
  </div>${tools.notePanel}${search.markup}
17
- ${constellation.markup}
18
- ${kinds.markup}
23
+ <div class="glance2">${hold.markup}${feel.markup}
24
+ </div>
19
25
  ${list.markup}
20
26
  `;
21
27
 
22
- let MEM = null;
23
-
24
28
  async function render() {
25
29
  let d;
26
30
  try { d = await api("/api/memories"); } catch (e) { return fail("The memories page", e); }
27
- MEM = d;
28
- document.getElementById("mem-lede").textContent = lede(d);
29
- constellation.paint(d);
30
- kinds.paint(d);
31
- constellation.draw();
31
+ const x = scrollX, y = scrollY;
32
+ $("mem-lede").textContent = count(d);
33
+ hold.paint(d);
34
+ feel.paint(d);
32
35
  await list.render();
36
+ if (scrollX !== x || scrollY !== y) scrollTo(x, y);
33
37
  }
34
38
 
35
- /** "121 memories and 24 entities and beliefs" — the census counts both, and
36
- * `counterparts status` prints them apart, so this page does too. */
37
- function heldWords(d) {
38
- const m = d.memories + (d.memories === 1 ? " memory" : " memories");
39
- return d.schemas ? m + " and " + d.schemas + (d.schemas === 1 ? " entity or belief" : " entities and beliefs") : m;
40
- }
41
-
42
- function lede(d) {
43
- if (d.total === 0) return "Nothing held yet. Write a note, or just talk — what matters settles here.";
44
- if (d.total < 20) return "A young memory: " + heldWords(d) + " so far. Every one is below, with its words; it fills in as we talk.";
45
- return heldWords(d) + ". Search by words, ask a question, or browse every one below, newest first.";
39
+ /** "145 memories" — the dashboard's one count (2026-09-26): every live row but
40
+ * the journal's, people and project cards included, the same number the
41
+ * list's "live" chip and the home page say. */
42
+ function count(d) {
43
+ if (d.total === 0) return "Nothing held yet. Write a note, or just talk.";
44
+ return d.total + (d.total === 1 ? " memory" : " memories");
46
45
  }
47
46
 
48
47
  export default {
49
48
  name: "memories",
50
49
  mount(section) {
51
50
  section.innerHTML = markup;
52
- constellation.mount();
53
- kinds.mount();
51
+ hold.mount();
52
+ feel.mount();
54
53
  list.mount();
55
54
  search.mount();
56
55
  tools.mount();
@@ -60,16 +59,11 @@ export default {
60
59
  render,
61
60
  /** The store moved (the pulse): re-read everything this page shows. */
62
61
  refresh: render,
63
- /** Coming back to the tab: the canvas may have been laid out at zero width. */
64
- show() { constellation.draw(); },
65
- resize() { if (MEM) constellation.draw(); },
66
62
  /** `#memories?state=archived` (or live/all): open the list at that filter. */
67
63
  route({ params }) {
68
64
  const state = params.get("state");
69
65
  if (!["live", "archived", "all"].includes(state)) return;
70
- setFilter({ state, kind: null, band: null });
71
- document.getElementById("mlist-h").scrollIntoView({ block: "start" });
66
+ setFilter({ state, kind: null, core: false, journal: false, hold: null, feeling: null, feelingCore: null });
67
+ $("mlist-h").scrollIntoView({ block: "start" });
72
68
  },
73
- /** After boot, when this is the tab showing. */
74
- redraw() { constellation.draw(); },
75
69
  };