@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/server/auth.d.ts
CHANGED
|
@@ -1,4 +1,6 @@
|
|
|
1
1
|
import { type ApiKeyVerifier } from "@hasna/contracts/auth";
|
|
2
|
+
/** True when {@link checkApiKey} verified an explicit API key on this request. */
|
|
3
|
+
export declare function isAuthenticated(req: Request): boolean;
|
|
2
4
|
/** Lazily build the contracts verifier. Returns null when auth is disabled. */
|
|
3
5
|
export declare function getApiKeyVerifier(): ApiKeyVerifier | null;
|
|
4
6
|
/**
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"auth.d.ts","sourceRoot":"","sources":["../../src/server/auth.ts"],"names":[],"mappings":"AAqBA,OAAO,EAGL,KAAK,cAAc,EAEpB,MAAM,uBAAuB,CAAC;
|
|
1
|
+
{"version":3,"file":"auth.d.ts","sourceRoot":"","sources":["../../src/server/auth.ts"],"names":[],"mappings":"AAqBA,OAAO,EAGL,KAAK,cAAc,EAEpB,MAAM,uBAAuB,CAAC;AAwB/B,kFAAkF;AAClF,wBAAgB,eAAe,CAAC,GAAG,EAAE,OAAO,GAAG,OAAO,CAErD;AAkCD,+EAA+E;AAC/E,wBAAgB,iBAAiB,IAAI,cAAc,GAAG,IAAI,CAuCzD;AAED;;;GAGG;AACH,wBAAsB,WAAW,CAC/B,GAAG,EAAE,OAAO,EACZ,MAAM,EAAE,MAAM,EACd,IAAI,EAAE,MAAM,EACZ,cAAc,CAAC,EAAE,SAAS,MAAM,EAAE,GACjC,OAAO,CAAC,QAAQ,GAAG,IAAI,CAAC,CA6B1B;AAED,mFAAmF;AACnF,wBAAgB,iBAAiB,IAAI,OAAO,CAE3C"}
|
package/dist/server/helpers.d.ts
CHANGED
|
@@ -6,8 +6,9 @@ export declare function isStateChangingMethod(method: string): boolean;
|
|
|
6
6
|
*
|
|
7
7
|
* `MEMENTOS_CORS_ORIGIN` accepts a comma-separated list; each entry may be a
|
|
8
8
|
* full origin (`http://localhost:19428`) or a bare `host[:port]`. The default
|
|
9
|
-
* is the
|
|
10
|
-
* which fails closed (no origin or host is allowed to mutate
|
|
9
|
+
* is the mementos server's own origin. An empty value yields an empty
|
|
10
|
+
* allowlist, which fails closed (no origin or host is allowed to mutate
|
|
11
|
+
* state).
|
|
11
12
|
*/
|
|
12
13
|
export declare function getAllowedOrigins(): string[];
|
|
13
14
|
/**
|
|
@@ -18,8 +19,13 @@ export declare function getAllowedOrigins(): string[];
|
|
|
18
19
|
* This is the non-OPTIONS sibling of the preflight gate: a hostile page can
|
|
19
20
|
* forge a POST/PATCH/DELETE with any Origin it likes, so those methods must
|
|
20
21
|
* be allowlisted on every request, not only at preflight time.
|
|
22
|
+
*
|
|
23
|
+
* `authenticated` marks a request whose API key was already verified (see
|
|
24
|
+
* auth.ts `checkApiKey`): such a request is not CSRF, so the ambient-credential
|
|
25
|
+
* gate is skipped for it when it carries no Origin header (the CLI/MCP/SDK
|
|
26
|
+
* client shape). See `checkWriteOriginOrHost`.
|
|
21
27
|
*/
|
|
22
|
-
export declare function checkOriginOrHost(req: Request, method: string): Response | null;
|
|
28
|
+
export declare function checkOriginOrHost(req: Request, method: string, authenticated?: boolean): Response | null;
|
|
23
29
|
/**
|
|
24
30
|
* The allowlist check itself: reject a request whose Origin (when present) or
|
|
25
31
|
* Host (when no Origin is present) is not on the configured allowlist.
|
|
@@ -28,9 +34,19 @@ export declare function checkOriginOrHost(req: Request, method: string): Respons
|
|
|
28
34
|
* trigger one with no preflight — so a GET route whose handler writes state
|
|
29
35
|
* (a touch/recency update, a cache write, an LLM call) must be gated exactly
|
|
30
36
|
* like a state-changing method, even though its HTTP method is not one.
|
|
37
|
+
*
|
|
38
|
+
* `authenticated` exempts requests that carry a VERIFIED explicit API key and
|
|
39
|
+
* no Origin header. The allowlist is an ambient-credential (CSRF) defense: a
|
|
40
|
+
* hostile page cannot attach the Authorization header without CORS preflight
|
|
41
|
+
* (which is separately allowlisted) and cannot read the key, so a keyed
|
|
42
|
+
* request with no Origin is not CSRF and must be served regardless of
|
|
43
|
+
* MEMENTOS_CORS_ORIGIN — a deployment that omits the env var (or a client
|
|
44
|
+
* reaching the server through a Host the allowlist does not name) must not
|
|
45
|
+
* take down every CLI/MCP/SDK client with 403 'Host is not allowed'.
|
|
46
|
+
* Browser-context requests — any request WITH an Origin header — keep the
|
|
47
|
+
* full Origin allowlist even when keyed, as defense in depth.
|
|
31
48
|
*/
|
|
32
|
-
export declare function checkWriteOriginOrHost(req: Request): Response | null;
|
|
33
|
-
export declare const MIME_TYPES: Record<string, string>;
|
|
49
|
+
export declare function checkWriteOriginOrHost(req: Request, authenticated?: boolean): Response | null;
|
|
34
50
|
export declare function json(data: unknown, status?: number): Response;
|
|
35
51
|
export declare function errorResponse(message: string, status: number, details?: unknown): Response;
|
|
36
52
|
/**
|
|
@@ -48,6 +64,4 @@ export declare function readJson(req: Request): Promise<unknown>;
|
|
|
48
64
|
export declare function getCorsHeaders(req?: Request): Record<string, string>;
|
|
49
65
|
export declare function authenticateRequest(req: Request): Response | null;
|
|
50
66
|
export declare function getSearchParams(url: URL): Record<string, string>;
|
|
51
|
-
export declare function resolveDashboardDir(): string;
|
|
52
|
-
export declare function serveStaticFile(filePath: string): Response | null;
|
|
53
67
|
//# sourceMappingURL=helpers.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"helpers.d.ts","sourceRoot":"","sources":["../../src/server/helpers.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"helpers.d.ts","sourceRoot":"","sources":["../../src/server/helpers.ts"],"names":[],"mappings":"AAKA,eAAO,MAAM,YAAY,EAAE,MAAM,CAAC,MAAM,EAAE,MAAM,CAK/C,CAAC;AAQF,8EAA8E;AAC9E,wBAAgB,qBAAqB,CAAC,MAAM,EAAE,MAAM,GAAG,OAAO,CAE7D;AAED;;;;;;;;GAQG;AACH,wBAAgB,iBAAiB,IAAI,MAAM,EAAE,CAM5C;AAWD;;;;;;;;;;;;;GAaG;AACH,wBAAgB,iBAAiB,CAAC,GAAG,EAAE,OAAO,EAAE,MAAM,EAAE,MAAM,EAAE,aAAa,UAAQ,GAAG,QAAQ,GAAG,IAAI,CAGtG;AAED;;;;;;;;;;;;;;;;;;;GAmBG;AACH,wBAAgB,sBAAsB,CAAC,GAAG,EAAE,OAAO,EAAE,aAAa,UAAQ,GAAG,QAAQ,GAAG,IAAI,CAmB3F;AAMD,wBAAgB,IAAI,CAAC,IAAI,EAAE,OAAO,EAAE,MAAM,SAAM,GAAG,QAAQ,CAK1D;AAED,wBAAgB,aAAa,CAC3B,OAAO,EAAE,MAAM,EACf,MAAM,EAAE,MAAM,EACd,OAAO,CAAC,EAAE,OAAO,GAChB,QAAQ,CAIV;AAED;;;;;;;;;GASG;AACH,wBAAgB,2BAA2B,CAAC,CAAC,EAAE,OAAO,GAAG,MAAM,GAAG,IAAI,CAWrE;AAKD,wBAAsB,QAAQ,CAAC,GAAG,EAAE,OAAO,GAAG,OAAO,CAAC,OAAO,CAAC,CAU7D;AAMD,wBAAgB,cAAc,CAAC,GAAG,CAAC,EAAE,OAAO,GAAG,MAAM,CAAC,MAAM,EAAE,MAAM,CAAC,CAWpE;AAED,wBAAgB,mBAAmB,CAAC,GAAG,EAAE,OAAO,GAAG,QAAQ,GAAG,IAAI,CAqBjE;AAED,wBAAgB,eAAe,CAAC,GAAG,EAAE,GAAG,GAAG,MAAM,CAAC,MAAM,EAAE,MAAM,CAAC,CAMhE"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/server/index.ts"],"names":[],"mappings":";AACA;;;GAGG;
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/server/index.ts"],"names":[],"mappings":";AACA;;;GAGG;AA6CH,OAAO,sBAAsB,CAAC;AAC9B,OAAO,oBAAoB,CAAC;AAC5B,OAAO,sBAAsB,CAAC;AAC9B,OAAO,kCAAkC,CAAC;AAC1C,OAAO,sBAAsB,CAAC;AAC9B,OAAO,mBAAmB,CAAC;AAC3B,OAAO,oBAAoB,CAAC;AA8F5B,wBAAgB,WAAW,CAAC,IAAI,EAAE,MAAM,GAAG,IAAI,CAqM9C"}
|