@hasna/mementos 0.14.88 → 0.16.0
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 +119 -30
- package/bun.lock +4 -65
- package/dist/audit-contract.d.ts +87 -0
- package/dist/audit-contract.d.ts.map +1 -0
- package/dist/cli/commands/info-context.d.ts.map +1 -1
- 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-backup.d.ts.map +1 -1
- package/dist/cli/commands/io-export.d.ts.map +1 -1
- package/dist/cli/commands/io-restore.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-list.d.ts +25 -0
- package/dist/cli/commands/memory-cmd-list.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/project.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-session.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-synthesized-profile.d.ts.map +1 -1
- package/dist/cli/commands/system.d.ts.map +1 -1
- package/dist/cli/helpers.d.ts.map +1 -1
- package/dist/cli/index.js +4964 -2168
- 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 +145 -37
- package/dist/db/api-mode.d.ts.map +1 -1
- package/dist/db/api-response-contract.d.ts +23 -0
- package/dist/db/api-response-contract.d.ts.map +1 -0
- package/dist/db/audit.d.ts +34 -45
- package/dist/db/audit.d.ts.map +1 -1
- package/dist/db/database.d.ts +1 -0
- package/dist/db/database.d.ts.map +1 -1
- package/dist/db/locks.d.ts.map +1 -1
- package/dist/db/machines.d.ts +50 -13
- package/dist/db/machines.d.ts.map +1 -1
- package/dist/db/memories.d.ts.map +1 -1
- package/dist/db/migrations.d.ts.map +1 -1
- package/dist/db/pg-migrate.d.ts.map +1 -1
- package/dist/db/pg-migrations.d.ts.map +1 -1
- package/dist/db/session-jobs.d.ts +2 -0
- package/dist/db/session-jobs.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 +299 -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 +4 -3
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +4328 -1485
- package/dist/lib/built-in-hooks.d.ts.map +1 -1
- 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/injection-project.d.ts +10 -0
- package/dist/lib/injection-project.d.ts.map +1 -0
- package/dist/lib/injector.d.ts +1 -0
- package/dist/lib/injector.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/machine-visibility.d.ts.map +1 -1
- package/dist/lib/memory-lock.d.ts.map +1 -1
- package/dist/lib/paths.d.ts +9 -0
- package/dist/lib/paths.d.ts.map +1 -1
- package/dist/lib/profile-synthesizer.d.ts +13 -2
- package/dist/lib/profile-synthesizer.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/lib/session-queue.d.ts.map +1 -1
- package/dist/lib/session-registry.d.ts +38 -1
- package/dist/lib/session-registry.d.ts.map +1 -1
- package/dist/lib/storage-sync.d.ts +5 -0
- package/dist/lib/storage-sync.d.ts.map +1 -1
- package/dist/lib/synthesis/index.d.ts.map +1 -1
- package/dist/mcp/index.d.ts +1 -1
- package/dist/mcp/index.d.ts.map +1 -1
- package/dist/mcp/index.js +6215 -2598
- package/dist/mcp/profile.d.ts +23 -0
- package/dist/mcp/profile.d.ts.map +1 -0
- package/dist/mcp/tools/lock-tools.d.ts.map +1 -1
- package/dist/mcp/tools/memory-audit.d.ts +1 -1
- package/dist/mcp/tools/memory-audit.d.ts.map +1 -1
- package/dist/mcp/tools/memory-crud.d.ts.map +1 -1
- package/dist/mcp/tools/memory-inject.d.ts.map +1 -1
- package/dist/mcp/tools/project-tools.d.ts.map +1 -1
- package/dist/mcp/tools/session-tools.d.ts.map +1 -1
- package/dist/mcp/tools/tool-registry.d.ts +22 -19
- package/dist/mcp/tools/tool-registry.d.ts.map +1 -1
- package/dist/mcp/tools/utility-tools.d.ts +2 -1
- package/dist/mcp/tools/utility-tools.d.ts.map +1 -1
- package/dist/project-registration.js +549 -205
- package/dist/sdk/index.d.ts +282 -14
- package/dist/sdk/index.d.ts.map +1 -1
- package/dist/sdk/index.js +1691 -35
- 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 +2 -0
- package/dist/server/index.d.ts.map +1 -1
- package/dist/server/index.js +6040 -2475
- package/dist/server/openapi.d.ts.map +1 -1
- package/dist/server/routes/audit.d.ts +2 -0
- package/dist/server/routes/audit.d.ts.map +1 -0
- package/dist/server/routes/machines.d.ts +2 -0
- package/dist/server/routes/machines.d.ts.map +1 -0
- package/dist/server/routes/system-sessions.d.ts.map +1 -1
- package/dist/server/routes/system-synthesis.d.ts.map +1 -1
- package/dist/storage.d.ts.map +1 -1
- package/dist/storage.js +78 -129
- package/dist/types/index.d.ts +3 -0
- package/dist/types/index.d.ts.map +1 -1
- package/docker-entrypoint.sh +7 -0
- package/hasna.contract.json +19 -7
- package/package.json +12 -11
- package/postinstall.mjs +52 -1
- package/dashboard/bun.lock +0 -519
- package/dist/cli/__fixtures__/clean-fallback-stub-server.d.ts +0 -2
- package/dist/cli/__fixtures__/clean-fallback-stub-server.d.ts.map +0 -1
- package/dist/cli/__fixtures__/io-restore-stub-server.d.ts +0 -2
- package/dist/cli/__fixtures__/io-restore-stub-server.d.ts.map +0 -1
- package/dist/cli/brains.d.ts +0 -3
- package/dist/cli/brains.d.ts.map +0 -1
- package/dist/db/__fixtures__/fail-closed-stub-server.d.ts +0 -2
- package/dist/db/__fixtures__/fail-closed-stub-server.d.ts.map +0 -1
- package/dist/db/__fixtures__/list-filter-capture-server.d.ts +0 -2
- package/dist/db/__fixtures__/list-filter-capture-server.d.ts.map +0 -1
- package/dist/db/__fixtures__/list-filter-client-runner.d.ts +0 -2
- package/dist/db/__fixtures__/list-filter-client-runner.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/test-support/memories-page-stub-server.d.ts +0 -2
- package/dist/test-support/memories-page-stub-server.d.ts.map +0 -1
- package/dist/test-support/memories-page-stub.d.ts +0 -28
- package/dist/test-support/memories-page-stub.d.ts.map +0 -1
- package/dist/test-support/pg-sync-stub-worker.d.ts +0 -2
- package/dist/test-support/pg-sync-stub-worker.d.ts.map +0 -1
- package/dist/test-support/preload-local-store.d.ts +0 -2
- package/dist/test-support/preload-local-store.d.ts.map +0 -1
- package/dist/test-support/project-authority-identity.d.ts +0 -8
- package/dist/test-support/project-authority-identity.d.ts.map +0 -1
- package/dist/test-support/store-isolation.d.ts +0 -108
- package/dist/test-support/store-isolation.d.ts.map +0 -1
- package/dist/test-support/strip-ansi.d.ts +0 -3
- package/dist/test-support/strip-ansi.d.ts.map +0 -1
|
@@ -8,7 +8,7 @@ import type { Command } from "commander";
|
|
|
8
8
|
* one that ships.
|
|
9
9
|
*
|
|
10
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
|
|
11
|
+
* the CLI wired 15 sources, leaving `init`, `project-panel` and the
|
|
12
12
|
* `@hasna/events` groups (`events`, `webhooks`) unwalked. Seven live `-j`
|
|
13
13
|
* collisions sat in that blind spot while the guard reported clean. Adding a
|
|
14
14
|
* command group here is now the only step required for it to be covered.
|
|
@@ -1 +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;
|
|
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;AAiBzC;;;;;;;;;;;;;GAaG;AACH,wBAAgB,mBAAmB,CAAC,OAAO,EAAE,OAAO,GAAG,OAAO,CAgB7D"}
|
package/dist/db/api-mode.d.ts
CHANGED
|
@@ -2,15 +2,26 @@ export interface ApiConfig {
|
|
|
2
2
|
baseUrl: string;
|
|
3
3
|
apiKey: string;
|
|
4
4
|
}
|
|
5
|
-
|
|
6
|
-
export
|
|
5
|
+
/** Tier-1 credential inputs (explicit key/profile, keychain runner for tests). */
|
|
6
|
+
export interface MementosClientResolveOptions {
|
|
7
|
+
credentials?: import("@hasna/contracts/client").CredentialChainOptions;
|
|
8
|
+
}
|
|
9
|
+
/** The env keys that select the API transport, resolver-derived, canonical first. */
|
|
10
|
+
export declare const API_URL_ENV_KEYS: readonly [string, string];
|
|
11
|
+
export declare const API_KEY_ENV_KEYS: readonly [string, string];
|
|
12
|
+
/** The env keys that select the server postgresql backend (and disable client API mode). */
|
|
7
13
|
export declare const DATABASE_URL_ENV_KEYS: readonly ["HASNA_MEMENTOS_DATABASE_URL", "MEMENTOS_DATABASE_URL"];
|
|
14
|
+
/** The explicit local SQLite path — the precedence-1 local opt-in. */
|
|
15
|
+
export declare const DB_PATH_ENV_KEYS: readonly ["HASNA_MEMENTOS_DB_PATH", "MEMENTOS_DB_PATH"];
|
|
16
|
+
type Env = Record<string, string | undefined>;
|
|
8
17
|
/**
|
|
9
18
|
* Which env keys currently select API mode, by name only — never the values.
|
|
10
19
|
* 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.
|
|
20
|
+
* is pointed at the cloud without reading source or echoing a credential. The
|
|
21
|
+
* API key is read from the resolver's own key list, so a tier that moves
|
|
22
|
+
* cannot drift out of this report.
|
|
12
23
|
*/
|
|
13
|
-
export declare function getApiModeEnvSources(): {
|
|
24
|
+
export declare function getApiModeEnvSources(env?: Env): {
|
|
14
25
|
urlKey: string | null;
|
|
15
26
|
keyKey: string | null;
|
|
16
27
|
databaseUrlKey: string | null;
|
|
@@ -25,9 +36,16 @@ export declare function getApiModeEnvSources(): {
|
|
|
25
36
|
* merely outranked, which points them at a credential problem they do not have.
|
|
26
37
|
*
|
|
27
38
|
* Never returns a credential value — the endpoint is not secret, the key is
|
|
28
|
-
* reported only as a boolean.
|
|
39
|
+
* reported only as a boolean. `apiKeyPresent` is answered through the resolver
|
|
40
|
+
* chain (any tier: env, Keychain, credentials file), because the Keychain and
|
|
41
|
+
* disk tiers are ambient and an env-only read would report "absent" on the
|
|
42
|
+
* very stations the resolver serves most.
|
|
43
|
+
*
|
|
44
|
+
* A malformed configured base THROWS (fail closed: a misconfigured endpoint
|
|
45
|
+
* must fail closed, exactly like a half-configured credential pair does), with
|
|
46
|
+
* the resolver's own message and never the raw value.
|
|
29
47
|
*/
|
|
30
|
-
export declare function getConfiguredApiEnv(): {
|
|
48
|
+
export declare function getConfiguredApiEnv(env?: Env, options?: MementosClientResolveOptions): {
|
|
31
49
|
baseUrl: string | null;
|
|
32
50
|
apiKeyPresent: boolean;
|
|
33
51
|
dbPathKey: string | null;
|
|
@@ -38,14 +56,71 @@ export declare function getConfiguredApiEnv(): {
|
|
|
38
56
|
* is silent and lands in a shared store.
|
|
39
57
|
*/
|
|
40
58
|
export declare const ALLOW_REMOTE_API_IN_TESTS_ENV = "MEMENTOS_ALLOW_REMOTE_API_IN_TESTS";
|
|
41
|
-
/** Resolve the API client config from env, or `null` when not configured. */
|
|
42
|
-
/** The env keys that explicitly select the local SQLite store. */
|
|
43
|
-
export declare const DB_PATH_ENV_KEYS: readonly ["HASNA_MEMENTOS_DB_PATH", "MEMENTOS_DB_PATH"];
|
|
44
59
|
/** Raised when the environment does not unambiguously select one store. */
|
|
45
60
|
export declare class MementosStoreConfigError extends Error {
|
|
46
61
|
readonly code = "MEMENTOS_STORE_CONFIG";
|
|
47
62
|
constructor(message: string);
|
|
48
63
|
}
|
|
64
|
+
/**
|
|
65
|
+
* Resolve the API client configuration through the @hasna/contracts chain, or
|
|
66
|
+
* return `null` when the environment selects the on-box store or configures
|
|
67
|
+
* nothing at all.
|
|
68
|
+
*
|
|
69
|
+
* EVERY CALL RESOLVES FRESH: the Keychain and the credentials file are
|
|
70
|
+
* re-read per request, so a key rotation heals a long-lived shell or MCP
|
|
71
|
+
* server without a restart. Deliberately a single pass down the chain (one
|
|
72
|
+
* credential resolution, once), with the resolved value handed back to the
|
|
73
|
+
* transport as its tier-1 argument so the authority pass never re-reads the
|
|
74
|
+
* tiers — and so the key that validated the authority is the key the request
|
|
75
|
+
* sends (no TOCTOU between two reads).
|
|
76
|
+
*
|
|
77
|
+
* Refusals — a URL without a credential, blank or disagreeing aliases, an
|
|
78
|
+
* unusable credential file, an invalid authority — THROW as
|
|
79
|
+
* {@link MementosStoreConfigError}. Only "nothing configured anywhere" (no
|
|
80
|
+
* env pointer, no Keychain item, no credentials file) returns null, and the
|
|
81
|
+
* fail-closed gate {@link assertClientStoreConfigured} refuses THAT at every
|
|
82
|
+
* store entry point: a null here is never permission to open the on-box
|
|
83
|
+
* default file.
|
|
84
|
+
*/
|
|
85
|
+
export declare function getApiConfig(env?: Env, options?: MementosClientResolveOptions): ApiConfig | null;
|
|
86
|
+
/**
|
|
87
|
+
* True when the client should route memory operations to the cloud API.
|
|
88
|
+
* Fail-closed against a client-side DSN: if DATABASE_URL is present, API mode
|
|
89
|
+
* refuses to engage so the two transports never mix.
|
|
90
|
+
*
|
|
91
|
+
* The SERVER PROCESS never routes through the client transport
|
|
92
|
+
* (`isApiMode()` is false there): mementos-serve selects its own backend via
|
|
93
|
+
* its storage configuration (HASNA_MEMENTOS_DATABASE_URL for PostgreSQL, or
|
|
94
|
+
* the on-box store), and the client API vars its operator shell may inherit
|
|
95
|
+
* (the fleet resolver's aliases are deliberately permissive) must not re-route
|
|
96
|
+
* server domain calls to the shared cloud — that would make a local serve read
|
|
97
|
+
* and write the fleet store. markServerContext() at server startup makes the
|
|
98
|
+
* distinction, and the same gate keeps the split-brain guard and every domain
|
|
99
|
+
* module's api arm inert inside the server process.
|
|
100
|
+
*/
|
|
101
|
+
export declare function isApiMode(): boolean;
|
|
102
|
+
/** WHERE the API transport came from, for operator reports. Never a value. */
|
|
103
|
+
export interface ResolvedApiModeReport {
|
|
104
|
+
/** The resolved `<origin>/v1` authority this client would send to. */
|
|
105
|
+
baseUrl: string;
|
|
106
|
+
/** An env key NAME, a Keychain item reference, a file PATH, or `"default"`. */
|
|
107
|
+
apiUrlSource: string | null;
|
|
108
|
+
/** An env key NAME, a Keychain item reference, or a file PATH. Never a value. */
|
|
109
|
+
apiKeySource: string | null;
|
|
110
|
+
/** The tier of the credential chain that supplied the key. */
|
|
111
|
+
apiKeyTier: string | null;
|
|
112
|
+
}
|
|
113
|
+
/**
|
|
114
|
+
* Resolve WHERE the client transport came from, without exposing the key.
|
|
115
|
+
*
|
|
116
|
+
* One pass down the @hasna/contracts chain, used by the operator-facing mode
|
|
117
|
+
* report (`storage mode`) so a human can see *why* the client is pointed at
|
|
118
|
+
* the cloud — an env key name, a Keychain item reference, a credentials-file
|
|
119
|
+
* path, or the fleet gateway default. `null` when the environment selects the
|
|
120
|
+
* on-box store or configures nothing at all; refusals throw exactly as
|
|
121
|
+
* {@link getApiConfig} does.
|
|
122
|
+
*/
|
|
123
|
+
export declare function getResolvedApiModeReport(env?: Env, options?: MementosClientResolveOptions): ResolvedApiModeReport | null;
|
|
49
124
|
/**
|
|
50
125
|
* Throw unless the environment unambiguously selects one store.
|
|
51
126
|
*
|
|
@@ -58,41 +133,73 @@ export declare class MementosStoreConfigError extends Error {
|
|
|
58
133
|
* THIS FUNCTION ONLY ASSERTS. It returns `void`, so it cannot select anything —
|
|
59
134
|
* the precedence table below describes the RESOLVER, which is `getApiConfig()`
|
|
60
135
|
* immediately after it, and each early `return` here only suppresses the
|
|
61
|
-
* ambiguity error for a case that is already unambiguous.
|
|
62
|
-
*
|
|
63
|
-
*
|
|
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.
|
|
136
|
+
* ambiguity error for a case that is already unambiguous. The SELECTION is
|
|
137
|
+
* implemented in `getApiConfig()` / `isApiMode()`; the table is documented here
|
|
138
|
+
* because this is where the error text lives.
|
|
70
139
|
*
|
|
71
140
|
* Precedence, highest first:
|
|
72
|
-
* 0. A retired storage-mode variable (HASNA_MEMENTOS_STORAGE_MODE or any of
|
|
73
|
-
* its aliases) throws via `assertNoLegacyStorageMode`, even when blank.
|
|
74
|
-
* Deployment modes no longer exist; a stale variable is an error, never a
|
|
75
|
-
* selector. ENFORCED HERE, before anything else.
|
|
76
141
|
* 1. An explicit SQLite path (`HASNA_MEMENTOS_DB_PATH` / `MEMENTOS_DB_PATH`) is
|
|
77
|
-
* the narrowest, most specific signal and selects LOCAL
|
|
78
|
-
* tooling and import/export keep working
|
|
79
|
-
*
|
|
80
|
-
*
|
|
81
|
-
*
|
|
82
|
-
*
|
|
83
|
-
*
|
|
84
|
-
*
|
|
142
|
+
* the narrowest, most specific signal and selects LOCAL before the resolver
|
|
143
|
+
* is even consulted, so local dev, tooling and import/export keep working
|
|
144
|
+
* when a credential is exported globally. (`MEMENTOS_DB_PATH`'s precedence
|
|
145
|
+
* over a COMPLETE API pair is the package's documented precedence-1 rule
|
|
146
|
+
* since 2026-08-03.)
|
|
147
|
+
* 2. A client DSN present disables API mode. A DSN on a client is forbidden
|
|
148
|
+
* and is tracked separately in database.ts.
|
|
149
|
+
* 3. The @hasna/contracts resolve — everything else. A URL without a
|
|
150
|
+
* resolvable credential, a blank or disagreeing pair, an unusable
|
|
151
|
+
* credential file, or an invalid authority THROWS here; a credential with
|
|
152
|
+
* no URL resolves to the fleet gateway (complete configuration).
|
|
153
|
+
* 4. Nothing configured anywhere -> no transport selected. This used to
|
|
154
|
+
* resolve to LOCAL (the "documented single-operator default"); since the
|
|
155
|
+
* 2026-09-04 fail-closed ruling a client that needs the store REFUSES
|
|
156
|
+
* instead — an explicit opt-in (`HASNA_MEMENTOS_DB_PATH` or
|
|
157
|
+
* `HASNA_MEMENTOS_LOCAL=1`) is now the only way into the on-box SQLite
|
|
158
|
+
* store, and `assertClientStoreConfigured()` (below) enforces that at
|
|
159
|
+
* every entry point that would otherwise open the default local file.
|
|
85
160
|
*
|
|
86
|
-
* Never reads, logs, or embeds a credential value — only variable NAMES
|
|
161
|
+
* Never reads, logs, or embeds a credential value — only variable NAMES and
|
|
162
|
+
* tier descriptions.
|
|
87
163
|
*/
|
|
88
|
-
export declare function assertUnambiguousStoreEnv(env?:
|
|
89
|
-
export declare function getApiConfig(): ApiConfig | null;
|
|
164
|
+
export declare function assertUnambiguousStoreEnv(env?: Env, options?: MementosClientResolveOptions): void;
|
|
90
165
|
/**
|
|
91
|
-
*
|
|
92
|
-
*
|
|
93
|
-
*
|
|
166
|
+
* FAIL-CLOSED store gate (owner ruling 2026-09-04, fleet fail-closed wave).
|
|
167
|
+
*
|
|
168
|
+
* The transport rules above answer "which store is configured?" and treat
|
|
169
|
+
* "none" as a question, not an answer: `isApiMode()` returns false and
|
|
170
|
+
* `getApiConfig()` returns null, and every domain call site reads that as
|
|
171
|
+
* "open the local store". That was the defect: a fleet CLI run WITHOUT a
|
|
172
|
+
* credential silently opened the default on-box SQLite store
|
|
173
|
+
* (~/.hasna/mementos/mementos.db), served it as if it were the memory store,
|
|
174
|
+
* and exited 0 — a false green against a different dataset.
|
|
175
|
+
*
|
|
176
|
+
* This function is the guard every store-access entry point calls BEFORE it
|
|
177
|
+
* may open the default local file (CLI command startup, `getDatabase()`
|
|
178
|
+
* default-path fallthrough, ...). It throws unless one of these is true:
|
|
179
|
+
*
|
|
180
|
+
* - an explicit SQLite path is set (`HASNA_MEMENTOS_DB_PATH` /
|
|
181
|
+
* `MEMENTOS_DB_PATH`) — the documented EXPLICIT LOCAL OPT-IN, or
|
|
182
|
+
* - the deliberate flag opt-in (`HASNA_MEMENTOS_LOCAL=1` / `MEMENTOS_LOCAL=1`)
|
|
183
|
+
* with no authority or credential configured — answered BEFORE the
|
|
184
|
+
* resolver runs, so a local run reads no Keychain item and no credential
|
|
185
|
+
* file, or
|
|
186
|
+
* - a client DSN is present (its own server-only guard already fails closed
|
|
187
|
+
* in getDatabase; the DSN tier is untouched here), or
|
|
188
|
+
* - the @hasna/contracts chain resolves a credential (fleet API mode —
|
|
189
|
+
* authority included, defaulting to the fleet gateway).
|
|
190
|
+
*
|
|
191
|
+
* Anything else — no credential, no opt-in — is a REFUSAL, never a local
|
|
192
|
+
* default. Never reads, logs, or embeds a credential value — only variable
|
|
193
|
+
* NAMES and tier descriptions.
|
|
94
194
|
*/
|
|
95
|
-
export declare function
|
|
195
|
+
export declare function assertClientStoreConfigured(env?: Env, options?: MementosClientResolveOptions): void;
|
|
196
|
+
/**
|
|
197
|
+
* The one-line refusal every surface prints when NOTHING resolves — the tiers
|
|
198
|
+
* consulted and the explicit opt-ins, names only, never a value. Shared with
|
|
199
|
+
* the `storage mode` probe so its `unconfigured` answer and the data verbs'
|
|
200
|
+
* refusal read as one message.
|
|
201
|
+
*/
|
|
202
|
+
export declare function unconfiguredStoreMessage(): string;
|
|
96
203
|
export declare class ApiRequestError extends Error {
|
|
97
204
|
readonly status: number;
|
|
98
205
|
readonly body: string;
|
|
@@ -124,4 +231,5 @@ export declare function apiJson<T = unknown>(method: string, path: string, body?
|
|
|
124
231
|
};
|
|
125
232
|
/** Build a query string from a filter object (skips undefined/null/empty). */
|
|
126
233
|
export declare function toQuery(params: Record<string, unknown>): string;
|
|
234
|
+
export {};
|
|
127
235
|
//# sourceMappingURL=api-mode.d.ts.map
|
|
@@ -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":"AAkGA,MAAM,WAAW,SAAS;IACxB,OAAO,EAAE,MAAM,CAAC;IAChB,MAAM,EAAE,MAAM,CAAC;CAChB;AAED,kFAAkF;AAClF,MAAM,WAAW,4BAA4B;IAC3C,WAAW,CAAC,EAAE,OAAO,yBAAyB,EAAE,sBAAsB,CAAC;CACxE;AAED,qFAAqF;AACrF,eAAO,MAAM,gBAAgB,EAAE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AAC,GAAG,MAAM,CAe/D"}
|
|
@@ -0,0 +1,23 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Strict decoders for hosted 2xx responses.
|
|
3
|
+
*
|
|
4
|
+
* The synchronous HTTP transport only proves that the response was JSON. These
|
|
5
|
+
* helpers prove the small shape each caller relies on so a proxy/server drift
|
|
6
|
+
* can never be converted into an authoritative empty list, zero count, or
|
|
7
|
+
* successful mutation receipt.
|
|
8
|
+
*/
|
|
9
|
+
export declare class MementosApiProtocolError extends Error {
|
|
10
|
+
readonly code = "MEMENTOS_API_PROTOCOL";
|
|
11
|
+
constructor(operation: string, detail: string);
|
|
12
|
+
}
|
|
13
|
+
export type JsonObject = Record<string, unknown>;
|
|
14
|
+
export declare function expectObject(value: unknown, operation: string): JsonObject;
|
|
15
|
+
export declare function expectArray(value: unknown, operation: string, field?: string): unknown[];
|
|
16
|
+
export declare function expectString(object: JsonObject, field: string, operation: string, options?: {
|
|
17
|
+
allowEmpty?: boolean;
|
|
18
|
+
}): string;
|
|
19
|
+
export declare function expectNullableString(object: JsonObject, field: string, operation: string): string | null;
|
|
20
|
+
export declare function expectBoolean(object: JsonObject, field: string, operation: string): boolean;
|
|
21
|
+
export declare function expectNonNegativeInteger(object: JsonObject, field: string, operation: string): number;
|
|
22
|
+
export declare function expectRecord(object: JsonObject, field: string, operation: string): JsonObject;
|
|
23
|
+
//# sourceMappingURL=api-response-contract.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"api-response-contract.d.ts","sourceRoot":"","sources":["../../src/db/api-response-contract.ts"],"names":[],"mappings":"AAAA;;;;;;;GAOG;AAEH,qBAAa,wBAAyB,SAAQ,KAAK;IACjD,QAAQ,CAAC,IAAI,2BAA2B;gBAE5B,SAAS,EAAE,MAAM,EAAE,MAAM,EAAE,MAAM;CAI9C;AAED,MAAM,MAAM,UAAU,GAAG,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,CAAC;AAEjD,wBAAgB,YAAY,CAAC,KAAK,EAAE,OAAO,EAAE,SAAS,EAAE,MAAM,GAAG,UAAU,CAK1E;AAED,wBAAgB,WAAW,CAAC,KAAK,EAAE,OAAO,EAAE,SAAS,EAAE,MAAM,EAAE,KAAK,CAAC,EAAE,MAAM,GAAG,OAAO,EAAE,CAQxF;AAED,wBAAgB,YAAY,CAC1B,MAAM,EAAE,UAAU,EAClB,KAAK,EAAE,MAAM,EACb,SAAS,EAAE,MAAM,EACjB,OAAO,GAAE;IAAE,UAAU,CAAC,EAAE,OAAO,CAAA;CAAO,GACrC,MAAM,CASR;AAED,wBAAgB,oBAAoB,CAClC,MAAM,EAAE,UAAU,EAClB,KAAK,EAAE,MAAM,EACb,SAAS,EAAE,MAAM,GAChB,MAAM,GAAG,IAAI,CAOf;AAED,wBAAgB,aAAa,CAAC,MAAM,EAAE,UAAU,EAAE,KAAK,EAAE,MAAM,EAAE,SAAS,EAAE,MAAM,GAAG,OAAO,CAM3F;AAED,wBAAgB,wBAAwB,CACtC,MAAM,EAAE,UAAU,EAClB,KAAK,EAAE,MAAM,EACb,SAAS,EAAE,MAAM,GAChB,MAAM,CASR;AAED,wBAAgB,YAAY,CAC1B,MAAM,EAAE,UAAU,EAClB,KAAK,EAAE,MAAM,EACb,SAAS,EAAE,MAAM,GAChB,UAAU,CASZ"}
|
package/dist/db/audit.d.ts
CHANGED
|
@@ -1,53 +1,42 @@
|
|
|
1
1
|
/**
|
|
2
|
-
* Immutable audit
|
|
3
|
-
*
|
|
2
|
+
* Immutable audit-log queries.
|
|
3
|
+
*
|
|
4
|
+
* The audit table is append-only. Hosted clients use versioned, strictly
|
|
5
|
+
* validated /v1 receipts; local/server callers use the same page contract over
|
|
6
|
+
* SQLite or PostgreSQL. No client path may fall through to local storage.
|
|
4
7
|
*/
|
|
5
|
-
import {
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
/**
|
|
13
|
-
* md5 hex digest of the value the row held BEFORE the operation, or `null`.
|
|
14
|
-
*
|
|
15
|
-
* `null` means the digest is UNAVAILABLE, never that the value was empty. It is
|
|
16
|
-
* the honest answer on SQLite, which has no `md5()` and whose driver
|
|
17
|
-
* (`bun:sqlite`) exposes no user-defined-function API, so a trigger cannot
|
|
18
|
-
* compute one. Postgres computes `md5(COALESCE(...))` natively and populates it.
|
|
19
|
-
*
|
|
20
|
-
* So: compare `md5(candidate)` against a NON-NULL value to prove what a row
|
|
21
|
-
* held. A `null` is a statement about the BACKEND and must never be read as
|
|
22
|
-
* evidence about the content — treating it as a failed match is the confident
|
|
23
|
-
* wrong answer migration 37 exists to prevent.
|
|
24
|
-
*/
|
|
25
|
-
old_value_hash: string | null;
|
|
26
|
-
/** md5 hex digest of the value AFTER the operation, or `null`. See `old_value_hash`. */
|
|
27
|
-
new_value_hash: string | null;
|
|
28
|
-
changes: Record<string, unknown>;
|
|
29
|
-
created_at: string;
|
|
8
|
+
import { type DbAdapter } from "../storage.js";
|
|
9
|
+
import { type AuditEntry, type AuditFilters, type AuditOperation, type AuditPage, type AuditStats } from "../audit-contract.js";
|
|
10
|
+
export type { AuditEntry, AuditFilters, AuditOperation, AuditPage, AuditStats } from "../audit-contract.js";
|
|
11
|
+
export { AUDIT_EXPORT_CONTRACT, AUDIT_OPERATIONS, AUDIT_STATS_CONTRACT, AUDIT_TRAIL_CONTRACT } from "../audit-contract.js";
|
|
12
|
+
export interface AuditPageOptions {
|
|
13
|
+
limit?: number;
|
|
14
|
+
cursor?: string;
|
|
30
15
|
}
|
|
31
|
-
|
|
32
|
-
* Get audit trail for a specific memory.
|
|
33
|
-
*/
|
|
34
|
-
export declare function getMemoryAuditTrail(memoryId: string, limit?: number, db?: Database): AuditEntry[];
|
|
35
|
-
/**
|
|
36
|
-
* Export full audit log for compliance reporting.
|
|
37
|
-
*/
|
|
38
|
-
export declare function exportAuditLog(options?: {
|
|
16
|
+
export interface AuditExportOptions extends AuditPageOptions {
|
|
39
17
|
since?: string;
|
|
40
18
|
until?: string;
|
|
41
|
-
operation?: string;
|
|
19
|
+
operation?: AuditOperation | string;
|
|
42
20
|
agent_id?: string;
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
total_entries: number;
|
|
50
|
-
by_operation: Record<string, number>;
|
|
51
|
-
recent_24h: number;
|
|
21
|
+
}
|
|
22
|
+
type AuditDatabase = DbAdapter & {
|
|
23
|
+
query(sql: string): {
|
|
24
|
+
get(...params: unknown[]): unknown;
|
|
25
|
+
all(...params: unknown[]): unknown[];
|
|
26
|
+
};
|
|
52
27
|
};
|
|
28
|
+
export declare function normalizeAuditFilters(input: {
|
|
29
|
+
memory_id?: string;
|
|
30
|
+
since?: string;
|
|
31
|
+
until?: string;
|
|
32
|
+
operation?: string;
|
|
33
|
+
agent_id?: string;
|
|
34
|
+
}): AuditFilters;
|
|
35
|
+
export declare function getMemoryAuditTrailPage(memoryId: string, options?: AuditPageOptions, db?: AuditDatabase): AuditPage;
|
|
36
|
+
export declare function exportAuditLogPage(options?: AuditExportOptions, db?: AuditDatabase): AuditPage;
|
|
37
|
+
/** Backward-compatible first-page helper. Prefer getMemoryAuditTrailPage. */
|
|
38
|
+
export declare function getMemoryAuditTrail(memoryId: string, limit?: number, db?: AuditDatabase): AuditEntry[];
|
|
39
|
+
/** Backward-compatible first-page helper. Prefer exportAuditLogPage. */
|
|
40
|
+
export declare function exportAuditLog(options?: AuditExportOptions, db?: AuditDatabase): AuditEntry[];
|
|
41
|
+
export declare function getAuditStats(db?: AuditDatabase): AuditStats;
|
|
53
42
|
//# sourceMappingURL=audit.d.ts.map
|
package/dist/db/audit.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"audit.d.ts","sourceRoot":"","sources":["../../src/db/audit.ts"],"names":[],"mappings":"AAAA
|
|
1
|
+
{"version":3,"file":"audit.d.ts","sourceRoot":"","sources":["../../src/db/audit.ts"],"names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rC,QAAQ,EAAE,MAAM,EAChB,OAAO,GAAE,gBAAqB,EAC9B,EAAE,CAAC,EAAE,aAAa,GACjB,SAAS,CAaX;AAED,wBAAgB,kBAAkB,CAChC,OAAO,GAAE,kBAAuB,EAChC,EAAE,CAAC,EAAE,aAAa,GACjB,SAAS,CAeX;AAED,6EAA6E;AAC7E,wBAAgB,mBAAmB,CAAC,QAAQ,EAAE,MAAM,EAAE,KAAK,GAAE,MAA4B,EAAE,EAAE,CAAC,EAAE,aAAa,GAAG,UAAU,EAAE,CAE3H;AAED,wEAAwE;AACxE,wBAAgB,cAAc,CAAC,OAAO,GAAE,kBAAuB,EAAE,EAAE,CAAC,EAAE,aAAa,GAAG,UAAU,EAAE,CAEjG;AAiCD,wBAAgB,aAAa,CAAC,EAAE,CAAC,EAAE,aAAa,GAAG,UAAU,CAQ5D"}
|
package/dist/db/database.d.ts
CHANGED
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
import { SqliteAdapter as Database } from "../storage.js";
|
|
2
2
|
export declare function getDbPath(): string;
|
|
3
3
|
export declare function getDatabase(dbPath?: string): Database;
|
|
4
|
+
export declare function applyMachineIdentityMigration(db: Database): void;
|
|
4
5
|
export declare function closeDatabase(): void;
|
|
5
6
|
export declare function resetDatabase(): void;
|
|
6
7
|
export declare function now(): string;
|
|
@@ -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;
|
|
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;AAiEvB,wBAAgB,SAAS,IAAI,MAAM,CA6BlC;AAqDD,wBAAgB,WAAW,CAAC,MAAM,CAAC,EAAE,MAAM,GAAG,QAAQ,CAmHrD;AAsCD,wBAAgB,6BAA6B,CAAC,EAAE,EAAE,QAAQ,GAAG,IAAI,CA8ChE;AAgBD,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;
|
|
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;AAY1D,MAAM,MAAM,YAAY,GAAG,SAAS,GAAG,QAAQ,GAAG,QAAQ,GAAG,OAAO,GAAG,WAAW,GAAG,MAAM,CAAC;AAC5F,MAAM,MAAM,QAAQ,GAAG,UAAU,GAAG,WAAW,CAAC;AAEhD,MAAM,WAAW,YAAY;IAC3B,EAAE,EAAE,MAAM,CAAC;IACX,aAAa,EAAE,YAAY,CAAC;IAC5B,WAAW,EAAE,MAAM,CAAC;IACpB,QAAQ,EAAE,MAAM,CAAC;IACjB,SAAS,EAAE,QAAQ,CAAC;IACpB,SAAS,EAAE,MAAM,CAAC;IAClB,UAAU,EAAE,MAAM,CAAC;CACpB;AAwCD;;;;;;;GAOG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AAC;IACjB,SAAS,EAAE,MAAM,CAAC;CACnB;AAED;;GAEG;AACH,wBAAgB,yBAAyB,CAAC,EAAE,CAAC,EAAE,QAAQ,GAAG,eAAe,EAAE,CAU1E;AAED,wBAAgB,iBAAiB,CAAC,EAAE,CAAC,EAAE,QAAQ,GAAG,MAAM,CASvD"}
|
package/dist/db/machines.d.ts
CHANGED
|
@@ -1,3 +1,9 @@
|
|
|
1
|
+
import { getDatabase } from "./database.js";
|
|
2
|
+
export declare const MACHINE_REGISTRATION_CONTRACT: "mementos.machine-registration.v1";
|
|
3
|
+
export declare const MACHINE_LIST_CONTRACT: "mementos.machines.v1";
|
|
4
|
+
export declare const MACHINE_MUTATION_CONTRACT: "mementos.machine-mutation.v1";
|
|
5
|
+
export declare const MACHINE_TOUCH_CONTRACT: "mementos.machine-touch.v1";
|
|
6
|
+
type MachineDatabase = ReturnType<typeof getDatabase>;
|
|
1
7
|
export interface Machine {
|
|
2
8
|
id: string;
|
|
3
9
|
name: string;
|
|
@@ -7,17 +13,48 @@ export interface Machine {
|
|
|
7
13
|
created_at: string;
|
|
8
14
|
last_seen_at: string;
|
|
9
15
|
}
|
|
10
|
-
export
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
export
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
export declare
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
16
|
+
export interface RegisterMachineInput {
|
|
17
|
+
name?: string;
|
|
18
|
+
hostname: string;
|
|
19
|
+
platform: string;
|
|
20
|
+
}
|
|
21
|
+
export interface MachineRegistrationResult {
|
|
22
|
+
machine: Machine;
|
|
23
|
+
created: boolean;
|
|
24
|
+
}
|
|
25
|
+
export declare class MachineRegistryError extends Error {
|
|
26
|
+
readonly code: "MACHINE_INVALID_INPUT" | "MACHINE_NOT_FOUND" | "MACHINE_NAME_CONFLICT" | "MACHINE_PRIMARY_DELETE_REFUSED" | "MACHINE_REGISTRATION_CONFLICT";
|
|
27
|
+
constructor(code: "MACHINE_INVALID_INPUT" | "MACHINE_NOT_FOUND" | "MACHINE_NAME_CONFLICT" | "MACHINE_PRIMARY_DELETE_REFUSED" | "MACHINE_REGISTRATION_CONFLICT", message: string);
|
|
28
|
+
}
|
|
29
|
+
/**
|
|
30
|
+
* Hostname is the account-local registration idempotency key, not an
|
|
31
|
+
* authorization boundary. The server-assigned machine `id` is the stable
|
|
32
|
+
* identity used by mutations and memory attribution. Renaming changes only the
|
|
33
|
+
* human display name; re-registering the same normalized hostname never takes
|
|
34
|
+
* over or renames an existing row.
|
|
35
|
+
*/
|
|
36
|
+
export declare function normalizeMachineHostname(host: string): string;
|
|
37
|
+
export declare function getMachineById(id: string, db: MachineDatabase): Machine | null;
|
|
38
|
+
/**
|
|
39
|
+
* Atomically register a machine using the database-enforced unique hostname
|
|
40
|
+
* invariant. The insert happens before any lookup; concurrent callers either
|
|
41
|
+
* create one row or observe/update that same row after `ON CONFLICT` resolves.
|
|
42
|
+
*/
|
|
43
|
+
export declare function registerMachineRecord(input: RegisterMachineInput, db?: MachineDatabase): MachineRegistrationResult;
|
|
44
|
+
export declare function registerMachine(name?: string, db?: MachineDatabase): Machine;
|
|
45
|
+
export declare function listMachines(db?: MachineDatabase): Machine[];
|
|
46
|
+
/** Read by stable id or display name for backward-compatible discovery only. */
|
|
47
|
+
export declare function getMachine(idOrName: string, db?: MachineDatabase): Machine | null;
|
|
48
|
+
export declare function renameMachine(id: string, newName: string, db?: MachineDatabase): Machine;
|
|
49
|
+
export declare function getPrimaryMachine(db?: MachineDatabase): Machine | null;
|
|
50
|
+
export declare function getPrimaryMachineCandidate(db?: MachineDatabase): Machine | null;
|
|
51
|
+
export declare function setPrimaryMachine(id: string, db?: MachineDatabase): Machine;
|
|
52
|
+
export declare function deleteMachine(id: string, db?: MachineDatabase): void;
|
|
53
|
+
export declare function getFallbackSyncTargetMachine(db?: MachineDatabase): Machine | null;
|
|
54
|
+
export declare function getPrimaryMachineStartupWarning(db?: MachineDatabase): string | null;
|
|
55
|
+
export declare function touchMachine(id: string, db?: MachineDatabase): Machine;
|
|
56
|
+
export declare function resetCurrentMachineIdCache(): void;
|
|
57
|
+
/** Get or auto-register the current machine and return its stable server id. */
|
|
58
|
+
export declare function getCurrentMachineId(db?: MachineDatabase): string;
|
|
59
|
+
export {};
|
|
23
60
|
//# sourceMappingURL=machines.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"machines.d.ts","sourceRoot":"","sources":["../../src/db/machines.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"machines.d.ts","sourceRoot":"","sources":["../../src/db/machines.ts"],"names":[],"mappings":"AAEA,OAAO,EAAE,WAAW,EAAa,MAAM,eAAe,CAAC;AAYvD,eAAO,MAAM,6BAA6B,EAAG,kCAA2C,CAAC;AACzF,eAAO,MAAM,qBAAqB,EAAG,sBAA+B,CAAC;AACrE,eAAO,MAAM,yBAAyB,EAAG,8BAAuC,CAAC;AACjF,eAAO,MAAM,sBAAsB,EAAG,2BAAoC,CAAC;AAE3E,KAAK,eAAe,GAAG,UAAU,CAAC,OAAO,WAAW,CAAC,CAAC;AAEtD,MAAM,WAAW,OAAO;IACtB,EAAE,EAAE,MAAM,CAAC;IACX,IAAI,EAAE,MAAM,CAAC;IACb,QAAQ,EAAE,MAAM,CAAC;IACjB,QAAQ,EAAE,MAAM,CAAC;IACjB,UAAU,EAAE,OAAO,CAAC;IACpB,UAAU,EAAE,MAAM,CAAC;IACnB,YAAY,EAAE,MAAM,CAAC;CACtB;AAaD,MAAM,WAAW,oBAAoB;IACnC,IAAI,CAAC,EAAE,MAAM,CAAC;IACd,QAAQ,EAAE,MAAM,CAAC;IACjB,QAAQ,EAAE,MAAM,CAAC;CAClB;AAED,MAAM,WAAW,yBAAyB;IACxC,OAAO,EAAE,OAAO,CAAC;IACjB,OAAO,EAAE,OAAO,CAAC;CAClB;AAED,qBAAa,oBAAqB,SAAQ,KAAK;aAE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,EAAE,eAAe,GAAG,IAAI,CAiBpE;AAED,wBAAgB,4BAA4B,CAAC,EAAE,CAAC,EAAE,eAAe,GAAG,OAAO,GAAG,IAAI,CAEjF;AAED,wBAAgB,+BAA+B,CAAC,EAAE,CAAC,EAAE,eAAe,GAAG,MAAM,GAAG,IAAI,CAKnF;AAED,wBAAgB,YAAY,CAAC,EAAE,EAAE,MAAM,EAAE,EAAE,CAAC,EAAE,eAAe,GAAG,OAAO,CAuBtE;AAID,wBAAgB,0BAA0B,IAAI,IAAI,CAEjD;AAED,gFAAgF;AAChF,wBAAgB,mBAAmB,CAAC,EAAE,CAAC,EAAE,eAAe,GAAG,MAAM,CAsBhE"}
|
|
@@ -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;AA2D3B,wBAAgB,cAAc,CAAC,GAAG,EAAE,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,GAAG,MAAM,CAqCnE;AA6BD;;;;GAIG;AACH,wBAAgB,wBAAwB,CAAC,OAAO,EAAE,MAAM,GAAG,IAAI,GAAG,SAAS,GAAG,MAAM,GAAG,IAAI,CAW1F;AAMD,wBAAgB,YAAY,CAC1B,KAAK,EAAE,iBAAiB,EACxB,U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AiB3C,CAAC;AAEF,eAAO,MAAM,UAAU,EAAE,MAAM,
|
|
1
|
+
{"version":3,"file":"migrations.d.ts","sourceRoot":"","sources":["../../src/db/migrations.ts"],"names":[],"mappings":"AASA,eAAO,MAAM,+BAA+B,wqBAiB3C,CAAC;AAEF,eAAO,MAAM,UAAU,EAAE,MAAM,EAswC9B,CAAC"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"pg-migrate.d.ts","sourceRoot":"","sources":["../../src/db/pg-migrate.ts"],"names":[],"mappings":"AAcA,MAAM,WAAW,iBAAiB;IAChC,OAAO,EAAE,MAAM,EAAE,CAAC;IAClB,cAAc,EAAE,MAAM,EAAE,CAAC;IACzB,MAAM,EAAE,MAAM,EAAE,CAAC;IACjB,eAAe,EAAE,MAAM,CAAC;CACzB;AAED,MAAM,WAAW,sBAAsB;IACrC,EAAE,EAAE,OAAO,CAAC;IACZ,MAAM,EAAE,yBAAyB,CAAC;IAClC,UAAU,EAAE,OAAO,CAAC;IACpB,0BAA0B,EAAE,MAAM,GAAG,IAAI,CAAC;IAC1C,gBAAgB,EAAE,MAAM,CAAC;IACzB,uBAAuB,EAAE,IAAI,CAAC;IAC9B,8BAA8B,EAAE,IAAI,CAAC;IACrC,UAAU,EAAE,IAAI,CAAC;IACjB,MAAM,EAAE,MAAM,EAAE,CAAC;IACjB,QAAQ,EAAE,MAAM,EAAE,CAAC;CACpB;AAED,wBAAgB,yBAAyB,CACvC,gBAAgB,CAAC,EAAE,MAAM,GACxB,sBAAsB,CAsCxB;AAED;;;;;GAKG;AACH,wBAAsB,iBAAiB,CACrC,gBAAgB,EAAE,MAAM,GACvB,OAAO,CAAC,iBAAiB,CAAC,
|
|
1
|
+
{"version":3,"file":"pg-migrate.d.ts","sourceRoot":"","sources":["../../src/db/pg-migrate.ts"],"names":[],"mappings":"AAcA,MAAM,WAAW,iBAAiB;IAChC,OAAO,EAAE,MAAM,EAAE,CAAC;IAClB,cAAc,EAAE,MAAM,EAAE,CAAC;IACzB,MAAM,EAAE,MAAM,EAAE,CAAC;IACjB,eAAe,EAAE,MAAM,CAAC;CACzB;AAED,MAAM,WAAW,sBAAsB;IACrC,EAAE,EAAE,OAAO,CAAC;IACZ,MAAM,EAAE,yBAAyB,CAAC;IAClC,UAAU,EAAE,OAAO,CAAC;IACpB,0BAA0B,EAAE,MAAM,GAAG,IAAI,CAAC;IAC1C,gBAAgB,EAAE,MAAM,CAAC;IACzB,uBAAuB,EAAE,IAAI,CAAC;IAC9B,8BAA8B,EAAE,IAAI,CAAC;IACrC,UAAU,EAAE,IAAI,CAAC;IACjB,MAAM,EAAE,MAAM,EAAE,CAAC;IACjB,QAAQ,EAAE,MAAM,EAAE,CAAC;CACpB;AAED,wBAAgB,yBAAyB,CACvC,gBAAgB,CAAC,EAAE,MAAM,GACxB,sBAAsB,CAsCxB;AAED;;;;;GAKG;AACH,wBAAsB,iBAAiB,CACrC,gBAAgB,EAAE,MAAM,GACvB,OAAO,CAAC,iBAAiB,CAAC,CAiE5B"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"pg-migrations.d.ts","sourceRoot":"","sources":["../../src/db/pg-migrations.ts"],"names":[],"mappings":"AAYA,eAAO,MAAM,aAAa,EAAE,MAAM,
|
|
1
|
+
{"version":3,"file":"pg-migrations.d.ts","sourceRoot":"","sources":["../../src/db/pg-migrations.ts"],"names":[],"mappings":"AAYA,eAAO,MAAM,aAAa,EAAE,MAAM,EA66BjC,CAAC"}
|
|
@@ -1,6 +1,8 @@
|
|
|
1
1
|
import { SqliteAdapter as Database } from "../storage.js";
|
|
2
2
|
export type SessionJobSource = "claude-code" | "codex" | "manual" | "open-sessions";
|
|
3
3
|
export type SessionJobStatus = "pending" | "processing" | "completed" | "failed";
|
|
4
|
+
export declare const SESSION_JOBS_PAGE_CONTRACT: "mementos.sessions.jobs.v2";
|
|
5
|
+
export declare const SESSION_INGEST_CONTRACT: "mementos.sessions.ingest.v2";
|
|
4
6
|
export interface SessionMemoryJob {
|
|
5
7
|
id: string;
|
|
6
8
|
session_id: string;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"session-jobs.d.ts","sourceRoot":"","sources":["../../src/db/session-jobs.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,aAAa,IAAI,QAAQ,EAAE,MAAM,eAAe,CAAC;
|
|
1
|
+
{"version":3,"file":"session-jobs.d.ts","sourceRoot":"","sources":["../../src/db/session-jobs.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,aAAa,IAAI,QAAQ,EAAE,MAAM,eAAe,CAAC;AAe1D,MAAM,MAAM,gBAAgB,GAAG,aAAa,GAAG,OAAO,GAAG,QAAQ,GAAG,eAAe,CAAC;AACpF,MAAM,MAAM,gBAAgB,GAAG,SAAS,GAAG,YAAY,GAAG,WAAW,GAAG,QAAQ,CAAC;AACjF,eAAO,MAAM,0BAA0B,EAAG,2BAAoC,CAAC;AAC/E,eAAO,MAAM,uBAAuB,EAAG,6BAAsC,CAAC;AAE9E,MAAM,WAAW,gBAAgB;IAC/B,EAAE,EAAE,MAAM,CAAC;IACX,UAAU,EAAE,MAAM,CAAC;IACnB,QAAQ,EAAE,MAAM,GAAG,IAAI,CAAC;IACxB,UAAU,EAAE,MAAM,GAAG,IAAI,CAAC;IAC1B,MAAM,EAAE,gBAAgB,CAAC;IACzB,MAAM,EAAE,gBAAgB,CAAC;IACzB,UAAU,EAAE,MAAM,CAAC;IACnB,WAAW,EAAE,MAAM,CAAC;IACpB,kBAAkB,EAAE,MAAM,CAAC;IAC3B,KAAK,EAAE,MAAM,GAAG,IAAI,CAAC;IACrB,QAAQ,EAAE,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,CAAC;IAClC,UAAU,EAAE,MAAM,CAAC;IACnB,UAAU,EAAE,MAAM,GAAG,IAAI,CAAC;IAC1B,YAAY,EAAE,MAAM,GAAG,IAAI,CAAC;CAC7B;AAED,MAAM,WAAW,qBAAqB;IACpC,UAAU,EAAE,MAA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CAwCzB;AAED,wBAAgB,iBAAiB,CAAC,EAAE,CAAC,EAAE,QAAQ,GAAG,gBAAgB,GAAG,IAAI,CASxE;AAED;;;;;;GAMG;AACH,wBAAgB,eAAe,CAAC,EAAE,EAAE,MAAM,EAAE,EAAE,CAAC,EAAE,QAAQ,GAAG,MAAM,CAQjE;AAED;;;;;;;;GAQG;AACH,wBAAgB,0BAA0B,CAAC,QAAQ,EAAE,MAAM,EAAE,EAAE,CAAC,EAAE,QAAQ,GAAG,MAAM,CAQlF"}
|
|
@@ -1,11 +1,17 @@
|
|
|
1
1
|
/**
|
|
2
2
|
* The transport that reads and writes will actually use.
|
|
3
3
|
*
|
|
4
|
-
* - `local-sqlite` — the on-disk SQLite file at `db_path` is authoritative
|
|
4
|
+
* - `local-sqlite` — the on-disk SQLite file at `db_path` is authoritative
|
|
5
|
+
* (reached ONLY through the explicit local opt-in).
|
|
5
6
|
* - `cloud-api` — authed HTTPS to the server (the shared store).
|
|
6
7
|
* - `cloud-postgres` — a direct Postgres DSN; server-only, never a client.
|
|
8
|
+
* - `unconfigured` — nothing resolves and nothing opted in: every data verb
|
|
9
|
+
* REFUSES (fail closed, owner ruling 2026-09-04). Reported
|
|
10
|
+
* as its own answer so the probe an operator runs to find
|
|
11
|
+
* out which store they are on never claims the on-box
|
|
12
|
+
* file "by default" while every read and write refuses it.
|
|
7
13
|
*/
|
|
8
|
-
export type StoreBackend = "local-sqlite" | "cloud-api" | "cloud-postgres";
|
|
14
|
+
export type StoreBackend = "local-sqlite" | "cloud-api" | "cloud-postgres" | "unconfigured";
|
|
9
15
|
export interface StoreBackendReport {
|
|
10
16
|
/** Machine-readable contract for scripts and test guards. */
|
|
11
17
|
schema: "mementos.store_backend.v1";
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"store-backend.d.ts","sourceRoot":"","sources":["../../src/db/store-backend.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"store-backend.d.ts","sourceRoot":"","sources":["../../src/db/store-backend.ts"],"names":[],"mappings":"AA2CA;;;;;;;;;;;;GAYG;AACH,MAAM,MAAM,YAAY,GAAG,cAAc,GAAG,WAAW,GAAG,gBAAgB,GAAG,cAAc,CAAC;AAE5F,MAAM,WAAW,kBAAkB;IACjC,6DAA6D;IAC7D,MAAM,EAAE,2BAA2B,CAAC;IACpC,OAAO,EAAE,YAAY,CAAC;IACtB,iFAAiF;IACjF,QAAQ,EAAE,OAAO,CAAC;IAClB,qGAAqG;IACrG,cAAc,EAAE,MAAM,CAAC;IACvB,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,CAiExD"}
|