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.
Files changed (58) hide show
  1. package/dist/agent-memories/sync.js +3 -2
  2. package/dist/api/recall-record.d.ts +46 -0
  3. package/dist/api/recall-record.js +98 -0
  4. package/dist/api/recall-request.d.ts +32 -0
  5. package/dist/api/recall-request.js +121 -0
  6. package/dist/api/recall-types.d.ts +7 -1
  7. package/dist/api/recall.d.ts +3 -2
  8. package/dist/api/recall.js +174 -181
  9. package/dist/api/tokens.d.ts +1 -1
  10. package/dist/api/tokens.js +13 -17
  11. package/dist/cli/recall.d.ts +1 -1
  12. package/dist/cli/recall.js +18 -49
  13. package/dist/cli/shared.js +2 -2
  14. package/dist/cli.d.ts +16 -0
  15. package/dist/cli.js +18 -1
  16. package/dist/config.d.ts +2 -0
  17. package/dist/config.js +4 -0
  18. package/dist/db/connect.d.ts +5 -0
  19. package/dist/db/connect.js +52 -0
  20. package/dist/db/open.d.ts +9 -11
  21. package/dist/db/open.js +23 -116
  22. package/dist/db/request-stores.d.ts +30 -0
  23. package/dist/db/request-stores.js +100 -0
  24. package/dist/db/sqlite-blocked.d.ts +6 -0
  25. package/dist/db/sqlite-blocked.js +11 -0
  26. package/dist/db.d.ts +3 -1
  27. package/dist/db.js +3 -1
  28. package/dist/embeddings.js +2 -1
  29. package/dist/goals.d.ts +18 -11
  30. package/dist/goals.js +38 -36
  31. package/dist/http-util.d.ts +2 -0
  32. package/dist/http-util.js +5 -0
  33. package/dist/mcp/memory-tools.js +4 -1
  34. package/dist/mcp/recall-tools.js +28 -133
  35. package/dist/mcp/request.d.ts +7 -0
  36. package/dist/mcp/request.js +63 -41
  37. package/dist/mcp/session-state.d.ts +1 -3
  38. package/dist/mcp/session-state.js +3 -5
  39. package/dist/predictions/planning-fallacy.d.ts +52 -0
  40. package/dist/predictions/planning-fallacy.js +70 -55
  41. package/dist/recall-trace.d.ts +1 -1
  42. package/dist/recall-trace.js +5 -4
  43. package/dist/search/physics-search.js +4 -1
  44. package/dist/search/vector.js +2 -0
  45. package/dist/server/routes/recall.d.ts +1 -1
  46. package/dist/server/routes/recall.js +30 -218
  47. package/dist/server.d.ts +12 -1
  48. package/dist/server.js +33 -22
  49. package/dist/store/entry-writes.d.ts +2 -0
  50. package/dist/store/entry-writes.js +24 -16
  51. package/dist/store-port.d.ts +70 -1
  52. package/dist/store-port.js +87 -9
  53. package/dist/version.d.ts +1 -1
  54. package/dist/version.js +1 -1
  55. package/extensions/openclaw-plugin/openclaw.plugin.json +1 -1
  56. package/extensions/openclaw-plugin/package.json +1 -1
  57. package/openclaw.plugin.json +1 -1
  58. package/package.json +1 -1
@@ -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 { closeHippoDb, openHippoDb } from './db.js';
4
- /** The built-in store: today's synchronous hippo.db functions behind the port, one handle per call, so close has nothing to release. */
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
- const db = openHippoDb(hippoRoot);
10
- try {
11
- return readApiKeyRecord(db, keyId);
12
- }
13
- finally {
14
- closeHippoDb(db);
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.64.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.64.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. */
@@ -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.64.1",
5
+ "version": "1.65.0",
6
6
 
7
7
  "configSchema": {
8
8
  "type": "object",
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "hippo-memory",
3
- "version": "1.64.1",
3
+ "version": "1.65.0",
4
4
  "type": "module",
5
5
  "description": "Make your agent's memory work like a brain. Hippo is long-term memory for coding agents.",
6
6
  "main": "index.ts",
@@ -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.64.1",
5
+ "version": "1.65.0",
6
6
  "configSchema": {
7
7
  "type": "object",
8
8
  "additionalProperties": false,
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "hippo-memory",
3
- "version": "1.64.1",
3
+ "version": "1.65.0",
4
4
  "description": "Make your agent's memory work like a brain. Hippo is long-term memory for coding agents.",
5
5
  "mcpName": "io.github.kitfunso/hippo-memory",
6
6
  "type": "module",