counterparts 0.3.2 → 0.3.3

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 (66) hide show
  1. package/CHANGELOG.md +72 -0
  2. package/package.json +1 -1
  3. package/src/adapters/claude-code/NOTES.md +12 -0
  4. package/src/adapters/claude-code/bin/hook.ts +85 -22
  5. package/src/adapters/claude-code/config.ts +7 -0
  6. package/src/adapters/claude-code/doctor.ts +20 -4
  7. package/src/adapters/claude-code/hooks.ts +157 -6
  8. package/src/adapters/claude-code/index.ts +3 -0
  9. package/src/adapters/cli/commands.ts +11 -0
  10. package/src/adapters/cli/mechanisms.ts +46 -21
  11. package/src/adapters/dashboard/registries.ts +4 -0
  12. package/src/adapters/dashboard/web/README.md +19 -11
  13. package/src/adapters/dashboard/web/flow.ts +2 -0
  14. package/src/adapters/dashboard/web/mechanisms/emotional/index.js +9 -5
  15. package/src/adapters/dashboard/web/mechanisms/prospective/index.js +6 -3
  16. package/src/adapters/dashboard/web/narrate.ts +8 -0
  17. package/src/adapters/dashboard/web/pages/health/sections/checks.js +17 -1
  18. package/src/adapters/dashboard/web/pages/self/index.js +55 -16
  19. package/src/adapters/dashboard/web/pages/self/sections/journal.js +75 -19
  20. package/src/adapters/dashboard/web/pages/self/sections/page.js +108 -65
  21. package/src/adapters/dashboard/web/pages/self/sections/settling.js +94 -99
  22. package/src/adapters/dashboard/web/pages/self/sections/wake.js +31 -15
  23. package/src/adapters/dashboard/web/pages/self/self.css +119 -59
  24. package/src/adapters/dashboard/web/pages/self/state.js +23 -0
  25. package/src/adapters/dashboard/web/pages/self/tips.js +50 -0
  26. package/src/adapters/dashboard/web/shared/memory-modal.js +9 -0
  27. package/src/adapters/dashboard/web/views/mechanisms.ts +85 -14
  28. package/src/adapters/dashboard/web/views/memory.ts +15 -1
  29. package/src/adapters/dashboard/web/views/mind.ts +130 -6
  30. package/src/adapters/feelings-line.ts +74 -0
  31. package/src/adapters/fired.ts +78 -18
  32. package/src/adapters/mcp/CONTRACT.md +8 -0
  33. package/src/adapters/mcp/NOTES.md +45 -0
  34. package/src/adapters/mcp/server.ts +165 -6
  35. package/src/adapters/mcp/tools.ts +51 -4
  36. package/src/core/bridge.ts +21 -16
  37. package/src/core/counterpart.ts +309 -6
  38. package/src/core/encode/CONTRACT.md +7 -1
  39. package/src/core/feelings-wheel.ts +171 -13
  40. package/src/core/mint.ts +9 -0
  41. package/src/core/physics/CONTRACT.md +43 -0
  42. package/src/core/physics/NOTES.md +94 -0
  43. package/src/core/physics/index.ts +98 -6
  44. package/src/core/prospective/CONTRACT.md +35 -6
  45. package/src/core/prospective/INTERFACE-GAPS.md +10 -5
  46. package/src/core/prospective/NOTES.md +175 -4
  47. package/src/core/prospective/derive.ts +32 -3
  48. package/src/core/prospective/index.ts +362 -39
  49. package/src/core/prospective/tunables.ts +18 -1
  50. package/src/core/prospective/windows.ts +104 -46
  51. package/src/core/recall/CONTRACT.md +28 -0
  52. package/src/core/recall/NOTES.md +39 -0
  53. package/src/core/recall/activate.ts +32 -5
  54. package/src/core/recall/gate.ts +7 -1
  55. package/src/core/recall/index.ts +19 -0
  56. package/src/core/recall/mood.ts +106 -0
  57. package/src/core/recall/tunables.ts +26 -0
  58. package/src/core/remember/index.ts +1 -0
  59. package/src/core/remember/proposals.ts +86 -3
  60. package/src/core/self/identity.ts +20 -1
  61. package/src/core/store/CONTRACT.md +9 -2
  62. package/src/core/store/NOTES.md +20 -0
  63. package/src/core/store/feelings.ts +23 -6
  64. package/src/core/store/index.ts +107 -10
  65. package/src/core/store/operational.ts +15 -1
  66. package/src/core/types.ts +9 -0
@@ -28,22 +28,58 @@
28
28
  .lane h4{font-size:10px;text-transform:uppercase;letter-spacing:2px;color:var(--purple);
29
29
  font-weight:400;margin-bottom:6px}
30
30
  .lane .item{font-size:11.5px;line-height:1.7;padding:4px 0 4px 14px;border-left:1px solid var(--border);
31
- margin-bottom:2px;color:var(--ink)}
31
+ margin-bottom:2px;color:var(--ink);overflow-wrap:anywhere}
32
32
  .lane .item .date{color:var(--faint)}
33
- .wakehead{color:var(--dim);font-size:11px;margin-bottom:12px;line-height:1.65}
33
+ .wakehead{color:var(--dim);font-size:11px;margin-bottom:12px;line-height:1.65;overflow-wrap:anywhere}
34
+
35
+ /* ── the `?`: the explaining words, out of the reading path ── */
36
+ .q-wrap{position:relative;display:inline-block;vertical-align:middle;line-height:1}
37
+ .q{display:inline-flex;align-items:center;justify-content:center;width:20px;height:20px;padding:0;margin:0 0 0 2px;
38
+ border:1px solid var(--glow);border-radius:50%;background:none;color:var(--dim);font-family:var(--sans);
39
+ font-size:12px;font-weight:600;line-height:1;cursor:pointer;position:relative}
40
+ /* A small glyph with a thumb-sized hit area around it. */
41
+ .q::after{content:"";position:absolute;inset:-12px}
42
+ .q:hover,.q:focus-visible,.q-wrap.open .q{color:var(--cyan);border-color:var(--cyan)}
43
+ .q-pop{display:none;position:absolute;left:0;top:calc(100% + 8px);z-index:30;width:max-content;
44
+ max-width:min(22rem,calc(100vw - 32px));background:var(--deep);border:1px solid var(--glow);border-radius:6px;
45
+ padding:9px 12px;font-family:var(--sans);font-size:13px;font-weight:400;line-height:1.55;color:var(--ink);
46
+ text-transform:none;letter-spacing:0;text-align:left;white-space:normal;box-shadow:0 6px 26px rgba(0,0,0,.6)}
47
+ /* Hovered: a floating note that never takes the pointer, so it can't sit in
48
+ the way of what is under it. Pinned (tap / click / Enter): the words drop
49
+ into the flow under the line they explain and cover nothing. */
50
+ @media(hover:hover){.q-wrap:not(.open):hover .q-pop,.q-wrap:not(.open) .q:focus-visible+.q-pop{display:block;pointer-events:none}}
51
+ .q-wrap.open{display:inline}
52
+ .q-wrap.open .q-pop{display:block;position:static;width:auto;max-width:none;margin:8px 0 2px;box-shadow:none;
53
+ background:rgba(0,229,255,.05);border-color:var(--border)}
54
+
55
+ /* ── the top: the page on the left, a side column on the right ── */
56
+ h2.sp-title{margin:0 0 12px;font-size:19px;color:var(--cyan)}
57
+ .self-top{display:grid;grid-template-columns:minmax(0,1fr) clamp(17rem,30vw,22rem);gap:20px;align-items:start}
58
+ .self-top>*{min-width:0}
59
+ .self-side{display:flex;flex-direction:column;gap:12px}
60
+ .side-block{background:var(--card);border:1px solid var(--border);border-radius:6px;padding:12px 14px;min-width:0}
61
+ .side-block[hidden]{display:none}
62
+ h3.sb-h{font-family:var(--sans);font-size:13.5px;font-weight:600;color:var(--ink);margin:0 0 8px;letter-spacing:.1px}
63
+ .sb-line{display:flex;flex-wrap:wrap;gap:4px 8px;align-items:baseline;font-size:13px;color:var(--ink);margin-bottom:6px}
64
+ .sb-k{color:var(--dim)}
65
+ .sb-why{color:var(--dim);font-size:12.5px;font-style:italic;margin:0 0 8px;overflow:hidden;
66
+ display:-webkit-box;-webkit-line-clamp:2;-webkit-box-orient:vertical}
67
+ .sb-writer{font-size:13px;color:var(--ink);border-top:1px solid var(--border);padding-top:8px;margin-top:2px;line-height:1.5}
68
+ .sb-writer:first-child{border-top:none;padding-top:0;margin-top:0}
69
+ .sb-writer.ok::before,.sb-writer.warn::before{content:"";display:inline-block;width:7px;height:7px;border-radius:50%;
70
+ margin-right:7px;vertical-align:1px;background:var(--teal)}
71
+ .sb-writer.warn::before{background:var(--amber)}
72
+ .sb-absent{color:var(--amber)}
73
+ @media(max-width:860px){.self-top{grid-template-columns:minmax(0,1fr)}}
34
74
 
35
75
  /* ── the self page: the heart of the tab ── */
36
76
  .sp-card{background:var(--card);border:1px solid var(--glow);border-radius:6px;padding:20px 24px 16px;
37
- margin:4px 0 8px;box-shadow:0 0 24px rgba(0,229,255,.06)}
38
- .sp-head{display:flex;justify-content:space-between;align-items:baseline;gap:12px;flex-wrap:wrap}
39
- h2.sp-title{margin:0 0 6px;font-size:19px;color:var(--cyan)}
40
- .sp-chips{display:flex;gap:6px;flex-wrap:wrap}
77
+ margin:0 0 8px;box-shadow:0 0 24px rgba(0,229,255,.06);min-width:0}
41
78
  .chip{display:inline-block;font-size:12px;color:var(--dim);border:1px solid var(--border);border-radius:11px;
42
79
  padding:2px 9px;line-height:1.5;white-space:nowrap}
43
80
  .chip.warn{color:var(--amber);border-color:rgba(255,215,64,.35)}
44
81
  .chip.model{color:var(--purple);border-color:rgba(179,136,255,.3);font-family:var(--mono);font-size:11.5px}
45
- .sp-reason{color:var(--dim);font-size:13px;margin:2px 0 10px}
46
- .sp-body{max-width:46rem}
82
+ .sp-body{max-width:46rem;overflow-wrap:anywhere}
47
83
  .md{color:var(--ink);font-size:15px;line-height:1.7}
48
84
  .md p{margin:0 0 10px;text-wrap:pretty}
49
85
  .md .md-h{font-family:var(--sans);font-weight:600;color:var(--purple);margin:16px 0 6px;font-size:14.5px;letter-spacing:.2px}
@@ -55,13 +91,13 @@ h2.sp-title{margin:0 0 6px;font-size:19px;color:var(--cyan)}
55
91
  .md code{font-family:var(--mono);font-size:.92em;background:var(--deep);padding:0 4px;border-radius:3px}
56
92
  .md blockquote{border-left:2px solid var(--purple);padding-left:12px;color:var(--dim);margin:0 0 10px}
57
93
  .md b{color:#e8eef5;font-weight:600}
58
- .sp-once{margin:0 0 14px}
94
+ .sp-once{margin:0}
59
95
 
60
96
  /* ── its history: a line of dots ── */
61
- .tl{overflow-x:auto;margin:0 0 8px;padding-bottom:2px}
97
+ .tl{overflow-x:auto;margin:0 -6px;padding-bottom:2px}
62
98
  .tl-track{display:inline-flex;gap:0;position:relative;min-width:min-content}
63
- .tl-track::before{content:"";position:absolute;left:44px;right:44px;top:15px;height:1px;background:var(--glow)}
64
- .tl-step{position:relative;flex:0 0 auto;min-width:88px;min-height:56px;padding:8px 6px 6px;background:none;border:none;
99
+ .tl-track::before{content:"";position:absolute;left:36px;right:36px;top:15px;height:1px;background:var(--glow)}
100
+ .tl-step{position:relative;flex:0 0 auto;min-width:72px;min-height:56px;padding:8px 4px 6px;background:none;border:none;
65
101
  color:var(--dim);cursor:pointer;display:flex;flex-direction:column;align-items:center;gap:4px;font-family:var(--sans)}
66
102
  .tl-dot{width:13px;height:13px;border-radius:50%;background:var(--card);border:2px solid var(--glow);position:relative;z-index:1;
67
103
  transition:transform .15s}
@@ -72,16 +108,23 @@ h2.sp-title{margin:0 0 6px;font-size:19px;color:var(--cyan)}
72
108
  .tl-date{font-size:12.5px;white-space:nowrap}
73
109
  .tl-who{font-size:11.5px;color:var(--faint);white-space:nowrap}
74
110
  .tl-step.on .tl-who{color:var(--dim)}
111
+ #self-version{margin-bottom:12px}
112
+ #self-version[hidden]{display:none}
113
+ .tl-detail{min-width:0}
75
114
  .tl-vhead{display:flex;gap:10px;align-items:baseline;flex-wrap:wrap;margin-bottom:4px}
76
115
  .tl-vhead b{color:var(--cyan);font-weight:600;font-size:14px}
77
116
  .tl-meta{color:var(--dim);font-size:12.5px}
117
+ .tl-close{margin-left:auto;background:none;border:1px solid var(--border);border-radius:3px;color:var(--dim);
118
+ font-family:var(--sans);font-size:12.5px;padding:0 12px;min-height:44px;cursor:pointer}
119
+ .tl-close:hover{color:var(--cyan);border-color:var(--glow)}
78
120
  .tl-why{color:var(--ink);font-size:13.5px;margin-bottom:10px;font-style:italic}
79
- .tl-toggle{display:inline-flex;border:1px solid var(--border);border-radius:4px;overflow:hidden;margin:2px 0 10px}
121
+ .tl-toggle{display:inline-flex;border:1px solid var(--border);border-radius:4px;overflow:hidden;margin:2px 0 10px;max-width:100%}
80
122
  .tl-toggle .seg{background:none;border:none;color:var(--dim);padding:7px 12px;font-family:var(--sans);font-size:12.5px;cursor:pointer;min-height:44px}
81
123
  .tl-toggle .seg+.seg{border-left:1px solid var(--border)}
82
124
  .tl-toggle .seg.on{background:rgba(0,229,255,.1);color:var(--cyan)}
83
125
  .diff{font-size:13.5px;line-height:1.65;border:1px solid var(--border);border-radius:4px;background:var(--deep);padding:6px 0;margin-top:6px}
84
126
  .d-line{display:flex;gap:8px;padding:1px 12px 1px 8px;white-space:pre-wrap;overflow-wrap:anywhere;color:var(--dim)}
127
+ .d-line>span:last-child{min-width:0}
85
128
  .d-sign{flex:0 0 12px;font-family:var(--mono);color:var(--faint)}
86
129
  .d-line.add{background:rgba(0,191,165,.10);color:var(--ink)}
87
130
  .d-line.add .d-sign{color:var(--teal)}
@@ -92,39 +135,46 @@ h2.sp-title{margin:0 0 6px;font-size:19px;color:var(--cyan)}
92
135
  .d-fold{color:var(--faint);font-size:12px;padding:2px 12px 2px 28px;font-style:italic}
93
136
  .d-add{color:var(--teal)} .d-del{color:#ff8a8a}
94
137
 
95
- /* ── what it's settling into ── */
96
- .self-cols{margin-top:6px}
97
- .st-sum{display:flex;flex-wrap:wrap;gap:6px 16px;font-size:13.5px;color:var(--ink);margin-bottom:10px}
98
- .st-sum span::before{content:"";display:inline-block;width:7px;height:7px;border-radius:50%;background:var(--cyan);margin-right:7px;vertical-align:1px}
99
- .st-sum span:nth-child(2)::before{background:var(--amber)}
100
- .st-sum span:nth-child(3)::before{background:var(--purple)}
138
+ /* ── settling into the core: one compact chart ── */
139
+ .self-cols{margin-top:20px}
140
+ .st-counts{display:flex;flex-wrap:wrap;align-items:center;gap:0 2px;margin:-6px 0 4px}
141
+ .st-count{background:none;border:none;color:var(--ink);font-family:var(--sans);font-size:13.5px;padding:0 6px;min-height:44px;
142
+ cursor:pointer;border-radius:4px}
143
+ .st-count::before{content:"";display:inline-block;width:7px;height:7px;border-radius:50%;background:var(--cyan);margin-right:7px;vertical-align:1px}
144
+ .st-count.k-guarded::before{background:var(--amber)}
145
+ .st-count.k-contested::before{background:var(--purple)}
146
+ .st-count:hover:not(:disabled){color:var(--cyan);text-decoration:underline}
147
+ .st-count.on{color:var(--cyan);background:rgba(0,229,255,.08)}
148
+ .st-count:disabled{cursor:default;color:var(--dim)}
149
+ .st-sep{color:var(--faint)}
150
+ .st-list{border:1px solid var(--border);border-radius:5px;padding:2px 10px;margin:0 0 10px}
151
+ .st-note{margin:6px 0}
101
152
  .st-warn{border:1px solid rgba(255,82,82,.45);border-radius:4px;padding:8px 12px;font-size:13px;color:var(--ink);margin-bottom:10px}
102
153
  .st-warn b{color:#ff8a8a;font-weight:500}
103
- .st-none{color:var(--dim);font-size:13px;margin:6px 0 4px}
104
- .st-none b{color:var(--amber);font-weight:400;margin-right:4px}
105
- h4.st-h{font-family:var(--sans);font-size:13.5px;font-weight:600;color:var(--ink);margin:14px 0 6px}
106
- h4.st-h small{font-weight:400;color:var(--dim);font-size:12px}
154
+ h4.st-h{font-family:var(--sans);font-size:13.5px;font-weight:600;color:var(--ink);margin:10px 0 6px}
107
155
  .st-row{display:flex;align-items:center;gap:10px;width:100%;text-align:left;background:none;border:none;
108
156
  border-top:1px solid var(--border);padding:9px 2px;color:var(--ink);font-family:var(--sans);font-size:13px;line-height:1.5;min-height:44px}
157
+ .st-list .st-row:first-child{border-top:none}
109
158
  .st-row.click,.st-story{cursor:pointer}
110
159
  .st-row:hover{background:var(--hover)}
111
160
  .st-text{flex:1;min-width:0}
112
161
  .st-about{display:block;color:var(--faint);font-size:12px}
113
- .st-group .extra{display:none}
114
- .st-group.all .extra{display:flex}
115
- .st-more{background:none;border:none;color:var(--cyan);font-family:var(--sans);font-size:12.5px;cursor:pointer;padding:8px 2px;min-height:44px}
116
162
  .st-bar{flex:0 0 70px;height:6px;background:var(--deep);border:1px solid var(--border);border-radius:3px;overflow:hidden}
117
163
  .st-bar span{display:block;height:100%;background:var(--purple)}
118
164
  .st-tag{flex:0 0 auto;font-size:11.5px;border-radius:10px;padding:1px 8px}
119
165
  .st-tag.changed{color:var(--amber);border:1px solid rgba(255,215,64,.35)}
120
166
 
121
- .cand{border:1px solid var(--border);border-radius:5px;padding:10px 12px;margin-bottom:8px;cursor:pointer;background:rgba(6,10,16,.5)}
122
- .cand:hover{border-color:var(--glow);box-shadow:var(--hovershadow)}
123
- .cand.ready{border-color:rgba(0,229,255,.45)}
124
- .cand-text{font-size:13.5px;line-height:1.5;color:var(--ink);margin-bottom:8px}
125
- .cand-meters{display:grid;grid-template-columns:auto 1fr auto auto;gap:6px 10px;align-items:center}
126
- .cm-lab{font-size:12px;color:var(--dim)}
127
- .cm-track{position:relative;height:8px;background:var(--deep);border:1px solid var(--border);border-radius:4px;min-width:80px}
167
+ .cr-head,.cr{display:grid;grid-template-columns:minmax(0,1fr) minmax(90px,36%) auto;gap:4px 12px;align-items:center}
168
+ .cr-head{font-size:12px;color:var(--dim);padding:0 8px 2px}
169
+ .cr-list{display:flex;flex-direction:column}
170
+ .cr{width:100%;text-align:left;background:none;border:none;border-top:1px solid var(--border);padding:6px 8px;min-height:44px;
171
+ color:var(--ink);font-family:var(--sans);font-size:13px;cursor:pointer}
172
+ .cr:first-child{border-top:none}
173
+ .cr:hover{background:var(--hover)}
174
+ .cr-name{white-space:nowrap;overflow:hidden;text-overflow:ellipsis;min-width:0}
175
+ .cr-ready{display:inline-block;font-size:11.5px;color:var(--cyan);border:1px solid rgba(0,229,255,.45);border-radius:10px;
176
+ padding:0 7px;margin-right:6px;line-height:1.5}
177
+ .cm-track{position:relative;height:8px;background:var(--deep);border:1px solid var(--border);border-radius:4px;min-width:0}
128
178
  .cm-fill{position:absolute;left:0;top:0;bottom:0;background:var(--purple);border-radius:3px}
129
179
  .cm-fill.ok{background:var(--teal)}
130
180
  .cm-ghost{position:absolute;top:0;bottom:0;background:repeating-linear-gradient(90deg,rgba(179,136,255,.45) 0 3px,transparent 3px 6px)}
@@ -132,14 +182,12 @@ h4.st-h small{font-weight:400;color:var(--dim);font-size:12px}
132
182
  .cm-dots{display:flex;gap:5px}
133
183
  .cm-dots .dd{width:11px;height:11px;border-radius:50%;border:1.5px solid var(--glow);background:transparent}
134
184
  .cm-dots .dd.on{background:var(--cyan);border-color:var(--cyan)}
135
- .cand-status{font-size:12px;color:var(--dim);margin-top:7px}
136
- .cand.ready .cand-status{color:var(--cyan)}
137
185
 
138
186
  /* ── the wake, folded ── */
139
187
  .wk-sum{display:flex;justify-content:space-between;align-items:baseline;gap:10px;width:100%;background:none;border:none;
140
- padding:0 0 8px;cursor:pointer;color:var(--ink);font-family:var(--sans);text-align:left;min-height:44px}
141
- .wk-line{font-size:14.5px;color:var(--dim)}
142
- .wk-line b{font-family:var(--mono);font-size:20px;color:var(--cyan);font-weight:700;margin-right:2px}
188
+ padding:0 0 6px;cursor:pointer;color:var(--ink);font-family:var(--sans);text-align:left;min-height:44px}
189
+ .wk-line{font-size:13.5px;color:var(--dim)}
190
+ .wk-line b{font-family:var(--mono);font-size:19px;color:var(--cyan);font-weight:700;margin:0 1px}
143
191
  .wk-open{font-size:12.5px;color:var(--cyan);white-space:nowrap}
144
192
  .wk-sum:hover .wk-open{text-decoration:underline}
145
193
  .wk-bar{display:flex;height:14px;border-radius:4px;overflow:hidden;background:var(--deep);border:1px solid var(--border)}
@@ -148,35 +196,47 @@ h4.st-h small{font-weight:400;color:var(--dim);font-size:12px}
148
196
  .p-furn{background:#3a4552}.p-page{background:var(--cyan)}.p-craft{background:var(--purple)}
149
197
  .p-threads{background:var(--amber)}.p-hints{background:var(--teal)}.p-horizon{background:#ff8a80}
150
198
  .p-room{background:transparent;border:1px dashed var(--glow)}
151
- .wk-legend{display:flex;flex-wrap:wrap;gap:4px 14px;margin:8px 0 2px;font-size:12.5px;color:var(--dim)}
199
+ .wk-legend{display:flex;flex-wrap:wrap;gap:4px 12px;margin:8px 0 2px;font-size:12.5px;color:var(--dim)}
152
200
  .wk-key i{display:inline-block;width:9px;height:9px;border-radius:2px;margin-right:6px;vertical-align:0}
153
201
  .wk-key em{font-style:normal;color:var(--faint);font-family:var(--mono);font-size:11.5px;margin-left:2px}
154
202
  .wk-full{margin-top:12px;border-top:1px solid var(--border);padding-top:12px}
155
- .wk-act{margin:10px 0 0}
156
- .wk-act .act-btn{min-height:44px;padding:8px 14px;font-family:var(--sans);font-size:13px;color:var(--cyan);border-color:var(--glow)}
157
- .wk-act .act-out{margin-top:8px}
203
+ .wk-act{margin:10px 0 0;display:flex;flex-wrap:wrap;align-items:center;gap:6px 10px}
204
+ .wk-act .act-btn{min-height:44px;padding:8px 14px;font-family:var(--sans);font-size:13px}
205
+ .wk-act .act-btn:disabled{cursor:not-allowed;opacity:.75;color:var(--dim);border-color:var(--border)}
206
+ .soon{font-size:12px;color:var(--dim);border:1px dashed var(--glow);border-radius:10px;padding:1px 9px}
207
+ .wk-act>div{flex:1 0 100%}
158
208
 
159
- /* ── the journal ── */
160
- .jd{margin-bottom:14px}
161
- .jd-h{display:flex;gap:10px;align-items:baseline;margin:0 0 6px;font-size:13.5px;color:var(--ink)}
162
- .jd-h b{font-weight:600}
163
- .jd-h span{color:var(--faint);font-size:12px}
164
- .jc{border:1px solid var(--border);border-radius:5px;background:var(--card);margin-bottom:6px}
165
- .jc summary{list-style:none;cursor:pointer;padding:10px 14px;display:block;min-height:44px}
166
- .jc summary::-webkit-details-marker{display:none}
167
- .jc summary:hover{background:var(--hover)}
168
- .jc[open] summary{border-bottom:1px solid var(--border)}
169
- .jc-top{display:flex;gap:8px;align-items:center;flex-wrap:wrap}
170
- .jc-title{color:var(--cyan);font-size:14px;font-weight:500}
171
- .jc-first{display:block;color:var(--dim);font-size:13px;margin-top:3px;line-height:1.5}
172
- .jc[open] .jc-first{display:none}
173
- .jc-body{padding:12px 16px}
209
+ /* ── the journal: a strip of days ── */
210
+ .jd-strip{display:flex;gap:6px;overflow-x:auto;padding:2px 2px 6px;margin:0 0 8px}
211
+ .jd-day{flex:0 0 auto;display:flex;flex-direction:column;align-items:flex-start;gap:2px;min-width:68px;min-height:44px;
212
+ padding:6px 10px;background:var(--card);border:1px solid var(--border);border-radius:5px;color:var(--ink);
213
+ font-family:var(--sans);cursor:pointer;text-align:left}
214
+ .jd-day b{font-size:13px;font-weight:600;white-space:nowrap}
215
+ .jd-lived{font-size:11.5px;color:var(--dim);white-space:nowrap}
216
+ .jd-day:hover{border-color:var(--glow)}
217
+ .jd-day.on{border-color:var(--cyan);background:rgba(0,229,255,.08)}
218
+ .jd-day.on b{color:var(--cyan)}
219
+ .jd-dots{display:flex;gap:3px;margin-top:2px}
220
+ .jd-dots i{width:6px;height:6px;border-radius:50%;background:var(--purple)}
221
+ .jd-n{font-family:var(--mono);font-size:12px;color:var(--purple)}
222
+ .jd-head{display:flex;gap:10px;align-items:baseline;margin:4px 0 6px;font-size:13.5px;color:var(--ink)}
223
+ .jd-head b{font-weight:600}
224
+ .jd-head span{color:var(--dim);font-size:12px}
225
+ .jc{border:1px solid var(--border);border-radius:5px;background:var(--card);margin-bottom:6px;min-width:0}
226
+ .jc-top{display:flex;gap:8px;align-items:center;flex-wrap:wrap;width:100%;background:none;border:none;text-align:left;
227
+ padding:10px 14px;min-height:44px;cursor:pointer;font-family:var(--sans)}
228
+ .jc-top:hover{background:var(--hover)}
229
+ .jc.open .jc-top{border-bottom:1px solid var(--border)}
230
+ .jc-title{color:var(--cyan);font-size:14px;font-weight:500;overflow-wrap:anywhere}
231
+ .jc-body{padding:12px 16px;overflow-wrap:anywhere}
174
232
  .jc-body .md{font-size:14px}
175
233
  .jc-open{min-height:44px;font-family:var(--sans);font-size:12.5px;padding:6px 12px}
176
234
 
177
235
  @media(max-width:640px){
178
236
  .sp-card{padding:16px 14px 12px}
179
237
  .md{font-size:14.5px}
180
- .cand-meters{grid-template-columns:auto 1fr}
181
- .tl-step{min-width:76px}
238
+ .cr-head{display:none}
239
+ .cr{grid-template-columns:minmax(0,1fr) auto;padding:8px 6px}
240
+ .cr .cr-name{grid-column:1/-1}
241
+ .tl-step{min-width:68px}
182
242
  }
@@ -0,0 +1,23 @@
1
+ /* What is open on the self tab, kept apart from the markup so a live refresh
2
+ can redraw a panel and leave every open thing open. Keyed by stable ids
3
+ (a version's seq, a chapter's row id + number, a lived day), never by a
4
+ position a refresh could shift. */
5
+ export const ui = {
6
+ /** The version whose what-changed view is open (its seq); null = none. */
7
+ version: null,
8
+ /** In that view: the whole version rather than the diff. */
9
+ whole: false,
10
+ /** The journal day picked (its lived day); null = follow the newest. */
11
+ day: null,
12
+ /** Expanded chapters, as `<row id>:<chapter number>`. */
13
+ chapters: new Set(),
14
+ /** Open `?` tips, by name. */
15
+ tips: new Set(),
16
+ /** The wake's full text is showing. */
17
+ wake: false,
18
+ /** Which count's list is open above the chart: "core" | "guarded" | "contested" | null. */
19
+ count: null,
20
+ };
21
+
22
+ /** A chapter's key in `ui.chapters`. */
23
+ export const chapterKey = (c) => c.id + ":" + c.chapter;
@@ -0,0 +1,50 @@
1
+ /* The small `?` that holds the explaining words, out of the reading path:
2
+ hover floats them on a pointer that can hover; a tap (or a click, or Enter)
3
+ pins them open in the flow under their line, and a second one closes them.
4
+ What is pinned is kept in `ui.tips`, so a live refresh draws it open again. */
5
+ import { esc } from "../../shared/dom.js";
6
+ import { ui } from "./state.js";
7
+
8
+ /** The markup for one tip: a `?` button and its words beside it. */
9
+ export function q(key, text) {
10
+ const open = ui.tips.has(key);
11
+ return '<span class="q-wrap' + (open ? " open" : "") + '" data-tip="' + esc(key) + '">' +
12
+ '<button type="button" class="q" aria-expanded="' + open + '" aria-label="What this means">?</button>' +
13
+ '<span class="q-pop" role="note">' + esc(text) + "</span></span>";
14
+ }
15
+
16
+ /** Keep an open tip inside the window: shift it left when it would run past
17
+ * the right edge (a phone is where that happens). */
18
+ function clamp(wrap) {
19
+ const pop = wrap.querySelector(".q-pop");
20
+ if (!pop) return;
21
+ pop.style.left = "";
22
+ // A pinned tip sits in the flow and needs no help; only the floating one can
23
+ // run past the edge.
24
+ if (getComputedStyle(pop).position !== "absolute") return;
25
+ const r = pop.getBoundingClientRect();
26
+ if (r.width === 0) return;
27
+ const room = document.documentElement.clientWidth - 12;
28
+ if (r.right > room) pop.style.left = Math.round(-(r.right - room)) + "px";
29
+ const r2 = pop.getBoundingClientRect();
30
+ if (r2.left < 12) pop.style.left = Math.round(parseFloat(pop.style.left || "0") + (12 - r2.left)) + "px";
31
+ }
32
+
33
+ /** Wire every tip under `root`. Safe to call after each repaint. */
34
+ export function wireTips(root) {
35
+ root.querySelectorAll(".q-wrap").forEach((wrap) => {
36
+ const key = wrap.dataset.tip;
37
+ const btn = wrap.querySelector(".q");
38
+ btn.addEventListener("click", (e) => {
39
+ e.stopPropagation();
40
+ e.preventDefault();
41
+ const open = !ui.tips.has(key);
42
+ if (open) ui.tips.add(key); else ui.tips.delete(key);
43
+ wrap.classList.toggle("open", open);
44
+ btn.setAttribute("aria-expanded", String(open));
45
+ if (open) clamp(wrap);
46
+ });
47
+ wrap.addEventListener("mouseenter", () => clamp(wrap));
48
+ if (ui.tips.has(key)) clamp(wrap);
49
+ });
50
+ }
@@ -42,6 +42,15 @@ export async function openMemory(id) {
42
42
  " · emotional " + n2(s.emotional) + " · predictive " + n2(s.predictive) +
43
43
  (s.novelty === null ? " · <span style='color:var(--amber)'>novelty blind (no schema context existed)</span>" : " · novelty " + n2(s.novelty)) +
44
44
  (s.claimed === null ? "" : " · claimed floor " + n2(s.claimed)) + "</span>") +
45
+ kv("feelings", d.confidential
46
+ ? "<span class='withheld'>withheld with the words</span>"
47
+ : d.feelings
48
+ ? esc(d.feelings) + " <span style='color:var(--faint)'>· intensity " + n2(d.intensity) +
49
+ " — holds it higher and slows its fading</span>"
50
+ : d.intensity > 0
51
+ ? "<span style='color:var(--dim)'>none recorded</span> <span style='color:var(--faint)'>· emotional score " + n2(d.intensity) +
52
+ " holds it higher and slows its fading</span>"
53
+ : "<span style='color:var(--dim)'>(none recorded)</span>") +
45
54
  kv("lived", "born day " + d.bornDay + " · used " + d.uses + "× over " + d.reinforcedDays +
46
55
  " separate days · last used day " + d.lastUsedDay) +
47
56
  kv("recorded", esc(d.learnedOn) + (d.happenedOn ? " · happened " + esc(d.happenedOn) : "") +
@@ -20,7 +20,7 @@
20
20
  * else. Rules 1–4 of `views.ts` apply; no row text is emitted, only counts and
21
21
  * event `seq`s the page can open with `/api/event`.
22
22
  */
23
- import type { EventRow } from "../../../../core/store/index.js";
23
+ import type { EventRow, ReadOnlyStore } from "../../../../core/store/index.js";
24
24
  import type { DurableEventName } from "../../registries.js";
25
25
  import type { DashboardSource } from "../../source.js";
26
26
 
@@ -60,8 +60,28 @@ interface MechanismProof {
60
60
  readonly built: boolean;
61
61
  /** Empty when not built. */
62
62
  readonly proofs: readonly Proof[];
63
+ /**
64
+ * A mechanism whose firing is ARITHMETIC ON A ROW rather than an event (the
65
+ * emotion lift): a count of rows it acted on inside the window, read from the
66
+ * store directly. The one read here that is not `eventLog`; it is still a
67
+ * read, and still counts only. It backs no event seq.
68
+ */
69
+ readonly census?: (store: ReadOnlyStore, fromDay: number) => { count: number; says: readonly [string, string] };
63
70
  /** For a grey light: the one plain line it shows instead of evidence. */
64
71
  readonly grey?: string;
72
+ /**
73
+ * WHAT THE MECHANISM IS HOLDING, when that is part of whether it can fire at
74
+ * all (2026-09-26, prospective: dated memories). Counted from the store, said
75
+ * after the evidence; and when it is ZERO and nothing fired, the light is
76
+ * grey with `none` — there is truly nothing for the mechanism to do.
77
+ */
78
+ readonly held?: {
79
+ readonly count: (store: ReadOnlyStore) => number;
80
+ readonly says: readonly [string, string];
81
+ readonly none: string;
82
+ };
83
+ /** Also say how many of the window's firings landed TODAY (this lived day). */
84
+ readonly today?: boolean;
65
85
  }
66
86
 
67
87
  const num = (v: unknown): number => (typeof v === "number" && Number.isFinite(v) ? v : 0);
@@ -83,14 +103,21 @@ export const MECHANISM_PROOFS: readonly MechanismProof[] = [
83
103
  ],
84
104
  },
85
105
  {
86
- // The quoted feeling is stored as a label with no weight, the classifier
87
- // ships off, and the numeric emotional score rides the salience columns —
88
- // there is no row that could say "feeling changed this memory".
106
+ // Emotion part A (2026-09-26): a memory's strongest feeling (or its
107
+ // `emotional` score) lifts it and slows its fading, and a recorded mood
108
+ // lifts matching memories in recall. The lift has no event of its own — it
109
+ // is arithmetic on the row — so it is counted by a census of the rows
110
+ // born inside the window; the mood-match is a count on the turn's row.
89
111
  id: "emotional",
90
112
  family: "encoding",
91
- built: false,
92
- proofs: [],
93
- grey: "In development: a feeling is stored as a label but does not yet weigh anything.",
113
+ built: true,
114
+ proofs: [
115
+ { event: "recall.decision", sum: "moodMatched", says: ["memory a matching mood brought closer", "memories a matching mood brought closer"] },
116
+ ],
117
+ census: (store, fromDay) => {
118
+ const c = store.emotionCensus({ sinceDay: fromDay });
119
+ return { count: c.weighted, says: ["new memory held higher and fading slower for the feeling it carries", "new memories held higher and fading slower for the feeling they carry"] };
120
+ },
94
121
  },
95
122
  // ── Storage ──
96
123
  {
@@ -141,13 +168,23 @@ export const MECHANISM_PROOFS: readonly MechanismProof[] = [
141
168
  proofs: [{ event: "associate.flush", sum: "rows", says: ["link written", "links written"] }],
142
169
  },
143
170
  {
144
- // `prospective.fire` exists and only the demo seeder calls `fire()`: no
145
- // live path spends the budget, so the rows prove nothing about real use.
171
+ // Built end to end since 2026-09-26: `note` / `session_end` take a date; a
172
+ // QUIET one comes back as a footnote cue and spends a fire when it surfaces
173
+ // (`Counterpart#spendArrivals`), a PLAIN one is said on its day. Grey only
174
+ // when nothing is dated at all (`held` below).
146
175
  id: "prospective",
147
176
  family: "retrieval",
148
- built: false,
149
- proofs: [],
150
- grey: "In development: dated reminders can be stored, but nothing brings them back on the day yet.",
177
+ built: true,
178
+ proofs: [
179
+ { event: "prospective.plain", says: ["reminder said plainly", "reminders said plainly"] },
180
+ { event: "prospective.fire", says: ["reminder came back as a quiet footnote", "reminders came back as quiet footnotes"] },
181
+ ],
182
+ held: {
183
+ count: (store) => store.datedMemories("0001-01-01", "9999-12-31").length,
184
+ says: ["dated memory held", "dated memories held"],
185
+ none: "Nothing dated yet: a note or a memory given a date comes back around that day.",
186
+ },
187
+ today: true,
151
188
  },
152
189
  // ── Transformation ──
153
190
  {
@@ -260,6 +297,7 @@ export function mechanismsView(src: DashboardSource): MechanismsView {
260
297
  }
261
298
  const parts: string[] = [];
262
299
  const backing: EventRow[] = [];
300
+ let today = 0;
263
301
  for (const proof of m.proofs) {
264
302
  let total = 0;
265
303
  for (const row of rowsFor(proof.event)) {
@@ -267,16 +305,49 @@ export function mechanismsView(src: DashboardSource): MechanismsView {
267
305
  if (n > 0) {
268
306
  total += n;
269
307
  backing.push(row);
308
+ if (row.day === livedDay) today += n;
270
309
  }
271
310
  }
272
311
  if (total > 0) parts.push(`${total} ${total === 1 ? proof.says[0] : proof.says[1]}`);
273
312
  }
313
+ if (m.census !== undefined) {
314
+ let c = { count: 0, says: ["", ""] as readonly [string, string] };
315
+ try {
316
+ c = m.census(store, fromDay);
317
+ } catch {
318
+ // A store that cannot answer the census simply has no census line.
319
+ }
320
+ if (c.count > 0) parts.push(`${c.count} ${c.count === 1 ? c.says[0] : c.says[1]}`);
321
+ }
322
+ // What it holds, read once and only for a row that declares it. A store
323
+ // that will not answer reads as "unknown", never as zero — zero turns the
324
+ // light grey, and a failed read is not evidence of nothing.
325
+ let held: number | null = null;
326
+ if (m.held !== undefined) {
327
+ try {
328
+ held = m.held.count(store);
329
+ } catch {
330
+ held = null;
331
+ }
332
+ }
333
+ const heldLine =
334
+ m.held === undefined || held === null ? "" : ` ${held} ${held === 1 ? m.held.says[0] : m.held.says[1]}.`;
274
335
  if (parts.length > 0) {
275
336
  const events = backing
276
337
  .sort((a, b) => b.seq - a.seq)
277
338
  .slice(0, RECENT_IDS)
278
339
  .map((r) => r.seq);
279
- return { id: m.id, family: m.family, status: "green", evidence: `${parts.join(", ")} in the last ${MECHANISM_DAYS} lived days.`, events };
340
+ const todayLine = m.today === true ? ` ${today} today.` : "";
341
+ return {
342
+ id: m.id,
343
+ family: m.family,
344
+ status: "green",
345
+ evidence: `${parts.join(", ")} in the last ${MECHANISM_DAYS} lived days.${todayLine}${heldLine}`,
346
+ events,
347
+ };
348
+ }
349
+ if (m.held !== undefined && held === 0) {
350
+ return { id: m.id, family: m.family, status: "grey", evidence: m.held.none, events: [] };
280
351
  }
281
352
  // Built, and nothing inside the window: when was it last seen at all? Only
282
353
  // the newest LOOKBACK rows of each name are searched, so a name with that
@@ -295,7 +366,7 @@ export function mechanismsView(src: DashboardSource): MechanismsView {
295
366
  lastDay === null
296
367
  ? `Built, and no record of it firing yet.`
297
368
  : `Built, but quiet for ${MECHANISM_DAYS} lived days (last fired on lived day ${lastDay}).`;
298
- return { id: m.id, family: m.family, status: "amber", evidence, events: [] };
369
+ return { id: m.id, family: m.family, status: "amber", evidence: `${evidence}${heldLine}`, events: [] };
299
370
  });
300
371
 
301
372
  return { livedDay, fromDay, days: MECHANISM_DAYS, mechanisms, truncated };
@@ -4,7 +4,8 @@
4
4
  * Split out of `web/views.ts`, which re-exports every public name from here;
5
5
  * the four rules in that file's header apply to every line below.
6
6
  */
7
- import { band, rep, sal, strength } from "../../../../core/physics/index.js";
7
+ import { band, emotionalIntensity, rep, sal, strength } from "../../../../core/physics/index.js";
8
+ import { feelingsLine } from "../../../feelings-line.js";
8
9
  import { isJournal } from "../../../../core/sleep/index.js";
9
10
  import type { Band, Kind } from "../../../../core/types.js";
10
11
  import type { DashboardSource } from "../../source.js";
@@ -66,6 +67,15 @@ export interface MemoryDetail {
66
67
  readonly points: { role: string; id: string; text: string }[];
67
68
  readonly versions: { seq: number; reason: string; day: number; became: string }[];
68
69
  readonly prospective: { date: string; state: string; fires: number; precision: string }[];
70
+ /**
71
+ * The feelings recorded on it, as one line — `you: worried 0.6 (now 0.3) ·
72
+ * me: tender 0.4` (`adapters/feelings-line.ts`) — or "" when it has none.
73
+ * Withheld with the body on a confidential memory: a feeling word about a
74
+ * sensitive thing says something about the thing.
75
+ */
76
+ readonly feelings: string;
77
+ /** The emotional intensity physics reads (physics §5.10): 0 when unfelt. */
78
+ readonly intensity: number;
69
79
  readonly absence: string | null;
70
80
  }
71
81
 
@@ -107,6 +117,8 @@ export function memoryDetail(src: DashboardSource, id: string): MemoryDetail {
107
117
  points: [],
108
118
  versions: [],
109
119
  prospective: [],
120
+ feelings: "",
121
+ intensity: 0,
110
122
  absence: r.label,
111
123
  } satisfies MemoryDetail;
112
124
 
@@ -197,6 +209,8 @@ export function memoryDetail(src: DashboardSource, id: string): MemoryDetail {
197
209
  fires: p.fires,
198
210
  precision: p.precision,
199
211
  })),
212
+ feelings: g.confidential ? "" : feelingsLine(store.feelingsFor(headId), day - physics.birthDay),
213
+ intensity: emotionalIntensity(physics),
200
214
  absence: null,
201
215
  };
202
216
  }