@remnic/core 9.3.654 → 9.3.656

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 (281) hide show
  1. package/dist/access-cli.js +29 -29
  2. package/dist/access-http.d.ts +4 -4
  3. package/dist/access-http.js +17 -17
  4. package/dist/access-mcp.d.ts +4 -4
  5. package/dist/access-mcp.js +16 -16
  6. package/dist/access-schema.d.ts +10 -10
  7. package/dist/{access-service-C8A5hoXJ.d.ts → access-service-D_nbpexW.d.ts} +33 -2
  8. package/dist/access-service.d.ts +4 -4
  9. package/dist/access-service.js +15 -15
  10. package/dist/action-confidence.d.ts +1 -1
  11. package/dist/active-memory-bridge.d.ts +1 -1
  12. package/dist/active-recall.d.ts +1 -1
  13. package/dist/active-recall.js +1 -1
  14. package/dist/behavior-learner.d.ts +1 -1
  15. package/dist/behavior-signals.d.ts +1 -1
  16. package/dist/bootstrap.d.ts +3 -3
  17. package/dist/briefing.d.ts +1 -1
  18. package/dist/briefing.js +3 -3
  19. package/dist/buffer-surprise-report.d.ts +1 -1
  20. package/dist/buffer.d.ts +1 -1
  21. package/dist/calibration.d.ts +1 -1
  22. package/dist/causal-behavior.d.ts +1 -1
  23. package/dist/causal-consolidation.d.ts +1 -1
  24. package/dist/causal-consolidation.js +4 -4
  25. package/dist/{chunk-JMQSYGXS.js → chunk-2BD7DG37.js} +2 -2
  26. package/dist/{chunk-FVRBLJP6.js → chunk-2MXEVL75.js} +2 -2
  27. package/dist/{chunk-LJCEWTG3.js → chunk-4UL7VPTD.js} +277 -58
  28. package/dist/chunk-4UL7VPTD.js.map +1 -0
  29. package/dist/{chunk-JYN7QNTA.js → chunk-54XF2FY7.js} +17 -17
  30. package/dist/{chunk-7WEB3FLJ.js → chunk-5PLUC5OB.js} +2 -2
  31. package/dist/{chunk-JX2RINDR.js → chunk-6G5JEN55.js} +2 -2
  32. package/dist/{chunk-ZCORQM74.js → chunk-AGJKWOKV.js} +2 -2
  33. package/dist/{chunk-NE2JBMLN.js → chunk-AZBV4RRY.js} +1 -1
  34. package/dist/chunk-AZBV4RRY.js.map +1 -0
  35. package/dist/{chunk-YLZLPVKK.js → chunk-CTAV55JM.js} +344 -1
  36. package/dist/chunk-CTAV55JM.js.map +1 -0
  37. package/dist/{chunk-2DSTAWNZ.js → chunk-DIBWFCLA.js} +3 -3
  38. package/dist/{chunk-NAZWHTYV.js → chunk-DR67OK4E.js} +5 -5
  39. package/dist/{chunk-XBIACVCO.js → chunk-EC2AYKRX.js} +2 -2
  40. package/dist/{chunk-JVRPJ7D4.js → chunk-EKQMQQ3U.js} +48 -12
  41. package/dist/chunk-EKQMQQ3U.js.map +1 -0
  42. package/dist/{chunk-RGPUQ66K.js → chunk-GCYFUTUC.js} +2 -2
  43. package/dist/{chunk-JBHXMCYN.js → chunk-GRYAECRV.js} +2 -2
  44. package/dist/{chunk-BJA6DQOC.js → chunk-GSHW5VVD.js} +5 -5
  45. package/dist/chunk-GYSYLGNE.js +650 -0
  46. package/dist/chunk-GYSYLGNE.js.map +1 -0
  47. package/dist/{chunk-NCGWXCSW.js → chunk-IOZ5WBWD.js} +2 -2
  48. package/dist/{chunk-QKK64Z6M.js → chunk-JSVFEHLL.js} +7 -5
  49. package/dist/chunk-JSVFEHLL.js.map +1 -0
  50. package/dist/{chunk-7LWRCOP7.js → chunk-LZTFCAKE.js} +2 -2
  51. package/dist/{chunk-2DGQLOOM.js → chunk-M3VYPE2H.js} +1 -1
  52. package/dist/{chunk-2DGQLOOM.js.map → chunk-M3VYPE2H.js.map} +1 -1
  53. package/dist/{chunk-6CVI6BP6.js → chunk-NXCK7DO7.js} +2 -2
  54. package/dist/{chunk-Z5MQI7K2.js → chunk-PEPHBH2W.js} +2 -2
  55. package/dist/{chunk-PYWNNF2I.js → chunk-QRSKPI62.js} +99 -66
  56. package/dist/chunk-QRSKPI62.js.map +1 -0
  57. package/dist/{chunk-XWQ6ERUG.js → chunk-QZRKNA5F.js} +2 -2
  58. package/dist/{chunk-PS3SYNHP.js → chunk-R5DB26G6.js} +2 -2
  59. package/dist/{chunk-OL2364SB.js → chunk-RDW5G6DO.js} +1502 -335
  60. package/dist/chunk-RDW5G6DO.js.map +1 -0
  61. package/dist/{chunk-YM3LR4LS.js → chunk-SSSXWIBP.js} +5 -5
  62. package/dist/{chunk-T2C6QJG2.js → chunk-SWDHVH2P.js} +2 -2
  63. package/dist/{chunk-DBM2BD22.js → chunk-SXYCVRLK.js} +3 -3
  64. package/dist/{chunk-K6X553JB.js → chunk-TFFZUFEP.js} +7 -5
  65. package/dist/chunk-TFFZUFEP.js.map +1 -0
  66. package/dist/{chunk-ENV6RDTD.js → chunk-TIJYQXDI.js} +2 -2
  67. package/dist/{chunk-BP2EV6W5.js → chunk-VAEAGTEQ.js} +4 -4
  68. package/dist/{chunk-3RACUBII.js → chunk-WIKMCJUR.js} +2 -2
  69. package/dist/{chunk-QW6JZO5P.js → chunk-WWMHAMAY.js} +2 -2
  70. package/dist/{chunk-GPW2E4LN.js → chunk-YEZHZCUO.js} +4 -4
  71. package/dist/{chunk-5FOCXX5E.js → chunk-YVVQUAOO.js} +3 -3
  72. package/dist/{chunk-5FOCXX5E.js.map → chunk-YVVQUAOO.js.map} +1 -1
  73. package/dist/{chunk-3XGWCZ63.js → chunk-YXLT4EMM.js} +2 -2
  74. package/dist/{chunk-Y2RIIF6H.js → chunk-Z6UDTNY6.js} +2 -2
  75. package/dist/{cli-uQgvDFNE.d.ts → cli-aYxSuPvP.d.ts} +3 -3
  76. package/dist/cli.d.ts +5 -5
  77. package/dist/cli.js +29 -29
  78. package/dist/compounding/engine.d.ts +1 -1
  79. package/dist/compounding/engine.js +3 -3
  80. package/dist/compounding/preference-consolidator.d.ts +1 -1
  81. package/dist/compression-optimizer.d.ts +1 -1
  82. package/dist/config.d.ts +1 -1
  83. package/dist/config.js +1 -1
  84. package/dist/connectors/codex-materialize-runner.d.ts +1 -1
  85. package/dist/connectors/codex-materialize-runner.js +3 -3
  86. package/dist/connectors/codex-materialize.d.ts +1 -1
  87. package/dist/connectors/index.d.ts +1 -1
  88. package/dist/connectors/index.js +3 -3
  89. package/dist/consolidation-provenance-check.d.ts +1 -1
  90. package/dist/consolidation-undo.d.ts +1 -1
  91. package/dist/contradiction/index.d.ts +1 -1
  92. package/dist/conversation-index/backend.d.ts +1 -1
  93. package/dist/conversation-index/chunker.d.ts +1 -1
  94. package/dist/conversation-index/faiss-adapter.d.ts +1 -1
  95. package/dist/conversation-index/indexer.d.ts +1 -1
  96. package/dist/conversation-index/search.d.ts +1 -1
  97. package/dist/day-summary.d.ts +1 -1
  98. package/dist/delinearize.d.ts +1 -1
  99. package/dist/direct-answer-wiring.d.ts +1 -1
  100. package/dist/direct-answer.d.ts +1 -1
  101. package/dist/embedding-fallback.d.ts +1 -1
  102. package/dist/enrichment/index.d.ts +1 -1
  103. package/dist/entity-retrieval.d.ts +1 -1
  104. package/dist/entity-retrieval.js +3 -3
  105. package/dist/entity-schema.d.ts +1 -1
  106. package/dist/explicit-capture.d.ts +3 -3
  107. package/dist/explicit-cue-recall.js +2 -2
  108. package/dist/extraction-judge-telemetry.d.ts +1 -1
  109. package/dist/extraction-judge-training.d.ts +1 -1
  110. package/dist/extraction-judge.d.ts +1 -1
  111. package/dist/extraction.d.ts +1 -1
  112. package/dist/fallback-llm.d.ts +1 -1
  113. package/dist/focused-list-recall.js +2 -2
  114. package/dist/identity-continuity.d.ts +1 -1
  115. package/dist/importance.d.ts +1 -1
  116. package/dist/index.d.ts +121 -121
  117. package/dist/index.js +39 -39
  118. package/dist/intent.d.ts +1 -1
  119. package/dist/lcm/engine.d.ts +1 -1
  120. package/dist/lcm/index.d.ts +1 -1
  121. package/dist/lcm/tools.d.ts +1 -1
  122. package/dist/lcm-fallback-read.js +1 -1
  123. package/dist/lifecycle.d.ts +1 -1
  124. package/dist/live-connectors-runner.d.ts +1 -1
  125. package/dist/local-llm.d.ts +1 -1
  126. package/dist/maintenance/memory-governance.d.ts +1 -1
  127. package/dist/maintenance/memory-governance.js +3 -3
  128. package/dist/maintenance/rebuild-memory-lifecycle-ledger.js +3 -3
  129. package/dist/maintenance/rebuild-memory-projection.js +4 -4
  130. package/dist/mcp-memory-inspector-app.d.ts +4 -4
  131. package/dist/memory-action-policy.d.ts +1 -1
  132. package/dist/memory-cache.d.ts +1 -1
  133. package/dist/memory-lifecycle-ledger-utils.d.ts +1 -1
  134. package/dist/memory-projection-store.d.ts +1 -1
  135. package/dist/memory-provenance.d.ts +1 -1
  136. package/dist/memory-worth-outcomes.d.ts +1 -1
  137. package/dist/models-json.d.ts +1 -1
  138. package/dist/namespaces/migrate.d.ts +1 -1
  139. package/dist/namespaces/migrate.js +11 -11
  140. package/dist/namespaces/principal.d.ts +1 -1
  141. package/dist/namespaces/search.d.ts +15 -4
  142. package/dist/namespaces/search.js +7 -7
  143. package/dist/namespaces/storage.d.ts +1 -1
  144. package/dist/namespaces/storage.js +3 -3
  145. package/dist/native-knowledge.d.ts +1 -1
  146. package/dist/operator-toolkit.d.ts +1 -1
  147. package/dist/operator-toolkit.js +14 -14
  148. package/dist/{orchestrator-B4Y4sWQH.d.ts → orchestrator-D1wcmPNj.d.ts} +17 -14
  149. package/dist/orchestrator.d.ts +3 -3
  150. package/dist/orchestrator.js +25 -25
  151. package/dist/patterns-cli.d.ts +1 -1
  152. package/dist/policy-runtime.d.ts +1 -1
  153. package/dist/qmd-recall-cache.d.ts +1 -1
  154. package/dist/qmd.d.ts +5 -1
  155. package/dist/qmd.js +2 -2
  156. package/dist/recall-disclosure-escalation.d.ts +1 -1
  157. package/dist/recall-explain-renderer.d.ts +1 -1
  158. package/dist/recall-explain-renderer.js +3 -3
  159. package/dist/recall-planner-llm.d.ts +1 -1
  160. package/dist/recall-state.d.ts +1 -1
  161. package/dist/recall-tag-filter.d.ts +1 -1
  162. package/dist/recall-xray-cli.d.ts +1 -1
  163. package/dist/recall-xray-cli.js +4 -4
  164. package/dist/recall-xray-renderer.d.ts +1 -1
  165. package/dist/recall-xray-renderer.js +3 -3
  166. package/dist/recall-xray.d.ts +1 -1
  167. package/dist/recall-xray.js +2 -2
  168. package/dist/resolve-auth-token.d.ts +1 -1
  169. package/dist/response-guidance-recall.js +2 -2
  170. package/dist/resume-bundles.js +2 -2
  171. package/dist/retrieval-agents.d.ts +1 -1
  172. package/dist/retrieval-tiers.d.ts +1 -1
  173. package/dist/routing/engine.d.ts +1 -1
  174. package/dist/routing/store.d.ts +1 -1
  175. package/dist/schemas.d.ts +22 -22
  176. package/dist/search/embed-helper.d.ts +1 -1
  177. package/dist/search/factory.d.ts +1 -1
  178. package/dist/search/factory.js +6 -6
  179. package/dist/search/index.d.ts +1 -1
  180. package/dist/search/index.js +6 -6
  181. package/dist/search/lancedb-backend.d.ts +1 -1
  182. package/dist/search/lancedb-backend.js +2 -2
  183. package/dist/search/meilisearch-backend.d.ts +1 -1
  184. package/dist/search/meilisearch-backend.js +2 -2
  185. package/dist/search/noop-backend.d.ts +1 -1
  186. package/dist/search/orama-backend.d.ts +1 -1
  187. package/dist/search/orama-backend.js +2 -2
  188. package/dist/search/port.d.ts +17 -1
  189. package/dist/search/port.js +1 -1
  190. package/dist/search/remote-backend.d.ts +1 -1
  191. package/dist/{semantic-consolidation-BKd0Pype.d.ts → semantic-consolidation-MWOdNtSE.d.ts} +1 -1
  192. package/dist/semantic-consolidation.d.ts +2 -2
  193. package/dist/semantic-consolidation.js +4 -4
  194. package/dist/semantic-rule-promotion.js +3 -3
  195. package/dist/semantic-rule-verifier.d.ts +3 -2
  196. package/dist/semantic-rule-verifier.js +5 -3
  197. package/dist/session-observer-bands.d.ts +1 -1
  198. package/dist/session-observer-state.d.ts +1 -1
  199. package/dist/shared-context/manager.d.ts +1 -1
  200. package/dist/signal.d.ts +1 -1
  201. package/dist/storage.d.ts +1 -1
  202. package/dist/storage.js +2 -2
  203. package/dist/summarizer.d.ts +1 -1
  204. package/dist/summary-snapshot.d.ts +1 -1
  205. package/dist/targeted-fact-recall.js +2 -2
  206. package/dist/temporal-supersession.d.ts +1 -1
  207. package/dist/temporal-validity.d.ts +1 -1
  208. package/dist/threading.d.ts +1 -1
  209. package/dist/tier-migration.d.ts +1 -1
  210. package/dist/tier-routing.d.ts +1 -1
  211. package/dist/topics.d.ts +1 -1
  212. package/dist/transcript.d.ts +1 -1
  213. package/dist/transfer/types.d.ts +12 -12
  214. package/dist/{types-BgChEr0M.d.ts → types-CgcCpUrf.d.ts} +51 -1
  215. package/dist/types.d.ts +1 -1
  216. package/dist/types.js +1 -1
  217. package/dist/utility-runtime.d.ts +1 -1
  218. package/dist/verified-recall.d.ts +2 -1
  219. package/dist/verified-recall.js +5 -3
  220. package/package.json +1 -1
  221. package/src/access-service-observe-lcm-parity.test.ts +86 -1
  222. package/src/access-service-observe-scope.test.ts +283 -1
  223. package/src/access-service-raw-excerpt-read-gate.test.ts +53 -0
  224. package/src/access-service.ts +391 -93
  225. package/src/coding/coding-namespace.ts +0 -3
  226. package/src/config.test.ts +69 -0
  227. package/src/config.ts +417 -0
  228. package/src/lcm-fallback-read.ts +2 -6
  229. package/src/maintenance/namespace-planner.test.ts +1120 -0
  230. package/src/maintenance/namespace-planner.ts +893 -0
  231. package/src/namespaces/scope-profiles.test.ts +1074 -0
  232. package/src/namespaces/scope-profiles.ts +456 -0
  233. package/src/namespaces/search.test.ts +130 -2
  234. package/src/namespaces/search.ts +71 -10
  235. package/src/orchestrator-flush.test.ts +606 -44
  236. package/src/orchestrator-source-attribution.test.ts +73 -0
  237. package/src/orchestrator.ts +932 -229
  238. package/src/qmd-client.test.ts +59 -0
  239. package/src/qmd.ts +124 -84
  240. package/src/search/port.ts +16 -0
  241. package/src/semantic-rule-verifier.ts +13 -6
  242. package/src/types.ts +64 -0
  243. package/src/verified-recall.ts +10 -6
  244. package/dist/chunk-JVRPJ7D4.js.map +0 -1
  245. package/dist/chunk-K6X553JB.js.map +0 -1
  246. package/dist/chunk-LJCEWTG3.js.map +0 -1
  247. package/dist/chunk-MMJANTJX.js +0 -339
  248. package/dist/chunk-MMJANTJX.js.map +0 -1
  249. package/dist/chunk-NE2JBMLN.js.map +0 -1
  250. package/dist/chunk-OL2364SB.js.map +0 -1
  251. package/dist/chunk-PYWNNF2I.js.map +0 -1
  252. package/dist/chunk-QKK64Z6M.js.map +0 -1
  253. package/dist/chunk-YLZLPVKK.js.map +0 -1
  254. /package/dist/{chunk-JMQSYGXS.js.map → chunk-2BD7DG37.js.map} +0 -0
  255. /package/dist/{chunk-FVRBLJP6.js.map → chunk-2MXEVL75.js.map} +0 -0
  256. /package/dist/{chunk-JYN7QNTA.js.map → chunk-54XF2FY7.js.map} +0 -0
  257. /package/dist/{chunk-7WEB3FLJ.js.map → chunk-5PLUC5OB.js.map} +0 -0
  258. /package/dist/{chunk-JX2RINDR.js.map → chunk-6G5JEN55.js.map} +0 -0
  259. /package/dist/{chunk-ZCORQM74.js.map → chunk-AGJKWOKV.js.map} +0 -0
  260. /package/dist/{chunk-2DSTAWNZ.js.map → chunk-DIBWFCLA.js.map} +0 -0
  261. /package/dist/{chunk-NAZWHTYV.js.map → chunk-DR67OK4E.js.map} +0 -0
  262. /package/dist/{chunk-XBIACVCO.js.map → chunk-EC2AYKRX.js.map} +0 -0
  263. /package/dist/{chunk-RGPUQ66K.js.map → chunk-GCYFUTUC.js.map} +0 -0
  264. /package/dist/{chunk-JBHXMCYN.js.map → chunk-GRYAECRV.js.map} +0 -0
  265. /package/dist/{chunk-BJA6DQOC.js.map → chunk-GSHW5VVD.js.map} +0 -0
  266. /package/dist/{chunk-NCGWXCSW.js.map → chunk-IOZ5WBWD.js.map} +0 -0
  267. /package/dist/{chunk-7LWRCOP7.js.map → chunk-LZTFCAKE.js.map} +0 -0
  268. /package/dist/{chunk-6CVI6BP6.js.map → chunk-NXCK7DO7.js.map} +0 -0
  269. /package/dist/{chunk-Z5MQI7K2.js.map → chunk-PEPHBH2W.js.map} +0 -0
  270. /package/dist/{chunk-XWQ6ERUG.js.map → chunk-QZRKNA5F.js.map} +0 -0
  271. /package/dist/{chunk-PS3SYNHP.js.map → chunk-R5DB26G6.js.map} +0 -0
  272. /package/dist/{chunk-YM3LR4LS.js.map → chunk-SSSXWIBP.js.map} +0 -0
  273. /package/dist/{chunk-T2C6QJG2.js.map → chunk-SWDHVH2P.js.map} +0 -0
  274. /package/dist/{chunk-DBM2BD22.js.map → chunk-SXYCVRLK.js.map} +0 -0
  275. /package/dist/{chunk-ENV6RDTD.js.map → chunk-TIJYQXDI.js.map} +0 -0
  276. /package/dist/{chunk-BP2EV6W5.js.map → chunk-VAEAGTEQ.js.map} +0 -0
  277. /package/dist/{chunk-3RACUBII.js.map → chunk-WIKMCJUR.js.map} +0 -0
  278. /package/dist/{chunk-QW6JZO5P.js.map → chunk-WWMHAMAY.js.map} +0 -0
  279. /package/dist/{chunk-GPW2E4LN.js.map → chunk-YEZHZCUO.js.map} +0 -0
  280. /package/dist/{chunk-3XGWCZ63.js.map → chunk-YXLT4EMM.js.map} +0 -0
  281. /package/dist/{chunk-Y2RIIF6H.js.map → chunk-Z6UDTNY6.js.map} +0 -0
@@ -373,6 +373,228 @@ var LEGACY_ACTIVE_RECALL_CUSTOM_FIELD = [
373
373
  "Prompt",
374
374
  "Override"
375
375
  ].join("");
376
+ var SCOPE_PROFILE_LAYER_IDS = [
377
+ "userProject",
378
+ "teamProject",
379
+ "userGlobal",
380
+ "serverShared"
381
+ ];
382
+ var SCOPE_PROFILE_PROMOTION_TARGETS = [
383
+ ...SCOPE_PROFILE_LAYER_IDS
384
+ ];
385
+ var SCOPE_PROFILE_AUTO_PROMOTE_CATEGORIES = [
386
+ "fact",
387
+ "correction",
388
+ "decision",
389
+ "preference",
390
+ "rule",
391
+ "procedure"
392
+ ];
393
+ var CONFIDENCE_TIERS = [
394
+ "explicit",
395
+ "implied",
396
+ "inferred",
397
+ "speculative"
398
+ ];
399
+ function isRecord(value) {
400
+ return typeof value === "object" && value !== null && !Array.isArray(value);
401
+ }
402
+ function parseStringList(value, keyName) {
403
+ if (value === void 0 || value === null) return [];
404
+ if (!Array.isArray(value)) {
405
+ throw new Error(keyName + " must be an array");
406
+ }
407
+ const out = [];
408
+ for (const entry of value) {
409
+ if (typeof entry !== "string" || entry.length === 0) {
410
+ throw new Error(keyName + " must contain only non-empty strings");
411
+ }
412
+ out.push(entry);
413
+ }
414
+ return out;
415
+ }
416
+ function parseScopeProfileLayerList(value, keyName, fallback) {
417
+ if (value === void 0 || value === null) return [...fallback];
418
+ if (!Array.isArray(value)) {
419
+ throw new Error(`${keyName} must be an array`);
420
+ }
421
+ const out = [];
422
+ for (const entry of value) {
423
+ if (!SCOPE_PROFILE_LAYER_IDS.includes(entry)) {
424
+ throw new Error(`${keyName} contains unsupported layer: ${String(entry)}`);
425
+ }
426
+ if (!out.includes(entry)) {
427
+ out.push(entry);
428
+ }
429
+ }
430
+ return out;
431
+ }
432
+ function parseScopeProfilePromotionTargets(value, keyName) {
433
+ if (value === void 0 || value === null) return [];
434
+ if (!Array.isArray(value)) {
435
+ throw new Error(`${keyName} must be an array`);
436
+ }
437
+ const out = [];
438
+ for (const entry of value) {
439
+ if (!SCOPE_PROFILE_PROMOTION_TARGETS.includes(entry)) {
440
+ throw new Error(`${keyName} contains unsupported target: ${String(entry)}`);
441
+ }
442
+ if (!out.includes(entry)) {
443
+ out.push(entry);
444
+ }
445
+ }
446
+ return out;
447
+ }
448
+ function parseScopeProfiles(value) {
449
+ if (value === void 0 || value === null) return {};
450
+ if (!isRecord(value)) {
451
+ throw new Error("scopeProfiles must be an object");
452
+ }
453
+ const profiles = {};
454
+ for (const [profileId, rawProfile] of Object.entries(value)) {
455
+ if (profileId.trim().length === 0) {
456
+ throw new Error("scopeProfiles keys must not be empty");
457
+ }
458
+ if (!isRecord(rawProfile)) {
459
+ throw new Error(`scopeProfiles.${profileId} must be an object`);
460
+ }
461
+ const readOrder = parseScopeProfileLayerList(
462
+ rawProfile.readOrder,
463
+ `scopeProfiles.${profileId}.readOrder`,
464
+ ["userProject", "userGlobal", "serverShared"]
465
+ );
466
+ const writeDefault = rawProfile.writeDefault === void 0 || rawProfile.writeDefault === null ? "userProject" : rawProfile.writeDefault;
467
+ if (!SCOPE_PROFILE_LAYER_IDS.includes(writeDefault)) {
468
+ throw new Error(`scopeProfiles.${profileId}.writeDefault contains unsupported layer: ${String(writeDefault)}`);
469
+ }
470
+ if (rawProfile.teamProject !== void 0 && rawProfile.teamProject !== null && !isRecord(rawProfile.teamProject)) {
471
+ throw new Error("scopeProfiles." + profileId + ".teamProject must be an object");
472
+ }
473
+ const teamProject = (() => {
474
+ if (!isRecord(rawProfile.teamProject)) return void 0;
475
+ const out = {};
476
+ if (rawProfile.teamProject.namespaceTemplate !== void 0) {
477
+ if (typeof rawProfile.teamProject.namespaceTemplate !== "string" || rawProfile.teamProject.namespaceTemplate.length === 0) {
478
+ throw new Error(
479
+ `scopeProfiles.${profileId}.teamProject.namespaceTemplate must be a non-empty string`
480
+ );
481
+ }
482
+ out.namespaceTemplate = rawProfile.teamProject.namespaceTemplate;
483
+ }
484
+ if (rawProfile.teamProject.teamId !== void 0) {
485
+ if (typeof rawProfile.teamProject.teamId !== "string" || rawProfile.teamProject.teamId.length === 0) {
486
+ throw new Error(
487
+ `scopeProfiles.${profileId}.teamProject.teamId must be a non-empty string`
488
+ );
489
+ }
490
+ out.teamId = rawProfile.teamProject.teamId;
491
+ }
492
+ return out;
493
+ })();
494
+ if (rawProfile.autoPromote !== void 0 && rawProfile.autoPromote !== null && !isRecord(rawProfile.autoPromote)) {
495
+ throw new Error(`scopeProfiles.${profileId}.autoPromote must be an object`);
496
+ }
497
+ const rawAutoPromote = isRecord(rawProfile.autoPromote) ? rawProfile.autoPromote : {};
498
+ const hasAutoPromoteEnabled = Object.prototype.hasOwnProperty.call(
499
+ rawAutoPromote,
500
+ "enabled"
501
+ );
502
+ const autoPromoteEnabled = coerceBool(rawAutoPromote.enabled);
503
+ if (hasAutoPromoteEnabled && autoPromoteEnabled === void 0) {
504
+ throw new Error(
505
+ `scopeProfiles.${profileId}.autoPromote.enabled must be a boolean or boolean-like string`
506
+ );
507
+ }
508
+ const minConfidenceTier = (() => {
509
+ const rawTier = rawAutoPromote.minConfidenceTier;
510
+ if (rawTier === void 0 || rawTier === null) return "explicit";
511
+ if (typeof rawTier !== "string" || !CONFIDENCE_TIERS.includes(rawTier)) {
512
+ throw new Error(
513
+ `scopeProfiles.${profileId}.autoPromote.minConfidenceTier must be one of: ${CONFIDENCE_TIERS.join(", ")}`
514
+ );
515
+ }
516
+ return rawTier;
517
+ })();
518
+ const autoPromoteCategories = (() => {
519
+ if (rawAutoPromote.categories === void 0 || rawAutoPromote.categories === null) {
520
+ return ["fact", "correction", "decision", "preference"];
521
+ }
522
+ if (!Array.isArray(rawAutoPromote.categories)) {
523
+ throw new Error(
524
+ `scopeProfiles.${profileId}.autoPromote.categories must be an array`
525
+ );
526
+ }
527
+ const categories = [];
528
+ for (const entry of rawAutoPromote.categories) {
529
+ if (typeof entry !== "string" || !SCOPE_PROFILE_AUTO_PROMOTE_CATEGORIES.includes(entry)) {
530
+ throw new Error(
531
+ "scopeProfiles." + profileId + ".autoPromote.categories must contain only: " + SCOPE_PROFILE_AUTO_PROMOTE_CATEGORIES.join(", ")
532
+ );
533
+ }
534
+ categories.push(entry);
535
+ }
536
+ return categories;
537
+ })();
538
+ profiles[profileId] = {
539
+ readOrder,
540
+ writeDefault,
541
+ promotionTargets: parseScopeProfilePromotionTargets(
542
+ rawProfile.promotionTargets,
543
+ `scopeProfiles.${profileId}.promotionTargets`
544
+ ),
545
+ ...teamProject && Object.keys(teamProject).length > 0 ? { teamProject } : {},
546
+ autoPromote: {
547
+ enabled: autoPromoteEnabled === true,
548
+ targets: parseScopeProfilePromotionTargets(
549
+ rawAutoPromote.targets,
550
+ `scopeProfiles.${profileId}.autoPromote.targets`
551
+ ),
552
+ categories: autoPromoteCategories,
553
+ minConfidenceTier
554
+ }
555
+ };
556
+ }
557
+ return profiles;
558
+ }
559
+ function parseScopeTeams(value) {
560
+ if (value === void 0 || value === null) return {};
561
+ if (!isRecord(value)) {
562
+ throw new Error("teams must be an object");
563
+ }
564
+ const teams = {};
565
+ for (const [teamId, rawTeam] of Object.entries(value)) {
566
+ if (teamId.trim().length === 0) {
567
+ throw new Error("teams keys must not be empty");
568
+ }
569
+ if (!isRecord(rawTeam)) {
570
+ throw new Error(`teams.${teamId} must be an object`);
571
+ }
572
+ const projectNamespaceTemplate = rawTeam.projectNamespaceTemplate;
573
+ if (projectNamespaceTemplate !== void 0) {
574
+ if (typeof projectNamespaceTemplate !== "string" || projectNamespaceTemplate.length === 0) {
575
+ throw new Error(`teams.${teamId}.projectNamespaceTemplate must be a non-empty string`);
576
+ }
577
+ }
578
+ teams[teamId] = {
579
+ principals: parseStringList(rawTeam.principals, `teams.${teamId}.principals`),
580
+ ...projectNamespaceTemplate !== void 0 ? { projectNamespaceTemplate } : {},
581
+ read: parseStringList(rawTeam.read, `teams.${teamId}.read`),
582
+ write: parseStringList(rawTeam.write, `teams.${teamId}.write`),
583
+ promote: parseStringList(rawTeam.promote, `teams.${teamId}.promote`)
584
+ };
585
+ }
586
+ return teams;
587
+ }
588
+ function validateScopeProfileTeamReferences(profiles, teams) {
589
+ for (const [profileId, profile] of Object.entries(profiles)) {
590
+ const teamId = profile.teamProject?.teamId;
591
+ if (teamId && !Object.prototype.hasOwnProperty.call(teams, teamId)) {
592
+ throw new Error(
593
+ `scopeProfiles.${profileId}.teamProject.teamId references unknown team: ${teamId}`
594
+ );
595
+ }
596
+ }
597
+ }
376
598
  function parseBoundedIntegerMs(value, fallback, min, max) {
377
599
  const coerced = coerceNumber(value);
378
600
  if (coerced === void 0) return fallback;
@@ -608,6 +830,42 @@ function resolveNamespaceCatalogEnabled(configValue) {
608
830
  }
609
831
  return true;
610
832
  }
833
+ function readNestedConfig(cfg, blockName, key) {
834
+ const block = validateNestedConfigBlock(cfg, blockName);
835
+ if (!block) return void 0;
836
+ return block[key];
837
+ }
838
+ function validateNestedConfigBlock(cfg, blockName) {
839
+ const block = cfg[blockName];
840
+ if (block === void 0 || block === null) return void 0;
841
+ if (typeof block !== "object" || Array.isArray(block)) {
842
+ throw new Error(`${blockName} must be a plain object`);
843
+ }
844
+ return block;
845
+ }
846
+ function readFlatOrNestedConfig(cfg, flatKey, blockName, nestedKey) {
847
+ return cfg[flatKey] !== void 0 ? cfg[flatKey] : readNestedConfig(cfg, blockName, nestedKey);
848
+ }
849
+ function resolveBooleanConfig(value, defaultValue, keyName) {
850
+ if (value === void 0 || value === null) return defaultValue;
851
+ const coerced = coerceBool(value);
852
+ if (coerced === void 0) {
853
+ throw new Error(
854
+ `${keyName} must be a boolean-like value (true/false/1/0/yes/no/on/off); got ${JSON.stringify(value)}`
855
+ );
856
+ }
857
+ return coerced;
858
+ }
859
+ function resolvePositiveIntegerConfig(value, defaultValue, keyName) {
860
+ if (value === void 0 || value === null) return defaultValue;
861
+ const coerced = coerceNumber(value);
862
+ if (coerced === void 0 || !Number.isFinite(coerced) || !Number.isInteger(coerced) || coerced < 1) {
863
+ throw new Error(
864
+ `${keyName} must be a positive integer; got ${JSON.stringify(value)}`
865
+ );
866
+ }
867
+ return coerced;
868
+ }
611
869
  function isOpenaiApiKeyDisabled(value) {
612
870
  return value === false || typeof value === "string" && value.trim().toLowerCase() === "false";
613
871
  }
@@ -888,6 +1146,7 @@ function parseConfig(raw) {
888
1146
  } else {
889
1147
  cfg = baseCfg;
890
1148
  }
1149
+ validateNestedConfigBlock(cfg, "maintenance");
891
1150
  const modelSource = cfg.modelSource === "gateway" ? "gateway" : "plugin";
892
1151
  const openaiApiKeyDisabled = isOpenaiApiKeyDisabled(cfg.openaiApiKey);
893
1152
  let apiKey;
@@ -1051,6 +1310,21 @@ function parseConfig(raw) {
1051
1310
  globalFallback: codingGlobalFallbackRaw === void 0 ? true : codingGlobalFallbackRaw
1052
1311
  };
1053
1312
  const memoryDir = typeof cfg.memoryDir === "string" && cfg.memoryDir.length > 0 ? expandTildePath(cfg.memoryDir) : DEFAULT_MEMORY_DIR;
1313
+ const scopeProfiles = parseScopeProfiles(cfg.scopeProfiles);
1314
+ const teams = parseScopeTeams(cfg.teams);
1315
+ validateScopeProfileTeamReferences(scopeProfiles, teams);
1316
+ const defaultScopeProfile = (() => {
1317
+ if (cfg.defaultScopeProfile === void 0 || cfg.defaultScopeProfile === null) {
1318
+ return void 0;
1319
+ }
1320
+ if (typeof cfg.defaultScopeProfile !== "string" || cfg.defaultScopeProfile.trim().length === 0) {
1321
+ throw new Error("defaultScopeProfile must be a non-empty string");
1322
+ }
1323
+ return cfg.defaultScopeProfile.trim();
1324
+ })();
1325
+ if (defaultScopeProfile !== void 0 && scopeProfiles[defaultScopeProfile] === void 0) {
1326
+ throw new Error(`defaultScopeProfile references unknown scope profile: ${defaultScopeProfile}`);
1327
+ }
1054
1328
  const rawIdentityInjectionMode = cfg.identityInjectionMode;
1055
1329
  const identityInjectionMode = rawIdentityInjectionMode && VALID_IDENTITY_INJECTION_MODES.includes(rawIdentityInjectionMode) ? rawIdentityInjectionMode : "recovery_only";
1056
1330
  const identityContinuityEnabled = cfg.identityContinuityEnabled === true;
@@ -1150,6 +1424,66 @@ function parseConfig(raw) {
1150
1424
  const sharedCrossSignalSemanticEnabled = cfg.sharedCrossSignalSemanticEnabled === true || cfg.crossSignalsSemanticEnabled === true;
1151
1425
  const sharedCrossSignalSemanticTimeoutMs = typeof cfg.sharedCrossSignalSemanticTimeoutMs === "number" ? Math.max(1, Math.floor(cfg.sharedCrossSignalSemanticTimeoutMs)) : typeof cfg.crossSignalsSemanticTimeoutMs === "number" ? Math.max(1, Math.floor(cfg.crossSignalsSemanticTimeoutMs)) : 4e3;
1152
1426
  const recallPipelineConfig = buildRecallPipelineConfig(cfg);
1427
+ const maintenanceNamespaceFanoutEnabled = resolveBooleanConfig(
1428
+ readFlatOrNestedConfig(
1429
+ cfg,
1430
+ "maintenanceNamespaceFanoutEnabled",
1431
+ "maintenance",
1432
+ "namespaceFanoutEnabled"
1433
+ ),
1434
+ true,
1435
+ "maintenance.namespaceFanoutEnabled"
1436
+ );
1437
+ const maintenanceMaxNamespacesPerCycle = resolvePositiveIntegerConfig(
1438
+ readFlatOrNestedConfig(
1439
+ cfg,
1440
+ "maintenanceMaxNamespacesPerCycle",
1441
+ "maintenance",
1442
+ "maxNamespacesPerCycle"
1443
+ ),
1444
+ 20,
1445
+ "maintenance.maxNamespacesPerCycle"
1446
+ );
1447
+ const maintenanceIncludeProjectNamespaces = resolveBooleanConfig(
1448
+ readFlatOrNestedConfig(
1449
+ cfg,
1450
+ "maintenanceIncludeProjectNamespaces",
1451
+ "maintenance",
1452
+ "includeProjectNamespaces"
1453
+ ),
1454
+ true,
1455
+ "maintenance.includeProjectNamespaces"
1456
+ );
1457
+ const maintenanceIncludeBranchNamespaces = resolveBooleanConfig(
1458
+ readFlatOrNestedConfig(
1459
+ cfg,
1460
+ "maintenanceIncludeBranchNamespaces",
1461
+ "maintenance",
1462
+ "includeBranchNamespaces"
1463
+ ),
1464
+ false,
1465
+ "maintenance.includeBranchNamespaces"
1466
+ );
1467
+ const maintenanceIncludeTeamProjectNamespaces = resolveBooleanConfig(
1468
+ readFlatOrNestedConfig(
1469
+ cfg,
1470
+ "maintenanceIncludeTeamProjectNamespaces",
1471
+ "maintenance",
1472
+ "includeTeamProjectNamespaces"
1473
+ ),
1474
+ true,
1475
+ "maintenance.includeTeamProjectNamespaces"
1476
+ );
1477
+ const maintenanceNamespaceLockStaleMs = resolvePositiveIntegerConfig(
1478
+ readFlatOrNestedConfig(
1479
+ cfg,
1480
+ "maintenanceNamespaceLockStaleMs",
1481
+ "maintenance",
1482
+ "namespaceLockStaleMs"
1483
+ ),
1484
+ 10 * 6e4,
1485
+ "maintenance.namespaceLockStaleMs"
1486
+ );
1153
1487
  return {
1154
1488
  openaiApiKey: apiKey,
1155
1489
  openaiBaseUrl: baseUrl,
@@ -1853,6 +2187,12 @@ function parseConfig(raw) {
1853
2187
  // QMD maintenance (debounced singleflight)
1854
2188
  qmdMaintenanceEnabled: cfg.qmdMaintenanceEnabled !== false,
1855
2189
  qmdMaintenanceDebounceMs: typeof cfg.qmdMaintenanceDebounceMs === "number" ? cfg.qmdMaintenanceDebounceMs : 3e4,
2190
+ maintenanceNamespaceFanoutEnabled,
2191
+ maintenanceMaxNamespacesPerCycle,
2192
+ maintenanceIncludeProjectNamespaces,
2193
+ maintenanceIncludeBranchNamespaces,
2194
+ maintenanceIncludeTeamProjectNamespaces,
2195
+ maintenanceNamespaceLockStaleMs,
1856
2196
  qmdAutoEmbedEnabled: cfg.qmdAutoEmbedEnabled === true,
1857
2197
  qmdEmbedMinIntervalMs: typeof cfg.qmdEmbedMinIntervalMs === "number" ? cfg.qmdEmbedMinIntervalMs : 60 * 6e4,
1858
2198
  qmdUpdateTimeoutMs: typeof cfg.qmdUpdateTimeoutMs === "number" ? cfg.qmdUpdateTimeoutMs : 9e4,
@@ -1916,6 +2256,9 @@ function parseConfig(raw) {
1916
2256
  includeInRecallByDefault: p?.includeInRecallByDefault === true
1917
2257
  })).filter((p) => p.name.length > 0) : [],
1918
2258
  defaultRecallNamespaces: Array.isArray(cfg.defaultRecallNamespaces) ? ["self", "shared"].filter((x) => cfg.defaultRecallNamespaces.includes(x)) : ["self", "shared"],
2259
+ scopeProfiles,
2260
+ defaultScopeProfile,
2261
+ teams,
1919
2262
  cronRecallMode: cfg.cronRecallMode === "none" ? "none" : cfg.cronRecallMode === "allowlist" ? "allowlist" : "all",
1920
2263
  cronRecallAllowlist: Array.isArray(cfg.cronRecallAllowlist) ? cfg.cronRecallAllowlist.filter((v) => typeof v === "string" && v.length > 0) : [],
1921
2264
  cronRecallPolicyEnabled: cfg.cronRecallPolicyEnabled !== false,
@@ -2826,4 +3169,4 @@ export {
2826
3169
  VALID_MEMORY_CATEGORIES,
2827
3170
  parseConfig
2828
3171
  };
2829
- //# sourceMappingURL=chunk-YLZLPVKK.js.map
3172
+ //# sourceMappingURL=chunk-CTAV55JM.js.map