@hasna/mementos 0.14.73 → 0.14.74
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/cli/commands/storage.d.ts.map +1 -1
- package/dist/cli/exit-codes.d.ts +13 -0
- package/dist/cli/exit-codes.d.ts.map +1 -0
- package/dist/cli/helpers.d.ts +1 -1
- package/dist/cli/helpers.d.ts.map +1 -1
- package/dist/cli/index.js +63 -11
- package/dist/db/api-mode.d.ts +33 -3
- package/dist/db/api-mode.d.ts.map +1 -1
- package/dist/db/database.d.ts.map +1 -1
- package/dist/db/store-backend.d.ts +11 -2
- package/dist/db/store-backend.d.ts.map +1 -1
- package/dist/index.js +12 -3
- package/dist/mcp/index.js +12 -3
- package/dist/server/index.js +12 -3
- package/dist/test-support/store-isolation.d.ts +22 -2
- package/dist/test-support/store-isolation.d.ts.map +1 -1
- package/dist/test-support/strip-ansi.d.ts +3 -0
- package/dist/test-support/strip-ansi.d.ts.map +1 -0
- package/package.json +1 -1
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"storage.d.ts","sourceRoot":"","sources":["../../../src/cli/commands/storage.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,OAAO,EAAE,MAAM,WAAW,CAAC;
|
|
1
|
+
{"version":3,"file":"storage.d.ts","sourceRoot":"","sources":["../../../src/cli/commands/storage.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,OAAO,EAAE,MAAM,WAAW,CAAC;AA8UzC,wBAAgB,uBAAuB,CAAC,OAAO,EAAE,OAAO,GAAG,IAAI,CAK9D"}
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
export declare const EXIT_USAGE = 64;
|
|
2
|
+
/**
|
|
3
|
+
* Map a CommanderError onto this CLI's exit-status contract.
|
|
4
|
+
*
|
|
5
|
+
* Pure and total: given the `code`/`exitCode` pair Commander produces, returns
|
|
6
|
+
* the status the process should exit with. Success paths (`--help`, `--version`,
|
|
7
|
+
* which arrive with exitCode 0) are passed through untouched.
|
|
8
|
+
*/
|
|
9
|
+
export declare function resolveExitCode(err: {
|
|
10
|
+
code?: string;
|
|
11
|
+
exitCode?: number;
|
|
12
|
+
}): number;
|
|
13
|
+
//# sourceMappingURL=exit-codes.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"exit-codes.d.ts","sourceRoot":"","sources":["../../src/cli/exit-codes.ts"],"names":[],"mappings":"AAsCA,eAAO,MAAM,UAAU,KAAK,CAAC;AA2B7B;;;;;;GAMG;AACH,wBAAgB,eAAe,CAAC,GAAG,EAAE;IACnC,IAAI,CAAC,EAAE,MAAM,CAAC;IACd,QAAQ,CAAC,EAAE,MAAM,CAAC;CACnB,GAAG,MAAM,CAOT"}
|
package/dist/cli/helpers.d.ts
CHANGED
|
@@ -6,7 +6,7 @@ export declare function importanceColor(importance: number): (s: string) => stri
|
|
|
6
6
|
export declare function colorScope(scope: MemoryScope): string;
|
|
7
7
|
export declare function colorCategory(category: MemoryCategory): string;
|
|
8
8
|
export declare function colorImportance(importance: number): string;
|
|
9
|
-
export declare function colorEntityType(type: string): string;
|
|
9
|
+
export declare function colorEntityType(type: string, suffix?: string): string;
|
|
10
10
|
export declare function resolveEntityArg(nameOrId: string, type?: EntityType): Entity;
|
|
11
11
|
export declare function outputJson(data: unknown): void;
|
|
12
12
|
export declare const DEFAULT_COMPACT_LIMIT = 20;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"helpers.d.ts","sourceRoot":"","sources":["../../src/cli/helpers.ts"],"names":[],"mappings":"AASA,OAAO,KAAK,EAAE,OAAO,EAAE,MAAM,WAAW,CAAC;AACzC,OAAO,KAAK,EACV,MAAM,EACN,cAAc,EACd,WAAW,EAEZ,MAAM,mBAAmB,CAAC;AAC3B,OAAO,KAAK,EAAE,MAAM,EAAE,UAAU,EAAE,MAAM,mBAAmB,CAAC;AAM5D,wBAAgB,iBAAiB,IAAI,MAAM,CAe1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FAAyF;AACzF,wBAAgB,gBAAgB,CAAC,GAAG,EAAE,MAAM,GAAG,OAAO,CAMrD;AAED,iEAAiE;AACjE,wBAAgB,sBAAsB,CAAC,GAAG,EAAE,MAAM,EAAE,KAAK,EAAE,OAAO,EAAE,cAAc,EAAE,OAAO,GAAG,MAAM,GAAG,IAAI,CA0C1G;AAED,wBAAgB,aAAa,IAAI,MAAM,CAGtC;AAED,wBAAgB,cAAc,IAAI,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,CAcxD;AAED,wBAAgB,eAAe,CAAC,IAAI,EAAE,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,GAAG,IAAI,CAMnE"}
|
package/dist/cli/index.js
CHANGED
|
@@ -3010,6 +3010,14 @@ function getApiModeEnvSources() {
|
|
|
3010
3010
|
databaseUrlKey: firstEnvKey(DATABASE_URL_ENV_KEYS)
|
|
3011
3011
|
};
|
|
3012
3012
|
}
|
|
3013
|
+
function getConfiguredApiEnv() {
|
|
3014
|
+
const rawBase = firstEnv(API_URL_ENV_KEYS);
|
|
3015
|
+
return {
|
|
3016
|
+
baseUrl: rawBase ? normalizeBase(rawBase) : null,
|
|
3017
|
+
apiKeyPresent: Boolean(firstEnvKey(API_KEY_ENV_KEYS)),
|
|
3018
|
+
dbPathKey: firstEnvKey(DB_PATH_ENV_KEYS)
|
|
3019
|
+
};
|
|
3020
|
+
}
|
|
3013
3021
|
function isLoopbackHost(rawHost) {
|
|
3014
3022
|
const host = rawHost.replace(/^\[/, "").replace(/\]$/, "").toLowerCase();
|
|
3015
3023
|
return host === "localhost" || host === "::1" || /^127\./.test(host);
|
|
@@ -3055,6 +3063,8 @@ function assertUnambiguousStoreEnv() {
|
|
|
3055
3063
|
}
|
|
3056
3064
|
function getApiConfig() {
|
|
3057
3065
|
assertUnambiguousStoreEnv();
|
|
3066
|
+
if (firstEnvKey(DB_PATH_ENV_KEYS))
|
|
3067
|
+
return null;
|
|
3058
3068
|
const rawBase = firstEnv(API_URL_ENV_KEYS);
|
|
3059
3069
|
const apiKey = firstEnv(API_KEY_ENV_KEYS);
|
|
3060
3070
|
if (!rawBase || !apiKey)
|
|
@@ -4179,9 +4189,10 @@ function migrateGlobalDir() {
|
|
|
4179
4189
|
}
|
|
4180
4190
|
}
|
|
4181
4191
|
function getDbPath() {
|
|
4182
|
-
const
|
|
4183
|
-
|
|
4184
|
-
|
|
4192
|
+
for (const key of DB_PATH_ENV_KEYS) {
|
|
4193
|
+
const envPath = process.env[key]?.trim();
|
|
4194
|
+
if (envPath)
|
|
4195
|
+
return envPath;
|
|
4185
4196
|
}
|
|
4186
4197
|
const cwd = process.cwd();
|
|
4187
4198
|
const nearest = findNearestMementosDb(cwd);
|
|
@@ -4225,6 +4236,12 @@ function getDatabase(dbPath) {
|
|
|
4225
4236
|
if (getStorageMode() === "cloud") {
|
|
4226
4237
|
return getCloudDatabase();
|
|
4227
4238
|
}
|
|
4239
|
+
if (process.env["NODE_ENV"] === "test") {
|
|
4240
|
+
const hasExplicitDbPath = DB_PATH_ENV_KEYS.some((key) => process.env[key]?.trim());
|
|
4241
|
+
if (!hasExplicitDbPath) {
|
|
4242
|
+
throw new Error("REFUSING-UNPINNED-TEST-OPEN: a test process tried to open the default local " + `SQLite store (${getDbPath()}) with no explicit dbPath argument and no ` + `${DB_PATH_ENV_KEYS.join("/")} set. Pass an explicit dbPath (e.g. ":memory:" ` + "or a scratch file), or set one of those env keys to a scratch path, before " + "calling getDatabase(). This guard exists because an unpinned test process " + "would otherwise silently read and write the real, shared, on-disk memory " + "store (todos 57b8b8c5).");
|
|
4243
|
+
}
|
|
4244
|
+
}
|
|
4228
4245
|
}
|
|
4229
4246
|
const path = dbPath || getDbPath();
|
|
4230
4247
|
if (_db) {
|
|
@@ -6036,9 +6053,9 @@ function colorCategory(category) {
|
|
|
6036
6053
|
function colorImportance(importance) {
|
|
6037
6054
|
return importanceColor(importance)(String(importance));
|
|
6038
6055
|
}
|
|
6039
|
-
function colorEntityType(type) {
|
|
6056
|
+
function colorEntityType(type, suffix = "") {
|
|
6040
6057
|
const colorFn = entityTypeColor[type] || chalk.white;
|
|
6041
|
-
return colorFn(type);
|
|
6058
|
+
return colorFn(`${type}${suffix}`);
|
|
6042
6059
|
}
|
|
6043
6060
|
function resolveEntityArg(nameOrId, type) {
|
|
6044
6061
|
const byName = getEntityByName(nameOrId, type);
|
|
@@ -59025,6 +59042,26 @@ function applyGlobalOptions(program2) {
|
|
|
59025
59042
|
return program2;
|
|
59026
59043
|
}
|
|
59027
59044
|
|
|
59045
|
+
// src/cli/exit-codes.ts
|
|
59046
|
+
var EXIT_USAGE = 64;
|
|
59047
|
+
var USAGE_ERROR_CODES = new Set([
|
|
59048
|
+
"commander.unknownCommand",
|
|
59049
|
+
"commander.unknownOption",
|
|
59050
|
+
"commander.missingArgument",
|
|
59051
|
+
"commander.optionMissingArgument",
|
|
59052
|
+
"commander.missingMandatoryOptionValue",
|
|
59053
|
+
"commander.excessArguments",
|
|
59054
|
+
"commander.conflictingOption",
|
|
59055
|
+
"commander.invalidArgument",
|
|
59056
|
+
"commander.help"
|
|
59057
|
+
]);
|
|
59058
|
+
function resolveExitCode(err) {
|
|
59059
|
+
const exitCode = typeof err.exitCode === "number" ? err.exitCode : 1;
|
|
59060
|
+
if (exitCode === 0)
|
|
59061
|
+
return 0;
|
|
59062
|
+
return USAGE_ERROR_CODES.has(err.code ?? "") ? EXIT_USAGE : exitCode;
|
|
59063
|
+
}
|
|
59064
|
+
|
|
59028
59065
|
// node_modules/@hasna/events/dist/commander.js
|
|
59029
59066
|
import { chmod, mkdir, readFile, rename, writeFile } from "fs/promises";
|
|
59030
59067
|
import { existsSync as existsSync3 } from "fs";
|
|
@@ -60452,7 +60489,7 @@ function registerChainCommand(program2) {
|
|
|
60452
60489
|
const m = memories[i];
|
|
60453
60490
|
const order = m.sequence_order !== null && m.sequence_order !== undefined ? m.sequence_order : i + 1;
|
|
60454
60491
|
const value = m.value.length > 120 ? m.value.slice(0, 120) + "..." : m.value;
|
|
60455
|
-
console.log(` ${chalk8.cyan(String(order) + ".")} ${chalk8.bold(m.key)}
|
|
60492
|
+
console.log(` ${chalk8.cyan(String(order) + ".")} ${chalk8.bold(`${m.key}:`)} ${value}`);
|
|
60456
60493
|
}
|
|
60457
60494
|
} catch (e) {
|
|
60458
60495
|
handleError(e);
|
|
@@ -62992,12 +63029,12 @@ function registerGraphCommands(program2) {
|
|
|
62992
63029
|
console.log();
|
|
62993
63030
|
console.log(chalk26.bold(`Entities: ${stats.entities.total}`));
|
|
62994
63031
|
for (const r of entityRows) {
|
|
62995
|
-
console.log(` ${colorEntityType(r.type)}
|
|
63032
|
+
console.log(` ${colorEntityType(r.type, ":")} ${r.count}`);
|
|
62996
63033
|
}
|
|
62997
63034
|
console.log();
|
|
62998
63035
|
console.log(chalk26.bold(`Relations: ${stats.relations.total}`));
|
|
62999
63036
|
for (const r of relationRows) {
|
|
63000
|
-
console.log(` ${chalk26.cyan(r.relation_type)}
|
|
63037
|
+
console.log(` ${chalk26.cyan(`${r.relation_type}:`)} ${r.count}`);
|
|
63001
63038
|
}
|
|
63002
63039
|
console.log();
|
|
63003
63040
|
console.log(chalk26.bold(`Memory links: ${stats.memory_links}`));
|
|
@@ -64038,7 +64075,7 @@ function registerToolsCommand(program2) {
|
|
|
64038
64075
|
console.log(chalk34.bold(`
|
|
64039
64076
|
Common errors:`));
|
|
64040
64077
|
for (const err of stats.common_errors) {
|
|
64041
|
-
console.log(` ${chalk34.red(err.error_type)}
|
|
64078
|
+
console.log(` ${chalk34.red(`${err.error_type}:`)} ${err.count} times`);
|
|
64042
64079
|
}
|
|
64043
64080
|
}
|
|
64044
64081
|
if (lessons.length === 0) {
|
|
@@ -65045,10 +65082,13 @@ function resolveStoreBackend() {
|
|
|
65045
65082
|
const apiConfig = getApiConfig();
|
|
65046
65083
|
const storageMode = getStorageMode();
|
|
65047
65084
|
const sources = getApiModeEnvSources();
|
|
65085
|
+
const configured = getConfiguredApiEnv();
|
|
65048
65086
|
const backend = apiMode ? "cloud-api" : storageMode === "cloud" ? "cloud-postgres" : "local-sqlite";
|
|
65049
65087
|
let selectedBy = "default";
|
|
65050
65088
|
if (apiMode) {
|
|
65051
65089
|
selectedBy = `${sources.urlKey} + ${sources.keyKey} (presence)`;
|
|
65090
|
+
} else if (backend === "local-sqlite" && configured.dbPathKey) {
|
|
65091
|
+
selectedBy = configured.apiKeyPresent && configured.baseUrl ? `${configured.dbPathKey} (explicit local path, outranks the API selectors)` : `${configured.dbPathKey} (explicit local path)`;
|
|
65052
65092
|
} else if (backend === "cloud-postgres") {
|
|
65053
65093
|
const modeKey = [MEMENTOS_STORAGE_ENV.mode, MEMENTOS_STORAGE_FALLBACK_ENV.mode].find((key) => process.env[key]?.trim());
|
|
65054
65094
|
selectedBy = modeKey ?? sources.databaseUrlKey ?? "storage config file";
|
|
@@ -65059,8 +65099,8 @@ function resolveStoreBackend() {
|
|
|
65059
65099
|
api_mode: apiMode,
|
|
65060
65100
|
storage_mode: storageMode,
|
|
65061
65101
|
db_path: getDbPath(),
|
|
65062
|
-
api_endpoint: apiConfig?.baseUrl ??
|
|
65063
|
-
api_key_present: Boolean(apiConfig?.apiKey),
|
|
65102
|
+
api_endpoint: apiConfig?.baseUrl ?? configured.baseUrl,
|
|
65103
|
+
api_key_present: Boolean(apiConfig?.apiKey) || configured.apiKeyPresent,
|
|
65064
65104
|
selected_by: selectedBy
|
|
65065
65105
|
};
|
|
65066
65106
|
}
|
|
@@ -65114,6 +65154,9 @@ function installStorageSubcommands(storage, program2) {
|
|
|
65114
65154
|
console.log(`Storage mode: ${report.storage_mode}`);
|
|
65115
65155
|
if (report.backend === "local-sqlite") {
|
|
65116
65156
|
console.log(`Database: ${report.db_path}`);
|
|
65157
|
+
if (report.api_key_present && report.api_endpoint) {
|
|
65158
|
+
console.log(`API endpoint (configured, OUTRANKED): ${report.api_endpoint}`);
|
|
65159
|
+
}
|
|
65117
65160
|
} else {
|
|
65118
65161
|
console.log(`API endpoint: ${report.api_endpoint ?? "(none)"}`);
|
|
65119
65162
|
console.log(`API key: ${report.api_key_present ? "configured" : "not configured"}`);
|
|
@@ -66962,6 +67005,14 @@ function getPackageVersion2() {
|
|
|
66962
67005
|
var program2 = new Command;
|
|
66963
67006
|
program2.name("mementos").description("Universal memory system for AI agents").version(getPackageVersion2());
|
|
66964
67007
|
applyGlobalOptions(program2);
|
|
67008
|
+
function applyExitCodeContract(command) {
|
|
67009
|
+
command.exitOverride((err) => {
|
|
67010
|
+
process.exit(resolveExitCode(err));
|
|
67011
|
+
});
|
|
67012
|
+
for (const subcommand of command.commands) {
|
|
67013
|
+
applyExitCodeContract(subcommand);
|
|
67014
|
+
}
|
|
67015
|
+
}
|
|
66965
67016
|
var startupWarningShown = false;
|
|
66966
67017
|
program2.hook("preAction", (_thisCommand, actionCommand) => {
|
|
66967
67018
|
if (skipsStartupDbAccess(actionCommand))
|
|
@@ -66977,4 +67028,5 @@ program2.hook("preAction", (_thisCommand, actionCommand) => {
|
|
|
66977
67028
|
} catch {}
|
|
66978
67029
|
});
|
|
66979
67030
|
registerAllCommands(program2);
|
|
67031
|
+
applyExitCodeContract(program2);
|
|
66980
67032
|
program2.parse(process.argv);
|
package/dist/db/api-mode.d.ts
CHANGED
|
@@ -15,6 +15,23 @@ export declare function getApiModeEnvSources(): {
|
|
|
15
15
|
keyKey: string | null;
|
|
16
16
|
databaseUrlKey: string | null;
|
|
17
17
|
};
|
|
18
|
+
/**
|
|
19
|
+
* What the environment CONFIGURES, regardless of which store finally wins.
|
|
20
|
+
*
|
|
21
|
+
* Distinct from {@link getApiConfig}, which answers "may I build a cloud
|
|
22
|
+
* request?" and returns null once an explicit DB_PATH outranks the credentials
|
|
23
|
+
* (precedence 1). An operator report needs both halves separately: conflating
|
|
24
|
+
* them prints "no API key configured" at someone whose key is configured and
|
|
25
|
+
* merely outranked, which points them at a credential problem they do not have.
|
|
26
|
+
*
|
|
27
|
+
* Never returns a credential value — the endpoint is not secret, the key is
|
|
28
|
+
* reported only as a boolean.
|
|
29
|
+
*/
|
|
30
|
+
export declare function getConfiguredApiEnv(): {
|
|
31
|
+
baseUrl: string | null;
|
|
32
|
+
apiKeyPresent: boolean;
|
|
33
|
+
dbPathKey: string | null;
|
|
34
|
+
};
|
|
18
35
|
/**
|
|
19
36
|
* Escape hatch for a test that genuinely must reach a non-loopback endpoint.
|
|
20
37
|
* Opt-in by design: the default has to be safe, because the failure it prevents
|
|
@@ -38,13 +55,26 @@ export declare class MementosStoreConfigError extends Error {
|
|
|
38
55
|
* dataset with no error and no flag. From the caller's side that is
|
|
39
56
|
* indistinguishable from a store that is working.
|
|
40
57
|
*
|
|
58
|
+
* THIS FUNCTION ONLY ASSERTS. It returns `void`, so it cannot select anything —
|
|
59
|
+
* the precedence table below describes the RESOLVER, which is `getApiConfig()`
|
|
60
|
+
* immediately after it, and each early `return` here only suppresses the
|
|
61
|
+
* ambiguity error for a case that is already unambiguous. Steps 1 and 2 are
|
|
62
|
+
* therefore implemented in `getApiConfig()` and `isApiMode()` respectively, and
|
|
63
|
+
* the table is documented here because this is where the error text lives.
|
|
64
|
+
*
|
|
65
|
+
* Keeping the table honest about that is not cosmetic. Until 2026-08-03 step 1
|
|
66
|
+
* was implemented NOWHERE: the `return` below reads as a selection, and an
|
|
67
|
+
* operator who read it concluded that a scratch DB_PATH made them safe while a
|
|
68
|
+
* fully-configured environment still routed every read and write to the shared
|
|
69
|
+
* production store.
|
|
70
|
+
*
|
|
41
71
|
* Precedence, highest first:
|
|
42
72
|
* 1. An explicit SQLite path (`HASNA_MEMENTOS_DB_PATH` / `MEMENTOS_DB_PATH`) is
|
|
43
73
|
* the narrowest, most specific signal and selects LOCAL, so local dev,
|
|
44
74
|
* tooling and import/export keep working when a stray credential is exported
|
|
45
|
-
* globally.
|
|
46
|
-
* 2. A client DSN present disables API mode.
|
|
47
|
-
*
|
|
75
|
+
* globally. ENFORCED in `getApiConfig()`, which returns null for it.
|
|
76
|
+
* 2. A client DSN present disables API mode. ENFORCED in `isApiMode()`. A DSN
|
|
77
|
+
* on a client is forbidden and is tracked separately in database.ts.
|
|
48
78
|
* 3. Both API URL and API key present -> API mode.
|
|
49
79
|
* 4. Exactly ONE of them present -> ERROR naming the missing variable.
|
|
50
80
|
* 5. Neither present -> LOCAL. The documented single-operator default.
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"api-mode.d.ts","sourceRoot":"","sources":["../../src/db/api-mode.ts"],"names":[],"mappings":"AA0CA,MAAM,WAAW,SAAS;IACxB,OAAO,EAAE,MAAM,CAAC;IAChB,MAAM,EAAE,MAAM,CAAC;CAChB;AASD,eAAO,MAAM,gBAAgB,yDAA0D,CAAC;AACxF,eAAO,MAAM,gBAAgB,yDAA0D,CAAC;AACxF,eAAO,MAAM,qBAAqB,mEAAoE,CAAC;AAsBvG;;;;GAIG;AACH,wBAAgB,oBAAoB,IAAI;IAAE,MAAM,EAAE,MAAM,GAAG,IAAI,CAAC;IAAC,MAAM,EAAE,MAAM,GAAG,IAAI,CAAC;IAAC,cAAc,EAAE,MAAM,GAAG,IAAI,CAAA;CAAE,CAMtH;AAED;;;;GAIG;AACH,eAAO,MAAM,6BAA6B,uCAAuC,CAAC;AAyDlF,6EAA6E;AAC7E,kEAAkE;AAClE,eAAO,MAAM,gBAAgB,yDAA0D,CAAC;AAExF,2EAA2E;AAC3E,qBAAa,wBAAyB,SAAQ,KAAK;IACjD,QAAQ,CAAC,IAAI,2BAA2B;gBAC5B,OAAO,EAAE,MAAM;CAI5B;AAED
|
|
1
|
+
{"version":3,"file":"api-mode.d.ts","sourceRoot":"","sources":["../../src/db/api-mode.ts"],"names":[],"mappings":"AA0CA,MAAM,WAAW,SAAS;IACxB,OAAO,EAAE,MAAM,CAAC;IAChB,MAAM,EAAE,MAAM,CAAC;CAChB;AASD,eAAO,MAAM,gBAAgB,yDAA0D,CAAC;AACxF,eAAO,MAAM,gBAAgB,yDAA0D,CAAC;AACxF,eAAO,MAAM,qBAAqB,mEAAoE,CAAC;AA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,MAAM,EAAE,MAAM,CAAC;IAAC,IAAI,EAAE,CAAC,CAAA;CAAE,CAiB7B;AAED,8EAA8E;AAC9E,wBAAgB,OAAO,CAAC,MAAM,EAAE,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,GAAG,MAAM,CAe/D"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"database.d.ts","sourceRoot":"","sources":["../../src/db/database.ts"],"names":[],"mappings":"AAAA,OAAO,EACL,aAAa,IAAI,QAAQ,EAK1B,MAAM,eAAe,CAAC;AAkDvB,wBAAgB,SAAS,IAAI,MAAM,
|
|
1
|
+
{"version":3,"file":"database.d.ts","sourceRoot":"","sources":["../../src/db/database.ts"],"names":[],"mappings":"AAAA,OAAO,EACL,aAAa,IAAI,QAAQ,EAK1B,MAAM,eAAe,CAAC;AAkDvB,wBAAgB,SAAS,IAAI,MAAM,CAwBlC;AAoDD,wBAAgB,WAAW,CAAC,MAAM,CAAC,EAAE,MAAM,GAAG,QAAQ,CAoGrD;AAgDD,wBAAgB,aAAa,IAAI,IAAI,CASpC;AAED,wBAAgB,aAAa,IAAI,IAAI,CAGpC;AAED,wBAAgB,GAAG,IAAI,MAAM,CAE5B;AAED,wBAAgB,IAAI,IAAI,MAAM,CAE7B;AAED,wBAAgB,SAAS,IAAI,MAAM,CAElC;AASD;;;;;;;;;;;;;;GAcG;AACH,wBAAgB,gBAAgB,CAAC,CAAC,EAAE,MAAM,GAAG,MAAM,CAElD;AAED,wBAAgB,gBAAgB,CAC9B,EAAE,EAAE,QAAQ,EACZ,KAAK,EAAE,MAAM,EACb,SAAS,EAAE,MAAM,GAChB,MAAM,GAAG,IAAI,CAuBf"}
|
|
@@ -16,9 +16,18 @@ export interface StoreBackendReport {
|
|
|
16
16
|
storage_mode: string;
|
|
17
17
|
/** The SQLite path that WOULD be used. Meaningful only for `local-sqlite`. */
|
|
18
18
|
db_path: string;
|
|
19
|
-
/**
|
|
19
|
+
/**
|
|
20
|
+
* Cloud endpoint origin + prefix as CONFIGURED, not necessarily as used: it
|
|
21
|
+
* is still reported when an explicit DB_PATH has outranked it, because the
|
|
22
|
+
* operator needs to see what was set as well as what won. Read `backend` /
|
|
23
|
+
* `api_mode` for what is actually in force, and `selected_by` for why.
|
|
24
|
+
* Not a secret; the key is never included.
|
|
25
|
+
*/
|
|
20
26
|
api_endpoint: string | null;
|
|
21
|
-
/**
|
|
27
|
+
/**
|
|
28
|
+
* Whether an API key is CONFIGURED in the environment — again independent of
|
|
29
|
+
* whether it won. The value is never read or reported.
|
|
30
|
+
*/
|
|
22
31
|
api_key_present: boolean;
|
|
23
32
|
/** Env key NAMES that produced this backend, or `"default"`. Names only. */
|
|
24
33
|
selected_by: string;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"store-backend.d.ts","sourceRoot":"","sources":["../../src/db/store-backend.ts"],"names":[],"mappings":"AA4BA;;;;;;GAMG;AACH,MAAM,MAAM,YAAY,GAAG,cAAc,GAAG,WAAW,GAAG,gBAAgB,CAAC;AAE3E,MAAM,WAAW,kBAAkB;IACjC,6DAA6D;IAC7D,MAAM,EAAE,2BAA2B,CAAC;IACpC,OAAO,EAAE,YAAY,CAAC;IACtB,iFAAiF;IACjF,QAAQ,EAAE,OAAO,CAAC;IAClB,6EAA6E;IAC7E,YAAY,EAAE,MAAM,CAAC;IACrB,8EAA8E;IAC9E,OAAO,EAAE,MAAM,CAAC;IAChB
|
|
1
|
+
{"version":3,"file":"store-backend.d.ts","sourceRoot":"","sources":["../../src/db/store-backend.ts"],"names":[],"mappings":"AA4BA;;;;;;GAMG;AACH,MAAM,MAAM,YAAY,GAAG,cAAc,GAAG,WAAW,GAAG,gBAAgB,CAAC;AAE3E,MAAM,WAAW,kBAAkB;IACjC,6DAA6D;IAC7D,MAAM,EAAE,2BAA2B,CAAC;IACpC,OAAO,EAAE,YAAY,CAAC;IACtB,iFAAiF;IACjF,QAAQ,EAAE,OAAO,CAAC;IAClB,6EAA6E;IAC7E,YAAY,EAAE,MAAM,CAAC;IACrB,8EAA8E;IAC9E,OAAO,EAAE,MAAM,CAAC;IAChB;;;;;;OAMG;IACH,YAAY,EAAE,MAAM,GAAG,IAAI,CAAC;IAC5B;;;OAGG;IACH,eAAe,EAAE,OAAO,CAAC;IACzB,4EAA4E;IAC5E,WAAW,EAAE,MAAM,CAAC;CACrB;AAED;;;;;GAKG;AACH,wBAAgB,mBAAmB,IAAI,kBAAkB,CAoDxD"}
|
package/dist/index.js
CHANGED
|
@@ -1031,6 +1031,8 @@ function assertUnambiguousStoreEnv() {
|
|
|
1031
1031
|
}
|
|
1032
1032
|
function getApiConfig() {
|
|
1033
1033
|
assertUnambiguousStoreEnv();
|
|
1034
|
+
if (firstEnvKey(DB_PATH_ENV_KEYS))
|
|
1035
|
+
return null;
|
|
1034
1036
|
const rawBase = firstEnv(API_URL_ENV_KEYS);
|
|
1035
1037
|
const apiKey = firstEnv(API_KEY_ENV_KEYS);
|
|
1036
1038
|
if (!rawBase || !apiKey)
|
|
@@ -2155,9 +2157,10 @@ function migrateGlobalDir() {
|
|
|
2155
2157
|
}
|
|
2156
2158
|
}
|
|
2157
2159
|
function getDbPath() {
|
|
2158
|
-
const
|
|
2159
|
-
|
|
2160
|
-
|
|
2160
|
+
for (const key of DB_PATH_ENV_KEYS) {
|
|
2161
|
+
const envPath = process.env[key]?.trim();
|
|
2162
|
+
if (envPath)
|
|
2163
|
+
return envPath;
|
|
2161
2164
|
}
|
|
2162
2165
|
const cwd = process.cwd();
|
|
2163
2166
|
const nearest = findNearestMementosDb(cwd);
|
|
@@ -2201,6 +2204,12 @@ function getDatabase(dbPath) {
|
|
|
2201
2204
|
if (getStorageMode() === "cloud") {
|
|
2202
2205
|
return getCloudDatabase();
|
|
2203
2206
|
}
|
|
2207
|
+
if (process.env["NODE_ENV"] === "test") {
|
|
2208
|
+
const hasExplicitDbPath = DB_PATH_ENV_KEYS.some((key) => process.env[key]?.trim());
|
|
2209
|
+
if (!hasExplicitDbPath) {
|
|
2210
|
+
throw new Error("REFUSING-UNPINNED-TEST-OPEN: a test process tried to open the default local " + `SQLite store (${getDbPath()}) with no explicit dbPath argument and no ` + `${DB_PATH_ENV_KEYS.join("/")} set. Pass an explicit dbPath (e.g. ":memory:" ` + "or a scratch file), or set one of those env keys to a scratch path, before " + "calling getDatabase(). This guard exists because an unpinned test process " + "would otherwise silently read and write the real, shared, on-disk memory " + "store (todos 57b8b8c5).");
|
|
2211
|
+
}
|
|
2212
|
+
}
|
|
2204
2213
|
}
|
|
2205
2214
|
const path = dbPath || getDbPath();
|
|
2206
2215
|
if (_db) {
|
package/dist/mcp/index.js
CHANGED
|
@@ -1094,6 +1094,8 @@ function assertUnambiguousStoreEnv() {
|
|
|
1094
1094
|
}
|
|
1095
1095
|
function getApiConfig() {
|
|
1096
1096
|
assertUnambiguousStoreEnv();
|
|
1097
|
+
if (firstEnvKey(DB_PATH_ENV_KEYS))
|
|
1098
|
+
return null;
|
|
1097
1099
|
const rawBase = firstEnv(API_URL_ENV_KEYS);
|
|
1098
1100
|
const apiKey = firstEnv(API_KEY_ENV_KEYS);
|
|
1099
1101
|
if (!rawBase || !apiKey)
|
|
@@ -2218,9 +2220,10 @@ function migrateGlobalDir() {
|
|
|
2218
2220
|
}
|
|
2219
2221
|
}
|
|
2220
2222
|
function getDbPath() {
|
|
2221
|
-
const
|
|
2222
|
-
|
|
2223
|
-
|
|
2223
|
+
for (const key of DB_PATH_ENV_KEYS) {
|
|
2224
|
+
const envPath = process.env[key]?.trim();
|
|
2225
|
+
if (envPath)
|
|
2226
|
+
return envPath;
|
|
2224
2227
|
}
|
|
2225
2228
|
const cwd = process.cwd();
|
|
2226
2229
|
const nearest = findNearestMementosDb(cwd);
|
|
@@ -2264,6 +2267,12 @@ function getDatabase(dbPath) {
|
|
|
2264
2267
|
if (getStorageMode() === "cloud") {
|
|
2265
2268
|
return getCloudDatabase();
|
|
2266
2269
|
}
|
|
2270
|
+
if (process.env["NODE_ENV"] === "test") {
|
|
2271
|
+
const hasExplicitDbPath = DB_PATH_ENV_KEYS.some((key) => process.env[key]?.trim());
|
|
2272
|
+
if (!hasExplicitDbPath) {
|
|
2273
|
+
throw new Error("REFUSING-UNPINNED-TEST-OPEN: a test process tried to open the default local " + `SQLite store (${getDbPath()}) with no explicit dbPath argument and no ` + `${DB_PATH_ENV_KEYS.join("/")} set. Pass an explicit dbPath (e.g. ":memory:" ` + "or a scratch file), or set one of those env keys to a scratch path, before " + "calling getDatabase(). This guard exists because an unpinned test process " + "would otherwise silently read and write the real, shared, on-disk memory " + "store (todos 57b8b8c5).");
|
|
2274
|
+
}
|
|
2275
|
+
}
|
|
2267
2276
|
}
|
|
2268
2277
|
const path = dbPath || getDbPath();
|
|
2269
2278
|
if (_db) {
|
package/dist/server/index.js
CHANGED
|
@@ -655,6 +655,8 @@ function assertUnambiguousStoreEnv() {
|
|
|
655
655
|
}
|
|
656
656
|
function getApiConfig() {
|
|
657
657
|
assertUnambiguousStoreEnv();
|
|
658
|
+
if (firstEnvKey(DB_PATH_ENV_KEYS))
|
|
659
|
+
return null;
|
|
658
660
|
const rawBase = firstEnv(API_URL_ENV_KEYS);
|
|
659
661
|
const apiKey = firstEnv(API_KEY_ENV_KEYS);
|
|
660
662
|
if (!rawBase || !apiKey)
|
|
@@ -1779,9 +1781,10 @@ function migrateGlobalDir() {
|
|
|
1779
1781
|
}
|
|
1780
1782
|
}
|
|
1781
1783
|
function getDbPath2() {
|
|
1782
|
-
const
|
|
1783
|
-
|
|
1784
|
-
|
|
1784
|
+
for (const key of DB_PATH_ENV_KEYS) {
|
|
1785
|
+
const envPath = process.env[key]?.trim();
|
|
1786
|
+
if (envPath)
|
|
1787
|
+
return envPath;
|
|
1785
1788
|
}
|
|
1786
1789
|
const cwd = process.cwd();
|
|
1787
1790
|
const nearest = findNearestMementosDb(cwd);
|
|
@@ -1825,6 +1828,12 @@ function getDatabase(dbPath) {
|
|
|
1825
1828
|
if (getStorageMode() === "cloud") {
|
|
1826
1829
|
return getCloudDatabase();
|
|
1827
1830
|
}
|
|
1831
|
+
if (process.env["NODE_ENV"] === "test") {
|
|
1832
|
+
const hasExplicitDbPath = DB_PATH_ENV_KEYS.some((key) => process.env[key]?.trim());
|
|
1833
|
+
if (!hasExplicitDbPath) {
|
|
1834
|
+
throw new Error("REFUSING-UNPINNED-TEST-OPEN: a test process tried to open the default local " + `SQLite store (${getDbPath2()}) with no explicit dbPath argument and no ` + `${DB_PATH_ENV_KEYS.join("/")} set. Pass an explicit dbPath (e.g. ":memory:" ` + "or a scratch file), or set one of those env keys to a scratch path, before " + "calling getDatabase(). This guard exists because an unpinned test process " + "would otherwise silently read and write the real, shared, on-disk memory " + "store (todos 57b8b8c5).");
|
|
1835
|
+
}
|
|
1836
|
+
}
|
|
1828
1837
|
}
|
|
1829
1838
|
const path = dbPath || getDbPath2();
|
|
1830
1839
|
if (_db) {
|
|
@@ -31,8 +31,6 @@ export interface IsolatedStoreEnvOptions {
|
|
|
31
31
|
*/
|
|
32
32
|
export declare function isolatedStoreEnv(dbPath: string, options?: IsolatedStoreEnvOptions): Record<string, string>;
|
|
33
33
|
export interface StubApiEnvOptions {
|
|
34
|
-
/** Pin the (non-authoritative) local SQLite path too, for belt and braces. */
|
|
35
|
-
dbPath?: string;
|
|
36
34
|
/** Stub bearer token. Never a real credential — the stub does not check it. */
|
|
37
35
|
apiKey?: string;
|
|
38
36
|
}
|
|
@@ -48,6 +46,28 @@ export interface StubApiEnvOptions {
|
|
|
48
46
|
* @param baseUrl the stub's origin, e.g. `http://127.0.0.1:<port>/<mode>`
|
|
49
47
|
*/
|
|
50
48
|
export declare function stubApiEnv(baseUrl: string, options?: StubApiEnvOptions): Record<string, string>;
|
|
49
|
+
/**
|
|
50
|
+
* Build a child env that DOES resolve to the cloud API — the negative case the
|
|
51
|
+
* isolation guards are proved against.
|
|
52
|
+
*
|
|
53
|
+
* This exists because of the 2026-08-03 precedence-1 fix. Before it, a cloud
|
|
54
|
+
* case could be built by taking any env and adding an API url+key, and several
|
|
55
|
+
* tests did exactly that on top of {@link isolatedStoreEnv}. An explicit
|
|
56
|
+
* `MEMENTOS_DB_PATH` now DEFEATS the API selectors (see getApiConfig in
|
|
57
|
+
* src/db/api-mode.ts), so that recipe silently produces a LOCAL backend — which
|
|
58
|
+
* would leave the isolation guards' positive controls unable to observe the bad
|
|
59
|
+
* state they exist to detect, and `assertLocalStoreBackend`'s own self-test
|
|
60
|
+
* unable to fail. Both would still be green.
|
|
61
|
+
*
|
|
62
|
+
* So the DB_PATH keys are removed here explicitly, and that removal is the
|
|
63
|
+
* load-bearing line rather than an afterthought: it is the only way to reach the
|
|
64
|
+
* cloud backend now. They are NOT in STORE_SELECTOR_ENV_KEYS because that set
|
|
65
|
+
* means "moves the store OFF local SQLite", and DB_PATH does the opposite.
|
|
66
|
+
*
|
|
67
|
+
* @param baseUrl point this at a closed loopback port, never a real endpoint
|
|
68
|
+
* @param apiKey never a real credential
|
|
69
|
+
*/
|
|
70
|
+
export declare function cloudSelectingEnv(baseUrl: string, apiKey?: string): Record<string, string>;
|
|
51
71
|
/** LLM provider keys most harnesses blank so no test can make a billed call. */
|
|
52
72
|
export declare const LLM_PROVIDER_ENV_KEYS: readonly ["ANTHROPIC_API_KEY", "OPENAI_API_KEY", "CEREBRAS_API_KEY", "XAI_API_KEY"];
|
|
53
73
|
/** `{ ANTHROPIC_API_KEY: "", ... }` — pass as `extra` to blank LLM providers. */
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"store-isolation.d.ts","sourceRoot":"","sources":["../../src/test-support/store-isolation.ts"],"names":[],"mappings":"AAmDA,OAAO,KAAK,EAAE,kBAAkB,EAAE,MAAM,wBAAwB,CAAC;AAGjE;;;;;;;;GAQG;AACH,eAAO,MAAM,uBAAuB,EAAE,SAAS,MAAM,EAWpD,CAAC;AAEF,qEAAqE;AACrE,eAAO,MAAM,gBAAgB,yDAA0D,CAAC;AAExF,MAAM,WAAW,uBAAuB;IACtC;;;;OAIG;IACH,KAAK,CAAC,EAAE,MAAM,CAAC,MAAM,EAAE,MAAM,CAAC,CAAC;CAChC;AAED;;;;;;;;;GASG;AACH,wBAAgB,gBAAgB,CAC9B,MAAM,EAAE,MAAM,EACd,OAAO,GAAE,uBAA4B,GACpC,MAAM,CAAC,MAAM,EAAE,MAAM,CAAC,CAKxB;AASD,MAAM,WAAW,iBAAiB;IAChC
|
|
1
|
+
{"version":3,"file":"store-isolation.d.ts","sourceRoot":"","sources":["../../src/test-support/store-isolation.ts"],"names":[],"mappings":"AAmDA,OAAO,KAAK,EAAE,kBAAkB,EAAE,MAAM,wBAAwB,CAAC;AAGjE;;;;;;;;GAQG;AACH,eAAO,MAAM,uBAAuB,EAAE,SAAS,MAAM,EAWpD,CAAC;AAEF,qEAAqE;AACrE,eAAO,MAAM,gBAAgB,yDAA0D,CAAC;AAExF,MAAM,WAAW,uBAAuB;IACtC;;;;OAIG;IACH,KAAK,CAAC,EAAE,MAAM,CAAC,MAAM,EAAE,MAAM,CAAC,CAAC;CAChC;AAED;;;;;;;;;GASG;AACH,wBAAgB,gBAAgB,CAC9B,MAAM,EAAE,MAAM,EACd,OAAO,GAAE,uBAA4B,GACpC,MAAM,CAAC,MAAM,EAAE,MAAM,CAAC,CAKxB;AASD,MAAM,WAAW,iBAAiB;IAChC,+EAA+E;IAC/E,MAAM,CAAC,EAAE,MAAM,CAAC;CAUjB;AAED;;;;;;;;;;GAUG;AACH,wBAAgB,UAAU,CAAC,OAAO,EAAE,MAAM,EAAE,OAAO,GAAE,iBAAsB,GAAG,MAAM,CAAC,MAAM,EAAE,MAAM,CAAC,CAQnG;AAED;;;;;;;;;;;;;;;;;;;;GAoBG;AACH,wBAAgB,iBAAiB,CAC/B,OAAO,EAAE,MAAM,EACf,MAAM,SAAmB,GACxB,MAAM,CAAC,MAAM,EAAE,MAAM,CAAC,CAMxB;AAED,gFAAgF;AAChF,eAAO,MAAM,qBAAqB,qFAKxB,CAAC;AAEX,iFAAiF;AACjF,wBAAgB,mBAAm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