counterparts 0.1.0
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/CONSTITUTION.md +68 -0
- package/LICENSE +21 -0
- package/README.md +348 -0
- package/docs/ELI5.md +84 -0
- package/docs/QUICKSTART.md +1258 -0
- package/docs/module-map.md +81 -0
- package/package.json +63 -0
- package/src/adapters/claude-code/CONTRACT.md +606 -0
- package/src/adapters/claude-code/INTERFACE-GAPS.md +655 -0
- package/src/adapters/claude-code/NOTES.md +1055 -0
- package/src/adapters/claude-code/bin/hook.ts +820 -0
- package/src/adapters/claude-code/bin/runner.ts +522 -0
- package/src/adapters/claude-code/config.ts +778 -0
- package/src/adapters/claude-code/credentials.ts +199 -0
- package/src/adapters/claude-code/doctor.ts +2557 -0
- package/src/adapters/claude-code/embed-client.ts +617 -0
- package/src/adapters/claude-code/hooks.ts +2240 -0
- package/src/adapters/claude-code/index.ts +224 -0
- package/src/adapters/claude-code/interpret-client.ts +395 -0
- package/src/adapters/claude-code/page-writer.ts +462 -0
- package/src/adapters/claude-code/primacy.ts +162 -0
- package/src/adapters/claude-code/spawn.ts +241 -0
- package/src/adapters/claude-code/standdown.ts +536 -0
- package/src/adapters/claude-code/transcript.ts +661 -0
- package/src/adapters/claude-code/vectors.ts +415 -0
- package/src/adapters/cli/CONTRACT.md +255 -0
- package/src/adapters/cli/INTERFACE-GAPS.md +350 -0
- package/src/adapters/cli/NOTES.md +936 -0
- package/src/adapters/cli/bin/counterparts.ts +74 -0
- package/src/adapters/cli/commands.ts +6095 -0
- package/src/adapters/cli/export.ts +766 -0
- package/src/adapters/cli/index.ts +103 -0
- package/src/adapters/cli/install.ts +670 -0
- package/src/adapters/cli/removal.ts +1186 -0
- package/src/adapters/cli/repair-dates.ts +659 -0
- package/src/adapters/cli/self-page.ts +229 -0
- package/src/adapters/cli/snapshot.ts +279 -0
- package/src/adapters/cli/start-fresh.ts +1228 -0
- package/src/adapters/config-path.ts +342 -0
- package/src/adapters/dashboard/CONTRACT.md +67 -0
- package/src/adapters/dashboard/INTERFACE-GAPS.md +139 -0
- package/src/adapters/dashboard/NOTES.md +474 -0
- package/src/adapters/dashboard/activity.ts +121 -0
- package/src/adapters/dashboard/ansi.ts +82 -0
- package/src/adapters/dashboard/bin/dashboard.ts +479 -0
- package/src/adapters/dashboard/browse.ts +298 -0
- package/src/adapters/dashboard/identity.ts +182 -0
- package/src/adapters/dashboard/index.ts +183 -0
- package/src/adapters/dashboard/layout.ts +149 -0
- package/src/adapters/dashboard/registries.ts +291 -0
- package/src/adapters/dashboard/resolve.ts +206 -0
- package/src/adapters/dashboard/source.ts +48 -0
- package/src/adapters/dashboard/status.ts +327 -0
- package/src/adapters/dashboard/stories.ts +194 -0
- package/src/adapters/dashboard/web/app.html +1731 -0
- package/src/adapters/dashboard/web/brain.html +463 -0
- package/src/adapters/dashboard/web/fired.ts +31 -0
- package/src/adapters/dashboard/web/flow.ts +457 -0
- package/src/adapters/dashboard/web/narrate.ts +1042 -0
- package/src/adapters/dashboard/web/reveal.ts +135 -0
- package/src/adapters/dashboard/web/server.ts +287 -0
- package/src/adapters/dashboard/web/views.ts +1744 -0
- package/src/adapters/expansions.ts +569 -0
- package/src/adapters/fired.ts +1580 -0
- package/src/adapters/mcp/CONTRACT.md +240 -0
- package/src/adapters/mcp/INTERFACE-GAPS.md +271 -0
- package/src/adapters/mcp/NOTES.md +205 -0
- package/src/adapters/mcp/bin/serve.ts +349 -0
- package/src/adapters/mcp/deliberate.ts +619 -0
- package/src/adapters/mcp/index.ts +101 -0
- package/src/adapters/mcp/protocol.ts +170 -0
- package/src/adapters/mcp/server.ts +1740 -0
- package/src/adapters/mcp/stdio.ts +56 -0
- package/src/adapters/mcp/tools.ts +779 -0
- package/src/adapters/scopes.ts +657 -0
- package/src/adapters/sessions.ts +402 -0
- package/src/adapters/snapshots.ts +1069 -0
- package/src/adapters/stance-env.ts +137 -0
- package/src/core/associate/CONTRACT.md +118 -0
- package/src/core/associate/INTERFACE-GAPS.md +173 -0
- package/src/core/associate/NOTES.md +194 -0
- package/src/core/associate/buffer.ts +66 -0
- package/src/core/associate/edges.ts +188 -0
- package/src/core/associate/index.ts +570 -0
- package/src/core/associate/pending.ts +383 -0
- package/src/core/associate/spread.ts +149 -0
- package/src/core/associate/tunables.ts +123 -0
- package/src/core/bridge.ts +272 -0
- package/src/core/briefing.ts +67 -0
- package/src/core/counterpart.ts +3855 -0
- package/src/core/encode/CONTRACT.md +151 -0
- package/src/core/encode/INTERFACE-GAPS.md +135 -0
- package/src/core/encode/NOTES.md +146 -0
- package/src/core/encode/aliases.ts +71 -0
- package/src/core/encode/battery.ts +284 -0
- package/src/core/encode/chunk.ts +265 -0
- package/src/core/encode/emotion.ts +119 -0
- package/src/core/encode/floor.ts +76 -0
- package/src/core/encode/index.ts +100 -0
- package/src/core/encode/precision.ts +162 -0
- package/src/core/encode/preselect.ts +269 -0
- package/src/core/encode/salience.ts +108 -0
- package/src/core/encode/secrets.ts +265 -0
- package/src/core/encode/tunables.ts +99 -0
- package/src/core/encode/types.ts +286 -0
- package/src/core/encode/words.ts +75 -0
- package/src/core/handoff/CONTRACT.md +199 -0
- package/src/core/handoff/INTERFACE-GAPS.md +166 -0
- package/src/core/handoff/NOTES.md +206 -0
- package/src/core/handoff/index.ts +957 -0
- package/src/core/mint.ts +279 -0
- package/src/core/observer.ts +28 -0
- package/src/core/physics/CONTRACT.md +341 -0
- package/src/core/physics/NOTES.md +155 -0
- package/src/core/physics/clock.ts +51 -0
- package/src/core/physics/index.ts +1054 -0
- package/src/core/prospective/CONTRACT.md +137 -0
- package/src/core/prospective/INTERFACE-GAPS.md +112 -0
- package/src/core/prospective/NOTES.md +160 -0
- package/src/core/prospective/derive.ts +188 -0
- package/src/core/prospective/index.ts +1030 -0
- package/src/core/prospective/tunables.ts +72 -0
- package/src/core/prospective/windows.ts +187 -0
- package/src/core/recall/CONTRACT.md +326 -0
- package/src/core/recall/INTERFACE-GAPS.md +163 -0
- package/src/core/recall/NOTES.md +472 -0
- package/src/core/recall/activate.ts +521 -0
- package/src/core/recall/cues.ts +275 -0
- package/src/core/recall/gate.ts +441 -0
- package/src/core/recall/index.ts +692 -0
- package/src/core/recall/probe.ts +239 -0
- package/src/core/recall/reference.ts +201 -0
- package/src/core/recall/render.ts +285 -0
- package/src/core/recall/session.ts +403 -0
- package/src/core/recall/tunables.ts +329 -0
- package/src/core/remember/CONTRACT.md +293 -0
- package/src/core/remember/INTERFACE-GAPS.md +189 -0
- package/src/core/remember/NOTES.md +373 -0
- package/src/core/remember/fallback.ts +452 -0
- package/src/core/remember/index.ts +103 -0
- package/src/core/remember/owner-strike-seam.ts +479 -0
- package/src/core/remember/proposals.ts +609 -0
- package/src/core/remember/spans.ts +1310 -0
- package/src/core/remember/tunables.ts +111 -0
- package/src/core/remember/updates.ts +198 -0
- package/src/core/retrieval.ts +96 -0
- package/src/core/revision.ts +441 -0
- package/src/core/schemas/CONTRACT.md +190 -0
- package/src/core/schemas/INTERFACE-GAPS.md +172 -0
- package/src/core/schemas/NOTES.md +260 -0
- package/src/core/schemas/aliases.ts +160 -0
- package/src/core/schemas/index.ts +1459 -0
- package/src/core/schemas/tunables.ts +44 -0
- package/src/core/schemas/types.ts +387 -0
- package/src/core/self/CONTRACT.md +459 -0
- package/src/core/self/INTERFACE-GAPS.md +284 -0
- package/src/core/self/NOTES.md +1057 -0
- package/src/core/self/briefing.ts +980 -0
- package/src/core/self/episodes.ts +483 -0
- package/src/core/self/freeze.ts +103 -0
- package/src/core/self/identity.ts +604 -0
- package/src/core/self/index.ts +2130 -0
- package/src/core/self/journal-file.ts +760 -0
- package/src/core/self/page.ts +404 -0
- package/src/core/self/tunables.ts +244 -0
- package/src/core/self/writer.ts +714 -0
- package/src/core/sleep/CONTRACT.md +298 -0
- package/src/core/sleep/INTERFACE-GAPS.md +262 -0
- package/src/core/sleep/NOTES.md +770 -0
- package/src/core/sleep/briefing.ts +86 -0
- package/src/core/sleep/consolidate.ts +241 -0
- package/src/core/sleep/cycle.ts +598 -0
- package/src/core/sleep/decay.ts +237 -0
- package/src/core/sleep/dedup.ts +373 -0
- package/src/core/sleep/index.ts +112 -0
- package/src/core/sleep/log.ts +116 -0
- package/src/core/sleep/markers.ts +164 -0
- package/src/core/sleep/prune.ts +170 -0
- package/src/core/sleep/strength-cache.ts +176 -0
- package/src/core/sleep/tunables.ts +135 -0
- package/src/core/sleep/types.ts +542 -0
- package/src/core/store/CONTRACT.md +446 -0
- package/src/core/store/NOTES.md +1068 -0
- package/src/core/store/cache.ts +709 -0
- package/src/core/store/db.ts +275 -0
- package/src/core/store/errors.ts +134 -0
- package/src/core/store/index.ts +2450 -0
- package/src/core/store/operational.ts +610 -0
- package/src/core/store/owner-op-seam.ts +428 -0
- package/src/core/store/paths.ts +494 -0
- package/src/core/store/prose.ts +165 -0
- package/src/core/store/render.ts +87 -0
- package/src/core/store/walk-seam.ts +78 -0
- package/src/core/types.ts +68 -0
- package/tools/install-loop/run.sh +1063 -0
|
@@ -0,0 +1,298 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* `browse` — the memories, listed; and one memory, opened.
|
|
3
|
+
*
|
|
4
|
+
* Two things this view is required to do, both from CONTRACT §3:
|
|
5
|
+
*
|
|
6
|
+
* 1. **Name the RECORD.** "The owner reads the store itself, not only renderings
|
|
7
|
+
* of it" (constitution line 6), so an opened memory says which record it is
|
|
8
|
+
* — id, revision and content hash — and the owner can address it, quote it
|
|
9
|
+
* and check it against a second reading. For now that is what is printed
|
|
10
|
+
* here; it used to be the markdown file's path, which named a filesystem
|
|
11
|
+
* layout rather than the memory.
|
|
12
|
+
* 2. **Resolve ids to text at render time.** Everything an opened memory points
|
|
13
|
+
* at — what superseded it, what it was grounded in, which schema it hangs
|
|
14
|
+
* on, what it fires with — is an ID in the store and a RESOLUTION here. None
|
|
15
|
+
* of it is text this view had lying around (scar §2.20).
|
|
16
|
+
*
|
|
17
|
+
* Sorted by strength, computed now, because "what is strong today" is the
|
|
18
|
+
* question a memory browser is actually asked.
|
|
19
|
+
*/
|
|
20
|
+
import { band, rep, sal, strength } from "../../core/physics/index.js";
|
|
21
|
+
import { isJournal } from "../../core/sleep/index.js";
|
|
22
|
+
import type { Band, Kind } from "../../core/types.js";
|
|
23
|
+
import { PLAIN } from "./ansi.js";
|
|
24
|
+
import type { Style } from "./ansi.js";
|
|
25
|
+
import {
|
|
26
|
+
NONE,
|
|
27
|
+
heading,
|
|
28
|
+
indent,
|
|
29
|
+
meter,
|
|
30
|
+
num,
|
|
31
|
+
plural,
|
|
32
|
+
stack,
|
|
33
|
+
subheading,
|
|
34
|
+
table,
|
|
35
|
+
truncate,
|
|
36
|
+
} from "./layout.js";
|
|
37
|
+
import { gistOf, resolveRef } from "./resolve.js";
|
|
38
|
+
import type { DashboardSource } from "./source.js";
|
|
39
|
+
|
|
40
|
+
export const DEFAULT_LIMIT = 20;
|
|
41
|
+
|
|
42
|
+
export interface BrowseOptions {
|
|
43
|
+
readonly style?: Style;
|
|
44
|
+
/** Open exactly this memory instead of listing. */
|
|
45
|
+
readonly id?: string;
|
|
46
|
+
readonly band?: Band;
|
|
47
|
+
readonly kind?: Kind;
|
|
48
|
+
/** Include archived rows. They are held, not gone (§4.2 G3). */
|
|
49
|
+
readonly archived?: boolean;
|
|
50
|
+
readonly limit?: number;
|
|
51
|
+
}
|
|
52
|
+
|
|
53
|
+
export function renderBrowse(src: DashboardSource, opts: BrowseOptions = {}): string {
|
|
54
|
+
return opts.id === undefined ? renderList(src, opts) : renderOne(src, opts.id, opts);
|
|
55
|
+
}
|
|
56
|
+
|
|
57
|
+
// ── the list ─────────────────────────────────────────────────────────────────
|
|
58
|
+
|
|
59
|
+
interface Line {
|
|
60
|
+
readonly id: string;
|
|
61
|
+
readonly strength: number;
|
|
62
|
+
readonly band: Band;
|
|
63
|
+
readonly kind: Kind;
|
|
64
|
+
readonly gist: string;
|
|
65
|
+
readonly archived: string | null;
|
|
66
|
+
}
|
|
67
|
+
|
|
68
|
+
function renderList(src: DashboardSource, opts: BrowseOptions): string {
|
|
69
|
+
const style = opts.style ?? PLAIN;
|
|
70
|
+
const store = src.store;
|
|
71
|
+
const day = store.livedDay();
|
|
72
|
+
const limit = opts.limit ?? DEFAULT_LIMIT;
|
|
73
|
+
|
|
74
|
+
// The band filter is COMPUTED, never delegated to the column: until 2026-09-14
|
|
75
|
+
// the stored band was a birth fossil (episodic at mint, identity at promotion
|
|
76
|
+
// — nothing ever wrote "semantic", replay review F6), so
|
|
77
|
+
// `list({ band: "semantic" })` returned nothing forever while the engine held
|
|
78
|
+
// semantic rows. The decay pass reconciles the column now (U8), and this stays
|
|
79
|
+
// computed regardless: the column is only as fresh as the last boundary.
|
|
80
|
+
const filter: { kind?: Kind; archived?: boolean } = {};
|
|
81
|
+
if (opts.kind !== undefined) filter.kind = opts.kind;
|
|
82
|
+
if (opts.archived !== true) filter.archived = false;
|
|
83
|
+
|
|
84
|
+
const lines: Line[] = [];
|
|
85
|
+
for (const id of store.list(filter)) {
|
|
86
|
+
const row = store.row(id);
|
|
87
|
+
if (row === undefined) continue;
|
|
88
|
+
// The `memories` table holds episodes too, and `list`'s filter has no way
|
|
89
|
+
// to say "memories only": an episode is the SOURCE a memory was made from,
|
|
90
|
+
// outside every sleep phase (`sleep/types.ts#isJournal`), and `status.ts`
|
|
91
|
+
// already counts it apart. Listed here it would read as a memory with kind
|
|
92
|
+
// `self`, band `episodic` and strength 0.00, and it would be counted in the
|
|
93
|
+
// footer — a census that is wrong by exactly the number of days lived.
|
|
94
|
+
if (isJournal(row)) continue;
|
|
95
|
+
let gist: string;
|
|
96
|
+
let s: number;
|
|
97
|
+
let b: Band;
|
|
98
|
+
try {
|
|
99
|
+
const physics = store.physicsOf(id);
|
|
100
|
+
gist = gistOf(store.readProse(id));
|
|
101
|
+
s = strength(physics, day);
|
|
102
|
+
b = band(physics, day);
|
|
103
|
+
} catch {
|
|
104
|
+
// A row the owner removed, or prose that will not read: it is still a real
|
|
105
|
+
// row, so it is listed as a named absence rather than silently dropped —
|
|
106
|
+
// under its recorded band, the only one an unreadable row has.
|
|
107
|
+
if (opts.band !== undefined && row.band !== opts.band) continue;
|
|
108
|
+
lines.push({
|
|
109
|
+
id,
|
|
110
|
+
strength: 0,
|
|
111
|
+
band: row.band,
|
|
112
|
+
kind: row.kind,
|
|
113
|
+
gist: resolveRef(store, id).label,
|
|
114
|
+
archived: row.archived_reason,
|
|
115
|
+
});
|
|
116
|
+
continue;
|
|
117
|
+
}
|
|
118
|
+
if (opts.band !== undefined && b !== opts.band) continue;
|
|
119
|
+
lines.push({
|
|
120
|
+
id,
|
|
121
|
+
strength: s,
|
|
122
|
+
band: b,
|
|
123
|
+
kind: row.kind,
|
|
124
|
+
gist,
|
|
125
|
+
archived: row.archived === 1 ? (row.archived_reason ?? "archived") : null,
|
|
126
|
+
});
|
|
127
|
+
}
|
|
128
|
+
lines.sort((a, b) => b.strength - a.strength || (a.id < b.id ? -1 : 1));
|
|
129
|
+
const shown = lines.slice(0, limit);
|
|
130
|
+
|
|
131
|
+
const filterNote = [
|
|
132
|
+
opts.band === undefined ? null : `band ${opts.band}`,
|
|
133
|
+
opts.kind === undefined ? null : `kind ${opts.kind}`,
|
|
134
|
+
opts.archived === true ? "archived included" : "live only",
|
|
135
|
+
]
|
|
136
|
+
.filter((x): x is string => x !== null)
|
|
137
|
+
.join(", ");
|
|
138
|
+
|
|
139
|
+
if (shown.length === 0) {
|
|
140
|
+
return stack(
|
|
141
|
+
heading("The memories I hold", style),
|
|
142
|
+
style.warn(`${NONE} — nothing matches (${filterNote}).`),
|
|
143
|
+
);
|
|
144
|
+
}
|
|
145
|
+
|
|
146
|
+
const rows: string[][] = [["strength", "", "band", "kind", "what it says", "id"]];
|
|
147
|
+
for (const line of shown) {
|
|
148
|
+
rows.push([
|
|
149
|
+
num(line.strength),
|
|
150
|
+
meter(line.strength, 8),
|
|
151
|
+
line.band,
|
|
152
|
+
line.kind,
|
|
153
|
+
truncate(line.gist, 48) + (line.archived === null ? "" : style.dim(` (${line.archived})`)),
|
|
154
|
+
line.id,
|
|
155
|
+
]);
|
|
156
|
+
}
|
|
157
|
+
|
|
158
|
+
const footer =
|
|
159
|
+
`${plural(lines.length, "memory", "memories")} match ${filterNote}; showing ${shown.length}, strongest first. ` +
|
|
160
|
+
"Open one with `browse --id <id>`.";
|
|
161
|
+
|
|
162
|
+
return stack(heading("The memories I hold", style), indent(table(rows, { right: [0] })), footer);
|
|
163
|
+
}
|
|
164
|
+
|
|
165
|
+
// ── one memory, opened ───────────────────────────────────────────────────────
|
|
166
|
+
|
|
167
|
+
function renderOne(src: DashboardSource, id: string, opts: BrowseOptions): string {
|
|
168
|
+
const style = opts.style ?? PLAIN;
|
|
169
|
+
const store = src.store;
|
|
170
|
+
const day = store.livedDay();
|
|
171
|
+
|
|
172
|
+
const ref = resolveRef(store, id);
|
|
173
|
+
if (!ref.present || ref.headId === null) {
|
|
174
|
+
return stack(heading(`Memory ${id}`, style), style.warn(ref.label));
|
|
175
|
+
}
|
|
176
|
+
// Follow the forwarding address: opening a superseded id shows what it BECAME,
|
|
177
|
+
// and says so. The alternative — showing the dead text because the caller
|
|
178
|
+
// typed the dead id — is the failure render-time resolution exists to prevent.
|
|
179
|
+
const headId = ref.headId;
|
|
180
|
+
const doc = store.readProse(headId);
|
|
181
|
+
const row = store.row(headId);
|
|
182
|
+
const physics = store.physicsOf(headId);
|
|
183
|
+
|
|
184
|
+
const facts: string[][] = [
|
|
185
|
+
// Which record this is: the id to address it by, the revision it is on, and
|
|
186
|
+
// the hash of the text shown below (constitution line 6 — the owner reads
|
|
187
|
+
// the store itself, and this is what they read it by).
|
|
188
|
+
[
|
|
189
|
+
"record",
|
|
190
|
+
row === undefined
|
|
191
|
+
? "—"
|
|
192
|
+
: `${headId} · rev ${row.revision} · ${row.content_hash === "" ? "—" : row.content_hash}`,
|
|
193
|
+
],
|
|
194
|
+
["kind", physics.kind],
|
|
195
|
+
// Live band first (arithmetic, what the engine acts on); the recorded
|
|
196
|
+
// column is the birth/promotion record and says so (review F6).
|
|
197
|
+
["band", `${band(physics, day)} (recorded ${row?.band ?? "—"}, set day ${row?.band_day ?? "—"})`],
|
|
198
|
+
[
|
|
199
|
+
"strength",
|
|
200
|
+
`${num(strength(physics, day))} ${meter(strength(physics, day), 12)}` +
|
|
201
|
+
` salience ${num(sal(physics.salience))} · repetition ${num(rep(physics))}`,
|
|
202
|
+
],
|
|
203
|
+
[
|
|
204
|
+
"salience",
|
|
205
|
+
`relevance ${num(physics.salience.relevance)} · emotional ${num(physics.salience.emotional)} · ` +
|
|
206
|
+
`predictive ${num(physics.salience.predictive)} · ` +
|
|
207
|
+
(physics.salience.novelty === null
|
|
208
|
+
? style.warn("novelty blind (no schema context existed)")
|
|
209
|
+
: `novelty ${num(physics.salience.novelty)}`) +
|
|
210
|
+
(physics.salience.claimed === null || physics.salience.claimed === undefined
|
|
211
|
+
? ""
|
|
212
|
+
: ` · claimed floor ${num(physics.salience.claimed)}`),
|
|
213
|
+
],
|
|
214
|
+
[
|
|
215
|
+
"lived",
|
|
216
|
+
`born day ${physics.birthDay} · used ${plural(physics.uses, "time")} over ` +
|
|
217
|
+
`${plural(physics.reinforcedDays ?? 0, "day")} · last used day ${physics.lastUsedDay}`,
|
|
218
|
+
],
|
|
219
|
+
["learned on", doc.learnedOn + (doc.happenedOn === undefined ? "" : ` · happened ${doc.happenedOn}`)],
|
|
220
|
+
[
|
|
221
|
+
"standing",
|
|
222
|
+
[
|
|
223
|
+
physics.consolidated ? "consolidated" : "not yet consolidated",
|
|
224
|
+
physics.promotedIdentity ? "promoted into identity" : "not promoted",
|
|
225
|
+
physics.protected ? style.bold("PROTECTED — no revision path reaches it") : "revisable",
|
|
226
|
+
].join(" · "),
|
|
227
|
+
],
|
|
228
|
+
[
|
|
229
|
+
"pressure",
|
|
230
|
+
physics.pressure === 0
|
|
231
|
+
? `${NONE} — nothing has argued with it`
|
|
232
|
+
: `${num(physics.pressure)} standing, last challenged on day ${physics.lastChallengedDay ?? "—"}`,
|
|
233
|
+
],
|
|
234
|
+
];
|
|
235
|
+
if (row?.archived === 1) {
|
|
236
|
+
facts.push(["archived", style.warn(row.archived_reason ?? "no reason recorded")]);
|
|
237
|
+
}
|
|
238
|
+
if (headId !== id) {
|
|
239
|
+
facts.push(["you asked for", `${id}, which forwards here`]);
|
|
240
|
+
}
|
|
241
|
+
|
|
242
|
+
return stack(
|
|
243
|
+
heading(`${headId}${doc.title === undefined ? "" : ` — ${doc.title}`}`, style),
|
|
244
|
+
indent(table(facts)),
|
|
245
|
+
`${subheading("What it says", style)}\n${indent(doc.body.trimEnd())}`,
|
|
246
|
+
referencesBlock(src, headId, doc.meta, row?.superseded_by ?? null, style),
|
|
247
|
+
);
|
|
248
|
+
}
|
|
249
|
+
|
|
250
|
+
/**
|
|
251
|
+
* Every id this memory points at, resolved NOW. Meta keys are not enumerated
|
|
252
|
+
* blindly: only the ones that are addresses, so a schema's `name` never gets
|
|
253
|
+
* mistaken for a pointer.
|
|
254
|
+
*/
|
|
255
|
+
function referencesBlock(
|
|
256
|
+
src: DashboardSource,
|
|
257
|
+
id: string,
|
|
258
|
+
meta: Record<string, unknown>,
|
|
259
|
+
supersededBy: string | null,
|
|
260
|
+
style: Style,
|
|
261
|
+
): string {
|
|
262
|
+
const store = src.store;
|
|
263
|
+
const rows: string[][] = [];
|
|
264
|
+
|
|
265
|
+
if (supersededBy !== null) {
|
|
266
|
+
rows.push(["became", resolveRef(store, supersededBy).label]);
|
|
267
|
+
}
|
|
268
|
+
const entityId = meta["entityId"];
|
|
269
|
+
if (typeof entityId === "string") rows.push(["hangs on", resolveRef(store, entityId).label]);
|
|
270
|
+
const updates = meta["updates"];
|
|
271
|
+
if (typeof updates === "string") rows.push(["revised", resolveRef(store, updates).label]);
|
|
272
|
+
const grounded = meta["groundedIn"];
|
|
273
|
+
if (Array.isArray(grounded)) {
|
|
274
|
+
for (const g of grounded) {
|
|
275
|
+
if (typeof g === "string") rows.push(["grounded in", resolveRef(store, g).label]);
|
|
276
|
+
}
|
|
277
|
+
}
|
|
278
|
+
for (const edge of store.edgesFrom(id)) {
|
|
279
|
+
rows.push([`fires with (${num(edge.weight)})`, resolveRef(store, edge.dst).label]);
|
|
280
|
+
}
|
|
281
|
+
for (const version of store.versions(id)) {
|
|
282
|
+
rows.push([
|
|
283
|
+
`version ${version.seq} (${version.reason}, day ${version.version_day})`,
|
|
284
|
+
version.successor_id === null
|
|
285
|
+
? "revised in place"
|
|
286
|
+
: resolveRef(store, version.successor_id).label,
|
|
287
|
+
]);
|
|
288
|
+
}
|
|
289
|
+
for (const p of store.prospectiveFor(id)) {
|
|
290
|
+
rows.push([`looks ahead to ${p.event_date}`, `${p.state}, fired ${plural(p.fires, "time")}`]);
|
|
291
|
+
}
|
|
292
|
+
|
|
293
|
+
const heading_ = subheading("What it points at, resolved just now", style);
|
|
294
|
+
if (rows.length === 0) {
|
|
295
|
+
return `${heading_}\n${indent(style.warn(`${NONE} — it points at nothing.`))}`;
|
|
296
|
+
}
|
|
297
|
+
return `${heading_}\n${indent(table(rows))}`;
|
|
298
|
+
}
|
|
@@ -0,0 +1,182 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* `identity` — the identity band and the protected set, SIDE BY SIDE.
|
|
3
|
+
*
|
|
4
|
+
* The keep (CONTRACT §3, review finding 2; scar §2.19): *inspectability scales
|
|
5
|
+
* with permanence.* Everything permanent is enumerable on demand — a list, not a
|
|
6
|
+
* cadence — and this view is the demand.
|
|
7
|
+
*
|
|
8
|
+
* The two lists are different populations and the difference is the whole point
|
|
9
|
+
* (`self/identity.ts` says it best): identity is what strength EARNED and physics
|
|
10
|
+
* can still move; protected is permanent ink no revision path reaches and no
|
|
11
|
+
* schema slice will ever contradict. "Permanent-includes-permanently-wrong" is
|
|
12
|
+
* doctrine, so a protected element that is NOT in the identity band — permanence
|
|
13
|
+
* without the band — is the row most worth staring at, and it gets its own line.
|
|
14
|
+
*
|
|
15
|
+
* The enumeration itself is `self/`'s, not a second implementation. Reads there
|
|
16
|
+
* are pure: they write nothing and log nothing (§14.1 G8).
|
|
17
|
+
*/
|
|
18
|
+
import { PLAIN } from "./ansi.js";
|
|
19
|
+
import type { Style } from "./ansi.js";
|
|
20
|
+
import { NONE, columns, heading, indent, meter, num, plural, stack, subheading, table } from "./layout.js";
|
|
21
|
+
import { resolveRef } from "./resolve.js";
|
|
22
|
+
import type { DashboardSource } from "./source.js";
|
|
23
|
+
import { findIdentityCore } from "../../core/self/index.js";
|
|
24
|
+
import type { EnumeratedElement } from "../../core/self/index.js";
|
|
25
|
+
import { DEFAULT_WIDTH } from "./layout.js";
|
|
26
|
+
|
|
27
|
+
export interface IdentityOptions {
|
|
28
|
+
readonly style?: Style;
|
|
29
|
+
readonly width?: number;
|
|
30
|
+
}
|
|
31
|
+
|
|
32
|
+
export function renderIdentity(src: DashboardSource, opts: IdentityOptions = {}): string {
|
|
33
|
+
const style = opts.style ?? PLAIN;
|
|
34
|
+
const width = opts.width ?? DEFAULT_WIDTH;
|
|
35
|
+
const day = src.store.livedDay();
|
|
36
|
+
const e = src.self.enumerate(day);
|
|
37
|
+
|
|
38
|
+
const left = list(
|
|
39
|
+
src,
|
|
40
|
+
`Identity band — what strength earned (${e.identity.length})`,
|
|
41
|
+
e.identity,
|
|
42
|
+
style,
|
|
43
|
+
true,
|
|
44
|
+
);
|
|
45
|
+
const right = list(
|
|
46
|
+
src,
|
|
47
|
+
`Protected — permanent ink (${e.protected.length})`,
|
|
48
|
+
e.protected,
|
|
49
|
+
style,
|
|
50
|
+
false,
|
|
51
|
+
);
|
|
52
|
+
|
|
53
|
+
const both =
|
|
54
|
+
e.both.length === 0
|
|
55
|
+
? `${style.warn(NONE)} — nothing is both permanent and constitutive.`
|
|
56
|
+
: e.both.map((id) => resolveRef(src.store, id, 56).label).join("\n");
|
|
57
|
+
|
|
58
|
+
const outside =
|
|
59
|
+
e.protectedOutsideIdentity.length === 0
|
|
60
|
+
? `${style.warn(NONE)} — every permanent element also stands in the identity band.`
|
|
61
|
+
: e.protectedOutsideIdentity.map((id) => resolveRef(src.store, id, 56).label).join("\n");
|
|
62
|
+
|
|
63
|
+
const opening =
|
|
64
|
+
`On lived day ${day} I hold ${plural(e.identity.length, "element")} in the identity band ` +
|
|
65
|
+
`and ${plural(e.protected.length, "element")} under protection. ` +
|
|
66
|
+
"The first is what repetition and salience earned and physics can still move; " +
|
|
67
|
+
"the second is ink no revision path reaches, including a revision that would be right.";
|
|
68
|
+
|
|
69
|
+
// THE CORE ITSELF, named or absent. Until 2026-09-04 this view rendered
|
|
70
|
+
// identically for a store whose identity core had been seeded and one whose
|
|
71
|
+
// had not — both show an empty band on day 0 — so a stranger who ran `init`
|
|
72
|
+
// instead of `install` had no way to find out that the thing the memory is
|
|
73
|
+
// ABOUT did not exist. The read is `self/`'s own finder plus one prose read,
|
|
74
|
+
// and it writes nothing (§14.1 G8).
|
|
75
|
+
const core = coreLine(src, style);
|
|
76
|
+
|
|
77
|
+
return stack(
|
|
78
|
+
heading("What I am made of", style),
|
|
79
|
+
opening,
|
|
80
|
+
core,
|
|
81
|
+
columns(left, right, { width }),
|
|
82
|
+
`${subheading("Both permanent AND constitutive — the strictest class", style)}\n${indent(both)}`,
|
|
83
|
+
`${subheading("Permanent, but outside the identity band", style)}\n${indent(outside)}`,
|
|
84
|
+
unenumerableBlock(src, e.identity, style),
|
|
85
|
+
);
|
|
86
|
+
}
|
|
87
|
+
|
|
88
|
+
/**
|
|
89
|
+
* One line naming the identity core, or its absence.
|
|
90
|
+
*
|
|
91
|
+
* The core is a `schema`/`self` row carrying `role: "entity"` in its meta
|
|
92
|
+
* (`self/identity.ts#findIdentityCore`), minted by `ensureIdentityCore` from a
|
|
93
|
+
* name the owner supplied — `install --name`, `init --name`, or `identity.name`
|
|
94
|
+
* in the host config. There is no default for it anywhere, which is exactly why
|
|
95
|
+
* its absence has to be legible rather than inferred from an empty band.
|
|
96
|
+
*/
|
|
97
|
+
function coreLine(src: DashboardSource, style: Style): string {
|
|
98
|
+
const id = findIdentityCore(src.store);
|
|
99
|
+
if (id === null) {
|
|
100
|
+
return (
|
|
101
|
+
`${style.warn("No identity core yet")} — nothing says who this memory is about. ` +
|
|
102
|
+
'Seed one with `counterparts install --name "<you>"` or `counterparts init --name "<you>"`; ' +
|
|
103
|
+
"there is no default for it anywhere."
|
|
104
|
+
);
|
|
105
|
+
}
|
|
106
|
+
let name = "(unnamed)";
|
|
107
|
+
let born: number | null = null;
|
|
108
|
+
try {
|
|
109
|
+
const doc = src.store.readProse(id);
|
|
110
|
+
const fromMeta = doc.meta["name"];
|
|
111
|
+
name = typeof fromMeta === "string" && fromMeta.length > 0 ? fromMeta : (doc.title ?? name);
|
|
112
|
+
} catch {
|
|
113
|
+
/* a core whose prose has gone is still a core; the id below says so */
|
|
114
|
+
}
|
|
115
|
+
try {
|
|
116
|
+
born = src.store.physicsOf(id).birthDay;
|
|
117
|
+
} catch {
|
|
118
|
+
born = null;
|
|
119
|
+
}
|
|
120
|
+
return `Identity core: seeded as ${name}${born === null ? "" : ` on day ${String(born)}`} (${id}).`;
|
|
121
|
+
}
|
|
122
|
+
|
|
123
|
+
/**
|
|
124
|
+
* Identity-band rows the enumeration could NOT read — a memory the owner removed
|
|
125
|
+
* since, or prose that has gone.
|
|
126
|
+
*
|
|
127
|
+
* `self/enumerate` drops such a row silently (`enumerateOne` returns null on a
|
|
128
|
+
* throw), which is right for a briefing and wrong for an inspection surface:
|
|
129
|
+
* scar §2.19 says everything permanent is enumerable ON DEMAND, and a row that
|
|
130
|
+
* quietly stops being counted is indistinguishable from one that was never
|
|
131
|
+
* there. The band is queryable, so the gap is recoverable here — the difference
|
|
132
|
+
* between the band's rows and the enumeration's is printed as named absences.
|
|
133
|
+
*
|
|
134
|
+
* The protected SET has no such recovery: protection is a physics flag on a row
|
|
135
|
+
* whose physics is exactly what stopped reading, so a removed protected element
|
|
136
|
+
* simply leaves the list. Filed in `INTERFACE-GAPS.md` §3.
|
|
137
|
+
*/
|
|
138
|
+
function unenumerableBlock(
|
|
139
|
+
src: DashboardSource,
|
|
140
|
+
enumerated: readonly EnumeratedElement[],
|
|
141
|
+
style: Style,
|
|
142
|
+
): string {
|
|
143
|
+
const seen = new Set(enumerated.map((el) => el.id));
|
|
144
|
+
const missing = src.store
|
|
145
|
+
.list({ band: "identity", archived: false })
|
|
146
|
+
.filter((id) => !seen.has(id));
|
|
147
|
+
const heading_ = subheading("Identity-band rows I could not read just now", style);
|
|
148
|
+
if (missing.length === 0) {
|
|
149
|
+
return `${heading_}\n${indent(`${style.warn(NONE)} — every element in the band read cleanly.`)}`;
|
|
150
|
+
}
|
|
151
|
+
return `${heading_}\n${indent(
|
|
152
|
+
table(missing.map((id) => [id, resolveRef(src.store, id, 48).label])),
|
|
153
|
+
)}`;
|
|
154
|
+
}
|
|
155
|
+
|
|
156
|
+
function list(
|
|
157
|
+
src: DashboardSource,
|
|
158
|
+
title: string,
|
|
159
|
+
elements: readonly EnumeratedElement[],
|
|
160
|
+
style: Style,
|
|
161
|
+
showMeter: boolean,
|
|
162
|
+
): string {
|
|
163
|
+
if (elements.length === 0) {
|
|
164
|
+
return `${subheading(title, style)}\n${indent(`${style.warn(NONE)} — this list is empty.`)}`;
|
|
165
|
+
}
|
|
166
|
+
const rows = elements.map((el) => {
|
|
167
|
+
// Text at render time: the enumeration carries a title, but a title is not
|
|
168
|
+
// the memory, and an element removed since enumeration must stop resolving.
|
|
169
|
+
const ref = resolveRef(src.store, el.id, 40);
|
|
170
|
+
const cells = [
|
|
171
|
+
num(el.strength),
|
|
172
|
+
...(showMeter ? [meter(el.strength, 6)] : []),
|
|
173
|
+
el.kind,
|
|
174
|
+
el.band,
|
|
175
|
+
ref.present ? (ref.text ?? "") : style.warn(ref.label),
|
|
176
|
+
el.id,
|
|
177
|
+
`${el.bytes}b`,
|
|
178
|
+
];
|
|
179
|
+
return cells;
|
|
180
|
+
});
|
|
181
|
+
return `${subheading(title, style)}\n${indent(table(rows, { right: [0] }))}`;
|
|
182
|
+
}
|
|
@@ -0,0 +1,183 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* `adapters/dashboard/` — the owner's window.
|
|
3
|
+
*
|
|
4
|
+
* The direct instrument of constitution line 16: *if the owner can't see it, it
|
|
5
|
+
* isn't trustworthy.* Five views, minimal-first (Amendment 15, CONTRACT §4):
|
|
6
|
+
*
|
|
7
|
+
* `status` the brain at a glance — counts by kind and band, the clock, what
|
|
8
|
+
* the last cycle finished, what has left and how.
|
|
9
|
+
* `browse` the memories, listed by strength; one memory opened shows its
|
|
10
|
+
* prose PATH and resolves every id it points at, at render time.
|
|
11
|
+
* `stories` per contested belief, the durable pressure log told as a story:
|
|
12
|
+
* lived day, challenger, force, bar, verdict.
|
|
13
|
+
* `identity` the identity band and the protected set, side by side, enumerable
|
|
14
|
+
* on demand (scar §2.19).
|
|
15
|
+
* `activity` the recent event feed, content-by-reference resolved at render.
|
|
16
|
+
*
|
|
17
|
+
* ## Observer BY CONSTRUCTION
|
|
18
|
+
*
|
|
19
|
+
* `Dashboard.open` composes a `Counterpart` — the composition root, never a
|
|
20
|
+
* hand-rewired Store, because re-deriving the wiring is how a caller "forgets the
|
|
21
|
+
* map and silently loses the safety half that rides along with it" — and it sets
|
|
22
|
+
* `observer: true` ITSELF. The caller cannot turn it off: an `observer: false` in
|
|
23
|
+
* the options is overwritten, not honoured. `sourceOf()` then refuses any
|
|
24
|
+
* Counterpart whose stance is not observer, so the views cannot be handed a
|
|
25
|
+
* writable brain even by a caller composing them directly.
|
|
26
|
+
*
|
|
27
|
+
* That is two layers. The third and load-bearing one is in the test: it scans
|
|
28
|
+
* every source file in this directory with comments and string literals stripped
|
|
29
|
+
* and fails on any call to a `WRITE_METHODS` name or any filesystem write. That
|
|
30
|
+
* scan is what "holds no write handle" actually means here, and it is also the
|
|
31
|
+
* mechanization of "no memory body text is persisted into dashboard state" — the
|
|
32
|
+
* dashboard has no state file because it cannot open one.
|
|
33
|
+
*
|
|
34
|
+
* `budgetBytes` and `identity` are deliberately never passed through: the
|
|
35
|
+
* dashboard does not wake and does not mint an identity core. An instrument
|
|
36
|
+
* leaves the store as it found it (scar E7).
|
|
37
|
+
*
|
|
38
|
+
* ## Terminal-first
|
|
39
|
+
*
|
|
40
|
+
* CONTRACT OQ1 asked terminal or local web. Terminal, for now — see `NOTES.md`;
|
|
41
|
+
* it is a working default, revisable without ceremony, and nothing in the view
|
|
42
|
+
* functions knows it: they return strings.
|
|
43
|
+
*/
|
|
44
|
+
import { Counterpart } from "../../core/counterpart.js";
|
|
45
|
+
import { PLAIN, style as makeStyle } from "./ansi.js";
|
|
46
|
+
import type { Style } from "./ansi.js";
|
|
47
|
+
import { DEFAULT_WIDTH } from "./layout.js";
|
|
48
|
+
import { renderActivity } from "./activity.js";
|
|
49
|
+
import type { ActivityOptions } from "./activity.js";
|
|
50
|
+
import { renderBrowse } from "./browse.js";
|
|
51
|
+
import type { BrowseOptions } from "./browse.js";
|
|
52
|
+
import { renderIdentity } from "./identity.js";
|
|
53
|
+
import type { IdentityOptions } from "./identity.js";
|
|
54
|
+
import { renderStatus } from "./status.js";
|
|
55
|
+
import type { StatusOptions } from "./status.js";
|
|
56
|
+
import { renderStories } from "./stories.js";
|
|
57
|
+
import type { StoriesOptions } from "./stories.js";
|
|
58
|
+
import { sourceOf } from "./source.js";
|
|
59
|
+
import type { DashboardSource } from "./source.js";
|
|
60
|
+
|
|
61
|
+
export * from "./ansi.js";
|
|
62
|
+
export * from "./layout.js";
|
|
63
|
+
export * from "./registries.js";
|
|
64
|
+
export * from "./resolve.js";
|
|
65
|
+
export * from "./source.js";
|
|
66
|
+
export { renderStatus } from "./status.js";
|
|
67
|
+
export type { StatusOptions } from "./status.js";
|
|
68
|
+
export { DEFAULT_LIMIT, renderBrowse } from "./browse.js";
|
|
69
|
+
export type { BrowseOptions } from "./browse.js";
|
|
70
|
+
export { DEFAULT_STORY_LIMIT, PRESSURE_EVENT, contestedBeliefs, renderStories } from "./stories.js";
|
|
71
|
+
export type { StoriesOptions } from "./stories.js";
|
|
72
|
+
export { renderIdentity } from "./identity.js";
|
|
73
|
+
export type { IdentityOptions } from "./identity.js";
|
|
74
|
+
export { DEFAULT_FEED, renderActivity } from "./activity.js";
|
|
75
|
+
export type { ActivityOptions } from "./activity.js";
|
|
76
|
+
|
|
77
|
+
/** The five. A sixth is earned by the owner asking for it (CONTRACT §4). */
|
|
78
|
+
export const VIEWS = ["status", "browse", "stories", "identity", "activity"] as const;
|
|
79
|
+
export type ViewName = (typeof VIEWS)[number];
|
|
80
|
+
|
|
81
|
+
export function isViewName(name: string): name is ViewName {
|
|
82
|
+
return (VIEWS as readonly string[]).includes(name);
|
|
83
|
+
}
|
|
84
|
+
|
|
85
|
+
/** One line each, for the entry script's help and for the owner's memory. */
|
|
86
|
+
export const VIEW_BLURB: Record<ViewName, string> = {
|
|
87
|
+
status: "the brain at a glance: counts by kind and band, the clock, what the last cycle finished",
|
|
88
|
+
browse: "the memories by strength; open one to see its prose path and everything it points at",
|
|
89
|
+
stories: "per contested belief, the pressure log as a story: day, challenger, force, bar, verdict",
|
|
90
|
+
identity: "the identity band and the protected set, side by side and enumerable",
|
|
91
|
+
activity: "the recent durable events, with every id resolved at render time",
|
|
92
|
+
};
|
|
93
|
+
|
|
94
|
+
export interface ViewArgs
|
|
95
|
+
extends StatusOptions,
|
|
96
|
+
BrowseOptions,
|
|
97
|
+
StoriesOptions,
|
|
98
|
+
IdentityOptions,
|
|
99
|
+
ActivityOptions {}
|
|
100
|
+
|
|
101
|
+
export interface DashboardOptions {
|
|
102
|
+
/** The data dir to look at. Defaults to `dataDir()`, resolved at call time. */
|
|
103
|
+
readonly dir?: string;
|
|
104
|
+
/** Escapes off unless asked. Views are byte-stable without one. */
|
|
105
|
+
readonly colour?: boolean;
|
|
106
|
+
readonly width?: number;
|
|
107
|
+
}
|
|
108
|
+
|
|
109
|
+
export class Dashboard {
|
|
110
|
+
readonly counterpart: Counterpart;
|
|
111
|
+
readonly source: DashboardSource;
|
|
112
|
+
readonly style: Style;
|
|
113
|
+
readonly width: number;
|
|
114
|
+
|
|
115
|
+
private constructor(opts: DashboardOptions) {
|
|
116
|
+
this.counterpart = Counterpart.open({
|
|
117
|
+
...(opts.dir === undefined ? {} : { dir: opts.dir }),
|
|
118
|
+
// NOT spread from the caller, and NOT defaulted: set here, unconditionally.
|
|
119
|
+
observer: true,
|
|
120
|
+
});
|
|
121
|
+
this.source = sourceOf(this.counterpart);
|
|
122
|
+
this.style = opts.colour === true ? makeStyle(true) : PLAIN;
|
|
123
|
+
this.width = opts.width ?? DEFAULT_WIDTH;
|
|
124
|
+
}
|
|
125
|
+
|
|
126
|
+
static open(opts: DashboardOptions = {}): Dashboard {
|
|
127
|
+
return new Dashboard(opts);
|
|
128
|
+
}
|
|
129
|
+
|
|
130
|
+
close(): void {
|
|
131
|
+
this.counterpart.close();
|
|
132
|
+
}
|
|
133
|
+
|
|
134
|
+
/** The store this is reading. Exposed so a caller can assert the stance. */
|
|
135
|
+
get store(): Counterpart["store"] {
|
|
136
|
+
return this.counterpart.store;
|
|
137
|
+
}
|
|
138
|
+
|
|
139
|
+
get observer(): boolean {
|
|
140
|
+
return this.counterpart.observer;
|
|
141
|
+
}
|
|
142
|
+
|
|
143
|
+
status(opts: StatusOptions = {}): string {
|
|
144
|
+
return renderStatus(this.source, { style: this.style, ...opts });
|
|
145
|
+
}
|
|
146
|
+
|
|
147
|
+
browse(opts: BrowseOptions = {}): string {
|
|
148
|
+
return renderBrowse(this.source, { style: this.style, ...opts });
|
|
149
|
+
}
|
|
150
|
+
|
|
151
|
+
stories(opts: StoriesOptions = {}): string {
|
|
152
|
+
return renderStories(this.source, { style: this.style, ...opts });
|
|
153
|
+
}
|
|
154
|
+
|
|
155
|
+
identity(opts: IdentityOptions = {}): string {
|
|
156
|
+
return renderIdentity(this.source, { style: this.style, width: this.width, ...opts });
|
|
157
|
+
}
|
|
158
|
+
|
|
159
|
+
activity(opts: ActivityOptions = {}): string {
|
|
160
|
+
return renderActivity(this.source, { style: this.style, ...opts });
|
|
161
|
+
}
|
|
162
|
+
|
|
163
|
+
/** Dispatch by name — what `bin/` and any future host call. */
|
|
164
|
+
render(view: ViewName, args: ViewArgs = {}): string {
|
|
165
|
+
switch (view) {
|
|
166
|
+
case "status":
|
|
167
|
+
return this.status(args);
|
|
168
|
+
case "browse":
|
|
169
|
+
return this.browse(args);
|
|
170
|
+
case "stories":
|
|
171
|
+
return this.stories(args);
|
|
172
|
+
case "identity":
|
|
173
|
+
return this.identity(args);
|
|
174
|
+
case "activity":
|
|
175
|
+
return this.activity(args);
|
|
176
|
+
}
|
|
177
|
+
}
|
|
178
|
+
|
|
179
|
+
/** Every view, in order. The whole window, for a scroll-back or a paste. */
|
|
180
|
+
all(args: ViewArgs = {}): string {
|
|
181
|
+
return VIEWS.map((v) => this.render(v, args)).join("\n\n\n");
|
|
182
|
+
}
|
|
183
|
+
}
|