@hasna/mementos 0.14.88 → 0.15.2
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 +44 -9
- package/bun.lock +4 -65
- package/dist/cli/commands/info-history.d.ts.map +1 -1
- package/dist/cli/commands/info-stale.d.ts.map +1 -1
- package/dist/cli/commands/io-export.d.ts.map +1 -1
- package/dist/cli/commands/memory-cmd-chain.d.ts.map +1 -1
- package/dist/cli/commands/memory-cmd-crud.d.ts.map +1 -1
- package/dist/cli/commands/memory-cmd-recall.d.ts.map +1 -1
- package/dist/cli/commands/memory-cmd-search.d.ts.map +1 -1
- package/dist/cli/commands/memory-cmd-tail.d.ts.map +1 -1
- package/dist/cli/commands/memory-cmd-view.d.ts.map +1 -1
- package/dist/cli/commands/memory-cmd-when-to-use.d.ts.map +1 -1
- package/dist/cli/commands/storage.d.ts.map +1 -1
- package/dist/cli/commands/system-doctor.d.ts.map +1 -1
- package/dist/cli/commands/system-status.d.ts +43 -0
- package/dist/cli/commands/system-status.d.ts.map +1 -0
- package/dist/cli/commands/system.d.ts.map +1 -1
- package/dist/cli/helpers.d.ts.map +1 -1
- package/dist/cli/index.js +3397 -1954
- package/dist/cli/register-all.d.ts +1 -1
- package/dist/cli/register-all.d.ts.map +1 -1
- package/dist/db/api-mode.d.ts +135 -37
- package/dist/db/api-mode.d.ts.map +1 -1
- package/dist/db/database.d.ts.map +1 -1
- package/dist/db/memories.d.ts.map +1 -1
- package/dist/db/store-backend.d.ts +8 -2
- package/dist/db/store-backend.d.ts.map +1 -1
- package/dist/diagnostics/historical-project-registration-receipt.js +85 -50
- package/dist/generated/storage-kit/backend.d.ts +12 -2
- package/dist/generated/storage-kit/backend.d.ts.map +1 -1
- package/dist/generated/storage-kit/index.d.ts +1 -1
- package/dist/generated/storage-kit/index.d.ts.map +1 -1
- package/dist/generated/storage-kit/migrations.d.ts +21 -0
- package/dist/generated/storage-kit/migrations.d.ts.map +1 -1
- package/dist/generated/storage-kit/pool.d.ts +2 -5
- package/dist/generated/storage-kit/pool.d.ts.map +1 -1
- package/dist/generated/storage-kit/query.d.ts +1 -1
- package/dist/generated/storage-kit/query.d.ts.map +1 -1
- package/dist/index.d.ts +0 -1
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +2811 -1285
- package/dist/lib/config.d.ts.map +1 -1
- package/dist/lib/env.d.ts +10 -0
- package/dist/lib/env.d.ts.map +1 -0
- package/dist/lib/gatherer.d.ts.map +1 -1
- package/dist/lib/local-opt-in.d.ts +114 -0
- package/dist/lib/local-opt-in.d.ts.map +1 -0
- package/dist/lib/paths.d.ts +9 -0
- package/dist/lib/paths.d.ts.map +1 -1
- package/dist/lib/redact.d.ts +70 -10
- package/dist/lib/redact.d.ts.map +1 -1
- package/dist/lib/reflection.d.ts.map +1 -1
- package/dist/mcp/index.d.ts.map +1 -1
- package/dist/mcp/index.js +2856 -1291
- package/dist/project-registration.js +273 -185
- package/dist/sdk/index.d.ts +173 -8
- package/dist/sdk/index.d.ts.map +1 -1
- package/dist/sdk/index.js +953 -12
- package/dist/server/auth.d.ts +2 -0
- package/dist/server/auth.d.ts.map +1 -1
- package/dist/server/helpers.d.ts +21 -7
- package/dist/server/helpers.d.ts.map +1 -1
- package/dist/server/index.d.ts.map +1 -1
- package/dist/server/index.js +2855 -1351
- package/dist/storage.d.ts.map +1 -1
- package/dist/storage.js +78 -129
- package/dist/test-support/store-isolation.d.ts +50 -11
- package/dist/test-support/store-isolation.d.ts.map +1 -1
- package/docker-entrypoint.sh +7 -0
- package/hasna.contract.json +17 -5
- package/package.json +5 -7
- package/postinstall.mjs +52 -1
- package/dashboard/bun.lock +0 -519
- package/dist/cli/brains.d.ts +0 -3
- package/dist/cli/brains.d.ts.map +0 -1
- package/dist/lib/retired-storage-mode.d.ts +0 -11
- package/dist/lib/retired-storage-mode.d.ts.map +0 -1
package/dist/storage.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"stor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`, `${token}_DATABASE_URL`]
|
|
73
73
|
};
|
|
74
74
|
}
|
|
75
|
-
function
|
|
76
|
-
const token = envToken(name);
|
|
77
|
-
return [
|
|
78
|
-
`HASNA_${token}_STORAGE_MODE`,
|
|
79
|
-
`HASNA_${token}_MODE`,
|
|
80
|
-
`${token}_STORAGE_MODE`,
|
|
81
|
-
`${token}_MODE`
|
|
82
|
-
];
|
|
83
|
-
}
|
|
84
|
-
function firstEnv(env, keys) {
|
|
75
|
+
function firstDatabaseUrl(env, keys) {
|
|
85
76
|
for (const key of keys) {
|
|
86
77
|
const value = ownString(env, key)?.trim();
|
|
87
78
|
if (value)
|
|
@@ -89,23 +80,8 @@ function firstEnv(env, keys) {
|
|
|
89
80
|
}
|
|
90
81
|
return null;
|
|
91
82
|
}
|
|
92
|
-
function firstDefinedEnvKey(env, keys) {
|
|
93
|
-
for (const key of keys) {
|
|
94
|
-
if (Object.hasOwn(env, key) && env[key] !== undefined)
|
|
95
|
-
return key;
|
|
96
|
-
}
|
|
97
|
-
return null;
|
|
98
|
-
}
|
|
99
|
-
function assertNoLegacyStorageMode(name, env = process.env) {
|
|
100
|
-
const legacyKey = firstDefinedEnvKey(env, legacyModeKeys(name));
|
|
101
|
-
if (!legacyKey)
|
|
102
|
-
return;
|
|
103
|
-
const canonicalDatabaseUrl = serverDataBackendEnvKeys(name).databaseUrlKeys[0];
|
|
104
|
-
throw new Error(`${legacyKey} was removed. Delete the storage-mode variable; ` + `set ${canonicalDatabaseUrl} to select the postgresql server backend, ` + `or leave it unset for sqlite.`);
|
|
105
|
-
}
|
|
106
83
|
function resolveServerDataBackend(name, env = process.env) {
|
|
107
|
-
|
|
108
|
-
const databaseUrl = firstEnv(env, serverDataBackendEnvKeys(name).databaseUrlKeys);
|
|
84
|
+
const databaseUrl = firstDatabaseUrl(env, serverDataBackendEnvKeys(name).databaseUrlKeys);
|
|
109
85
|
if (!databaseUrl) {
|
|
110
86
|
return {
|
|
111
87
|
backend: "sqlite",
|
|
@@ -122,113 +98,69 @@ function resolveServerDataBackend(name, env = process.env) {
|
|
|
122
98
|
};
|
|
123
99
|
}
|
|
124
100
|
function resolveDatabaseUrl(name, env = process.env) {
|
|
125
|
-
|
|
126
|
-
const hit = firstEnv(env, serverDataBackendEnvKeys(name).databaseUrlKeys);
|
|
127
|
-
return hit?.value ?? null;
|
|
101
|
+
return firstDatabaseUrl(env, serverDataBackendEnvKeys(name).databaseUrlKeys)?.value ?? null;
|
|
128
102
|
}
|
|
129
103
|
var init_backend = () => {};
|
|
130
104
|
|
|
131
|
-
// src/lib/
|
|
132
|
-
|
|
133
|
-
for (const key of keys) {
|
|
134
|
-
if (Object.hasOwn(env, key) && env[key] !== undefined)
|
|
135
|
-
return key;
|
|
136
|
-
}
|
|
137
|
-
return null;
|
|
138
|
-
}
|
|
139
|
-
function assertNoLegacyStorageMode2(env = process.env) {
|
|
140
|
-
const legacyKey = firstDefinedEnvKey2(env, LEGACY_STORAGE_MODE_KEYS);
|
|
141
|
-
if (!legacyKey)
|
|
142
|
-
return;
|
|
143
|
-
throw new Error(`${legacyKey} was removed. Deployment modes no longer exist: delete the storage-mode variable. ` + `The client uses the local SQLite store, or the HTTP API selected by ` + `HASNA_MEMENTOS_API_URL + HASNA_MEMENTOS_API_KEY. ` + `On the server, set HASNA_MEMENTOS_DATABASE_URL to select the postgresql backend, ` + `or leave it unset for sqlite.`);
|
|
144
|
-
}
|
|
145
|
-
var LEGACY_STORAGE_MODE_KEYS;
|
|
146
|
-
var init_retired_storage_mode = __esm(() => {
|
|
147
|
-
LEGACY_STORAGE_MODE_KEYS = [
|
|
148
|
-
"HASNA_MEMENTOS_STORAGE_MODE",
|
|
149
|
-
"HASNA_MEMENTOS_MODE",
|
|
150
|
-
"MEMENTOS_STORAGE_MODE",
|
|
151
|
-
"MEMENTOS_MODE"
|
|
152
|
-
];
|
|
153
|
-
});
|
|
154
|
-
|
|
155
|
-
// ../../node_modules/.bun/@hasna+paths@0.1.0/node_modules/@hasna/paths/dist/index.js
|
|
105
|
+
// src/lib/paths.ts
|
|
106
|
+
import { existsSync } from "fs";
|
|
156
107
|
import { homedir } from "os";
|
|
157
|
-
import { join } from "path";
|
|
158
|
-
|
|
108
|
+
import { join, resolve } from "path";
|
|
109
|
+
import { homedir as pathsResolverHomedir } from "os";
|
|
110
|
+
import { join as pathsResolverJoin } from "path";
|
|
111
|
+
function pathsResolverAssertApp(app) {
|
|
159
112
|
if (typeof app !== "string" || app.length === 0) {
|
|
160
113
|
throw new TypeError("paths: app must be a non-empty string");
|
|
161
114
|
}
|
|
162
|
-
if (!
|
|
115
|
+
if (!PATHS_RESOLVER_APP_SLUG_RE.test(app)) {
|
|
163
116
|
throw new TypeError(`paths: invalid app slug "${app}" \u2014 expected lowercase kebab-case ([a-z0-9]+(-[a-z0-9]+)*)`);
|
|
164
117
|
}
|
|
165
118
|
}
|
|
166
|
-
function
|
|
167
|
-
|
|
168
|
-
}
|
|
169
|
-
|
|
170
|
-
const value = envOf(options)[KIND_ENV[kind]];
|
|
171
|
-
return typeof value === "string" && value.length > 0 ? value : undefined;
|
|
172
|
-
}
|
|
173
|
-
function isMacOS(platform) {
|
|
174
|
-
return platform === "darwin";
|
|
119
|
+
function pathsResolverAssertKind(kind) {
|
|
120
|
+
if (!Object.keys(PATHS_RESOLVER_KIND_ENV).includes(kind)) {
|
|
121
|
+
throw new TypeError(`paths: invalid path kind "${kind}" \u2014 expected one of ${Object.keys(PATHS_RESOLVER_KIND_ENV).join(", ")}`);
|
|
122
|
+
}
|
|
175
123
|
}
|
|
176
|
-
function
|
|
177
|
-
|
|
178
|
-
|
|
124
|
+
function pathsResolverBaseDir(kind, options) {
|
|
125
|
+
pathsResolverAssertKind(kind);
|
|
126
|
+
const env = options.env ?? process.env;
|
|
127
|
+
const override = env[PATHS_RESOLVER_KIND_ENV[kind]];
|
|
128
|
+
if (typeof override === "string" && override.length > 0)
|
|
179
129
|
return override;
|
|
180
|
-
const home = options.home ??
|
|
130
|
+
const home = options.home ?? pathsResolverHomedir();
|
|
181
131
|
const platform = options.platform ?? process.platform;
|
|
182
|
-
if (
|
|
132
|
+
if (platform === "darwin") {
|
|
183
133
|
switch (kind) {
|
|
184
|
-
case "config":
|
|
185
134
|
case "data":
|
|
186
|
-
return
|
|
135
|
+
return pathsResolverJoin(home, "Library", "Application Support", "Hasna");
|
|
187
136
|
case "cache":
|
|
188
|
-
return
|
|
137
|
+
return pathsResolverJoin(home, "Library", "Caches", "Hasna");
|
|
189
138
|
case "state":
|
|
190
|
-
return
|
|
139
|
+
return pathsResolverJoin(home, "Library", "Logs", "Hasna");
|
|
191
140
|
}
|
|
192
141
|
}
|
|
193
142
|
switch (kind) {
|
|
194
|
-
case "config":
|
|
195
|
-
return join(home, ".config", "hasna");
|
|
196
143
|
case "data":
|
|
197
|
-
return
|
|
144
|
+
return pathsResolverJoin(home, ".local", "share", "hasna");
|
|
198
145
|
case "state":
|
|
199
|
-
return
|
|
146
|
+
return pathsResolverJoin(home, ".local", "state", "hasna");
|
|
200
147
|
case "cache":
|
|
201
|
-
return
|
|
148
|
+
return pathsResolverJoin(home, ".cache", "hasna");
|
|
202
149
|
}
|
|
203
150
|
}
|
|
204
|
-
function
|
|
205
|
-
|
|
206
|
-
const appSegment = options.internal === true ?
|
|
207
|
-
return
|
|
151
|
+
function pathsResolverResolve(kind, options) {
|
|
152
|
+
pathsResolverAssertApp(options.app);
|
|
153
|
+
const appSegment = options.internal === true ? pathsResolverJoin("internal", options.app) : options.app;
|
|
154
|
+
return pathsResolverJoin(pathsResolverBaseDir(kind, options), appSegment);
|
|
208
155
|
}
|
|
209
156
|
function dataDir(options) {
|
|
210
|
-
return
|
|
157
|
+
return pathsResolverResolve("data", options);
|
|
211
158
|
}
|
|
212
|
-
var KIND_ENV, APP_SLUG_RE;
|
|
213
|
-
var init_dist = __esm(() => {
|
|
214
|
-
KIND_ENV = {
|
|
215
|
-
config: "HASNA_CONFIG_HOME",
|
|
216
|
-
data: "HASNA_DATA_HOME",
|
|
217
|
-
state: "HASNA_STATE_HOME",
|
|
218
|
-
cache: "HASNA_CACHE_HOME"
|
|
219
|
-
};
|
|
220
|
-
APP_SLUG_RE = /^[a-z0-9]+(?:-[a-z0-9]+)*$/;
|
|
221
|
-
});
|
|
222
|
-
|
|
223
|
-
// src/lib/paths.ts
|
|
224
|
-
import { existsSync } from "fs";
|
|
225
|
-
import { homedir as homedir2 } from "os";
|
|
226
|
-
import { join as join2, resolve } from "path";
|
|
227
159
|
function effectiveHome() {
|
|
228
|
-
return process.env["HOME"] || process.env["USERPROFILE"] ||
|
|
160
|
+
return process.env["HOME"] || process.env["USERPROFILE"] || homedir() || "/tmp";
|
|
229
161
|
}
|
|
230
162
|
function legacyDataRoot() {
|
|
231
|
-
return
|
|
163
|
+
return join(effectiveHome(), ".hasna", "mementos");
|
|
232
164
|
}
|
|
233
165
|
function resolverDataRoot() {
|
|
234
166
|
return dataDir({
|
|
@@ -240,7 +172,7 @@ function adoptResolverDataRoot(resolved, env = process.env) {
|
|
|
240
172
|
const dataOverride = env.HASNA_DATA_HOME;
|
|
241
173
|
if (typeof dataOverride === "string" && dataOverride.trim().length > 0)
|
|
242
174
|
return true;
|
|
243
|
-
return existsSync(
|
|
175
|
+
return existsSync(join(resolved, "mementos.db"));
|
|
244
176
|
}
|
|
245
177
|
function exactDataRoot() {
|
|
246
178
|
for (const key of ["HASNA_MEMENTOS_HOME", "MEMENTOS_HOME"]) {
|
|
@@ -257,14 +189,34 @@ function getDataRoot() {
|
|
|
257
189
|
const resolved = resolverDataRoot();
|
|
258
190
|
return adoptResolverDataRoot(resolved) ? resolve(resolved) : resolve(legacyDataRoot());
|
|
259
191
|
}
|
|
192
|
+
var PATHS_RESOLVER_KIND_ENV, PATHS_RESOLVER_APP_SLUG_RE;
|
|
260
193
|
var init_paths = __esm(() => {
|
|
261
|
-
|
|
194
|
+
PATHS_RESOLVER_KIND_ENV = {
|
|
195
|
+
data: "HASNA_DATA_HOME",
|
|
196
|
+
state: "HASNA_STATE_HOME",
|
|
197
|
+
cache: "HASNA_CACHE_HOME"
|
|
198
|
+
};
|
|
199
|
+
PATHS_RESOLVER_APP_SLUG_RE = /^[a-z0-9]+(?:-[a-z0-9]+)*$/;
|
|
200
|
+
});
|
|
201
|
+
|
|
202
|
+
// src/lib/env.ts
|
|
203
|
+
var alias = (canonical, legacy) => process.env[canonical] ?? process.env[legacy], env;
|
|
204
|
+
var init_env = __esm(() => {
|
|
205
|
+
env = {
|
|
206
|
+
apiKey: () => alias("HASNA_MEMENTOS_API_KEY", "MEMENTOS_API_KEY"),
|
|
207
|
+
defaultScope: () => alias("HASNA_MEMENTOS_DEFAULT_SCOPE", "MEMENTOS_DEFAULT_SCOPE"),
|
|
208
|
+
defaultCategory: () => alias("HASNA_MEMENTOS_DEFAULT_CATEGORY", "MEMENTOS_DEFAULT_CATEGORY"),
|
|
209
|
+
defaultImportance: () => alias("HASNA_MEMENTOS_DEFAULT_IMPORTANCE", "MEMENTOS_DEFAULT_IMPORTANCE"),
|
|
210
|
+
pgsyncQueryTimeoutMs: () => alias("HASNA_MEMENTOS_PGSYNC_QUERY_TIMEOUT_MS", "MEMENTOS_PGSYNC_QUERY_TIMEOUT_MS"),
|
|
211
|
+
reflectProvider: () => alias("HASNA_MEMENTOS_REFLECT_PROVIDER", "MEMENTOS_REFLECT_PROVIDER"),
|
|
212
|
+
reflectModel: () => alias("HASNA_MEMENTOS_REFLECT_MODEL", "MEMENTOS_REFLECT_MODEL")
|
|
213
|
+
};
|
|
262
214
|
});
|
|
263
215
|
|
|
264
216
|
// src/storage.ts
|
|
265
217
|
import { Database } from "bun:sqlite";
|
|
266
218
|
import { existsSync as existsSync2, mkdirSync, readFileSync, writeFileSync } from "fs";
|
|
267
|
-
import { join as
|
|
219
|
+
import { join as join2 } from "path";
|
|
268
220
|
import { fileURLToPath } from "url";
|
|
269
221
|
import { Worker } from "worker_threads";
|
|
270
222
|
import pg from "pg";
|
|
@@ -289,6 +241,7 @@ class SqliteAdapter {
|
|
|
289
241
|
db;
|
|
290
242
|
constructor(path) {
|
|
291
243
|
this.db = new Database(path, { create: true });
|
|
244
|
+
this.db.exec("PRAGMA busy_timeout = 5000");
|
|
292
245
|
this.db.exec("PRAGMA journal_mode = WAL");
|
|
293
246
|
this.db.exec("PRAGMA foreign_keys = ON");
|
|
294
247
|
}
|
|
@@ -539,9 +492,9 @@ function getConfigPath() {
|
|
|
539
492
|
return STORAGE_CONFIG_PATH;
|
|
540
493
|
}
|
|
541
494
|
function getStorageDatabaseEnv() {
|
|
542
|
-
for (const
|
|
543
|
-
if (readEnv(
|
|
544
|
-
return
|
|
495
|
+
for (const env2 of DATABASE_ENV_NAMES) {
|
|
496
|
+
if (readEnv(env2.name))
|
|
497
|
+
return env2;
|
|
545
498
|
}
|
|
546
499
|
return null;
|
|
547
500
|
}
|
|
@@ -551,20 +504,19 @@ function getStorageEnvName(key) {
|
|
|
551
504
|
return readEnv(canonical) || !readEnv(fallback) ? canonical : fallback;
|
|
552
505
|
}
|
|
553
506
|
function getStorageDatabaseUrl() {
|
|
554
|
-
const
|
|
555
|
-
return
|
|
507
|
+
const env2 = getStorageDatabaseEnv();
|
|
508
|
+
return env2 ? readEnv(env2.name) : null;
|
|
556
509
|
}
|
|
557
510
|
function getStorageDatabaseEnvName() {
|
|
558
511
|
return getStorageEnvName("databaseUrl");
|
|
559
512
|
}
|
|
560
|
-
function getStorageBackend(
|
|
561
|
-
return resolveServerDataBackend("mementos",
|
|
513
|
+
function getStorageBackend(env2 = process.env) {
|
|
514
|
+
return resolveServerDataBackend("mementos", env2).backend;
|
|
562
515
|
}
|
|
563
|
-
function getStorageBackendDatabaseUrl(
|
|
564
|
-
return resolveDatabaseUrl("mementos",
|
|
516
|
+
function getStorageBackendDatabaseUrl(env2 = process.env) {
|
|
517
|
+
return resolveDatabaseUrl("mementos", env2);
|
|
565
518
|
}
|
|
566
519
|
function getStorageConfig() {
|
|
567
|
-
assertNoLegacyStorageMode2();
|
|
568
520
|
const fileConfig = readConfigFile();
|
|
569
521
|
const merged = {
|
|
570
522
|
...DEFAULT_STORAGE_CONFIG,
|
|
@@ -651,14 +603,14 @@ function storageEnvStatus(key) {
|
|
|
651
603
|
};
|
|
652
604
|
}
|
|
653
605
|
function postgresBackendStatus(config) {
|
|
654
|
-
const
|
|
655
|
-
const envUrl =
|
|
656
|
-
if (
|
|
606
|
+
const env2 = getStorageDatabaseEnv();
|
|
607
|
+
const envUrl = env2 ? readEnv(env2.name) : null;
|
|
608
|
+
if (env2 && envUrl) {
|
|
657
609
|
const validation = validatePostgresConnectionString(envUrl);
|
|
658
610
|
return {
|
|
659
611
|
configured: validation.ok,
|
|
660
612
|
source: "env",
|
|
661
|
-
env_name:
|
|
613
|
+
env_name: env2.name,
|
|
662
614
|
redacted_url: validation.redacted_url,
|
|
663
615
|
missing: [],
|
|
664
616
|
issues: validation.issues,
|
|
@@ -704,7 +656,6 @@ function getSafeStorageConfigSummary(config = getStorageConfig()) {
|
|
|
704
656
|
};
|
|
705
657
|
}
|
|
706
658
|
function getStorageStatus() {
|
|
707
|
-
assertNoLegacyStorageMode2();
|
|
708
659
|
const config = getStorageConfig();
|
|
709
660
|
const backend = getStorageBackend();
|
|
710
661
|
const postgresRequested = backend === "postgresql";
|
|
@@ -814,14 +765,12 @@ function resolveConfiguredConnectionString(dbName) {
|
|
|
814
765
|
return `postgres://${username}:${encodeURIComponent(password)}@${host}:${port}/${dbName}${sslParam}`;
|
|
815
766
|
}
|
|
816
767
|
function getStorageConnectionString(dbName = "mementos") {
|
|
817
|
-
assertNoLegacyStorageMode2();
|
|
818
768
|
if (!isServerContext()) {
|
|
819
769
|
throw new Error("Refusing to construct an RDS Postgres DSN outside the mementos-serve server. " + "The raw database DSN is NEVER distributed to client machines. " + "Clients must use the HTTP API: set HASNA_MEMENTOS_API_URL and " + "HASNA_MEMENTOS_API_KEY (and unset HASNA_MEMENTOS_DATABASE_URL).");
|
|
820
770
|
}
|
|
821
771
|
return resolveConfiguredConnectionString(dbName);
|
|
822
772
|
}
|
|
823
773
|
function getStorageConnectionStringForOperator(dbName = "mementos") {
|
|
824
|
-
assertNoLegacyStorageMode2();
|
|
825
774
|
return resolveConfiguredConnectionString(dbName);
|
|
826
775
|
}
|
|
827
776
|
function isSyncExcludedTable(table) {
|
|
@@ -992,8 +941,8 @@ CREATE TABLE IF NOT EXISTS _sync_meta (
|
|
|
992
941
|
)`;
|
|
993
942
|
var init_storage = __esm(() => {
|
|
994
943
|
init_backend();
|
|
995
|
-
init_retired_storage_mode();
|
|
996
944
|
init_paths();
|
|
945
|
+
init_env();
|
|
997
946
|
PgSyncPool = class PgSyncPool {
|
|
998
947
|
worker;
|
|
999
948
|
status;
|
|
@@ -1003,7 +952,7 @@ var init_storage = __esm(() => {
|
|
|
1003
952
|
generation = 0;
|
|
1004
953
|
static DATA_BYTES = 128 * 1024 * 1024;
|
|
1005
954
|
static queryTimeoutMs() {
|
|
1006
|
-
const raw =
|
|
955
|
+
const raw = env.pgsyncQueryTimeoutMs()?.trim();
|
|
1007
956
|
const parsed = raw ? Number(raw) : Number.NaN;
|
|
1008
957
|
return Number.isFinite(parsed) && parsed > 0 ? parsed : 60000;
|
|
1009
958
|
}
|
|
@@ -1011,9 +960,9 @@ var init_storage = __esm(() => {
|
|
|
1011
960
|
const ext = import.meta.url.endsWith(".ts") ? ".ts" : ".js";
|
|
1012
961
|
const here = fileURLToPath(new URL(".", import.meta.url));
|
|
1013
962
|
const candidates = [
|
|
1014
|
-
|
|
1015
|
-
|
|
1016
|
-
|
|
963
|
+
join2(here, `pg-sync-worker${ext}`),
|
|
964
|
+
join2(here, "..", `pg-sync-worker${ext}`),
|
|
965
|
+
join2(here, "..", "..", `pg-sync-worker${ext}`)
|
|
1017
966
|
];
|
|
1018
967
|
for (const candidate of candidates) {
|
|
1019
968
|
if (existsSync2(candidate))
|
|
@@ -1119,8 +1068,8 @@ var init_storage = __esm(() => {
|
|
|
1119
1068
|
schedule_minutes: 0
|
|
1120
1069
|
}
|
|
1121
1070
|
};
|
|
1122
|
-
STORAGE_CONFIG_DIR =
|
|
1123
|
-
STORAGE_CONFIG_PATH =
|
|
1071
|
+
STORAGE_CONFIG_DIR = join2(LOCAL_DATA_DIR, "storage");
|
|
1072
|
+
STORAGE_CONFIG_PATH = join2(STORAGE_CONFIG_DIR, "config.json");
|
|
1124
1073
|
DATABASE_ENV_NAMES = [
|
|
1125
1074
|
{ name: MEMENTOS_STORAGE_ENV.databaseUrl, deprecated: false },
|
|
1126
1075
|
{ name: MEMENTOS_STORAGE_FALLBACK_ENV.databaseUrl, deprecated: false }
|
|
@@ -1,21 +1,54 @@
|
|
|
1
1
|
import type { StoreBackendReport } from "../db/store-backend.js";
|
|
2
2
|
/**
|
|
3
|
-
* Every env var that can
|
|
4
|
-
*
|
|
5
|
-
* retyped, so adding a selector in
|
|
6
|
-
* automatically widens what the harnesses neutralize.
|
|
3
|
+
* Every env var that can point this client at a store shared with other
|
|
4
|
+
* people, derived from the resolver's own exported key lists rather than
|
|
5
|
+
* retyped, so adding a selector in @hasna/contracts (or a deliberate tier
|
|
6
|
+
* here) automatically widens what the harnesses neutralize.
|
|
7
7
|
*
|
|
8
|
-
*
|
|
9
|
-
*
|
|
10
|
-
*
|
|
11
|
-
*
|
|
8
|
+
* Blanking them is NO LONGER SUFFICIENT ON ITS OWN, and that is the whole
|
|
9
|
+
* reason the local opt-in below is defaulted on. Since the credential chain
|
|
10
|
+
* moved into @hasna/contracts (hasna/apps#1720) a key can also arrive from the
|
|
11
|
+
* machine's login Keychain or from `~/.hasna/mementos/config/credentials`,
|
|
12
|
+
* neither of which an env dictionary can blank. What makes a fixture
|
|
13
|
+
* physically unable to reach the hosted authority is therefore the pair: these
|
|
14
|
+
* variables deleted, AND the local opt-in, which the resolver is never
|
|
15
|
+
* consulted past — so no Keychain item and no credential file is ever read.
|
|
12
16
|
*
|
|
13
|
-
*
|
|
14
|
-
*
|
|
17
|
+
* The legacy unprefixed `MEMENTOS_*` spellings are the resolver's silent alias
|
|
18
|
+
* fallback for one release; they are scrubbed here for the same reason the
|
|
19
|
+
* canonical names are.
|
|
15
20
|
*/
|
|
16
21
|
export declare const STORE_SELECTOR_ENV_KEYS: readonly string[];
|
|
22
|
+
/**
|
|
23
|
+
* Routing variables that select a store *kind* rather than a shared
|
|
24
|
+
* destination; LOCAL_ONLY entries are pinned rather than scrubbed and exempt
|
|
25
|
+
* from the coverage assertion:
|
|
26
|
+
*
|
|
27
|
+
* - `HASNA_MEMENTOS_LOCAL` / `MEMENTOS_LOCAL` — the explicit unhosted
|
|
28
|
+
* opt-in; local-intent envs default it on, remote-intent envs may set it
|
|
29
|
+
* to "" to exercise the fail-closed arm. It is answered BEFORE the
|
|
30
|
+
* resolver runs, so a scrubbed test environment physically cannot read the
|
|
31
|
+
* Keychain or a credentials file.
|
|
32
|
+
* - the `*_DB_PATH` keys are the precedence-1 explicit local SQLite file.
|
|
33
|
+
* - `HASNA_STATION` pins WHICH Keychain account the resolver asks for — a
|
|
34
|
+
* name no item can exist under, so the Keychain tier is reliably EMPTY on
|
|
35
|
+
* a developer Mac and on CI alike.
|
|
36
|
+
*/
|
|
37
|
+
export declare const LOCAL_ONLY_STORE_ENV_KEYS: readonly string[];
|
|
38
|
+
/**
|
|
39
|
+
* The retired storage-mode variables, from the resolver's own list. The
|
|
40
|
+
* resolver never reads them — they are inert — but a test env DELETES them so
|
|
41
|
+
* a test can never depend on a stale fragment from the host environment. They
|
|
42
|
+
* are listed here so scrub coverage treats them as handled.
|
|
43
|
+
*/
|
|
44
|
+
export declare const REMOVED_STORE_ENV_KEYS: readonly string[];
|
|
45
|
+
/**
|
|
46
|
+
* The Keychain account a test environment pins, chosen so that no item can
|
|
47
|
+
* exist under it (see LOCAL_ONLY_STORE_ENV_KEYS).
|
|
48
|
+
*/
|
|
49
|
+
export declare const MEMENTOS_TEST_KEYCHAIN_ACCOUNT = "mementos-test-fixture-no-such-station";
|
|
17
50
|
/** The two env vars that point the CLI at a specific SQLite file. */
|
|
18
|
-
export declare const DB_PATH_ENV_KEYS: readonly [
|
|
51
|
+
export declare const DB_PATH_ENV_KEYS: readonly string[];
|
|
19
52
|
export interface IsolatedStoreEnvOptions {
|
|
20
53
|
/**
|
|
21
54
|
* Extra vars to set in the child, applied last. Harnesses use this to blank
|
|
@@ -73,6 +106,12 @@ export declare function stubApiEnv(baseUrl: string, options?: StubApiEnvOptions)
|
|
|
73
106
|
* @param apiKey never a real credential
|
|
74
107
|
*/
|
|
75
108
|
export declare function cloudSelectingEnv(baseUrl: string, apiKey?: string): Record<string, string>;
|
|
109
|
+
/**
|
|
110
|
+
* The ambient env with the local-intent defaults applied ON TOP of the scrub
|
|
111
|
+
* (used by the `bun test` preload and by in-process suites that must be able
|
|
112
|
+
* to reach the hosted arm deliberately).
|
|
113
|
+
*/
|
|
114
|
+
export declare function localMementosTestEnv(extra?: Record<string, string>): Record<string, string>;
|
|
76
115
|
/** LLM provider keys most harnesses blank so no test can make a billed call. */
|
|
77
116
|
export declare const LLM_PROVIDER_ENV_KEYS: readonly ["ANTHROPIC_API_KEY", "OPENAI_API_KEY", "CEREBRAS_API_KEY", "XAI_API_KEY"];
|
|
78
117
|
/** `{ 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":"
|
|
1
|
+
{"version":3,"file":"store-isolation.d.ts","sourceRoot":"","sources":["../../src/test-support/store-isolation.ts"],"names":[],"mappings":"AA+DA,OAAO,KAAK,EAAE,kBAAkB,EAAE,MAAM,wBAAwB,CAAC;AASjE;;;;;;;;;;;;;;;;;;GAkBG;AACH,eAAO,MAAM,uBAAuB,EAAE,SAAS,MAAM,EAUpD,CAAC;AAEF;;;;;;;;;;;;;;GAcG;AACH,eAAO,MAAM,yBAAyB,EAAE,SAAS,MAAM,EAKtD,CAAC;AAEF;;;;;GAKG;AACH,eAAO,MAA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AE,MAAM,GACtB,OAAO,CAAC,kBAAkB,CAAC,CAuD7B;AAED;;;;;;;;GAQG;AACH,wBAAgB,sBAAsB,CAAC,MAAM,EAAE,MAAM,EAAE,OAAO,SAA0B,GAAG,IAAI,CAQ9F"}
|
package/docker-entrypoint.sh
CHANGED
|
@@ -32,10 +32,17 @@ esac
|
|
|
32
32
|
export HASNA_MEMENTOS_API_SIGNING_KEY="${HASNA_MEMENTOS_API_SIGNING_KEY:-${API_KEY_SIGNING_SECRET}}"
|
|
33
33
|
|
|
34
34
|
# Map published bin names to their dist entrypoints.
|
|
35
|
+
# mementos-deploy is the deploy-lane marker command: the deploy workflow
|
|
36
|
+
# (deploy-mementos.yml) registers every managed task definition with
|
|
37
|
+
# command=["mementos-deploy"], and preflight verifies the stable baseline by
|
|
38
|
+
# that marker. It runs the web server exactly like mementos-serve — without
|
|
39
|
+
# this mapping the deployed task would fall through to the fallback branch and
|
|
40
|
+
# exec a binary named mementos-deploy that does not exist (O15-05020).
|
|
35
41
|
cmd="${1:-mementos-serve}"
|
|
36
42
|
[ "$#" -gt 0 ] && shift || true
|
|
37
43
|
case "$cmd" in
|
|
38
44
|
mementos-serve) set -- bun /app/dist/server/index.js "$@" ;;
|
|
45
|
+
mementos-deploy) set -- bun /app/dist/server/index.js "$@" ;;
|
|
39
46
|
mementos-mcp) set -- bun /app/dist/mcp/index.js "$@" ;;
|
|
40
47
|
mementos) set -- bun /app/dist/cli/index.js "$@" ;;
|
|
41
48
|
bun|/*) set -- "$cmd" "$@" ;;
|
package/hasna.contract.json
CHANGED
|
@@ -4,8 +4,8 @@
|
|
|
4
4
|
"name": "mementos",
|
|
5
5
|
"class": "cli-with-store",
|
|
6
6
|
"contractVersion": "v1",
|
|
7
|
-
"kitVersion": "0.
|
|
8
|
-
"description": "Universal memory system for AI agents — CLI, MCP server, REST API, and TypeScript SDK over one SQLite or PostgreSQL store.
|
|
7
|
+
"kitVersion": "1.0.2",
|
|
8
|
+
"description": "Universal memory system for AI agents — CLI, MCP server, REST API, and TypeScript SDK over one SQLite or PostgreSQL store. Hosted clients (CLI, MCP server, ./sdk) resolve their credential and authority through the @hasna/contracts client chain, fresh per call; the on-box SQLite store is reachable only by the explicit local opt-ins (HASNA_MEMENTOS_DB_PATH / HASNA_MEMENTOS_LOCAL). mementos-serve reads PostgreSQL selected by HASNA_MEMENTOS_DATABASE_URL. The data backend is the only runtime switch; retired storage-mode variables are inert.",
|
|
9
9
|
"bins": [
|
|
10
10
|
"mementos",
|
|
11
11
|
"mementos-mcp",
|
|
@@ -21,9 +21,21 @@
|
|
|
21
21
|
"status": "supported",
|
|
22
22
|
"bin": "mementos-serve",
|
|
23
23
|
"authMode": "api-key",
|
|
24
|
-
"health": {
|
|
25
|
-
|
|
26
|
-
|
|
24
|
+
"health": {
|
|
25
|
+
"method": "GET",
|
|
26
|
+
"path": "/health",
|
|
27
|
+
"public": true
|
|
28
|
+
},
|
|
29
|
+
"readiness": {
|
|
30
|
+
"method": "GET",
|
|
31
|
+
"path": "/ready",
|
|
32
|
+
"public": true
|
|
33
|
+
},
|
|
34
|
+
"version": {
|
|
35
|
+
"method": "GET",
|
|
36
|
+
"path": "/version",
|
|
37
|
+
"public": true
|
|
38
|
+
},
|
|
27
39
|
"apiBasePath": "/v1",
|
|
28
40
|
"openApiPath": "/v1/openapi.json"
|
|
29
41
|
},
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@hasna/mementos",
|
|
3
|
-
"version": "0.
|
|
3
|
+
"version": "0.15.2",
|
|
4
4
|
"description": "Universal memory system for AI agents - CLI + MCP server + library API",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"main": "dist/index.js",
|
|
@@ -30,7 +30,6 @@
|
|
|
30
30
|
},
|
|
31
31
|
"files": [
|
|
32
32
|
"dist",
|
|
33
|
-
"dashboard/dist",
|
|
34
33
|
"Dockerfile.package",
|
|
35
34
|
"docker-entrypoint.sh",
|
|
36
35
|
"bun.lock",
|
|
@@ -41,7 +40,7 @@
|
|
|
41
40
|
],
|
|
42
41
|
"scripts": {
|
|
43
42
|
"clean": "rm -rf dist",
|
|
44
|
-
"build": "bun run clean && bun build src/cli/index.tsx --outdir dist/cli --target bun --external ink --external react --external chalk --external @modelcontextprotocol/sdk --external @hasna/contracts --external @hasna/contracts
|
|
43
|
+
"build": "bun run clean && bun build src/cli/index.tsx --outdir dist/cli --target bun --external ink --external react --external chalk --external @modelcontextprotocol/sdk --external @hasna/contracts --external @hasna/contracts/* --external pg && bun build src/mcp/index.ts --outdir dist/mcp --target bun --external @modelcontextprotocol/sdk --external @hasna/contracts --external @hasna/contracts/* --external pg && bun build src/server/index.ts --outdir dist/server --target bun --external @hasna/contracts --external @hasna/contracts/* --external pg && bun build src/index.ts src/storage.ts src/pg-sync-worker.ts src/project-registration.ts --outdir dist --target bun --external @hasna/contracts --external @hasna/contracts/* --external pg && bun build src/diagnostics/historical-project-registration-receipt.ts --outdir dist/diagnostics --target bun --external pg && bun build src/sdk/index.ts --outdir dist/sdk --target bun && tsc --emitDeclarationOnly --outDir dist",
|
|
45
44
|
"prepare": "bun run build:js",
|
|
46
45
|
"prepack": "bun run build && bun run scan-artifact",
|
|
47
46
|
"prepublishOnly": "bun run typecheck && bun run test && bun run contracts:conformance && contracts no-cloud-scan .",
|
|
@@ -56,7 +55,7 @@
|
|
|
56
55
|
"dev:mcp": "bun run src/mcp/index.ts",
|
|
57
56
|
"dev:serve": "bun run src/server/index.ts",
|
|
58
57
|
"postinstall": "node postinstall.mjs",
|
|
59
|
-
"build:js": "bun run clean && bun build src/cli/index.tsx --outdir dist/cli --target bun --external ink --external react --external chalk --external @modelcontextprotocol/sdk --external @hasna/contracts --external @hasna/contracts
|
|
58
|
+
"build:js": "bun run clean && bun build src/cli/index.tsx --outdir dist/cli --target bun --external ink --external react --external chalk --external @modelcontextprotocol/sdk --external @hasna/contracts --external @hasna/contracts/* --external pg && bun build src/mcp/index.ts --outdir dist/mcp --target bun --external @modelcontextprotocol/sdk --external @hasna/contracts --external @hasna/contracts/* --external pg && bun build src/server/index.ts --outdir dist/server --target bun --external @hasna/contracts --external @hasna/contracts/* --external pg && bun build src/index.ts src/storage.ts src/pg-sync-worker.ts src/project-registration.ts --outdir dist --target bun --external @hasna/contracts --external @hasna/contracts/* --external pg && bun build src/diagnostics/historical-project-registration-receipt.ts --outdir dist/diagnostics --target bun --external pg && bun build src/sdk/index.ts --outdir dist/sdk --target bun && tsc --emitDeclarationOnly --outDir dist"
|
|
60
59
|
},
|
|
61
60
|
"keywords": [
|
|
62
61
|
"memory",
|
|
@@ -91,9 +90,8 @@
|
|
|
91
90
|
"@ai-sdk/anthropic": "^3.0.82",
|
|
92
91
|
"@ai-sdk/openai": "^3.0.69",
|
|
93
92
|
"@ai-sdk/openai-compatible": "^2.0.48",
|
|
94
|
-
"@hasna/contracts": "0.
|
|
93
|
+
"@hasna/contracts": "1.0.2",
|
|
95
94
|
"@hasna/events": "0.1.6",
|
|
96
|
-
"@hasna/paths": "0.1.0",
|
|
97
95
|
"@modelcontextprotocol/sdk": "^1.12.1",
|
|
98
96
|
"ai": "^6.0.199",
|
|
99
97
|
"chalk": "^5.4.1",
|
|
@@ -106,7 +104,7 @@
|
|
|
106
104
|
"zod": "^3.24.2"
|
|
107
105
|
},
|
|
108
106
|
"devDependencies": {
|
|
109
|
-
"@types/bun": "
|
|
107
|
+
"@types/bun": "1.3.14",
|
|
110
108
|
"bun-types": "1.3.14",
|
|
111
109
|
"@types/pg": "^8.11.11",
|
|
112
110
|
"@types/react": "^18.3.18",
|