counterparts 0.3.2 → 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.
- package/CHANGELOG.md +153 -0
- package/docs/module-map.md +3 -2
- package/package.json +1 -1
- package/src/adapters/claude-code/NOTES.md +28 -0
- package/src/adapters/claude-code/bin/hook.ts +85 -22
- package/src/adapters/claude-code/config.ts +7 -0
- package/src/adapters/claude-code/doctor.ts +166 -4
- package/src/adapters/claude-code/hooks.ts +185 -6
- package/src/adapters/claude-code/index.ts +3 -0
- package/src/adapters/claude-code/transcript.ts +7 -0
- package/src/adapters/cli/CONTRACT.md +11 -0
- package/src/adapters/cli/INTERFACE-GAPS.md +16 -0
- package/src/adapters/cli/NOTES.md +25 -0
- package/src/adapters/cli/commands.ts +184 -4
- package/src/adapters/cli/dream-core.ts +126 -0
- package/src/adapters/cli/help.ts +17 -0
- package/src/adapters/cli/mechanisms.ts +199 -106
- package/src/adapters/dashboard/CONTRACT.md +5 -0
- package/src/adapters/dashboard/INTERFACE-GAPS.md +12 -0
- package/src/adapters/dashboard/NOTES.md +38 -0
- package/src/adapters/dashboard/registries.ts +35 -1
- package/src/adapters/dashboard/web/README.md +63 -26
- package/src/adapters/dashboard/web/app.html +2 -0
- package/src/adapters/dashboard/web/flow.ts +14 -0
- package/src/adapters/dashboard/web/lanes.ts +141 -0
- package/src/adapters/dashboard/web/mechanisms/association/index.js +1 -2
- package/src/adapters/dashboard/web/mechanisms/consolidation/index.js +8 -5
- package/src/adapters/dashboard/web/mechanisms/consolidation/panel.js +7 -7
- package/src/adapters/dashboard/web/mechanisms/decay/index.js +1 -2
- package/src/adapters/dashboard/web/mechanisms/dreaming/index.js +19 -0
- package/src/adapters/dashboard/web/mechanisms/emotional/index.js +9 -6
- package/src/adapters/dashboard/web/mechanisms/episodic-semantic/index.js +4 -5
- package/src/adapters/dashboard/web/mechanisms/index.js +5 -3
- package/src/adapters/dashboard/web/mechanisms/interference/index.js +1 -2
- package/src/adapters/dashboard/web/mechanisms/prospective/index.js +7 -5
- package/src/adapters/dashboard/web/mechanisms/reconsolidation/index.js +1 -2
- package/src/adapters/dashboard/web/mechanisms/regions.js +1 -1
- package/src/adapters/dashboard/web/mechanisms/retrieval/index.js +1 -2
- package/src/adapters/dashboard/web/mechanisms/salience/index.js +1 -2
- package/src/adapters/dashboard/web/mechanisms/schema/index.js +1 -2
- package/src/adapters/dashboard/web/narrate.ts +76 -13
- package/src/adapters/dashboard/web/pages/health/sections/checks.js +17 -1
- package/src/adapters/dashboard/web/pages/home/home.css +29 -13
- package/src/adapters/dashboard/web/pages/home/index.js +2 -0
- package/src/adapters/dashboard/web/pages/home/sections/explorer.js +22 -7
- package/src/adapters/dashboard/web/pages/home/sections/hero.js +15 -3
- package/src/adapters/dashboard/web/pages/home/sections/live-activity.js +15 -9
- package/src/adapters/dashboard/web/pages/home/sections/recent-chapters.js +6 -2
- package/src/adapters/dashboard/web/pages/home/sections/tiles.js +35 -18
- package/src/adapters/dashboard/web/pages/memories/index.js +30 -36
- package/src/adapters/dashboard/web/pages/memories/memories.css +97 -72
- package/src/adapters/dashboard/web/pages/memories/row.js +51 -0
- package/src/adapters/dashboard/web/pages/memories/sections/feel.js +176 -0
- package/src/adapters/dashboard/web/pages/memories/sections/hold.js +67 -0
- package/src/adapters/dashboard/web/pages/memories/sections/list.js +65 -43
- package/src/adapters/dashboard/web/pages/memories/sections/search.js +26 -23
- package/src/adapters/dashboard/web/pages/memories/state.js +12 -5
- package/src/adapters/dashboard/web/pages/self/index.js +57 -16
- package/src/adapters/dashboard/web/pages/self/sections/dreams.js +76 -0
- package/src/adapters/dashboard/web/pages/self/sections/journal.js +75 -19
- package/src/adapters/dashboard/web/pages/self/sections/page.js +108 -65
- package/src/adapters/dashboard/web/pages/self/sections/settling.js +129 -104
- package/src/adapters/dashboard/web/pages/self/sections/wake.js +31 -15
- package/src/adapters/dashboard/web/pages/self/self.css +122 -59
- package/src/adapters/dashboard/web/pages/self/state.js +21 -0
- package/src/adapters/dashboard/web/server.ts +9 -0
- package/src/adapters/dashboard/web/shared/memory-marks.css +17 -0
- package/src/adapters/dashboard/web/shared/memory-marks.js +81 -0
- package/src/adapters/dashboard/web/shared/memory-modal.js +240 -53
- package/src/adapters/dashboard/web/shared/modal.css +67 -0
- package/src/adapters/dashboard/web/shared/tip.js +1 -1
- package/src/adapters/dashboard/web/shared/widgets/feed.css +4 -0
- package/src/adapters/dashboard/web/shared/widgets/feed.js +56 -14
- package/src/adapters/dashboard/web/shared/widgets/light.css +1 -0
- package/src/adapters/dashboard/web/shared/widgets/light.js +7 -5
- package/src/adapters/dashboard/web/shared/widgets/tips.css +19 -0
- package/src/adapters/dashboard/web/shared/widgets/tips.js +56 -0
- package/src/adapters/dashboard/web/views/activity.ts +18 -2
- package/src/adapters/dashboard/web/views/archive-words.ts +27 -10
- package/src/adapters/dashboard/web/views/dreams.ts +199 -0
- package/src/adapters/dashboard/web/views/mechanism-panel.ts +116 -35
- package/src/adapters/dashboard/web/views/mechanisms.ts +81 -255
- package/src/adapters/dashboard/web/views/memories.ts +245 -43
- package/src/adapters/dashboard/web/views/memory-words.ts +133 -0
- package/src/adapters/dashboard/web/views/memory.ts +226 -4
- package/src/adapters/dashboard/web/views/mind.ts +261 -61
- package/src/adapters/dashboard/web/views/overview.ts +80 -42
- package/src/adapters/dashboard/web/views/search.ts +35 -1
- package/src/adapters/dashboard/web/views/shared.ts +14 -0
- package/src/adapters/dashboard/web/views.ts +2 -0
- package/src/adapters/feelings-line.ts +74 -0
- package/src/adapters/fired.ts +163 -23
- package/src/adapters/mcp/CONTRACT.md +8 -0
- package/src/adapters/mcp/NOTES.md +56 -0
- package/src/adapters/mcp/server.ts +254 -6
- package/src/adapters/mcp/tools.ts +180 -5
- package/src/adapters/mechanism-evidence.ts +465 -0
- package/src/core/bridge.ts +21 -16
- package/src/core/counterpart.ts +422 -10
- package/src/core/dream/CONTRACT.md +143 -0
- package/src/core/dream/INTERFACE-GAPS.md +24 -0
- package/src/core/dream/NOTES.md +84 -0
- package/src/core/dream/index.ts +1067 -0
- package/src/core/dream/mark.ts +14 -0
- package/src/core/dream/tunables.ts +56 -0
- package/src/core/encode/CONTRACT.md +7 -1
- package/src/core/feelings-wheel.ts +171 -13
- package/src/core/mint.ts +9 -0
- package/src/core/physics/CONTRACT.md +132 -21
- package/src/core/physics/NOTES.md +233 -0
- package/src/core/physics/index.ts +419 -50
- package/src/core/prospective/CONTRACT.md +35 -6
- package/src/core/prospective/INTERFACE-GAPS.md +10 -5
- package/src/core/prospective/NOTES.md +175 -4
- package/src/core/prospective/derive.ts +32 -3
- package/src/core/prospective/index.ts +362 -39
- package/src/core/prospective/tunables.ts +18 -1
- package/src/core/prospective/windows.ts +104 -46
- package/src/core/recall/CONTRACT.md +28 -0
- package/src/core/recall/NOTES.md +55 -0
- package/src/core/recall/activate.ts +32 -5
- package/src/core/recall/gate.ts +7 -1
- package/src/core/recall/index.ts +28 -2
- package/src/core/recall/mood.ts +106 -0
- package/src/core/recall/tunables.ts +26 -0
- package/src/core/remember/CONTRACT.md +5 -0
- package/src/core/remember/index.ts +1 -0
- package/src/core/remember/proposals.ts +86 -3
- package/src/core/remember/spans.ts +11 -1
- package/src/core/self/CONTRACT.md +3 -0
- package/src/core/self/INTERFACE-GAPS.md +7 -0
- package/src/core/self/NOTES.md +30 -0
- package/src/core/self/identity.ts +115 -6
- package/src/core/self/index.ts +17 -0
- package/src/core/self/tunables.ts +17 -0
- package/src/core/sleep/CONTRACT.md +17 -1
- package/src/core/sleep/INTERFACE-GAPS.md +19 -0
- package/src/core/sleep/NOTES.md +36 -0
- package/src/core/sleep/consolidate.ts +149 -96
- package/src/core/sleep/decay.ts +11 -0
- package/src/core/sleep/index.ts +4 -1
- package/src/core/sleep/tunables.ts +9 -0
- package/src/core/sleep/types.ts +17 -0
- package/src/core/sleep/upgrade.ts +168 -0
- package/src/core/store/CONTRACT.md +21 -2
- package/src/core/store/NOTES.md +68 -0
- package/src/core/store/feelings.ts +23 -6
- package/src/core/store/index.ts +716 -17
- package/src/core/store/operational.ts +329 -4
- package/src/core/store/owner-op-seam.ts +79 -1
- package/src/core/types.ts +37 -0
- package/src/adapters/dashboard/web/pages/memories/sections/constellation.js +0 -178
- package/src/adapters/dashboard/web/pages/memories/sections/kinds.js +0 -42
|
@@ -4,24 +4,27 @@
|
|
|
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 { TUNABLES as PHYSICS,
|
|
7
|
+
import { TUNABLES as PHYSICS, promotionEligibility, sal } from "../../../../core/physics/index.js";
|
|
8
8
|
import { isConfidential } from "../../../../core/recall/index.js";
|
|
9
9
|
import {
|
|
10
10
|
FRAMING,
|
|
11
11
|
LANE_ORDER,
|
|
12
12
|
SELF_PAGE_REVISED_EVENT,
|
|
13
13
|
chapterModels,
|
|
14
|
+
dayBefore,
|
|
14
15
|
pageSections,
|
|
15
16
|
readChapterLead,
|
|
16
17
|
} from "../../../../core/self/index.js";
|
|
17
|
-
import type { PageVersion } from "../../../../core/self/index.js";
|
|
18
|
-
import { TUNABLES as SLEEP, isJournal } from "../../../../core/sleep/index.js";
|
|
18
|
+
import type { PageVersion, PageWriterRun, PageWriterStatus } from "../../../../core/self/index.js";
|
|
19
|
+
import { TUNABLES as SLEEP, aboutMe, isJournal, ownerNames } from "../../../../core/sleep/index.js";
|
|
19
20
|
import type { Band, Kind } from "../../../../core/types.js";
|
|
20
21
|
import { NEVER, NONE } from "../../layout.js";
|
|
21
22
|
import { localDate } from "../../../../core/time.js";
|
|
22
23
|
import type { DashboardSource } from "../../source.js";
|
|
23
24
|
import { WITHHELD, reveal } from "../reveal.js";
|
|
24
25
|
import { chapters, contestedRows, livedDays } from "./rows.js";
|
|
26
|
+
import { coreHistory, dreamsView } from "./dreams.js";
|
|
27
|
+
import type { CoreHistory, DreamsView } from "./dreams.js";
|
|
25
28
|
import type { ChapterRow, ContestedRow } from "./rows.js";
|
|
26
29
|
|
|
27
30
|
// ─────────────────────────────────────────────────────────────────────────────
|
|
@@ -92,6 +95,8 @@ export interface MindView {
|
|
|
92
95
|
readonly reason: string | null;
|
|
93
96
|
readonly version: number;
|
|
94
97
|
readonly stale: boolean;
|
|
98
|
+
/** Calendar days without a rewrite past which `stale` turns true (`self/`'s PAGE_STALE_DAYS). */
|
|
99
|
+
readonly staleAfter: number;
|
|
95
100
|
readonly core: string;
|
|
96
101
|
readonly lately: string;
|
|
97
102
|
readonly headed: boolean;
|
|
@@ -119,6 +124,42 @@ export interface MindView {
|
|
|
119
124
|
readonly journalAbsent: string | null;
|
|
120
125
|
/** Chapters past the ones sent. 0 when all of them are here. */
|
|
121
126
|
readonly journalMore: number;
|
|
127
|
+
/** What the nightly page writer did on the newest night it has a row for. */
|
|
128
|
+
readonly writer: WriterLine;
|
|
129
|
+
/**
|
|
130
|
+
* THE DREAM JOURNAL (2026-09-26): each dream with its journal and its
|
|
131
|
+
* changes. The owner's to read — a dream is not a memory and never becomes
|
|
132
|
+
* one (`views/dreams.ts`).
|
|
133
|
+
*/
|
|
134
|
+
readonly dreams: DreamsView;
|
|
135
|
+
/** `(never run)` when this store has never dreamed; null otherwise. */
|
|
136
|
+
readonly dreamsAbsent: string | null;
|
|
137
|
+
}
|
|
138
|
+
|
|
139
|
+
/**
|
|
140
|
+
* The page writer's newest night, in plain words (2026-09-26, the self tab's
|
|
141
|
+
* side column; an experiment). Read from the newest `self.page.writer.ran` row
|
|
142
|
+
* through `self/`'s own `pageWriterStatus`, so a claim whose day has passed
|
|
143
|
+
* reads the way doctor reads it, and a derived reading is worded as ours.
|
|
144
|
+
*/
|
|
145
|
+
export interface WriterLine {
|
|
146
|
+
/** False when the log holds no run at all. */
|
|
147
|
+
readonly ran: boolean;
|
|
148
|
+
/** The night's date (the day the run read), "" when none. */
|
|
149
|
+
readonly about: string;
|
|
150
|
+
readonly outcome: string | null;
|
|
151
|
+
/** True when no row says this: it is read from a claim whose day is over. */
|
|
152
|
+
readonly derived: boolean;
|
|
153
|
+
/** True when that night is last night. */
|
|
154
|
+
readonly lastNight: boolean;
|
|
155
|
+
/** "Last night", "The night of Jul 9", or "" when nothing ran. */
|
|
156
|
+
readonly when: string;
|
|
157
|
+
/** What it did, in plain words. */
|
|
158
|
+
readonly what: string;
|
|
159
|
+
/** The two together, as the page prints it. */
|
|
160
|
+
readonly line: string;
|
|
161
|
+
/** `(never run)` when the log holds no run; null otherwise. */
|
|
162
|
+
readonly absent: string | null;
|
|
122
163
|
}
|
|
123
164
|
|
|
124
165
|
/** One state of the page: an archived version, or the one standing now. */
|
|
@@ -137,21 +178,26 @@ export interface PageStep {
|
|
|
137
178
|
readonly bytes: number | null;
|
|
138
179
|
}
|
|
139
180
|
|
|
181
|
+
/**
|
|
182
|
+
* One memory about me or about us, on its way to the core (2026-09-26): how far
|
|
183
|
+
* along each lane it is. Fast: how strongly it was felt against the bar, and
|
|
184
|
+
* whether it has come back after a gap. Slow: on how many separate lived days
|
|
185
|
+
* it came back, over how many.
|
|
186
|
+
*/
|
|
140
187
|
export interface Candidate {
|
|
141
188
|
readonly id: string;
|
|
142
189
|
readonly text: string;
|
|
143
190
|
readonly confidential: boolean;
|
|
144
191
|
readonly kind: Kind;
|
|
145
|
-
|
|
146
|
-
readonly
|
|
147
|
-
readonly
|
|
148
|
-
/** True when consolidation's one-time bonus is already in `base`. */
|
|
149
|
-
readonly consolidated: boolean;
|
|
150
|
-
readonly bonus: number;
|
|
151
|
-
/** Distinct lived days a use was credited, and how many the rule needs. */
|
|
192
|
+
readonly feeling: number;
|
|
193
|
+
readonly needFeeling: number;
|
|
194
|
+
readonly returned: boolean;
|
|
152
195
|
readonly days: number;
|
|
153
196
|
readonly requiredDays: number;
|
|
154
|
-
|
|
197
|
+
readonly span: number;
|
|
198
|
+
readonly needSpan: number;
|
|
199
|
+
/** The lane that is met, when one is: the next consolidation crosses it (the nightly cap permitting). */
|
|
200
|
+
readonly lane: "fast" | "slow" | null;
|
|
155
201
|
readonly eligible: boolean;
|
|
156
202
|
}
|
|
157
203
|
|
|
@@ -175,14 +221,27 @@ export interface SettlingView {
|
|
|
175
221
|
readonly unreadable: { id: string; label: string }[];
|
|
176
222
|
/** The closest candidates, closest first. */
|
|
177
223
|
readonly candidates: Candidate[];
|
|
178
|
-
/** Memories
|
|
224
|
+
/** Memories about me or about us that have come back at least once. */
|
|
179
225
|
readonly onTheWay: number;
|
|
180
|
-
/** Memories
|
|
226
|
+
/** Memories about me or about us that have not come back yet. */
|
|
181
227
|
readonly unused: number;
|
|
182
|
-
/** Memories
|
|
228
|
+
/** Memories that are not about me or about us: the core is not for them. */
|
|
183
229
|
readonly outOfReach: number;
|
|
230
|
+
/**
|
|
231
|
+
* WHAT CROSSED LATELY (2026-09-26): the newest promotions with their lane
|
|
232
|
+
* ("became core last night"), the owner's demotions with his reason, and the
|
|
233
|
+
* memories dreams nominated. From `core_events`.
|
|
234
|
+
*/
|
|
235
|
+
readonly history: CoreHistory;
|
|
184
236
|
/** The rule, as numbers, so the page states it rather than restating it. */
|
|
185
|
-
readonly rule: {
|
|
237
|
+
readonly rule: {
|
|
238
|
+
needFeeling: number;
|
|
239
|
+
needGap: number;
|
|
240
|
+
days: number;
|
|
241
|
+
span: number;
|
|
242
|
+
everyDays: number;
|
|
243
|
+
cap: number;
|
|
244
|
+
};
|
|
186
245
|
/** Two-word absences, for each list that is empty. */
|
|
187
246
|
readonly coreAbsent: string | null;
|
|
188
247
|
readonly guardedAbsent: string | null;
|
|
@@ -253,9 +312,7 @@ export function mindView(src: DashboardSource): MindView {
|
|
|
253
312
|
const stories = storyViews(src);
|
|
254
313
|
|
|
255
314
|
return {
|
|
256
|
-
opening:
|
|
257
|
-
`Lived day ${day}. Who I am, in my own words — and, under it, how that has changed, ` +
|
|
258
|
-
"what is slowly settling into the core, what the next session will be handed, and the journal.",
|
|
315
|
+
opening: `Day ${day} · Who I am`,
|
|
259
316
|
identity,
|
|
260
317
|
identityAbsent: e.identity.length === 0 ? (everLived ? NONE : NEVER) : null,
|
|
261
318
|
guarded,
|
|
@@ -283,6 +340,7 @@ export function mindView(src: DashboardSource): MindView {
|
|
|
283
340
|
reason: page.reason,
|
|
284
341
|
version: page.version,
|
|
285
342
|
stale: src.self.pageStale(page),
|
|
343
|
+
staleAfter: src.self.tunables.PAGE_STALE_DAYS,
|
|
286
344
|
// The three the type declares, NAMED — a spread of `pageSections`
|
|
287
345
|
// also carried `preamble` into the JSON, which `tsc` cannot catch
|
|
288
346
|
// through a spread (adversarial review n2).
|
|
@@ -313,9 +371,110 @@ export function mindView(src: DashboardSource): MindView {
|
|
|
313
371
|
wakeParts: wake.ok ? wakeParts(wake.text, page !== null) : [],
|
|
314
372
|
wakeBudget: lastBudget(src),
|
|
315
373
|
...journal(src, JOURNAL_LIMIT, everLived ? NONE : NEVER),
|
|
374
|
+
writer: writerLine(src),
|
|
375
|
+
...dreamsPart(src),
|
|
316
376
|
};
|
|
317
377
|
}
|
|
318
378
|
|
|
379
|
+
/** The dream journal, and its absence line when there has never been a dream. */
|
|
380
|
+
function dreamsPart(src: DashboardSource): { dreams: DreamsView; dreamsAbsent: string | null } {
|
|
381
|
+
const dreams = dreamsView(src);
|
|
382
|
+
return { dreams, dreamsAbsent: dreams.dreams.length === 0 ? NEVER : null };
|
|
383
|
+
}
|
|
384
|
+
|
|
385
|
+
// ─────────────────────────────────────────────────────────────────────────────
|
|
386
|
+
// the page writer's last night, in plain words
|
|
387
|
+
// ─────────────────────────────────────────────────────────────────────────────
|
|
388
|
+
|
|
389
|
+
/** Why a run did not happen or did not finish, in words. A code nobody mapped
|
|
390
|
+
* keeps its own words (hyphens read as spaces) rather than being guessed at. */
|
|
391
|
+
const WRITER_REASON: Record<string, string> = {
|
|
392
|
+
watchdog: "it ran out of time",
|
|
393
|
+
"no-room": "the session had no room to ask it",
|
|
394
|
+
"scope-question": "the first-launch question took its turn",
|
|
395
|
+
off: "the writer is switched off",
|
|
396
|
+
observer: "the session was read-only",
|
|
397
|
+
"no-previous-day": "there was no earlier day to read",
|
|
398
|
+
"already-claimed": "that night was already handled",
|
|
399
|
+
"asks-spent": "it had already been asked as often as it may",
|
|
400
|
+
"no-memories": "nothing was remembered that day",
|
|
401
|
+
"not-host-mode": "it is not set to run on its own",
|
|
402
|
+
};
|
|
403
|
+
|
|
404
|
+
export function writerReason(detail: string): string {
|
|
405
|
+
const d = detail.trim();
|
|
406
|
+
if (d === "") return "no reason was recorded";
|
|
407
|
+
const known = WRITER_REASON[d];
|
|
408
|
+
if (known !== undefined) return known;
|
|
409
|
+
const exit = /^exit (\S+)$/.exec(d);
|
|
410
|
+
if (exit !== null) return `it stopped with an error (exit ${exit[1] as string})`;
|
|
411
|
+
return d.replace(/[-_]+/g, " ");
|
|
412
|
+
}
|
|
413
|
+
|
|
414
|
+
const MONTHS = ["Jan", "Feb", "Mar", "Apr", "May", "Jun", "Jul", "Aug", "Sep", "Oct", "Nov", "Dec"];
|
|
415
|
+
|
|
416
|
+
/** "2026-07-09" → "Jul 9"; anything else as it came. */
|
|
417
|
+
function shortDay(iso: string): string {
|
|
418
|
+
const m = /^(\d{4})-(\d{2})-(\d{2})$/.exec(iso);
|
|
419
|
+
if (m === null) return iso;
|
|
420
|
+
return `${MONTHS[Number(m[2]) - 1] ?? (m[2] as string)} ${Number(m[3])}`;
|
|
421
|
+
}
|
|
422
|
+
|
|
423
|
+
/** What `writerWords` reads: `pageWriterStatus`'s answer, or null when the log
|
|
424
|
+
* holds no run at all. */
|
|
425
|
+
export type WriterReading =
|
|
426
|
+
| (Pick<PageWriterStatus, "about" | "outcome" | "derived"> & { readonly run: Pick<PageWriterRun, "detail"> | null })
|
|
427
|
+
| null;
|
|
428
|
+
|
|
429
|
+
/** The words for one night. Pure, so every outcome is tested without a store. */
|
|
430
|
+
export function writerWords(status: WriterReading, yesterday: string): WriterLine {
|
|
431
|
+
if (status === null) {
|
|
432
|
+
const none = "No run recorded yet";
|
|
433
|
+
return { ran: false, about: "", outcome: null, derived: false, lastNight: false, when: "", what: none, line: none, absent: NEVER };
|
|
434
|
+
}
|
|
435
|
+
const detail = status.run?.detail ?? "";
|
|
436
|
+
let what: string;
|
|
437
|
+
switch (status.outcome) {
|
|
438
|
+
case "revised":
|
|
439
|
+
what = "rewrote it";
|
|
440
|
+
break;
|
|
441
|
+
case "nothing-to-say":
|
|
442
|
+
// A derived reading is OURS: the session was handed the day and nothing
|
|
443
|
+
// came back. It must not read as something the writer reported.
|
|
444
|
+
what = status.derived ? "was handed the day and left it as is" : "read the day and kept it as is";
|
|
445
|
+
break;
|
|
446
|
+
case "refused":
|
|
447
|
+
what = `tried, but the rewrite was turned away — ${writerReason(detail)}`;
|
|
448
|
+
break;
|
|
449
|
+
case "failed":
|
|
450
|
+
// Derived: a `started` claim still standing once its day was over.
|
|
451
|
+
what = status.derived ? "started and never finished" : `couldn't run — ${writerReason(detail)}`;
|
|
452
|
+
break;
|
|
453
|
+
case "asked":
|
|
454
|
+
what = "was asked at today's first session; no answer yet";
|
|
455
|
+
break;
|
|
456
|
+
case "started":
|
|
457
|
+
what = "is running now";
|
|
458
|
+
break;
|
|
459
|
+
default:
|
|
460
|
+
what = status.run === null ? "nothing ran, and nothing says why" : `didn't run — ${writerReason(detail)}`;
|
|
461
|
+
}
|
|
462
|
+
const lastNight = status.about !== "" && status.about === yesterday;
|
|
463
|
+
const when = lastNight ? "Last night" : status.about === "" ? "Its last run" : `The night of ${shortDay(status.about)}`;
|
|
464
|
+
return { ran: true, about: status.about, outcome: status.outcome, derived: status.derived, lastNight, when, what, line: `${when}: ${what}`, absent: null };
|
|
465
|
+
}
|
|
466
|
+
|
|
467
|
+
function writerLine(src: DashboardSource): WriterLine {
|
|
468
|
+
try {
|
|
469
|
+
const today = src.self.calendarToday();
|
|
470
|
+
const last = src.self.pageWriterRuns()[0];
|
|
471
|
+
if (last === undefined) return writerWords(null, dayBefore(today));
|
|
472
|
+
return writerWords(src.self.pageWriterStatus(last.about, today), dayBefore(today));
|
|
473
|
+
} catch {
|
|
474
|
+
return writerWords(null, "");
|
|
475
|
+
}
|
|
476
|
+
}
|
|
477
|
+
|
|
319
478
|
/** How many chapters the journal sends. The rest are counted, not dropped silently. */
|
|
320
479
|
const JOURNAL_LIMIT = 60;
|
|
321
480
|
|
|
@@ -390,18 +549,80 @@ const LOG_LIMIT = 2_000;
|
|
|
390
549
|
|
|
391
550
|
type Shaped = MindView["identity"][number];
|
|
392
551
|
|
|
552
|
+
/**
|
|
553
|
+
* One memory about me or about us on its way to the core, in physics' own
|
|
554
|
+
* terms (2026-09-26): how far along each lane it is.
|
|
555
|
+
*/
|
|
556
|
+
export interface CoreCandidate {
|
|
557
|
+
readonly id: string;
|
|
558
|
+
readonly kind: Kind;
|
|
559
|
+
/** Fast lane: how strongly it was felt, and whether it has come back after a gap. */
|
|
560
|
+
readonly feeling: number;
|
|
561
|
+
readonly returned: boolean;
|
|
562
|
+
/** Slow lane: awake returns on this many distinct lived days, over `span` of them. */
|
|
563
|
+
readonly days: number;
|
|
564
|
+
readonly span: number;
|
|
565
|
+
/** The lane that is met, when one is. */
|
|
566
|
+
readonly lane: "fast" | "slow" | null;
|
|
567
|
+
readonly eligible: boolean;
|
|
568
|
+
/** The better of the two lanes' progress, 0..2. */
|
|
569
|
+
readonly closeness: number;
|
|
570
|
+
}
|
|
571
|
+
|
|
572
|
+
/**
|
|
573
|
+
* The memories that can still reach the core, closest first, and how many never
|
|
574
|
+
* can (see `settlingView`). Shared with the home page's core tile, so "closest:
|
|
575
|
+
* 1 of 5 days" there is the head of the list the self tab draws.
|
|
576
|
+
*/
|
|
577
|
+
export function coreCandidates(src: DashboardSource, pageId: string | null): { raw: CoreCandidate[]; outOfReach: number } {
|
|
578
|
+
const store = src.store;
|
|
579
|
+
const owner = ownerNames(store);
|
|
580
|
+
const raw: CoreCandidate[] = [];
|
|
581
|
+
let outOfReach = 0;
|
|
582
|
+
for (const id of store.list({ archived: false })) {
|
|
583
|
+
const row = store.row(id);
|
|
584
|
+
if (row === undefined || isJournal(row) || row.type === "schema" || id === pageId) continue;
|
|
585
|
+
let p;
|
|
586
|
+
try {
|
|
587
|
+
p = store.physicsOf(id);
|
|
588
|
+
} catch {
|
|
589
|
+
continue;
|
|
590
|
+
}
|
|
591
|
+
if (p.promotedIdentity) continue;
|
|
592
|
+
if (!aboutMe(store, row, owner)) {
|
|
593
|
+
outOfReach += 1;
|
|
594
|
+
continue;
|
|
595
|
+
}
|
|
596
|
+
const v = promotionEligibility(p, { aboutMe: true, demoted: false });
|
|
597
|
+
const returned = v.fast.gap !== null && v.fast.gap >= v.fast.needGap;
|
|
598
|
+
const fast = Math.min(1, v.fast.intensity / v.fast.needIntensity) + (returned ? 1 : 0);
|
|
599
|
+
const slow = Math.min(1, v.slow.days / v.slow.needDays) + Math.min(1, v.slow.span / v.slow.needSpan);
|
|
600
|
+
raw.push({
|
|
601
|
+
id,
|
|
602
|
+
kind: p.kind,
|
|
603
|
+
feeling: v.fast.intensity,
|
|
604
|
+
returned,
|
|
605
|
+
days: v.slow.days,
|
|
606
|
+
span: v.slow.span,
|
|
607
|
+
lane: v.lane,
|
|
608
|
+
eligible: v.eligible,
|
|
609
|
+
closeness: Math.max(fast, slow),
|
|
610
|
+
});
|
|
611
|
+
}
|
|
612
|
+
// Closest first: the better of the two lanes' progress; ties by return days.
|
|
613
|
+
raw.sort((a, b) => b.closeness - a.closeness || b.days - a.days || (a.id < b.id ? -1 : 1));
|
|
614
|
+
return { raw, outOfReach };
|
|
615
|
+
}
|
|
616
|
+
|
|
393
617
|
/**
|
|
394
618
|
* The core as it stands, and — the part a young store needs — what is on its way.
|
|
395
619
|
*
|
|
396
620
|
* The candidates are computed with physics' OWN rule, `promotionEligibility`
|
|
397
|
-
* (
|
|
398
|
-
*
|
|
399
|
-
*
|
|
400
|
-
*
|
|
401
|
-
*
|
|
402
|
-
* 2026-09-24, Consolidation). Those are counted apart, not listed as "on their
|
|
403
|
-
* way". Schema rows (the page, the identity core, beliefs) are not memories and
|
|
404
|
-
* are left out, as are journal rows.
|
|
621
|
+
* (2026-09-26: only memories about me or about us, by the fast lane or the slow
|
|
622
|
+
* lane), and sleep's own "about me" reading; nothing here restates a
|
|
623
|
+
* threshold. Memories that are not about me or about us can never become core
|
|
624
|
+
* and are counted apart. Schema rows (the page, the identity core, beliefs)
|
|
625
|
+
* are not memories and are left out, as are journal rows.
|
|
405
626
|
*/
|
|
406
627
|
function settlingView(
|
|
407
628
|
src: DashboardSource,
|
|
@@ -416,32 +637,7 @@ function settlingView(
|
|
|
416
637
|
},
|
|
417
638
|
): SettlingView {
|
|
418
639
|
const store = src.store;
|
|
419
|
-
const
|
|
420
|
-
let outOfReach = 0;
|
|
421
|
-
for (const id of store.list({ archived: false })) {
|
|
422
|
-
const row = store.row(id);
|
|
423
|
-
if (row === undefined || isJournal(row) || row.type === "schema" || id === x.pageId) continue;
|
|
424
|
-
let p;
|
|
425
|
-
try {
|
|
426
|
-
p = store.physicsOf(id);
|
|
427
|
-
} catch {
|
|
428
|
-
continue;
|
|
429
|
-
}
|
|
430
|
-
const v = promotionEligibility(p);
|
|
431
|
-
if (v.blockedBy.includes("already-identity")) continue;
|
|
432
|
-
const k = kindPhysics(p.kind);
|
|
433
|
-
const best = Math.max(k.wSal * sal(p.salience), k.wRep * PHYSICS.REP_CAP) + PHYSICS.CONS_BONUS;
|
|
434
|
-
if (best < v.threshold) {
|
|
435
|
-
outOfReach += 1;
|
|
436
|
-
continue;
|
|
437
|
-
}
|
|
438
|
-
raw.push({ id, kind: p.kind, base: v.base, consolidated: p.consolidated, days: v.reinforcedDays, eligible: v.eligible });
|
|
439
|
-
}
|
|
440
|
-
// Closest first: how much of each condition is met, both halves weighted
|
|
441
|
-
// alike; ties by days, then by what it has earned.
|
|
442
|
-
const closeness = (r: (typeof raw)[number]): number =>
|
|
443
|
-
Math.min(1, r.base / PHYSICS.THETA_ID) + Math.min(1, r.days / PHYSICS.N_PROMOTION_DAYS);
|
|
444
|
-
raw.sort((a, b) => closeness(b) - closeness(a) || b.days - a.days || b.base - a.base || (a.id < b.id ? -1 : 1));
|
|
640
|
+
const { raw, outOfReach } = coreCandidates(src, x.pageId);
|
|
445
641
|
const candidates: Candidate[] = raw.slice(0, CANDIDATE_LIMIT).map((r) => {
|
|
446
642
|
const t = reveal(store, r.id, 110);
|
|
447
643
|
return {
|
|
@@ -449,12 +645,14 @@ function settlingView(
|
|
|
449
645
|
text: t.text ?? t.label,
|
|
450
646
|
confidential: t.confidential,
|
|
451
647
|
kind: r.kind,
|
|
452
|
-
|
|
453
|
-
|
|
454
|
-
|
|
455
|
-
bonus: PHYSICS.CONS_BONUS,
|
|
648
|
+
feeling: r.feeling,
|
|
649
|
+
needFeeling: PHYSICS.CORE_FAST_FEELING,
|
|
650
|
+
returned: r.returned,
|
|
456
651
|
days: r.days,
|
|
457
|
-
requiredDays: PHYSICS.
|
|
652
|
+
requiredDays: PHYSICS.CORE_SLOW_DAYS,
|
|
653
|
+
span: r.span,
|
|
654
|
+
needSpan: PHYSICS.CORE_SLOW_SPAN_DAYS,
|
|
655
|
+
lane: r.lane,
|
|
458
656
|
eligible: r.eligible,
|
|
459
657
|
};
|
|
460
658
|
});
|
|
@@ -482,12 +680,14 @@ function settlingView(
|
|
|
482
680
|
onTheWay: raw.filter((r) => r.days > 0).length,
|
|
483
681
|
unused: raw.filter((r) => r.days === 0).length,
|
|
484
682
|
outOfReach,
|
|
683
|
+
history: coreHistory(src),
|
|
485
684
|
rule: {
|
|
486
|
-
|
|
487
|
-
|
|
685
|
+
needFeeling: PHYSICS.CORE_FAST_FEELING,
|
|
686
|
+
needGap: PHYSICS.CORE_FAST_GAP_DAYS,
|
|
687
|
+
days: PHYSICS.CORE_SLOW_DAYS,
|
|
688
|
+
span: PHYSICS.CORE_SLOW_SPAN_DAYS,
|
|
488
689
|
everyDays: SLEEP.CADENCE.consolidate,
|
|
489
|
-
|
|
490
|
-
bonus: PHYSICS.CONS_BONUS,
|
|
690
|
+
cap: SLEEP.CORE_MAX_PER_SLEEP,
|
|
491
691
|
},
|
|
492
692
|
coreAbsent: x.core.length === 0 ? x.absent : null,
|
|
493
693
|
guardedAbsent: x.guarded.length === 0 ? x.absent : null,
|
|
@@ -4,7 +4,7 @@
|
|
|
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, strength } from "../../../../core/physics/index.js";
|
|
7
|
+
import { TUNABLES as PHYSICS, band, strength } from "../../../../core/physics/index.js";
|
|
8
8
|
import { MARKER_UNSET, isJournal, readMarker } from "../../../../core/sleep/index.js";
|
|
9
9
|
import type { Band, Kind } from "../../../../core/types.js";
|
|
10
10
|
import { NEVER, NONE } from "../../layout.js";
|
|
@@ -13,7 +13,8 @@ import type { DashboardSource } from "../../source.js";
|
|
|
13
13
|
import type { NarratedEvent } from "../narrate.js";
|
|
14
14
|
import { reveal } from "../reveal.js";
|
|
15
15
|
import { activityView } from "./activity.js";
|
|
16
|
-
import {
|
|
16
|
+
import { archiveGroup } from "./archive-words.js";
|
|
17
|
+
import { coreCandidates } from "./mind.js";
|
|
17
18
|
import { mechanismsView } from "./mechanisms.js";
|
|
18
19
|
import { lastActive } from "./meta.js";
|
|
19
20
|
import { BAND_GLOSS, chapters, contestedRows, livedDays } from "./rows.js";
|
|
@@ -34,43 +35,70 @@ export interface Tile {
|
|
|
34
35
|
}
|
|
35
36
|
|
|
36
37
|
|
|
37
|
-
/** One of the
|
|
38
|
+
/** One of the four small tiles under the home page's headline. */
|
|
38
39
|
export interface HeroCount {
|
|
40
|
+
/** Stable name the page keys its link and its `?` by. */
|
|
41
|
+
readonly key: "memories" | "core" | "chapters" | "replaced";
|
|
39
42
|
readonly label: string;
|
|
40
43
|
readonly value: string;
|
|
44
|
+
/** A few words under the number, or "" for none. */
|
|
41
45
|
readonly note: string;
|
|
42
46
|
/** True when the value is an absence marker or zero. */
|
|
43
47
|
readonly absent: boolean;
|
|
48
|
+
/** The core tile: the closest candidate's credited days, of those required. */
|
|
49
|
+
readonly progress?: { readonly days: number; readonly of: number } | null;
|
|
50
|
+
/** The replaced tile: the other ways out, each its own small number (zeros left out). */
|
|
51
|
+
readonly others?: readonly { readonly label: string; readonly count: number }[];
|
|
44
52
|
}
|
|
45
53
|
|
|
46
54
|
/**
|
|
47
|
-
* The home page's hero, left side: one
|
|
48
|
-
*
|
|
49
|
-
*
|
|
50
|
-
* contested beliefs and the briefing's bytes on the self tab; the last cycle on
|
|
51
|
-
* the health tab.
|
|
55
|
+
* The home page's hero, left side: one headline line and four small tiles. The
|
|
56
|
+
* other numbers live where they are about: protected rows, contested beliefs
|
|
57
|
+
* and the briefing on the self tab; the last cycle on the health tab.
|
|
52
58
|
*/
|
|
53
59
|
export interface Hero {
|
|
54
|
-
/** "Day 30
|
|
60
|
+
/** "Day 30 · 145 memories · 8 of 11 built · 6 active this week". */
|
|
55
61
|
readonly headline: string;
|
|
56
62
|
readonly counts: HeroCount[];
|
|
57
63
|
/** Mechanisms that fired in the window, and how many there are. */
|
|
58
64
|
readonly working: number;
|
|
59
65
|
readonly mechanisms: number;
|
|
66
|
+
/** Mechanisms built at all ("partly" included). */
|
|
67
|
+
readonly built: number;
|
|
68
|
+
/** The one memory count (`memoriesLive`). */
|
|
69
|
+
readonly memories: number;
|
|
60
70
|
}
|
|
61
71
|
|
|
62
72
|
/**
|
|
63
|
-
*
|
|
64
|
-
*
|
|
65
|
-
*
|
|
73
|
+
* THE MECHANISM SCORE IN THE HEADLINE — the owner's development view, for now
|
|
74
|
+
* (2026-09-26): expected to go once all eleven are built. This flag is the one
|
|
75
|
+
* place to take it out.
|
|
66
76
|
*/
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
const
|
|
72
|
-
|
|
73
|
-
|
|
77
|
+
export const SHOW_MECHANISM_SCORE = true;
|
|
78
|
+
|
|
79
|
+
/** The headline, in short parts joined by a dot. */
|
|
80
|
+
export function heroHeadline(x: { day: number; lived: boolean; memories: number; built: number; working: number; mechanisms: number }): string {
|
|
81
|
+
const parts = [
|
|
82
|
+
x.lived ? `Day ${x.day}` : "Nothing lived yet",
|
|
83
|
+
`${x.memories} ${x.memories === 1 ? "memory" : "memories"}`,
|
|
84
|
+
];
|
|
85
|
+
if (SHOW_MECHANISM_SCORE) parts.push(`${x.built} of ${x.mechanisms} built`, `${x.working} active this week`);
|
|
86
|
+
return parts.join(" · ");
|
|
87
|
+
}
|
|
88
|
+
|
|
89
|
+
/** Archived rows by the way they left (`archive-words.ts#archiveGroup`). */
|
|
90
|
+
function archiveGroups(src: DashboardSource): { replaced: number; letGo: number; removed: number; other: number } {
|
|
91
|
+
const out = { replaced: 0, letGo: 0, removed: 0, other: 0 };
|
|
92
|
+
for (const id of src.store.list({ archived: true })) {
|
|
93
|
+
const row = src.store.row(id);
|
|
94
|
+
if (row === undefined || isJournal(row)) continue;
|
|
95
|
+
const g = archiveGroup(row.archived_reason, row.superseded_by !== null);
|
|
96
|
+
if (g === "replaced") out.replaced += 1;
|
|
97
|
+
else if (g === "let-go") out.letGo += 1;
|
|
98
|
+
else if (g === "removed") out.removed += 1;
|
|
99
|
+
else out.other += 1;
|
|
100
|
+
}
|
|
101
|
+
return out;
|
|
74
102
|
}
|
|
75
103
|
|
|
76
104
|
export interface OverviewView {
|
|
@@ -186,39 +214,49 @@ export function overviewView(src: DashboardSource, feedLimit = FEED_LIMIT): Over
|
|
|
186
214
|
|
|
187
215
|
const mech = mechanismsView(src).mechanisms;
|
|
188
216
|
const working = mech.filter((m) => m.status === "green").length;
|
|
217
|
+
const built = mech.filter((m) => m.build !== "not").length;
|
|
218
|
+
// THE ONE COUNT: what the memories list's "live" chip counts.
|
|
219
|
+
const memories = rows.length;
|
|
220
|
+
const closest = coreCandidates(src, src.self.page()?.id ?? null).raw[0];
|
|
221
|
+
const left = archiveGroups(src);
|
|
222
|
+
const others = [
|
|
223
|
+
{ label: "let go", count: left.letGo },
|
|
224
|
+
{ label: "removed by you", count: left.removed },
|
|
225
|
+
{ label: "set aside", count: left.other },
|
|
226
|
+
].filter((o) => o.count > 0);
|
|
189
227
|
const hero: Hero = {
|
|
190
|
-
headline:
|
|
191
|
-
(day === 0 && rows.length === 0 ? "Nothing lived yet." : `Day ${day}.`) +
|
|
192
|
-
` Holding ${held.length} ${held.length === 1 ? "memory" : "memories"}.` +
|
|
193
|
-
` ${working} of ${mech.length} mechanisms working.`,
|
|
228
|
+
headline: heroHeadline({ day, lived: !(day === 0 && rows.length === 0), memories, built, working, mechanisms: mech.length }),
|
|
194
229
|
counts: [
|
|
230
|
+
{ key: "memories", label: "memories", value: String(memories), note: "", absent: memories === 0 },
|
|
195
231
|
{
|
|
196
|
-
|
|
197
|
-
|
|
198
|
-
note: beliefs === 0 ? "live, and able to fade" : `plus ${beliefs} ${beliefs === 1 ? "belief or entity" : "beliefs and entities"}, counted apart`,
|
|
199
|
-
absent: held.length === 0,
|
|
200
|
-
},
|
|
201
|
-
{
|
|
202
|
-
label: "core memories",
|
|
232
|
+
key: "core",
|
|
233
|
+
label: "core",
|
|
203
234
|
value: String(e.identity.length),
|
|
204
|
-
|
|
235
|
+
// An eligible candidate has met a lane and joins at the next consolidation
|
|
236
|
+
// (2026-09-26); otherwise the slow lane's days are the progress shown.
|
|
237
|
+
note:
|
|
238
|
+
closest === undefined
|
|
239
|
+
? ""
|
|
240
|
+
: closest.eligible
|
|
241
|
+
? "closest: ready to join"
|
|
242
|
+
: `closest: ${Math.min(closest.days, PHYSICS.CORE_SLOW_DAYS)} of ${PHYSICS.CORE_SLOW_DAYS} days`,
|
|
205
243
|
absent: e.identity.length === 0,
|
|
244
|
+
progress: closest === undefined ? null : { days: Math.min(closest.days, PHYSICS.CORE_SLOW_DAYS), of: PHYSICS.CORE_SLOW_DAYS },
|
|
206
245
|
},
|
|
246
|
+
{ key: "chapters", label: "chapters", value: String(journalCount), note: "", absent: journalCount === 0 },
|
|
207
247
|
{
|
|
208
|
-
|
|
209
|
-
|
|
210
|
-
|
|
211
|
-
|
|
212
|
-
|
|
213
|
-
|
|
214
|
-
label: "archived",
|
|
215
|
-
value: String(archived.length),
|
|
216
|
-
note: archivedNote(archived.map((r) => r.archived)),
|
|
217
|
-
absent: archived.length === 0,
|
|
248
|
+
key: "replaced",
|
|
249
|
+
label: "replaced",
|
|
250
|
+
value: String(left.replaced),
|
|
251
|
+
note: others.map((o) => `${o.count} ${o.label}`).join(" · "),
|
|
252
|
+
absent: left.replaced === 0,
|
|
253
|
+
others,
|
|
218
254
|
},
|
|
219
255
|
],
|
|
220
256
|
working,
|
|
221
257
|
mechanisms: mech.length,
|
|
258
|
+
built,
|
|
259
|
+
memories,
|
|
222
260
|
};
|
|
223
261
|
|
|
224
262
|
return {
|
|
@@ -237,7 +275,7 @@ export function overviewView(src: DashboardSource, feedLimit = FEED_LIMIT): Over
|
|
|
237
275
|
}),
|
|
238
276
|
bandNote:
|
|
239
277
|
"Memories start episodic and climb only by being used on separate days. Most fade where they started — that is the design, not a shortfall.",
|
|
240
|
-
feed: activityView(src, { limit: feedLimit }).events,
|
|
278
|
+
feed: activityView(src, { limit: feedLimit, lane: "home" }).events,
|
|
241
279
|
identity: e.identity.slice(0, 12).map((el) => {
|
|
242
280
|
const r = reveal(store, el.id, 90);
|
|
243
281
|
return {
|