hippo-memory 3.0.0 → 3.1.1

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 (93) hide show
  1. package/README.md +1 -0
  2. package/dist/api/context/context-plan.js +2 -4
  3. package/dist/api/context/context-select.js +12 -7
  4. package/dist/api/detached.d.ts +6 -0
  5. package/dist/api/detached.js +16 -0
  6. package/dist/api/embeddings.d.ts +4 -3
  7. package/dist/api/embeddings.js +4 -4
  8. package/dist/api/memories/promote.js +2 -1
  9. package/dist/api/memories/remember-local.d.ts +5 -4
  10. package/dist/api/memories/remember-local.js +13 -10
  11. package/dist/api/recall/rank-stages.js +2 -2
  12. package/dist/api/session-end.js +1 -0
  13. package/dist/api/sharing.js +9 -7
  14. package/dist/api/sleep/auto-sleep.d.ts +1 -1
  15. package/dist/api/sleep/auto-sleep.js +5 -3
  16. package/dist/api/sleep/learn.js +5 -2
  17. package/dist/api/sleep/sleep-run.js +4 -2
  18. package/dist/api/types.d.ts +4 -0
  19. package/dist/base/memory/entry.js +2 -2
  20. package/dist/base/memory/markdown-delimiters.d.ts +15 -0
  21. package/dist/base/memory/markdown-delimiters.js +94 -0
  22. package/dist/base/memory/memory-audit.js +4 -4
  23. package/dist/base/memory/memory-quality.d.ts +12 -0
  24. package/dist/base/memory/memory-quality.js +92 -3
  25. package/dist/base/ports/store/types.d.ts +2 -1
  26. package/dist/base/rank/prompt-recall.d.ts +16 -3
  27. package/dist/base/rank/prompt-recall.js +47 -7
  28. package/dist/base/util/detached-set.d.ts +8 -0
  29. package/dist/base/util/detached-set.js +35 -0
  30. package/dist/base/util/tokenize.d.ts +29 -0
  31. package/dist/base/util/tokenize.js +68 -5
  32. package/dist/base/util/version.d.ts +1 -1
  33. package/dist/base/util/version.js +1 -1
  34. package/dist/db/meta.d.ts +1 -0
  35. package/dist/db/meta.js +1 -0
  36. package/dist/db/store-runtime.d.ts +10 -3
  37. package/dist/db/store-runtime.js +19 -3
  38. package/dist/domain/consolidate/conflicts.js +2 -2
  39. package/dist/domain/learn/forward-claim-detector.js +4 -2
  40. package/dist/domain/learn/invalidation.js +5 -2
  41. package/dist/domain/search/bm25.js +3 -3
  42. package/dist/domain/search/detached-work.d.ts +6 -0
  43. package/dist/domain/search/detached-work.js +2 -0
  44. package/dist/domain/search/embed-memories.d.ts +4 -4
  45. package/dist/domain/search/embed-memories.js +4 -5
  46. package/dist/domain/sharing/global-sync.d.ts +8 -2
  47. package/dist/domain/sharing/global-sync.js +5 -5
  48. package/dist/domain/sharing/share.d.ts +4 -0
  49. package/dist/domain/sharing/share.js +2 -2
  50. package/dist/entry/eval-scripts.d.ts +1 -0
  51. package/dist/entry/sleep.d.ts +1 -0
  52. package/dist/index.d.ts +1 -1
  53. package/dist/server.d.ts +1 -0
  54. package/dist/store/rules/windows.d.ts +3 -0
  55. package/dist/store/rules/windows.js +3 -0
  56. package/dist/store/sqlite/audit/audit-maintenance.js +16 -13
  57. package/dist/store/sqlite/recall/candidates.js +1 -0
  58. package/dist/store/sqlite/recall/search-rows.d.ts +2 -2
  59. package/dist/store/sqlite/recall/search-rows.js +62 -26
  60. package/dist/store/sqlite/runtime/server-runtime.d.ts +6 -1
  61. package/dist/store/sqlite/runtime/server-runtime.js +15 -3
  62. package/dist/store/sqlite/runtime/worker-jobs.js +2 -2
  63. package/dist/store/sqlite/sharing/copy-rows.d.ts +1 -0
  64. package/dist/store/sqlite/sharing/copy-rows.js +2 -1
  65. package/dist/surface/capture/command.d.ts +8 -1
  66. package/dist/surface/capture/command.js +38 -8
  67. package/dist/surface/capture/compact.d.ts +3 -3
  68. package/dist/surface/capture/compact.js +4 -4
  69. package/dist/surface/capture/extract.d.ts +10 -0
  70. package/dist/surface/capture/extract.js +199 -26
  71. package/dist/surface/capture/session-texts.js +11 -11
  72. package/dist/surface/cli/api-context.d.ts +5 -0
  73. package/dist/surface/cli/api-context.js +12 -0
  74. package/dist/surface/cli/goals.js +6 -8
  75. package/dist/surface/cli/hook-runtime.js +2 -2
  76. package/dist/surface/cli/memory-import.js +20 -15
  77. package/dist/surface/mcp/protocol.d.ts +6 -0
  78. package/dist/surface/mcp/protocol.js +1 -0
  79. package/dist/surface/mcp/stdio.js +11 -5
  80. package/dist/surface/open-store.d.ts +2 -2
  81. package/dist/surface/open-store.js +11 -7
  82. package/dist/surface/server/auth.d.ts +1 -1
  83. package/dist/surface/server/auth.js +13 -2
  84. package/dist/surface/server/boot.js +3 -2
  85. package/dist/surface/server/dashboard-listener.js +2 -2
  86. package/dist/surface/server/lifecycle.d.ts +2 -0
  87. package/dist/surface/server/lifecycle.js +4 -2
  88. package/dist/surface/server/mcp-http.js +1 -0
  89. package/dist/surface/server/types.d.ts +3 -0
  90. package/extensions/openclaw-plugin/openclaw.plugin.json +1 -1
  91. package/extensions/openclaw-plugin/package.json +1 -1
  92. package/openclaw.plugin.json +1 -1
  93. package/package.json +1 -1
@@ -31,11 +31,15 @@ async function warnBackfillFailed(ctx, embedCommand, err) {
31
31
  log.warn(`import: embedding backfill failed (${errorMessage(err)}); ${waiting} rows have no vector; ` +
32
32
  `run '${embedCommand}' to backfill`, errorFields(err));
33
33
  }
34
- /** Batch-embed freshly imported rows. The floating promise is deliberate: libuv keeps the
35
- * process alive until it settles, and awaiting would block the CLI on model load; `hippo embed`
36
- * is the backstop if interrupted. */
37
- function backfillVectors(ctx, embedCommand) {
38
- void memoryEmbedMissing(ctx).catch((err) => warnBackfillFailed(ctx, embedCommand, err));
34
+ /** Batch-embeds freshly imported rows before the command returns, since the command's store
35
+ * runtime closes then. */
36
+ async function backfillVectors(ctx, embedCommand) {
37
+ try {
38
+ await memoryEmbedMissing(ctx);
39
+ }
40
+ catch (err) {
41
+ await warnBackfillFailed(ctx, embedCommand, err);
42
+ }
39
43
  }
40
44
  function warnRedacted(count) {
41
45
  if (count) {
@@ -94,7 +98,7 @@ async function importIntoStore(run) {
94
98
  dryRun,
95
99
  });
96
100
  }
97
- importFromFile(targetRoot, args, flags, { importOptions, useGlobal, dryRun, tenantId });
101
+ await importFromFile(targetRoot, args, flags, { importOptions, useGlobal, dryRun, tenantId });
98
102
  }
99
103
  // Determine which importer to use based on flag
100
104
  function pickImporter(args, flags) {
@@ -138,7 +142,7 @@ function pickImporter(args, flags) {
138
142
  return { filePath: args[0], importer: importGenericFileInto, importerName: 'File' };
139
143
  return { filePath: undefined, importer: undefined, importerName: '' };
140
144
  }
141
- function importFromFile(targetRoot, args, flags, options) {
145
+ async function importFromFile(targetRoot, args, flags, options) {
142
146
  const { importOptions, useGlobal, dryRun, tenantId } = options;
143
147
  const { filePath, importer, importerName } = pickImporter(args, flags);
144
148
  if (!filePath || !importer) {
@@ -149,12 +153,12 @@ function importFromFile(targetRoot, args, flags, options) {
149
153
  fail(`File not found: ${filePath}`);
150
154
  }
151
155
  const result = importer(filePath, importOptions);
156
+ const storeLabel = useGlobal ? `global (${hippoHomeDir()})` : targetRoot;
157
+ printFileImportSummary(result, { importerName, filePath, storeLabel, dryRun });
152
158
  // The importers' writeEntry sites don't embed, so the new rows are embedded here in one pass.
153
159
  if (!dryRun && result.imported >= 1) {
154
- backfillVectors(cliApiContext(targetRoot, tenantId), useGlobal ? 'hippo embed --global' : 'hippo embed');
160
+ await backfillVectors(cliApiContext(targetRoot, tenantId), useGlobal ? 'hippo embed --global' : 'hippo embed');
155
161
  }
156
- const storeLabel = useGlobal ? `global (${hippoHomeDir()})` : targetRoot;
157
- printFileImportSummary(result, { importerName, filePath, storeLabel, dryRun });
158
162
  }
159
163
  function printFileImportSummary(result, { importerName, filePath, storeLabel, dryRun }) {
160
164
  console.log(`\nImport ${importerName}: ${filePath}`);
@@ -206,7 +210,12 @@ async function importVaultFolder(options) {
206
210
  batch: cliStoreBatch(hippoRoot),
207
211
  infra: cliInfra(),
208
212
  });
209
- printVaultSummary(vaultResult, folderPath, cliApiContext(hippoRoot, tenantId), dryRun);
213
+ const ctx = cliApiContext(hippoRoot, tenantId);
214
+ printVaultSummary(vaultResult, folderPath, ctx, dryRun);
215
+ // Vault rows write through api.remember, which never embeds, so backfill them as the single-file
216
+ // import does.
217
+ if (!dryRun && vaultResult.imported >= 1)
218
+ await backfillVectors(ctx, 'hippo embed');
210
219
  }
211
220
  function checkVaultArgs(folderPath, flags, useGlobal) {
212
221
  if (!fs.existsSync(folderPath) || !fs.statSync(folderPath).isDirectory()) {
@@ -239,9 +248,5 @@ function printVaultSummary(vaultResult, folderPath, ctx, dryRun) {
239
248
  warnRedacted(vaultResult.redacted);
240
249
  console.log(` ${dryRun ? 'Would archive: ' : 'Archived (removed): '}${vaultResult.archived ?? 0}`);
241
250
  console.log(` Store: ${ctx.hippoRoot}`);
242
- // Vault rows write through api.remember, which never embeds, so backfill them as the single-file
243
- // import does.
244
- if (!dryRun && vaultResult.imported >= 1)
245
- backfillVectors(ctx, 'hippo embed');
246
251
  }
247
252
  //# sourceMappingURL=memory-import.js.map
@@ -10,6 +10,7 @@ import type { ContextWith } from '../../api/types.js';
10
10
  import type { ConfiguredFolder } from '../../base/config/configured-folder.js';
11
11
  import type { CallerState } from '../../api/callers.js';
12
12
  import type { InfraPorts } from '../../base/ports/infra.js';
13
+ import type { DetachedWork } from '../../domain/search/detached-work.js';
13
14
  /** Same bounded walk as the CLI (ends at home, so HIPPO_HOME wins over ~/.hippo); cwd/opts are
14
15
  * the test seam. */
15
16
  export declare function findHippoRoot(cwd?: string, opts?: ResolveProjectIdentityOptions): string | null;
@@ -55,6 +56,8 @@ export interface McpCaller<S extends RequiredStore = RequiredStore> {
55
56
  clientKey?: string;
56
57
  /** Aborts when the call passes its deadline, so a tool stops starting work nobody waits for. */
57
58
  signal?: AbortSignal;
59
+ /** The transport root's keeper of work a call does not wait on; unset, each call waits for it. */
60
+ detached?: DetachedWork;
58
61
  }
59
62
  /** A tool's run for one call's arguments. */
60
63
  export type ToolRun = (args: Record<string, JsonValue>) => string | Promise<string>;
@@ -84,6 +87,9 @@ export type McpContextFor<S extends RequiredStore = RequiredStore> = (hippoRoot:
84
87
  * src/surface/mcp does not. */
85
88
  export interface McpHost<S extends RequiredStore = RequiredStore> {
86
89
  runFrame<T>(signal: AbortSignal, run: (contextFor: McpContextFor<S>) => Promise<T>): Promise<T>;
90
+ /** Waits up to `withinMs` for the work the frames handed off, such as an embed; resolves with
91
+ * how many were still running. */
92
+ settle(withinMs: number): Promise<number>;
87
93
  }
88
94
  /** One tool call after the store, config and tenant are resolved; every handler reads the same
89
95
  * five. */
@@ -83,6 +83,7 @@ export function mcpApiContext(ctx) {
83
83
  clientKey: mcpClientKey(ctx),
84
84
  infra: ctx.infra,
85
85
  signal: ctx.signal,
86
+ detached: ctx.detached,
86
87
  };
87
88
  }
88
89
  /** The transport's client key, else `stdio-<pid>:<tenant>`; a caller's project narrows either,
@@ -96,7 +96,9 @@ function track(method, call) {
96
96
  .finally(() => inFlight.delete(call))
97
97
  .catch((err) => log.error(`mcp: ${method} failed after it was dispatched`, errorFields(err)));
98
98
  }
99
- async function drainInFlight() {
99
+ /** Waits for the calls in flight, then for the work they handed off, one bound for both. */
100
+ async function drainInFlight(host) {
101
+ const started = performance.now();
100
102
  if (inFlight.size > 0) {
101
103
  let bound;
102
104
  const timedOut = new Promise((resolve) => {
@@ -108,9 +110,13 @@ async function drainInFlight() {
108
110
  for (const method of inFlight.values()) {
109
111
  log.warn(`mcp: ${method} was still running ${STDIN_END_DRAIN_MS} ms after stdin closed; exiting without its reply`, { method });
110
112
  }
113
+ const left = await host.settle(Math.max(0, STDIN_END_DRAIN_MS - (performance.now() - started)));
114
+ if (left > 0) {
115
+ log.warn(`mcp: ${left} handed-off task(s), such as an embed, still running ${STDIN_END_DRAIN_MS} ms after stdin closed`, { left });
116
+ }
111
117
  }
112
- async function exitWhenDrained() {
113
- await drainInFlight();
118
+ async function exitWhenDrained(host) {
119
+ await drainInFlight(host);
114
120
  exitAfterFlush(0);
115
121
  }
116
122
  /** Answers `req` with one timeout error at the deadline a served request has. The returned
@@ -222,7 +228,7 @@ export function startStdioLoop(host) {
222
228
  runWithRequestId(randomUUID(), () => dispatch(body, abort, host));
223
229
  }));
224
230
  process.stdin.on('end', () => {
225
- exitWhenDrained().catch((err) => {
231
+ exitWhenDrained(host).catch((err) => {
226
232
  log.error('mcp: draining the calls in flight failed; exiting', errorFields(err));
227
233
  exitAfterFlush(1);
228
234
  });
@@ -231,7 +237,7 @@ export function startStdioLoop(host) {
231
237
  // A crash waits for the calls in flight as stdin's end does, so a client is not left without its
232
238
  // reply.
233
239
  installCrashHandlers('mcp', {
234
- run: drainInFlight,
240
+ run: () => drainInFlight(host),
235
241
  boundMs: STDIN_END_DRAIN_MS + CRASH_DRAIN_SLACK_MS,
236
242
  });
237
243
  }
@@ -6,8 +6,8 @@ export { decodeVector, EMBEDDING_MODEL_META_KEY, encodeVector, OTHER_STORE_MARKE
6
6
  /** The default store as ./store-kit publishes it, with only the rules an add-on picks: a runtime
7
7
  * or a session belongs to a composition root, and the published entries export neither. */
8
8
  export declare const publishedDefaultStore: (hippoRoot: string, rules?: StoreRules) => HippoStore & StoreGroups;
9
- /** Runs `fn` on a store runtime of its own, disposed when `fn` settles, or by its exit hook if
10
- * the process exits first. */
9
+ /** Runs `fn` on a store runtime of its own, disposed with the work `fn` detached on it once `fn`
10
+ * settles, or closed by its exit hook if the process exits first. */
11
11
  export declare function withStoreRuntime<T>(fn: (runtime: StoreRuntime) => Promise<T>): Promise<T>;
12
12
  /** hippo.db as a server serves it, with an exit hook that closes what the server opened if
13
13
  * close() never runs. */
@@ -5,18 +5,22 @@ export { decodeVector, EMBEDDING_MODEL_META_KEY, encodeVector, OTHER_STORE_MARKE
5
5
  /** The default store as ./store-kit publishes it, with only the rules an add-on picks: a runtime
6
6
  * or a session belongs to a composition root, and the published entries export neither. */
7
7
  export const publishedDefaultStore = sqliteStoreWith;
8
- /** Runs `fn` on a store runtime of its own, disposed when `fn` settles, or by its exit hook if
9
- * the process exits first. */
8
+ /** Runs `fn` on a store runtime of its own, disposed with the work `fn` detached on it once `fn`
9
+ * settles, or closed by its exit hook if the process exits first. */
10
10
  export async function withStoreRuntime(fn) {
11
11
  const runtime = new StoreRuntime();
12
- const onExit = () => runtime.dispose();
12
+ const onExit = () => runtime.closeNow();
13
13
  process.once('exit', onExit);
14
14
  try {
15
15
  return await fn(runtime);
16
16
  }
17
17
  finally {
18
- process.off('exit', onExit);
19
- runtime.dispose();
18
+ try {
19
+ await runtime.dispose();
20
+ }
21
+ finally {
22
+ process.off('exit', onExit);
23
+ }
20
24
  }
21
25
  }
22
26
  /** hippo.db as a server serves it, with an exit hook that closes what the server opened if
@@ -27,9 +31,9 @@ export function defaultServerRuntime(hippoRoot, opts = {}) {
27
31
  process.once('exit', onExit);
28
32
  return {
29
33
  ...runtime,
30
- close: async () => {
34
+ close: async (settleWithinMs) => {
31
35
  process.off('exit', onExit);
32
- await runtime.close();
36
+ await runtime.close(settleWithinMs);
33
37
  },
34
38
  };
35
39
  }
@@ -26,7 +26,7 @@ type AuthHeader = {
26
26
  };
27
27
  export declare function readAuthHeader(req: IncomingMessage): AuthHeader;
28
28
  type AuthOptions = Pick<ResolvedServeOptions, 'hippoRoot' | 'authResolver' | 'authResolverTimeoutMs' | 'store' | 'reachOf' | 'callerLimiter' | 'localKey' | 'keyVerifier'> & Partial<Pick<ResolvedServeOptions, 'failedAuthLimiter'>>;
29
- type ContextOptions = AuthOptions & Pick<ResolvedServeOptions, 'configAt' | 'onHippoDb' | 'infra'> & Partial<Pick<ResolvedServeOptions, 'callers' | 'signal' | 'ledgerStore'>>;
29
+ type ContextOptions = AuthOptions & Pick<ResolvedServeOptions, 'configAt' | 'onHippoDb' | 'infra' | 'detached'> & Partial<Pick<ResolvedServeOptions, 'callers' | 'signal' | 'ledgerStore'>>;
30
30
  /** Add-ons call this to refuse a subject that would collide with a built-in actor. */
31
31
  export declare function isReservedActor(subject: string): boolean;
32
32
  /** Builds a per-request Context from the Authorization header and remote address; throws
@@ -323,8 +323,19 @@ function contextFor(id, opts, clientKey) {
323
323
  const reach = contextReach(opts.reachOf(team), opts.configAt, infra.embedderFor, ledger);
324
324
  const callers = opts.callers;
325
325
  const actor = bearerActor(id);
326
- const { store, signal } = opts;
327
- return { tenantId: id.tenantId, actor, store, reach, config, callers, clientKey, infra, signal };
326
+ const { store, signal, detached } = opts;
327
+ return {
328
+ tenantId: id.tenantId,
329
+ actor,
330
+ store,
331
+ reach,
332
+ config,
333
+ callers,
334
+ clientKey,
335
+ infra,
336
+ signal,
337
+ detached,
338
+ };
328
339
  }
329
340
  /** Auth check for routes that need no tenant Context (e.g. the MCP transport, which resolves its
330
341
  * own root): throws HttpError 401 like buildContextWithAuth. */
@@ -15,7 +15,7 @@ import { isLocalCaller } from './auth.js';
15
15
  import { assertClientIpHeaderPinned, enforceRateLimit } from './client-ip.js';
16
16
  import { createSleepQueue } from './sleep-offload.js';
17
17
  import { createCallerState, newRowsOn } from '../../api/callers.js';
18
- import { DEFAULT_SHUTDOWN_DRAIN_MS, drainAndClose, setKeepAliveTimeouts, shutdownBoundMs, } from './lifecycle.js';
18
+ import { DEFAULT_SHUTDOWN_DRAIN_MS, DETACHED_SETTLE_MS, drainAndClose, setKeepAliveTimeouts, shutdownBoundMs, } from './lifecycle.js';
19
19
  import { createReadyProbe } from './ready.js';
20
20
  import { DEFAULT_SERVER_HOST, DEFAULT_SERVER_PORT } from './defaults.js';
21
21
  import { installCrashHandlers, installSignalHandlers } from '../../base/util/crash-handlers.js';
@@ -221,7 +221,7 @@ async function bindClaimed(opts, plan) {
221
221
  // An auto-sleep answers no request, so draining skips it; its child must leave the store before
222
222
  // the store closes.
223
223
  await served.sleeps.settled();
224
- await runtime.close();
224
+ await runtime.close(DETACHED_SETTLE_MS);
225
225
  };
226
226
  if (opts.handleSignals) {
227
227
  exitOnSignalOrCrash(stop, opts.shutdownDrainMs ?? DEFAULT_SHUTDOWN_DRAIN_MS);
@@ -280,6 +280,7 @@ function servedOptsFor(opts, { routes, publicJsonBodies, limiters }, runtime, lo
280
280
  callersFor: (storeFor) => callersOnRequest(callers, counted && storeFor(counted)),
281
281
  ledgerStore: hasGroups(store, ['ledger', 'folderFiles']) ? store : undefined,
282
282
  infra: rootInfra(runtime.host),
283
+ detached: runtime.detached,
283
284
  sleeps,
284
285
  counts,
285
286
  };
@@ -13,7 +13,7 @@ import { answerRequest } from './failure-replies.js';
13
13
  import { startDashboardReader } from './dashboard-reader.js';
14
14
  import { answerDashboard } from './dashboard-routes.js';
15
15
  import { dashboardTickets } from './dashboard-session.js';
16
- import { DEFAULT_SHUTDOWN_DRAIN_MS, drainAndClose, setKeepAliveTimeouts, shutdownBoundMs, } from './lifecycle.js';
16
+ import { DEFAULT_SHUTDOWN_DRAIN_MS, DETACHED_SETTLE_MS, drainAndClose, setKeepAliveTimeouts, shutdownBoundMs, } from './lifecycle.js';
17
17
  import { createListener } from './tls.js';
18
18
  import { rootInfra } from '../../infra/ports.js';
19
19
  // The audit log's actor for every dashboard write.
@@ -67,7 +67,7 @@ export async function serveDashboard(opts) {
67
67
  // close is the last.
68
68
  const release = async () => {
69
69
  await serving.reader.close();
70
- await runtime.close();
70
+ await runtime.close(DETACHED_SETTLE_MS);
71
71
  };
72
72
  try {
73
73
  await listenOn(server, opts.port, DASHBOARD_HOST);
@@ -1,6 +1,8 @@
1
1
  import type { Server, ServerResponse } from 'node:http';
2
2
  export declare function setKeepAliveTimeouts(server: Server): void;
3
3
  export declare const DEFAULT_SHUTDOWN_DRAIN_MS = 5000;
4
+ /** How long a stop waits for work a request handed off, such as an embed, before the stores close. */
5
+ export declare const DETACHED_SETTLE_MS = 5000;
4
6
  /** How long a signal or crash shutdown may run before the process is ended without it. */
5
7
  export declare function shutdownBoundMs(drainMs: number): number;
6
8
  /**
@@ -15,8 +15,10 @@ export function setKeepAliveTimeouts(server) {
15
15
  server.requestTimeout = Math.max(REQUEST_RECEIVE_TIMEOUT_MS, server.headersTimeout + bodyDeadlineMs(envBodyTimeoutMs()));
16
16
  }
17
17
  export const DEFAULT_SHUTDOWN_DRAIN_MS = 5000;
18
- // Past the request drain, a stop only waits for each store thread to end its statement and close:
19
- // seconds at most, so longer means a thread that will not end.
18
+ /** How long a stop waits for work a request handed off, such as an embed, before the stores close. */
19
+ export const DETACHED_SETTLE_MS = 5000;
20
+ // Past the request drain, a stop waits up to DETACHED_SETTLE_MS for handed-off work, then for each
21
+ // store thread to end its statement and close: seconds at most, so longer means a stuck thread.
20
22
  const STORE_CLOSE_GRACE_MS = 10_000;
21
23
  /** How long a signal or crash shutdown may run before the process is ended without it. */
22
24
  export function shutdownBoundMs(drainMs) {
@@ -75,6 +75,7 @@ function mcpContextFor(ctx, opts, project) {
75
75
  reach: ctx.reach,
76
76
  callers: ctx.callers,
77
77
  infra: ctx.infra,
78
+ detached: ctx.detached,
78
79
  };
79
80
  if (project !== undefined)
80
81
  mcpCtx.project = project;
@@ -14,6 +14,7 @@ import type { ConfigReader } from '../../host/config-file.js';
14
14
  import type { CallerState } from '../../api/callers.js';
15
15
  import type { SleepQueue } from './sleep-offload.js';
16
16
  import type { InfraPorts } from '../../base/ports/infra.js';
17
+ import type { DetachedWork } from '../../domain/search/detached-work.js';
17
18
  import type { ConnectorStore } from '../connectors/ingest.js';
18
19
  export interface ServerHandle {
19
20
  port: number;
@@ -147,6 +148,8 @@ export type ResolvedServeOptions = ServeOptions & {
147
148
  /** This server's outside services: one reranker registry for the server's life, the rest per
148
149
  * Context. */
149
150
  infra: () => InfraPorts;
151
+ /** Keeps the work a request starts and does not wait on; the server's stop settles it. */
152
+ detached: DetachedWork;
150
153
  sleeps: SleepQueue;
151
154
  counts: ServerCounts;
152
155
  };
@@ -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": "3.0.0",
5
+ "version": "3.1.1",
6
6
 
7
7
  "configSchema": {
8
8
  "type": "object",
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "hippo-memory",
3
- "version": "3.0.0",
3
+ "version": "3.1.1",
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": "3.0.0",
5
+ "version": "3.1.1",
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": "3.0.0",
3
+ "version": "3.1.1",
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",