om-memory-system 4.24.0-next.147 → 4.25.1

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.
Files changed (57) hide show
  1. package/dist/adapters/opencode/user-prompt.js +6 -1
  2. package/dist/config.d.ts +9 -0
  3. package/dist/config.js +5 -44
  4. package/dist/core/retrieval.js +1 -1
  5. package/dist/services/chat/chat-answer.d.ts +56 -0
  6. package/dist/services/chat/chat-answer.js +88 -0
  7. package/dist/services/chat/chat-plan.d.ts +60 -0
  8. package/dist/services/chat/chat-plan.js +92 -0
  9. package/dist/services/chat/chat-retrieve.d.ts +36 -0
  10. package/dist/services/chat/chat-retrieve.js +82 -0
  11. package/dist/services/chat/chat-routes.d.ts +12 -0
  12. package/dist/services/chat/chat-routes.js +145 -0
  13. package/dist/services/chat/chat-runtime.d.ts +21 -0
  14. package/dist/services/chat/chat-runtime.js +104 -0
  15. package/dist/services/chat/chat-service.d.ts +42 -0
  16. package/dist/services/chat/chat-service.js +130 -0
  17. package/dist/services/chat/chat-status.d.ts +16 -0
  18. package/dist/services/chat/chat-status.js +23 -0
  19. package/dist/services/chat/chat-store.d.ts +60 -0
  20. package/dist/services/chat/chat-store.js +352 -0
  21. package/dist/services/chat/chat-types.d.ts +59 -0
  22. package/dist/services/chat/chat-types.js +8 -0
  23. package/dist/services/client.d.ts +1 -0
  24. package/dist/services/client.js +8 -3
  25. package/dist/services/context.d.ts +3 -1
  26. package/dist/services/context.js +4 -2
  27. package/dist/services/global-config-writer.js +8 -1
  28. package/dist/services/privacy.js +2 -2
  29. package/dist/services/settings-snapshot.js +1 -0
  30. package/dist/services/turso/exact-scan.d.ts +6 -0
  31. package/dist/services/turso/exact-scan.js +23 -0
  32. package/dist/services/turso/keyword-search.d.ts +35 -0
  33. package/dist/services/turso/keyword-search.js +153 -0
  34. package/dist/services/turso/rank-fusion.d.ts +34 -0
  35. package/dist/services/turso/rank-fusion.js +45 -0
  36. package/dist/services/turso/tag-match.d.ts +7 -0
  37. package/dist/services/turso/tag-match.js +29 -0
  38. package/dist/services/turso/types.d.ts +2 -0
  39. package/dist/services/turso/vector-search.d.ts +3 -3
  40. package/dist/services/turso/vector-search.js +23 -39
  41. package/dist/services/user-profile/profile-context.d.ts +6 -1
  42. package/dist/services/user-profile/profile-context.js +43 -7
  43. package/dist/services/user-profile/profile-relevance.d.ts +37 -0
  44. package/dist/services/user-profile/profile-relevance.js +75 -0
  45. package/dist/services/web-route-modules.d.ts +8 -0
  46. package/dist/services/web-route-modules.js +15 -0
  47. package/dist/services/web-server.js +5 -4
  48. package/dist/utils/keyword-boost.d.ts +17 -0
  49. package/dist/utils/keyword-boost.js +32 -0
  50. package/dist/utils/reranker-settings.d.ts +13 -0
  51. package/dist/utils/reranker-settings.js +48 -0
  52. package/dist/web/assets/index-CjfE2byA.js +126 -0
  53. package/dist/web/assets/index-SK0gAreR.css +2 -0
  54. package/dist/web/index.html +2 -2
  55. package/package.json +1 -1
  56. package/dist/web/assets/index-B_2GCxJJ.js +0 -127
  57. package/dist/web/assets/index-JAZ-QY-Z.css +0 -2
@@ -14,7 +14,7 @@ import { WebAuth } from "./web-auth.js";
14
14
  import { NODE_HTTP_IDLE_TIMEOUT_MS } from "./request-timeouts.js";
15
15
  import { testReranker } from "./reranker-test.js";
16
16
  import { handleListTags, handleListKeywords, handleListMemories, handleAddMemory, handleDeleteMemory, handleBulkDelete, handleUpdateMemory, handleSearch, handleStats, handlePinMemory, handleUnpinMemory, handleRunCleanup, handleRunDeduplication, handleDetectMigration, handleRunMigration, handleDetectTagMigration, handleRunTagMigrationBatch, handleGetTagMigrationProgress, handleDeletePrompt, handleBulkDeletePrompts, handleGetUserProfile, handleGetProfileChangelog, handleGetProfileSnapshot, handleRefreshProfile, handleCategoryCleanupApply, handleCategoryCleanupStart, handleCategoryCleanupStatus, handleCategoryCleanupUndo, handleUpdateProfileItem, } from "./api-handlers.js";
17
- import { routeProfileCleanup } from "./profile-cleanup-routes.js";
17
+ import { routeModules } from "./web-route-modules.js";
18
18
  const isBun = typeof globalThis.Bun !== "undefined";
19
19
  const MIN_FAILED_TAKEOVERS = 3;
20
20
  export function attachNodeDisconnectHandlers(req, res, onDisconnect) {
@@ -1349,9 +1349,10 @@ export class WebServer {
1349
1349
  const result = await handleRefreshProfile(userId);
1350
1350
  return this.jsonResponse(result);
1351
1351
  }
1352
- const cleanup = await routeProfileCleanup(path, method, url, () => req.json().catch(() => ({})));
1353
- if (cleanup !== undefined)
1354
- return this.jsonResponse(cleanup);
1352
+ const { CONFIG: config } = await import("../config.js");
1353
+ const routed = await routeModules(path, method, url, req, config);
1354
+ if (routed)
1355
+ return this.jsonResponse(routed.body, routed.status);
1355
1356
  if (path === "/api/user-profile/category-cleanup" && method === "POST") {
1356
1357
  const body = (await req.json().catch(() => ({})));
1357
1358
  return this.jsonResponse(await handleCategoryCleanupStart(body.userId || undefined));
@@ -0,0 +1,17 @@
1
+ /**
2
+ * The `keywordBoost` and `keywordMode` settings (openspec change hook-search-keywords-and-profile):
3
+ * how much a memory that contains a word of the prompt gains in search. Pure,
4
+ * so config.ts and tests share one rule without importing CONFIG.
5
+ */
6
+ export declare const KEYWORD_BOOST_DEFAULT = 0.1;
7
+ export declare const KEYWORD_BOOST_MAX = 0.5;
8
+ /**
9
+ * The setting from the file: the default when absent, otherwise a number from
10
+ * 0 to 0.5. The message names the setting and its accepted values only.
11
+ */
12
+ export declare function checkedKeywordBoost(value: unknown): number;
13
+ /** How word matches join the results: an added boost, or rank fusion (experimental). */
14
+ export type KeywordMode = "boost" | "rrf";
15
+ export declare const KEYWORD_MODES: readonly KeywordMode[];
16
+ /** The `keywordMode` setting from the file: `boost` when absent, otherwise `boost` or `rrf`. */
17
+ export declare function checkedKeywordMode(value: unknown): KeywordMode;
@@ -0,0 +1,32 @@
1
+ /**
2
+ * The `keywordBoost` and `keywordMode` settings (openspec change hook-search-keywords-and-profile):
3
+ * how much a memory that contains a word of the prompt gains in search. Pure,
4
+ * so config.ts and tests share one rule without importing CONFIG.
5
+ */
6
+ export const KEYWORD_BOOST_DEFAULT = 0.1;
7
+ export const KEYWORD_BOOST_MAX = 0.5;
8
+ /**
9
+ * The setting from the file: the default when absent, otherwise a number from
10
+ * 0 to 0.5. The message names the setting and its accepted values only.
11
+ */
12
+ export function checkedKeywordBoost(value) {
13
+ if (value === undefined)
14
+ return KEYWORD_BOOST_DEFAULT;
15
+ if (typeof value !== "number" ||
16
+ !Number.isFinite(value) ||
17
+ value < 0 ||
18
+ value > KEYWORD_BOOST_MAX) {
19
+ throw new Error(`Invalid keywordBoost config (accepted: numbers from 0 to ${KEYWORD_BOOST_MAX})`);
20
+ }
21
+ return value;
22
+ }
23
+ export const KEYWORD_MODES = ["boost", "rrf"];
24
+ /** The `keywordMode` setting from the file: `boost` when absent, otherwise `boost` or `rrf`. */
25
+ export function checkedKeywordMode(value) {
26
+ if (value === undefined)
27
+ return "boost";
28
+ if (value !== "boost" && value !== "rrf") {
29
+ throw new Error(`Invalid keywordMode config (accepted: ${KEYWORD_MODES.join(", ")})`);
30
+ }
31
+ return value;
32
+ }
@@ -0,0 +1,13 @@
1
+ export interface RerankerFileSettings {
2
+ rerankerEnabled?: boolean;
3
+ rerankerApiUrl?: string;
4
+ rerankerModel?: string;
5
+ rerankerApiKey?: string;
6
+ rerankerTimeoutMs?: number;
7
+ }
8
+ /**
9
+ * Validate the five opt-in reranker keys when present (openspec change
10
+ * retrieval-threshold-and-reranker). Messages name the setting and its
11
+ * accepted values only; the value is never quoted back.
12
+ */
13
+ export declare function checkedRerankerSettings(fileConfig: RerankerFileSettings): void;
@@ -0,0 +1,48 @@
1
+ /**
2
+ * Validation of the opt-in reranker keys. Lives outside src/config.ts, which is
3
+ * at its size ceiling; config.ts calls it while building CONFIG.
4
+ */
5
+ import { RERANKER_TIMEOUT_MAX_MS, RERANKER_TIMEOUT_MIN_MS } from "../services/request-timeouts.js";
6
+ /** The reranker key must be a reference, never a literal secret in the file. */
7
+ function isRerankerKeyReference(value) {
8
+ return /^(env:\/\/[A-Za-z_][A-Za-z0-9_]*|file:\/\/.+)$/.test(value.trim());
9
+ }
10
+ /**
11
+ * Validate the five opt-in reranker keys when present (openspec change
12
+ * retrieval-threshold-and-reranker). Messages name the setting and its
13
+ * accepted values only; the value is never quoted back.
14
+ */
15
+ export function checkedRerankerSettings(fileConfig) {
16
+ const invalid = (setting, accepted) => new Error(`Invalid ${setting} config (accepted: ${accepted})`);
17
+ if (fileConfig.rerankerEnabled !== undefined && typeof fileConfig.rerankerEnabled !== "boolean") {
18
+ throw invalid("rerankerEnabled", "boolean");
19
+ }
20
+ for (const key of ["rerankerApiUrl", "rerankerModel"]) {
21
+ const value = fileConfig[key];
22
+ if (value === undefined)
23
+ continue;
24
+ if (typeof value !== "string" || value.trim().length === 0) {
25
+ throw invalid(key, "a non-empty string");
26
+ }
27
+ }
28
+ if (fileConfig.rerankerApiUrl !== undefined &&
29
+ !/^https?:\/\/\S+$/.test(fileConfig.rerankerApiUrl.trim())) {
30
+ throw invalid("rerankerApiUrl", "an http:// or https:// URL");
31
+ }
32
+ if (fileConfig.rerankerApiKey !== undefined) {
33
+ if (typeof fileConfig.rerankerApiKey !== "string" ||
34
+ !isRerankerKeyReference(fileConfig.rerankerApiKey)) {
35
+ throw invalid("rerankerApiKey", "an env:// or file:// secret reference");
36
+ }
37
+ }
38
+ if (fileConfig.rerankerTimeoutMs !== undefined) {
39
+ const value = fileConfig.rerankerTimeoutMs;
40
+ const ok = typeof value === "number" &&
41
+ Number.isSafeInteger(value) &&
42
+ value >= RERANKER_TIMEOUT_MIN_MS &&
43
+ value <= RERANKER_TIMEOUT_MAX_MS;
44
+ if (!ok) {
45
+ throw invalid("rerankerTimeoutMs", `integers from ${RERANKER_TIMEOUT_MIN_MS} to ${RERANKER_TIMEOUT_MAX_MS}`);
46
+ }
47
+ }
48
+ }