hippo-memory 3.4.0 → 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 +2 -0
- package/dist/api/objects/object-kinds.d.ts +1 -4
- package/dist/api/objects/object-kinds.js +1 -5
- 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.d.ts +5 -0
- package/dist/api/sleep/sleep.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/ports/store/capture.d.ts +2 -0
- package/dist/base/ports/store/consolidation.d.ts +15 -0
- package/dist/base/ports/store/consolidation.js +2 -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/store-effects.d.ts +2 -0
- package/dist/base/ports/store.d.ts +1 -1
- package/dist/base/scope/read-admission.d.ts +2 -0
- package/dist/base/scope/read-admission.js +8 -2
- package/dist/base/util/version.d.ts +1 -1
- package/dist/base/util/version.js +1 -1
- package/dist/db/migrations/index.d.ts +1 -1
- package/dist/db/migrations/index.js +3 -1
- package/dist/db/migrations/v63.d.ts +3 -0
- package/dist/db/migrations/v63.js +9 -0
- package/dist/domain/consolidate/merge.js +6 -6
- package/dist/domain/consolidate/tombstones.d.ts +3 -4
- package/dist/domain/consolidate/tombstones.js +3 -3
- package/dist/domain/objects/decisions.d.ts +4 -7
- package/dist/domain/objects/decisions.js +1 -9
- package/dist/domain/objects/descriptor.d.ts +2 -0
- package/dist/domain/objects/lifecycle.js +8 -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/spool-request-id.d.ts +3 -0
- package/dist/store/sqlite/capture/spool-request-id.js +12 -0
- package/dist/store/sqlite/consolidation/consolidation.js +2 -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 +1 -2
- package/dist/store/sqlite/entries/entry-row.js +5 -1
- package/dist/store/sqlite/entries/entry-writes.js +3 -10
- 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/recall/candidates.js +2 -7
- package/dist/store/sqlite/recall/search-rows.d.ts +3 -0
- package/dist/store/sqlite/recall/search-rows.js +22 -6
- 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/review/conflicts.js +3 -4
- package/dist/store/sqlite/runtime/rule-sql.d.ts +1 -0
- package/dist/store/sqlite/runtime/rule-sql.js +2 -0
- 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/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/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/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/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/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/README.md
CHANGED
|
@@ -56,7 +56,7 @@ Every measurement we have ever published is indexed in [`docs/evals/`](docs/eval
|
|
|
56
56
|
pre-registrations kept next to their results, including the runs that failed and the one
|
|
57
57
|
claim we retracted.
|
|
58
58
|
|
|
59
|
-
- **Z0 round
|
|
59
|
+
- **Correct your agent once, and with hippo it repeats that mistake about half as often. Z0 round 3, real Claude Code sessions on 29 repositories, hippo against built-in memory alone: 11 repeats in 100 against 21, 2 to 4 tasks after the correction, at no extra cost (ratio 1.006 [0.964, 1.049]).** With no memory the agent repeats it 83 times in 100. Over every first chance to repeat, the pre-registered read is 14.9 points fewer [5.5, 24.3], adjusted p 0.006, against a full-win line of 15. The gain is the same with lesson capture switched off, so round 4 tests how much of it the stored lessons carry. ([result](docs/evals/2026-11-08-z0-round3-result.md); [round 2](docs/evals/2026-11-01-z0-round2-result.md), on 16 repositories, was inconclusive at -8.9 points)
|
|
60
60
|
- **Sequential Learning Benchmark.** [benchmarks/sequential-learning/](benchmarks/sequential-learning/). 50 tasks, 10 buried traps. Measures whether agents learn from past mistakes, not just retrieve text. v0.11.0 informal magnitude RETRACTED v1.7.9; mechanism remains shipped. See [CHANGELOG.md](./CHANGELOG.md) v1.7.9 entry.
|
|
61
61
|
- **LongMemEval oracle split, all 500 questions in one pooled store, BM25 only, no embeddings, v0.11: R@5 = 74.0%** ([benchmarks/README.md](benchmarks/README.md), scripts in [benchmarks/longmemeval/](benchmarks/longmemeval/)). A different setup from the per-haystack results under [Benchmarks](#benchmarks), so the two are not a before and after.
|
|
62
62
|
- **On a private 300-query developer store, R@1 0.41 to 0.62 with `hippo recall "<query>" --reranker jev`**, the free local cross-encoder against Jev ([full eval](docs/evals/2026-09-19-jev-reranker.md)). The opt-in [TypeSafe Jev](https://typesafe.ai) reranker, off by default, about 0.0004 USD a recall. 2000-draw paired bootstrap; the margin held in 20 of 20 seeds and a permutation null reached it in 0 of 200 runs. Ranking only: three graded tests on one 150-question LongMemEval set did **not** show a better answer rate than the free local cross-encoder, and that negative result is in the same doc. What it buys today is a shorter context: on that set, 2 memories ranked by Jev answered as well as 5 ranked by the cross-encoder.
|
|
@@ -847,7 +847,7 @@ The block asks for nothing a hook already does, because each extra tool call re-
|
|
|
847
847
|
For Claude Code, it also adds 7 hook entries to `~/.claude/settings.json`:
|
|
848
848
|
- a `SessionEnd` hook that runs `hippo sleep` and then `hippo capture` when the session exits. Capture matches the last 20 user and 10 assistant messages of the transcript against word patterns for decisions, rules, errors and preferences. It uses no model unless you turn on `capture.followUpRules` (see Conversation Capture) and does not read earlier turns, so a correction older than that window needs a `hippo remember` by hand.
|
|
849
849
|
- a `SessionStart` hook that prints the previous session's consolidation log on stderr, where `claude --debug` shows it. When the last sleep failed or a compaction summary was set aside, it shows you one line that points to `hippo doctor`.
|
|
850
|
-
- a `UserPromptSubmit` hook that runs `hippo context --pinned-only --include-recent 5 --format additional-context` every turn. It re-injects pinned memories (`hippo remember <text> --pin`) plus up to 5 memories that share words with your prompt. When nothing matches, it adds only the pinned ones. Since 1.55.0 this replaces the 5 newest memories, which cut the median block from 847 to 533 tokens in our eval. `{"pinnedInject":{"promptRecall":false}}` brings back the 5 newest, so fresh same-session lessons appear on the next prompt whatever you ask. The block is rendered without live strength percentages, so it stays byte-identical while its memories do not change, and it is sent only when it changed since the session's last prompt: an unchanged block is skipped, resent every 10 skips (`pinnedInject.refreshTurns`, `0` never resends) and resent after compaction. The prompt-matched memories go in a separate block that is never skipped, so they are sent on every prompt they match. `{"pinnedInject":{"skipUnchanged":false}}` sends the pinned block every turn as before. Opt out entirely with `{"pinnedInject":{"enabled":false}}` in `.hippo/config.json`.
|
|
850
|
+
- a `UserPromptSubmit` hook that runs `hippo context --pinned-only --include-recent 5 --format additional-context` every turn. It re-injects pinned memories (`hippo remember <text> --pin`) plus up to 5 memories that share words with your prompt. When nothing matches, it adds only the pinned ones. Since 1.55.0 this replaces the 5 newest memories, which cut the median block from 847 to 533 tokens in our eval. `{"pinnedInject":{"promptRecall":false}}` brings back the 5 newest, so fresh same-session lessons appear on the next prompt whatever you ask. The block is rendered without live strength percentages, so it stays byte-identical while its memories do not change, and it is sent only when it changed since the session's last prompt: an unchanged block is skipped, resent every 10 skips (`pinnedInject.refreshTurns`, `0` never resends) and resent after compaction. The prompt-matched memories go in a separate block that is never skipped, so they are sent on every prompt they match. `{"pinnedInject":{"skipUnchanged":false}}` sends the pinned block every turn as before. `{"pinnedInject":{"excludeTags":["session-digest"]}}` leaves out every memory that carries a listed tag, whether it is pinned, recent or matched to the prompt; the list is empty by default. Opt out entirely with `{"pinnedInject":{"enabled":false}}` in `.hippo/config.json`.
|
|
851
851
|
- a `PreCompact` hook that runs `hippo pre-compact` before the transcript gets summarized. It records the compaction in the store, saves a working-state snapshot (task/summary/next step) so mid-session compaction can't drop it, and asks the summariser to end its summary with a "Memories for hippo" list: the lessons, decisions and corrections from the session that should outlive it. The `SessionEnd` hook still owns extracting durable memories from the transcript.
|
|
852
852
|
- a second `SessionStart` hook (matcher `compact`) that runs `hippo compact-resume`, printing that snapshot back into context right after compaction, if it is under 15 minutes old.
|
|
853
853
|
- a `PostCompact` hook that runs `hippo post-compact`. It keeps the summary in the store with secrets scrubbed, and saves each item of that list as a memory that sleep never deletes: at most 10 per compaction, skipping an item an earlier compaction already saved and any item that looks like a secret. An item over 500 characters stays in the compaction's record only. It then prints one line, such as "Hippo saved 3 memories from this compaction and restored your task snapshot." If the store is busy, the summary waits in the store's `compactions-spool/` folder and `hippo sleep` finishes the save; `hippo doctor` names any compaction left unfinished for over 10 minutes. It also counts spool files that are waiting, stale (left by a replay that stopped) or set aside as `.bad`. The session that compacted does not have those memories injected back into its own prompts, since it just read them in the summary; `hippo recall` still finds them. The hook prints nothing when there is no store to save to.
|
|
@@ -1155,11 +1155,11 @@ Nothing. Hippo is MIT-licensed and needs no account or API key. Optional feature
|
|
|
1155
1155
|
|
|
1156
1156
|
### Is it production-ready?
|
|
1157
1157
|
|
|
1158
|
-
Judge it by what is tested. 3,500+ tests run against a real database, with no module mocks and no mocked store, and a negative test checks that one tenant cannot read another's memories. It is MIT-licensed and has zero runtime dependencies.
|
|
1158
|
+
Judge it by what is tested. 3,500+ tests run against a real database, with no module mocks and no mocked store, and a negative test checks that one tenant cannot read another's memories. It is MIT-licensed and has zero runtime dependencies. For what it does to an agent's work, see the next question.
|
|
1159
1159
|
|
|
1160
1160
|
### Has hippo been shown to make agents better at their work?
|
|
1161
1161
|
|
|
1162
|
-
|
|
1162
|
+
On repeat mistakes, yes. Z0 round 3 ran real Claude Code sessions on 29 repositories, with hippo and with Claude Code's built-in memory alone. An agent corrected once repeated that mistake about half as often with hippo installed: 11 times in 100 against 21, 2 to 4 tasks after the correction, at the same cost. Over every first chance to repeat, the pre-registered read is 14.9 points fewer [5.5, 24.3] ([result](https://github.com/kitfunso/hippo-memory/blob/master/docs/evals/2026-11-08-z0-round3-result.md)). On tasks with no lesson to apply, hippo changed neither the cost nor the share solved. The gain was the same with lesson capture switched off, so round 4 tests how much of it the stored lessons carry. The other published numbers measure retrieval. Every measurement, including failed runs and one retracted claim, is indexed in [docs/evals](https://github.com/kitfunso/hippo-memory/blob/master/docs/evals/README.md).
|
|
1163
1163
|
|
|
1164
1164
|
---
|
|
1165
1165
|
|
package/dist/api/callers.d.ts
CHANGED
|
@@ -11,9 +11,12 @@ export interface AutoSleepHost {
|
|
|
11
11
|
/** The rows `tenantId` wrote since the store's last sleep, counted on the store of the call
|
|
12
12
|
* that wrote, so a write's count opens no second connection. */
|
|
13
13
|
readonly newSince: (tenantId: string, now: Date) => Promise<number>;
|
|
14
|
-
/**
|
|
14
|
+
/** `held` is set while a sleep is counted or run, so two writes landing together start one.
|
|
15
|
+
* `notBefore` is the epoch ms before which no write retries, set after a sleep another process
|
|
16
|
+
* made this host skip. */
|
|
15
17
|
readonly latch: {
|
|
16
18
|
held: boolean;
|
|
19
|
+
notBefore?: number;
|
|
17
20
|
};
|
|
18
21
|
}
|
|
19
22
|
export type AutoSleepStart = Omit<AutoSleepHost, 'latch'>;
|
|
@@ -129,6 +129,8 @@ export function planContext(ctx, opts, local) {
|
|
|
129
129
|
/** The prompt-recall candidate request the ambient loads carry, when the prompt has any terms. */
|
|
130
130
|
export function promptRecallRequest(opts, plan) {
|
|
131
131
|
const { pinnedInject } = plan.config;
|
|
132
|
+
// Optional: a config built in code before this key existed has none, and reads as no list.
|
|
133
|
+
const excludeTags = pinnedInject.excludeTags ?? [];
|
|
132
134
|
const promptRecallTerms = plan.promptRecallPending && pinnedInject.enabled ? promptSearchTerms(opts.prompt ?? '') : [];
|
|
133
135
|
return promptRecallTerms.length > 0
|
|
134
136
|
? {
|
|
@@ -138,6 +140,7 @@ export function promptRecallRequest(opts, plan) {
|
|
|
138
140
|
min: 1,
|
|
139
141
|
})),
|
|
140
142
|
ownScope: plan.ownScope,
|
|
143
|
+
...(excludeTags.length > 0 && { excludeTags }),
|
|
141
144
|
}
|
|
142
145
|
: undefined;
|
|
143
146
|
}
|
|
@@ -68,6 +68,8 @@ export function ambientAdmission(opts, plan, digestHandoff) {
|
|
|
68
68
|
// Inside admit, not after the load, so the loader's window widens past a session's own items.
|
|
69
69
|
ownSessionId: opts.currentSessionId || undefined,
|
|
70
70
|
handoffSessionId: digestHandoff?.evidence?.derivedFrom === 'transcript' ? digestHandoff.sessionId : undefined,
|
|
71
|
+
// Only the hook block's pinned-only reads drop tags; a search or plain context read keeps them.
|
|
72
|
+
excludeTags: plan.pinnedOnly ? plan.config.pinnedInject.excludeTags : undefined,
|
|
71
73
|
};
|
|
72
74
|
const admit = (e) => ambientAdmits(e, rule);
|
|
73
75
|
// The two-store search has always ranked a session's own compaction items; only the local search
|
|
@@ -1,8 +1,7 @@
|
|
|
1
|
-
import type { MemoryEntry } from '../../base/memory/entry.js';
|
|
2
1
|
import type { Incident, Policy, ProjectBrief } from '../../base/records/object-types.js';
|
|
3
2
|
import { type SaveIncidentOptions } from '../../domain/objects/incidents.js';
|
|
4
3
|
import { type BriefDigest } from '../../domain/objects/project-briefs.js';
|
|
5
|
-
import type {
|
|
4
|
+
import type { ContextWith } from '../types.js';
|
|
6
5
|
import { type WriteOrigin } from './objects.js';
|
|
7
6
|
export type { BriefDigest } from '../../domain/objects/project-briefs.js';
|
|
8
7
|
export type { SaveIncidentOptions } from '../../domain/objects/incidents.js';
|
|
@@ -39,6 +38,4 @@ export declare function briefRefresh(ctx: ContextWith<'objects'>, repo: string):
|
|
|
39
38
|
/** The active decision whose mirror is `memoryId`, or null: what the CLI's `--supersedes
|
|
40
39
|
* <memory-id>` names. */
|
|
41
40
|
export declare function decisionIdByMemory(ctx: ContextWith<'objects'>, memoryId: string): Promise<number | null>;
|
|
42
|
-
/** Weakens the memory a new decision replaces, once that decision has saved. */
|
|
43
|
-
export declare function decisionMemoryWeaken(ctx: Context, entry: MemoryEntry): Promise<void>;
|
|
44
41
|
//# sourceMappingURL=object-kinds.d.ts.map
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { MAX_CUSTOMER_LEN, MAX_NOTE_LEN } from '../../domain/objects/customer-notes.js';
|
|
2
2
|
import { MAX_SHORT_FIELD_LEN } from '../../base/util/limits.js';
|
|
3
|
-
import { resolveActiveDecisionIdByMemory
|
|
3
|
+
import { resolveActiveDecisionIdByMemory } from '../../domain/objects/decisions.js';
|
|
4
4
|
import { openIncident, resolveOpenIncident, } from '../../domain/objects/incidents.js';
|
|
5
5
|
import { policiesAsOf } from '../../domain/objects/policies.js';
|
|
6
6
|
import { MAX_PROCESS_STEP_LEN, MAX_PROCESS_STEPS } from '../../domain/objects/processes.js';
|
|
@@ -70,8 +70,4 @@ export function briefRefresh(ctx, repo) {
|
|
|
70
70
|
export function decisionIdByMemory(ctx, memoryId) {
|
|
71
71
|
return resolveActiveDecisionIdByMemory(ctx.store.objects, ctx.tenantId, memoryId);
|
|
72
72
|
}
|
|
73
|
-
/** Weakens the memory a new decision replaces, once that decision has saved. */
|
|
74
|
-
export function decisionMemoryWeaken(ctx, entry) {
|
|
75
|
-
return weakenSupersededMemory(ctx.store.entryWrites, entry, ctx.actor.subject);
|
|
76
|
-
}
|
|
77
73
|
//# sourceMappingURL=object-kinds.js.map
|
|
@@ -51,8 +51,9 @@ export interface SessionEndWork<Turn, Scan extends {
|
|
|
51
51
|
}) => void;
|
|
52
52
|
/** Where the re-read count's lines wait for sleep. */
|
|
53
53
|
held: HeldLog;
|
|
54
|
-
/** Sleeps the folder's own store; reports its own failure.
|
|
55
|
-
|
|
54
|
+
/** Sleeps the folder's own store; reports its own failure. True when another sleep held the
|
|
55
|
+
* store's claim, so this one consolidated nothing. */
|
|
56
|
+
sleep: () => Promise<boolean | void>;
|
|
56
57
|
/** Imports the session's agent notes into the global store, for a folder that does not sleep
|
|
57
58
|
* here. */
|
|
58
59
|
importAgentNotes: () => Promise<void>;
|
package/dist/api/session-end.js
CHANGED
|
@@ -173,8 +173,10 @@ async function sleepStep(ctx, w) {
|
|
|
173
173
|
await w.importAgentNotes();
|
|
174
174
|
return;
|
|
175
175
|
}
|
|
176
|
-
if (w.mode !== 'turn' || !w.sessionId)
|
|
177
|
-
|
|
176
|
+
if (w.mode !== 'turn' || !w.sessionId) {
|
|
177
|
+
await w.sleep();
|
|
178
|
+
return;
|
|
179
|
+
}
|
|
178
180
|
// Each line starts the log afresh, as a sleep does.
|
|
179
181
|
const prefix = `turn close, session ${w.sessionId}`;
|
|
180
182
|
try {
|
|
@@ -184,8 +186,10 @@ async function sleepStep(ctx, w) {
|
|
|
184
186
|
w.log(`${prefix}: skip sleep, ${why}`, { startFresh: true });
|
|
185
187
|
return;
|
|
186
188
|
}
|
|
187
|
-
await w.sleep();
|
|
188
|
-
w.log(
|
|
189
|
+
const refused = await w.sleep();
|
|
190
|
+
w.log(refused
|
|
191
|
+
? `${prefix}: skip sleep, a sleep is already running`
|
|
192
|
+
: `${prefix}: ran sleep at ${count} new memories (threshold ${threshold})`);
|
|
189
193
|
}
|
|
190
194
|
catch (err) {
|
|
191
195
|
w.log(`${prefix}: sleep check failed: ${errorMessage(err)}`, {
|
package/dist/api/sharing.d.ts
CHANGED
|
@@ -1,4 +1,5 @@
|
|
|
1
1
|
import type { MemoryEntry } from '../base/memory/entry.js';
|
|
2
|
+
import { type ShareOutcome } from '../domain/sharing/share.js';
|
|
2
3
|
import { type Context, type ContextWith } from './types.js';
|
|
3
4
|
export { AUTO_SHARE_MIN_SCORE, transferScore } from '../domain/sharing/share.js';
|
|
4
5
|
/** One project's rows in the global store. */
|
|
@@ -7,11 +8,11 @@ export interface SharePeer {
|
|
|
7
8
|
readonly count: number;
|
|
8
9
|
readonly latest: string;
|
|
9
10
|
}
|
|
10
|
-
/** Copies one of the caller's memories to the global store
|
|
11
|
-
*
|
|
11
|
+
/** Copies one of the caller's memories to the global store unless its transfer score is too low
|
|
12
|
+
* and `force` is off, or the caller's global rows already hold its text. */
|
|
12
13
|
export declare function shareToGlobal(ctx: ContextWith<'folderFiles'>, id: string, opts: {
|
|
13
14
|
readonly force: boolean;
|
|
14
|
-
}): Promise<
|
|
15
|
+
}): Promise<ShareOutcome>;
|
|
15
16
|
/** The caller's memories whose transfer score reaches `minScore`, copied to the global store
|
|
16
17
|
* unless `dryRun`. */
|
|
17
18
|
export declare function autoShareToGlobal(ctx: ContextWith<'sharing' | 'folderFiles'>, opts: {
|
package/dist/api/sharing.js
CHANGED
|
@@ -17,8 +17,8 @@ function requireGlobalTarget(ctx, action) {
|
|
|
17
17
|
}
|
|
18
18
|
return target;
|
|
19
19
|
}
|
|
20
|
-
/** Copies one of the caller's memories to the global store
|
|
21
|
-
*
|
|
20
|
+
/** Copies one of the caller's memories to the global store unless its transfer score is too low
|
|
21
|
+
* and `force` is off, or the caller's global rows already hold its text. */
|
|
22
22
|
export async function shareToGlobal(ctx, id, opts) {
|
|
23
23
|
const target = requireGlobalTarget(ctx, 'share');
|
|
24
24
|
const options = { force: opts.force, tenantId: ctx.tenantId, embed: ctx.infra };
|
|
@@ -1,12 +1,13 @@
|
|
|
1
1
|
import type { HippoConfig } from '../../base/config/config.js';
|
|
2
2
|
import { type ConsolidationResult } from '../../domain/consolidate/run.js';
|
|
3
3
|
import { type Context, type ContextWith } from '../types.js';
|
|
4
|
+
import { type AutoSleepRefused } from './one-sleep.js';
|
|
4
5
|
/**
|
|
5
6
|
* Runs one auto-sleep consolidation of the folder its host was built for: the HTTP server passes
|
|
6
7
|
* one that runs it off its event loop, in a child process; stdio passes one that runs it in its
|
|
7
8
|
* own.
|
|
8
9
|
*/
|
|
9
|
-
export type AutoSleepRunner = () => Promise<void>;
|
|
10
|
+
export type AutoSleepRunner = () => Promise<void | AutoSleepRefused>;
|
|
10
11
|
export interface AutoSleepDue {
|
|
11
12
|
enabled: boolean;
|
|
12
13
|
count: number;
|
|
@@ -23,5 +24,5 @@ export declare function autoSleepDue(newSince: (tenantId: string, now: Date) =>
|
|
|
23
24
|
export declare function autoSleepAfterWrite(ctx: Pick<Context, 'tenantId' | 'config' | 'callers' | 'infra' | 'detached'>): Promise<void>;
|
|
24
25
|
/** What one auto-sleep runs: the consolidation alone, its skipped passes logged by the process
|
|
25
26
|
* that ran it. */
|
|
26
|
-
export declare function autoSleepConsolidate(ctx: Pick<ContextWith<'consolidation' | 'learning' | 'lessonWrites' | 'auditMaintenance' | 'vectors'>, 'store' | 'config' | 'tenantId' | 'infra'>): Promise<ConsolidationResult>;
|
|
27
|
+
export declare function autoSleepConsolidate(ctx: Pick<ContextWith<'consolidation' | 'learning' | 'lessonWrites' | 'auditMaintenance' | 'vectors'>, 'store' | 'config' | 'tenantId' | 'infra'>): Promise<ConsolidationResult | AutoSleepRefused>;
|
|
27
28
|
//# sourceMappingURL=auto-sleep.d.ts.map
|
|
@@ -5,6 +5,10 @@ import { logPhaseFailures } from '../../domain/consolidate/run.js';
|
|
|
5
5
|
import { runConsolidation } from '../../domain/consolidate/sleep.js';
|
|
6
6
|
import { strengthOf } from '../types.js';
|
|
7
7
|
import { withDetached } from '../detached.js';
|
|
8
|
+
import { oneSleepPerStore, refusedAutoSleep, sleepWasRefused, } from './one-sleep.js';
|
|
9
|
+
// Long enough that a host skips the minutes another process spends on its sleep, short enough that
|
|
10
|
+
// the next due write after it ends is not left waiting.
|
|
11
|
+
const REFUSED_BACKOFF_MS = 60_000;
|
|
8
12
|
/** Counts only when enabled: the count reads the store. */
|
|
9
13
|
export async function autoSleepDue(newSince, tenantId, config, now) {
|
|
10
14
|
const { enabled, threshold } = config;
|
|
@@ -21,7 +25,7 @@ export async function autoSleepAfterWrite(ctx) {
|
|
|
21
25
|
const { tenantId, config } = ctx;
|
|
22
26
|
if (host === undefined || !config.autoSleep.enabled || tenantId !== host.hostTenantId)
|
|
23
27
|
return;
|
|
24
|
-
if (host.latch.held)
|
|
28
|
+
if (host.latch.held || ctx.infra.clock().getTime() < (host.latch.notBefore ?? 0))
|
|
25
29
|
return;
|
|
26
30
|
// Held from the count on, so two writes landing together never both start a sleep.
|
|
27
31
|
host.latch.held = true;
|
|
@@ -42,6 +46,11 @@ export async function autoSleepAfterWrite(ctx) {
|
|
|
42
46
|
// it. A failure is logged here once, with the tenant.
|
|
43
47
|
const sleep = host
|
|
44
48
|
.run()
|
|
49
|
+
.then((outcome) => {
|
|
50
|
+
if (sleepWasRefused(outcome)) {
|
|
51
|
+
host.latch.notBefore = ctx.infra.clock().getTime() + REFUSED_BACKOFF_MS;
|
|
52
|
+
}
|
|
53
|
+
})
|
|
45
54
|
.catch((err) => {
|
|
46
55
|
log.error(`auto-sleep consolidate failed (tenant ${tenantId}): ${errorMessage(err)}`, errorFields(err));
|
|
47
56
|
})
|
|
@@ -54,13 +63,17 @@ export async function autoSleepAfterWrite(ctx) {
|
|
|
54
63
|
* that ran it. */
|
|
55
64
|
export async function autoSleepConsolidate(ctx) {
|
|
56
65
|
const { store, config, tenantId, infra } = ctx;
|
|
57
|
-
const result = await runConsolidation(store, {
|
|
66
|
+
const result = await oneSleepPerStore(store, false, () => runConsolidation(store, {
|
|
58
67
|
config,
|
|
59
68
|
tenantId,
|
|
60
69
|
llm: infra.llm,
|
|
61
70
|
now: infra.clock(),
|
|
62
71
|
strength: strengthOf(ctx),
|
|
63
|
-
});
|
|
72
|
+
}), refusedAutoSleep);
|
|
73
|
+
if (sleepWasRefused(result)) {
|
|
74
|
+
log.info(`auto-sleep: skipped, a sleep is already running (since ${result.alreadyRunning.since})`);
|
|
75
|
+
return result;
|
|
76
|
+
}
|
|
64
77
|
logPhaseFailures(result);
|
|
65
78
|
return result;
|
|
66
79
|
}
|
|
@@ -0,0 +1,23 @@
|
|
|
1
|
+
import type { Consolidation } from '../../base/ports/store/consolidation.js';
|
|
2
|
+
import type { ConsolidationResult } from '../../domain/consolidate/run.js';
|
|
3
|
+
import type { SleepResult } from './sleep.js';
|
|
4
|
+
/** What an auto-sleep answers when another sleep held the store; non-null, as the sleep child's
|
|
5
|
+
* reply check rejects a null result. */
|
|
6
|
+
export interface AutoSleepRefused {
|
|
7
|
+
readonly alreadyRunning: {
|
|
8
|
+
readonly since: string;
|
|
9
|
+
};
|
|
10
|
+
}
|
|
11
|
+
/** A sleep that did nothing: its 0 counts mean "nothing was done", not "the store is empty". */
|
|
12
|
+
export declare function refusedSleep(since: string): SleepResult;
|
|
13
|
+
export declare function refusedAutoSleep(since: string): AutoSleepRefused;
|
|
14
|
+
/** What a sleep entry point answers: its result, an auto-sleep's consolidation, a refusal, or nothing. */
|
|
15
|
+
export type SleepAnswer = SleepResult | ConsolidationResult | AutoSleepRefused | void;
|
|
16
|
+
/** True for an answer a held claim produced: the one test every reader of a sleep's answer uses. */
|
|
17
|
+
export declare function sleepWasRefused(result: SleepAnswer): result is AutoSleepRefused;
|
|
18
|
+
/** Runs `run` holding the store's claim; a held claim gives `refused(since)` and runs nothing. A dry
|
|
19
|
+
* run consolidates nothing, so it takes no claim, and a store without claim methods runs unguarded. */
|
|
20
|
+
export declare function oneSleepPerStore<R, F>({ consolidation }: {
|
|
21
|
+
readonly consolidation: Consolidation;
|
|
22
|
+
}, dryRun: boolean, run: () => Promise<R>, refused: (since: string) => F): Promise<R | F>;
|
|
23
|
+
//# sourceMappingURL=one-sleep.d.ts.map
|
|
@@ -0,0 +1,53 @@
|
|
|
1
|
+
import { errorFields, errorMessage, log } from '../../base/util/log.js';
|
|
2
|
+
/** A sleep that did nothing: its 0 counts mean "nothing was done", not "the store is empty". */
|
|
3
|
+
export function refusedSleep(since) {
|
|
4
|
+
return {
|
|
5
|
+
active: 0,
|
|
6
|
+
removed: 0,
|
|
7
|
+
mergedEpisodic: 0,
|
|
8
|
+
newSemantic: 0,
|
|
9
|
+
dryRun: false,
|
|
10
|
+
alreadyRunning: { since },
|
|
11
|
+
};
|
|
12
|
+
}
|
|
13
|
+
export function refusedAutoSleep(since) {
|
|
14
|
+
return { alreadyRunning: { since } };
|
|
15
|
+
}
|
|
16
|
+
/** True for an answer a held claim produced: the one test every reader of a sleep's answer uses. */
|
|
17
|
+
export function sleepWasRefused(result) {
|
|
18
|
+
return (typeof result === 'object' &&
|
|
19
|
+
result !== null &&
|
|
20
|
+
'alreadyRunning' in result &&
|
|
21
|
+
result.alreadyRunning !== undefined);
|
|
22
|
+
}
|
|
23
|
+
/** Runs `run` holding the store's claim; a held claim gives `refused(since)` and runs nothing. A dry
|
|
24
|
+
* run consolidates nothing, so it takes no claim, and a store without claim methods runs unguarded. */
|
|
25
|
+
export async function oneSleepPerStore({ consolidation }, dryRun, run, refused) {
|
|
26
|
+
if (dryRun || consolidation.claimSleep === undefined)
|
|
27
|
+
return run();
|
|
28
|
+
const claim = await consolidation.claimSleep();
|
|
29
|
+
if (claim.kind === 'held')
|
|
30
|
+
return refused(claim.since);
|
|
31
|
+
try {
|
|
32
|
+
return await run();
|
|
33
|
+
}
|
|
34
|
+
finally {
|
|
35
|
+
await giveBack(consolidation);
|
|
36
|
+
}
|
|
37
|
+
}
|
|
38
|
+
// A failed release must not replace the sleep's own result or error; one retry, since a claim kept by a
|
|
39
|
+
// long-running host would refuse every later sleep until it restarts.
|
|
40
|
+
async function giveBack(consolidation) {
|
|
41
|
+
if (consolidation.releaseSleep === undefined)
|
|
42
|
+
return;
|
|
43
|
+
for (let attempt = 1; attempt <= 2; attempt++) {
|
|
44
|
+
try {
|
|
45
|
+
await consolidation.releaseSleep();
|
|
46
|
+
return;
|
|
47
|
+
}
|
|
48
|
+
catch (err) {
|
|
49
|
+
log.warn(`the sleep claim was not given back (attempt ${attempt} of 2): ${errorMessage(err)}`, errorFields(err));
|
|
50
|
+
}
|
|
51
|
+
}
|
|
52
|
+
}
|
|
53
|
+
//# sourceMappingURL=one-sleep.js.map
|
|
@@ -50,6 +50,11 @@ export interface SleepResult {
|
|
|
50
50
|
};
|
|
51
51
|
/** What the sleep did, in order. */
|
|
52
52
|
events?: SleepEvent[];
|
|
53
|
+
/** Set when another sleep held the store's claim since that ISO time, so this one did nothing and
|
|
54
|
+
* its 0 counts mean "nothing was done", not "the store is empty". */
|
|
55
|
+
alreadyRunning?: {
|
|
56
|
+
since: string;
|
|
57
|
+
};
|
|
53
58
|
}
|
|
54
59
|
/** Sleeps the WHOLE store, every tenant, so /v1/sleep stays loopback-only; never auto-deletes
|
|
55
60
|
* pinned, raw, kept or object-backing rows. */
|
package/dist/api/sleep/sleep.js
CHANGED
|
@@ -1,8 +1,9 @@
|
|
|
1
1
|
// The sleep cycle: decay, consolidation, dedupe, graph extraction and the other maintenance passes.
|
|
2
2
|
import { runSleep } from './sleep-run.js';
|
|
3
|
+
import { oneSleepPerStore, refusedSleep } from './one-sleep.js';
|
|
3
4
|
/** Sleeps the WHOLE store, every tenant, so /v1/sleep stays loopback-only; never auto-deletes
|
|
4
5
|
* pinned, raw, kept or object-backing rows. */
|
|
5
6
|
export async function sleepWholeStore(ctx, opts = {}) {
|
|
6
|
-
return runSleep(ctx, opts);
|
|
7
|
+
return oneSleepPerStore(ctx.store, opts.dryRun === true, () => runSleep(ctx, opts), refusedSleep);
|
|
7
8
|
}
|
|
8
9
|
//# sourceMappingURL=sleep.js.map
|
|
@@ -50,6 +50,7 @@ function pinnedInjectFields(read) {
|
|
|
50
50
|
promptRecallMinShared: read('promptRecallMinShared', count(P.promptRecallMinShared)),
|
|
51
51
|
promptRecallMaxItems: read('promptRecallMaxItems', count(P.promptRecallMaxItems)),
|
|
52
52
|
promptRecallCandidates: read('promptRecallCandidates', count(P.promptRecallCandidates)),
|
|
53
|
+
excludeTags: read('excludeTags', textList([])),
|
|
53
54
|
};
|
|
54
55
|
}
|
|
55
56
|
// Every top-level key loadConfig reads. A bad value warns once, in one wording, and reads as the
|
|
@@ -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();
|
|
@@ -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 {
|
|
@@ -102,7 +102,20 @@ export interface Consolidation {
|
|
|
102
102
|
/** Marks the tenant's pending graph work up to `maxId` processed; returns how many rows it
|
|
103
103
|
* marked. */
|
|
104
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>;
|
|
105
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
|
+
};
|
|
106
119
|
/** What each Consolidation method does to the store; every adapter honours it. */
|
|
107
120
|
export declare const CONSOLIDATION_EFFECTS: {
|
|
108
121
|
readonly begin: "write";
|
|
@@ -123,6 +136,8 @@ export declare const CONSOLIDATION_EFFECTS: {
|
|
|
123
136
|
readonly duplicateCandidates: "read";
|
|
124
137
|
readonly dirtyGraphTenants: "read";
|
|
125
138
|
readonly markGraphDrained: "write";
|
|
139
|
+
readonly claimSleep: "write";
|
|
140
|
+
readonly releaseSleep: "write";
|
|
126
141
|
};
|
|
127
142
|
export interface SleepBegin {
|
|
128
143
|
readonly dryRun: boolean;
|
|
@@ -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
|
}
|
|
@@ -231,6 +231,8 @@ export declare const STORE_EFFECTS: {
|
|
|
231
231
|
readonly duplicateCandidates: "read";
|
|
232
232
|
readonly dirtyGraphTenants: "read";
|
|
233
233
|
readonly markGraphDrained: "write";
|
|
234
|
+
readonly claimSleep: "write";
|
|
235
|
+
readonly releaseSleep: "write";
|
|
234
236
|
};
|
|
235
237
|
readonly learning: {
|
|
236
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';
|
|
@@ -17,6 +17,8 @@ export interface AmbientAdmission {
|
|
|
17
17
|
/** The session of a shown or omitted transcript handoff: it stands for the closing message its
|
|
18
18
|
* digest rows hold, so that session's digest stays out. */
|
|
19
19
|
readonly handoffSessionId?: string;
|
|
20
|
+
/** Rows carrying any of these tags stay out; the prompt hook sets it from `pinnedInject.excludeTags`. */
|
|
21
|
+
readonly excludeTags?: readonly string[];
|
|
20
22
|
}
|
|
21
23
|
/**
|
|
22
24
|
* Why an ambient load leaves a row out: `admission` refused it, or it passed but is neither pinned
|
|
@@ -33,9 +33,12 @@ export function ambientEnvelopeAdmits(e, a) {
|
|
|
33
33
|
return true;
|
|
34
34
|
return classifyOriginProject(e.originProject, a.currentProject) !== 'cross-project';
|
|
35
35
|
}
|
|
36
|
-
//
|
|
36
|
+
// The cheap checks go before the envelope, which regex-scans content for secrets.
|
|
37
37
|
export function ambientAdmits(e, a) {
|
|
38
|
-
return !isSuperseded(e) &&
|
|
38
|
+
return (!isSuperseded(e) &&
|
|
39
|
+
!isOwnCompactionItem(e, a.ownSessionId) &&
|
|
40
|
+
!hasExcludedTag(e, a.excludeTags) &&
|
|
41
|
+
ambientEnvelopeAdmits(e, a));
|
|
39
42
|
}
|
|
40
43
|
/** Why an ambient load leaves `e` out, or null when it keeps it. */
|
|
41
44
|
export function ambientRefusal(e, a) {
|
|
@@ -50,4 +53,7 @@ export function descendantAdmits(row, a) {
|
|
|
50
53
|
function isOwnCompactionItem(e, ownSessionId) {
|
|
51
54
|
return (!!ownSessionId && e.sourceSessionId === ownSessionId && e.tags.includes(COMPACTION_MEMORY_TAG));
|
|
52
55
|
}
|
|
56
|
+
function hasExcludedTag(e, excludeTags) {
|
|
57
|
+
return excludeTags !== undefined && excludeTags.some((tag) => e.tags.includes(tag));
|
|
58
|
+
}
|
|
53
59
|
//# sourceMappingURL=read-admission.js.map
|
|
@@ -2,7 +2,7 @@
|
|
|
2
2
|
* Single source of truth for the package version, written by scripts/sync-version.mjs; never
|
|
3
3
|
* edit by hand. Read by the db rollback guard, /health, MCP. A constant, not a runtime
|
|
4
4
|
* package.json read: the published bundle may lack package.json on a path ESM can resolve. */
|
|
5
|
-
export declare const PACKAGE_VERSION = "3.
|
|
5
|
+
export declare const PACKAGE_VERSION = "3.5.1";
|
|
6
6
|
/** The floor a store takes on its first expiring key: the first release with schema v53, set by
|
|
7
7
|
* hand in that release; scripts/checks/check-expiring-keys-floor.mjs gates it. */
|
|
8
8
|
export declare const EXPIRING_KEYS_MIN_BINARY = "1.64.0";
|
|
@@ -2,7 +2,7 @@
|
|
|
2
2
|
* Single source of truth for the package version, written by scripts/sync-version.mjs; never
|
|
3
3
|
* edit by hand. Read by the db rollback guard, /health, MCP. A constant, not a runtime
|
|
4
4
|
* package.json read: the published bundle may lack package.json on a path ESM can resolve. */
|
|
5
|
-
export const PACKAGE_VERSION = '3.
|
|
5
|
+
export const PACKAGE_VERSION = '3.5.1';
|
|
6
6
|
/** The floor a store takes on its first expiring key: the first release with schema v53, set by
|
|
7
7
|
* hand in that release; scripts/checks/check-expiring-keys-floor.mjs gates it. */
|
|
8
8
|
export const EXPIRING_KEYS_MIN_BINARY = '1.64.0';
|