hippo-memory 3.3.3 → 3.5.1
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/README.md +4 -4
- package/dist/api/callers.d.ts +4 -1
- package/dist/api/context/context-plan.js +3 -0
- package/dist/api/context/context-pools.js +4 -1
- package/dist/api/context/user-rule.js +2 -1
- package/dist/api/dashboard/detail.js +2 -1
- package/dist/api/dashboard/live.d.ts +0 -4
- package/dist/api/dashboard/live.js +0 -8
- package/dist/api/memories/conflicts.d.ts +2 -1
- package/dist/api/memories/conflicts.js +3 -8
- package/dist/api/memories/promote.js +6 -2
- package/dist/api/objects/object-kinds.d.ts +1 -4
- package/dist/api/objects/object-kinds.js +1 -5
- package/dist/api/recall/compose.js +2 -1
- package/dist/api/recall/rank-stages.js +2 -1
- package/dist/api/recall/rows.js +2 -1
- package/dist/api/session-end.d.ts +3 -2
- package/dist/api/session-end.js +8 -4
- package/dist/api/sharing.d.ts +4 -3
- package/dist/api/sharing.js +2 -2
- package/dist/api/sleep/auto-sleep.d.ts +3 -2
- package/dist/api/sleep/auto-sleep.js +16 -3
- package/dist/api/sleep/one-sleep.d.ts +23 -0
- package/dist/api/sleep/one-sleep.js +53 -0
- package/dist/api/sleep/sleep-run.js +2 -1
- package/dist/api/sleep/sleep.d.ts +5 -0
- package/dist/api/sleep/sleep.js +2 -1
- package/dist/api/summary-parents.js +2 -1
- package/dist/base/config/config-keys.js +1 -0
- package/dist/base/config/config.d.ts +2 -0
- package/dist/base/config/config.js +1 -0
- package/dist/base/embeddings/local.d.ts +1 -1
- package/dist/base/embeddings/local.js +2 -3
- package/dist/base/memory/ambient.js +2 -1
- package/dist/base/memory/entry.d.ts +4 -1
- package/dist/base/memory/entry.js +7 -1
- package/dist/base/memory/half-life-plan.js +6 -4
- package/dist/base/memory/keep-rules.js +2 -1
- package/dist/base/memory/liveness.d.ts +7 -0
- package/dist/base/memory/liveness.js +6 -0
- package/dist/base/memory/markdown.js +15 -5
- package/dist/base/memory/memory-audit.js +2 -1
- package/dist/base/memory/memory-facts.d.ts +0 -2
- package/dist/base/memory/memory-facts.js +0 -2
- package/dist/base/memory/merged-row.js +3 -2
- package/dist/base/memory/rule-replaces.js +2 -1
- package/dist/base/memory/stale-mark.d.ts +9 -0
- package/dist/base/memory/stale-mark.js +18 -0
- package/dist/base/ports/store/capture.d.ts +2 -0
- package/dist/base/ports/store/conflicts.d.ts +5 -1
- package/dist/base/ports/store/conflicts.js +2 -0
- package/dist/base/ports/store/consolidation.d.ts +66 -2
- package/dist/base/ports/store/consolidation.js +5 -0
- package/dist/base/ports/store/context-reads.d.ts +2 -0
- package/dist/base/ports/store/objects.d.ts +15 -4
- package/dist/base/ports/store/sessions.d.ts +8 -2
- package/dist/base/ports/store/sessions.js +6 -0
- package/dist/base/ports/store/store-effects.d.ts +5 -0
- package/dist/base/ports/store.d.ts +1 -1
- package/dist/base/scope/live-memory.d.ts +7 -0
- package/dist/base/scope/live-memory.js +10 -0
- package/dist/base/scope/read-admission.d.ts +2 -0
- package/dist/base/scope/read-admission.js +9 -2
- package/dist/base/util/version.d.ts +1 -1
- package/dist/base/util/version.js +1 -1
- package/dist/db/continuity-tables.d.ts +4 -1
- package/dist/db/continuity-tables.js +21 -12
- package/dist/db/migrate.js +2 -2
- package/dist/db/migrations/index.d.ts +1 -1
- package/dist/db/migrations/index.js +5 -1
- package/dist/db/migrations/v61.js +3 -3
- package/dist/db/migrations/v62.d.ts +3 -0
- package/dist/db/migrations/v62.js +43 -0
- package/dist/db/migrations/v63.d.ts +3 -0
- package/dist/db/migrations/v63.js +9 -0
- package/dist/db/required-objects.js +2 -1
- package/dist/db/sql-predicates.d.ts +22 -2
- package/dist/db/sql-predicates.js +27 -2
- package/dist/domain/agent-memories/apply.js +2 -1
- package/dist/domain/agent-memories/container-view.js +2 -1
- package/dist/domain/consolidate/conflicts.js +2 -1
- package/dist/domain/consolidate/dag-summary.d.ts +2 -0
- package/dist/domain/consolidate/dag.d.ts +3 -0
- package/dist/domain/consolidate/dag.js +53 -8
- package/dist/domain/consolidate/dedupe.js +2 -1
- package/dist/domain/consolidate/events.d.ts +2 -0
- package/dist/domain/consolidate/llm-passes.js +94 -20
- package/dist/domain/consolidate/merge.js +11 -10
- package/dist/domain/consolidate/retry-holds.d.ts +14 -0
- package/dist/domain/consolidate/retry-holds.js +26 -0
- package/dist/domain/consolidate/run.d.ts +8 -0
- package/dist/domain/consolidate/run.js +2 -0
- package/dist/domain/consolidate/tombstones.d.ts +3 -4
- package/dist/domain/consolidate/tombstones.js +3 -3
- package/dist/domain/graph/recall.js +3 -2
- package/dist/domain/learn/churn-stale.js +2 -1
- package/dist/domain/learn/extract.d.ts +10 -0
- package/dist/domain/learn/extract.js +10 -5
- package/dist/domain/learn/invalidation.d.ts +1 -1
- package/dist/domain/learn/invalidation.js +4 -11
- package/dist/domain/objects/decisions.d.ts +4 -7
- package/dist/domain/objects/decisions.js +1 -14
- package/dist/domain/objects/descriptor.d.ts +2 -0
- package/dist/domain/objects/lifecycle.js +8 -2
- package/dist/domain/search/as-of.js +3 -2
- package/dist/domain/sharing/share.d.ts +16 -4
- package/dist/domain/sharing/share.js +33 -17
- package/dist/entry/store-kit.js +2 -1
- package/dist/infra/local-embedder.js +14 -2
- package/dist/infra/spool-claims.d.ts +2 -2
- package/dist/infra/spool-claims.js +4 -3
- package/dist/infra/spool-import.js +1 -1
- package/dist/infra/spool-record.d.ts +3 -1
- package/dist/store/sqlite/capture/compaction-hooks.js +14 -6
- package/dist/store/sqlite/capture/compaction-rows.js +9 -2
- package/dist/store/sqlite/capture/spool-request-id.d.ts +3 -0
- package/dist/store/sqlite/capture/spool-request-id.js +12 -0
- package/dist/store/sqlite/connectors/quarantine.js +13 -4
- package/dist/store/sqlite/consolidation/consolidation-summaries.d.ts +4 -5
- package/dist/store/sqlite/consolidation/consolidation-summaries.js +46 -26
- package/dist/store/sqlite/consolidation/consolidation.js +7 -0
- package/dist/store/sqlite/consolidation/empty-extractions.d.ts +14 -0
- package/dist/store/sqlite/consolidation/empty-extractions.js +57 -0
- package/dist/store/sqlite/consolidation/rebuild-holds.d.ts +21 -0
- package/dist/store/sqlite/consolidation/rebuild-holds.js +68 -0
- package/dist/store/sqlite/consolidation/sleep-lock.d.ts +4 -0
- package/dist/store/sqlite/consolidation/sleep-lock.js +69 -0
- package/dist/store/sqlite/entries/entry-filter.js +3 -3
- package/dist/store/sqlite/entries/entry-reads.js +2 -1
- package/dist/store/sqlite/entries/entry-row.js +5 -1
- package/dist/store/sqlite/entries/entry-writes.js +9 -15
- package/dist/store/sqlite/entries/raw-archive.d.ts +2 -1
- package/dist/store/sqlite/entries/raw-archive.js +12 -3
- package/dist/store/sqlite/maintenance/agent-import-steps.js +7 -2
- package/dist/store/sqlite/maintenance/project-tags.js +4 -3
- package/dist/store/sqlite/recall/candidates.js +12 -11
- package/dist/store/sqlite/recall/search-rows.d.ts +3 -0
- package/dist/store/sqlite/recall/search-rows.js +26 -9
- package/dist/store/sqlite/records/object-rows.d.ts +2 -0
- package/dist/store/sqlite/records/object-rows.js +5 -1
- package/dist/store/sqlite/records/object-writes.d.ts +3 -0
- package/dist/store/sqlite/records/object-writes.js +43 -1
- package/dist/store/sqlite/reports/dashboard-lists.js +3 -2
- package/dist/store/sqlite/reports/dashboard-reads.js +5 -3
- package/dist/store/sqlite/reports/dashboard-sql.d.ts +0 -3
- package/dist/store/sqlite/reports/dashboard-sql.js +2 -9
- package/dist/store/sqlite/reports/reports.js +2 -1
- package/dist/store/sqlite/review/conflicts.js +10 -5
- package/dist/store/sqlite/runtime/rule-sql.d.ts +1 -0
- package/dist/store/sqlite/runtime/rule-sql.js +4 -1
- package/dist/store/sqlite/runtime/status-transitions.d.ts +98 -0
- package/dist/store/sqlite/runtime/status-transitions.js +105 -0
- package/dist/store/sqlite/sessions/goals.js +11 -12
- package/dist/store/sqlite/sessions/sessions.d.ts +1 -1
- package/dist/store/sqlite/sessions/sessions.js +20 -8
- package/dist/surface/capture/session-worker.d.ts +3 -2
- package/dist/surface/capture/session-worker.js +36 -10
- package/dist/surface/cli/api-context.js +2 -1
- package/dist/surface/cli/client.d.ts +6 -5
- package/dist/surface/cli/client.js +50 -19
- package/dist/surface/cli/conflicts.js +12 -1
- package/dist/surface/cli/continuity.js +4 -0
- package/dist/surface/cli/decisions.js +16 -17
- package/dist/surface/cli/hooks/session-end-worker.js +3 -2
- package/dist/surface/cli/install-steps.js +99 -13
- package/dist/surface/cli/memory-writes.js +3 -2
- package/dist/surface/cli/print.js +2 -1
- package/dist/surface/cli/sleep-render.js +7 -0
- package/dist/surface/cli/sleep.d.ts +3 -2
- package/dist/surface/cli/sleep.js +10 -4
- package/dist/surface/cli/transfer.js +6 -3
- package/dist/surface/cli/verbs/objects.js +2 -2
- package/dist/surface/dashboard/dashboard-actions.js +1 -1
- package/dist/surface/hooks-install/codex-wrapper.js +52 -11
- package/dist/surface/hooks-install/rules/hook-blocks.js +9 -2
- package/dist/surface/mcp/admin-tools.js +5 -2
- package/dist/surface/render/sleep-events.js +2 -0
- package/dist/surface/server/routes/decisions.js +2 -2
- package/dist/surface/server/sleep-child.js +5 -4
- package/dist/surface/server/sleep-offload.js +36 -25
- package/dist-ui/assets/index-Cst0ubfs.js +1 -0
- package/dist-ui/index.html +1 -1
- package/extensions/openclaw-plugin/openclaw.plugin.json +1 -1
- package/extensions/openclaw-plugin/package.json +1 -1
- package/openclaw.plugin.json +1 -1
- package/package.json +1 -1
- package/dist-ui/assets/index-Q9SY-1Bj.js +0 -1
|
@@ -78,6 +78,8 @@ export interface HippoConfig {
|
|
|
78
78
|
promptRecallMaxItems: number;
|
|
79
79
|
/** FTS candidate pool size per store before gating. Default 100. */
|
|
80
80
|
promptRecallCandidates: number;
|
|
81
|
+
/** Tags the hook block leaves out: a row carrying any is no pin, recent or recall candidate. Default []. */
|
|
82
|
+
excludeTags?: string[];
|
|
81
83
|
};
|
|
82
84
|
/** Memory scope isolation (default true): ambient context (`hippo context`, the hook,
|
|
83
85
|
* /v1/context, MCP hippo_context) excludes OTHER projects' memories; explicit recall is
|
|
@@ -8,7 +8,7 @@ export interface TransformersPackage {
|
|
|
8
8
|
}
|
|
9
9
|
/** The installed package to import, or null when neither is installed. */
|
|
10
10
|
export declare function resolveTransformersPackage(): TransformersPackage | null;
|
|
11
|
-
/**
|
|
11
|
+
/** Whether @xenova/transformers or @huggingface/transformers is installed, resolved afresh on every call. */
|
|
12
12
|
export declare function isEmbeddingAvailable(): boolean;
|
|
13
13
|
export declare function resolveEmbeddingModel(embeddings: EmbeddingsConfig, explicitModel?: string): string;
|
|
14
14
|
//# sourceMappingURL=local.d.ts.map
|
|
@@ -33,10 +33,9 @@ function entryUrl(name) {
|
|
|
33
33
|
const viaRequire = ignoringCodes(NOT_INSTALLED, () => _require.resolve(name));
|
|
34
34
|
return viaRequire === undefined ? null : pathToFileURL(viaRequire).href;
|
|
35
35
|
}
|
|
36
|
-
|
|
37
|
-
/** Check (synchronously) if @xenova/transformers or @huggingface/transformers is installed. */
|
|
36
|
+
/** Whether @xenova/transformers or @huggingface/transformers is installed, resolved afresh on every call. */
|
|
38
37
|
export function isEmbeddingAvailable() {
|
|
39
|
-
return
|
|
38
|
+
return resolveTransformersPackage() !== null;
|
|
40
39
|
}
|
|
41
40
|
export function resolveEmbeddingModel(embeddings, explicitModel) {
|
|
42
41
|
const direct = explicitModel?.trim();
|
|
@@ -6,6 +6,7 @@ import { Layer } from './entry.js';
|
|
|
6
6
|
import { calculateStrength } from './strength.js';
|
|
7
7
|
import { ERROR_TAG, HIGH_SCHEMA_FIT } from './entry.js';
|
|
8
8
|
import { DAY_MS } from '../util/time.js';
|
|
9
|
+
import { isSuperseded } from './liveness.js';
|
|
9
10
|
const STATE_DECIMALS = 3;
|
|
10
11
|
// Cut points renderAmbientSummary uses to turn the state vector into words.
|
|
11
12
|
const SUMMARY_THRESHOLD = {
|
|
@@ -78,7 +79,7 @@ export function foldAmbientRows(t, entries, currentTime, model) {
|
|
|
78
79
|
const freshAfter = currentTime.getTime() - AMBIENT_FRESH_WINDOW_MS;
|
|
79
80
|
t.total += entries.length;
|
|
80
81
|
for (const entry of entries) {
|
|
81
|
-
if (entry
|
|
82
|
+
if (isSuperseded(entry))
|
|
82
83
|
continue;
|
|
83
84
|
for (const tag of entry.tags)
|
|
84
85
|
t.tagCounts.set(tag, (t.tagCounts.get(tag) ?? 0) + 1);
|
|
@@ -7,7 +7,10 @@ export declare enum Layer {
|
|
|
7
7
|
Trace = "trace"
|
|
8
8
|
}
|
|
9
9
|
export type EmotionalValence = 'neutral' | 'positive' | 'negative' | 'critical';
|
|
10
|
-
export
|
|
10
|
+
export declare const CONFIDENCE_LEVELS: readonly ["verified", "observed", "inferred", "stale"];
|
|
11
|
+
export type ConfidenceLevel = (typeof CONFIDENCE_LEVELS)[number];
|
|
12
|
+
/** True when `value` is one of the four stored confidence tiers. */
|
|
13
|
+
export declare function isConfidenceLevel(value: string): value is ConfidenceLevel;
|
|
11
14
|
export type TraceOutcome = 'success' | 'failure' | 'partial' | null;
|
|
12
15
|
export declare const MEMORY_KINDS: readonly ["raw", "distilled", "superseded", "archived"];
|
|
13
16
|
export type MemoryKind = (typeof MEMORY_KINDS)[number];
|
|
@@ -7,6 +7,7 @@ import { isJsonString } from '../util/json.js';
|
|
|
7
7
|
import { tokenizeMin } from '../util/tokenize.js';
|
|
8
8
|
import { ID_SUFFIX_CHARS } from '../util/token-text.js';
|
|
9
9
|
import { calculateStrength, netWrong, PRODUCTION_STRENGTH, } from './strength.js';
|
|
10
|
+
import { isSuperseded } from './liveness.js';
|
|
10
11
|
export const DEFAULT_SCHEMA_FIT = 0.5;
|
|
11
12
|
export var Layer;
|
|
12
13
|
(function (Layer) {
|
|
@@ -15,6 +16,11 @@ export var Layer;
|
|
|
15
16
|
Layer["Semantic"] = "semantic";
|
|
16
17
|
Layer["Trace"] = "trace";
|
|
17
18
|
})(Layer || (Layer = {}));
|
|
19
|
+
export const CONFIDENCE_LEVELS = ['verified', 'observed', 'inferred', 'stale'];
|
|
20
|
+
/** True when `value` is one of the four stored confidence tiers. */
|
|
21
|
+
export function isConfidenceLevel(value) {
|
|
22
|
+
return CONFIDENCE_LEVELS.some((level) => level === value);
|
|
23
|
+
}
|
|
18
24
|
export const MEMORY_KINDS = ['raw', 'distilled', 'superseded', 'archived'];
|
|
19
25
|
/** Named dag_level values; level 0 is a raw leaf. */
|
|
20
26
|
export const DAG_LEVEL = { extracted: 1, topic: 2, entity: 3 };
|
|
@@ -238,7 +244,7 @@ export function markRetrieved(entries, now, model) {
|
|
|
238
244
|
if (!model.recallStrengthens)
|
|
239
245
|
return entries;
|
|
240
246
|
return entries.map((e) => {
|
|
241
|
-
if (e
|
|
247
|
+
if (isSuperseded(e))
|
|
242
248
|
return e;
|
|
243
249
|
const wrong = netWrong(e, model) > 0;
|
|
244
250
|
// Confidence stays untouched: it is an epistemic tier, not a recency signal.
|
|
@@ -2,7 +2,9 @@
|
|
|
2
2
|
// goes. Pure, so the store runs it inside the move's own write scope and plan, write and audit stay
|
|
3
3
|
// one transaction.
|
|
4
4
|
import { deriveHalfLife } from './entry.js';
|
|
5
|
+
import { INVALIDATED_TAG, SUPERSEDED_TAG } from './stale-mark.js';
|
|
5
6
|
import { LEGACY_TYPED_HALF_LIFE } from './strength.js';
|
|
7
|
+
import { isSuperseded } from './liveness.js';
|
|
6
8
|
const TYPED_SOURCES = new Set([
|
|
7
9
|
'decision',
|
|
8
10
|
'incident',
|
|
@@ -15,9 +17,9 @@ const TYPED_SOURCES = new Set([
|
|
|
15
17
|
/** Recall bonus over `written`, the half-life `entry` got at write, or null when off it; each
|
|
16
18
|
* recall added 2 days. */
|
|
17
19
|
export function halfLifeRecallBonus(entry, written) {
|
|
18
|
-
if (entry
|
|
19
|
-
entry.tags.includes(
|
|
20
|
-
entry.tags.includes(
|
|
20
|
+
if (isSuperseded(entry) ||
|
|
21
|
+
entry.tags.includes(INVALIDATED_TAG) ||
|
|
22
|
+
entry.tags.includes(SUPERSEDED_TAG)) {
|
|
21
23
|
return null;
|
|
22
24
|
}
|
|
23
25
|
const bonus = entry.halfLifeDays - written;
|
|
@@ -68,7 +70,7 @@ function planMoves(rows, to) {
|
|
|
68
70
|
let count = 0;
|
|
69
71
|
for (const { entry: e, object } of rows.rows) {
|
|
70
72
|
count++;
|
|
71
|
-
if (e
|
|
73
|
+
if (isSuperseded(e))
|
|
72
74
|
copies.add(e.supersededBy);
|
|
73
75
|
const base = baseTarget(e, rows.from, to);
|
|
74
76
|
const typed = typedPending ? typedTarget(e, to) : null;
|
|
@@ -1,13 +1,14 @@
|
|
|
1
1
|
// Which memories sleep may never delete, and how an outcome mark changes an entry.
|
|
2
2
|
import { AGENT_MEMORY_TOOLS, toolSourcePrefix } from './agent-memory-tools.js';
|
|
3
3
|
import { CHURN_STALE_TAG } from './entry.js';
|
|
4
|
+
import { isSuperseded } from './liveness.js';
|
|
4
5
|
import { calculateStrength } from './strength.js';
|
|
5
6
|
export const KEEP_PAIRS = AGENT_MEMORY_TOOLS.map((t) => ({
|
|
6
7
|
tag: t.tag,
|
|
7
8
|
sourcePrefix: toolSourcePrefix(t.id),
|
|
8
9
|
}));
|
|
9
10
|
export function isKeptForGood(entry) {
|
|
10
|
-
return (!entry
|
|
11
|
+
return (!isSuperseded(entry) &&
|
|
11
12
|
KEEP_PAIRS.some((p) => entry.tags.includes(p.tag) && entry.source.startsWith(p.sourcePrefix)));
|
|
12
13
|
}
|
|
13
14
|
export function canAutoDelete(entry) {
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
/** True when the memory has a successor link of any value, a blank one included. */
|
|
2
|
+
export declare function isSuperseded<T extends {
|
|
3
|
+
readonly supersededBy?: string | null;
|
|
4
|
+
}>(entry: T): entry is T & {
|
|
5
|
+
readonly supersededBy: string;
|
|
6
|
+
};
|
|
7
|
+
//# sourceMappingURL=liveness.d.ts.map
|
|
@@ -0,0 +1,6 @@
|
|
|
1
|
+
// A blank link counts as superseded: the CAS guard, recall and three partial indexes read it so.
|
|
2
|
+
/** True when the memory has a successor link of any value, a blank one included. */
|
|
3
|
+
export function isSuperseded(entry) {
|
|
4
|
+
return entry.supersededBy !== null && entry.supersededBy !== undefined;
|
|
5
|
+
}
|
|
6
|
+
//# sourceMappingURL=liveness.js.map
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { DEFAULT_TENANT_ID } from '../util/tenant.js';
|
|
2
|
-
import { DEFAULT_SCHEMA_FIT, } from './entry.js';
|
|
2
|
+
import { DEFAULT_SCHEMA_FIT, isConfidenceLevel, } from './entry.js';
|
|
3
3
|
import { FALLBACK_HALF_LIFE_DAYS } from './strength.js';
|
|
4
4
|
import { fromWire, toWire } from './memory-wire.js';
|
|
5
5
|
import { dumpFrontmatter, parseFrontmatter } from '../util/yaml.js';
|
|
@@ -79,9 +79,8 @@ export function deserializeEntry(raw, now) {
|
|
|
79
79
|
});
|
|
80
80
|
}
|
|
81
81
|
function scoringWireOf(data, now) {
|
|
82
|
-
// SAFETY: each `as X` narrows a raw YAML field to a MemoryWire union member
|
|
83
|
-
//
|
|
84
|
-
// accept (permissive parse).
|
|
82
|
+
// SAFETY: each `as X` narrows a raw YAML field to a MemoryWire union member, so a hand-edited
|
|
83
|
+
// value outside it parses through. Confidence alone is checked: it becomes a stored tier.
|
|
85
84
|
return {
|
|
86
85
|
id: String(data['id']),
|
|
87
86
|
created: String(data['created'] ?? now.toISOString()),
|
|
@@ -101,9 +100,20 @@ function scoringWireOf(data, now) {
|
|
|
101
100
|
outcome_negative: Number(data['outcome_negative'] ?? 0),
|
|
102
101
|
conflicts_with: normalizeStringArray(data['conflicts_with']),
|
|
103
102
|
pinned: Boolean(data['pinned'] ?? false),
|
|
104
|
-
confidence: data
|
|
103
|
+
confidence: confidenceOf(data),
|
|
105
104
|
};
|
|
106
105
|
}
|
|
106
|
+
function confidenceOf(data) {
|
|
107
|
+
const given = data['confidence'];
|
|
108
|
+
// This parser reads a bare `confidence:` line as '', so it counts as missing like null.
|
|
109
|
+
const value = given === undefined || given === null || given === '' ? 'observed' : given;
|
|
110
|
+
const text = String(value);
|
|
111
|
+
if (isConfidenceLevel(text))
|
|
112
|
+
return text;
|
|
113
|
+
throw new Error(`memory ${String(data['id'])}: unknown confidence ${JSON.stringify(value)}; ` +
|
|
114
|
+
'use verified, observed, inferred or stale; the file stays on disk, ' +
|
|
115
|
+
'and deleting hippo.db to rebuild is safe only before any new write');
|
|
116
|
+
}
|
|
107
117
|
function lineageWireOf(data, now) {
|
|
108
118
|
// SAFETY: each `as X` narrows a raw YAML field to a MemoryWire union member; frontmatter is only
|
|
109
119
|
// written by serializeEntry, so out-of-range values mean hand-edited files, which this parser may
|
|
@@ -2,6 +2,7 @@
|
|
|
2
2
|
import { canAutoDelete, isKeptForGood } from './keep-rules.js';
|
|
3
3
|
import { automaticDefect, BUNDLE_HEADER, isAutomaticEntry, isCertainReason, isFragment, isReleaseCommitNoise, isShortAndUnspecific, MIN_MEMORY_CHARS, MIN_SUBSTANTIVE_WORDS, storedDefect, substantiveWordCount, } from './memory-quality.js';
|
|
4
4
|
import { heldTexts } from '../util/same-text.js';
|
|
5
|
+
import { isSuperseded } from './liveness.js';
|
|
5
6
|
export function auditMemory(entry, backsObject = false) {
|
|
6
7
|
const issue = classifyMemory(entry);
|
|
7
8
|
// Error means "auto-remove"; a pinned, raw, kept-for-good or object-backing row is never
|
|
@@ -90,7 +91,7 @@ export function repairKeeps(entry, backsObject, protection) {
|
|
|
90
91
|
}
|
|
91
92
|
/** The rows quality repair judges: a superseded or archived row is already out of recall. */
|
|
92
93
|
export function isRepairCandidate(entry) {
|
|
93
|
-
return !entry
|
|
94
|
+
return !isSuperseded(entry) && entry.kind !== 'archived';
|
|
94
95
|
}
|
|
95
96
|
function structured(entry) {
|
|
96
97
|
return (entry.traceOutcome !== null ||
|
|
@@ -3,8 +3,6 @@ import { Layer, type MemoryEntry } from './entry.js';
|
|
|
3
3
|
export declare const BAND_AT_RISK = 3;
|
|
4
4
|
/** Layers in the dashboard's wire order; a layer's index is its place here. */
|
|
5
5
|
export declare const LAYER_ORDER: readonly [Layer.Buffer, Layer.Episodic, Layer.Semantic, Layer.Trace];
|
|
6
|
-
/** Confidence tiers in sort order; any other tier sorts after them. */
|
|
7
|
-
export declare const CONFIDENCE_ORDER: readonly ["verified", "observed", "inferred", "stale"];
|
|
8
6
|
/** Days of created history the dashboard's series spans; an older row counts at its first point. */
|
|
9
7
|
export declare const SERIES_DAYS = 90;
|
|
10
8
|
export interface MemoryFacts {
|
|
@@ -11,8 +11,6 @@ const BAND_FADING = 2;
|
|
|
11
11
|
export const BAND_AT_RISK = 3;
|
|
12
12
|
/** Layers in the dashboard's wire order; a layer's index is its place here. */
|
|
13
13
|
export const LAYER_ORDER = [Layer.Buffer, Layer.Episodic, Layer.Semantic, Layer.Trace];
|
|
14
|
-
/** Confidence tiers in sort order; any other tier sorts after them. */
|
|
15
|
-
export const CONFIDENCE_ORDER = ['verified', 'observed', 'inferred', 'stale'];
|
|
16
14
|
/** Days of created history the dashboard's series spans; an older row counts at its first point. */
|
|
17
15
|
export const SERIES_DAYS = 90;
|
|
18
16
|
const AHEAD_7D_MS = 7 * DAY_MS;
|
|
@@ -4,6 +4,7 @@
|
|
|
4
4
|
// only once restored.
|
|
5
5
|
import { generateId } from './entry.js';
|
|
6
6
|
import { duplicateKey, heldTexts, mergedText } from '../util/same-text.js';
|
|
7
|
+
import { isSuperseded } from './liveness.js';
|
|
7
8
|
/**
|
|
8
9
|
* The row that replaces a merged row once its retired texts leave: undefined when it holds none,
|
|
9
10
|
* null when nothing else is left.
|
|
@@ -34,10 +35,10 @@ export function mergedSuccessor(row, retired, retiredIds) {
|
|
|
34
35
|
* rejection now covers.
|
|
35
36
|
*/
|
|
36
37
|
export function successorAfterRetirement(row, byId, rejected) {
|
|
37
|
-
if (row.source !== 'consolidation' || row
|
|
38
|
+
if (row.source !== 'consolidation' || isSuperseded(row))
|
|
38
39
|
return undefined;
|
|
39
40
|
const sources = row.parents.flatMap((id) => byId.get(id) ?? []);
|
|
40
|
-
const retiredIds = new Set(sources.filter((s) =>
|
|
41
|
+
const retiredIds = new Set(sources.filter((s) => isSuperseded(s) || rejected(s.content)).map((s) => s.id));
|
|
41
42
|
const live = new Set(sources.filter((s) => !retiredIds.has(s.id)).map((s) => duplicateKey(s.content)));
|
|
42
43
|
const gone = new Set(sources.filter((s) => retiredIds.has(s.id)).map((s) => duplicateKey(s.content)));
|
|
43
44
|
const retired = (text) => (gone.has(duplicateKey(text)) && !live.has(duplicateKey(text))) || rejected(text);
|
|
@@ -1,5 +1,6 @@
|
|
|
1
1
|
// Not in same-text because it reads the user-rule tag, and base/util may not import base/memory.
|
|
2
2
|
import { USER_RULE_TAG } from './entry.js';
|
|
3
|
+
import { isSuperseded } from './liveness.js';
|
|
3
4
|
/** Whether a stated rule replaces this held copy: a live, observed capture row of `ruleProject`
|
|
4
5
|
* (the rule's project names), unpinned or pinned without the user-rule tag. Any other copy stops
|
|
5
6
|
* the rule, so a replayed transcript revives nothing and no project loses its row. */
|
|
@@ -8,7 +9,7 @@ export function ruleReplaces(row, ruleProject) {
|
|
|
8
9
|
row.source === 'capture' &&
|
|
9
10
|
Boolean(row.originProject) &&
|
|
10
11
|
ruleProject.includes(row.originProject ?? '') &&
|
|
11
|
-
row
|
|
12
|
+
!isSuperseded(row) &&
|
|
12
13
|
row.confidence === 'observed');
|
|
13
14
|
}
|
|
14
15
|
//# sourceMappingURL=rule-replaces.js.map
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
import type { MemoryEntry } from './entry.js';
|
|
2
|
+
/** The tag invalidation puts on a memory it weakened. */
|
|
3
|
+
export declare const INVALIDATED_TAG = "invalidated";
|
|
4
|
+
/** The tag a decision puts on the memory it replaced. */
|
|
5
|
+
export declare const SUPERSEDED_TAG = "superseded";
|
|
6
|
+
/** The row marked stale under tag `marker`, its half-life halved only when it is not already stale under that
|
|
7
|
+
* marker: repeating the act changes nothing, and a marker copied onto a fresh row does not block the first halving. */
|
|
8
|
+
export declare function markStale(entry: MemoryEntry, marker: string): MemoryEntry;
|
|
9
|
+
//# sourceMappingURL=stale-mark.d.ts.map
|
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
/** The tag invalidation puts on a memory it weakened. */
|
|
2
|
+
export const INVALIDATED_TAG = 'invalidated';
|
|
3
|
+
/** The tag a decision puts on the memory it replaced. */
|
|
4
|
+
export const SUPERSEDED_TAG = 'superseded';
|
|
5
|
+
/** The row marked stale under tag `marker`, its half-life halved only when it is not already stale under that
|
|
6
|
+
* marker: repeating the act changes nothing, and a marker copied onto a fresh row does not block the first halving. */
|
|
7
|
+
export function markStale(entry, marker) {
|
|
8
|
+
const tagged = entry.tags.includes(marker);
|
|
9
|
+
if (tagged && entry.confidence === 'stale')
|
|
10
|
+
return { ...entry };
|
|
11
|
+
return {
|
|
12
|
+
...entry,
|
|
13
|
+
confidence: 'stale',
|
|
14
|
+
halfLifeDays: Math.max(1, Math.floor(entry.halfLifeDays / 2)),
|
|
15
|
+
tags: tagged ? entry.tags : [...entry.tags, marker],
|
|
16
|
+
};
|
|
17
|
+
}
|
|
18
|
+
//# sourceMappingURL=stale-mark.js.map
|
|
@@ -109,6 +109,8 @@ export interface SpooledSummary {
|
|
|
109
109
|
payload: Omit<CompactionStart, 'originProject'>;
|
|
110
110
|
text: CompactionText;
|
|
111
111
|
at: Date;
|
|
112
|
+
/** Stable per spool file, so a second import of it finds the record its first one made. */
|
|
113
|
+
importKey?: string;
|
|
112
114
|
}
|
|
113
115
|
/** How long a call waits on a locked store; unset is the store's default wait. */
|
|
114
116
|
interface StoreWait {
|
|
@@ -16,10 +16,14 @@ export interface ConflictRow {
|
|
|
16
16
|
readonly a: ConflictMember | null;
|
|
17
17
|
readonly b: ConflictMember | null;
|
|
18
18
|
}
|
|
19
|
+
/** Every status a memory conflict row may hold. */
|
|
20
|
+
export declare const CONFLICT_STATUSES: readonly ["open", "resolved"];
|
|
21
|
+
/** One of `CONFLICT_STATUSES`. */
|
|
22
|
+
export type ConflictStatus = (typeof CONFLICT_STATUSES)[number];
|
|
19
23
|
export interface ConflictListQuery {
|
|
20
24
|
/** ALL_TENANTS is host admin, which the api checks. */
|
|
21
25
|
readonly tenantId: TenantId;
|
|
22
|
-
/** '*'
|
|
26
|
+
/** Open, resolved, or '*' for every status. */
|
|
23
27
|
readonly status: string;
|
|
24
28
|
readonly limit: number;
|
|
25
29
|
/** Resume after this (updatedAt, id) position; the list runs newest change first. */
|
|
@@ -30,8 +30,48 @@ export interface Consolidation {
|
|
|
30
30
|
/** Writes the particles over their stored state, as one batch. */
|
|
31
31
|
saveParticles(particles: PhysicsParticle[]): Promise<void>;
|
|
32
32
|
/** The `limit` dirty summaries changed last, each with its live children by created then id,
|
|
33
|
-
* and whether more were waiting.
|
|
34
|
-
|
|
33
|
+
* and whether more were waiting. With `at`, a summary held past it is skipped and counted in
|
|
34
|
+
* `held`; an adapter that ignores `at` stores no hold unless it has `noteRebuildFailures`. */
|
|
35
|
+
dirtySummaries(limit: number, at?: string): Promise<DirtySummaries>;
|
|
36
|
+
/** Stores one pass's counted rebuild failures in one write; an item lands only while the stored
|
|
37
|
+
* count equals its `priorFailures`. Optional: a store without it keeps no holds and sleep sends
|
|
38
|
+
* every dirty summary as before. */
|
|
39
|
+
noteRebuildFailures?(failed: ReadonlyArray<{
|
|
40
|
+
readonly id: string;
|
|
41
|
+
readonly tenantId: string;
|
|
42
|
+
readonly priorFailures: number;
|
|
43
|
+
readonly failures: number;
|
|
44
|
+
/** The ISO time the summary is next sent to the model; null while it is not held. */
|
|
45
|
+
readonly retryAfter: string | null;
|
|
46
|
+
}>): Promise<void>;
|
|
47
|
+
/** Up to `page.limit` empty extraction marks by source id, after the id `page.after`, and the id
|
|
48
|
+
* to continue after (null on the last page). A mark says extraction found nothing in that
|
|
49
|
+
* text of the source. Optional: a store without it keeps no marks and sleep offers every
|
|
50
|
+
* source as before. */
|
|
51
|
+
emptyExtractions?(page: {
|
|
52
|
+
readonly limit: number;
|
|
53
|
+
readonly after?: string;
|
|
54
|
+
}): Promise<{
|
|
55
|
+
readonly marks: ReadonlyArray<{
|
|
56
|
+
readonly id: string;
|
|
57
|
+
/** The hash of the source text the model found nothing in. */
|
|
58
|
+
readonly digest: string;
|
|
59
|
+
/** The ISO time of that call. */
|
|
60
|
+
readonly at: string;
|
|
61
|
+
}>;
|
|
62
|
+
readonly next: string | null;
|
|
63
|
+
}>;
|
|
64
|
+
/** Stores `mark` and drops the marks of the ids in `clear`, in one write; a mark lands only for
|
|
65
|
+
* a source that is live (neither archived nor superseded), and the marks of sources that are
|
|
66
|
+
* gone or no longer live are dropped with it. Optional, as `emptyExtractions` is. */
|
|
67
|
+
noteEmptyExtractions?(note: {
|
|
68
|
+
readonly mark: ReadonlyArray<{
|
|
69
|
+
readonly id: string;
|
|
70
|
+
readonly digest: string;
|
|
71
|
+
readonly at: string;
|
|
72
|
+
}>;
|
|
73
|
+
readonly clear: readonly string[];
|
|
74
|
+
}): Promise<void>;
|
|
35
75
|
/** Up to `page.limit` of the L2 topic summaries with no L3 profile above them, oldest first,
|
|
36
76
|
* after `page.after`. */
|
|
37
77
|
unprofiledTopicSummaries(page: {
|
|
@@ -62,7 +102,20 @@ export interface Consolidation {
|
|
|
62
102
|
/** Marks the tenant's pending graph work up to `maxId` processed; returns how many rows it
|
|
63
103
|
* marked. */
|
|
64
104
|
markGraphDrained(tenantId: string, maxId: number): Promise<number>;
|
|
105
|
+
/** Takes the right to run a sleep on this store; `held` says another sleep has it and since
|
|
106
|
+
* when. One holder at a time across processes, and a holder that dies frees it. Optional: a
|
|
107
|
+
* store without it runs its sleeps unguarded. */
|
|
108
|
+
claimSleep?(): Promise<SleepClaim>;
|
|
109
|
+
/** Gives back a claim this store took; a claim not taken, or already given back, is a no-op. */
|
|
110
|
+
releaseSleep?(): Promise<void>;
|
|
65
111
|
}
|
|
112
|
+
/** The answer to `claimSleep`: `since` is the ISO time the holder took it. */
|
|
113
|
+
export type SleepClaim = {
|
|
114
|
+
readonly kind: 'taken';
|
|
115
|
+
} | {
|
|
116
|
+
readonly kind: 'held';
|
|
117
|
+
readonly since: string;
|
|
118
|
+
};
|
|
66
119
|
/** What each Consolidation method does to the store; every adapter honours it. */
|
|
67
120
|
export declare const CONSOLIDATION_EFFECTS: {
|
|
68
121
|
readonly begin: "write";
|
|
@@ -72,6 +125,9 @@ export declare const CONSOLIDATION_EFFECTS: {
|
|
|
72
125
|
readonly particlesByRecall: "read";
|
|
73
126
|
readonly saveParticles: "write";
|
|
74
127
|
readonly dirtySummaries: "read";
|
|
128
|
+
readonly noteRebuildFailures: "write";
|
|
129
|
+
readonly emptyExtractions: "read";
|
|
130
|
+
readonly noteEmptyExtractions: "write";
|
|
75
131
|
readonly unprofiledTopicSummaries: "read";
|
|
76
132
|
readonly settleSummary: "write";
|
|
77
133
|
readonly commit: "write";
|
|
@@ -80,6 +136,8 @@ export declare const CONSOLIDATION_EFFECTS: {
|
|
|
80
136
|
readonly duplicateCandidates: "read";
|
|
81
137
|
readonly dirtyGraphTenants: "read";
|
|
82
138
|
readonly markGraphDrained: "write";
|
|
139
|
+
readonly claimSleep: "write";
|
|
140
|
+
readonly releaseSleep: "write";
|
|
83
141
|
};
|
|
84
142
|
export interface SleepBegin {
|
|
85
143
|
readonly dryRun: boolean;
|
|
@@ -137,8 +195,14 @@ export interface DirtySummaries {
|
|
|
137
195
|
readonly summaries: ReadonlyArray<{
|
|
138
196
|
readonly summary: MemoryEntry;
|
|
139
197
|
readonly children: MemoryEntry[];
|
|
198
|
+
/** The rebuild failures in a row stored for it; 0 when none, and unset by a store that keeps
|
|
199
|
+
* none. */
|
|
200
|
+
readonly failures?: number;
|
|
140
201
|
}>;
|
|
141
202
|
readonly more: boolean;
|
|
203
|
+
/** Dirty summaries skipped because their hold had not ended at `at`; unset when `at` was not
|
|
204
|
+
* given or the store keeps no holds. */
|
|
205
|
+
readonly held?: number;
|
|
142
206
|
}
|
|
143
207
|
/** The fields one dirty summary settles to; its dirty mark is cleared with them. */
|
|
144
208
|
export interface SummarySettle {
|
|
@@ -7,6 +7,9 @@ export const CONSOLIDATION_EFFECTS = {
|
|
|
7
7
|
particlesByRecall: 'read',
|
|
8
8
|
saveParticles: 'write',
|
|
9
9
|
dirtySummaries: 'read',
|
|
10
|
+
noteRebuildFailures: 'write',
|
|
11
|
+
emptyExtractions: 'read',
|
|
12
|
+
noteEmptyExtractions: 'write',
|
|
10
13
|
unprofiledTopicSummaries: 'read',
|
|
11
14
|
settleSummary: 'write',
|
|
12
15
|
commit: 'write',
|
|
@@ -15,5 +18,7 @@ export const CONSOLIDATION_EFFECTS = {
|
|
|
15
18
|
duplicateCandidates: 'read',
|
|
16
19
|
dirtyGraphTenants: 'read',
|
|
17
20
|
markGraphDrained: 'write',
|
|
21
|
+
claimSleep: 'write',
|
|
22
|
+
releaseSleep: 'write',
|
|
18
23
|
};
|
|
19
24
|
//# sourceMappingURL=consolidation.js.map
|
|
@@ -51,6 +51,8 @@ export interface AmbientRecallRequest {
|
|
|
51
51
|
terms: string[];
|
|
52
52
|
limit: number;
|
|
53
53
|
ownScope?: string;
|
|
54
|
+
/** Rows with any of these tags stay out of the full-text window, before its limit. */
|
|
55
|
+
excludeTags?: readonly string[];
|
|
54
56
|
}
|
|
55
57
|
/** The rows a non-pinned context read may admit; each predicate is one contextGet's admission
|
|
56
58
|
* applies again in JS. */
|
|
@@ -29,6 +29,9 @@ export interface ObjectSave<K extends SavableKind = SavableKind> {
|
|
|
29
29
|
readonly supersedesId?: number;
|
|
30
30
|
/** Stored on a successor of a versioned kind only; a first version and a decision keep none. */
|
|
31
31
|
readonly changeSummary?: string;
|
|
32
|
+
/** A decision only: a memory of the tenant the save also weakens, beside the one the replaced
|
|
33
|
+
* row mirrors; the save is refused when the tenant holds none. */
|
|
34
|
+
readonly weakensMemoryId?: string;
|
|
32
35
|
readonly actor: string;
|
|
33
36
|
/** The new row's createdAt and the replaced row's supersededAt: core's clock, as `toISOString`
|
|
34
37
|
* gives it, since the list orders createdAt as text. */
|
|
@@ -50,6 +53,12 @@ export type IncidentOpenRefusal = {
|
|
|
50
53
|
} | {
|
|
51
54
|
readonly refused: 'vanished';
|
|
52
55
|
};
|
|
56
|
+
/** Why a save wrote nothing: any `ObjectRefusal`, or `memoryId`, the memory the save named to
|
|
57
|
+
* weaken, is no memory of the tenant. */
|
|
58
|
+
export type SaveRefusal = ObjectRefusal | {
|
|
59
|
+
readonly refused: 'memory_missing';
|
|
60
|
+
readonly memoryId: string;
|
|
61
|
+
};
|
|
53
62
|
export interface IncidentResolve {
|
|
54
63
|
/** The row's resolutionText; core has checked it is not blank. */
|
|
55
64
|
readonly text: string;
|
|
@@ -109,9 +118,11 @@ export interface Objects {
|
|
|
109
118
|
closeObject(tenantId: string, kind: 'prediction', id: number, close: PredictionClose): Promise<Prediction>;
|
|
110
119
|
/** In one transaction, in order: writes `mirror` as `EntryWrites.writeEntry` does; inserts the
|
|
111
120
|
* row active (version 1, or the replaced row's plus one); with `supersedesId`, supersedes that
|
|
112
|
-
* row; appends the supersede and create rows. A
|
|
113
|
-
*
|
|
114
|
-
|
|
121
|
+
* row; appends the supersede and create rows and the mirror's remember row. A decision then
|
|
122
|
+
* weakens the memory the replaced row mirrors, if it still has one, and the one
|
|
123
|
+
* `weakensMemoryId` names, each marked stale as `markStale` does and followed by its remember
|
|
124
|
+
* row. A refusal (`missing`, `status`, `raced`, `vanished`, `memory_missing`) writes nothing. */
|
|
125
|
+
saveObject<K extends SavableKind>(tenantId: string, kind: K, save: ObjectSave<K>): Promise<ObjectByKind[K] | SaveRefusal>;
|
|
115
126
|
/** In one transaction, in order: writes `mirror` as `EntryWrites.writeEntry` does; checks each
|
|
116
127
|
* linked id is a memory of the tenant; inserts the row open under the next id; appends the
|
|
117
128
|
* incident_open row, then the mirror's remember row. A refusal leaves no mirror, row or audit
|
|
@@ -157,7 +168,7 @@ export interface ObjectCalls {
|
|
|
157
168
|
listObjects(...args: ObjectListArgs): Promise<AnyObject[]>;
|
|
158
169
|
objectById(tenantId: string, kind: ObjectKind | 'prediction', id: number): Promise<AnyObject | null>;
|
|
159
170
|
closeObject(...args: ObjectCloseArgs): Promise<AnyObject | ObjectRefusal>;
|
|
160
|
-
saveObject(...args: ObjectSaveArgs): Promise<AnyObject |
|
|
171
|
+
saveObject(...args: ObjectSaveArgs): Promise<AnyObject | SaveRefusal | IncidentOpenRefusal>;
|
|
161
172
|
briefReceipts: Objects['briefReceipts'];
|
|
162
173
|
predictionBaserate: Objects['predictionBaserate'];
|
|
163
174
|
}
|
|
@@ -1,6 +1,12 @@
|
|
|
1
1
|
import type { JsonValue, JsonObject } from '../../util/json.js';
|
|
2
2
|
import type { HandoffEvidence, HandoffOutcome, SessionHandoff } from '../../session/handoff.js';
|
|
3
3
|
import type { ContinuityKey } from './types.js';
|
|
4
|
+
/** The statuses a task snapshot takes when it leaves `active` without a successor. */
|
|
5
|
+
export declare const SNAPSHOT_CLOSE_STATUSES: readonly ["cleared", "done", "session-ended"];
|
|
6
|
+
/** One of `SNAPSHOT_CLOSE_STATUSES`. */
|
|
7
|
+
export type SnapshotCloseStatus = (typeof SNAPSHOT_CLOSE_STATUSES)[number];
|
|
8
|
+
/** True when `status` is one of the close statuses a snapshot clear may set. */
|
|
9
|
+
export declare function isSnapshotCloseStatus(status: string): status is SnapshotCloseStatus;
|
|
4
10
|
export interface TaskSnapshot {
|
|
5
11
|
id: number;
|
|
6
12
|
task: string;
|
|
@@ -142,13 +148,13 @@ export interface Sessions {
|
|
|
142
148
|
readonly limit?: number;
|
|
143
149
|
}): Promise<WorkingMemoryItem[]>;
|
|
144
150
|
/** Closes with `status` the key's active snapshots the session saved, never a newer session's;
|
|
145
|
-
* rows closed. */
|
|
151
|
+
* rows closed. `status` is cleared, done or session-ended. */
|
|
146
152
|
clear(tenantId: string, kind: 'snapshot', close: {
|
|
147
153
|
readonly status: string;
|
|
148
154
|
readonly sessionId: string;
|
|
149
155
|
}, key: ContinuityKey | null): Promise<number>;
|
|
150
156
|
/** Closes with `status` the tenant's newest active snapshot, whoever saved it, and drops its
|
|
151
|
-
* mirror; a shared store refuses. Rows closed. */
|
|
157
|
+
* mirror; a shared store refuses. Rows closed. `status` is cleared, done or session-ended. */
|
|
152
158
|
clear(tenantId: string, kind: 'snapshot', close: {
|
|
153
159
|
readonly status: string;
|
|
154
160
|
}): Promise<number>;
|
|
@@ -1,3 +1,9 @@
|
|
|
1
|
+
/** The statuses a task snapshot takes when it leaves `active` without a successor. */
|
|
2
|
+
export const SNAPSHOT_CLOSE_STATUSES = ['cleared', 'done', 'session-ended'];
|
|
3
|
+
/** True when `status` is one of the close statuses a snapshot clear may set. */
|
|
4
|
+
export function isSnapshotCloseStatus(status) {
|
|
5
|
+
return SNAPSHOT_CLOSE_STATUSES.some((close) => close === status);
|
|
6
|
+
}
|
|
1
7
|
/** What each Sessions method does to the store; every adapter honours it. */
|
|
2
8
|
export const SESSIONS_EFFECTS = {
|
|
3
9
|
save: 'write',
|
|
@@ -220,6 +220,9 @@ export declare const STORE_EFFECTS: {
|
|
|
220
220
|
readonly particlesByRecall: "read";
|
|
221
221
|
readonly saveParticles: "write";
|
|
222
222
|
readonly dirtySummaries: "read";
|
|
223
|
+
readonly noteRebuildFailures: "write";
|
|
224
|
+
readonly emptyExtractions: "read";
|
|
225
|
+
readonly noteEmptyExtractions: "write";
|
|
223
226
|
readonly unprofiledTopicSummaries: "read";
|
|
224
227
|
readonly settleSummary: "write";
|
|
225
228
|
readonly commit: "write";
|
|
@@ -228,6 +231,8 @@ export declare const STORE_EFFECTS: {
|
|
|
228
231
|
readonly duplicateCandidates: "read";
|
|
229
232
|
readonly dirtyGraphTenants: "read";
|
|
230
233
|
readonly markGraphDrained: "write";
|
|
234
|
+
readonly claimSleep: "write";
|
|
235
|
+
readonly releaseSleep: "write";
|
|
231
236
|
};
|
|
232
237
|
readonly learning: {
|
|
233
238
|
readonly entriesMentioning: "read";
|
|
@@ -200,7 +200,7 @@ export type { VectorReads, StoredPart, StoredParts, VectorRowWrite, VectorWrite,
|
|
|
200
200
|
export type { KeyRevoke, KeyMint, SelfKeyMint, KeyListQuery, KeyWrites } from './store/keys.js';
|
|
201
201
|
export type { AmbientAdmission, AmbientCandidateRequest, AmbientCandidates, AmbientRefusal, ContextReads, SessionRawQuery, SessionRawCount, DescendantAdmission, DescendantOrigin, DescendantPage, DescendantWalk, SummaryDescendants, DagReads, } from './store/context-reads.js';
|
|
202
202
|
export type { EntryWrite, EntryTarget, OutcomeWrite, SupersedeWrite, EntryRemoval, RawArchive, EntryWrites, LessonWrites, } from './store/entry-writes.js';
|
|
203
|
-
export type { PredictionSave, PredictionClose, PredictionFilter, PredictionListQuery, ObjectListQuery, ObjectClose, ObjectSave, IncidentOpen, IncidentOpenRefusal, IncidentResolve, PoliciesInForceQuery, SkillsByNameQuery, Objects, } from './store/objects.js';
|
|
203
|
+
export type { PredictionSave, PredictionClose, PredictionFilter, PredictionListQuery, ObjectListQuery, ObjectClose, ObjectSave, IncidentOpen, IncidentOpenRefusal, IncidentResolve, SaveRefusal, PoliciesInForceQuery, SkillsByNameQuery, Objects, } from './store/objects.js';
|
|
204
204
|
export type { AuditLog, AuditMaintenance } from './store/audit.js';
|
|
205
205
|
export type { Readiness } from './store/diagnostics.js';
|
|
206
206
|
export type { QuarantineListQuery, QuarantinedMemory, QuarantineRefusal, QuarantineApproval, QuarantineRejection, Quarantine, } from './store/quarantine.js';
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
/** True for a live memory: not superseded, kind raw or distilled, and not in a quarantine scope. */
|
|
2
|
+
export declare function isLiveMemory(entry: {
|
|
3
|
+
readonly supersededBy?: string | null;
|
|
4
|
+
readonly kind: string;
|
|
5
|
+
readonly scope: string | null;
|
|
6
|
+
}): boolean;
|
|
7
|
+
//# sourceMappingURL=live-memory.d.ts.map
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
// Here, not in base/memory, since scope already imports memory and the quarantine test is scope's.
|
|
2
|
+
import { isSuperseded } from '../memory/liveness.js';
|
|
3
|
+
import { isQuarantineScope } from './recall-scope.js';
|
|
4
|
+
/** True for a live memory: not superseded, kind raw or distilled, and not in a quarantine scope. */
|
|
5
|
+
export function isLiveMemory(entry) {
|
|
6
|
+
return (!isSuperseded(entry) &&
|
|
7
|
+
(entry.kind === 'raw' || entry.kind === 'distilled') &&
|
|
8
|
+
!isQuarantineScope(entry.scope));
|
|
9
|
+
}
|
|
10
|
+
//# sourceMappingURL=live-memory.js.map
|