hippo-memory 1.62.0 → 1.63.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +9 -0
- package/dist/agent-memories/apply.d.ts +2 -0
- package/dist/agent-memories/apply.js +23 -1
- package/dist/agent-memories/claude-code.d.ts +2 -1
- package/dist/agent-memories/claude-code.js +4 -4
- package/dist/agent-memories/report.d.ts +1 -0
- package/dist/agent-memories/report.js +2 -2
- package/dist/agent-memories/sync.js +37 -23
- package/dist/ambient-store.d.ts +4 -4
- package/dist/ambient-store.js +4 -3
- package/dist/api/assemble.d.ts +7 -10
- package/dist/api/assemble.js +7 -12
- package/dist/api/audit.d.ts +2 -2
- package/dist/api/audit.js +2 -2
- package/dist/api/auth.d.ts +6 -6
- package/dist/api/auth.js +5 -7
- package/dist/api/context-select.d.ts +4 -3
- package/dist/api/context-select.js +9 -11
- package/dist/api/context-types.d.ts +12 -17
- package/dist/api/context.d.ts +3 -2
- package/dist/api/context.js +20 -20
- package/dist/api/dormant.js +1 -1
- package/dist/api/drill-down.d.ts +4 -4
- package/dist/api/drill-down.js +22 -10
- package/dist/api/outcome.d.ts +8 -13
- package/dist/api/outcome.js +13 -17
- package/dist/api/promote.d.ts +5 -8
- package/dist/api/quarantine.js +3 -2
- package/dist/api/recall-types.d.ts +43 -55
- package/dist/api/recall.d.ts +3 -3
- package/dist/api/recall.js +7 -18
- package/dist/api/remember.d.ts +2 -2
- package/dist/api/sleep.d.ts +7 -35
- package/dist/api/sleep.js +3 -2
- package/dist/api/tokens.d.ts +2 -2
- package/dist/api/tokens.js +2 -2
- package/dist/api/types.d.ts +6 -10
- package/dist/api/types.js +2 -4
- package/dist/audit-prune.d.ts +4 -6
- package/dist/audit-prune.js +3 -5
- package/dist/audit.js +11 -33
- package/dist/auth.d.ts +8 -9
- package/dist/auth.js +5 -7
- package/dist/autolearn.d.ts +1 -1
- package/dist/autolearn.js +1 -1
- package/dist/availability.js +3 -5
- package/dist/capture/command.d.ts +5 -4
- package/dist/capture/command.js +8 -22
- package/dist/capture/compact.d.ts +1 -1
- package/dist/capture/compact.js +9 -13
- package/dist/capture/extract.js +37 -115
- package/dist/capture-error.d.ts +1 -1
- package/dist/capture-error.js +1 -1
- package/dist/churn-git.d.ts +1 -1
- package/dist/churn-git.js +1 -1
- package/dist/cli/audit.js +3 -4
- package/dist/cli/auth.js +3 -6
- package/dist/cli/curate.d.ts +1 -1
- package/dist/cli/curate.js +8 -24
- package/dist/cli/dag.js +5 -9
- package/dist/cli/decisions.js +10 -21
- package/dist/cli/explain.js +2 -1
- package/dist/cli/goals.js +1 -1
- package/dist/cli/init.js +1 -1
- package/dist/cli/playbooks.js +4 -9
- package/dist/cli/projects.js +3 -1
- package/dist/cli/recall.js +2 -1
- package/dist/cli/remember.js +6 -18
- package/dist/cli/session-hooks.js +21 -40
- package/dist/cli/setup.d.ts +1 -1
- package/dist/cli/setup.js +2 -6
- package/dist/cli/shared.js +3 -3
- package/dist/cli/slack.js +1 -1
- package/dist/cli/sleep.js +27 -1
- package/dist/cli/status.d.ts +4 -4
- package/dist/cli/status.js +7 -12
- package/dist/cli/transfer.js +8 -13
- package/dist/cli/usage.js +9 -6
- package/dist/cli.d.ts +1 -1
- package/dist/cli.js +4 -9
- package/dist/compaction-record.d.ts +2 -0
- package/dist/compaction-record.js +89 -68
- package/dist/compare.d.ts +11 -16
- package/dist/compare.js +11 -16
- package/dist/config.d.ts +19 -18
- package/dist/config.js +90 -67
- package/dist/connectors/github/backfill.d.ts +2 -2
- package/dist/connectors/github/backfill.js +8 -15
- package/dist/connectors/github/cli-impl.js +3 -8
- package/dist/connectors/github/deletion.d.ts +5 -12
- package/dist/connectors/github/deletion.js +5 -12
- package/dist/connectors/github/dlq.d.ts +6 -9
- package/dist/connectors/github/dlq.js +2 -3
- package/dist/connectors/github/ingest.d.ts +5 -7
- package/dist/connectors/github/ingest.js +8 -12
- package/dist/connectors/github/octokit-client.d.ts +3 -5
- package/dist/connectors/github/octokit-client.js +5 -6
- package/dist/connectors/github/signature.d.ts +9 -39
- package/dist/connectors/github/signature.js +9 -39
- package/dist/connectors/github/tenant-routing.d.ts +1 -1
- package/dist/connectors/github/tenant-routing.js +1 -1
- package/dist/connectors/github/transform.js +2 -2
- package/dist/connectors/github/types.d.ts +2 -10
- package/dist/connectors/github/types.js +1 -3
- package/dist/connectors/slack/deletion.d.ts +3 -8
- package/dist/connectors/slack/deletion.js +3 -8
- package/dist/connectors/slack/dlq.d.ts +1 -1
- package/dist/connectors/slack/ingest.d.ts +1 -1
- package/dist/connectors/slack/ingest.js +7 -16
- package/dist/connectors/slack/signature.d.ts +1 -1
- package/dist/connectors/slack/tenant-routing.d.ts +3 -5
- package/dist/connectors/slack/tenant-routing.js +3 -5
- package/dist/connectors/slack/transform.d.ts +5 -6
- package/dist/connectors/slack/transform.js +5 -6
- package/dist/connectors/slack/types.d.ts +2 -6
- package/dist/connectors/slack/types.js +1 -3
- package/dist/connectors/slack/web-client.js +10 -3
- package/dist/connectors/slack/workspaces.d.ts +3 -5
- package/dist/connectors/slack/workspaces.js +3 -5
- package/dist/consolidate/conflicts.js +3 -14
- package/dist/consolidate/decay.js +9 -29
- package/dist/consolidate/llm-passes.js +4 -5
- package/dist/consolidate/merge.js +8 -23
- package/dist/consolidate/run.d.ts +1 -8
- package/dist/consolidate/run.js +3 -25
- package/dist/consolidate/sleep.js +5 -17
- package/dist/consolidate/traces.js +9 -21
- package/dist/customer-notes.d.ts +5 -7
- package/dist/customer-notes.js +6 -9
- package/dist/dag.d.ts +10 -21
- package/dist/dag.js +23 -73
- package/dist/db/continuity.js +2 -2
- package/dist/db/migrations/v14.js +1 -1
- package/dist/db/migrations/v15.js +1 -2
- package/dist/db/migrations/v16.js +3 -4
- package/dist/db/migrations/v17.js +2 -3
- package/dist/db/migrations/v19.js +1 -1
- package/dist/db/migrations/v20.js +1 -1
- package/dist/db/migrations/v21.js +2 -6
- package/dist/db/migrations/v22.js +2 -4
- package/dist/db/migrations/v23.js +1 -1
- package/dist/db/migrations/v24.js +4 -6
- package/dist/db/migrations/v25.js +2 -3
- package/dist/db/migrations/v26.js +3 -3
- package/dist/db/migrations/v27.js +2 -10
- package/dist/db/migrations/v28.js +5 -8
- package/dist/db/migrations/v29.js +3 -4
- package/dist/db/migrations/v30.js +2 -2
- package/dist/db/migrations/v31.js +1 -1
- package/dist/db/migrations/v32.js +1 -1
- package/dist/db/migrations/v33.js +3 -3
- package/dist/db/migrations/v34.js +1 -1
- package/dist/db/migrations/v35.js +3 -4
- package/dist/db/migrations/v36.js +3 -4
- package/dist/db/migrations/v37.js +5 -5
- package/dist/db/migrations/v38.js +7 -8
- package/dist/db/migrations/v39.js +1 -1
- package/dist/db/migrations/v40.js +4 -16
- package/dist/db/migrations/v41.js +3 -4
- package/dist/db/migrations/v42.js +3 -4
- package/dist/db/migrations/v45.js +1 -1
- package/dist/db/migrations/v46.js +1 -1
- package/dist/db/migrations/v47.js +1 -1
- package/dist/db/migrations/v48.js +1 -1
- package/dist/decisions.d.ts +2 -2
- package/dist/decisions.js +6 -6
- package/dist/dedupe.js +86 -61
- package/dist/delivery-recorder.js +154 -135
- package/dist/doctor.js +119 -104
- package/dist/dormant.js +1 -4
- package/dist/embedding-provider.d.ts +4 -8
- package/dist/embedding-provider.js +4 -8
- package/dist/embeddings.js +55 -47
- package/dist/env.d.ts +1 -1
- package/dist/env.js +12 -12
- package/dist/escape.d.ts +5 -0
- package/dist/escape.js +10 -0
- package/dist/eval-stats.d.ts +1 -2
- package/dist/eval-stats.js +1 -2
- package/dist/eval-suite.js +27 -21
- package/dist/extract.js +4 -9
- package/dist/failure-log.d.ts +3 -3
- package/dist/failure-log.js +1 -1
- package/dist/forward-claim-detector.d.ts +2 -4
- package/dist/forward-claim-detector.js +6 -11
- package/dist/goals.d.ts +3 -3
- package/dist/goals.js +5 -6
- package/dist/graph/read.d.ts +2 -2
- package/dist/graph/read.js +5 -6
- package/dist/graph/types.d.ts +8 -8
- package/dist/graph/write.d.ts +7 -14
- package/dist/graph/write.js +16 -23
- package/dist/graph-extract.d.ts +7 -8
- package/dist/graph-extract.js +62 -72
- package/dist/graph-recall.d.ts +2 -2
- package/dist/graph-recall.js +55 -49
- package/dist/graph-stream.d.ts +5 -6
- package/dist/graph-stream.js +66 -57
- package/dist/graph-view.d.ts +2 -2
- package/dist/graph-view.js +7 -7
- package/dist/half-life-migration.d.ts +1 -2
- package/dist/half-life-migration.js +2 -3
- package/dist/hooks/codex-session.js +1 -1
- package/dist/hooks/codex-wrapper.d.ts +1 -1
- package/dist/hooks/codex-wrapper.js +3 -2
- package/dist/hooks/json-hooks.d.ts +2 -2
- package/dist/hooks/json-hooks.js +5 -4
- package/dist/hooks/opencode.d.ts +1 -1
- package/dist/hooks/opencode.js +5 -4
- package/dist/hooks/shared.d.ts +3 -7
- package/dist/hooks/shared.js +1 -8
- package/dist/http-util.d.ts +2 -3
- package/dist/http-util.js +3 -0
- package/dist/importers/core.d.ts +2 -9
- package/dist/importers/core.js +15 -30
- package/dist/importers/sources.js +2 -1
- package/dist/importers/vault.js +2 -20
- package/dist/incidents.d.ts +1 -1
- package/dist/incidents.js +1 -1
- package/dist/instruction-detect.d.ts +1 -1
- package/dist/instruction-detect.js +1 -1
- package/dist/invalidation.d.ts +3 -0
- package/dist/invalidation.js +160 -114
- package/dist/json.d.ts +5 -0
- package/dist/json.js +4 -0
- package/dist/judgment.js +1 -2
- package/dist/local-embedding.js +1 -1
- package/dist/mcp/admin-tools.js +7 -17
- package/dist/mcp/format.js +1 -1
- package/dist/mcp/framing.js +3 -6
- package/dist/mcp/protocol.d.ts +2 -5
- package/dist/mcp/protocol.js +1 -3
- package/dist/mcp/recall-tools.js +12 -15
- package/dist/mcp/request.js +4 -3
- package/dist/mcp/session-state.js +2 -3
- package/dist/mcp/stdio.js +2 -1
- package/dist/mcp/tools.js +9 -6
- package/dist/memory-value-weights.d.ts +5 -8
- package/dist/memory-value-weights.js +5 -8
- package/dist/memory-value.d.ts +13 -13
- package/dist/memory-value.js +26 -37
- package/dist/memory.d.ts +20 -22
- package/dist/memory.js +24 -48
- package/dist/multihop.d.ts +1 -1
- package/dist/multihop.js +3 -2
- package/dist/owner-validation.d.ts +4 -5
- package/dist/owner-validation.js +4 -5
- package/dist/physics.d.ts +4 -4
- package/dist/physics.js +7 -9
- package/dist/policies.d.ts +9 -10
- package/dist/policies.js +12 -14
- package/dist/postinstall.js +3 -6
- package/dist/predictions/planning-fallacy.d.ts +9 -14
- package/dist/predictions/planning-fallacy.js +10 -16
- package/dist/predictions/store.d.ts +15 -23
- package/dist/predictions/store.js +36 -33
- package/dist/processes.d.ts +2 -7
- package/dist/processes.js +3 -3
- package/dist/project-briefs.d.ts +2 -3
- package/dist/project-briefs.js +9 -13
- package/dist/project-identity.d.ts +22 -9
- package/dist/project-identity.js +47 -12
- package/dist/project-merge.d.ts +17 -2
- package/dist/project-merge.js +109 -27
- package/dist/project-remote.d.ts +12 -0
- package/dist/project-remote.js +138 -0
- package/dist/prompt-recall.js +1 -2
- package/dist/rate-limit.d.ts +1 -1
- package/dist/rate-limit.js +1 -1
- package/dist/raw-archive.d.ts +9 -0
- package/dist/raw-archive.js +70 -53
- package/dist/recall-history.d.ts +19 -20
- package/dist/recall-history.js +24 -42
- package/dist/recall-pipeline.js +4 -28
- package/dist/recall-scope.d.ts +7 -8
- package/dist/recall-scope.js +7 -8
- package/dist/recall-trace.d.ts +5 -9
- package/dist/recall-trace.js +6 -10
- package/dist/refine-llm.d.ts +1 -1
- package/dist/refine-llm.js +2 -2
- package/dist/reject-flow.d.ts +3 -4
- package/dist/reject-flow.js +122 -117
- package/dist/rejection.d.ts +5 -6
- package/dist/rejection.js +7 -15
- package/dist/rerankers/clef.d.ts +1 -1
- package/dist/rerankers/jev.d.ts +1 -2
- package/dist/rerankers/jev.js +4 -5
- package/dist/rerankers/llm.d.ts +1 -2
- package/dist/rerankers/llm.js +1 -2
- package/dist/rerankers/types.d.ts +1 -2
- package/dist/rrf.d.ts +2 -2
- package/dist/rrf.js +2 -2
- package/dist/search/bm25-search.d.ts +1 -1
- package/dist/search/bm25-search.js +2 -1
- package/dist/search/boosts.js +2 -1
- package/dist/search/hybrid.d.ts +1 -1
- package/dist/search/hybrid.js +2 -1
- package/dist/search/physics-search.d.ts +1 -1
- package/dist/search/physics-search.js +2 -1
- package/dist/search/types.d.ts +2 -0
- package/dist/search/types.js +3 -1
- package/dist/secret-detect.d.ts +4 -5
- package/dist/secret-detect.js +6 -10
- package/dist/server/auth.js +5 -5
- package/dist/server/client-ip.js +1 -1
- package/dist/server/cursor.js +2 -1
- package/dist/server/mcp-http.js +4 -4
- package/dist/server/request.d.ts +3 -6
- package/dist/server/request.js +6 -7
- package/dist/server/routes/admin.js +5 -4
- package/dist/server/routes/customer-notes.js +6 -5
- package/dist/server/routes/decisions.js +4 -3
- package/dist/server/routes/incidents.js +7 -5
- package/dist/server/routes/memories.js +7 -7
- package/dist/server/routes/policies.js +3 -2
- package/dist/server/routes/predictions.js +12 -15
- package/dist/server/routes/processes.js +3 -2
- package/dist/server/routes/project-briefs.js +8 -7
- package/dist/server/routes/recall.js +95 -93
- package/dist/server/routes/skills.js +6 -5
- package/dist/server/types.d.ts +1 -1
- package/dist/server/validation.d.ts +1 -2
- package/dist/server/validation.js +7 -14
- package/dist/server-detect.js +72 -58
- package/dist/server.d.ts +2 -2
- package/dist/server.js +131 -117
- package/dist/shared.d.ts +17 -17
- package/dist/shared.js +93 -97
- package/dist/skills.d.ts +3 -3
- package/dist/skills.js +8 -8
- package/dist/store/audit-event.d.ts +2 -2
- package/dist/store/audit-event.js +1 -1
- package/dist/store/candidates.d.ts +2 -2
- package/dist/store/candidates.js +4 -3
- package/dist/store/conflicts.js +30 -22
- package/dist/store/delete-and-batch.d.ts +11 -14
- package/dist/store/delete-and-batch.js +40 -91
- package/dist/store/entry-reads.d.ts +17 -25
- package/dist/store/entry-reads.js +59 -40
- package/dist/store/entry-row.d.ts +6 -24
- package/dist/store/entry-row.js +6 -24
- package/dist/store/entry-writes.d.ts +6 -7
- package/dist/store/entry-writes.js +13 -11
- package/dist/store/handoffs.d.ts +1 -1
- package/dist/store/handoffs.js +7 -10
- package/dist/store/index-and-stats.d.ts +2 -6
- package/dist/store/index-and-stats.js +4 -10
- package/dist/store/mirrors.d.ts +6 -19
- package/dist/store/mirrors.js +14 -39
- package/dist/store/open.js +9 -31
- package/dist/store/rows.d.ts +5 -11
- package/dist/store/rows.js +6 -11
- package/dist/store/search-rows.d.ts +17 -34
- package/dist/store/search-rows.js +31 -59
- package/dist/store/sessions.d.ts +4 -5
- package/dist/store/sessions.js +5 -6
- package/dist/store/summaries.d.ts +13 -17
- package/dist/store/summaries.js +26 -70
- package/dist/support-bundle.js +4 -8
- package/dist/tenant.d.ts +1 -5
- package/dist/token-ledger.d.ts +1 -1
- package/dist/token-ledger.js +3 -5
- package/dist/trace.js +1 -3
- package/dist/version.d.ts +1 -1
- package/dist/version.js +1 -1
- package/dist/working-memory.d.ts +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
|
@@ -9,10 +9,9 @@ export interface RecallOpts {
|
|
|
9
9
|
query: string;
|
|
10
10
|
limit?: number;
|
|
11
11
|
/**
|
|
12
|
-
*
|
|
12
|
+
* Scorer-window opt-in. When set, `loadSearchEntries`
|
|
13
13
|
* loads up to `scorerWindow` candidates. When undefined (default),
|
|
14
|
-
* the
|
|
15
|
-
* which every release before v1.7.0 silently relied on.
|
|
14
|
+
* the store-internal 200-row default applies.
|
|
16
15
|
*
|
|
17
16
|
* `scorerWindow` lets callers decouple "how many candidates do I want
|
|
18
17
|
* the scorer to evaluate" from `limit` ("how many do I want returned").
|
|
@@ -26,18 +25,16 @@ export interface RecallOpts {
|
|
|
26
25
|
*
|
|
27
26
|
* Validated as a positive finite integer when set. `scorerWindow: 0`
|
|
28
27
|
* or non-finite values throw `RecallContractError` with code
|
|
29
|
-
* `invalid_scorer_window
|
|
30
|
-
*
|
|
28
|
+
* `invalid_scorer_window`, because 0 would otherwise fall through to an
|
|
29
|
+
* uncapped fallback.
|
|
31
30
|
*
|
|
32
|
-
* **Input is library-only
|
|
31
|
+
* **Input is library-only.** HTTP `/v1/memories`, MCP
|
|
33
32
|
* `hippo_recall`, and `client.ts` thin-client do NOT serialize this
|
|
34
33
|
* INPUT field; remote callers cannot send `scorerWindow` and will see
|
|
35
34
|
* the store default applied. The OUTPUT `RecallResult.windowSize` is
|
|
36
35
|
* always serialized over the wire (HTTP `sendJson` ships the whole
|
|
37
36
|
* RecallResult, so remote callers receive `windowSize: 200` in the
|
|
38
|
-
* response).
|
|
39
|
-
* alongside the deferred-queue items that need a wider candidate pool
|
|
40
|
-
* (e.g. mean-of-children summary re-rank).
|
|
37
|
+
* response).
|
|
41
38
|
*/
|
|
42
39
|
scorerWindow?: number;
|
|
43
40
|
/** Candidate order. `recall` always keeps the BM25 order; `retrieve` honours this. */
|
|
@@ -53,21 +50,21 @@ export interface RecallOpts {
|
|
|
53
50
|
*/
|
|
54
51
|
scope?: string;
|
|
55
52
|
/**
|
|
56
|
-
*
|
|
53
|
+
* DAG-aware recall. When true (default), entries that overflow the
|
|
57
54
|
* `limit` and share a level-2 parent summary cause that summary to be
|
|
58
55
|
* appended in their place, capped at ceil(limit * 0.3) extra rows. Set to
|
|
59
|
-
* false
|
|
56
|
+
* false for a strict limit.
|
|
60
57
|
*/
|
|
61
58
|
summarizeOverflow?: boolean;
|
|
62
59
|
/**
|
|
63
|
-
*
|
|
60
|
+
* Fresh tail. When > 0, prepend the last N kind='raw' rows
|
|
64
61
|
* (tenant + scope filtered, dedup against the BM25 hits) so an agent's
|
|
65
62
|
* "what did I just see" recall path always covers the recent window
|
|
66
63
|
* even when the query terms don't match. Capped at 200. Default 0 = off.
|
|
67
64
|
*/
|
|
68
65
|
freshTailCount?: number;
|
|
69
66
|
/**
|
|
70
|
-
*
|
|
67
|
+
* Fresh-tail session scope. When set, restricts the fresh-tail
|
|
71
68
|
* window to a specific session. Without it, fresh-tail is tenant-wide,
|
|
72
69
|
* which surfaces newest rows across ALL sessions — useful for "anything
|
|
73
70
|
* new in this tenant", but wrong for "what did I just see in this one
|
|
@@ -79,7 +76,7 @@ export interface RecallOpts {
|
|
|
79
76
|
* session handoff, recent session events) on the result. Default false to keep
|
|
80
77
|
* the hot path cheap; agent boot paths should set this to true.
|
|
81
78
|
*
|
|
82
|
-
* All three lookups are tenant-scoped to ctx.tenantId via the
|
|
79
|
+
* All three lookups are tenant-scoped to ctx.tenantId via the store
|
|
83
80
|
* helpers. No risk of cross-tenant leak.
|
|
84
81
|
*
|
|
85
82
|
* Note: when no active snapshot exists, sessionHandoff is null and
|
|
@@ -90,24 +87,23 @@ export interface RecallOpts {
|
|
|
90
87
|
*/
|
|
91
88
|
includeContinuity?: boolean;
|
|
92
89
|
/**
|
|
93
|
-
*
|
|
90
|
+
* When set AND `(ctx.tenantId, sessionId)` has active goals AND
|
|
94
91
|
* `goalTag` is unset, `api.recall` applies the dlPFC goal-stack boost lifted
|
|
95
|
-
* from CLI cmdRecall.
|
|
96
|
-
* HIPPO_SESSION_ID). Undefined preserves v1.7.3 behaviour (no boost).
|
|
92
|
+
* from CLI cmdRecall. Undefined means no boost.
|
|
97
93
|
*
|
|
98
94
|
* Why on RecallOpts and not Context: Context is shared by remember/recall/
|
|
99
95
|
* assemble/outcome. Goal-stack boost is recall-scoped only.
|
|
100
96
|
*/
|
|
101
97
|
sessionId?: string;
|
|
102
98
|
/**
|
|
103
|
-
*
|
|
104
|
-
* SUPPRESSED (mirrors the CLI's `goalTag === ''` gate
|
|
99
|
+
* Explicit goal-tag override. When set, the goal-stack boost is
|
|
100
|
+
* SUPPRESSED (mirrors the CLI's `goalTag === ''` gate). Use to
|
|
105
101
|
* pin recall ranking against one specific goal/tag without the multi-goal
|
|
106
102
|
* stack interfering.
|
|
107
103
|
*/
|
|
108
104
|
goalTag?: string;
|
|
109
105
|
/**
|
|
110
|
-
*
|
|
106
|
+
* Anchoring detector. Caller-supplied snapshot of the per-
|
|
111
107
|
* (tenant, session) recall ring. When present, api.recall computes
|
|
112
108
|
* `RecallResult.anchoringHint` against this snapshot + the just-computed
|
|
113
109
|
* top-1. When undefined (default), no anchoring detection runs on the
|
|
@@ -122,27 +118,25 @@ export interface RecallOpts {
|
|
|
122
118
|
*/
|
|
123
119
|
recallHistory?: RecallHistorySnapshot;
|
|
124
120
|
/**
|
|
125
|
-
*
|
|
121
|
+
* When true, api.recall does NOT compute or emit the
|
|
126
122
|
* availabilityHint. Callers that run their OWN per-pipeline availability
|
|
127
123
|
* detection over a different result set (the MCP handler computes it over
|
|
128
124
|
* physics/hybrid results, not api.recall's BM25 band) pass this to avoid a
|
|
129
125
|
* double audit emission and a hint describing a result set the caller never
|
|
130
|
-
* surfaces. Mirrors how
|
|
126
|
+
* surfaces. Mirrors how anchoring only runs when opts.recallHistory
|
|
131
127
|
* is supplied. HTTP / direct SDK callers leave this unset and receive the hint.
|
|
132
128
|
*/
|
|
133
129
|
suppressAvailabilityHint?: boolean;
|
|
134
130
|
/**
|
|
135
|
-
*
|
|
131
|
+
* Recall trace. When true, api.recall captures the lifecycle re-ranking
|
|
136
132
|
* trace (currently the goal-boost step on the primary band) and attaches it
|
|
137
133
|
* to each `RecallResultItem` as `rerankTrace`, plus `rerankPipeline:'api'`.
|
|
138
|
-
* When undefined/false (default), both fields are absent on EVERY band
|
|
139
|
-
*
|
|
140
|
-
*
|
|
141
|
-
* reranker/retrieval-count-downweight) are A7.2.
|
|
134
|
+
* When undefined/false (default), both fields are absent on EVERY band.
|
|
135
|
+
* The api pipeline applies only goal-boost; the richer CLI stages
|
|
136
|
+
* (interference/value/utility/reranker/retrieval-count-downweight) are not traced here.
|
|
142
137
|
*/
|
|
143
138
|
explain?: boolean;
|
|
144
139
|
/**
|
|
145
|
-
* LC1 (docs/plans/2026-08-02-lc1-recall-trace-persistence.md) / F2 fix.
|
|
146
140
|
* When true, api.recall does NOT write a recall_traces row for this call.
|
|
147
141
|
* Mirrors `suppressAvailabilityHint`'s pattern: callers that run their OWN
|
|
148
142
|
* tracing over a DIFFERENT result set must suppress api.recall's copy so
|
|
@@ -176,26 +170,24 @@ export interface RecallResultItem {
|
|
|
176
170
|
layer: string;
|
|
177
171
|
strength: number;
|
|
178
172
|
/**
|
|
179
|
-
* v1.5.0 DAG-aware recall (docs/plans/2026-05-05-dag-recall.md Task 2).
|
|
180
173
|
* True when this row is a level-2 topic summary substituted in for
|
|
181
174
|
* overflowed children that didn't fit the limit.
|
|
182
175
|
*/
|
|
183
176
|
isSummary?: boolean;
|
|
184
177
|
/**
|
|
185
178
|
* IDs of the overflow leaves this summary covers. Caller can drill
|
|
186
|
-
* into these via `drillDown`
|
|
179
|
+
* into these via `drillDown` to recover the original detail.
|
|
187
180
|
*/
|
|
188
181
|
substitutedFor?: string[];
|
|
189
182
|
/** Cached descendant count from schema v25; non-zero for level-2+ rows. */
|
|
190
183
|
descendantCount?: number;
|
|
191
184
|
/**
|
|
192
|
-
*
|
|
193
|
-
* for rows surfaced via the most-recent-N kind='raw' window, NOT by the
|
|
185
|
+
* True for rows surfaced via the most-recent-N kind='raw' window, NOT by the
|
|
194
186
|
* BM25 query match. Caller can render them in a separate "recent" band.
|
|
195
187
|
*/
|
|
196
188
|
isFreshTail?: boolean;
|
|
197
189
|
/**
|
|
198
|
-
*
|
|
190
|
+
* Ordered lifecycle re-ranking steps that mutated this
|
|
199
191
|
* row's `score` after candidate generation. On the api pipeline this carries
|
|
200
192
|
* the goal-boost step (the only re-ranking api.recall applies). Populated
|
|
201
193
|
* ONLY when `RecallOpts.explain` is set; absent on the default path
|
|
@@ -204,11 +196,11 @@ export interface RecallResultItem {
|
|
|
204
196
|
*/
|
|
205
197
|
rerankTrace?: RerankStep[];
|
|
206
198
|
/**
|
|
207
|
-
*
|
|
199
|
+
* Names which pipeline produced `rerankTrace`. `'api'` on
|
|
208
200
|
* every band returned by `api.recall` when `explain` is set; the CLI carries
|
|
209
201
|
* its trace on `SearchResult` instead and does not set this. Absent on the
|
|
210
202
|
* default path. Distinguishes the api pipeline (goal-boost only) from the
|
|
211
|
-
* richer CLI pipeline
|
|
203
|
+
* richer CLI pipeline.
|
|
212
204
|
*/
|
|
213
205
|
rerankPipeline?: 'cli' | 'api';
|
|
214
206
|
}
|
|
@@ -227,20 +219,20 @@ export interface RecallResult {
|
|
|
227
219
|
*/
|
|
228
220
|
continuityTokens?: number;
|
|
229
221
|
/**
|
|
230
|
-
*
|
|
222
|
+
* Scorer window actually used for this recall. Equals
|
|
231
223
|
* `opts.scorerWindow` when set, otherwise the store-internal default
|
|
232
224
|
* (200) used by `loadSearchEntries(undefined, ...)`. Reported so
|
|
233
225
|
* callers can introspect "did the scorer see enough candidates?"
|
|
234
226
|
* without re-deriving the value.
|
|
235
227
|
*
|
|
236
228
|
* Optional in the type to keep `RecallResult` literal-construction
|
|
237
|
-
* back-compatible with
|
|
229
|
+
* back-compatible with test fakes / mocks that predate the field.
|
|
238
230
|
* Always present on values returned by `api.recall` itself; consumers
|
|
239
231
|
* reading from `api.recall` can treat it as defined.
|
|
240
232
|
*/
|
|
241
233
|
windowSize?: number;
|
|
242
234
|
/**
|
|
243
|
-
*
|
|
235
|
+
* WYSIATI cutoff transparency. When present, gives the
|
|
244
236
|
* calling agent a per-pipeline breakdown of what was excluded from
|
|
245
237
|
* `results[]` and why. Always populated by `api.recall`, `cmdRecall`, and
|
|
246
238
|
* the MCP `hippo_recall` handler. Optional in the type for back-compat
|
|
@@ -255,7 +247,7 @@ export interface RecallResult {
|
|
|
255
247
|
*/
|
|
256
248
|
suppressionSummary?: RecallSuppressionSummary;
|
|
257
249
|
/**
|
|
258
|
-
*
|
|
250
|
+
* Auto-injected planning-fallacy hint. When the recall
|
|
259
251
|
* query carries a forward-prediction phrase ("will take ~3 days", "ship
|
|
260
252
|
* by Friday", "ETA in 2 weeks") AND the closest matching prediction
|
|
261
253
|
* class has closed historical data, this carries the base-rate stats so
|
|
@@ -275,15 +267,13 @@ export interface RecallResult {
|
|
|
275
267
|
*/
|
|
276
268
|
planningFallacyHint?: PlanningFallacyHint;
|
|
277
269
|
/**
|
|
278
|
-
*
|
|
270
|
+
* "Watching" variant emitted when the
|
|
279
271
|
* forward-claim regex matched but no baserate could be produced
|
|
280
272
|
* (either because no prediction class scored ≥ 1 on token overlap,
|
|
281
273
|
* or because ≥2 classes tied at the best score). Mutually exclusive
|
|
282
274
|
* with `planningFallacyHint`: at most one of the two is set per
|
|
283
|
-
* recall.
|
|
284
|
-
*
|
|
285
|
-
* the dominant J3.2 failure mode, because natural-language queries
|
|
286
|
-
* rarely share non-stopword tokens with class tags. The watching
|
|
275
|
+
* recall. Natural-language queries rarely share non-stopword tokens
|
|
276
|
+
* with class tags, so without it the hint would mostly stay silent. The watching
|
|
287
277
|
* variant gives the agent enough signal to either re-tag the
|
|
288
278
|
* prediction or pass the suggestion through to the user.
|
|
289
279
|
*
|
|
@@ -293,9 +283,9 @@ export interface RecallResult {
|
|
|
293
283
|
*/
|
|
294
284
|
planningFallacyWatching?: PlanningFallacyWatching;
|
|
295
285
|
/**
|
|
296
|
-
*
|
|
286
|
+
* Recall-recurrence anchoring hint. Populated
|
|
297
287
|
* when api.recall's `opts.recallHistory` snapshot + the just-computed
|
|
298
|
-
* top-1 satisfy
|
|
288
|
+
* top-1 satisfy the query_repeat or memory_dominance rule.
|
|
299
289
|
*
|
|
300
290
|
* Per-pipeline detection: each pipeline (api.recall, cmdRecall, MCP)
|
|
301
291
|
* computes its OWN hint against its OWN top-1. This field reflects
|
|
@@ -311,7 +301,7 @@ export interface RecallResult {
|
|
|
311
301
|
*/
|
|
312
302
|
anchoringHint?: AnchoringHint;
|
|
313
303
|
/**
|
|
314
|
-
*
|
|
304
|
+
* Availability/recency-bias hint. Per-pipeline (computed
|
|
315
305
|
* against this pipeline's own returned top-K + the matched candidate pool
|
|
316
306
|
* it was drawn from), soft-warning ONLY: never filters, reorders, or
|
|
317
307
|
* suppresses a result. Fires when the returned slice is recency-dominated
|
|
@@ -321,7 +311,7 @@ export interface RecallResult {
|
|
|
321
311
|
availabilityHint?: AvailabilityHint;
|
|
322
312
|
}
|
|
323
313
|
/**
|
|
324
|
-
*
|
|
314
|
+
* WYSIATI cutoff transparency.
|
|
325
315
|
*
|
|
326
316
|
* Surfaces what the recall pipeline excluded from `results[]` so the calling
|
|
327
317
|
* agent does not treat the cutoff as the full picture (Kahneman's "What You
|
|
@@ -371,19 +361,17 @@ export interface RecallSuppressionSummary {
|
|
|
371
361
|
*/
|
|
372
362
|
freshTailAdded: number;
|
|
373
363
|
/** Counter of memories suppressed by detected interference patterns.
|
|
374
|
-
*
|
|
375
|
-
* pipeline's own
|
|
376
|
-
* anchoring detector
|
|
364
|
+
* Incremented by 1 PER PIPELINE when that
|
|
365
|
+
* pipeline's own memory_dominance verdict fires (via the
|
|
366
|
+
* anchoring detector, see `detectAnchoring()` in src/recall-history.ts).
|
|
377
367
|
* Each pipeline (api.recall, cmdRecall, MCP physics/hybrid) bumps its
|
|
378
368
|
* OWN suppressionSummary independently because each runs its own
|
|
379
369
|
* detector against its own top-1 + its own per-(tenant, session) ring
|
|
380
370
|
* buffer. The number reflects this-pipeline interference only; not a
|
|
381
371
|
* cross-pipeline aggregate.
|
|
382
372
|
*
|
|
383
|
-
*
|
|
384
|
-
*
|
|
385
|
-
* doc that referenced one was speculative; J1 uses caller-side in-memory
|
|
386
|
-
* rings instead.
|
|
373
|
+
* No `interference_suppression` table exists; the detector uses
|
|
374
|
+
* caller-side in-memory rings instead.
|
|
387
375
|
*/
|
|
388
376
|
suppressedByInterference: number;
|
|
389
377
|
}
|
package/dist/api/recall.d.ts
CHANGED
|
@@ -5,7 +5,7 @@ import { type Context } from './types.js';
|
|
|
5
5
|
* `api.recall`, `cmdRecall`, and the MCP `hippo_recall` handler so all three
|
|
6
6
|
* pipelines produce the same shape without duplicating field-construction
|
|
7
7
|
* logic. Pass-through identity today; kept as a helper so future field
|
|
8
|
-
* additions
|
|
8
|
+
* additions land at one site.
|
|
9
9
|
*/
|
|
10
10
|
export declare function buildSuppressionSummary(counts: {
|
|
11
11
|
totalCandidates: number;
|
|
@@ -20,7 +20,7 @@ export declare function buildSuppressionSummary(counts: {
|
|
|
20
20
|
* `ctx.tenantId` and keeps that order whatever `mode` says; `retrieve` is the
|
|
21
21
|
* mode-aware, strengthening variant the HTTP route uses.
|
|
22
22
|
*
|
|
23
|
-
* **api.recall does NOT mutate `index.last_retrieval_ids`** (
|
|
23
|
+
* **api.recall does NOT mutate `index.last_retrieval_ids`** (contract
|
|
24
24
|
* lock). The CLI `cmdRecall` (cli.ts) writes `last_retrieval_ids` because the
|
|
25
25
|
* CLI is interactive (user is about to run `hippo outcome --good`). SDK callers
|
|
26
26
|
* are programmatic: they either pass explicit ids to `api.outcome` or call
|
|
@@ -31,6 +31,6 @@ export declare function buildSuppressionSummary(counts: {
|
|
|
31
31
|
* `tests/api-recall-no-side-effects.test.ts`.
|
|
32
32
|
*/
|
|
33
33
|
export declare function recall(ctx: Context, opts: RecallOpts): RecallResult;
|
|
34
|
-
/** Mode-aware recall that strengthens each returned row; never writes last_retrieval_ids (
|
|
34
|
+
/** Mode-aware recall that strengthens each returned row; never writes last_retrieval_ids (contract lock). */
|
|
35
35
|
export declare function retrieve(ctx: Context, opts: RecallOpts): Promise<RecallResult>;
|
|
36
36
|
//# sourceMappingURL=recall.d.ts.map
|
package/dist/api/recall.js
CHANGED
|
@@ -29,7 +29,7 @@ import { RecallContractError } from './types.js';
|
|
|
29
29
|
* `api.recall`, `cmdRecall`, and the MCP `hippo_recall` handler so all three
|
|
30
30
|
* pipelines produce the same shape without duplicating field-construction
|
|
31
31
|
* logic. Pass-through identity today; kept as a helper so future field
|
|
32
|
-
* additions
|
|
32
|
+
* additions land at one site.
|
|
33
33
|
*/
|
|
34
34
|
export function buildSuppressionSummary(counts) {
|
|
35
35
|
return {
|
|
@@ -46,7 +46,7 @@ export function buildSuppressionSummary(counts) {
|
|
|
46
46
|
* `ctx.tenantId` and keeps that order whatever `mode` says; `retrieve` is the
|
|
47
47
|
* mode-aware, strengthening variant the HTTP route uses.
|
|
48
48
|
*
|
|
49
|
-
* **api.recall does NOT mutate `index.last_retrieval_ids`** (
|
|
49
|
+
* **api.recall does NOT mutate `index.last_retrieval_ids`** (contract
|
|
50
50
|
* lock). The CLI `cmdRecall` (cli.ts) writes `last_retrieval_ids` because the
|
|
51
51
|
* CLI is interactive (user is about to run `hippo outcome --good`). SDK callers
|
|
52
52
|
* are programmatic: they either pass explicit ids to `api.outcome` or call
|
|
@@ -62,7 +62,7 @@ export function recall(ctx, opts) {
|
|
|
62
62
|
const windowSize = recallWindowSize(opts);
|
|
63
63
|
return recallFrom(ctx, opts, windowSize, loadRecallSearchEntries(ctx.hippoRoot, opts.query, windowSize, ctx.tenantId, opts.scope, 'exact', false));
|
|
64
64
|
}
|
|
65
|
-
/** Mode-aware recall that strengthens each returned row; never writes last_retrieval_ids (
|
|
65
|
+
/** Mode-aware recall that strengthens each returned row; never writes last_retrieval_ids (contract lock). */
|
|
66
66
|
export async function retrieve(ctx, opts) {
|
|
67
67
|
assertScopeRequestAllowed(ctx.actor, opts.scope);
|
|
68
68
|
const windowSize = recallWindowSize(opts);
|
|
@@ -131,11 +131,8 @@ async function retrieveFromStore(ctx, opts, windowSize, show) {
|
|
|
131
131
|
}
|
|
132
132
|
/** Contract preflight: throws before any store-touching work. */
|
|
133
133
|
function recallWindowSize(opts) {
|
|
134
|
-
//
|
|
135
|
-
//
|
|
136
|
-
// call). For a true contract preflight we want the throw before any
|
|
137
|
-
// store-touching work. Single check here; the consumer site at
|
|
138
|
-
// `if (freshTailCount > 0)` does NOT re-validate (would be a no-op).
|
|
134
|
+
// Throw before loadSearchEntries, which runs initStore and migrates legacy state on first call.
|
|
135
|
+
// The consumer site at `if (freshTailCount > 0)` does NOT re-validate.
|
|
139
136
|
const freshTailCountPreflight = opts.freshTailCount ?? 0;
|
|
140
137
|
if (freshTailCountPreflight > 0 &&
|
|
141
138
|
!opts.freshTailSessionId &&
|
|
@@ -143,16 +140,8 @@ function recallWindowSize(opts) {
|
|
|
143
140
|
throw new RecallContractError('fresh_tail_requires_session_id', 'fresh-tail requires a session id when HIPPO_REQUIRE_SESSION_SCOPED_FRESH_TAIL=1; ' +
|
|
144
141
|
'pass opts.freshTailSessionId or unset the env to allow tenant-wide fresh-tail.');
|
|
145
142
|
}
|
|
146
|
-
//
|
|
147
|
-
//
|
|
148
|
-
// preserves every pre-v1.7.0 caller's behaviour bit-for-bit (codex
|
|
149
|
-
// mk2-pass P0-1: defaulting to `limit` would have shrunk the
|
|
150
|
-
// candidate pool and killed overflow summaries).
|
|
151
|
-
// DEFAULT_SEARCH_CANDIDATE_LIMIT is imported from store.ts so the two
|
|
152
|
-
// values cannot drift (codex diff-pass P1 #3).
|
|
153
|
-
// Validate the input — codex diff-pass P1 #1 caught that scorerWindow=0
|
|
154
|
-
// would route through FTS/LIKE LIMIT 0 and then fall through to an
|
|
155
|
-
// uncapped full-store fallback. Reject non-positive / non-finite values.
|
|
143
|
+
// Undefined keeps the store default: defaulting to `limit` would shrink the pool and kill overflow summaries.
|
|
144
|
+
// 0 would reach FTS/LIKE LIMIT 0 and then an uncapped full-store fallback, so non-positive values throw.
|
|
156
145
|
if (opts.scorerWindow !== undefined) {
|
|
157
146
|
if (!Number.isFinite(opts.scorerWindow) ||
|
|
158
147
|
!Number.isInteger(opts.scorerWindow) ||
|
package/dist/api/remember.d.ts
CHANGED
|
@@ -10,14 +10,14 @@ export interface RememberOpts {
|
|
|
10
10
|
tags?: string[];
|
|
11
11
|
/**
|
|
12
12
|
* Optional hook invoked inside the same transaction as the underlying
|
|
13
|
-
* memories INSERT. Used by ingestion connectors
|
|
13
|
+
* memories INSERT. Used by ingestion connectors to stamp
|
|
14
14
|
* idempotency / cursor rows atomically with the memory row, so a crash
|
|
15
15
|
* mid-write cannot produce a memory without its corresponding side-effect
|
|
16
16
|
* log row (or vice versa). If the callback throws, the INSERT is rolled
|
|
17
17
|
* back and the error is rethrown.
|
|
18
18
|
*/
|
|
19
19
|
afterWrite?: (db: DatabaseSyncLike, memoryId: string) => void;
|
|
20
|
-
/**
|
|
20
|
+
/** Connector-ingested content an agent doesn't control; gates detectInstruction. CLI/HTTP/MCP never set this. */
|
|
21
21
|
untrusted?: boolean;
|
|
22
22
|
}
|
|
23
23
|
export interface RememberResult {
|
package/dist/api/sleep.d.ts
CHANGED
|
@@ -64,22 +64,21 @@ export interface SleepResult {
|
|
|
64
64
|
};
|
|
65
65
|
shared?: number;
|
|
66
66
|
/**
|
|
67
|
-
*
|
|
67
|
+
* Count of memories the auto-share secret veto withheld this sleep
|
|
68
68
|
* — rows that passed every other admission gate (transfer score,
|
|
69
69
|
* not-already-global) and were blocked solely by `detectSecret`. Absent
|
|
70
70
|
* when 0 or when auto-share did not run.
|
|
71
71
|
*/
|
|
72
72
|
secretSkipped?: number;
|
|
73
73
|
/**
|
|
74
|
-
*
|
|
75
|
-
* tombstone refused this sleep
|
|
76
|
-
*
|
|
77
|
-
* batch). Absent when 0 or when auto-share did not run.
|
|
74
|
+
* Count of auto-share candidates the GLOBAL store's rejection
|
|
75
|
+
* tombstone refused this sleep; copy paths must not let one rejected
|
|
76
|
+
* candidate abort the batch. Absent when 0 or when auto-share did not run.
|
|
78
77
|
*/
|
|
79
78
|
rejectedSkipped?: number;
|
|
80
79
|
ambient?: AmbientState | null;
|
|
81
80
|
/**
|
|
82
|
-
*
|
|
81
|
+
* Graph re-extraction totals across the tenants rebuilt
|
|
83
82
|
* this sleep. Absent when no tenant was dirty, and under dryRun (the graph
|
|
84
83
|
* phase runs only on a real sleep). Cross-tenant aggregate, one reason
|
|
85
84
|
* /v1/sleep stays loopback-only.
|
|
@@ -91,35 +90,7 @@ export interface SleepResult {
|
|
|
91
90
|
};
|
|
92
91
|
details?: string[];
|
|
93
92
|
}
|
|
94
|
-
/**
|
|
95
|
-
* Run the pure-storage consolidation pipeline.
|
|
96
|
-
*
|
|
97
|
-
* Tenant scope note: sleep operates on the WHOLE hippoRoot (all tenants in
|
|
98
|
-
* it), matching the pre-refactor cmdSleepCore behavior. Correct for a CLI
|
|
99
|
-
* maintenance op invoked by the operator. Episode B (v1.11.4) exposed this
|
|
100
|
-
* over HTTP `/v1/sleep` with loopback-only enforcement (per-request guard
|
|
101
|
-
* in the handler plus serve()'s boot-time host check). The TODOS.md
|
|
102
|
-
* per-tenant scoping follow-up remains open for the day non-loopback
|
|
103
|
-
* serving lands — at that point the route will need an admin-role gate OR
|
|
104
|
-
* api.sleep itself will need to scope dedup / audit / delete by ctx.tenantId.
|
|
105
|
-
*
|
|
106
|
-
* Dedup and audit deletes each log a `forget` row with the ctx actor and a
|
|
107
|
-
* `metadata.reason`. Pinned, raw, kept and object-backing rows are never auto-deleted (AUTOMATIC_DELETE_SQL).
|
|
108
|
-
* dryRun previews consolidate, dedup and audit, then returns before share/ambient.
|
|
109
|
-
*/
|
|
110
|
-
/**
|
|
111
|
-
* v1.12.2: Test-only DI seam shape for `sleep`'s phase dependencies.
|
|
112
|
-
*
|
|
113
|
-
* Each field defaults to the real production implementation imported at the
|
|
114
|
-
* top of this file. Test files pass a `Partial<SleepPhases>` override via
|
|
115
|
-
* `SleepOpts.__phases` (note the `__` prefix — internal-only) to inject
|
|
116
|
-
* deterministic throws for mid-phase failure-path coverage (the
|
|
117
|
-
* `partial: true` + `errorMessage` audit-row branch at line ~2098).
|
|
118
|
-
*
|
|
119
|
-
* Production callers MUST NOT use `__phases`. The field exists solely so
|
|
120
|
-
* `tests/api-sleep-phase-faults.test.ts` can force each phase boundary to
|
|
121
|
-
* throw without depending on store-corruption fragility.
|
|
122
|
-
*/
|
|
93
|
+
/** Test-only seam: `SleepOpts.__phases` forces a phase to throw into emitSleepAudit's `partial: true` row; production never sets it. */
|
|
123
94
|
export interface SleepPhases {
|
|
124
95
|
consolidate: typeof consolidate;
|
|
125
96
|
deduplicateStore: typeof deduplicateStore;
|
|
@@ -132,5 +103,6 @@ export interface SleepPhases {
|
|
|
132
103
|
loadPendingExtractionTenants: typeof loadPendingExtractionTenants;
|
|
133
104
|
extractGraph: typeof extractGraph;
|
|
134
105
|
}
|
|
106
|
+
/** Sleeps the WHOLE hippoRoot, every tenant, so /v1/sleep stays loopback-only; never auto-deletes pinned, raw, kept or object-backing rows. */
|
|
135
107
|
export declare function sleep(ctx: Context, opts?: SleepOpts): Promise<SleepResult>;
|
|
136
108
|
//# sourceMappingURL=sleep.d.ts.map
|
package/dist/api/sleep.js
CHANGED
|
@@ -23,12 +23,13 @@ const DEFAULT_SLEEP_PHASES = {
|
|
|
23
23
|
loadPendingExtractionTenants,
|
|
24
24
|
extractGraph,
|
|
25
25
|
};
|
|
26
|
+
/** Sleeps the WHOLE hippoRoot, every tenant, so /v1/sleep stays loopback-only; never auto-deletes pinned, raw, kept or object-backing rows. */
|
|
26
27
|
export async function sleep(ctx, opts = {}) {
|
|
27
28
|
const dryRun = Boolean(opts.dryRun);
|
|
28
|
-
//
|
|
29
|
+
// Resolve phase dependencies, allowing test-only `__phases`
|
|
29
30
|
// override to inject deterministic throws for mid-phase failure coverage.
|
|
30
31
|
const phases = { ...DEFAULT_SLEEP_PHASES, ...(opts.__phases ?? {}) };
|
|
31
|
-
//
|
|
32
|
+
// Phase counters for the consolidate audit emit (in finally).
|
|
32
33
|
// Accumulated as each phase completes so partial-failure paths still report
|
|
33
34
|
// accurate "what got done before the failure" data.
|
|
34
35
|
const counts = { consolidation: 0, dedup: 0, auditDeleted: 0, ambient: 0 };
|
package/dist/api/tokens.d.ts
CHANGED
|
@@ -2,7 +2,7 @@ import { type TokenSummary, type TokenSurface } from '../token-ledger.js';
|
|
|
2
2
|
import { type FailureSummary } from '../failure-log.js';
|
|
3
3
|
import type { Context } from './types.js';
|
|
4
4
|
/**
|
|
5
|
-
* Record memory text handed to an agent in the token ledger
|
|
5
|
+
* Record memory text handed to an agent in the token ledger.
|
|
6
6
|
* Best-effort: never throws, because a ledger failure must not fail the
|
|
7
7
|
* recall or context call that produced the text.
|
|
8
8
|
*/
|
|
@@ -19,7 +19,7 @@ export declare function recordTokens(ctx: Context, surface: TokenSurface, use: {
|
|
|
19
19
|
export declare function tokenSummary(ctx: Context, opts?: {
|
|
20
20
|
days?: number;
|
|
21
21
|
}): TokenSummary;
|
|
22
|
-
/** Failed tool calls by outcome, and repeats across sessions, over the last `days` days (default 30)
|
|
22
|
+
/** Failed tool calls by outcome, and repeats across sessions, over the last `days` days (default 30). */
|
|
23
23
|
export declare function failureSummary(ctx: Context, opts?: {
|
|
24
24
|
days?: number;
|
|
25
25
|
}): FailureSummary;
|
package/dist/api/tokens.js
CHANGED
|
@@ -4,7 +4,7 @@ import { recordTokenUse, summarizeTokenUse } from '../token-ledger.js';
|
|
|
4
4
|
import { summarizeFailures } from '../failure-log.js';
|
|
5
5
|
import { log } from '../log.js';
|
|
6
6
|
/**
|
|
7
|
-
* Record memory text handed to an agent in the token ledger
|
|
7
|
+
* Record memory text handed to an agent in the token ledger.
|
|
8
8
|
* Best-effort: never throws, because a ledger failure must not fail the
|
|
9
9
|
* recall or context call that produced the text.
|
|
10
10
|
*/
|
|
@@ -43,7 +43,7 @@ export function tokenSummary(ctx, opts = {}) {
|
|
|
43
43
|
closeHippoDb(db);
|
|
44
44
|
}
|
|
45
45
|
}
|
|
46
|
-
/** Failed tool calls by outcome, and repeats across sessions, over the last `days` days (default 30)
|
|
46
|
+
/** Failed tool calls by outcome, and repeats across sessions, over the last `days` days (default 30). */
|
|
47
47
|
export function failureSummary(ctx, opts = {}) {
|
|
48
48
|
const db = openHippoDb(ctx.hippoRoot);
|
|
49
49
|
try {
|
package/dist/api/types.d.ts
CHANGED
|
@@ -1,18 +1,16 @@
|
|
|
1
1
|
import { BadRequestError } from '../api-errors.js';
|
|
2
2
|
/**
|
|
3
|
-
* Actor identity + authorization role for a Context.
|
|
3
|
+
* Actor identity + authorization role for a Context.
|
|
4
4
|
*
|
|
5
|
-
*
|
|
6
|
-
*
|
|
7
|
-
* a role for /v1/sleep admin gating. Audit helpers continue accepting `string`
|
|
8
|
-
* — callers pass `ctx.actor.subject`. Role checks happen at the request
|
|
5
|
+
* Carries the audit-log subject plus a role for /v1/sleep admin gating. Audit
|
|
6
|
+
* helpers take the bare `string`, so callers pass `ctx.actor.subject`. Role checks happen at the request
|
|
9
7
|
* boundary (e.g. /v1/sleep), except in authCreate and authRevoke (ForbiddenError).
|
|
10
8
|
*/
|
|
11
9
|
export interface Actor {
|
|
12
10
|
/** 'cli' | 'localhost:cli' | 'api_key:<key_id>' | 'mcp' | 'connector:slack' | 'connector:github' */
|
|
13
11
|
subject: string;
|
|
14
12
|
role: 'admin' | 'member';
|
|
15
|
-
/**
|
|
13
|
+
/** Restricted scopes a member key may read (auth.ts grantScope). Unused for admin actors. */
|
|
16
14
|
scopes?: readonly string[];
|
|
17
15
|
/** An auth resolver vouched for this caller, so its admin role stops at its own tenant. */
|
|
18
16
|
viaAuthResolver?: true;
|
|
@@ -44,10 +42,8 @@ export declare function adminActor(subject: string): Actor;
|
|
|
44
42
|
* is opt-in so multi-session tenants can fail loud instead of silently
|
|
45
43
|
* surfacing cross-session rows tagged `isFreshTail=true`.
|
|
46
44
|
* - 'invalid_scorer_window' — `opts.scorerWindow` is set to a non-positive,
|
|
47
|
-
* non-integer, or non-finite value.
|
|
48
|
-
*
|
|
49
|
-
* full-store fallback (codex v1.7.0 diff-pass P1). Validated upfront
|
|
50
|
-
* so the contract holds.
|
|
45
|
+
* non-integer, or non-finite value. 0 would route through FTS/LIKE
|
|
46
|
+
* `LIMIT 0` and then an uncapped full-store fallback, so it is validated upfront.
|
|
51
47
|
*/
|
|
52
48
|
export declare class RecallContractError extends BadRequestError {
|
|
53
49
|
readonly code: 'fresh_tail_requires_session_id' | 'invalid_scorer_window';
|
package/dist/api/types.js
CHANGED
|
@@ -22,10 +22,8 @@ export function adminActor(subject) {
|
|
|
22
22
|
* is opt-in so multi-session tenants can fail loud instead of silently
|
|
23
23
|
* surfacing cross-session rows tagged `isFreshTail=true`.
|
|
24
24
|
* - 'invalid_scorer_window' — `opts.scorerWindow` is set to a non-positive,
|
|
25
|
-
* non-integer, or non-finite value.
|
|
26
|
-
*
|
|
27
|
-
* full-store fallback (codex v1.7.0 diff-pass P1). Validated upfront
|
|
28
|
-
* so the contract holds.
|
|
25
|
+
* non-integer, or non-finite value. 0 would route through FTS/LIKE
|
|
26
|
+
* `LIMIT 0` and then an uncapped full-store fallback, so it is validated upfront.
|
|
29
27
|
*/
|
|
30
28
|
export class RecallContractError extends BadRequestError {
|
|
31
29
|
code;
|
package/dist/audit-prune.d.ts
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
/**
|
|
2
|
-
* Audit log retention pruning
|
|
2
|
+
* Audit log retention pruning.
|
|
3
3
|
*
|
|
4
4
|
* The `audit_log` table grows unbounded by default — every recall, write,
|
|
5
5
|
* outcome, sleep, supersede, promote, forget, archive_raw, auth_revoke,
|
|
@@ -7,10 +7,8 @@
|
|
|
7
7
|
* accumulate to millions of rows and slow down both audit queries and
|
|
8
8
|
* incremental SQLite VACUUMs.
|
|
9
9
|
*
|
|
10
|
-
*
|
|
11
|
-
*
|
|
12
|
-
* regulatory retention floors (HIPAA, SOX, GDPR) — the prune should be
|
|
13
|
-
* opt-in per tenant and emit its own audit trail event."
|
|
10
|
+
* Regulatory retention floors (HIPAA, SOX, GDPR) are why the prune is opt-in
|
|
11
|
+
* per tenant and emits its own audit trail event.
|
|
14
12
|
*
|
|
15
13
|
* Design notes:
|
|
16
14
|
* - Per-tenant by default (matches existing audit CLI conventions).
|
|
@@ -29,7 +27,7 @@ import type { DatabaseSyncLike } from './db.js';
|
|
|
29
27
|
export interface PruneAuditOpts {
|
|
30
28
|
/** Cutoff in days. Rows with `ts < (now - N days)` are deleted. */
|
|
31
29
|
olderThanDays: number;
|
|
32
|
-
/** Tenant scope. Required
|
|
30
|
+
/** Tenant scope. Required: prune is always tenant-scoped. */
|
|
33
31
|
tenantId: string;
|
|
34
32
|
/** When true, count matching rows but do NOT delete. Default false. */
|
|
35
33
|
dryRun?: boolean;
|
package/dist/audit-prune.js
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
/**
|
|
2
|
-
* Audit log retention pruning
|
|
2
|
+
* Audit log retention pruning.
|
|
3
3
|
*
|
|
4
4
|
* The `audit_log` table grows unbounded by default — every recall, write,
|
|
5
5
|
* outcome, sleep, supersede, promote, forget, archive_raw, auth_revoke,
|
|
@@ -7,10 +7,8 @@
|
|
|
7
7
|
* accumulate to millions of rows and slow down both audit queries and
|
|
8
8
|
* incremental SQLite VACUUMs.
|
|
9
9
|
*
|
|
10
|
-
*
|
|
11
|
-
*
|
|
12
|
-
* regulatory retention floors (HIPAA, SOX, GDPR) — the prune should be
|
|
13
|
-
* opt-in per tenant and emit its own audit trail event."
|
|
10
|
+
* Regulatory retention floors (HIPAA, SOX, GDPR) are why the prune is opt-in
|
|
11
|
+
* per tenant and emits its own audit trail event.
|
|
14
12
|
*
|
|
15
13
|
* Design notes:
|
|
16
14
|
* - Per-tenant by default (matches existing audit CLI conventions).
|