hippo-memory 1.56.0 → 1.58.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 (129) hide show
  1. package/README.md +11 -0
  2. package/dist/agent-memories/claude-code.js +1 -1
  3. package/dist/agent-memories/gemini.js +1 -1
  4. package/dist/api-errors.d.ts +27 -0
  5. package/dist/api-errors.js +37 -0
  6. package/dist/api.d.ts +21 -14
  7. package/dist/api.js +97 -71
  8. package/dist/audit.d.ts +4 -0
  9. package/dist/audit.js +11 -0
  10. package/dist/autolearn.d.ts +1 -1
  11. package/dist/autolearn.js +7 -5
  12. package/dist/capture-contract.d.ts +47 -0
  13. package/dist/capture-contract.js +49 -0
  14. package/dist/capture-error.js +2 -1
  15. package/dist/capture.d.ts +0 -13
  16. package/dist/capture.js +5 -66
  17. package/dist/card-detail.d.ts +1 -1
  18. package/dist/card-detail.js +1 -1
  19. package/dist/cli/shared.d.ts +137 -0
  20. package/dist/cli/shared.js +834 -0
  21. package/dist/cli/sleep.d.ts +10 -0
  22. package/dist/cli/sleep.js +171 -0
  23. package/dist/cli.d.ts +0 -7
  24. package/dist/cli.js +322 -1827
  25. package/dist/client.js +9 -0
  26. package/dist/codex-patch.js +1 -1
  27. package/dist/compaction-record.d.ts +1 -1
  28. package/dist/compaction-record.js +3 -2
  29. package/dist/config.d.ts +5 -0
  30. package/dist/config.js +17 -0
  31. package/dist/connectors/github/dlq.js +5 -2
  32. package/dist/connectors/github/octokit-client.js +4 -2
  33. package/dist/connectors/github/webhook.d.ts +19 -0
  34. package/dist/connectors/github/webhook.js +313 -0
  35. package/dist/connectors/slack/dlq.js +6 -2
  36. package/dist/connectors/slack/web-client.js +7 -5
  37. package/dist/connectors/slack/webhook.d.ts +22 -0
  38. package/dist/connectors/slack/webhook.js +203 -0
  39. package/dist/consolidate.d.ts +10 -0
  40. package/dist/consolidate.js +38 -35
  41. package/dist/context-auto.d.ts +3 -0
  42. package/dist/context-auto.js +34 -0
  43. package/dist/customer-notes.js +16 -14
  44. package/dist/dag.js +3 -2
  45. package/dist/dashboard.js +3 -2
  46. package/dist/db.d.ts +12 -0
  47. package/dist/db.js +62 -1
  48. package/dist/decisions.js +11 -9
  49. package/dist/doctor.js +5 -0
  50. package/dist/embedding-provider.js +3 -3
  51. package/dist/embeddings.d.ts +4 -4
  52. package/dist/embeddings.js +72 -16
  53. package/dist/eval-stats.d.ts +58 -0
  54. package/dist/eval-stats.js +111 -0
  55. package/dist/extract.js +3 -2
  56. package/dist/goals.d.ts +49 -25
  57. package/dist/goals.js +39 -22
  58. package/dist/graph-extract.js +1 -1
  59. package/dist/graph-recall.d.ts +1 -1
  60. package/dist/graph-recall.js +1 -1
  61. package/dist/graph.js +1 -1
  62. package/dist/hooks.d.ts +1 -3
  63. package/dist/hooks.js +2 -4
  64. package/dist/http-retry.d.ts +21 -0
  65. package/dist/http-retry.js +50 -0
  66. package/dist/http-util.d.ts +39 -0
  67. package/dist/http-util.js +56 -0
  68. package/dist/importers.d.ts +2 -0
  69. package/dist/importers.js +16 -5
  70. package/dist/incidents.js +13 -11
  71. package/dist/index.d.ts +5 -2
  72. package/dist/index.js +5 -2
  73. package/dist/judgment.js +10 -17
  74. package/dist/log.d.ts +25 -0
  75. package/dist/log.js +48 -0
  76. package/dist/mcp/server.js +224 -308
  77. package/dist/mcp/tool-args.d.ts +21 -0
  78. package/dist/mcp/tool-args.js +80 -0
  79. package/dist/memory.d.ts +19 -0
  80. package/dist/memory.js +41 -2
  81. package/dist/overlap-index.d.ts +7 -0
  82. package/dist/overlap-index.js +38 -0
  83. package/dist/pilot-arm.d.ts +9 -0
  84. package/dist/pilot-arm.js +47 -0
  85. package/dist/policies.js +14 -12
  86. package/dist/predictions.js +11 -9
  87. package/dist/processes.js +16 -14
  88. package/dist/project-briefs.js +19 -16
  89. package/dist/project-identity.d.ts +1 -1
  90. package/dist/project-identity.js +25 -1
  91. package/dist/prompt-recall.js +1 -1
  92. package/dist/raw-archive.js +7 -6
  93. package/dist/recall-history.d.ts +5 -0
  94. package/dist/recall-history.js +9 -0
  95. package/dist/recall-pipeline.d.ts +101 -0
  96. package/dist/recall-pipeline.js +313 -0
  97. package/dist/recall-scope.d.ts +24 -1
  98. package/dist/recall-scope.js +29 -2
  99. package/dist/refine-llm.js +3 -2
  100. package/dist/reject-flow.js +6 -9
  101. package/dist/rejection.d.ts +2 -1
  102. package/dist/rejection.js +2 -1
  103. package/dist/search.d.ts +0 -20
  104. package/dist/search.js +16 -51
  105. package/dist/secret-detect.d.ts +13 -1
  106. package/dist/secret-detect.js +33 -1
  107. package/dist/server.d.ts +3 -1
  108. package/dist/server.js +1854 -2566
  109. package/dist/session-digest.js +2 -1
  110. package/dist/shared.js +7 -6
  111. package/dist/skills.js +17 -15
  112. package/dist/store-cards.d.ts +53 -0
  113. package/dist/store-cards.js +512 -0
  114. package/dist/store.d.ts +2 -89
  115. package/dist/store.js +10 -566
  116. package/dist/tenant.d.ts +22 -0
  117. package/dist/tenant.js +26 -0
  118. package/dist/token-ledger.d.ts +4 -2
  119. package/dist/token-ledger.js +2 -2
  120. package/dist/tokenize.d.ts +2 -0
  121. package/dist/tokenize.js +8 -0
  122. package/dist/version.d.ts +1 -1
  123. package/dist/version.js +1 -1
  124. package/extensions/openclaw-plugin/openclaw.plugin.json +1 -1
  125. package/extensions/openclaw-plugin/package.json +1 -1
  126. package/openclaw.plugin.json +1 -1
  127. package/package.json +1 -1
  128. package/dist/connectors/slack/ratelimit.d.ts +0 -9
  129. package/dist/connectors/slack/ratelimit.js +0 -18
@@ -7,8 +7,9 @@ import type { DatabaseSyncLike } from './db.js';
7
7
  * - `context`, `recall`: the CLI commands.
8
8
  * - `mcp_recall`, `mcp_context`: the MCP tools.
9
9
  * - `http_recall`, `http_context`, `http_assemble`: the HTTP API.
10
+ * - `pilot`: the session's pilot arm row (src/pilot-arm.ts); not a send, so it is in no surface list.
10
11
  */
11
- export type TokenSurface = 'hook' | 'hook_recall' | 'compact_resume' | 'context' | 'recall' | 'mcp_recall' | 'mcp_context' | 'http_recall' | 'http_context' | 'http_assemble';
12
+ export type TokenSurface = 'hook' | 'hook_recall' | 'compact_resume' | 'context' | 'recall' | 'mcp_recall' | 'mcp_context' | 'http_recall' | 'http_context' | 'http_assemble' | 'pilot';
12
13
  /** All surfaces, in report order. */
13
14
  export declare const TOKEN_SURFACES: readonly TokenSurface[];
14
15
  /** Surfaces whose re-reads are counted: only a hook payload tells a sub-agent's block from its parent's, as both carry one session id. */
@@ -19,8 +20,9 @@ export declare const REREAD_SURFACES: readonly TokenSurface[];
19
20
  * - `skip`: identical to the session's last injected block, so not sent again.
20
21
  * - `reset`: the host compacted its context, so the next block must be sent.
21
22
  * - `reread`: tokens later calls read again, booked at session end as one row per session, hook surface and UTC day of the calls.
23
+ * - `arm`: the pilot assignment; `block_hash` is `hippo` or `holdout`, `items` the holdout rate in basis points.
22
24
  */
23
- export type TokenEvent = 'inject' | 'skip' | 'reset' | 'reread';
25
+ export type TokenEvent = 'inject' | 'skip' | 'reset' | 'reread' | 'arm';
24
26
  /** Rows older than this are pruned on write. */
25
27
  export declare const TOKEN_LEDGER_RETENTION_DAYS = 90;
26
28
  /**
@@ -125,7 +125,7 @@ export function summarizeTokenUse(db, tenantId, sinceIso) {
125
125
  COUNT(DISTINCT CASE WHEN event = 'reread' THEN session_id END) AS reread_sessions,
126
126
  SUM(CASE WHEN event = 'inject' THEN tokens ELSE 0 END) AS tokens
127
127
  FROM token_ledger
128
- WHERE tenant_id = ? AND ts >= ? AND session_id IS NOT NULL`).get(...REREAD_SURFACES, tenantId, sinceIso);
128
+ WHERE tenant_id = ? AND ts >= ? AND session_id IS NOT NULL AND event <> 'arm'`).get(...REREAD_SURFACES, tenantId, sinceIso);
129
129
  const sessionCount = Number(perSession?.sessions ?? 0);
130
130
  const sessionTokens = Number(perSession?.tokens ?? 0);
131
131
  return {
@@ -197,7 +197,7 @@ export function tokensBySession(db, tenantId, sinceIso) {
197
197
  SUM(CASE WHEN event = 'skip' THEN tokens ELSE 0 END) AS skipped,
198
198
  SUM(CASE WHEN event = 'inject' THEN 1 ELSE 0 END) AS injections
199
199
  FROM token_ledger
200
- WHERE tenant_id = ? AND ts >= ? AND session_id IS NOT NULL
200
+ WHERE tenant_id = ? AND ts >= ? AND session_id IS NOT NULL AND event <> 'arm'
201
201
  GROUP BY session_id`).all(tenantId, sinceIso);
202
202
  return rows.map((r) => ({
203
203
  sessionId: r.session_id,
@@ -0,0 +1,2 @@
1
+ export declare function tokenize(text: string): string[];
2
+ //# sourceMappingURL=tokenize.d.ts.map
@@ -0,0 +1,8 @@
1
+ export function tokenize(text) {
2
+ return text
3
+ .toLowerCase()
4
+ .replace(/[^\w\s]/g, ' ')
5
+ .split(/\s+/)
6
+ .filter((t) => t.length > 1);
7
+ }
8
+ //# sourceMappingURL=tokenize.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.56.0";
19
+ export declare const PACKAGE_VERSION = "1.58.0";
20
20
  /** Compares plain x.y.z versions, positive if a > b; tags throw so the rollback guard never misfires silently. */
21
21
  export declare function compareSemver(a: string, b: string): number;
22
22
  //# sourceMappingURL=version.d.ts.map
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.56.0';
19
+ export const PACKAGE_VERSION = '1.58.0';
20
20
  /** Compares plain x.y.z versions, positive if a > b; tags throw so the rollback guard never misfires silently. */
21
21
  export function compareSemver(a, b) {
22
22
  const parse = (v) => {
@@ -2,7 +2,7 @@
2
2
  "id": "hippo-memory",
3
3
  "name": "Hippo Memory",
4
4
  "description": "Memory for AI agents that learns what is wrong and ranks it down. Injects context at session start and captures errors.",
5
- "version": "1.56.0",
5
+ "version": "1.58.0",
6
6
 
7
7
  "configSchema": {
8
8
  "type": "object",
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "hippo-memory",
3
- "version": "1.56.0",
3
+ "version": "1.58.0",
4
4
  "type": "module",
5
5
  "description": "Hippo Memory plugin for OpenClaw - biologically-inspired agent memory",
6
6
  "main": "index.ts",
@@ -2,7 +2,7 @@
2
2
  "id": "hippo-memory",
3
3
  "name": "Hippo Memory",
4
4
  "description": "Memory for AI agents that learns what is wrong and ranks it down. Injects context at session start and captures errors.",
5
- "version": "1.56.0",
5
+ "version": "1.58.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.56.0",
3
+ "version": "1.58.0",
4
4
  "description": "Memory for AI agents that learns what is wrong and ranks it down. MCP server, hooks for Claude Code, OpenCode and Codex, AGENTS.md instructions for Codex, Cursor, OpenClaw and Pi. SQLite, zero runtime deps.",
5
5
  "mcpName": "io.github.kitfunso/hippo-memory",
6
6
  "type": "module",
@@ -1,9 +0,0 @@
1
- export interface RetryOpts {
2
- url: string;
3
- init?: RequestInit;
4
- fetchImpl?: typeof fetch;
5
- sleep?: (ms: number) => Promise<void>;
6
- maxRetries?: number;
7
- }
8
- export declare function fetchWithRetry(opts: RetryOpts): Promise<Response>;
9
- //# sourceMappingURL=ratelimit.d.ts.map
@@ -1,18 +0,0 @@
1
- export async function fetchWithRetry(opts) {
2
- const f = opts.fetchImpl ?? fetch;
3
- const sleep = opts.sleep ?? ((ms) => new Promise((r) => setTimeout(r, ms)));
4
- const max = opts.maxRetries ?? 3;
5
- let attempt = 0;
6
- while (true) {
7
- const r = await f(opts.url, opts.init);
8
- if (r.status !== 429)
9
- return r;
10
- if (attempt >= max)
11
- throw new Error(`rate-limited after ${attempt + 1} attempts: ${opts.url}`);
12
- const ra = r.headers.get('retry-after');
13
- const delaySec = ra ? Number(ra) : Math.pow(2, attempt);
14
- await sleep(Math.max(0, delaySec) * 1000);
15
- attempt++;
16
- }
17
- }
18
- //# sourceMappingURL=ratelimit.js.map