@remnic/core 9.3.633 → 9.3.635

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 (61) hide show
  1. package/dist/access-cli.js +24 -24
  2. package/dist/access-http.d.ts +1 -1
  3. package/dist/access-http.js +22 -3
  4. package/dist/access-mcp.d.ts +1 -1
  5. package/dist/access-mcp.js +21 -2
  6. package/dist/{access-service-C9_EpVHd.d.ts → access-service-GVOE5U3C.d.ts} +3 -0
  7. package/dist/access-service.d.ts +1 -1
  8. package/dist/access-service.js +20 -1
  9. package/dist/{chunk-2ROPI5OE.js → chunk-6GC5SGFE.js} +4 -4
  10. package/dist/{chunk-6GDHLVJC.js → chunk-AV5ZEH4M.js} +4 -4
  11. package/dist/{chunk-32U3N7H5.js → chunk-BK35NOJL.js} +3 -3
  12. package/dist/{chunk-TZVQQTG4.js → chunk-DEDTFRH2.js} +6 -6
  13. package/dist/{chunk-5PT5I6JQ.js → chunk-JYFO32V4.js} +7 -7
  14. package/dist/{chunk-ZJR7VG5L.js → chunk-LASA46TQ.js} +2 -2
  15. package/dist/{chunk-XG4NAWAV.js → chunk-NFNQ7TWF.js} +3 -3
  16. package/dist/{chunk-XG4NAWAV.js.map → chunk-NFNQ7TWF.js.map} +1 -1
  17. package/dist/{chunk-YRMKDTKF.js → chunk-RAGXUVQW.js} +3 -3
  18. package/dist/{chunk-EWLQPEO6.js → chunk-RN7MUWON.js} +4 -4
  19. package/dist/{chunk-WR64DQFE.js → chunk-SQZ42MKH.js} +4 -4
  20. package/dist/{chunk-WLZBVYC6.js → chunk-TFICNXXU.js} +28 -28
  21. package/dist/{chunk-IFVFQRZ2.js → chunk-VTH5SKQW.js} +2 -2
  22. package/dist/{chunk-DOBJH4I6.js → chunk-XM6M6DHG.js} +78 -10
  23. package/dist/chunk-XM6M6DHG.js.map +1 -0
  24. package/dist/{chunk-VTR3MNYF.js → chunk-YCX45GOQ.js} +4 -4
  25. package/dist/{cli-CuVEQWKr.d.ts → cli-B-fHk59D.d.ts} +1 -1
  26. package/dist/cli.d.ts +2 -2
  27. package/dist/cli.js +26 -26
  28. package/dist/direct-answer-wiring.js +2 -2
  29. package/dist/harmonic-retrieval.js +2 -2
  30. package/dist/index.d.ts +2 -2
  31. package/dist/index.js +41 -41
  32. package/dist/mcp-memory-inspector-app.d.ts +1 -1
  33. package/dist/namespaces/migrate.js +8 -8
  34. package/dist/namespaces/search.js +6 -6
  35. package/dist/operator-toolkit.js +19 -19
  36. package/dist/orchestrator.js +23 -23
  37. package/dist/qmd.js +2 -2
  38. package/dist/retrieval-agents.js +2 -2
  39. package/dist/search/embed-helper.js +2 -2
  40. package/dist/search/factory.js +5 -5
  41. package/dist/search/index.js +5 -5
  42. package/dist/search/lancedb-backend.js +1 -1
  43. package/dist/search/meilisearch-backend.js +1 -1
  44. package/dist/search/orama-backend.js +1 -1
  45. package/package.json +1 -1
  46. package/src/access-mcp.ts +1 -1
  47. package/src/access-service-namespace.test.ts +312 -0
  48. package/src/access-service.ts +97 -11
  49. package/dist/chunk-DOBJH4I6.js.map +0 -1
  50. /package/dist/{chunk-2ROPI5OE.js.map → chunk-6GC5SGFE.js.map} +0 -0
  51. /package/dist/{chunk-6GDHLVJC.js.map → chunk-AV5ZEH4M.js.map} +0 -0
  52. /package/dist/{chunk-32U3N7H5.js.map → chunk-BK35NOJL.js.map} +0 -0
  53. /package/dist/{chunk-TZVQQTG4.js.map → chunk-DEDTFRH2.js.map} +0 -0
  54. /package/dist/{chunk-5PT5I6JQ.js.map → chunk-JYFO32V4.js.map} +0 -0
  55. /package/dist/{chunk-ZJR7VG5L.js.map → chunk-LASA46TQ.js.map} +0 -0
  56. /package/dist/{chunk-YRMKDTKF.js.map → chunk-RAGXUVQW.js.map} +0 -0
  57. /package/dist/{chunk-EWLQPEO6.js.map → chunk-RN7MUWON.js.map} +0 -0
  58. /package/dist/{chunk-WR64DQFE.js.map → chunk-SQZ42MKH.js.map} +0 -0
  59. /package/dist/{chunk-WLZBVYC6.js.map → chunk-TFICNXXU.js.map} +0 -0
  60. /package/dist/{chunk-IFVFQRZ2.js.map → chunk-VTH5SKQW.js.map} +0 -0
  61. /package/dist/{chunk-VTR3MNYF.js.map → chunk-YCX45GOQ.js.map} +0 -0
@@ -3,7 +3,7 @@ import {
3
3
  } from "./chunk-JOASJWQR.js";
4
4
  import {
5
5
  EmbedHelper
6
- } from "./chunk-EWLQPEO6.js";
6
+ } from "./chunk-RN7MUWON.js";
7
7
  import {
8
8
  LanceDbBackend
9
9
  } from "./chunk-3MAONBX3.js";
@@ -24,7 +24,7 @@ import {
24
24
  } from "./chunk-ORFGK3XI.js";
25
25
  import {
26
26
  QmdClient
27
- } from "./chunk-TZVQQTG4.js";
27
+ } from "./chunk-DEDTFRH2.js";
28
28
  import {
29
29
  log
30
30
  } from "./chunk-2ODBA7MQ.js";
@@ -170,4 +170,4 @@ export {
170
170
  createConversationSearchBackend,
171
171
  createConversationIndexRuntime
172
172
  };
173
- //# sourceMappingURL=chunk-YRMKDTKF.js.map
173
+ //# sourceMappingURL=chunk-RAGXUVQW.js.map
@@ -5,12 +5,12 @@ import {
5
5
  getHostEmbeddingProvider,
6
6
  normalizeHostEmbeddingVector
7
7
  } from "./chunk-3ONXXHQO.js";
8
- import {
9
- isAbortError
10
- } from "./chunk-PVGDJXVK.js";
11
8
  import {
12
9
  log
13
10
  } from "./chunk-2ODBA7MQ.js";
11
+ import {
12
+ isAbortError
13
+ } from "./chunk-PVGDJXVK.js";
14
14
 
15
15
  // src/search/embed-helper.ts
16
16
  var DEFAULT_OPENAI_MODEL = "text-embedding-3-small";
@@ -305,4 +305,4 @@ function normalizeHttpEmbeddingVector(vector) {
305
305
  export {
306
306
  EmbedHelper
307
307
  };
308
- //# sourceMappingURL=chunk-EWLQPEO6.js.map
308
+ //# sourceMappingURL=chunk-RN7MUWON.js.map
@@ -1,12 +1,12 @@
1
1
  import {
2
2
  isDirectAnswerEligible
3
3
  } from "./chunk-6HEM6HTQ.js";
4
- import {
5
- throwIfAborted
6
- } from "./chunk-PVGDJXVK.js";
7
4
  import {
8
5
  normalizeRecallTokens
9
6
  } from "./chunk-ZBJMUXZH.js";
7
+ import {
8
+ throwIfAborted
9
+ } from "./chunk-PVGDJXVK.js";
10
10
 
11
11
  // src/taxonomy/resolver.ts
12
12
  var DEFAULT_CATEGORY_ID = "facts";
@@ -177,4 +177,4 @@ export {
177
177
  resolveCategory,
178
178
  tryDirectAnswer
179
179
  };
180
- //# sourceMappingURL=chunk-WR64DQFE.js.map
180
+ //# sourceMappingURL=chunk-SQZ42MKH.js.map
@@ -77,7 +77,7 @@ import {
77
77
  runDirectAgent,
78
78
  runTemporalAgent,
79
79
  shouldRunAgent
80
- } from "./chunk-2ROPI5OE.js";
80
+ } from "./chunk-6GC5SGFE.js";
81
81
  import {
82
82
  clearIndexes,
83
83
  deindexMemory,
@@ -188,7 +188,7 @@ import {
188
188
  } from "./chunk-WLEB7WCG.js";
189
189
  import {
190
190
  tryDirectAnswer
191
- } from "./chunk-WR64DQFE.js";
191
+ } from "./chunk-SQZ42MKH.js";
192
192
  import {
193
193
  EmbeddingFallback
194
194
  } from "./chunk-XCAZF7KQ.js";
@@ -232,28 +232,9 @@ import {
232
232
  import {
233
233
  TranscriptManager
234
234
  } from "./chunk-A6D7A2FW.js";
235
- import {
236
- NamespaceSearchRouter
237
- } from "./chunk-ZJR7VG5L.js";
238
- import {
239
- createConversationIndexRuntime,
240
- createSearchBackend
241
- } from "./chunk-YRMKDTKF.js";
242
- import {
243
- NoopSearchBackend
244
- } from "./chunk-CYEPCZN5.js";
245
235
  import {
246
236
  NamespaceStorageRouter
247
237
  } from "./chunk-LEG7XWS2.js";
248
- import {
249
- namespaceIdentityFromToken
250
- } from "./chunk-ZFXCQPNO.js";
251
- import {
252
- writeConversationChunks
253
- } from "./chunk-OIF36KGD.js";
254
- import {
255
- parseQmdExplain
256
- } from "./chunk-TZVQQTG4.js";
257
238
  import {
258
239
  PolicyRuntimeManager
259
240
  } from "./chunk-33JBK2XP.js";
@@ -263,7 +244,7 @@ import {
263
244
  } from "./chunk-JXS5PDQ7.js";
264
245
  import {
265
246
  searchHarmonicRetrieval
266
- } from "./chunk-6GDHLVJC.js";
247
+ } from "./chunk-AV5ZEH4M.js";
267
248
  import {
268
249
  collectNativeKnowledgeChunks,
269
250
  formatNativeKnowledgeSection,
@@ -314,11 +295,6 @@ import {
314
295
  import {
315
296
  BoxBuilder
316
297
  } from "./chunk-HQ6NIBL6.js";
317
- import {
318
- abortError,
319
- isAbortError,
320
- throwIfAborted
321
- } from "./chunk-PVGDJXVK.js";
322
298
  import {
323
299
  WearablesInputError,
324
300
  describeErrorForOperator
@@ -335,6 +311,25 @@ import {
335
311
  import {
336
312
  buildXraySnapshot
337
313
  } from "./chunk-YQNADJCT.js";
314
+ import {
315
+ NamespaceSearchRouter
316
+ } from "./chunk-LASA46TQ.js";
317
+ import {
318
+ createConversationIndexRuntime,
319
+ createSearchBackend
320
+ } from "./chunk-RAGXUVQW.js";
321
+ import {
322
+ NoopSearchBackend
323
+ } from "./chunk-CYEPCZN5.js";
324
+ import {
325
+ namespaceIdentityFromToken
326
+ } from "./chunk-ZFXCQPNO.js";
327
+ import {
328
+ writeConversationChunks
329
+ } from "./chunk-OIF36KGD.js";
330
+ import {
331
+ parseQmdExplain
332
+ } from "./chunk-DEDTFRH2.js";
338
333
  import {
339
334
  objectiveStateStoreOverrideForNamespace,
340
335
  searchObjectiveStateSnapshots
@@ -412,6 +407,11 @@ import {
412
407
  import {
413
408
  log
414
409
  } from "./chunk-2ODBA7MQ.js";
410
+ import {
411
+ abortError,
412
+ isAbortError,
413
+ throwIfAborted
414
+ } from "./chunk-PVGDJXVK.js";
415
415
  import {
416
416
  keyring_exports,
417
417
  secureStoreDir
@@ -13206,4 +13206,4 @@ export {
13206
13206
  resolvePersistedMemoryRelativePath,
13207
13207
  Orchestrator
13208
13208
  };
13209
- //# sourceMappingURL=chunk-WLZBVYC6.js.map
13209
+ //# sourceMappingURL=chunk-TFICNXXU.js.map
@@ -1,6 +1,6 @@
1
1
  import {
2
2
  listNamespaces
3
- } from "./chunk-VTR3MNYF.js";
3
+ } from "./chunk-YCX45GOQ.js";
4
4
  import {
5
5
  runConsolidationProvenanceCheck
6
6
  } from "./chunk-AL4RAJL5.js";
@@ -1336,4 +1336,4 @@ export {
1336
1336
  runBenchmarkRecall,
1337
1337
  runOperatorRepair
1338
1338
  };
1339
- //# sourceMappingURL=chunk-IFVFQRZ2.js.map
1339
+ //# sourceMappingURL=chunk-VTH5SKQW.js.map
@@ -47,6 +47,9 @@ import {
47
47
  import {
48
48
  estimateRecallTokens
49
49
  } from "./chunk-YQNADJCT.js";
50
+ import {
51
+ namespaceCollectionName
52
+ } from "./chunk-LASA46TQ.js";
50
53
  import {
51
54
  recordObjectiveStateSnapshotsFromObservedMessages
52
55
  } from "./chunk-BMFZLLNI.js";
@@ -793,6 +796,57 @@ var EngramAccessService = class {
793
796
  }
794
797
  return resolved;
795
798
  }
799
+ resolveReadableNamespacesForSearch(namespace, principal) {
800
+ const requested = namespace?.trim();
801
+ if (requested) {
802
+ return [this.resolveReadableNamespace(requested, principal)];
803
+ }
804
+ if (!this.orchestrator.config.namespacesEnabled) {
805
+ return [this.resolveNamespace(void 0)];
806
+ }
807
+ if (!principal) {
808
+ throw new EngramAccessInputError(
809
+ "authentication required: namespaces are enabled and no principal was supplied"
810
+ );
811
+ }
812
+ return recallNamespacesForPrincipal(principal, this.orchestrator.config).filter((ns) => canReadNamespace(principal, ns, this.orchestrator.config));
813
+ }
814
+ resolveAllReadableConfiguredNamespaces(principal) {
815
+ const config = this.orchestrator.config;
816
+ const candidates = [
817
+ config.defaultNamespace,
818
+ config.sharedNamespace,
819
+ ...config.namespacePolicies.map((policy) => policy.name)
820
+ ];
821
+ return [...new Set(candidates)].filter((namespace) => canReadNamespace(principal, namespace, config));
822
+ }
823
+ resolveMemorySearchNamespacesForCollection(collection, namespaces, collectionPrincipal) {
824
+ if (!this.orchestrator.config.namespacesEnabled) {
825
+ return namespaces;
826
+ }
827
+ const baseCollection = this.orchestrator.config.qmdCollection;
828
+ if (!collection || collection === "global" || collection === baseCollection) {
829
+ return namespaces;
830
+ }
831
+ const candidates = collectionPrincipal ? this.resolveAllReadableConfiguredNamespaces(collectionPrincipal) : namespaces;
832
+ const matchedNamespaces = candidates.filter((namespace) => {
833
+ const canonical = namespaceCollectionName(baseCollection, namespace, {
834
+ defaultNamespace: this.orchestrator.config.defaultNamespace,
835
+ useLegacyDefaultCollection: false
836
+ });
837
+ const legacyDefault = namespaceCollectionName(baseCollection, namespace, {
838
+ defaultNamespace: this.orchestrator.config.defaultNamespace,
839
+ useLegacyDefaultCollection: true
840
+ });
841
+ return collection === canonical || collection === legacyDefault;
842
+ });
843
+ if (matchedNamespaces.length > 0) {
844
+ return matchedNamespaces;
845
+ }
846
+ throw new EngramAccessInputError(
847
+ "collection is not namespace-scoped for the requested principal"
848
+ );
849
+ }
796
850
  async buildRecallDebug(snapshot, namespace, includeDebug, sessionKey) {
797
851
  if (!includeDebug) return void 0;
798
852
  if (!sessionKey?.trim()) return void 0;
@@ -3391,15 +3445,29 @@ ${next}`);
3391
3445
  }
3392
3446
  // ── Memory search & debug ─────────────────────────────────────────────
3393
3447
  async memorySearch(request) {
3394
- const { query, namespace, maxResults, collection, principal } = request;
3395
- const resolvedNs = this.resolveReadableNamespace(namespace, principal);
3396
- const namespaceFilter = resolvedNs !== this.orchestrator.config.defaultNamespace ? resolvedNs : void 0;
3397
- const results = collection === "global" && !namespaceFilter ? await this.orchestrator.qmd.searchGlobal(query, maxResults) : await this.orchestrator.searchAcrossNamespaces({
3398
- query,
3399
- namespaces: namespaceFilter ? [namespaceFilter] : void 0,
3400
- maxResults,
3401
- mode: "search"
3402
- });
3448
+ const { query, namespace, maxResults, principal } = request;
3449
+ const collection = request.collection?.trim();
3450
+ if (request.collection !== void 0 && !collection) {
3451
+ throw new EngramAccessInputError("collection must be a non-empty string");
3452
+ }
3453
+ let results;
3454
+ if (!this.orchestrator.config.namespacesEnabled) {
3455
+ this.resolveReadableNamespace(namespace, principal);
3456
+ results = collection === "global" ? await this.orchestrator.qmd.searchGlobal(query, maxResults) : await this.orchestrator.qmd.search(query, collection, maxResults);
3457
+ } else {
3458
+ const readableNamespaces = this.resolveReadableNamespacesForSearch(namespace, principal);
3459
+ const namespaces = this.resolveMemorySearchNamespacesForCollection(
3460
+ collection,
3461
+ readableNamespaces,
3462
+ namespace?.trim() ? void 0 : principal
3463
+ );
3464
+ results = namespaces.length === 0 ? [] : await this.orchestrator.searchAcrossNamespaces({
3465
+ query,
3466
+ namespaces,
3467
+ maxResults,
3468
+ mode: "search"
3469
+ });
3470
+ }
3403
3471
  return {
3404
3472
  query,
3405
3473
  results: results.map((r) => ({
@@ -4390,4 +4458,4 @@ export {
4390
4458
  shapeMemorySummary,
4391
4459
  EngramAccessService
4392
4460
  };
4393
- //# sourceMappingURL=chunk-DOBJH4I6.js.map
4461
+ //# sourceMappingURL=chunk-XM6M6DHG.js.map