@remnic/core 9.46.1 → 9.47.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.
Files changed (122) hide show
  1. package/dist/access-admin-ops-surface.d.ts +2 -2
  2. package/dist/access-admin-ops-surface.js +3 -2
  3. package/dist/access-authorization-probe.d.ts +2 -2
  4. package/dist/access-authorization-probe.js +4 -3
  5. package/dist/access-boundary.d.ts +2 -2
  6. package/dist/access-boundary.js +3 -2
  7. package/dist/access-cli.js +16 -16
  8. package/dist/access-extraction-force-flush.d.ts +2 -2
  9. package/dist/access-extraction-force-flush.js +3 -2
  10. package/dist/access-http-lcm-compaction.d.ts +2 -2
  11. package/dist/access-http-lcm-compaction.js +1 -1
  12. package/dist/access-http-lifecycle-flush.d.ts +2 -2
  13. package/dist/access-http-lifecycle-flush.js +2 -2
  14. package/dist/access-http-offline-stream.d.ts +2 -2
  15. package/dist/access-http-query.js +3 -2
  16. package/dist/access-http.d.ts +8 -2
  17. package/dist/access-http.js +11 -10
  18. package/dist/access-identity-continuity-surface.d.ts +1 -1
  19. package/dist/access-identity-continuity-surface.js +3 -2
  20. package/dist/access-lcm-surface.d.ts +2 -2
  21. package/dist/access-lcm-surface.js +3 -2
  22. package/dist/access-mcp.d.ts +2 -2
  23. package/dist/access-mcp.js +7 -6
  24. package/dist/access-memory-search-fanout.d.ts +163 -2
  25. package/dist/access-memory-search-fanout.js +20 -3
  26. package/dist/access-namespace-preflight.js +3 -2
  27. package/dist/access-observe-write-surface.d.ts +2 -2
  28. package/dist/access-observe-write-surface.js +3 -2
  29. package/dist/access-offline-manifest.d.ts +1 -1
  30. package/dist/access-operations-batch.js +4 -3
  31. package/dist/access-operations.d.ts +6 -5
  32. package/dist/access-operations.js +6 -5
  33. package/dist/access-recall-concurrency.d.ts +2 -2
  34. package/dist/access-recall-concurrency.js +3 -2
  35. package/dist/access-recall-response.d.ts +2 -2
  36. package/dist/access-recall-response.js +3 -2
  37. package/dist/access-recall-surface.d.ts +2 -2
  38. package/dist/access-recall-surface.js +3 -2
  39. package/dist/access-schema.d.ts +84 -84
  40. package/dist/{access-service-loJadYd7.d.ts → access-service-DNBYHK33.d.ts} +2 -1
  41. package/dist/access-service-helpers.d.ts +2 -2
  42. package/dist/access-service.d.ts +2 -2
  43. package/dist/access-service.js +3 -2
  44. package/dist/access-surface-catalog.d.ts +2 -2
  45. package/dist/access-surface-catalog.js +1 -0
  46. package/dist/access-surface-catalog.js.map +1 -1
  47. package/dist/active-recall.js +2 -2
  48. package/dist/bootstrap.d.ts +1 -1
  49. package/dist/{chunk-WHWDBTCJ.js → chunk-74HN5QUH.js} +2 -2
  50. package/dist/{chunk-2DSUT7DZ.js → chunk-FQU3HTQM.js} +40 -11
  51. package/dist/chunk-FQU3HTQM.js.map +1 -0
  52. package/dist/{chunk-5LRDM4R7.js → chunk-G2L5IZV4.js} +7 -7
  53. package/dist/{chunk-TQZ4DVBC.js → chunk-GZ3R6XOE.js} +5 -2
  54. package/dist/chunk-GZ3R6XOE.js.map +1 -0
  55. package/dist/{chunk-5546W5SI.js → chunk-HLKPRWF4.js} +2 -2
  56. package/dist/chunk-IXEBUYO4.js +201 -0
  57. package/dist/chunk-IXEBUYO4.js.map +1 -0
  58. package/dist/{chunk-RCU25Z66.js → chunk-IXH2U2QT.js} +169 -58
  59. package/dist/chunk-IXH2U2QT.js.map +1 -0
  60. package/dist/{chunk-HJ3SVHUW.js → chunk-IZQ5TDFT.js} +9 -4
  61. package/dist/chunk-IZQ5TDFT.js.map +1 -0
  62. package/dist/{chunk-RVPTS4U5.js → chunk-JCNJIXZN.js} +2 -2
  63. package/dist/{chunk-5R6S4DJZ.js → chunk-N5XULCU3.js} +2 -2
  64. package/dist/{chunk-6H744ZBH.js → chunk-QISYTKG4.js} +2 -2
  65. package/dist/{chunk-AUMWZSE7.js → chunk-RN53QBM4.js} +4 -4
  66. package/dist/{chunk-M32URQXV.js → chunk-SIP5DBDN.js} +275 -334
  67. package/dist/chunk-SIP5DBDN.js.map +1 -0
  68. package/dist/{chunk-44N6ESJ4.js → chunk-TIDEL77O.js} +2 -2
  69. package/dist/{chunk-XBMJ35IP.js → chunk-VFZS2HAA.js} +4 -3
  70. package/dist/chunk-VFZS2HAA.js.map +1 -0
  71. package/dist/{cli-D_RcqXfZ.d.ts → cli-BWXSPxB9.d.ts} +2 -2
  72. package/dist/cli.d.ts +3 -3
  73. package/dist/cli.js +15 -15
  74. package/dist/config.js +2 -2
  75. package/dist/explicit-capture.d.ts +1 -1
  76. package/dist/external-wiki-access.d.ts +2 -2
  77. package/dist/external-wiki-access.js +4 -3
  78. package/dist/external-wiki-mcp-tools.d.ts +2 -2
  79. package/dist/index.d.ts +680 -680
  80. package/dist/index.js +16 -16
  81. package/dist/mcp-memory-inspector-app.d.ts +2 -2
  82. package/dist/operator-toolkit.js +3 -3
  83. package/dist/{orchestrator-LPGegii3.d.ts → orchestrator-CRR-6sVB.d.ts} +6 -0
  84. package/dist/orchestrator.d.ts +1 -1
  85. package/dist/orchestrator.js +17 -17
  86. package/dist/resume-bundles.js +3 -3
  87. package/dist/schemas.d.ts +76 -76
  88. package/dist/shared-context/manager.d.ts +8 -8
  89. package/dist/skills-registry.js +2 -2
  90. package/dist/skills-registry.js.map +1 -1
  91. package/dist/transfer/types.d.ts +66 -66
  92. package/package.json +2 -2
  93. package/skills/remnic-memory-workflow/SKILL.md +1 -1
  94. package/skills/remnic-remember/SKILL.md +1 -1
  95. package/src/access-http-lcm-compaction.ts +3 -0
  96. package/src/access-http.test.ts +645 -0
  97. package/src/access-http.ts +55 -4
  98. package/src/access-mcp.ts +1 -0
  99. package/src/access-memory-search-fanout.ts +305 -2
  100. package/src/access-operations.ts +6 -0
  101. package/src/access-service-namespace.test.ts +146 -0
  102. package/src/access-service.ts +39 -40
  103. package/src/access-surface-catalog.ts +1 -0
  104. package/src/orchestration/generic-recall-paths.ts +116 -5
  105. package/src/skills-registry.test.ts +14 -0
  106. package/src/skills-registry.ts +2 -2
  107. package/dist/chunk-2DSUT7DZ.js.map +0 -1
  108. package/dist/chunk-7HXCF4RE.js +0 -72
  109. package/dist/chunk-7HXCF4RE.js.map +0 -1
  110. package/dist/chunk-HJ3SVHUW.js.map +0 -1
  111. package/dist/chunk-M32URQXV.js.map +0 -1
  112. package/dist/chunk-RCU25Z66.js.map +0 -1
  113. package/dist/chunk-TQZ4DVBC.js.map +0 -1
  114. package/dist/chunk-XBMJ35IP.js.map +0 -1
  115. /package/dist/{chunk-WHWDBTCJ.js.map → chunk-74HN5QUH.js.map} +0 -0
  116. /package/dist/{chunk-5LRDM4R7.js.map → chunk-G2L5IZV4.js.map} +0 -0
  117. /package/dist/{chunk-5546W5SI.js.map → chunk-HLKPRWF4.js.map} +0 -0
  118. /package/dist/{chunk-RVPTS4U5.js.map → chunk-JCNJIXZN.js.map} +0 -0
  119. /package/dist/{chunk-5R6S4DJZ.js.map → chunk-N5XULCU3.js.map} +0 -0
  120. /package/dist/{chunk-6H744ZBH.js.map → chunk-QISYTKG4.js.map} +0 -0
  121. /package/dist/{chunk-AUMWZSE7.js.map → chunk-RN53QBM4.js.map} +0 -0
  122. /package/dist/{chunk-44N6ESJ4.js.map → chunk-TIDEL77O.js.map} +0 -0
@@ -158,12 +158,18 @@ import {
158
158
  supersessionKeysForFact
159
159
  } from "./chunk-DNHVPZOD.js";
160
160
  import {
161
- ExtractionDeadlineError
161
+ ExtractionDeadlineError,
162
+ isActivityDigestPath,
163
+ isArtifactMemoryPath,
164
+ isMeetingRecordPath
162
165
  } from "./chunk-N3LL5NEU.js";
163
166
  import {
164
167
  ExtractionLivenessWarnThrottle,
165
168
  computeExtractionLivenessStatus
166
169
  } from "./chunk-3SG4FGDV.js";
170
+ import {
171
+ isExternalWikiCollectionName
172
+ } from "./chunk-JV3C2MNQ.js";
167
173
  import {
168
174
  sanitizeMemoryContent
169
175
  } from "./chunk-5GKPFL3S.js";
@@ -192,10 +198,10 @@ import {
192
198
  } from "./chunk-SYOIVK7K.js";
193
199
  import {
194
200
  defaultNamespaceAtFlatRoot,
201
+ memorySearchThroughScope,
195
202
  mergeMemorySearchDefaultFallback,
196
- resolveMemorySearchDefaultFallback,
197
- runMemorySearchFanout
198
- } from "./chunk-7HXCF4RE.js";
203
+ resolveMemorySearchDefaultFallback
204
+ } from "./chunk-IXEBUYO4.js";
199
205
  import {
200
206
  PendingObserveExtractionTracker,
201
207
  pendingObserveScopeHint
@@ -321,6 +327,9 @@ import {
321
327
  import {
322
328
  SecureStoreLockedError
323
329
  } from "./chunk-XQ3HXAQH.js";
330
+ import {
331
+ ALL_CATEGORY_DIRS
332
+ } from "./chunk-VS2IYZRU.js";
324
333
  import {
325
334
  recordCitationUsage
326
335
  } from "./chunk-NINSR6LX.js";
@@ -4793,10 +4802,110 @@ function buildNotificationSummary(plan) {
4793
4802
  return `${plan.classification}: ${plan.request.text.slice(0, 60)}${plan.request.text.length > 60 ? "..." : ""} (${target})`;
4794
4803
  }
4795
4804
 
4805
+ // src/orchestration/generic-recall-paths.ts
4806
+ import path6 from "path";
4807
+ var CATEGORY_MEMORY_ROOTS = Object.fromEntries(
4808
+ ALL_CATEGORY_DIRS.map((directory) => [directory, true])
4809
+ );
4810
+ var RESERVED_ARCHIVE_ROOTS = { archive: true, namespaces: true };
4811
+ function isQmdCollectionPrefix(prefix, collection, source) {
4812
+ if (typeof collection !== "string" || collection.length === 0) return false;
4813
+ if (prefix.startsWith(`${collection}--`)) return true;
4814
+ if (prefix !== collection) return false;
4815
+ if (source === "qmd") return true;
4816
+ return !Object.hasOwn(CATEGORY_MEMORY_ROOTS, prefix) && !Object.hasOwn(RESERVED_ARCHIVE_ROOTS, prefix);
4817
+ }
4818
+ function normalizeQmdUriPath(relativePath, source) {
4819
+ if (source !== "qmd" || !relativePath.startsWith("qmd://")) return relativePath;
4820
+ try {
4821
+ const parsed = new URL(relativePath);
4822
+ if (parsed.protocol !== "qmd:" || !parsed.hostname) return relativePath;
4823
+ const collection = decodeURIComponent(parsed.hostname);
4824
+ const pathname = decodeURIComponent(parsed.pathname.replace(/^\/+/, ""));
4825
+ return pathname ? `${collection}/${pathname}` : collection;
4826
+ } catch {
4827
+ return relativePath;
4828
+ }
4829
+ }
4830
+ function stripQmdCollectionPrefix(relativePath, policy, source) {
4831
+ const normalized = path6.posix.normalize(normalizeQmdUriPath(relativePath, source).replace(/\\/g, "/"));
4832
+ const slashIndex = normalized.indexOf("/");
4833
+ if (slashIndex <= 0 || slashIndex >= normalized.length - 1) return normalized;
4834
+ const prefix = normalized.slice(0, slashIndex);
4835
+ const matchesHotCollection = isQmdCollectionPrefix(prefix, policy.qmdCollection, source);
4836
+ const matchesColdCollection = isQmdCollectionPrefix(prefix, policy.qmdColdCollection, source);
4837
+ return matchesHotCollection || matchesColdCollection ? normalized.slice(slashIndex + 1) : normalized;
4838
+ }
4839
+ function isTopLevelArchivePath(filePath, policy = {}, source = "filesystem") {
4840
+ const isAbsolutePath = path6.isAbsolute(filePath);
4841
+ const relative2 = policy.memoryDir && isAbsolutePath ? path6.relative(policy.memoryDir, path6.resolve(filePath)) : filePath;
4842
+ const normalized = !isAbsolutePath ? stripQmdCollectionPrefix(relative2, policy, source) : relative2;
4843
+ return /^(?:archive|namespaces[\\/][^\\/]+[\\/]archive)(?:[\\/]|$)/i.test(normalized);
4844
+ }
4845
+ function isExternalWikiQmdPath(filePath, source) {
4846
+ if (source !== "qmd") return false;
4847
+ const normalized = normalizeQmdUriPath(filePath, source).replace(/\\/g, "/");
4848
+ const slashIndex = normalized.indexOf("/");
4849
+ const collection = slashIndex === -1 ? normalized : normalized.slice(0, slashIndex);
4850
+ return isExternalWikiCollectionName(collection);
4851
+ }
4852
+ function isSearchExcludedPath(filePath, policy = {}, source = "filesystem") {
4853
+ if (isExternalWikiQmdPath(filePath, source)) return true;
4854
+ for (const candidate of collectionSpellings(filePath, policy, source)) {
4855
+ if (isArtifactMemoryPath(candidate) || isNamespacedActivityDigestPath(candidate, policy.memoryDir) || isMeetingRecordPath(candidate)) {
4856
+ return true;
4857
+ }
4858
+ }
4859
+ return false;
4860
+ }
4861
+ function isNamespacedActivityDigestPath(candidate, memoryDir) {
4862
+ if (isActivityDigestPath(candidate, memoryDir)) return true;
4863
+ if (memoryDir === void 0 || memoryDir.length === 0) return false;
4864
+ const relative2 = path6.relative(memoryDir, path6.resolve(memoryDir, candidate));
4865
+ const namespaced = /^namespaces[\\/]([^\\/]+)[\\/](.*)$/.exec(relative2);
4866
+ if (namespaced === null) return false;
4867
+ return isActivityDigestPath(namespaced[2] ?? "", memoryDir);
4868
+ }
4869
+ function collectionSpellings(filePath, policy, source) {
4870
+ if (path6.isAbsolute(filePath)) return [filePath];
4871
+ if (source === "qmd" && filePath.startsWith("qmd://")) {
4872
+ const normalized2 = path6.posix.normalize(normalizeQmdUriPath(filePath, source).replace(/\\/g, "/"));
4873
+ const slashIndex2 = normalized2.indexOf("/");
4874
+ return slashIndex2 <= 0 || slashIndex2 >= normalized2.length - 1 ? [normalized2] : [normalized2, normalized2.slice(slashIndex2 + 1)];
4875
+ }
4876
+ const normalized = path6.posix.normalize(
4877
+ normalizeQmdUriPath(filePath, source).replace(/\\/g, "/")
4878
+ );
4879
+ const stripped = stripQmdCollectionPrefix(filePath, policy, source);
4880
+ const spellings = [stripped];
4881
+ if (stripped !== normalized) return spellings;
4882
+ const slashIndex = stripped.indexOf("/");
4883
+ if (slashIndex <= 0 || slashIndex >= stripped.length - 1) return spellings;
4884
+ const prefix = stripped.slice(0, slashIndex);
4885
+ const requested = policy.requestedCollection;
4886
+ if (prefix !== requested && (Object.hasOwn(CATEGORY_MEMORY_ROOTS, prefix) || Object.hasOwn(RESERVED_ARCHIVE_ROOTS, prefix))) {
4887
+ return spellings;
4888
+ }
4889
+ spellings.push(stripped.slice(slashIndex + 1));
4890
+ return spellings;
4891
+ }
4892
+ function isGenericRecallExcludedPath(filePath, policy = {}, source = "filesystem") {
4893
+ return isSearchExcludedPath(filePath, policy, source) || // Recall-only: archived memories are cold, but an explicit search is one
4894
+ // of the surfaces they remain reachable through.
4895
+ isTopLevelArchivePath(filePath, policy, source);
4896
+ }
4897
+ function filterRecallCandidates(candidates, options) {
4898
+ const pathPolicy = options.pathPolicy ?? (options.memoryRoot === void 0 ? void 0 : { memoryDir: options.memoryRoot });
4899
+ const scopedByNamespace = options.namespacesEnabled ? candidates.filter(
4900
+ (r) => options.recallNamespaces.includes(r.namespace ?? options.resolveNamespace(r.path))
4901
+ ) : candidates;
4902
+ return scopedByNamespace.filter((r) => !isGenericRecallExcludedPath(r.path, pathPolicy, "qmd")).slice(0, Math.max(0, options.limit));
4903
+ }
4904
+
4796
4905
  // src/procedural/procedure-miner.ts
4797
4906
  import { createHash as createHash3 } from "crypto";
4798
4907
  import { mkdir as mkdir2, rm, stat } from "fs/promises";
4799
- import path6 from "path";
4908
+ import path7 from "path";
4800
4909
 
4801
4910
  // src/procedural/reinforcement-core.ts
4802
4911
  function clusterByKey(items, keyFn) {
@@ -4849,8 +4958,8 @@ function sleep(ms) {
4849
4958
  return new Promise((resolve4) => setTimeout(resolve4, ms));
4850
4959
  }
4851
4960
  async function acquireClusterWriteLock(memoryDir, clusterHash) {
4852
- const lockRoot = path6.join(path6.resolve(memoryDir), "state", "procedure-miner-locks");
4853
- const lockDir = path6.join(lockRoot, `${clusterHash}.lock`);
4961
+ const lockRoot = path7.join(path7.resolve(memoryDir), "state", "procedure-miner-locks");
4962
+ const lockDir = path7.join(lockRoot, `${clusterHash}.lock`);
4854
4963
  await mkdir2(lockRoot, { recursive: true });
4855
4964
  const startedAt = Date.now();
4856
4965
  let attempts = 0;
@@ -4881,7 +4990,7 @@ async function acquireClusterWriteLock(memoryDir, clusterHash) {
4881
4990
  }
4882
4991
  }
4883
4992
  async function withClusterWriteLock(memoryDir, clusterHash, fn) {
4884
- const inProcessKey = `${path6.resolve(memoryDir)}:${clusterHash}`;
4993
+ const inProcessKey = `${path7.resolve(memoryDir)}:${clusterHash}`;
4885
4994
  const previous = inProcessClusterWriteLocks.get(inProcessKey) ?? Promise.resolve();
4886
4995
  let releaseInProcess;
4887
4996
  const current = previous.catch(() => void 0).then(
@@ -5338,10 +5447,10 @@ function formatZodIssues(error) {
5338
5447
  const parts = [];
5339
5448
  for (const issue of error.issues) {
5340
5449
  const hasNumeric = issue.path.some((p) => typeof p === "number");
5341
- const path9 = hasNumeric ? issue.path.filter((p) => typeof p === "string").join(".") || "(root)" : issue.path.length > 0 ? issue.path.join(".") : "(root)";
5450
+ const path10 = hasNumeric ? issue.path.filter((p) => typeof p === "string").join(".") || "(root)" : issue.path.length > 0 ? issue.path.join(".") : "(root)";
5342
5451
  const options = enumOptionsFromIssue(issue);
5343
5452
  const suffix = options ? `. Valid: ${options.join(", ")}` : "";
5344
- parts.push(`${path9}: ${issue.message}${suffix}`);
5453
+ parts.push(`${path10}: ${issue.message}${suffix}`);
5345
5454
  }
5346
5455
  return parts.length > 0 ? `request validation failed: ${parts.join("; ")}` : "request validation failed";
5347
5456
  }
@@ -5480,7 +5589,7 @@ function resolveQueryNamespaceWritablePreflight(caps, params, authenticatedPrinc
5480
5589
  }
5481
5590
 
5482
5591
  // src/admin/admin-surfaces.ts
5483
- import path7 from "path";
5592
+ import path8 from "path";
5484
5593
  var REDACTED = "<redacted>";
5485
5594
  var SENSITIVE_KEY_RE = /(token|secret|password|api[_-]?key|bearer|authorization|credential|private[_-]?key)/i;
5486
5595
  var BEARER_VALUE_RE = /^(bearer|sk-|pk-|xox[bp]-|AKIA)/i;
@@ -5763,7 +5872,7 @@ async function auditTranscripts(memoryDir) {
5763
5872
  movedEntries: file.groups.reduce((sum, group) => sum + group.entryCount, 0),
5764
5873
  unmovableLines: file.unmovableLines
5765
5874
  }));
5766
- const mixedOtherDefault = files.some((file) => file.sourceRelPath.split(path7.sep).includes("other"));
5875
+ const mixedOtherDefault = files.some((file) => file.sourceRelPath.split(path8.sep).includes("other"));
5767
5876
  const summary = plan.movedEntries === 0 ? "No mixed-session transcript data detected; nothing to migrate." : `Found ${plan.movedEntries} entries across ${plan.distinctSessions} distinct sessions stranded in shared/legacy directories. Run the CLI migration command to re-home them.`;
5768
5877
  return {
5769
5878
  generatedAt: plan.generatedAt,
@@ -8129,7 +8238,7 @@ import { createHash as createHash5 } from "crypto";
8129
8238
  import * as nodePath2 from "path";
8130
8239
 
8131
8240
  // src/orchestration/recall-result-formatter.ts
8132
- import path8 from "path";
8241
+ import path9 from "path";
8133
8242
  function renderConnectorLabel(connector) {
8134
8243
  if (!isValidConnectorId(connector)) return null;
8135
8244
  return connector.length <= CONNECTOR_LABEL_MAX_LENGTH ? connector : `${connector.slice(0, CONNECTOR_LABEL_MAX_LENGTH - 1)}\u2026`;
@@ -8151,15 +8260,15 @@ function resolveEffectiveIdentityInjectionMode(options) {
8151
8260
  return { mode: options.configuredMode, shouldInject: true };
8152
8261
  }
8153
8262
  function displayResultPath(resultPath, memoryDir, namespace) {
8154
- if (!path8.isAbsolute(resultPath)) return resultPath;
8155
- const root = path8.resolve(memoryDir);
8156
- const nsRoot = path8.join(root, "namespaces");
8157
- if (namespace && (resultPath === nsRoot || resultPath.startsWith(nsRoot + path8.sep))) {
8158
- const afterNs = path8.relative(nsRoot, resultPath).split(path8.sep).slice(1).join("/");
8263
+ if (!path9.isAbsolute(resultPath)) return resultPath;
8264
+ const root = path9.resolve(memoryDir);
8265
+ const nsRoot = path9.join(root, "namespaces");
8266
+ if (namespace && (resultPath === nsRoot || resultPath.startsWith(nsRoot + path9.sep))) {
8267
+ const afterNs = path9.relative(nsRoot, resultPath).split(path9.sep).slice(1).join("/");
8159
8268
  if (afterNs) return `${namespace}/${afterNs}`;
8160
8269
  }
8161
- const rel = path8.relative(root, resultPath);
8162
- return rel && !rel.startsWith("..") && !path8.isAbsolute(rel) ? rel.split(path8.sep).join("/") : resultPath;
8270
+ const rel = path9.relative(root, resultPath);
8271
+ return rel && !rel.startsWith("..") && !path9.isAbsolute(rel) ? rel.split(path9.sep).join("/") : resultPath;
8163
8272
  }
8164
8273
  function displaySafeBudgetsApplied(budgetsApplied, memoryDir) {
8165
8274
  if (!budgetsApplied?.includedMemoryPaths) return budgetsApplied;
@@ -12146,41 +12255,40 @@ var EngramAccessService = class {
12146
12255
  }
12147
12256
  // ── Memory search & debug ─────────────────────────────────────────────
12148
12257
  async memorySearch(request) {
12149
- const { query, namespace, maxResults, principal } = request;
12150
- const collection = request.collection?.trim();
12151
- if (request.collection !== void 0 && !collection) {
12152
- throw new EngramAccessInputError("collection must be a non-empty string");
12153
- }
12154
- let results;
12155
- if (!resolveNamespaceCapabilities(this.orchestrator.config).namespaces) {
12156
- this.resolveReadableNamespace(namespace, principal);
12157
- results = collection === "global" ? await this.orchestrator.qmd.searchGlobal(query, maxResults) : await this.orchestrator.qmd.search(query, collection, maxResults);
12158
- } else {
12159
- const readableNamespaces = await this.resolveReadableNamespacesForSearch(namespace, principal);
12160
- const namespaces = this.resolveMemorySearchNamespacesForCollection(
12161
- collection,
12162
- readableNamespaces,
12163
- namespace?.trim() ? void 0 : principal
12164
- );
12165
- results = await runMemorySearchFanout({
12166
- query,
12167
- namespaces,
12168
- maxResults,
12169
- principal,
12170
- requestedNamespace: namespace,
12171
- collection,
12172
- search: (params) => this.orchestrator.searchAcrossNamespaces(params)
12173
- });
12174
- }
12175
- return {
12176
- query,
12177
- results: results.map((r) => ({
12178
- path: r.path,
12179
- score: r.score,
12180
- snippet: (r.snippet ?? "").slice(0, 800)
12181
- })),
12182
- count: results.length
12183
- };
12258
+ const { qmd, config } = this.orchestrator;
12259
+ return memorySearchThroughScope(
12260
+ {
12261
+ namespacesEnabled: resolveNamespaceCapabilities(config).namespaces,
12262
+ // `0` is preserved, never coerced: a zero limit is a runtime
12263
+ // compatibility guarantee (AGENTS.md guardrail 4), and it means the
12264
+ // same thing here as an explicit `maxResults: 0` from the caller - an
12265
+ // empty result with no backend call. Anything non-numeric falls back
12266
+ // to the documented default.
12267
+ defaultBudget: typeof config.qmdMaxResults === "number" ? config.qmdMaxResults : 10,
12268
+ // Search-specific: artifacts and the other dedicated surfaces stay
12269
+ // out, but ARCHIVED memories remain findable - explicit search is one
12270
+ // of the surfaces the lifecycle reserves them for.
12271
+ isExcluded: (memoryPath) => isSearchExcludedPath(
12272
+ memoryPath,
12273
+ // The caller's own collection disambiguates a prefix that is also
12274
+ // a memory category name (`collection: "facts"`).
12275
+ { ...config, requestedCollection: request.collection?.trim() || void 0 },
12276
+ "qmd"
12277
+ ),
12278
+ authorizeFlatCorpus: (namespace, principal) => {
12279
+ this.resolveReadableNamespace(namespace, principal);
12280
+ },
12281
+ authorizeNamespaces: async (namespace, principal, collection) => this.resolveMemorySearchNamespacesForCollection(
12282
+ collection,
12283
+ await this.resolveReadableNamespacesForSearch(namespace, principal),
12284
+ namespace?.trim() ? void 0 : principal
12285
+ ),
12286
+ searchAcrossNamespaces: (params) => this.orchestrator.searchAcrossNamespaces(params),
12287
+ searchGlobal: (query, maxResults) => qmd.searchGlobal(query, maxResults),
12288
+ search: (query, collection, maxResults) => qmd.search(query, collection, maxResults)
12289
+ },
12290
+ request
12291
+ );
12184
12292
  }
12185
12293
  async memoryProfile(namespace, principal) {
12186
12294
  const resolvedNs = this.resolveReadableNamespace(namespace, principal);
@@ -12702,7 +12810,7 @@ var EngramAccessService = class {
12702
12810
  const resolvedNamespace = this.resolveReadableNamespace(options.namespace, options.principal);
12703
12811
  const storage = await offlineSyncStorageForSnapshot(this.orchestrator, resolvedNamespace);
12704
12812
  const storageHash = createHash6("sha256").update(storage.dir).digest("hex").slice(0, 16);
12705
- const deletions = [...await storage.readDeletionRevisions()].map(([path9, mtimeMs]) => ({ path: path9, mtimeMs }));
12813
+ const deletions = [...await storage.readDeletionRevisions()].map(([path10, mtimeMs]) => ({ path: path10, mtimeMs }));
12706
12814
  const snapshotBuilder = options.includeContent === false && options.baseFiles && options.baseFiles.length > 0 ? buildOfflineSyncSnapshotFromBase : buildOfflineSyncSnapshot;
12707
12815
  const snapshot = await snapshotBuilder({
12708
12816
  root: storage.dir,
@@ -12727,7 +12835,7 @@ var EngramAccessService = class {
12727
12835
  const storageHash = createHash6("sha256").update(storage.dir).digest("hex").slice(0, 16);
12728
12836
  const deletions = await filterOfflineSyncDeletionRevisions({
12729
12837
  root: storage.dir,
12730
- deletions: [...await storage.readDeletionRevisions()].map(([path9, mtimeMs]) => ({ path: path9, mtimeMs })),
12838
+ deletions: [...await storage.readDeletionRevisions()].map(([path10, mtimeMs]) => ({ path: path10, mtimeMs })),
12731
12839
  includeTranscripts: options.includeTranscripts !== false,
12732
12840
  userExcludeRegexps: this.offlineSyncUserExcludes
12733
12841
  });
@@ -13376,6 +13484,9 @@ export {
13376
13484
  CorrectionContractError,
13377
13485
  detectPassiveCorrections,
13378
13486
  capturePassiveCorrections,
13487
+ isTopLevelArchivePath,
13488
+ isGenericRecallExcludedPath,
13489
+ filterRecallCandidates,
13379
13490
  clusterByKey,
13380
13491
  computeProcedureStats,
13381
13492
  formatProcedureStatsText,
@@ -13412,4 +13523,4 @@ export {
13412
13523
  EngramAccessService,
13413
13524
  AccessAdminOpsSurface
13414
13525
  };
13415
- //# sourceMappingURL=chunk-RCU25Z66.js.map
13526
+ //# sourceMappingURL=chunk-IXH2U2QT.js.map