hippo-memory 1.56.0 → 1.57.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/dist/api.d.ts +16 -9
- package/dist/api.js +57 -24
- package/dist/card-detail.d.ts +1 -1
- package/dist/card-detail.js +1 -1
- package/dist/cli/shared.d.ts +137 -0
- package/dist/cli/shared.js +830 -0
- package/dist/cli/sleep.d.ts +10 -0
- package/dist/cli/sleep.js +171 -0
- package/dist/cli.d.ts +0 -7
- package/dist/cli.js +223 -1789
- package/dist/connectors/github/webhook.d.ts +19 -0
- package/dist/connectors/github/webhook.js +313 -0
- package/dist/connectors/slack/webhook.d.ts +22 -0
- package/dist/connectors/slack/webhook.js +203 -0
- package/dist/consolidate.js +3 -2
- package/dist/context-auto.d.ts +3 -0
- package/dist/context-auto.js +34 -0
- package/dist/customer-notes.js +2 -1
- package/dist/dashboard.js +2 -1
- package/dist/decisions.js +2 -1
- package/dist/eval-stats.d.ts +58 -0
- package/dist/eval-stats.js +111 -0
- package/dist/goals.d.ts +49 -25
- package/dist/goals.js +39 -22
- package/dist/graph-extract.js +1 -1
- package/dist/graph-recall.d.ts +1 -1
- package/dist/graph-recall.js +1 -1
- package/dist/graph.js +1 -1
- package/dist/hooks.d.ts +1 -3
- package/dist/hooks.js +2 -4
- package/dist/http-util.d.ts +31 -0
- package/dist/http-util.js +46 -0
- package/dist/incidents.js +2 -1
- package/dist/index.d.ts +5 -2
- package/dist/index.js +5 -2
- package/dist/mcp/server.js +173 -285
- package/dist/memory.d.ts +19 -0
- package/dist/memory.js +38 -0
- package/dist/policies.js +2 -1
- package/dist/predictions.js +2 -1
- package/dist/processes.js +2 -1
- package/dist/project-briefs.js +3 -1
- package/dist/prompt-recall.js +1 -1
- package/dist/recall-history.d.ts +5 -0
- package/dist/recall-history.js +9 -0
- package/dist/recall-pipeline.d.ts +101 -0
- package/dist/recall-pipeline.js +313 -0
- package/dist/recall-scope.d.ts +22 -0
- package/dist/recall-scope.js +27 -1
- package/dist/search.d.ts +0 -20
- package/dist/search.js +2 -49
- package/dist/server.js +1901 -2384
- package/dist/skills.js +2 -1
- package/dist/store-cards.d.ts +53 -0
- package/dist/store-cards.js +512 -0
- package/dist/store.d.ts +2 -89
- package/dist/store.js +6 -562
- package/dist/tenant.d.ts +22 -0
- package/dist/tenant.js +26 -0
- package/dist/tokenize.d.ts +2 -0
- package/dist/tokenize.js +8 -0
- package/dist/version.d.ts +1 -1
- package/dist/version.js +1 -1
- package/extensions/openclaw-plugin/openclaw.plugin.json +1 -1
- package/extensions/openclaw-plugin/package.json +1 -1
- package/openclaw.plugin.json +1 -1
- package/package.json +1 -1
package/dist/search.js
CHANGED
|
@@ -3,7 +3,8 @@
|
|
|
3
3
|
* Zero external dependencies when embeddings are not available.
|
|
4
4
|
*/
|
|
5
5
|
import { estimateTokens } from './token-ledger.js';
|
|
6
|
-
import { calculateStrength,
|
|
6
|
+
import { calculateStrength, CHURN_STALE_TAG } from './memory.js';
|
|
7
|
+
import { tokenize } from './tokenize.js';
|
|
7
8
|
import { isOutcomeFastAblated, isRecallBoostAblated, isRecencyAblated, evalRecencyScaleDays, evalNow } from './ablation.js';
|
|
8
9
|
import { extractPathTags, pathBoostMultiplier } from './path-context.js';
|
|
9
10
|
import { detectScope, scopeMatch } from './scope.js';
|
|
@@ -20,16 +21,6 @@ export const CHURN_STALE_RANK_MULTIPLIER = 0.5; // SHORTCUT: untuned; FE3 measur
|
|
|
20
21
|
export function churnStaleFactor(entry) {
|
|
21
22
|
return entry.tags.includes(CHURN_STALE_TAG) ? CHURN_STALE_RANK_MULTIPLIER : 1.0;
|
|
22
23
|
}
|
|
23
|
-
// ---------------------------------------------------------------------------
|
|
24
|
-
// Tokenizer
|
|
25
|
-
// ---------------------------------------------------------------------------
|
|
26
|
-
export function tokenize(text) {
|
|
27
|
-
return text
|
|
28
|
-
.toLowerCase()
|
|
29
|
-
.replace(/[^\w\s]/g, ' ')
|
|
30
|
-
.split(/\s+/)
|
|
31
|
-
.filter((t) => t.length > 1);
|
|
32
|
-
}
|
|
33
24
|
const BM25_K1 = 1.5;
|
|
34
25
|
const BM25_B = 0.75;
|
|
35
26
|
export function buildCorpus(texts) {
|
|
@@ -902,44 +893,6 @@ export function search(query, entries, options = {}) {
|
|
|
902
893
|
}
|
|
903
894
|
return fitBudget(dedupedSync, budget, minResults, options.cost);
|
|
904
895
|
}
|
|
905
|
-
/**
|
|
906
|
-
* Update retrieval metadata on entries that were returned by a search.
|
|
907
|
-
* Returns the mutated copies (caller must persist to disk).
|
|
908
|
-
*
|
|
909
|
-
* EVAL-ONLY ablation (see ablation.ts): with HIPPO_ABLATE_RECALL_BOOST set,
|
|
910
|
-
* this returns the entries UNMUTATED - neutralizing all three strengthening
|
|
911
|
-
* sub-effects (clock reset, retrieval_count, half-life increment) at the
|
|
912
|
-
* single shared write site. The entries (not an empty array) must be
|
|
913
|
-
* returned because callers derive `last_retrieval_ids` from the return
|
|
914
|
-
* value, and a later `hippo outcome --good/--bad` targets those ids - an
|
|
915
|
-
* empty return would silently co-ablate the outcome channel in the
|
|
916
|
-
* strengthen-off arm (codex round-7 P2). PERSISTENCE is gated separately at
|
|
917
|
-
* each persisting caller (CLI recall, api context, MCP recall/context,
|
|
918
|
-
* consolidation replay): writeEntry on identical rows still refreshes
|
|
919
|
-
* updated_at, rewrites mirrors, and marks DAG parents dirty (codex round-6
|
|
920
|
-
* P2), so those write loops skip under the flag.
|
|
921
|
-
* The default `now` honors HIPPO_FAKE_NOW (simulated-time protocols).
|
|
922
|
-
*/
|
|
923
|
-
// Confidence is deliberately absent below: it is an epistemic tier, not a
|
|
924
|
-
// recency signal, and a stored 'stale' is always a deliberate mark (2026-09-07).
|
|
925
|
-
export function markRetrieved(entries, now = evalNow()) {
|
|
926
|
-
if (isRecallBoostAblated())
|
|
927
|
-
return entries;
|
|
928
|
-
return entries.map((e) => {
|
|
929
|
-
if (e.superseded_by)
|
|
930
|
-
return e;
|
|
931
|
-
const wrong = netWrong(e) > 0;
|
|
932
|
-
const updated = {
|
|
933
|
-
...e,
|
|
934
|
-
retrieval_count: e.retrieval_count + 1,
|
|
935
|
-
last_retrieved: wrong ? e.last_retrieved : now.toISOString(),
|
|
936
|
-
// +2 days half-life per retrieval (PLAN.md); a wrong memory keeps both, since last_retrieved is the decay anchor
|
|
937
|
-
half_life_days: wrong ? e.half_life_days : e.half_life_days + 2,
|
|
938
|
-
};
|
|
939
|
-
updated.strength = calculateStrength(updated, now);
|
|
940
|
-
return updated;
|
|
941
|
-
});
|
|
942
|
-
}
|
|
943
896
|
/**
|
|
944
897
|
* Explain why a search result matched a query.
|
|
945
898
|
* Computes which query terms overlapped with the document and whether
|