@remnic/core 9.3.655 → 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 (247) hide show
  1. package/dist/access-cli.js +22 -22
  2. package/dist/access-http.d.ts +4 -4
  3. package/dist/access-http.js +10 -10
  4. package/dist/access-mcp.d.ts +4 -4
  5. package/dist/access-mcp.js +9 -9
  6. package/dist/access-schema.d.ts +10 -10
  7. package/dist/{access-service-BEJvriUt.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 +8 -8
  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-PVE7KSQP.js → chunk-2BD7DG37.js} +2 -2
  26. package/dist/{chunk-54LOUIBE.js → chunk-2MXEVL75.js} +2 -2
  27. package/dist/{chunk-55ZMNKMQ.js → chunk-4UL7VPTD.js} +276 -57
  28. package/dist/chunk-4UL7VPTD.js.map +1 -0
  29. package/dist/{chunk-COVZLGMR.js → chunk-54XF2FY7.js} +17 -17
  30. package/dist/{chunk-UYNFWZWG.js → chunk-AGJKWOKV.js} +2 -2
  31. package/dist/{chunk-TDZSSJV4.js → chunk-AZBV4RRY.js} +1 -1
  32. package/dist/chunk-AZBV4RRY.js.map +1 -0
  33. package/dist/{chunk-KOI765XP.js → chunk-CTAV55JM.js} +241 -1
  34. package/dist/chunk-CTAV55JM.js.map +1 -0
  35. package/dist/{chunk-A3Y37UWI.js → chunk-DIBWFCLA.js} +3 -3
  36. package/dist/{chunk-QDVQ4AN2.js → chunk-DR67OK4E.js} +5 -5
  37. package/dist/{chunk-XBIACVCO.js → chunk-EC2AYKRX.js} +2 -2
  38. package/dist/{chunk-IQ53ZSXV.js → chunk-GCYFUTUC.js} +2 -2
  39. package/dist/{chunk-YYN3LIYA.js → chunk-GSHW5VVD.js} +5 -5
  40. package/dist/chunk-GYSYLGNE.js +650 -0
  41. package/dist/chunk-GYSYLGNE.js.map +1 -0
  42. package/dist/{chunk-NRBGRZW4.js → chunk-IOZ5WBWD.js} +2 -2
  43. package/dist/{chunk-NCSJKK23.js → chunk-JSVFEHLL.js} +7 -5
  44. package/dist/chunk-JSVFEHLL.js.map +1 -0
  45. package/dist/{chunk-7LWRCOP7.js → chunk-LZTFCAKE.js} +2 -2
  46. package/dist/{chunk-TEO46GMM.js → chunk-NXCK7DO7.js} +2 -2
  47. package/dist/{chunk-XOFXKASO.js → chunk-PEPHBH2W.js} +2 -2
  48. package/dist/{chunk-WDTUYOLS.js → chunk-QZRKNA5F.js} +2 -2
  49. package/dist/{chunk-PS3SYNHP.js → chunk-R5DB26G6.js} +2 -2
  50. package/dist/{chunk-5QD3QD76.js → chunk-RDW5G6DO.js} +659 -123
  51. package/dist/chunk-RDW5G6DO.js.map +1 -0
  52. package/dist/{chunk-BGKXTVNG.js → chunk-SWDHVH2P.js} +2 -2
  53. package/dist/{chunk-67G4T7KI.js → chunk-SXYCVRLK.js} +3 -3
  54. package/dist/{chunk-UCEABZZN.js → chunk-TFFZUFEP.js} +7 -5
  55. package/dist/chunk-TFFZUFEP.js.map +1 -0
  56. package/dist/{chunk-UCEDY5M7.js → chunk-TIJYQXDI.js} +2 -2
  57. package/dist/{chunk-2RCGZ67B.js → chunk-VAEAGTEQ.js} +3 -3
  58. package/dist/{chunk-XRKQOQLY.js → chunk-WIKMCJUR.js} +2 -2
  59. package/dist/{chunk-KZZ4YAEC.js → chunk-WWMHAMAY.js} +2 -2
  60. package/dist/{chunk-OKW6F5S5.js → chunk-YEZHZCUO.js} +4 -4
  61. package/dist/{chunk-5FOCXX5E.js → chunk-YVVQUAOO.js} +3 -3
  62. package/dist/{chunk-5FOCXX5E.js.map → chunk-YVVQUAOO.js.map} +1 -1
  63. package/dist/{chunk-3XGWCZ63.js → chunk-YXLT4EMM.js} +2 -2
  64. package/dist/{chunk-PTMJ2FH2.js → chunk-Z6UDTNY6.js} +2 -2
  65. package/dist/{cli-BGahB_d3.d.ts → cli-aYxSuPvP.d.ts} +3 -3
  66. package/dist/cli.d.ts +5 -5
  67. package/dist/cli.js +22 -22
  68. package/dist/compounding/engine.d.ts +1 -1
  69. package/dist/compounding/engine.js +3 -3
  70. package/dist/compounding/preference-consolidator.d.ts +1 -1
  71. package/dist/compression-optimizer.d.ts +1 -1
  72. package/dist/config.d.ts +1 -1
  73. package/dist/config.js +1 -1
  74. package/dist/connectors/codex-materialize-runner.d.ts +1 -1
  75. package/dist/connectors/codex-materialize-runner.js +3 -3
  76. package/dist/connectors/codex-materialize.d.ts +1 -1
  77. package/dist/connectors/index.d.ts +1 -1
  78. package/dist/connectors/index.js +3 -3
  79. package/dist/consolidation-provenance-check.d.ts +1 -1
  80. package/dist/consolidation-undo.d.ts +1 -1
  81. package/dist/contradiction/index.d.ts +1 -1
  82. package/dist/conversation-index/backend.d.ts +1 -1
  83. package/dist/conversation-index/chunker.d.ts +1 -1
  84. package/dist/conversation-index/faiss-adapter.d.ts +1 -1
  85. package/dist/conversation-index/indexer.d.ts +1 -1
  86. package/dist/conversation-index/search.d.ts +1 -1
  87. package/dist/day-summary.d.ts +1 -1
  88. package/dist/delinearize.d.ts +1 -1
  89. package/dist/direct-answer-wiring.d.ts +1 -1
  90. package/dist/direct-answer.d.ts +1 -1
  91. package/dist/embedding-fallback.d.ts +1 -1
  92. package/dist/enrichment/index.d.ts +1 -1
  93. package/dist/entity-retrieval.d.ts +1 -1
  94. package/dist/entity-retrieval.js +3 -3
  95. package/dist/entity-schema.d.ts +1 -1
  96. package/dist/explicit-capture.d.ts +3 -3
  97. package/dist/explicit-cue-recall.js +2 -2
  98. package/dist/extraction-judge-telemetry.d.ts +1 -1
  99. package/dist/extraction-judge-training.d.ts +1 -1
  100. package/dist/extraction-judge.d.ts +1 -1
  101. package/dist/extraction.d.ts +1 -1
  102. package/dist/fallback-llm.d.ts +1 -1
  103. package/dist/focused-list-recall.js +2 -2
  104. package/dist/identity-continuity.d.ts +1 -1
  105. package/dist/importance.d.ts +1 -1
  106. package/dist/index.d.ts +121 -121
  107. package/dist/index.js +32 -32
  108. package/dist/intent.d.ts +1 -1
  109. package/dist/lcm/engine.d.ts +1 -1
  110. package/dist/lcm/index.d.ts +1 -1
  111. package/dist/lcm/tools.d.ts +1 -1
  112. package/dist/lcm-fallback-read.js +1 -1
  113. package/dist/lifecycle.d.ts +1 -1
  114. package/dist/live-connectors-runner.d.ts +1 -1
  115. package/dist/local-llm.d.ts +1 -1
  116. package/dist/maintenance/memory-governance.d.ts +1 -1
  117. package/dist/maintenance/memory-governance.js +3 -3
  118. package/dist/maintenance/rebuild-memory-lifecycle-ledger.js +3 -3
  119. package/dist/maintenance/rebuild-memory-projection.js +4 -4
  120. package/dist/mcp-memory-inspector-app.d.ts +4 -4
  121. package/dist/memory-action-policy.d.ts +1 -1
  122. package/dist/memory-cache.d.ts +1 -1
  123. package/dist/memory-lifecycle-ledger-utils.d.ts +1 -1
  124. package/dist/memory-projection-store.d.ts +1 -1
  125. package/dist/memory-provenance.d.ts +1 -1
  126. package/dist/memory-worth-outcomes.d.ts +1 -1
  127. package/dist/models-json.d.ts +1 -1
  128. package/dist/namespaces/migrate.d.ts +1 -1
  129. package/dist/namespaces/migrate.js +4 -4
  130. package/dist/namespaces/principal.d.ts +1 -1
  131. package/dist/namespaces/search.d.ts +1 -1
  132. package/dist/namespaces/storage.d.ts +1 -1
  133. package/dist/namespaces/storage.js +3 -3
  134. package/dist/native-knowledge.d.ts +1 -1
  135. package/dist/operator-toolkit.d.ts +1 -1
  136. package/dist/operator-toolkit.js +7 -7
  137. package/dist/{orchestrator-BgzZlWxH.d.ts → orchestrator-D1wcmPNj.d.ts} +8 -2
  138. package/dist/orchestrator.d.ts +3 -3
  139. package/dist/orchestrator.js +18 -18
  140. package/dist/patterns-cli.d.ts +1 -1
  141. package/dist/policy-runtime.d.ts +1 -1
  142. package/dist/qmd-recall-cache.d.ts +1 -1
  143. package/dist/qmd.d.ts +1 -1
  144. package/dist/recall-disclosure-escalation.d.ts +1 -1
  145. package/dist/recall-explain-renderer.d.ts +1 -1
  146. package/dist/recall-explain-renderer.js +3 -3
  147. package/dist/recall-planner-llm.d.ts +1 -1
  148. package/dist/recall-state.d.ts +1 -1
  149. package/dist/recall-tag-filter.d.ts +1 -1
  150. package/dist/recall-xray-cli.d.ts +1 -1
  151. package/dist/recall-xray-cli.js +4 -4
  152. package/dist/recall-xray-renderer.d.ts +1 -1
  153. package/dist/recall-xray-renderer.js +3 -3
  154. package/dist/recall-xray.d.ts +1 -1
  155. package/dist/recall-xray.js +2 -2
  156. package/dist/resolve-auth-token.d.ts +1 -1
  157. package/dist/response-guidance-recall.js +2 -2
  158. package/dist/resume-bundles.js +2 -2
  159. package/dist/retrieval-agents.d.ts +1 -1
  160. package/dist/retrieval-tiers.d.ts +1 -1
  161. package/dist/routing/engine.d.ts +1 -1
  162. package/dist/routing/store.d.ts +1 -1
  163. package/dist/search/embed-helper.d.ts +1 -1
  164. package/dist/search/factory.d.ts +1 -1
  165. package/dist/search/index.d.ts +1 -1
  166. package/dist/search/lancedb-backend.d.ts +1 -1
  167. package/dist/search/meilisearch-backend.d.ts +1 -1
  168. package/dist/search/noop-backend.d.ts +1 -1
  169. package/dist/search/orama-backend.d.ts +1 -1
  170. package/dist/search/port.d.ts +1 -1
  171. package/dist/search/remote-backend.d.ts +1 -1
  172. package/dist/{semantic-consolidation-Z8d_uMq8.d.ts → semantic-consolidation-MWOdNtSE.d.ts} +1 -1
  173. package/dist/semantic-consolidation.d.ts +2 -2
  174. package/dist/semantic-consolidation.js +4 -4
  175. package/dist/semantic-rule-promotion.js +3 -3
  176. package/dist/semantic-rule-verifier.d.ts +3 -2
  177. package/dist/semantic-rule-verifier.js +5 -3
  178. package/dist/session-observer-bands.d.ts +1 -1
  179. package/dist/session-observer-state.d.ts +1 -1
  180. package/dist/shared-context/manager.d.ts +1 -1
  181. package/dist/signal.d.ts +1 -1
  182. package/dist/storage.d.ts +1 -1
  183. package/dist/storage.js +2 -2
  184. package/dist/summarizer.d.ts +1 -1
  185. package/dist/summary-snapshot.d.ts +1 -1
  186. package/dist/targeted-fact-recall.js +2 -2
  187. package/dist/temporal-supersession.d.ts +1 -1
  188. package/dist/temporal-validity.d.ts +1 -1
  189. package/dist/threading.d.ts +1 -1
  190. package/dist/tier-migration.d.ts +1 -1
  191. package/dist/tier-routing.d.ts +1 -1
  192. package/dist/topics.d.ts +1 -1
  193. package/dist/transcript.d.ts +1 -1
  194. package/dist/{types-2OPlQWJG.d.ts → types-CgcCpUrf.d.ts} +39 -1
  195. package/dist/types.d.ts +1 -1
  196. package/dist/types.js +1 -1
  197. package/dist/utility-runtime.d.ts +1 -1
  198. package/dist/verified-recall.d.ts +2 -1
  199. package/dist/verified-recall.js +5 -3
  200. package/package.json +1 -1
  201. package/src/access-service-observe-lcm-parity.test.ts +86 -1
  202. package/src/access-service-observe-scope.test.ts +283 -1
  203. package/src/access-service-raw-excerpt-read-gate.test.ts +53 -0
  204. package/src/access-service.ts +391 -93
  205. package/src/coding/coding-namespace.ts +0 -3
  206. package/src/config.ts +282 -0
  207. package/src/lcm-fallback-read.ts +2 -6
  208. package/src/namespaces/scope-profiles.test.ts +1074 -0
  209. package/src/namespaces/scope-profiles.ts +456 -0
  210. package/src/orchestrator-flush.test.ts +142 -0
  211. package/src/orchestrator-source-attribution.test.ts +73 -0
  212. package/src/orchestrator.ts +835 -163
  213. package/src/semantic-rule-verifier.ts +13 -6
  214. package/src/types.ts +52 -0
  215. package/src/verified-recall.ts +10 -6
  216. package/dist/chunk-55ZMNKMQ.js.map +0 -1
  217. package/dist/chunk-5QD3QD76.js.map +0 -1
  218. package/dist/chunk-KOI765XP.js.map +0 -1
  219. package/dist/chunk-MMJANTJX.js +0 -339
  220. package/dist/chunk-MMJANTJX.js.map +0 -1
  221. package/dist/chunk-NCSJKK23.js.map +0 -1
  222. package/dist/chunk-TDZSSJV4.js.map +0 -1
  223. package/dist/chunk-UCEABZZN.js.map +0 -1
  224. /package/dist/{chunk-PVE7KSQP.js.map → chunk-2BD7DG37.js.map} +0 -0
  225. /package/dist/{chunk-54LOUIBE.js.map → chunk-2MXEVL75.js.map} +0 -0
  226. /package/dist/{chunk-COVZLGMR.js.map → chunk-54XF2FY7.js.map} +0 -0
  227. /package/dist/{chunk-UYNFWZWG.js.map → chunk-AGJKWOKV.js.map} +0 -0
  228. /package/dist/{chunk-A3Y37UWI.js.map → chunk-DIBWFCLA.js.map} +0 -0
  229. /package/dist/{chunk-QDVQ4AN2.js.map → chunk-DR67OK4E.js.map} +0 -0
  230. /package/dist/{chunk-XBIACVCO.js.map → chunk-EC2AYKRX.js.map} +0 -0
  231. /package/dist/{chunk-IQ53ZSXV.js.map → chunk-GCYFUTUC.js.map} +0 -0
  232. /package/dist/{chunk-YYN3LIYA.js.map → chunk-GSHW5VVD.js.map} +0 -0
  233. /package/dist/{chunk-NRBGRZW4.js.map → chunk-IOZ5WBWD.js.map} +0 -0
  234. /package/dist/{chunk-7LWRCOP7.js.map → chunk-LZTFCAKE.js.map} +0 -0
  235. /package/dist/{chunk-TEO46GMM.js.map → chunk-NXCK7DO7.js.map} +0 -0
  236. /package/dist/{chunk-XOFXKASO.js.map → chunk-PEPHBH2W.js.map} +0 -0
  237. /package/dist/{chunk-WDTUYOLS.js.map → chunk-QZRKNA5F.js.map} +0 -0
  238. /package/dist/{chunk-PS3SYNHP.js.map → chunk-R5DB26G6.js.map} +0 -0
  239. /package/dist/{chunk-BGKXTVNG.js.map → chunk-SWDHVH2P.js.map} +0 -0
  240. /package/dist/{chunk-67G4T7KI.js.map → chunk-SXYCVRLK.js.map} +0 -0
  241. /package/dist/{chunk-UCEDY5M7.js.map → chunk-TIJYQXDI.js.map} +0 -0
  242. /package/dist/{chunk-2RCGZ67B.js.map → chunk-VAEAGTEQ.js.map} +0 -0
  243. /package/dist/{chunk-XRKQOQLY.js.map → chunk-WIKMCJUR.js.map} +0 -0
  244. /package/dist/{chunk-KZZ4YAEC.js.map → chunk-WWMHAMAY.js.map} +0 -0
  245. /package/dist/{chunk-OKW6F5S5.js.map → chunk-YEZHZCUO.js.map} +0 -0
  246. /package/dist/{chunk-3XGWCZ63.js.map → chunk-YXLT4EMM.js.map} +0 -0
  247. /package/dist/{chunk-PTMJ2FH2.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;
@@ -1088,6 +1310,21 @@ function parseConfig(raw) {
1088
1310
  globalFallback: codingGlobalFallbackRaw === void 0 ? true : codingGlobalFallbackRaw
1089
1311
  };
1090
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
+ }
1091
1328
  const rawIdentityInjectionMode = cfg.identityInjectionMode;
1092
1329
  const identityInjectionMode = rawIdentityInjectionMode && VALID_IDENTITY_INJECTION_MODES.includes(rawIdentityInjectionMode) ? rawIdentityInjectionMode : "recovery_only";
1093
1330
  const identityContinuityEnabled = cfg.identityContinuityEnabled === true;
@@ -2019,6 +2256,9 @@ function parseConfig(raw) {
2019
2256
  includeInRecallByDefault: p?.includeInRecallByDefault === true
2020
2257
  })).filter((p) => p.name.length > 0) : [],
2021
2258
  defaultRecallNamespaces: Array.isArray(cfg.defaultRecallNamespaces) ? ["self", "shared"].filter((x) => cfg.defaultRecallNamespaces.includes(x)) : ["self", "shared"],
2259
+ scopeProfiles,
2260
+ defaultScopeProfile,
2261
+ teams,
2022
2262
  cronRecallMode: cfg.cronRecallMode === "none" ? "none" : cfg.cronRecallMode === "allowlist" ? "allowlist" : "all",
2023
2263
  cronRecallAllowlist: Array.isArray(cfg.cronRecallAllowlist) ? cfg.cronRecallAllowlist.filter((v) => typeof v === "string" && v.length > 0) : [],
2024
2264
  cronRecallPolicyEnabled: cfg.cronRecallPolicyEnabled !== false,
@@ -2929,4 +3169,4 @@ export {
2929
3169
  VALID_MEMORY_CATEGORIES,
2930
3170
  parseConfig
2931
3171
  };
2932
- //# sourceMappingURL=chunk-KOI765XP.js.map
3172
+ //# sourceMappingURL=chunk-CTAV55JM.js.map