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.
- package/README.md +1 -0
- package/dist/api/context/context-plan.js +2 -4
- package/dist/api/context/context-select.js +12 -7
- package/dist/api/detached.d.ts +6 -0
- package/dist/api/detached.js +16 -0
- package/dist/api/embeddings.d.ts +4 -3
- package/dist/api/embeddings.js +4 -4
- package/dist/api/memories/promote.js +2 -1
- package/dist/api/memories/remember-local.d.ts +5 -4
- package/dist/api/memories/remember-local.js +13 -10
- package/dist/api/recall/rank-stages.js +2 -2
- package/dist/api/session-end.js +1 -0
- package/dist/api/sharing.js +9 -7
- package/dist/api/sleep/auto-sleep.d.ts +1 -1
- package/dist/api/sleep/auto-sleep.js +5 -3
- package/dist/api/sleep/learn.js +5 -2
- package/dist/api/sleep/sleep-run.js +4 -2
- package/dist/api/types.d.ts +4 -0
- package/dist/base/memory/entry.js +2 -2
- package/dist/base/memory/markdown-delimiters.d.ts +15 -0
- package/dist/base/memory/markdown-delimiters.js +94 -0
- package/dist/base/memory/memory-audit.js +4 -4
- package/dist/base/memory/memory-quality.d.ts +12 -0
- package/dist/base/memory/memory-quality.js +92 -3
- package/dist/base/ports/store/types.d.ts +2 -1
- package/dist/base/rank/prompt-recall.d.ts +16 -3
- package/dist/base/rank/prompt-recall.js +47 -7
- package/dist/base/util/detached-set.d.ts +8 -0
- package/dist/base/util/detached-set.js +35 -0
- package/dist/base/util/tokenize.d.ts +29 -0
- package/dist/base/util/tokenize.js +68 -5
- package/dist/base/util/version.d.ts +1 -1
- package/dist/base/util/version.js +1 -1
- package/dist/db/meta.d.ts +1 -0
- package/dist/db/meta.js +1 -0
- package/dist/db/store-runtime.d.ts +10 -3
- package/dist/db/store-runtime.js +19 -3
- package/dist/domain/consolidate/conflicts.js +2 -2
- package/dist/domain/learn/forward-claim-detector.js +4 -2
- package/dist/domain/learn/invalidation.js +5 -2
- package/dist/domain/search/bm25.js +3 -3
- package/dist/domain/search/detached-work.d.ts +6 -0
- package/dist/domain/search/detached-work.js +2 -0
- package/dist/domain/search/embed-memories.d.ts +4 -4
- package/dist/domain/search/embed-memories.js +4 -5
- package/dist/domain/sharing/global-sync.d.ts +8 -2
- package/dist/domain/sharing/global-sync.js +5 -5
- package/dist/domain/sharing/share.d.ts +4 -0
- package/dist/domain/sharing/share.js +2 -2
- package/dist/entry/eval-scripts.d.ts +1 -0
- package/dist/entry/sleep.d.ts +1 -0
- package/dist/index.d.ts +1 -1
- package/dist/server.d.ts +1 -0
- package/dist/store/rules/windows.d.ts +3 -0
- package/dist/store/rules/windows.js +3 -0
- package/dist/store/sqlite/audit/audit-maintenance.js +16 -13
- package/dist/store/sqlite/recall/candidates.js +1 -0
- package/dist/store/sqlite/recall/search-rows.d.ts +2 -2
- package/dist/store/sqlite/recall/search-rows.js +62 -26
- package/dist/store/sqlite/runtime/server-runtime.d.ts +6 -1
- package/dist/store/sqlite/runtime/server-runtime.js +15 -3
- package/dist/store/sqlite/runtime/worker-jobs.js +2 -2
- package/dist/store/sqlite/sharing/copy-rows.d.ts +1 -0
- package/dist/store/sqlite/sharing/copy-rows.js +2 -1
- package/dist/surface/capture/command.d.ts +8 -1
- package/dist/surface/capture/command.js +38 -8
- package/dist/surface/capture/compact.d.ts +3 -3
- package/dist/surface/capture/compact.js +4 -4
- package/dist/surface/capture/extract.d.ts +10 -0
- package/dist/surface/capture/extract.js +199 -26
- package/dist/surface/capture/session-texts.js +11 -11
- package/dist/surface/cli/api-context.d.ts +5 -0
- package/dist/surface/cli/api-context.js +12 -0
- package/dist/surface/cli/goals.js +6 -8
- package/dist/surface/cli/hook-runtime.js +2 -2
- package/dist/surface/cli/memory-import.js +20 -15
- package/dist/surface/mcp/protocol.d.ts +6 -0
- package/dist/surface/mcp/protocol.js +1 -0
- package/dist/surface/mcp/stdio.js +11 -5
- package/dist/surface/open-store.d.ts +2 -2
- package/dist/surface/open-store.js +11 -7
- package/dist/surface/server/auth.d.ts +1 -1
- package/dist/surface/server/auth.js +13 -2
- package/dist/surface/server/boot.js +3 -2
- package/dist/surface/server/dashboard-listener.js +2 -2
- package/dist/surface/server/lifecycle.d.ts +2 -0
- package/dist/surface/server/lifecycle.js +4 -2
- package/dist/surface/server/mcp-http.js +1 -0
- package/dist/surface/server/types.d.ts +3 -0
- 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
|
@@ -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-
|
|
35
|
-
*
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
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
|
-
|
|
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. */
|
|
@@ -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
|
-
|
|
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
|
|
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
|
|
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.
|
|
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
|
-
|
|
19
|
-
|
|
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 {
|
|
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
|
-
|
|
19
|
-
|
|
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) {
|
|
@@ -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
|
};
|
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": "3.
|
|
5
|
+
"version": "3.1.1",
|
|
6
6
|
"configSchema": {
|
|
7
7
|
"type": "object",
|
|
8
8
|
"additionalProperties": false,
|
package/package.json
CHANGED