refactor: align dreaming status with sqlite labels

This commit is contained in:
Peter Steinberger
2026-05-09 06:42:30 +01:00
parent b91d1dec9c
commit bba0ccfbf4
2 changed files with 12 additions and 6 deletions

View File

@@ -100,6 +100,8 @@ describe("dreaming controller", () => {
remPhaseHitCount: 4,
promotedTotal: 21,
promotedToday: 2,
storeLabel: "sqlite:plugin_state_entries/memory-core/dreaming.short-term-recall",
phaseSignalLabel: "sqlite:plugin_state_entries/memory-core/dreaming.phase-signals",
shortTermEntries: [
{
key: "memory:memory/2026-04-05.md:1:2",
@@ -194,6 +196,10 @@ describe("dreaming controller", () => {
expect(status?.totalSignalCount).toBe(20);
expect(status?.phaseSignalCount).toBe(11);
expect(status?.promotedToday).toBe(2);
expect(status?.storeLabel).toBe("sqlite:plugin_state_entries/memory-core/dreaming.short-term-recall");
expect(status?.phaseSignalLabel).toBe(
"sqlite:plugin_state_entries/memory-core/dreaming.phase-signals",
);
expect(status?.shortTermEntries).toHaveLength(1);
expect(status?.shortTermEntries[0]?.snippet).toBe(
"Emma prefers shorter, lower-pressure check-ins.",

View File

@@ -67,8 +67,8 @@ export type DreamingStatus = {
remPhaseHitCount: number;
promotedTotal: number;
promotedToday: number;
storePath?: string;
phaseSignalPath?: string;
storeLabel?: string;
phaseSignalLabel?: string;
storeError?: string;
phaseSignalError?: string;
shortTermEntries: DreamingEntry[];
@@ -683,8 +683,8 @@ function normalizeDreamingStatus(raw: unknown): DreamingStatus | null {
}
: undefined;
const timezone = normalizeTrimmedString(record.timezone);
const storePath = normalizeTrimmedString(record.storePath);
const phaseSignalPath = normalizeTrimmedString(record.phaseSignalPath);
const storeLabel = normalizeTrimmedString(record.storeLabel);
const phaseSignalLabel = normalizeTrimmedString(record.phaseSignalLabel);
const storeError = normalizeTrimmedString(record.storeError);
const phaseSignalError = normalizeTrimmedString(record.phaseSignalError);
@@ -704,8 +704,8 @@ function normalizeDreamingStatus(raw: unknown): DreamingStatus | null {
remPhaseHitCount: normalizeFiniteInt(record.remPhaseHitCount, 0),
promotedTotal: normalizeFiniteInt(record.promotedTotal, 0),
promotedToday: normalizeFiniteInt(record.promotedToday, 0),
...(storePath ? { storePath } : {}),
...(phaseSignalPath ? { phaseSignalPath } : {}),
...(storeLabel ? { storeLabel } : {}),
...(phaseSignalLabel ? { phaseSignalLabel } : {}),
...(storeError ? { storeError } : {}),
...(phaseSignalError ? { phaseSignalError } : {}),
shortTermEntries: normalizeDreamingEntries(record.shortTermEntries),