@hasna/mementos 0.14.68 → 0.14.70
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 +155 -73
- package/dist/cli/__fixtures__/clean-fallback-stub-server.d.ts +2 -0
- package/dist/cli/__fixtures__/clean-fallback-stub-server.d.ts.map +1 -0
- package/dist/cli/commands/io-clean.d.ts.map +1 -1
- package/dist/cli/commands/memory-cmd-crud.d.ts.map +1 -1
- package/dist/cli/commands/storage.d.ts.map +1 -1
- package/dist/cli/commands/system-mcp.d.ts.map +1 -1
- package/dist/cli/commands/system-profile.d.ts.map +1 -1
- package/dist/cli/global-options.d.ts +27 -0
- package/dist/cli/global-options.d.ts.map +1 -0
- package/dist/cli/index.js +699 -301
- package/dist/cli/register-all.d.ts +17 -0
- package/dist/cli/register-all.d.ts.map +1 -0
- package/dist/cli/startup-side-effects.d.ts +9 -0
- package/dist/cli/startup-side-effects.d.ts.map +1 -0
- package/dist/db/__fixtures__/fail-closed-stub-server.d.ts +2 -0
- package/dist/db/__fixtures__/fail-closed-stub-server.d.ts.map +1 -0
- package/dist/db/agents.d.ts.map +1 -1
- package/dist/db/api-mode.d.ts +70 -2
- package/dist/db/api-mode.d.ts.map +1 -1
- package/dist/db/database.d.ts +16 -0
- package/dist/db/database.d.ts.map +1 -1
- package/dist/db/locks.d.ts.map +1 -1
- package/dist/db/memories.d.ts +24 -6
- package/dist/db/memories.d.ts.map +1 -1
- package/dist/db/migrations.d.ts +1 -0
- package/dist/db/migrations.d.ts.map +1 -1
- package/dist/db/pg-migrations.d.ts.map +1 -1
- package/dist/db/session-jobs.d.ts.map +1 -1
- package/dist/db/store-backend.d.ts +33 -0
- package/dist/db/store-backend.d.ts.map +1 -0
- package/dist/index.js +196 -62
- package/dist/lib/auto-memory-queue.d.ts +2 -0
- package/dist/lib/auto-memory-queue.d.ts.map +1 -1
- package/dist/lib/auto-memory.d.ts +1 -0
- package/dist/lib/auto-memory.d.ts.map +1 -1
- package/dist/lib/built-in-hooks.d.ts.map +1 -1
- package/dist/lib/enum-validation.d.ts +20 -0
- package/dist/lib/enum-validation.d.ts.map +1 -0
- package/dist/lib/gdpr.d.ts.map +1 -1
- package/dist/mcp/index.d.ts.map +1 -1
- package/dist/mcp/index.js +301 -78
- package/dist/mcp/tools/system-tools-memory-admin.d.ts.map +1 -1
- package/dist/server/helpers.d.ts +11 -0
- package/dist/server/helpers.d.ts.map +1 -1
- package/dist/server/index.d.ts.map +1 -1
- package/dist/server/index.js +304 -72
- package/dist/storage.d.ts +11 -2
- package/dist/storage.d.ts.map +1 -1
- package/dist/storage.js +42 -11
- package/dist/test-support/preload-local-store.d.ts +2 -0
- package/dist/test-support/preload-local-store.d.ts.map +1 -0
- package/dist/test-support/store-isolation.d.ts +83 -0
- package/dist/test-support/store-isolation.d.ts.map +1 -0
- package/dist/types/index.d.ts +8 -4
- package/dist/types/index.d.ts.map +1 -1
- package/package.json +1 -1
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
import type { Command } from "commander";
|
|
2
|
+
/**
|
|
3
|
+
* Attach EVERY command group to `program`, in the order the CLI presents them.
|
|
4
|
+
*
|
|
5
|
+
* This is the single registration list. `index.tsx` calls it to build the real
|
|
6
|
+
* CLI, and `global-options.test.ts` calls it to walk the real option tables — so
|
|
7
|
+
* the structural short-flag guard cannot silently check a smaller tree than the
|
|
8
|
+
* one that ships.
|
|
9
|
+
*
|
|
10
|
+
* That drift was real: the guard originally re-listed 11 groups by hand while
|
|
11
|
+
* the CLI wired 15 sources, leaving `init`, `project-panel`, `brains` and the
|
|
12
|
+
* `@hasna/events` groups (`events`, `webhooks`) unwalked. Seven live `-j`
|
|
13
|
+
* collisions sat in that blind spot while the guard reported clean. Adding a
|
|
14
|
+
* command group here is now the only step required for it to be covered.
|
|
15
|
+
*/
|
|
16
|
+
export declare function registerAllCommands(program: Command): Command;
|
|
17
|
+
//# sourceMappingURL=register-all.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"register-all.d.ts","sourceRoot":"","sources":["../../src/cli/register-all.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,OAAO,EAAE,MAAM,WAAW,CAAC;AAkBzC;;;;;;;;;;;;;GAaG;AACH,wBAAgB,mBAAmB,CAAC,OAAO,EAAE,OAAO,GAAG,OAAO,CAiB7D"}
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
import type { Command } from "commander";
|
|
2
|
+
/**
|
|
3
|
+
* Mark a command as having no startup database access, and return it so it can
|
|
4
|
+
* be used inline at the end of a builder chain.
|
|
5
|
+
*/
|
|
6
|
+
export declare function withoutStartupDbAccess<T extends Command>(command: T): T;
|
|
7
|
+
/** Whether the command about to run has opted out of the startup DB access. */
|
|
8
|
+
export declare function skipsStartupDbAccess(command: Command | undefined): boolean;
|
|
9
|
+
//# sourceMappingURL=startup-side-effects.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"startup-side-effects.d.ts","sourceRoot":"","sources":["../../src/cli/startup-side-effects.ts"],"names":[],"mappings":"AAsBA,OAAO,KAAK,EAAE,OAAO,EAAE,MAAM,WAAW,CAAC;AAIzC;;;GAGG;AACH,wBAAgB,sBAAsB,CAAC,CAAC,SAAS,OAAO,EAAE,OAAO,EAAE,CAAC,GAAG,CAAC,CAGvE;AAED,+EAA+E;AAC/E,wBAAgB,oBAAoB,CAAC,OAAO,EAAE,OAAO,GAAG,SAAS,GAAG,OAAO,CAE1E"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"fail-closed-stub-server.d.ts","sourceRoot":"","sources":["../../../src/db/__fixtures__/fail-closed-stub-server.ts"],"names":[],"mappings":"AAkBA,QAAA,MAAM,MAAM,uBAyBV,CAAC"}
|
package/dist/db/agents.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"agents.d.ts","sourceRoot":"","sources":["../../src/db/agents.ts"],"names":[],"m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,CAa7E;AAED,wBAAgB,WAAW,CACzB,EAAE,EAAE,MAAM,EACV,OAAO,EAAE;IAAE,IAAI,CAAC,EAAE,MAAM,CAAC;IAAC,WAAW,CAAC,EAAE,MAAM,CAAC;IAAC,IAAI,CAAC,EAAE,MAAM,CAAC;IAAC,QAAQ,CAAC,EAAE,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,CAAC;IAAC,iBAAiB,CAAC,EAAE,MAAM,GAAG,IAAI,CAAA;CAAE,EACtI,EAAE,CAAC,EAAE,QAAQ,GACZ,KAAK,GAAG,IAAI,CAsDd"}
|
package/dist/db/api-mode.d.ts
CHANGED
|
@@ -2,7 +2,56 @@ export interface ApiConfig {
|
|
|
2
2
|
baseUrl: string;
|
|
3
3
|
apiKey: string;
|
|
4
4
|
}
|
|
5
|
+
export declare const API_URL_ENV_KEYS: readonly ["HASNA_MEMENTOS_API_URL", "MEMENTOS_API_URL"];
|
|
6
|
+
export declare const API_KEY_ENV_KEYS: readonly ["HASNA_MEMENTOS_API_KEY", "MEMENTOS_API_KEY"];
|
|
7
|
+
export declare const DATABASE_URL_ENV_KEYS: readonly ["HASNA_MEMENTOS_DATABASE_URL", "MEMENTOS_DATABASE_URL"];
|
|
8
|
+
/**
|
|
9
|
+
* Which env keys currently select API mode, by name only — never the values.
|
|
10
|
+
* Used by the operator-facing mode report so a human can see *why* the client
|
|
11
|
+
* is pointed at the cloud without reading source or echoing a credential.
|
|
12
|
+
*/
|
|
13
|
+
export declare function getApiModeEnvSources(): {
|
|
14
|
+
urlKey: string | null;
|
|
15
|
+
keyKey: string | null;
|
|
16
|
+
databaseUrlKey: string | null;
|
|
17
|
+
};
|
|
18
|
+
/**
|
|
19
|
+
* Escape hatch for a test that genuinely must reach a non-loopback endpoint.
|
|
20
|
+
* Opt-in by design: the default has to be safe, because the failure it prevents
|
|
21
|
+
* is silent and lands in a shared store.
|
|
22
|
+
*/
|
|
23
|
+
export declare const ALLOW_REMOTE_API_IN_TESTS_ENV = "MEMENTOS_ALLOW_REMOTE_API_IN_TESTS";
|
|
5
24
|
/** Resolve the API client config from env, or `null` when not configured. */
|
|
25
|
+
/** The env keys that explicitly select the local SQLite store. */
|
|
26
|
+
export declare const DB_PATH_ENV_KEYS: readonly ["HASNA_MEMENTOS_DB_PATH", "MEMENTOS_DB_PATH"];
|
|
27
|
+
/** Raised when the environment does not unambiguously select one store. */
|
|
28
|
+
export declare class MementosStoreConfigError extends Error {
|
|
29
|
+
readonly code = "MEMENTOS_STORE_CONFIG";
|
|
30
|
+
constructor(message: string);
|
|
31
|
+
}
|
|
32
|
+
/**
|
|
33
|
+
* Throw unless the environment unambiguously selects one store.
|
|
34
|
+
*
|
|
35
|
+
* AMBIGUOUS CONFIGURATION IS AN ERROR, NOT A DEFAULT. Half an API configuration
|
|
36
|
+
* used to resolve to `null`, which every caller read as "local SQLite" — so an
|
|
37
|
+
* operator whose API key failed to load silently got a different, usually stale,
|
|
38
|
+
* dataset with no error and no flag. From the caller's side that is
|
|
39
|
+
* indistinguishable from a store that is working.
|
|
40
|
+
*
|
|
41
|
+
* Precedence, highest first:
|
|
42
|
+
* 1. An explicit SQLite path (`HASNA_MEMENTOS_DB_PATH` / `MEMENTOS_DB_PATH`) is
|
|
43
|
+
* the narrowest, most specific signal and selects LOCAL, so local dev,
|
|
44
|
+
* tooling and import/export keep working when a stray credential is exported
|
|
45
|
+
* globally.
|
|
46
|
+
* 2. A client DSN present disables API mode. Unchanged here, and tracked
|
|
47
|
+
* separately — a DSN on a client is forbidden and handled in database.ts.
|
|
48
|
+
* 3. Both API URL and API key present -> API mode.
|
|
49
|
+
* 4. Exactly ONE of them present -> ERROR naming the missing variable.
|
|
50
|
+
* 5. Neither present -> LOCAL. The documented single-operator default.
|
|
51
|
+
*
|
|
52
|
+
* Never reads, logs, or embeds a credential value — only variable NAMES.
|
|
53
|
+
*/
|
|
54
|
+
export declare function assertUnambiguousStoreEnv(): void;
|
|
6
55
|
export declare function getApiConfig(): ApiConfig | null;
|
|
7
56
|
/**
|
|
8
57
|
* True when the client should route memory operations to the cloud API.
|
|
@@ -15,8 +64,27 @@ export declare class ApiRequestError extends Error {
|
|
|
15
64
|
readonly body: string;
|
|
16
65
|
constructor(message: string, status: number, body: string);
|
|
17
66
|
}
|
|
18
|
-
|
|
19
|
-
|
|
67
|
+
export interface ApiJsonOptions {
|
|
68
|
+
/**
|
|
69
|
+
* Treat `404` as a normal outcome and return `{status: 404, data: undefined}`
|
|
70
|
+
* instead of throwing. ONLY for callers where "absent" is a real answer —
|
|
71
|
+
* a GET of one record by id, a DELETE that tolerates an already-gone row, or
|
|
72
|
+
* a call that has an explicit fallback for a route an older server image does
|
|
73
|
+
* not serve yet (see `runCleanupViaApi`).
|
|
74
|
+
*
|
|
75
|
+
* It must never be set on a create/upsert path. A 404 there means the route
|
|
76
|
+
* did not exist on the server (client/server version skew, wrong base URL),
|
|
77
|
+
* so nothing was written; returning success-shaped data made the CLI print
|
|
78
|
+
* "Saved:" and exit 0 having persisted nothing. Default is fail-closed.
|
|
79
|
+
*/
|
|
80
|
+
allow404?: boolean;
|
|
81
|
+
}
|
|
82
|
+
/**
|
|
83
|
+
* Authed JSON request. Throws {@link ApiRequestError} on every non-2xx,
|
|
84
|
+
* including 404, unless the caller opts into 404 pass-through via
|
|
85
|
+
* {@link ApiJsonOptions.allow404}.
|
|
86
|
+
*/
|
|
87
|
+
export declare function apiJson<T = unknown>(method: string, path: string, body?: unknown, options?: ApiJsonOptions): {
|
|
20
88
|
status: number;
|
|
21
89
|
data: T;
|
|
22
90
|
};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"api-mode.d.ts","sourceRoot":"","sources":["../../src/db/api-mode.ts"],"names":[],"mappings":"
|
|
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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iB7B;AAED,8EAA8E;AAC9E,wBAAgB,OAAO,CAAC,MAAM,EAAE,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,GAAG,MAAM,CAe/D"}
|
package/dist/db/database.d.ts
CHANGED
|
@@ -6,5 +6,21 @@ export declare function resetDatabase(): void;
|
|
|
6
6
|
export declare function now(): string;
|
|
7
7
|
export declare function uuid(): string;
|
|
8
8
|
export declare function shortUuid(): string;
|
|
9
|
+
/**
|
|
10
|
+
* Escape the SQL `LIKE` metacharacters so a caller-supplied id prefix is matched
|
|
11
|
+
* LITERALLY rather than as a pattern.
|
|
12
|
+
*
|
|
13
|
+
* `\` is replaced FIRST, or the backslashes this function itself introduces
|
|
14
|
+
* would be escaped a second time and the pattern would match nothing.
|
|
15
|
+
*
|
|
16
|
+
* Escaping is the right remedy here rather than rejecting any prefix outside the
|
|
17
|
+
* UUID charset `[0-9a-f-]`, because the id space is not UUID-only in practice:
|
|
18
|
+
* `bulkUpsertMemories` writes a caller-supplied `id` verbatim and validates no
|
|
19
|
+
* charset, so an imported row can legitimately carry `_` or `%` in its id. A
|
|
20
|
+
* charset rejection would make exactly those rows unaddressable by prefix, which
|
|
21
|
+
* trades a wrong-row deletion for a silent inability to reach a real row.
|
|
22
|
+
* Escaping fixes the injection at the root while keeping every id addressable.
|
|
23
|
+
*/
|
|
24
|
+
export declare function escapeLikePrefix(s: string): string;
|
|
9
25
|
export declare function resolvePartialId(db: Database, table: string, partialId: string): string | null;
|
|
10
26
|
//# sourceMappingURL=database.d.ts.map
|
|
@@ -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,CAoBlC;AAoDD,wBAAgB,WAAW,CAAC,MAAM,CAAC,EAAE,MAAM,GAAG,QAAQ,CA4DrD;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,wBAAgB,gBAAgB,CAC9B,EAAE,EAAE,QAAQ,EACZ,KAAK,EAAE,MAAM,EACb,SAAS,EAAE,MAAM,GAChB,MAAM,GAAG,IAAI,
|
|
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,CAoBlC;AAoDD,wBAAgB,WAAW,CAAC,MAAM,CAAC,EAAE,MAAM,GAAG,QAAQ,CA4DrD;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"}
|
package/dist/db/locks.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"locks.d.ts","sourceRoot":"","sources":["../../src/db/locks.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,aAAa,IAAI,QAAQ,EAAE,MAAM,eAAe,CAAC;AAI1D,MAAM,MAAM,YAAY,GAAG,SAAS,GAAG,QAAQ,GAAG,QAAQ,GAAG,OAAO,GA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AM,CAAC;IACjB,SAAS,EAAE,MAAM,CAAC;CACnB;AAED;;GAEG;AACH,wBAAgB,yBAAyB,CAAC,EAAE,CAAC,EAAE,QAAQ,GAAG,eAAe,EAAE,CAS1E;AAED,wBAAgB,iBAAiB,CAAC,EAAE,CAAC,EAAE,QAAQ,GAAG,MAAM,CAQvD"}
|
package/dist/db/memories.d.ts
CHANGED
|
@@ -4,7 +4,15 @@ export declare function parseMemoryRow(row: Record<string, unknown>): Memory;
|
|
|
4
4
|
export declare function createMemory(input: CreateMemoryInput, dedupeMode?: DedupeMode, db?: Database): Memory;
|
|
5
5
|
export interface BulkUpsertResult {
|
|
6
6
|
inserted: number;
|
|
7
|
+
/** Rows the store already had (id or unique-key conflict) — a benign no-op. */
|
|
7
8
|
skipped: number;
|
|
9
|
+
/**
|
|
10
|
+
* Rows the store REFUSED (bad enum, failed CHECK/FK, missing key). These did
|
|
11
|
+
* NOT persist. Kept separate from `skipped` so a caller can never read a
|
|
12
|
+
* dropped row as an idempotent no-op; every rejection also has a line in
|
|
13
|
+
* `errors`. `inserted + skipped + rejected === total`.
|
|
14
|
+
*/
|
|
15
|
+
rejected: number;
|
|
8
16
|
errors: string[];
|
|
9
17
|
total: number;
|
|
10
18
|
}
|
|
@@ -18,12 +26,22 @@ export interface BulkUpsertResult {
|
|
|
18
26
|
* - does NOT dedupe by key/scope/agent and does NOT fire hooks / entity
|
|
19
27
|
* extraction / embedding work (those run asynchronously elsewhere).
|
|
20
28
|
*
|
|
21
|
-
* Idempotency is by
|
|
22
|
-
* `ON CONFLICT DO NOTHING
|
|
23
|
-
*
|
|
24
|
-
*
|
|
25
|
-
*
|
|
26
|
-
*
|
|
29
|
+
* Idempotency is by conflict, not by suppression: the statement carries an
|
|
30
|
+
* explicit bare `ON CONFLICT DO NOTHING`, which SQLite and Postgres both read
|
|
31
|
+
* as "ignore a uniqueness conflict (primary-key `id` or the unique key index)".
|
|
32
|
+
* A row already present is therefore left untouched and re-runs never create
|
|
33
|
+
* duplicates. This is the cross-machine → cloud backfill path for the fleet
|
|
34
|
+
* self-host cutover: a machine's local memories are shipped to the cloud store
|
|
35
|
+
* verbatim without mutating rows that are already present.
|
|
36
|
+
*
|
|
37
|
+
* It deliberately does NOT use `INSERT OR IGNORE`: on SQLite that swallows
|
|
38
|
+
* *every* constraint failure, so a row refused by the `category`/`scope`/
|
|
39
|
+
* `source`/`status` CHECK vanished with `changes === 0` and was counted as an
|
|
40
|
+
* idempotent `skipped` — a cloud write that did not persist reporting success.
|
|
41
|
+
* With a bare `ON CONFLICT DO NOTHING` a CHECK/FK/NOT NULL violation still
|
|
42
|
+
* throws into the catch below and lands in `rejected` + `errors`. Enum values
|
|
43
|
+
* are additionally pre-validated per row so the reason names the field and the
|
|
44
|
+
* accepted set instead of quoting raw constraint SQL.
|
|
27
45
|
*
|
|
28
46
|
* FK-referenced agent/project/session/machine rows are stubbed via
|
|
29
47
|
* {@link ensureMemoryReferences} so cross-machine authorship ids never fail the
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"memories.d.ts","sourceRoot":"","sources":["../../src/db/memories.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,aAAa,IAAI,QAAQ,EAAE,MAAM,eAAe,CAAC;AAE1D,OAAO,KAAK,EACV,iBAAiB,EACjB,UAAU,EACV,MAAM,EACN,YAAY,EACZ,aAAa,EACb,iBAAiB,EAClB,MAAM,mBAAmB,CAAC;
|
|
1
|
+
{"version":3,"file":"memories.d.ts","sourceRoot":"","sources":["../../src/db/memories.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,aAAa,IAAI,QAAQ,EAAE,MAAM,eAAe,CAAC;AAE1D,OAAO,KAAK,EACV,iBAAiB,EACjB,UAAU,EACV,MAAM,EACN,YAAY,EACZ,aAAa,EACb,iBAAiB,EAClB,MAAM,mBAAmB,CAAC;AAuD3B,wBAAgB,cAAc,CAAC,GAAG,EAAE,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,GAAG,MAAM,CA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,oBAAoB,EAAE,CAAC,CA4DjC"}
|
package/dist/db/migrations.d.ts
CHANGED
|
@@ -1,2 +1,3 @@
|
|
|
1
|
+
export declare const MEMORY_VERSION_SNAPSHOT_TRIGGER = "\nCREATE TRIGGER IF NOT EXISTS memories_version_snapshot\nBEFORE UPDATE ON memories\nWHEN NEW.version > OLD.version\nBEGIN\n INSERT OR IGNORE INTO memory_versions (\n id, memory_id, version, value, importance, scope, category, tags,\n summary, pinned, status, when_to_use, created_at\n ) VALUES (\n lower(hex(randomblob(4))) || '-' || lower(hex(randomblob(2))) || '-' ||\n lower(hex(randomblob(2))) || '-' || lower(hex(randomblob(2))) || '-' ||\n lower(hex(randomblob(6))),\n OLD.id, OLD.version, OLD.value, OLD.importance, OLD.scope, OLD.category,\n OLD.tags, OLD.summary, OLD.pinned, OLD.status, OLD.when_to_use,\n OLD.updated_at\n );\nEND;\n";
|
|
1
2
|
export declare const MIGRATIONS: string[];
|
|
2
3
|
//# sourceMappingURL=migrations.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"migrations.d.ts","sourceRoot":"","sources":["../../src/db/migrations.ts"],"names":[],"mappings":"AAGA,eAAO,MAAM,UAAU,EAAE,MAAM,
|
|
1
|
+
{"version":3,"file":"migrations.d.ts","sourceRoot":"","sources":["../../src/db/migrations.ts"],"names":[],"mappings":"AAGA,eAAO,MAAM,+BAA+B,wqBAiB3C,CAAC;AAEF,eAAO,MAAM,UAAU,EAAE,MAAM,EAm9B9B,CAAC"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"pg-migrations.d.ts","sourceRoot":"","sources":["../../src/db/pg-migrations.ts"],"names":[],"mappings":"AAAA;;;;;GAKG;AACH,eAAO,MAAM,aAAa,EAAE,MAAM,
|
|
1
|
+
{"version":3,"file":"pg-migrations.d.ts","sourceRoot":"","sources":["../../src/db/pg-migrations.ts"],"names":[],"mappings":"AAAA;;;;;GAKG;AACH,eAAO,MAAM,aAAa,E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,EAAE,CAAC,EAAE,QAAQ,GACZ,gBAAgB,CAwBlB;AAED,wBAAgB,aAAa,CAAC,EAAE,EAAE,MAAM,EAAE,EAAE,CAAC,EAAE,QAAQ,GAAG,gBAAgB,GAAG,IAAI,CAiBhF;AAED,wBAAgB,eAAe,CAC7B,MAAM,CAAC,EAAE,gBAAgB,EACzB,EAAE,CAAC,EAAE,QAAQ,GACZ,gBAAgB,EAAE,CA2CpB;AAED,wBAAgB,gBAAgB,CAC9B,EAAE,EAAE,MAAM,EACV,OAAO,EAAE,qBAAqB,EAC9B,EAAE,CAAC,EAAE,QAAQ,GACZ,gBAAgB,GAAG,IAAI,CAwCzB;AAED,wBAAgB,iBAAiB,CAAC,EAAE,CAAC,EAAE,QAAQ,GAAG,gBAAgB,GAAG,IAAI,CASxE"}
|
|
@@ -0,0 +1,33 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* The transport that reads and writes will actually use.
|
|
3
|
+
*
|
|
4
|
+
* - `local-sqlite` — the on-disk SQLite file at `db_path` is authoritative.
|
|
5
|
+
* - `cloud-api` — authed HTTPS to the self-hosted server (the shared store).
|
|
6
|
+
* - `cloud-postgres` — a direct Postgres DSN; server-only, never a client.
|
|
7
|
+
*/
|
|
8
|
+
export type StoreBackend = "local-sqlite" | "cloud-api" | "cloud-postgres";
|
|
9
|
+
export interface StoreBackendReport {
|
|
10
|
+
/** Machine-readable contract for scripts and test guards. */
|
|
11
|
+
schema: "mementos.store_backend.v1";
|
|
12
|
+
backend: StoreBackend;
|
|
13
|
+
/** True when the HTTPS client transport is engaged (client reads AND writes). */
|
|
14
|
+
api_mode: boolean;
|
|
15
|
+
/** The `getStorageMode()` value — reported for diagnosis, NOT the answer. */
|
|
16
|
+
storage_mode: string;
|
|
17
|
+
/** The SQLite path that WOULD be used. Meaningful only for `local-sqlite`. */
|
|
18
|
+
db_path: string;
|
|
19
|
+
/** Cloud endpoint origin + prefix. Not a secret; the key is never included. */
|
|
20
|
+
api_endpoint: string | null;
|
|
21
|
+
/** Whether an API key is configured. The value is never read or reported. */
|
|
22
|
+
api_key_present: boolean;
|
|
23
|
+
/** Env key NAMES that produced this backend, or `"default"`. Names only. */
|
|
24
|
+
selected_by: string;
|
|
25
|
+
}
|
|
26
|
+
/**
|
|
27
|
+
* Resolve the effective store backend from the environment.
|
|
28
|
+
*
|
|
29
|
+
* Pure with respect to storage: touches no database, makes no network call, and
|
|
30
|
+
* never places a credential value in the returned report.
|
|
31
|
+
*/
|
|
32
|
+
export declare function resolveStoreBackend(): StoreBackendReport;
|
|
33
|
+
//# sourceMappingURL=store-backend.d.ts.map
|
|
@@ -0,0 +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,+EAA+E;IAC/E,YAAY,EAAE,MAAM,GAAG,IAAI,CAAC;IAC5B,6EAA6E;IAC7E,eAAe,EAAE,OAAO,CAAC;IACzB,4EAA4E;IAC5E,WAAW,EAAE,MAAM,CAAC;CACrB;AAED;;;;;GAKG;AACH,wBAAgB,mBAAmB,IAAI,kBAAkB,CAkCxD"}
|