hippo-memory 1.64.1 → 1.65.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/agent-memories/sync.js +3 -2
- package/dist/api/recall-record.d.ts +46 -0
- package/dist/api/recall-record.js +98 -0
- package/dist/api/recall-request.d.ts +32 -0
- package/dist/api/recall-request.js +121 -0
- package/dist/api/recall-types.d.ts +7 -1
- package/dist/api/recall.d.ts +3 -2
- package/dist/api/recall.js +174 -181
- package/dist/api/tokens.d.ts +1 -1
- package/dist/api/tokens.js +13 -17
- package/dist/cli/recall.d.ts +1 -1
- package/dist/cli/recall.js +18 -49
- package/dist/cli/shared.js +2 -2
- package/dist/cli.d.ts +16 -0
- package/dist/cli.js +18 -1
- package/dist/config.d.ts +2 -0
- package/dist/config.js +4 -0
- package/dist/db/connect.d.ts +5 -0
- package/dist/db/connect.js +52 -0
- package/dist/db/open.d.ts +9 -11
- package/dist/db/open.js +23 -116
- package/dist/db/request-stores.d.ts +30 -0
- package/dist/db/request-stores.js +100 -0
- package/dist/db/sqlite-blocked.d.ts +6 -0
- package/dist/db/sqlite-blocked.js +11 -0
- package/dist/db.d.ts +3 -1
- package/dist/db.js +3 -1
- package/dist/embeddings.js +2 -1
- package/dist/goals.d.ts +18 -11
- package/dist/goals.js +38 -36
- package/dist/http-util.d.ts +2 -0
- package/dist/http-util.js +5 -0
- package/dist/mcp/memory-tools.js +4 -1
- package/dist/mcp/recall-tools.js +28 -133
- package/dist/mcp/request.d.ts +7 -0
- package/dist/mcp/request.js +63 -41
- package/dist/mcp/session-state.d.ts +1 -3
- package/dist/mcp/session-state.js +3 -5
- package/dist/predictions/planning-fallacy.d.ts +52 -0
- package/dist/predictions/planning-fallacy.js +70 -55
- package/dist/recall-trace.d.ts +1 -1
- package/dist/recall-trace.js +5 -4
- package/dist/search/physics-search.js +4 -1
- package/dist/search/vector.js +2 -0
- package/dist/server/routes/recall.d.ts +1 -1
- package/dist/server/routes/recall.js +30 -218
- package/dist/server.d.ts +12 -1
- package/dist/server.js +33 -22
- package/dist/store/entry-writes.d.ts +2 -0
- package/dist/store/entry-writes.js +24 -16
- package/dist/store-port.d.ts +70 -1
- package/dist/store-port.js +87 -9
- 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/store-port.js
CHANGED
|
@@ -1,20 +1,98 @@
|
|
|
1
1
|
// The async seam the server reaches its store through, so an add-on can serve from a database other than hippo.db.
|
|
2
2
|
import { readApiKeyRecord } from './auth.js';
|
|
3
|
-
import {
|
|
4
|
-
|
|
3
|
+
import { appendAuditEvent } from './audit.js';
|
|
4
|
+
import { closeHippoDb, openHippoDb, withWriteScope } from './db.js';
|
|
5
|
+
import { activeGoalsWithPolicies, localGoalRecallRows, writeGoalRecallLog, } from './goals.js';
|
|
6
|
+
import { planningFallacyEvidenceAt } from './predictions/planning-fallacy.js';
|
|
7
|
+
import { writeRecallTrace } from './recall-trace.js';
|
|
8
|
+
import { loadEntriesByIds, loadFreshRawMemories } from './store/entry-reads.js';
|
|
9
|
+
import { strengthenRetrievedInOwnTx } from './store/entry-writes.js';
|
|
10
|
+
import { loadLatestHandoff } from './store/handoffs.js';
|
|
11
|
+
import { updateStats } from './store/index-and-stats.js';
|
|
12
|
+
import { loadRecallSearchEntries } from './store/search-rows.js';
|
|
13
|
+
import { listSessionEvents, loadActiveTaskSnapshot } from './store/sessions.js';
|
|
14
|
+
import { recordTokenUse } from './token-ledger.js';
|
|
15
|
+
function onHandle(hippoRoot, fn) {
|
|
16
|
+
const db = openHippoDb(hippoRoot);
|
|
17
|
+
try {
|
|
18
|
+
return fn(db);
|
|
19
|
+
}
|
|
20
|
+
finally {
|
|
21
|
+
closeHippoDb(db);
|
|
22
|
+
}
|
|
23
|
+
}
|
|
24
|
+
/** The store a request runs on: the served one, else hippo.db under its root, as the CLI and SDK callers have it. */
|
|
25
|
+
export function storeFor(ctx) {
|
|
26
|
+
return ctx.store ?? sqliteStore(ctx.hippoRoot);
|
|
27
|
+
}
|
|
28
|
+
/** The built-in store: today's synchronous hippo.db functions behind the port, each call on its own short-lived handles, so close has nothing to release. */
|
|
5
29
|
export function sqliteStore(hippoRoot) {
|
|
6
30
|
return {
|
|
7
31
|
kind: 'sqlite',
|
|
8
32
|
async findApiKey(keyId) {
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
33
|
+
return onHandle(hippoRoot, (db) => readApiKeyRecord(db, keyId));
|
|
34
|
+
},
|
|
35
|
+
async searchRecallEntries(query, args) {
|
|
36
|
+
return loadRecallSearchEntries(hippoRoot, query, args.limit, args.tenantId, args.requestedScope, args.explicitScopeMode, args.includeSuperseded, args.originProjects, args.ownScope);
|
|
37
|
+
},
|
|
38
|
+
async entriesByIds(ids, tenantId) {
|
|
39
|
+
return loadEntriesByIds(hippoRoot, ids, tenantId);
|
|
40
|
+
},
|
|
41
|
+
async activeGoals(opts) {
|
|
42
|
+
return activeGoalsWithPolicies(hippoRoot, opts);
|
|
43
|
+
},
|
|
44
|
+
async freshRawEntries(count, tenantId, sessionId, origins) {
|
|
45
|
+
return loadFreshRawMemories(hippoRoot, count, tenantId, sessionId, origins ?? undefined);
|
|
46
|
+
},
|
|
47
|
+
async continuity(tenantId, eventLimit, key) {
|
|
48
|
+
return continuityAt(hippoRoot, tenantId, eventLimit, key);
|
|
49
|
+
},
|
|
50
|
+
async planningFallacyEvidence(tenantId, classQueryTokens) {
|
|
51
|
+
return planningFallacyEvidenceAt(hippoRoot, tenantId, classQueryTokens);
|
|
52
|
+
},
|
|
53
|
+
async appendAuditEvents(events) {
|
|
54
|
+
if (events.length === 0)
|
|
55
|
+
return;
|
|
56
|
+
onHandle(hippoRoot, (db) => withWriteScope(db, 'append_audit_events', () => {
|
|
57
|
+
for (const event of events)
|
|
58
|
+
appendAuditEvent(db, event);
|
|
59
|
+
}));
|
|
60
|
+
},
|
|
61
|
+
async finishRecall(writes) {
|
|
62
|
+
finishRecallAt(hippoRoot, writes);
|
|
63
|
+
},
|
|
64
|
+
async bumpRecallStats(recalled) {
|
|
65
|
+
updateStats(hippoRoot, { recalled });
|
|
66
|
+
},
|
|
67
|
+
async recordTokens(use) {
|
|
68
|
+
onHandle(hippoRoot, (db) => recordTokenUse(db, use));
|
|
16
69
|
},
|
|
17
70
|
async close() { },
|
|
18
71
|
};
|
|
19
72
|
}
|
|
73
|
+
/** sqliteStore's continuity read, for the synchronous recall that cannot await the port. */
|
|
74
|
+
export function continuityAt(hippoRoot, tenantId, eventLimit, key) {
|
|
75
|
+
const activeSnapshot = loadActiveTaskSnapshot(hippoRoot, tenantId, key ?? undefined);
|
|
76
|
+
const sessionId = activeSnapshot?.session_id ?? undefined;
|
|
77
|
+
return {
|
|
78
|
+
activeSnapshot,
|
|
79
|
+
sessionHandoff: sessionId ? loadLatestHandoff(hippoRoot, tenantId, sessionId, {}, key ?? undefined) : null,
|
|
80
|
+
recentSessionEvents: sessionId ? listSessionEvents(hippoRoot, tenantId, { session_id: sessionId, limit: eventLimit }) : [],
|
|
81
|
+
};
|
|
82
|
+
}
|
|
83
|
+
/** sqliteStore's finishRecall, for the synchronous recall that cannot await the port. */
|
|
84
|
+
export function finishRecallAt(hippoRoot, writes) {
|
|
85
|
+
onHandle(hippoRoot, (db) => {
|
|
86
|
+
withWriteScope(db, 'finish_recall', () => {
|
|
87
|
+
writeGoalRecallLog(db, localGoalRecallRows(db, writes.goalLog));
|
|
88
|
+
for (const event of writes.audit)
|
|
89
|
+
appendAuditEvent(db, event);
|
|
90
|
+
});
|
|
91
|
+
// Each opens its own transaction, so neither can share the scope above.
|
|
92
|
+
if (writes.trace)
|
|
93
|
+
writeRecallTrace(db, writes.trace);
|
|
94
|
+
if (writes.strengthen)
|
|
95
|
+
strengthenRetrievedInOwnTx(db, writes.strengthen.ids, writes.strengthen.opts);
|
|
96
|
+
});
|
|
97
|
+
}
|
|
20
98
|
//# sourceMappingURL=store-port.js.map
|
package/dist/version.d.ts
CHANGED
|
@@ -16,7 +16,7 @@
|
|
|
16
16
|
* an ESM `import` can resolve cleanly, and a hardcoded constant survives
|
|
17
17
|
* any packager that drops .json files.
|
|
18
18
|
*/
|
|
19
|
-
export declare const PACKAGE_VERSION = "1.
|
|
19
|
+
export declare const PACKAGE_VERSION = "1.65.0";
|
|
20
20
|
/** The floor a store takes on its first expiring key: the first release with schema v53, set by hand in that release; scripts/check-expiring-keys-floor.mjs gates it. */
|
|
21
21
|
export declare const EXPIRING_KEYS_MIN_BINARY = "1.64.0";
|
|
22
22
|
/** The floor a store takes on its first session bind or owner snapshot: first release with v54; set by hand in that release. */
|
package/dist/version.js
CHANGED
|
@@ -16,7 +16,7 @@
|
|
|
16
16
|
* an ESM `import` can resolve cleanly, and a hardcoded constant survives
|
|
17
17
|
* any packager that drops .json files.
|
|
18
18
|
*/
|
|
19
|
-
export const PACKAGE_VERSION = '1.
|
|
19
|
+
export const PACKAGE_VERSION = '1.65.0';
|
|
20
20
|
/** The floor a store takes on its first expiring key: the first release with schema v53, set by hand in that release; scripts/check-expiring-keys-floor.mjs gates it. */
|
|
21
21
|
export const EXPIRING_KEYS_MIN_BINARY = '1.64.0';
|
|
22
22
|
/** The floor a store takes on its first session bind or owner snapshot: first release with v54; set by hand in that release. */
|
package/openclaw.plugin.json
CHANGED
|
@@ -2,7 +2,7 @@
|
|
|
2
2
|
"id": "hippo-memory",
|
|
3
3
|
"name": "Hippo Memory",
|
|
4
4
|
"description": "Make your agent's memory work like a brain. Hippo is long-term memory for coding agents.",
|
|
5
|
-
"version": "1.
|
|
5
|
+
"version": "1.65.0",
|
|
6
6
|
"configSchema": {
|
|
7
7
|
"type": "object",
|
|
8
8
|
"additionalProperties": false,
|
package/package.json
CHANGED