counterparts 0.3.0 → 0.3.2
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 +76 -0
- package/docs/module-map.md +2 -0
- package/package.json +2 -1
- package/src/adapters/claude-code/CONTRACT.md +2 -1
- package/src/adapters/claude-code/NOTES.md +90 -2
- package/src/adapters/claude-code/bin/hook.ts +17 -2
- package/src/adapters/claude-code/bin/runner.ts +4 -1
- package/src/adapters/claude-code/config.ts +23 -0
- package/src/adapters/claude-code/doctor.ts +148 -26
- package/src/adapters/claude-code/hooks.ts +37 -12
- package/src/adapters/claude-code/index.ts +2 -0
- package/src/adapters/claude-code/standdown.ts +12 -1
- package/src/adapters/claude-code/transcript.ts +79 -6
- package/src/adapters/cli/INTERFACE-GAPS.md +4 -0
- package/src/adapters/cli/commands.ts +209 -61
- package/src/adapters/cli/export.ts +27 -3
- package/src/adapters/cli/help.ts +22 -8
- package/src/adapters/cli/install.ts +3 -5
- package/src/adapters/cli/mechanisms.ts +295 -0
- package/src/adapters/cli/repair-dates.ts +3 -1
- package/src/adapters/cli/snapshot.ts +4 -27
- package/src/adapters/dashboard/CONTRACT.md +13 -9
- package/src/adapters/dashboard/INTERFACE-GAPS.md +4 -0
- package/src/adapters/dashboard/NOTES.md +3 -2
- package/src/adapters/dashboard/activity.ts +2 -1
- package/src/adapters/dashboard/bin/dashboard.ts +18 -3
- package/src/adapters/dashboard/upgrade.ts +23 -0
- package/src/adapters/dashboard/web/README.md +153 -0
- package/src/adapters/dashboard/web/actions.ts +631 -0
- package/src/adapters/dashboard/web/app.html +40 -1703
- package/src/adapters/dashboard/web/app.js +55 -0
- package/src/adapters/dashboard/web/mechanisms/association/index.js +15 -0
- package/src/adapters/dashboard/web/mechanisms/association/panel.js +17 -0
- package/src/adapters/dashboard/web/mechanisms/consolidation/index.js +15 -0
- package/src/adapters/dashboard/web/mechanisms/consolidation/panel.js +23 -0
- package/src/adapters/dashboard/web/mechanisms/decay/index.js +15 -0
- package/src/adapters/dashboard/web/mechanisms/decay/panel.js +45 -0
- package/src/adapters/dashboard/web/mechanisms/emotional/index.js +15 -0
- package/src/adapters/dashboard/web/mechanisms/episodic-semantic/index.js +15 -0
- package/src/adapters/dashboard/web/mechanisms/index.js +60 -0
- package/src/adapters/dashboard/web/mechanisms/interference/index.js +15 -0
- package/src/adapters/dashboard/web/mechanisms/picture.js +28 -0
- package/src/adapters/dashboard/web/mechanisms/prospective/index.js +15 -0
- package/src/adapters/dashboard/web/mechanisms/reconsolidation/index.js +15 -0
- package/src/adapters/dashboard/web/mechanisms/reconsolidation/panel.js +15 -0
- package/src/adapters/dashboard/web/mechanisms/regions.js +30 -0
- package/src/adapters/dashboard/web/mechanisms/retrieval/index.js +15 -0
- package/src/adapters/dashboard/web/mechanisms/retrieval/panel.js +20 -0
- package/src/adapters/dashboard/web/mechanisms/salience/index.js +15 -0
- package/src/adapters/dashboard/web/mechanisms/salience/panel.js +14 -0
- package/src/adapters/dashboard/web/mechanisms/schema/index.js +15 -0
- package/src/adapters/dashboard/web/narrate.ts +10 -10
- package/src/adapters/dashboard/web/pages/flow/flow.css +38 -0
- package/src/adapters/dashboard/web/pages/flow/index.js +117 -0
- package/src/adapters/dashboard/web/pages/flow/sections/blind.js +12 -0
- package/src/adapters/dashboard/web/pages/flow/sections/detail.js +45 -0
- package/src/adapters/dashboard/web/pages/flow/sections/diagram.js +291 -0
- package/src/adapters/dashboard/web/pages/flow/sections/feed.js +11 -0
- package/src/adapters/dashboard/web/pages/flow/sections/fired.js +41 -0
- package/src/adapters/dashboard/web/pages/flow/sections/heatmap.js +25 -0
- package/src/adapters/dashboard/web/pages/flow/sections/records.js +24 -0
- package/src/adapters/dashboard/web/pages/flow/sections/symmetry.js +17 -0
- package/src/adapters/dashboard/web/pages/flow/state.js +3 -0
- package/src/adapters/dashboard/web/pages/health/health.css +93 -0
- package/src/adapters/dashboard/web/pages/health/index.js +41 -0
- package/src/adapters/dashboard/web/pages/health/sections/archive.js +84 -0
- package/src/adapters/dashboard/web/pages/health/sections/checks.js +172 -0
- package/src/adapters/dashboard/web/pages/health/sections/cycle.js +37 -0
- package/src/adapters/dashboard/web/pages/health/sections/verify.js +54 -0
- package/src/adapters/dashboard/web/pages/home/brain.js +375 -0
- package/src/adapters/dashboard/web/pages/home/home.css +134 -0
- package/src/adapters/dashboard/web/pages/home/index.js +84 -0
- package/src/adapters/dashboard/web/pages/home/sections/explorer.js +206 -0
- package/src/adapters/dashboard/web/pages/home/sections/hero.js +22 -0
- package/src/adapters/dashboard/web/pages/home/sections/live-activity.js +25 -0
- package/src/adapters/dashboard/web/pages/home/sections/recent-chapters.js +13 -0
- package/src/adapters/dashboard/web/pages/home/sections/tiles.js +52 -0
- package/src/adapters/dashboard/web/pages/memories/index.js +75 -0
- package/src/adapters/dashboard/web/pages/memories/memories.css +143 -0
- package/src/adapters/dashboard/web/pages/memories/sections/constellation.js +178 -0
- package/src/adapters/dashboard/web/pages/memories/sections/kinds.js +42 -0
- package/src/adapters/dashboard/web/pages/memories/sections/list.js +114 -0
- package/src/adapters/dashboard/web/pages/memories/sections/search.js +102 -0
- package/src/adapters/dashboard/web/pages/memories/sections/tools.js +155 -0
- package/src/adapters/dashboard/web/pages/memories/state.js +22 -0
- package/src/adapters/dashboard/web/pages/self/diff.js +79 -0
- package/src/adapters/dashboard/web/pages/self/index.js +43 -0
- package/src/adapters/dashboard/web/pages/self/markdown.js +61 -0
- package/src/adapters/dashboard/web/pages/self/sections/journal.js +32 -0
- package/src/adapters/dashboard/web/pages/self/sections/page.js +149 -0
- package/src/adapters/dashboard/web/pages/self/sections/settling.js +150 -0
- package/src/adapters/dashboard/web/pages/self/sections/stories.js +47 -0
- package/src/adapters/dashboard/web/pages/self/sections/wake.js +74 -0
- package/src/adapters/dashboard/web/pages/self/self.css +182 -0
- package/src/adapters/dashboard/web/server.ts +305 -28
- package/src/adapters/dashboard/web/shared/absence.js +14 -0
- package/src/adapters/dashboard/web/shared/actions.js +48 -0
- package/src/adapters/dashboard/web/shared/api.js +17 -0
- package/src/adapters/dashboard/web/shared/base.css +34 -0
- package/src/adapters/dashboard/web/shared/canvas.js +68 -0
- package/src/adapters/dashboard/web/shared/colors.js +6 -0
- package/src/adapters/dashboard/web/shared/dom.js +4 -0
- package/src/adapters/dashboard/web/shared/event-modal.js +25 -0
- package/src/adapters/dashboard/web/shared/fonts/OFL-courier-prime.txt +93 -0
- package/src/adapters/dashboard/web/shared/fonts/OFL-outfit.txt +93 -0
- package/src/adapters/dashboard/web/shared/fonts/courier-prime-latin-400.woff2 +0 -0
- package/src/adapters/dashboard/web/shared/fonts/courier-prime-latin-700.woff2 +0 -0
- package/src/adapters/dashboard/web/shared/fonts/outfit-latin-wght.woff2 +0 -0
- package/src/adapters/dashboard/web/shared/format.js +31 -0
- package/src/adapters/dashboard/web/shared/layout.css +32 -0
- package/src/adapters/dashboard/web/shared/memory-modal.js +124 -0
- package/src/adapters/dashboard/web/shared/modal.css +24 -0
- package/src/adapters/dashboard/web/shared/modal.js +22 -0
- package/src/adapters/dashboard/web/shared/state.js +12 -0
- package/src/adapters/dashboard/web/shared/tip.css +4 -0
- package/src/adapters/dashboard/web/shared/tip.js +12 -0
- package/src/adapters/dashboard/web/shared/tokens.css +50 -0
- package/src/adapters/dashboard/web/shared/type.css +52 -0
- package/src/adapters/dashboard/web/shared/utilities.css +5 -0
- package/src/adapters/dashboard/web/shared/vendor/MIT-three.txt +21 -0
- package/src/adapters/dashboard/web/shared/vendor/three.module.min.js +6 -0
- package/src/adapters/dashboard/web/shared/widgets/bar.css +9 -0
- package/src/adapters/dashboard/web/shared/widgets/card.css +6 -0
- package/src/adapters/dashboard/web/shared/widgets/chapters.js +15 -0
- package/src/adapters/dashboard/web/shared/widgets/chart.css +4 -0
- package/src/adapters/dashboard/web/shared/widgets/confirm.css +31 -0
- package/src/adapters/dashboard/web/shared/widgets/confirm.js +52 -0
- package/src/adapters/dashboard/web/shared/widgets/feed.css +13 -0
- package/src/adapters/dashboard/web/shared/widgets/feed.js +41 -0
- package/src/adapters/dashboard/web/shared/widgets/light.css +4 -0
- package/src/adapters/dashboard/web/shared/widgets/light.js +15 -0
- package/src/adapters/dashboard/web/shared/widgets/rows.css +7 -0
- package/src/adapters/dashboard/web/shared/widgets/table.css +17 -0
- package/src/adapters/dashboard/web/shared/widgets/tiles.css +14 -0
- package/src/adapters/dashboard/web/shell/pages.js +15 -0
- package/src/adapters/dashboard/web/shell/pulse.js +86 -0
- package/src/adapters/dashboard/web/shell/tabs.js +49 -0
- package/src/adapters/dashboard/web/static.ts +76 -0
- package/src/adapters/dashboard/web/views/activity.ts +80 -0
- package/src/adapters/dashboard/web/views/archive-words.ts +57 -0
- package/src/adapters/dashboard/web/views/flow-view.ts +217 -0
- package/src/adapters/dashboard/web/views/health.ts +328 -0
- package/src/adapters/dashboard/web/views/mechanism-panel.ts +370 -0
- package/src/adapters/dashboard/web/views/mechanisms.ts +302 -0
- package/src/adapters/dashboard/web/views/memories.ts +342 -0
- package/src/adapters/dashboard/web/views/memory.ts +210 -0
- package/src/adapters/dashboard/web/views/meta.ts +64 -0
- package/src/adapters/dashboard/web/views/mind.ts +729 -0
- package/src/adapters/dashboard/web/views/overview.ts +282 -0
- package/src/adapters/dashboard/web/views/pulse.ts +19 -0
- package/src/adapters/dashboard/web/views/rows.ts +207 -0
- package/src/adapters/dashboard/web/views/search.ts +62 -0
- package/src/adapters/dashboard/web/views/shared.ts +161 -0
- package/src/adapters/dashboard/web/views.ts +34 -1724
- package/src/adapters/fired.ts +138 -31
- package/src/adapters/mcp/INTERFACE-GAPS.md +4 -1
- package/src/adapters/mcp/NOTES.md +43 -0
- package/src/adapters/mcp/bin/serve.ts +9 -1
- package/src/adapters/mcp/index.ts +7 -0
- package/src/adapters/mcp/server.ts +167 -6
- package/src/adapters/mcp/tools.ts +42 -0
- package/src/adapters/mcp/write-up.ts +1 -1
- package/src/adapters/sessions.ts +18 -1
- package/src/adapters/snapshots.ts +71 -39
- package/src/core/associate/INTERFACE-GAPS.md +8 -0
- package/src/core/counterpart.ts +86 -7
- package/src/core/encode/INTERFACE-GAPS.md +12 -0
- package/src/core/feelings-wheel.ts +218 -0
- package/src/core/handoff/INTERFACE-GAPS.md +2 -0
- package/src/core/mint.ts +14 -2
- package/src/core/prospective/INTERFACE-GAPS.md +14 -0
- package/src/core/prospective/windows.ts +10 -48
- package/src/core/recall/INTERFACE-GAPS.md +6 -0
- package/src/core/remember/INTERFACE-GAPS.md +10 -0
- package/src/core/schemas/INTERFACE-GAPS.md +8 -0
- package/src/core/schemas/NOTES.md +118 -1
- package/src/core/schemas/index.ts +330 -40
- package/src/core/schemas/tunables.ts +23 -0
- package/src/core/schemas/types.ts +64 -1
- package/src/core/self/CONTRACT.md +3 -0
- package/src/core/self/INTERFACE-GAPS.md +10 -0
- package/src/core/self/NOTES.md +33 -2
- package/src/core/self/calendar.ts +7 -78
- package/src/core/self/episodes.ts +52 -12
- package/src/core/self/index.ts +40 -12
- package/src/core/self/writer.ts +22 -22
- package/src/core/sleep/NOTES.md +36 -0
- package/src/core/sleep/cycle.ts +38 -3
- package/src/core/sleep/fade.ts +76 -0
- package/src/core/sleep/index.ts +4 -1
- package/src/core/sleep/prune.ts +8 -1
- package/src/core/sleep/tunables.ts +5 -0
- package/src/core/sleep/types.ts +24 -0
- package/src/core/store/CONTRACT.md +36 -7
- package/src/core/store/NOTES.md +197 -0
- package/src/core/store/errors.ts +22 -0
- package/src/core/store/feelings.ts +182 -0
- package/src/core/store/index.ts +339 -45
- package/src/core/store/operational.ts +240 -22
- package/src/core/store/owner-op-seam.ts +13 -3
- package/src/core/store/paths.ts +15 -1
- package/src/core/store/pre-migration.ts +258 -0
- package/src/core/store/prose.ts +8 -1
- package/src/core/store/render.ts +3 -0
- package/src/core/time.ts +374 -0
- package/src/core/types.ts +13 -0
- package/src/adapters/dashboard/web/brain.html +0 -463
package/src/core/counterpart.ts
CHANGED
|
@@ -149,7 +149,9 @@ import type {
|
|
|
149
149
|
import { cyclePartial, runCycle } from "./sleep/index.js";
|
|
150
150
|
import type { CyclePartial, CycleReport, Phase } from "./sleep/index.js";
|
|
151
151
|
import { Store, assertSafeDataDir, hashText, indexTextOf } from "./store/index.js";
|
|
152
|
-
import type {
|
|
152
|
+
import type {
|
|
153
|
+
AddFeelingsResult,
|
|
154
|
+
FeelingInput, Embedder, StoreEvent } from "./store/index.js";
|
|
153
155
|
import { TUNABLES as PHYSICS } from "./physics/index.js";
|
|
154
156
|
import type { UseTier } from "./physics/index.js";
|
|
155
157
|
import type { Kind } from "./types.js";
|
|
@@ -699,10 +701,18 @@ export interface CounterpartOptions extends Stance {
|
|
|
699
701
|
vectors?: LiveVectors;
|
|
700
702
|
/** Retention window for the bounded logs. `store/` owns the default. */
|
|
701
703
|
retentionDays?: number;
|
|
704
|
+
/** Where the store's pre-migration copy goes; `store/` owns the default. */
|
|
705
|
+
snapshotsDir?: string;
|
|
702
706
|
/** The identity core's name is the OWNER's; there is no default (SEAMS F). */
|
|
703
707
|
identity?: IdentityCoreSpec;
|
|
704
708
|
onEvent?: (e: CounterpartEvent) => void;
|
|
705
709
|
now?: () => number;
|
|
710
|
+
/**
|
|
711
|
+
* The person's zone, an IANA name — the host config's `timeZone`
|
|
712
|
+
* (docs/time.md rule 2). Handed to the store, which every local date here
|
|
713
|
+
* reads through (`Store#zone`). Absent: the machine's current zone.
|
|
714
|
+
*/
|
|
715
|
+
timeZone?: string;
|
|
706
716
|
}
|
|
707
717
|
|
|
708
718
|
/** What `wake()` returns: the bundle, plus what the host told us about itself. */
|
|
@@ -729,6 +739,8 @@ export interface DepositContext {
|
|
|
729
739
|
scope: string;
|
|
730
740
|
/** The span this deposit IS (a jot's own words), withheld from the sweep. */
|
|
731
741
|
ownSpanHash?: string | null;
|
|
742
|
+
/** The model writing it, from host state (`MintOptions.model`); absent = NULL. */
|
|
743
|
+
model?: string;
|
|
732
744
|
}
|
|
733
745
|
|
|
734
746
|
/**
|
|
@@ -1314,6 +1326,8 @@ export class Counterpart {
|
|
|
1314
1326
|
...(opts.dir === undefined ? {} : { dir: opts.dir }),
|
|
1315
1327
|
...(opts.embed === undefined ? {} : { embed: opts.embed }),
|
|
1316
1328
|
...(opts.retentionDays === undefined ? {} : { retentionDays: opts.retentionDays }),
|
|
1329
|
+
...(opts.snapshotsDir === undefined ? {} : { snapshotsDir: opts.snapshotsDir }),
|
|
1330
|
+
...(opts.timeZone === undefined ? {} : { timeZone: opts.timeZone }),
|
|
1317
1331
|
onEvent: (e: StoreEvent) => this.relay("store", e),
|
|
1318
1332
|
});
|
|
1319
1333
|
|
|
@@ -1375,6 +1389,7 @@ export class Counterpart {
|
|
|
1375
1389
|
}
|
|
1376
1390
|
this.relay("self", e);
|
|
1377
1391
|
},
|
|
1392
|
+
onMemoryMinted: (m) => this.creditNamedIn(m.title, m.body, m.day, m.id, "episode"),
|
|
1378
1393
|
now: this.nowFn,
|
|
1379
1394
|
});
|
|
1380
1395
|
this.recall = new Recall({
|
|
@@ -2159,6 +2174,22 @@ export class Counterpart {
|
|
|
2159
2174
|
return this.deposit(draft, "session-end", ctx);
|
|
2160
2175
|
}
|
|
2161
2176
|
|
|
2177
|
+
/**
|
|
2178
|
+
* Feelings on a memory (schema v7, `store/feelings.ts`), through the SECRETS
|
|
2179
|
+
* half of the battery: `carried_by` and an `other` word are words about the
|
|
2180
|
+
* moment, and a credential must not land in them any more than in a body.
|
|
2181
|
+
* Nothing else here reads them — salience, decay and recall are untouched
|
|
2182
|
+
* until the emotion build. Throws what the store throws (`FEELING_INVALID`).
|
|
2183
|
+
*/
|
|
2184
|
+
addFeelings(memoryId: string, inputs: readonly FeelingInput[], opts: { model?: string } = {}): AddFeelingsResult {
|
|
2185
|
+
const clean = inputs.map((f) => ({
|
|
2186
|
+
...f,
|
|
2187
|
+
...(typeof f.carriedBy === "string" ? { carriedBy: redactSecrets(f.carriedBy) } : {}),
|
|
2188
|
+
...(typeof f.otherWord === "string" ? { otherWord: redactSecrets(f.otherWord) } : {}),
|
|
2189
|
+
}));
|
|
2190
|
+
return this.store.addFeelings(memoryId, clean, opts);
|
|
2191
|
+
}
|
|
2192
|
+
|
|
2162
2193
|
/** An in-the-moment deliberate deposit. Channel: `authored`. Always covers
|
|
2163
2194
|
* its own session's words: `cover` is not taken here, and is dropped if a
|
|
2164
2195
|
* caller outside TypeScript sends it. */
|
|
@@ -2167,6 +2198,7 @@ export class Counterpart {
|
|
|
2167
2198
|
session: ctx.session,
|
|
2168
2199
|
scope: ctx.scope,
|
|
2169
2200
|
...(ctx.ownSpanHash === undefined ? {} : { ownSpanHash: ctx.ownSpanHash }),
|
|
2201
|
+
...(ctx.model === undefined ? {} : { model: ctx.model }),
|
|
2170
2202
|
});
|
|
2171
2203
|
}
|
|
2172
2204
|
|
|
@@ -2198,7 +2230,8 @@ export class Counterpart {
|
|
|
2198
2230
|
appendEpisode(
|
|
2199
2231
|
sessionId: string,
|
|
2200
2232
|
text: string,
|
|
2201
|
-
|
|
2233
|
+
/** `model`: the model writing this chapter, when the host knows it. */
|
|
2234
|
+
opts: { day?: number; title?: string; happenedOn?: string; model?: string } = {},
|
|
2202
2235
|
): ChapterResult {
|
|
2203
2236
|
const verdict = episodeGate()({ text, handles: [], sessionId });
|
|
2204
2237
|
if (!verdict.ok) {
|
|
@@ -2525,6 +2558,10 @@ export class Counterpart {
|
|
|
2525
2558
|
cycle = runCycle({
|
|
2526
2559
|
store: this.store,
|
|
2527
2560
|
render,
|
|
2561
|
+
// schemas INTERFACE-GAPS §6: sleep owns the cadence, schemas the verdict.
|
|
2562
|
+
// Under observer the phase hands `apply: false` and this is a dry run.
|
|
2563
|
+
fade: (f) =>
|
|
2564
|
+
this.schemas.fadeSweep(f.day, { date: f.date, dryRun: !f.apply, limit: f.budget }),
|
|
2528
2565
|
date,
|
|
2529
2566
|
...(composeBudget === null ? {} : { budgetBytes: composeBudget }),
|
|
2530
2567
|
onEvent: (e) => this.relay("sleep", e),
|
|
@@ -2958,6 +2995,7 @@ export class Counterpart {
|
|
|
2958
2995
|
promoted: known ? report.promoted.length : null,
|
|
2959
2996
|
pruned: known ? report.pruned.length : null,
|
|
2960
2997
|
merged: known ? report.merged.length : null,
|
|
2998
|
+
faded: known ? report.faded.length : null,
|
|
2961
2999
|
bandUp: known ? report.bandTransitions.filter((t) => t.direction === "up").length : null,
|
|
2962
3000
|
bandDown: known
|
|
2963
3001
|
? report.bandTransitions.filter((t) => t.direction === "down").length
|
|
@@ -3509,6 +3547,7 @@ export class Counterpart {
|
|
|
3509
3547
|
const mint = mintProposal(this.store, proposal, {
|
|
3510
3548
|
self: this.self,
|
|
3511
3549
|
channel: "authored",
|
|
3550
|
+
...(ctx.model === undefined ? {} : { model: ctx.model }),
|
|
3512
3551
|
onEvent: (name, data) => this.emit(name, undefined, data),
|
|
3513
3552
|
});
|
|
3514
3553
|
this.emit("counterpart.deposit", mint.id, {
|
|
@@ -3524,7 +3563,8 @@ export class Counterpart {
|
|
|
3524
3563
|
// alias ACTED, and those fires are most of what a mix is made of — v1's own
|
|
3525
3564
|
// "737 gate fires" counted fires on proposals that were accepted.
|
|
3526
3565
|
this.recordDeposit(result, ctx, source, mint);
|
|
3527
|
-
this.mentionFromProposal(proposal, `deposit:${mint.id}`);
|
|
3566
|
+
const titled = this.mentionFromProposal(proposal, `deposit:${mint.id}`);
|
|
3567
|
+
this.creditNamedIn(proposal.title ?? null, proposal.content, proposal.day, mint.id, source, titled);
|
|
3528
3568
|
this.applyDeclaredRevision(proposal, mint, source);
|
|
3529
3569
|
return {
|
|
3530
3570
|
deposited: true,
|
|
@@ -3716,7 +3756,8 @@ export class Counterpart {
|
|
|
3716
3756
|
updates: mint.updates,
|
|
3717
3757
|
blind: mint.blind,
|
|
3718
3758
|
});
|
|
3719
|
-
this.mentionFromProposal(proposal, `sweep:${chunk.index}`);
|
|
3759
|
+
const titled = this.mentionFromProposal(proposal, `sweep:${chunk.index}`);
|
|
3760
|
+
this.creditNamedIn(proposal.title, proposal.content, proposal.day, mint.id, "sweep", titled);
|
|
3720
3761
|
// The DOOR, not `SWEPT_SOURCE` — that field says "session-end" because
|
|
3721
3762
|
// `remember/`'s vocabulary has no word for a sweep (see its comment).
|
|
3722
3763
|
this.applyDeclaredRevision(proposal, mint, "sweep");
|
|
@@ -3841,10 +3882,10 @@ export class Counterpart {
|
|
|
3841
3882
|
private mentionFromProposal(
|
|
3842
3883
|
proposal: { title?: string | null; kind: Kind; content: string; aliases: readonly string[]; day: number },
|
|
3843
3884
|
chunkRef: string,
|
|
3844
|
-
):
|
|
3885
|
+
): string | null {
|
|
3845
3886
|
const title = proposal.title ?? null;
|
|
3846
|
-
if (title === null || title.trim().length === 0) return;
|
|
3847
|
-
if (proposal.kind !== "entity" && proposal.kind !== "person" && proposal.kind !== "place") return;
|
|
3887
|
+
if (title === null || title.trim().length === 0) return null;
|
|
3888
|
+
if (proposal.kind !== "entity" && proposal.kind !== "person" && proposal.kind !== "place") return null;
|
|
3848
3889
|
const outcome = this.schemas.mention({
|
|
3849
3890
|
name: title,
|
|
3850
3891
|
kind: proposal.kind,
|
|
@@ -3858,6 +3899,44 @@ export class Counterpart {
|
|
|
3858
3899
|
kind: proposal.kind,
|
|
3859
3900
|
day: proposal.day,
|
|
3860
3901
|
});
|
|
3902
|
+
return outcome.id;
|
|
3903
|
+
}
|
|
3904
|
+
|
|
3905
|
+
/**
|
|
3906
|
+
* A saved memory that names a card anywhere in its title or body counts as a
|
|
3907
|
+
* use of that card, so someone talked about every day keeps their card, and
|
|
3908
|
+
* one who faded comes back (schemas NOTES §15). The card the title path just handled is skipped. Every
|
|
3909
|
+
* door that mints calls this: a deposit, a sweep, an episode ingestion.
|
|
3910
|
+
* Fail-open: the memory has already landed.
|
|
3911
|
+
*/
|
|
3912
|
+
private creditNamedIn(
|
|
3913
|
+
title: string | null,
|
|
3914
|
+
body: string,
|
|
3915
|
+
day: number,
|
|
3916
|
+
memoryId: string,
|
|
3917
|
+
door: string,
|
|
3918
|
+
titled: string | null = null,
|
|
3919
|
+
): void {
|
|
3920
|
+
if (this.observer) return;
|
|
3921
|
+
try {
|
|
3922
|
+
const out = this.schemas.creditNamedIn({
|
|
3923
|
+
text: title === null ? body : `${title}\n${body}`,
|
|
3924
|
+
day,
|
|
3925
|
+
ref: memoryId,
|
|
3926
|
+
...(titled === null ? {} : { except: [titled] }),
|
|
3927
|
+
});
|
|
3928
|
+
if (out.credited.length + out.refused.length + out.revived.length + out.ambiguous === 0) return;
|
|
3929
|
+
this.emit("counterpart.mention.named", memoryId, {
|
|
3930
|
+
door,
|
|
3931
|
+
credited: out.credited.length,
|
|
3932
|
+
refused: out.refused.length,
|
|
3933
|
+
revived: out.revived.length,
|
|
3934
|
+
ambiguous: out.ambiguous,
|
|
3935
|
+
day,
|
|
3936
|
+
});
|
|
3937
|
+
} catch (err) {
|
|
3938
|
+
this.emit("counterpart.mention.named.failed", memoryId, { door, code: errCode(err) });
|
|
3939
|
+
}
|
|
3861
3940
|
}
|
|
3862
3941
|
|
|
3863
3942
|
private emit(
|
|
@@ -23,6 +23,8 @@ mechanized guarantee. Listed worst first.
|
|
|
23
23
|
|
|
24
24
|
### (a) BLOCKING — the chunk-level guarantee has no chunk
|
|
25
25
|
|
|
26
|
+
**Closed 2026-09-24** — sweep chunks go through `encodeChunk` (`core/bridge.ts#gateSweepChunk`).
|
|
27
|
+
|
|
26
28
|
`GateFn` is per proposal. **"A fully-gated chunk moves NO durable state" (encode
|
|
27
29
|
§5 G3, scar §7b) is a CHUNK-level property**: it is scoped to *all-rejected*, and
|
|
28
30
|
it is what closes the element-level side channel — prediction checks, entity
|
|
@@ -41,6 +43,8 @@ chokepoint, and it already returns the per-proposal verdicts `remember/` wants.
|
|
|
41
43
|
|
|
42
44
|
### (b) BLOCKING — the emotion exemption cannot be set
|
|
43
45
|
|
|
46
|
+
**Closed 2026-09-24** — the exemption is engine-set from the proposal's source (`core/bridge.ts#verdictFor`, `selfAuthoredFeeling`).
|
|
47
|
+
|
|
44
48
|
Encode §5 G5: the exemption is **set per proposal by the engine that minted it**,
|
|
45
49
|
and encode never infers it. `GateInput` has no field for it. As written, every
|
|
46
50
|
self-authored feeling with no citable quote comes back `quote-missing` and the
|
|
@@ -52,6 +56,8 @@ which must take the ordinary path.)
|
|
|
52
56
|
|
|
53
57
|
### (c) The claimed-salience floor is not reachable through this seam
|
|
54
58
|
|
|
59
|
+
**Closed 2026-09-24** — `claimed` and `salience` ride `GateInput` (`remember/proposals.ts`); the floor is clamped at mint (`core/mint.ts`, `clampSalienceAtSeam`, emits `salience.lifted`).
|
|
60
|
+
|
|
55
61
|
Encode §5 G6 exists because v1's "remember this" note claimed a salience floor
|
|
56
62
|
**only in its prompt**, with no engine backstop. The clamp lives at the
|
|
57
63
|
proposal→memory seam (`tagSalience` → `physics.clampSalienceAtSeam`) and emits
|
|
@@ -65,6 +71,8 @@ to the `ok` verdict** — or route through `encodeChunk`, which already does it.
|
|
|
65
71
|
|
|
66
72
|
### (d) The ops rule has no input
|
|
67
73
|
|
|
74
|
+
**Closed 2026-09-24** — the author's `title` reaches the battery as a handle (`core/bridge.ts#verdictFor`).
|
|
75
|
+
|
|
68
76
|
Encode refuses the whole proposal when a *name or handle* carries a credential
|
|
69
77
|
("a credential must never become an entity the store indexes"). `GateInput` has no
|
|
70
78
|
`handles` field, so that refusal can never fire through this seam. **Add
|
|
@@ -72,6 +80,8 @@ Encode refuses the whole proposal when a *name or handle* carries a credential
|
|
|
72
80
|
|
|
73
81
|
### (e) Lossy telemetry on refusal
|
|
74
82
|
|
|
83
|
+
**Closed 2026-09-24** — the refusal arm carries `blockedBy`, `records` and `refusedByDesign` (`remember/proposals.ts#GateVerdict`, filled by `core/bridge.ts#verdictFor`).
|
|
84
|
+
|
|
75
85
|
`GateVerdict`'s failure arm is `{ ok: false; gate: string; reason: string }` — one
|
|
76
86
|
gate, one reason. Encode returns `blockedBy` (every blocking reason) plus one
|
|
77
87
|
`GateRecord` per gate, always, including the `not-invoked` / `refused-by-design` /
|
|
@@ -102,6 +112,8 @@ adapter-local renames.
|
|
|
102
112
|
|
|
103
113
|
## 2. `schemas/` must import encode's whole-word matcher, not write its own
|
|
104
114
|
|
|
115
|
+
**Closed 2026-09-24** — `schemas/aliases.ts` and `schemas/index.ts` import `occursAsWholeWord` from `encode/words.ts`.
|
|
116
|
+
|
|
105
117
|
behavioral-spec §8 G3 requires **one** whole-word definition, shared between
|
|
106
118
|
preselection and entity birth: "Birth must test a proposed name by *exactly* the
|
|
107
119
|
rule preselection uses, or the two drift and a name that 'was in the span' for one
|
|
@@ -0,0 +1,218 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* THE FEELINGS WHEEL — the vocabulary a recorded feeling is spelled in
|
|
3
|
+
* (owner-approved 2026-09-25, transcribed from his poster).
|
|
4
|
+
*
|
|
5
|
+
* Six CORE emotions at the centre (happy, sad, fear, anger, surprise, disgust),
|
|
6
|
+
* a MIDDLE ring of named feelings under each, and an OUTER ring of two finer
|
|
7
|
+
* words under each middle one. A recorded feeling (`store` table `feelings`,
|
|
8
|
+
* schema v7) names one core and one entry from this list — or `other`, with the
|
|
9
|
+
* person's own word kept beside it.
|
|
10
|
+
*
|
|
11
|
+
* **The key scheme.** An entry's key is its word, lower-case (`furious`,
|
|
12
|
+
* `hopeful`). A word the wheel prints under TWO DIFFERENT cores gets a
|
|
13
|
+
* core-qualified key on BOTH sides — `<core>.<word>` — so no key silently means
|
|
14
|
+
* one of two feelings: `anger.insecure` / `fear.insecure`, `sad.inferior` /
|
|
15
|
+
* `fear.inferior`. A word printed twice under the SAME core is one key (sad's
|
|
16
|
+
* `abandoned` is a middle-ring feeling and also under `lonely`; it is kept once,
|
|
17
|
+
* on the middle ring, with `alsoUnder: "lonely"`). The six cores are entries
|
|
18
|
+
* too (ring `core`), for a feeling named only at the centre. `other` is the
|
|
19
|
+
* one key that is not on the wheel. `resolveEmotion` accepts a bare word where
|
|
20
|
+
* it is unambiguous, and qualifies an ambiguous one by the core it was given.
|
|
21
|
+
*
|
|
22
|
+
* **Valence** is +1 or −1 per entry, and 0 for `surprise` itself: surprise's
|
|
23
|
+
* children take their own (amazed, awe, astonished, excited, energetic, eager
|
|
24
|
+
* lean positive; startled, shocked, dismayed, confused, perplexed, disillusioned
|
|
25
|
+
* lean negative). Nothing reads valence yet — it is here so the emotion build
|
|
26
|
+
* that comes later does not have to re-transcribe the poster.
|
|
27
|
+
*
|
|
28
|
+
* A leaf: no imports, so `store/` (which validates against it) and anything
|
|
29
|
+
* above can read it without a layering question.
|
|
30
|
+
*/
|
|
31
|
+
|
|
32
|
+
export const CORE_EMOTIONS = ["happy", "sad", "fear", "anger", "surprise", "disgust"] as const;
|
|
33
|
+
export type CoreEmotion = (typeof CORE_EMOTIONS)[number];
|
|
34
|
+
|
|
35
|
+
export type WheelRing = "core" | "middle" | "outer";
|
|
36
|
+
export type Valence = 1 | 0 | -1;
|
|
37
|
+
|
|
38
|
+
export interface WheelEntry {
|
|
39
|
+
/** The stored key (see the scheme above). */
|
|
40
|
+
readonly key: string;
|
|
41
|
+
/** The word as the wheel prints it. */
|
|
42
|
+
readonly word: string;
|
|
43
|
+
readonly core: CoreEmotion;
|
|
44
|
+
readonly ring: WheelRing;
|
|
45
|
+
/** The middle-ring key an outer word sits under; null for the core and middle rings. */
|
|
46
|
+
readonly parent: string | null;
|
|
47
|
+
readonly valence: Valence;
|
|
48
|
+
/** A middle-ring word the wheel ALSO prints on the outer ring of the same core. */
|
|
49
|
+
readonly alsoUnder?: string;
|
|
50
|
+
}
|
|
51
|
+
|
|
52
|
+
/** The one emotion key that is not on the wheel: the person's own word is kept beside it. */
|
|
53
|
+
export const OTHER_EMOTION = "other";
|
|
54
|
+
|
|
55
|
+
type Branch = readonly [middle: string, outer: readonly [string, string]];
|
|
56
|
+
|
|
57
|
+
const TREE: Record<CoreEmotion, readonly Branch[]> = {
|
|
58
|
+
anger: [
|
|
59
|
+
["hurt", ["embarrassed", "devastated"]],
|
|
60
|
+
["threatened", ["insecure", "jealous"]],
|
|
61
|
+
["hateful", ["resentful", "violated"]],
|
|
62
|
+
["mad", ["furious", "enraged"]],
|
|
63
|
+
["aggressive", ["provoked", "hostile"]],
|
|
64
|
+
["frustrated", ["infuriated", "irritated"]],
|
|
65
|
+
["distant", ["withdrawn", "suspicious"]],
|
|
66
|
+
["critical", ["skeptical", "sarcastic"]],
|
|
67
|
+
],
|
|
68
|
+
disgust: [
|
|
69
|
+
["disapproval", ["judgmental", "loathing"]],
|
|
70
|
+
["disappointed", ["repugnant", "revolted"]],
|
|
71
|
+
["awful", ["revulsion", "detestable"]],
|
|
72
|
+
["avoidance", ["aversion", "hesitant"]],
|
|
73
|
+
],
|
|
74
|
+
sad: [
|
|
75
|
+
["guilty", ["remorseful", "ashamed"]],
|
|
76
|
+
["abandoned", ["ignored", "victimized"]],
|
|
77
|
+
["despair", ["powerless", "vulnerable"]],
|
|
78
|
+
["depressed", ["inferior", "empty"]],
|
|
79
|
+
["lonely", ["abandoned", "isolated"]],
|
|
80
|
+
["bored", ["apathetic", "indifferent"]],
|
|
81
|
+
],
|
|
82
|
+
happy: [
|
|
83
|
+
["optimistic", ["inspired", "open"]],
|
|
84
|
+
["intimate", ["playful", "sensitive"]],
|
|
85
|
+
["peaceful", ["hopeful", "loving"]],
|
|
86
|
+
["powerful", ["provocative", "courageous"]],
|
|
87
|
+
["accepted", ["fulfilled", "respected"]],
|
|
88
|
+
["proud", ["confident", "important"]],
|
|
89
|
+
["interested", ["inquisitive", "amused"]],
|
|
90
|
+
["joyful", ["ecstatic", "liberated"]],
|
|
91
|
+
],
|
|
92
|
+
surprise: [
|
|
93
|
+
["excited", ["energetic", "eager"]],
|
|
94
|
+
["amazed", ["awe", "astonished"]],
|
|
95
|
+
["confused", ["perplexed", "disillusioned"]],
|
|
96
|
+
["startled", ["dismayed", "shocked"]],
|
|
97
|
+
],
|
|
98
|
+
fear: [
|
|
99
|
+
["scared", ["terrified", "frightened"]],
|
|
100
|
+
["anxious", ["overwhelmed", "worried"]],
|
|
101
|
+
["insecure", ["incompetent", "inferior"]],
|
|
102
|
+
["submissive", ["worthless", "insignificant"]],
|
|
103
|
+
["rejected", ["inadequate", "alienated"]],
|
|
104
|
+
["humiliated", ["disrespected", "ridiculed"]],
|
|
105
|
+
],
|
|
106
|
+
};
|
|
107
|
+
|
|
108
|
+
const SURPRISE_POSITIVE = new Set(["excited", "energetic", "eager", "amazed", "awe", "astonished"]);
|
|
109
|
+
|
|
110
|
+
function valenceOf(core: CoreEmotion, word: string, ring: WheelRing): Valence {
|
|
111
|
+
if (core === "happy") return 1;
|
|
112
|
+
if (core !== "surprise") return -1;
|
|
113
|
+
if (ring === "core") return 0;
|
|
114
|
+
return SURPRISE_POSITIVE.has(word) ? 1 : -1;
|
|
115
|
+
}
|
|
116
|
+
|
|
117
|
+
function build(): WheelEntry[] {
|
|
118
|
+
// Which words sit under more than one core decides which keys are qualified.
|
|
119
|
+
const coresOf = new Map<string, Set<CoreEmotion>>();
|
|
120
|
+
for (const core of CORE_EMOTIONS) {
|
|
121
|
+
for (const [middle, outer] of TREE[core]) {
|
|
122
|
+
for (const w of [middle, ...outer]) {
|
|
123
|
+
const set = coresOf.get(w) ?? new Set<CoreEmotion>();
|
|
124
|
+
set.add(core);
|
|
125
|
+
coresOf.set(w, set);
|
|
126
|
+
}
|
|
127
|
+
}
|
|
128
|
+
}
|
|
129
|
+
const keyOf = (core: CoreEmotion, word: string): string =>
|
|
130
|
+
(coresOf.get(word)?.size ?? 0) > 1 ? `${core}.${word}` : word;
|
|
131
|
+
const out: WheelEntry[] = [];
|
|
132
|
+
const seen = new Set<string>();
|
|
133
|
+
for (const core of CORE_EMOTIONS) {
|
|
134
|
+
out.push({ key: core, word: core, core, ring: "core", parent: null, valence: valenceOf(core, core, "core") });
|
|
135
|
+
seen.add(core);
|
|
136
|
+
const middles = new Set(TREE[core].map(([m]) => m));
|
|
137
|
+
for (const [middle] of TREE[core]) {
|
|
138
|
+
const key = keyOf(core, middle);
|
|
139
|
+
const alsoUnder = TREE[core].find(([m, o]) => m !== middle && o.includes(middle))?.[0];
|
|
140
|
+
out.push({
|
|
141
|
+
key,
|
|
142
|
+
word: middle,
|
|
143
|
+
core,
|
|
144
|
+
ring: "middle",
|
|
145
|
+
parent: null,
|
|
146
|
+
valence: valenceOf(core, middle, "middle"),
|
|
147
|
+
...(alsoUnder === undefined ? {} : { alsoUnder: keyOf(core, alsoUnder) }),
|
|
148
|
+
});
|
|
149
|
+
seen.add(key);
|
|
150
|
+
}
|
|
151
|
+
for (const [middle, outer] of TREE[core]) {
|
|
152
|
+
for (const word of outer) {
|
|
153
|
+
const key = keyOf(core, word);
|
|
154
|
+
if (seen.has(key) || middles.has(word)) continue; // sad's `abandoned`: one key
|
|
155
|
+
out.push({ key, word, core, ring: "outer", parent: keyOf(core, middle), valence: valenceOf(core, word, "outer") });
|
|
156
|
+
seen.add(key);
|
|
157
|
+
}
|
|
158
|
+
}
|
|
159
|
+
}
|
|
160
|
+
return out;
|
|
161
|
+
}
|
|
162
|
+
|
|
163
|
+
/** Every entry on the wheel, cores first within each core's block. */
|
|
164
|
+
export const FEELINGS_WHEEL: readonly WheelEntry[] = build();
|
|
165
|
+
|
|
166
|
+
const BY_KEY = new Map(FEELINGS_WHEEL.map((e) => [e.key, e]));
|
|
167
|
+
|
|
168
|
+
export function isCoreEmotion(value: unknown): value is CoreEmotion {
|
|
169
|
+
return typeof value === "string" && (CORE_EMOTIONS as readonly string[]).includes(value);
|
|
170
|
+
}
|
|
171
|
+
|
|
172
|
+
export function wheelEntry(key: string): WheelEntry | undefined {
|
|
173
|
+
return BY_KEY.get(key);
|
|
174
|
+
}
|
|
175
|
+
|
|
176
|
+
/** How an emotion as given reads against the wheel, under the core it was given with. */
|
|
177
|
+
export type EmotionResolution =
|
|
178
|
+
| { readonly kind: "wheel"; readonly entry: WheelEntry }
|
|
179
|
+
| { readonly kind: "wrong-core"; readonly entry: WheelEntry }
|
|
180
|
+
| { readonly kind: "other"; readonly word: string; readonly closest: readonly string[] };
|
|
181
|
+
|
|
182
|
+
/**
|
|
183
|
+
* Read `emotion` (a key or a bare word, any case) under `core`. A bare word the
|
|
184
|
+
* wheel prints under two cores is qualified by `core`; a word that is on the
|
|
185
|
+
* wheel under a DIFFERENT core only is `wrong-core`; anything else is `other`,
|
|
186
|
+
* with the closest keys under `core` for the caller to rewrite with.
|
|
187
|
+
*/
|
|
188
|
+
export function resolveEmotion(core: CoreEmotion, emotion: string): EmotionResolution {
|
|
189
|
+
const raw = emotion.trim().toLowerCase();
|
|
190
|
+
const direct = BY_KEY.get(raw) ?? BY_KEY.get(`${core}.${raw}`);
|
|
191
|
+
if (direct !== undefined) return direct.core === core ? { kind: "wheel", entry: direct } : { kind: "wrong-core", entry: direct };
|
|
192
|
+
const elsewhere = FEELINGS_WHEEL.find((e) => e.word === raw);
|
|
193
|
+
if (elsewhere !== undefined) return { kind: "wrong-core", entry: elsewhere };
|
|
194
|
+
return { kind: "other", word: emotion.trim(), closest: closestKeys(core, raw) };
|
|
195
|
+
}
|
|
196
|
+
|
|
197
|
+
/** Up to `n` keys under `core`, nearest first by edit distance to `word`. */
|
|
198
|
+
export function closestKeys(core: CoreEmotion, word: string, n = 5): string[] {
|
|
199
|
+
return FEELINGS_WHEEL.filter((e) => e.core === core && e.ring !== "core")
|
|
200
|
+
.map((e) => ({ key: e.key, d: editDistance(word, e.word) }))
|
|
201
|
+
.sort((a, b) => a.d - b.d || (a.key < b.key ? -1 : 1))
|
|
202
|
+
.slice(0, n)
|
|
203
|
+
.map((x) => x.key);
|
|
204
|
+
}
|
|
205
|
+
|
|
206
|
+
function editDistance(a: string, b: string): number {
|
|
207
|
+
const prev = Array.from({ length: b.length + 1 }, (_, i) => i);
|
|
208
|
+
for (let i = 1; i <= a.length; i++) {
|
|
209
|
+
let diag = prev[0] as number;
|
|
210
|
+
prev[0] = i;
|
|
211
|
+
for (let j = 1; j <= b.length; j++) {
|
|
212
|
+
const up = prev[j] as number;
|
|
213
|
+
prev[j] = Math.min(up + 1, (prev[j - 1] as number) + 1, diag + (a[i - 1] === b[j - 1] ? 0 : 1));
|
|
214
|
+
diag = up;
|
|
215
|
+
}
|
|
216
|
+
}
|
|
217
|
+
return prev[b.length] as number;
|
|
218
|
+
}
|
|
@@ -63,6 +63,8 @@ to decide in advance (constitution line 15).
|
|
|
63
63
|
|
|
64
64
|
## 5. Every handoff row is one more file `Schemas.load` reads at open
|
|
65
65
|
|
|
66
|
+
**Closed 2026-09-24** — F5 landed (store schema v6): bodies are rows, so there is no prose file to go missing; `MEMORY_BODY_MISSING` replaced `PROSE_FILE_MISSING` (`store/errors.ts`).
|
|
67
|
+
|
|
66
68
|
**Owner:** `store/` (F5 closes it).
|
|
67
69
|
**Needed:** nothing — this is recorded, not worked around.
|
|
68
70
|
**Have:** `Schemas.load` reads every `type: "schema"` row's prose at open, and on a v5 store
|
package/src/core/mint.ts
CHANGED
|
@@ -50,7 +50,7 @@
|
|
|
50
50
|
*/
|
|
51
51
|
import { TUNABLES as PHYSICS, clampSalienceAtSeam } from "./physics/index.js";
|
|
52
52
|
import type { Proposal } from "./remember/index.js";
|
|
53
|
-
import {
|
|
53
|
+
import { localDate } from "./time.js";
|
|
54
54
|
import type { Store } from "./store/index.js";
|
|
55
55
|
import type { Band, Salience } from "./types.js";
|
|
56
56
|
|
|
@@ -95,6 +95,14 @@ export interface MintOptions {
|
|
|
95
95
|
/** Explicit override. Absent, the direction is read off `updates.method` —
|
|
96
96
|
* see `directionOf`, which is where the rule and its reasons live. */
|
|
97
97
|
claimDirection?: ClaimDirection;
|
|
98
|
+
/**
|
|
99
|
+
* The model that wrote this deposit, as the host reported it (schema v7's
|
|
100
|
+
* `memories.model`). Host state, never an author field: the MCP server reads
|
|
101
|
+
* it off the session registry record (`mcp/server.ts`), the same relay a
|
|
102
|
+
* chapter's model takes. The sweep passes none — its words are an
|
|
103
|
+
* interpreter's retelling, not a named model's — and the column is NULL.
|
|
104
|
+
*/
|
|
105
|
+
model?: string;
|
|
98
106
|
}
|
|
99
107
|
|
|
100
108
|
export interface MintResult {
|
|
@@ -183,8 +191,11 @@ export function mintProposal(store: Store, proposal: Proposal, opts: MintOptions
|
|
|
183
191
|
// default (`store.today()`) is only the fallback for a proposal with no
|
|
184
192
|
// usable instant. The lived day is untouched: `physics.birthDay` below is
|
|
185
193
|
// still `proposal.day`, and the two clocks stay separate.
|
|
194
|
+
//
|
|
195
|
+
// In the person's zone since 2026-09-25 (docs/time.md rule 3): an 11:50 pm
|
|
196
|
+
// deposit belongs to that local day, not to the UTC one it is already in.
|
|
186
197
|
const learnedOn =
|
|
187
|
-
Number.isFinite(proposal.at) && proposal.at > 0 ?
|
|
198
|
+
Number.isFinite(proposal.at) && proposal.at > 0 ? localDate(proposal.at, store.zone()) : store.today();
|
|
188
199
|
|
|
189
200
|
const id = store.put({
|
|
190
201
|
type: "memory",
|
|
@@ -194,6 +205,7 @@ export function mintProposal(store: Store, proposal: Proposal, opts: MintOptions
|
|
|
194
205
|
...(proposal.title === null ? {} : { title: proposal.title }),
|
|
195
206
|
meta,
|
|
196
207
|
band: opts.band ?? "episodic",
|
|
208
|
+
...(opts.model === undefined ? {} : { model: opts.model }),
|
|
197
209
|
salience: clamp.salience,
|
|
198
210
|
physics: { birthDay: proposal.day, lastUsedDay: proposal.day },
|
|
199
211
|
// Engine-set provenance (F9-light): the channel as recorded fact, and ids
|
|
@@ -5,6 +5,8 @@ entry names the owner, the workaround now in the code, and what the real fix loo
|
|
|
5
5
|
|
|
6
6
|
## 1. The wiring into `recall/` — and the `arrival` NAME COLLISION
|
|
7
7
|
|
|
8
|
+
**Closed 2026-09-24** — a temporal cue enters through `core/retrieval.ts#composeTurn` → `recall/activate.ts` (the `temporal` channel, counted as cue in `cueFraction`); the footnote cap is `recall/gate.ts` `cue-only-temporal`.
|
|
9
|
+
|
|
8
10
|
**Owner:** the coordinator (a seam pass), not this module and not `recall/`.
|
|
9
11
|
**Needed:** contract §5 G1 — "a temporal cue enters `recall/` through the same activation
|
|
10
12
|
and gate path as any other cue; a test asserts no second injection path exists."
|
|
@@ -41,6 +43,16 @@ computes arrivals and nothing consumes them.
|
|
|
41
43
|
|
|
42
44
|
## 2. `ProseDoc` has no future-event date, and no enumeration of dated memories
|
|
43
45
|
|
|
46
|
+
**Storage closed 2026-09-25 (schema v7)** — `memories.event_date` (a day, month, year or
|
|
47
|
+
`a..b` range, read by `core/time.ts`, refused when unreadable), `ProseDoc.eventDate`,
|
|
48
|
+
`revise({ eventDate })` (null clears it; the old date stays in the version), a partial
|
|
49
|
+
index, and `Store.datedMemories(from, to)`. A new column rather than a widened
|
|
50
|
+
`happenedOn`, because `schemas/` already writes every belief's `statedOn` into
|
|
51
|
+
`happened_on` (store NOTES 2026-09-25). **Still open, for PR B:** nothing writes
|
|
52
|
+
`event_date` yet, and `arrivals()` / `exitReport()` still scan `store.list()` and read
|
|
53
|
+
`contentDates` (which keeps reading `happenedOn` and the `eventDate` meta convention); a
|
|
54
|
+
range is not yet a window precision (`windows.ts` knows day and month).
|
|
55
|
+
|
|
44
56
|
**Owner:** `store/`.
|
|
45
57
|
**Needed:** (a) somewhere canonical for "the date this memory is ABOUT, in the future";
|
|
46
58
|
(b) a way to ask which memories have one, without reading every memory.
|
|
@@ -71,6 +83,8 @@ seam it will use for the wiring in gap #1.
|
|
|
71
83
|
|
|
72
84
|
## 4. `store.revise` cannot patch `happenedOn`, so a reschedule cannot complete here
|
|
73
85
|
|
|
86
|
+
**Closed 2026-09-24** — `Store#revise` takes `happenedOn` in its patch (`store/index.ts`, schema v6). `Prospective.reschedule()` still leaves that revise to its caller.
|
|
87
|
+
|
|
74
88
|
**Owner:** `store/`.
|
|
75
89
|
**Needed:** §12 G8 — the correction "names the exact current value, carries a reason, and
|
|
76
90
|
archives the old."
|
|
@@ -19,6 +19,7 @@
|
|
|
19
19
|
*
|
|
20
20
|
* Pure: no ambient clock read anywhere in this file. The caller supplies `at`.
|
|
21
21
|
*/
|
|
22
|
+
import { addDays, daysBetween, isDay, monthBounds } from "../time.js";
|
|
22
23
|
import type { ProspectiveTunables } from "./tunables.js";
|
|
23
24
|
|
|
24
25
|
/** As stated. `2026` / `2026-08` / `2026-08-25` — the three shapes prose carries. */
|
|
@@ -46,29 +47,14 @@ export interface Window {
|
|
|
46
47
|
const DAY_RE = /^(\d{4})-(\d{2})-(\d{2})$/;
|
|
47
48
|
const MONTH_RE = /^(\d{4})-(\d{2})$/;
|
|
48
49
|
const YEAR_RE = /^\d{4}$/;
|
|
49
|
-
const DAY_MS = 86_400_000;
|
|
50
50
|
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
if (m === null) return null;
|
|
59
|
-
const y = Number(m[1]);
|
|
60
|
-
const mo = Number(m[2]);
|
|
61
|
-
const d = Number(m[3]);
|
|
62
|
-
if (mo < 1 || mo > 12 || d < 1 || d > 31) return null;
|
|
63
|
-
const ms = Date.UTC(y, mo - 1, d);
|
|
64
|
-
// Round-trip: rejects 2026-02-30 and friends without a calendar table.
|
|
65
|
-
return isoOf(ms) === iso ? ms : null;
|
|
66
|
-
}
|
|
67
|
-
|
|
68
|
-
function isoOf(ms: number): string {
|
|
69
|
-
const t = new Date(ms);
|
|
70
|
-
return `${t.getUTCFullYear()}-${pad(t.getUTCMonth() + 1)}-${pad(t.getUTCDate())}`;
|
|
71
|
-
}
|
|
51
|
+
/**
|
|
52
|
+
* The calendar arithmetic is `core/time.ts`'s (2026-09-25, docs/time.md rule 1).
|
|
53
|
+
* It used to live here on the UTC getters — correct, since a stated day is a
|
|
54
|
+
* label and not a moment, but a second copy of the one conversion module's job.
|
|
55
|
+
* Re-exported so `prospective/`'s public surface is unchanged.
|
|
56
|
+
*/
|
|
57
|
+
export { addDays, daysBetween, monthBounds };
|
|
72
58
|
|
|
73
59
|
/**
|
|
74
60
|
* The precision a date STATES. Null means "not a date this module understands",
|
|
@@ -76,7 +62,7 @@ function isoOf(ms: number): string {
|
|
|
76
62
|
* silent skip (scar §2.4).
|
|
77
63
|
*/
|
|
78
64
|
export function precisionOf(date: string): DatePrecision | null {
|
|
79
|
-
if (DAY_RE.test(date)) return
|
|
65
|
+
if (DAY_RE.test(date)) return isDay(date) ? "day" : null;
|
|
80
66
|
const m = MONTH_RE.exec(date);
|
|
81
67
|
if (m !== null) {
|
|
82
68
|
const mo = Number(m[2]);
|
|
@@ -85,30 +71,6 @@ export function precisionOf(date: string): DatePrecision | null {
|
|
|
85
71
|
return YEAR_RE.test(date) ? "year" : null;
|
|
86
72
|
}
|
|
87
73
|
|
|
88
|
-
export function addDays(isoDay: string, n: number): string {
|
|
89
|
-
const ms = dayMs(isoDay);
|
|
90
|
-
if (ms === null) throw new Error(`addDays: not an ISO day: ${isoDay}`);
|
|
91
|
-
return isoOf(ms + n * DAY_MS);
|
|
92
|
-
}
|
|
93
|
-
|
|
94
|
-
/** Calendar days from `a` to `b`; negative when `b` is earlier. */
|
|
95
|
-
export function daysBetween(a: string, b: string): number {
|
|
96
|
-
const x = dayMs(a);
|
|
97
|
-
const y = dayMs(b);
|
|
98
|
-
if (x === null || y === null) throw new Error(`daysBetween: not ISO days: ${a}, ${b}`);
|
|
99
|
-
return Math.round((y - x) / DAY_MS);
|
|
100
|
-
}
|
|
101
|
-
|
|
102
|
-
/** First and last day of a stated `YYYY-MM`. */
|
|
103
|
-
export function monthBounds(month: string): { first: string; last: string } | null {
|
|
104
|
-
const m = MONTH_RE.exec(month);
|
|
105
|
-
if (m === null) return null;
|
|
106
|
-
const y = Number(m[1]);
|
|
107
|
-
const mo = Number(m[2]);
|
|
108
|
-
if (mo < 1 || mo > 12) return null;
|
|
109
|
-
return { first: `${y}-${pad(mo)}-01`, last: isoOf(Date.UTC(y, mo, 0)) };
|
|
110
|
-
}
|
|
111
|
-
|
|
112
74
|
export function windowKey(eventDate: string, precision: WindowPrecision): string {
|
|
113
75
|
return `${precision === "day" ? "d" : "m"}:${eventDate}`;
|
|
114
76
|
}
|
|
@@ -137,7 +99,7 @@ export function windowFor(
|
|
|
137
99
|
): Window | null {
|
|
138
100
|
if (precision === "year") return null;
|
|
139
101
|
if (precision === "day") {
|
|
140
|
-
if (
|
|
102
|
+
if (!isDay(eventDate)) return null;
|
|
141
103
|
return {
|
|
142
104
|
key: windowKey(eventDate, "day"),
|
|
143
105
|
eventDate,
|