@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.
- package/dist/access-cli.js +29 -29
- package/dist/access-http.d.ts +4 -4
- package/dist/access-http.js +17 -17
- package/dist/access-mcp.d.ts +4 -4
- package/dist/access-mcp.js +16 -16
- package/dist/access-schema.d.ts +10 -10
- package/dist/{access-service-C8A5hoXJ.d.ts → access-service-D_nbpexW.d.ts} +33 -2
- package/dist/access-service.d.ts +4 -4
- package/dist/access-service.js +15 -15
- package/dist/action-confidence.d.ts +1 -1
- package/dist/active-memory-bridge.d.ts +1 -1
- package/dist/active-recall.d.ts +1 -1
- package/dist/active-recall.js +1 -1
- package/dist/behavior-learner.d.ts +1 -1
- package/dist/behavior-signals.d.ts +1 -1
- package/dist/bootstrap.d.ts +3 -3
- package/dist/briefing.d.ts +1 -1
- package/dist/briefing.js +3 -3
- package/dist/buffer-surprise-report.d.ts +1 -1
- package/dist/buffer.d.ts +1 -1
- package/dist/calibration.d.ts +1 -1
- package/dist/causal-behavior.d.ts +1 -1
- package/dist/causal-consolidation.d.ts +1 -1
- package/dist/causal-consolidation.js +4 -4
- package/dist/{chunk-JMQSYGXS.js → chunk-2BD7DG37.js} +2 -2
- package/dist/{chunk-FVRBLJP6.js → chunk-2MXEVL75.js} +2 -2
- package/dist/{chunk-LJCEWTG3.js → chunk-4UL7VPTD.js} +277 -58
- package/dist/chunk-4UL7VPTD.js.map +1 -0
- package/dist/{chunk-JYN7QNTA.js → chunk-54XF2FY7.js} +17 -17
- package/dist/{chunk-7WEB3FLJ.js → chunk-5PLUC5OB.js} +2 -2
- package/dist/{chunk-JX2RINDR.js → chunk-6G5JEN55.js} +2 -2
- package/dist/{chunk-ZCORQM74.js → chunk-AGJKWOKV.js} +2 -2
- package/dist/{chunk-NE2JBMLN.js → chunk-AZBV4RRY.js} +1 -1
- package/dist/chunk-AZBV4RRY.js.map +1 -0
- package/dist/{chunk-YLZLPVKK.js → chunk-CTAV55JM.js} +344 -1
- package/dist/chunk-CTAV55JM.js.map +1 -0
- package/dist/{chunk-2DSTAWNZ.js → chunk-DIBWFCLA.js} +3 -3
- package/dist/{chunk-NAZWHTYV.js → chunk-DR67OK4E.js} +5 -5
- package/dist/{chunk-XBIACVCO.js → chunk-EC2AYKRX.js} +2 -2
- package/dist/{chunk-JVRPJ7D4.js → chunk-EKQMQQ3U.js} +48 -12
- package/dist/chunk-EKQMQQ3U.js.map +1 -0
- package/dist/{chunk-RGPUQ66K.js → chunk-GCYFUTUC.js} +2 -2
- package/dist/{chunk-JBHXMCYN.js → chunk-GRYAECRV.js} +2 -2
- package/dist/{chunk-BJA6DQOC.js → chunk-GSHW5VVD.js} +5 -5
- package/dist/chunk-GYSYLGNE.js +650 -0
- package/dist/chunk-GYSYLGNE.js.map +1 -0
- package/dist/{chunk-NCGWXCSW.js → chunk-IOZ5WBWD.js} +2 -2
- package/dist/{chunk-QKK64Z6M.js → chunk-JSVFEHLL.js} +7 -5
- package/dist/chunk-JSVFEHLL.js.map +1 -0
- package/dist/{chunk-7LWRCOP7.js → chunk-LZTFCAKE.js} +2 -2
- package/dist/{chunk-2DGQLOOM.js → chunk-M3VYPE2H.js} +1 -1
- package/dist/{chunk-2DGQLOOM.js.map → chunk-M3VYPE2H.js.map} +1 -1
- package/dist/{chunk-6CVI6BP6.js → chunk-NXCK7DO7.js} +2 -2
- package/dist/{chunk-Z5MQI7K2.js → chunk-PEPHBH2W.js} +2 -2
- package/dist/{chunk-PYWNNF2I.js → chunk-QRSKPI62.js} +99 -66
- package/dist/chunk-QRSKPI62.js.map +1 -0
- package/dist/{chunk-XWQ6ERUG.js → chunk-QZRKNA5F.js} +2 -2
- package/dist/{chunk-PS3SYNHP.js → chunk-R5DB26G6.js} +2 -2
- package/dist/{chunk-OL2364SB.js → chunk-RDW5G6DO.js} +1502 -335
- package/dist/chunk-RDW5G6DO.js.map +1 -0
- package/dist/{chunk-YM3LR4LS.js → chunk-SSSXWIBP.js} +5 -5
- package/dist/{chunk-T2C6QJG2.js → chunk-SWDHVH2P.js} +2 -2
- package/dist/{chunk-DBM2BD22.js → chunk-SXYCVRLK.js} +3 -3
- package/dist/{chunk-K6X553JB.js → chunk-TFFZUFEP.js} +7 -5
- package/dist/chunk-TFFZUFEP.js.map +1 -0
- package/dist/{chunk-ENV6RDTD.js → chunk-TIJYQXDI.js} +2 -2
- package/dist/{chunk-BP2EV6W5.js → chunk-VAEAGTEQ.js} +4 -4
- package/dist/{chunk-3RACUBII.js → chunk-WIKMCJUR.js} +2 -2
- package/dist/{chunk-QW6JZO5P.js → chunk-WWMHAMAY.js} +2 -2
- package/dist/{chunk-GPW2E4LN.js → chunk-YEZHZCUO.js} +4 -4
- package/dist/{chunk-5FOCXX5E.js → chunk-YVVQUAOO.js} +3 -3
- package/dist/{chunk-5FOCXX5E.js.map → chunk-YVVQUAOO.js.map} +1 -1
- package/dist/{chunk-3XGWCZ63.js → chunk-YXLT4EMM.js} +2 -2
- package/dist/{chunk-Y2RIIF6H.js → chunk-Z6UDTNY6.js} +2 -2
- package/dist/{cli-uQgvDFNE.d.ts → cli-aYxSuPvP.d.ts} +3 -3
- package/dist/cli.d.ts +5 -5
- package/dist/cli.js +29 -29
- package/dist/compounding/engine.d.ts +1 -1
- package/dist/compounding/engine.js +3 -3
- package/dist/compounding/preference-consolidator.d.ts +1 -1
- package/dist/compression-optimizer.d.ts +1 -1
- package/dist/config.d.ts +1 -1
- package/dist/config.js +1 -1
- package/dist/connectors/codex-materialize-runner.d.ts +1 -1
- package/dist/connectors/codex-materialize-runner.js +3 -3
- package/dist/connectors/codex-materialize.d.ts +1 -1
- package/dist/connectors/index.d.ts +1 -1
- package/dist/connectors/index.js +3 -3
- package/dist/consolidation-provenance-check.d.ts +1 -1
- package/dist/consolidation-undo.d.ts +1 -1
- package/dist/contradiction/index.d.ts +1 -1
- package/dist/conversation-index/backend.d.ts +1 -1
- package/dist/conversation-index/chunker.d.ts +1 -1
- package/dist/conversation-index/faiss-adapter.d.ts +1 -1
- package/dist/conversation-index/indexer.d.ts +1 -1
- package/dist/conversation-index/search.d.ts +1 -1
- package/dist/day-summary.d.ts +1 -1
- package/dist/delinearize.d.ts +1 -1
- package/dist/direct-answer-wiring.d.ts +1 -1
- package/dist/direct-answer.d.ts +1 -1
- package/dist/embedding-fallback.d.ts +1 -1
- package/dist/enrichment/index.d.ts +1 -1
- package/dist/entity-retrieval.d.ts +1 -1
- package/dist/entity-retrieval.js +3 -3
- package/dist/entity-schema.d.ts +1 -1
- package/dist/explicit-capture.d.ts +3 -3
- package/dist/explicit-cue-recall.js +2 -2
- package/dist/extraction-judge-telemetry.d.ts +1 -1
- package/dist/extraction-judge-training.d.ts +1 -1
- package/dist/extraction-judge.d.ts +1 -1
- package/dist/extraction.d.ts +1 -1
- package/dist/fallback-llm.d.ts +1 -1
- package/dist/focused-list-recall.js +2 -2
- package/dist/identity-continuity.d.ts +1 -1
- package/dist/importance.d.ts +1 -1
- package/dist/index.d.ts +121 -121
- package/dist/index.js +39 -39
- package/dist/intent.d.ts +1 -1
- package/dist/lcm/engine.d.ts +1 -1
- package/dist/lcm/index.d.ts +1 -1
- package/dist/lcm/tools.d.ts +1 -1
- package/dist/lcm-fallback-read.js +1 -1
- package/dist/lifecycle.d.ts +1 -1
- package/dist/live-connectors-runner.d.ts +1 -1
- package/dist/local-llm.d.ts +1 -1
- package/dist/maintenance/memory-governance.d.ts +1 -1
- package/dist/maintenance/memory-governance.js +3 -3
- package/dist/maintenance/rebuild-memory-lifecycle-ledger.js +3 -3
- package/dist/maintenance/rebuild-memory-projection.js +4 -4
- package/dist/mcp-memory-inspector-app.d.ts +4 -4
- package/dist/memory-action-policy.d.ts +1 -1
- package/dist/memory-cache.d.ts +1 -1
- package/dist/memory-lifecycle-ledger-utils.d.ts +1 -1
- package/dist/memory-projection-store.d.ts +1 -1
- package/dist/memory-provenance.d.ts +1 -1
- package/dist/memory-worth-outcomes.d.ts +1 -1
- package/dist/models-json.d.ts +1 -1
- package/dist/namespaces/migrate.d.ts +1 -1
- package/dist/namespaces/migrate.js +11 -11
- package/dist/namespaces/principal.d.ts +1 -1
- package/dist/namespaces/search.d.ts +15 -4
- package/dist/namespaces/search.js +7 -7
- package/dist/namespaces/storage.d.ts +1 -1
- package/dist/namespaces/storage.js +3 -3
- package/dist/native-knowledge.d.ts +1 -1
- package/dist/operator-toolkit.d.ts +1 -1
- package/dist/operator-toolkit.js +14 -14
- package/dist/{orchestrator-B4Y4sWQH.d.ts → orchestrator-D1wcmPNj.d.ts} +17 -14
- package/dist/orchestrator.d.ts +3 -3
- package/dist/orchestrator.js +25 -25
- package/dist/patterns-cli.d.ts +1 -1
- package/dist/policy-runtime.d.ts +1 -1
- package/dist/qmd-recall-cache.d.ts +1 -1
- package/dist/qmd.d.ts +5 -1
- package/dist/qmd.js +2 -2
- package/dist/recall-disclosure-escalation.d.ts +1 -1
- package/dist/recall-explain-renderer.d.ts +1 -1
- package/dist/recall-explain-renderer.js +3 -3
- package/dist/recall-planner-llm.d.ts +1 -1
- package/dist/recall-state.d.ts +1 -1
- package/dist/recall-tag-filter.d.ts +1 -1
- package/dist/recall-xray-cli.d.ts +1 -1
- package/dist/recall-xray-cli.js +4 -4
- package/dist/recall-xray-renderer.d.ts +1 -1
- package/dist/recall-xray-renderer.js +3 -3
- package/dist/recall-xray.d.ts +1 -1
- package/dist/recall-xray.js +2 -2
- package/dist/resolve-auth-token.d.ts +1 -1
- package/dist/response-guidance-recall.js +2 -2
- package/dist/resume-bundles.js +2 -2
- package/dist/retrieval-agents.d.ts +1 -1
- package/dist/retrieval-tiers.d.ts +1 -1
- package/dist/routing/engine.d.ts +1 -1
- package/dist/routing/store.d.ts +1 -1
- package/dist/schemas.d.ts +22 -22
- package/dist/search/embed-helper.d.ts +1 -1
- package/dist/search/factory.d.ts +1 -1
- package/dist/search/factory.js +6 -6
- package/dist/search/index.d.ts +1 -1
- package/dist/search/index.js +6 -6
- package/dist/search/lancedb-backend.d.ts +1 -1
- package/dist/search/lancedb-backend.js +2 -2
- package/dist/search/meilisearch-backend.d.ts +1 -1
- package/dist/search/meilisearch-backend.js +2 -2
- package/dist/search/noop-backend.d.ts +1 -1
- package/dist/search/orama-backend.d.ts +1 -1
- package/dist/search/orama-backend.js +2 -2
- package/dist/search/port.d.ts +17 -1
- package/dist/search/port.js +1 -1
- package/dist/search/remote-backend.d.ts +1 -1
- package/dist/{semantic-consolidation-BKd0Pype.d.ts → semantic-consolidation-MWOdNtSE.d.ts} +1 -1
- package/dist/semantic-consolidation.d.ts +2 -2
- package/dist/semantic-consolidation.js +4 -4
- package/dist/semantic-rule-promotion.js +3 -3
- package/dist/semantic-rule-verifier.d.ts +3 -2
- package/dist/semantic-rule-verifier.js +5 -3
- package/dist/session-observer-bands.d.ts +1 -1
- package/dist/session-observer-state.d.ts +1 -1
- package/dist/shared-context/manager.d.ts +1 -1
- package/dist/signal.d.ts +1 -1
- package/dist/storage.d.ts +1 -1
- package/dist/storage.js +2 -2
- package/dist/summarizer.d.ts +1 -1
- package/dist/summary-snapshot.d.ts +1 -1
- package/dist/targeted-fact-recall.js +2 -2
- package/dist/temporal-supersession.d.ts +1 -1
- package/dist/temporal-validity.d.ts +1 -1
- package/dist/threading.d.ts +1 -1
- package/dist/tier-migration.d.ts +1 -1
- package/dist/tier-routing.d.ts +1 -1
- package/dist/topics.d.ts +1 -1
- package/dist/transcript.d.ts +1 -1
- package/dist/transfer/types.d.ts +12 -12
- package/dist/{types-BgChEr0M.d.ts → types-CgcCpUrf.d.ts} +51 -1
- package/dist/types.d.ts +1 -1
- package/dist/types.js +1 -1
- package/dist/utility-runtime.d.ts +1 -1
- package/dist/verified-recall.d.ts +2 -1
- package/dist/verified-recall.js +5 -3
- package/package.json +1 -1
- package/src/access-service-observe-lcm-parity.test.ts +86 -1
- package/src/access-service-observe-scope.test.ts +283 -1
- package/src/access-service-raw-excerpt-read-gate.test.ts +53 -0
- package/src/access-service.ts +391 -93
- package/src/coding/coding-namespace.ts +0 -3
- package/src/config.test.ts +69 -0
- package/src/config.ts +417 -0
- package/src/lcm-fallback-read.ts +2 -6
- package/src/maintenance/namespace-planner.test.ts +1120 -0
- package/src/maintenance/namespace-planner.ts +893 -0
- package/src/namespaces/scope-profiles.test.ts +1074 -0
- package/src/namespaces/scope-profiles.ts +456 -0
- package/src/namespaces/search.test.ts +130 -2
- package/src/namespaces/search.ts +71 -10
- package/src/orchestrator-flush.test.ts +606 -44
- package/src/orchestrator-source-attribution.test.ts +73 -0
- package/src/orchestrator.ts +932 -229
- package/src/qmd-client.test.ts +59 -0
- package/src/qmd.ts +124 -84
- package/src/search/port.ts +16 -0
- package/src/semantic-rule-verifier.ts +13 -6
- package/src/types.ts +64 -0
- package/src/verified-recall.ts +10 -6
- package/dist/chunk-JVRPJ7D4.js.map +0 -1
- package/dist/chunk-K6X553JB.js.map +0 -1
- package/dist/chunk-LJCEWTG3.js.map +0 -1
- package/dist/chunk-MMJANTJX.js +0 -339
- package/dist/chunk-MMJANTJX.js.map +0 -1
- package/dist/chunk-NE2JBMLN.js.map +0 -1
- package/dist/chunk-OL2364SB.js.map +0 -1
- package/dist/chunk-PYWNNF2I.js.map +0 -1
- package/dist/chunk-QKK64Z6M.js.map +0 -1
- package/dist/chunk-YLZLPVKK.js.map +0 -1
- /package/dist/{chunk-JMQSYGXS.js.map → chunk-2BD7DG37.js.map} +0 -0
- /package/dist/{chunk-FVRBLJP6.js.map → chunk-2MXEVL75.js.map} +0 -0
- /package/dist/{chunk-JYN7QNTA.js.map → chunk-54XF2FY7.js.map} +0 -0
- /package/dist/{chunk-7WEB3FLJ.js.map → chunk-5PLUC5OB.js.map} +0 -0
- /package/dist/{chunk-JX2RINDR.js.map → chunk-6G5JEN55.js.map} +0 -0
- /package/dist/{chunk-ZCORQM74.js.map → chunk-AGJKWOKV.js.map} +0 -0
- /package/dist/{chunk-2DSTAWNZ.js.map → chunk-DIBWFCLA.js.map} +0 -0
- /package/dist/{chunk-NAZWHTYV.js.map → chunk-DR67OK4E.js.map} +0 -0
- /package/dist/{chunk-XBIACVCO.js.map → chunk-EC2AYKRX.js.map} +0 -0
- /package/dist/{chunk-RGPUQ66K.js.map → chunk-GCYFUTUC.js.map} +0 -0
- /package/dist/{chunk-JBHXMCYN.js.map → chunk-GRYAECRV.js.map} +0 -0
- /package/dist/{chunk-BJA6DQOC.js.map → chunk-GSHW5VVD.js.map} +0 -0
- /package/dist/{chunk-NCGWXCSW.js.map → chunk-IOZ5WBWD.js.map} +0 -0
- /package/dist/{chunk-7LWRCOP7.js.map → chunk-LZTFCAKE.js.map} +0 -0
- /package/dist/{chunk-6CVI6BP6.js.map → chunk-NXCK7DO7.js.map} +0 -0
- /package/dist/{chunk-Z5MQI7K2.js.map → chunk-PEPHBH2W.js.map} +0 -0
- /package/dist/{chunk-XWQ6ERUG.js.map → chunk-QZRKNA5F.js.map} +0 -0
- /package/dist/{chunk-PS3SYNHP.js.map → chunk-R5DB26G6.js.map} +0 -0
- /package/dist/{chunk-YM3LR4LS.js.map → chunk-SSSXWIBP.js.map} +0 -0
- /package/dist/{chunk-T2C6QJG2.js.map → chunk-SWDHVH2P.js.map} +0 -0
- /package/dist/{chunk-DBM2BD22.js.map → chunk-SXYCVRLK.js.map} +0 -0
- /package/dist/{chunk-ENV6RDTD.js.map → chunk-TIJYQXDI.js.map} +0 -0
- /package/dist/{chunk-BP2EV6W5.js.map → chunk-VAEAGTEQ.js.map} +0 -0
- /package/dist/{chunk-3RACUBII.js.map → chunk-WIKMCJUR.js.map} +0 -0
- /package/dist/{chunk-QW6JZO5P.js.map → chunk-WWMHAMAY.js.map} +0 -0
- /package/dist/{chunk-GPW2E4LN.js.map → chunk-YEZHZCUO.js.map} +0 -0
- /package/dist/{chunk-3XGWCZ63.js.map → chunk-YXLT4EMM.js.map} +0 -0
- /package/dist/{chunk-Y2RIIF6H.js.map → chunk-Z6UDTNY6.js.map} +0 -0
|
@@ -14,7 +14,7 @@ import {
|
|
|
14
14
|
} from "./chunk-H7XKCNR6.js";
|
|
15
15
|
import {
|
|
16
16
|
toRecallExplainJson
|
|
17
|
-
} from "./chunk-
|
|
17
|
+
} from "./chunk-TIJYQXDI.js";
|
|
18
18
|
import {
|
|
19
19
|
applyTagFilter,
|
|
20
20
|
normalizeTags,
|
|
@@ -27,15 +27,17 @@ import {
|
|
|
27
27
|
listMemoryGovernanceRuns,
|
|
28
28
|
readMemoryGovernanceRunArtifact,
|
|
29
29
|
runMemoryGovernance
|
|
30
|
-
} from "./chunk-
|
|
30
|
+
} from "./chunk-QZRKNA5F.js";
|
|
31
31
|
import {
|
|
32
32
|
clusterByKey,
|
|
33
33
|
combineNamespaces,
|
|
34
|
+
expandScopeProfileReadNamespaces,
|
|
34
35
|
lcmSessionKeyForNamespace,
|
|
35
36
|
projectTagProjectId,
|
|
36
37
|
resolveCodingNamespaceOverlay,
|
|
37
|
-
resolveGitContext
|
|
38
|
-
|
|
38
|
+
resolveGitContext,
|
|
39
|
+
resolveScopeProfilePlan
|
|
40
|
+
} from "./chunk-GYSYLGNE.js";
|
|
39
41
|
import {
|
|
40
42
|
getTrustZoneStoreStatus,
|
|
41
43
|
isTrustZoneName,
|
|
@@ -50,10 +52,10 @@ import {
|
|
|
50
52
|
} from "./chunk-FF4KLI5W.js";
|
|
51
53
|
import {
|
|
52
54
|
estimateRecallTokens
|
|
53
|
-
} from "./chunk-
|
|
55
|
+
} from "./chunk-2MXEVL75.js";
|
|
54
56
|
import {
|
|
55
57
|
namespaceCollectionName
|
|
56
|
-
} from "./chunk-
|
|
58
|
+
} from "./chunk-EKQMQQ3U.js";
|
|
57
59
|
import {
|
|
58
60
|
namespaceIdentityFromToken
|
|
59
61
|
} from "./chunk-ZFXCQPNO.js";
|
|
@@ -92,14 +94,14 @@ import {
|
|
|
92
94
|
buildBriefing,
|
|
93
95
|
parseBriefingFocus,
|
|
94
96
|
parseBriefingWindow
|
|
95
|
-
} from "./chunk-
|
|
97
|
+
} from "./chunk-Z6UDTNY6.js";
|
|
96
98
|
import {
|
|
97
99
|
parseEntityFile
|
|
98
|
-
} from "./chunk-
|
|
100
|
+
} from "./chunk-NXCK7DO7.js";
|
|
99
101
|
import {
|
|
100
102
|
DEFAULT_RECALL_DISCLOSURE,
|
|
101
103
|
isRecallDisclosure
|
|
102
|
-
} from "./chunk-
|
|
104
|
+
} from "./chunk-AZBV4RRY.js";
|
|
103
105
|
import {
|
|
104
106
|
inferMemoryStatus,
|
|
105
107
|
toMemoryPathRel
|
|
@@ -789,11 +791,32 @@ var EngramAccessService = class {
|
|
|
789
791
|
);
|
|
790
792
|
}
|
|
791
793
|
const hasSession = typeof request.sessionKey === "string" && request.sessionKey.length > 0;
|
|
794
|
+
const codingContext = hasSession && this.orchestrator.config.namespacesEnabled && this.orchestrator.config.codingMode?.projectScope ? this.orchestrator.getCodingContextForSession(request.sessionKey) ?? await this.resolveCodingContextFromOptions(request) : null;
|
|
792
795
|
const overlay = hasSession && this.orchestrator.config.namespacesEnabled && this.orchestrator.config.codingMode?.projectScope ? resolveCodingNamespaceOverlay(
|
|
793
|
-
|
|
796
|
+
codingContext,
|
|
794
797
|
this.orchestrator.config.codingMode,
|
|
795
798
|
this.orchestrator.config.defaultNamespace
|
|
796
799
|
) : null;
|
|
800
|
+
const principal = this.resolveRequestPrincipal(
|
|
801
|
+
request.sessionKey,
|
|
802
|
+
request.authenticatedPrincipal
|
|
803
|
+
);
|
|
804
|
+
const profilePlan = resolveScopeProfilePlan({
|
|
805
|
+
config: this.orchestrator.config,
|
|
806
|
+
principal,
|
|
807
|
+
codingContext,
|
|
808
|
+
codingOverlay: overlay
|
|
809
|
+
});
|
|
810
|
+
if (profilePlan) {
|
|
811
|
+
const selectedLayer = profilePlan.layers.find((layer) => layer.id === profilePlan.writeLayer);
|
|
812
|
+
const writeNamespaceReadable = profilePlan.writeNamespace.length > 0 && profilePlan.readNamespaces.includes(profilePlan.writeNamespace);
|
|
813
|
+
if (!selectedLayer?.writable || !writeNamespaceReadable) {
|
|
814
|
+
throw new EngramAccessInputError(
|
|
815
|
+
`scope profile ${profilePlan.profileId} has no writable layer inside the profile read stack for principal ${principal ?? "anonymous"}`
|
|
816
|
+
);
|
|
817
|
+
}
|
|
818
|
+
return profilePlan.writeNamespace;
|
|
819
|
+
}
|
|
797
820
|
if (!overlay) {
|
|
798
821
|
return this.resolveWritableNamespace(
|
|
799
822
|
void 0,
|
|
@@ -801,10 +824,6 @@ var EngramAccessService = class {
|
|
|
801
824
|
request.authenticatedPrincipal
|
|
802
825
|
);
|
|
803
826
|
}
|
|
804
|
-
const principal = this.resolveRequestPrincipal(
|
|
805
|
-
request.sessionKey,
|
|
806
|
-
request.authenticatedPrincipal
|
|
807
|
-
);
|
|
808
827
|
const base = defaultNamespaceForPrincipal(principal, this.orchestrator.config);
|
|
809
828
|
if (!canWriteNamespace(principal, base, this.orchestrator.config)) {
|
|
810
829
|
throw new EngramAccessInputError(`namespace is not writable: ${base}`);
|
|
@@ -887,6 +906,55 @@ var EngramAccessService = class {
|
|
|
887
906
|
baseNamespace
|
|
888
907
|
);
|
|
889
908
|
const codingOverlayApplied = overlaidBase !== baseNamespace;
|
|
909
|
+
const codingOverlay = overlayEligible ? resolveCodingNamespaceOverlay(
|
|
910
|
+
attachedContext,
|
|
911
|
+
this.orchestrator.config.codingMode,
|
|
912
|
+
this.orchestrator.config.defaultNamespace
|
|
913
|
+
) : null;
|
|
914
|
+
const profilePlan = resolveScopeProfilePlan({
|
|
915
|
+
config: this.orchestrator.config,
|
|
916
|
+
principal,
|
|
917
|
+
codingContext: attachedContext,
|
|
918
|
+
codingOverlay
|
|
919
|
+
});
|
|
920
|
+
if (profilePlan) {
|
|
921
|
+
const selectedLayer = profilePlan.layers.find((layer) => layer.id === profilePlan.writeLayer);
|
|
922
|
+
const writeNamespaceReadable = profilePlan.writeNamespace.length > 0 && profilePlan.readNamespaces.includes(profilePlan.writeNamespace);
|
|
923
|
+
if (!selectedLayer?.writable || !writeNamespaceReadable) {
|
|
924
|
+
clearSeededContext();
|
|
925
|
+
throw new EngramAccessInputError(
|
|
926
|
+
`scope profile ${profilePlan.profileId} has no writable layer inside the profile read stack for principal ${principal ?? "anonymous"}`
|
|
927
|
+
);
|
|
928
|
+
}
|
|
929
|
+
const legacyRecallNamespaces = Array.isArray(this.orchestrator.config.defaultRecallNamespaces) ? recallNamespacesForPrincipal(principal, this.orchestrator.config) : [];
|
|
930
|
+
const expandedReadNamespaces = expandScopeProfileReadNamespaces({
|
|
931
|
+
profilePlan,
|
|
932
|
+
principalSelfNamespace: profilePlan.baseNamespace,
|
|
933
|
+
config: this.orchestrator.config,
|
|
934
|
+
principal,
|
|
935
|
+
codingOverlay,
|
|
936
|
+
legacyRecallNamespaces
|
|
937
|
+
});
|
|
938
|
+
const readNamespaces2 = expandedReadNamespaces;
|
|
939
|
+
const profileCodingOverlayApplied = Boolean(
|
|
940
|
+
codingOverlay && profilePlan.layers.some(
|
|
941
|
+
(layer) => (layer.id === "userProject" || layer.id === "teamProject") && layer.readable && layer.namespace && readNamespaces2.includes(layer.namespace)
|
|
942
|
+
)
|
|
943
|
+
);
|
|
944
|
+
return {
|
|
945
|
+
principal,
|
|
946
|
+
baseNamespace: profilePlan.baseNamespace,
|
|
947
|
+
writeNamespace: profilePlan.writeNamespace,
|
|
948
|
+
objectiveStateNamespace: profilePlan.writeNamespace,
|
|
949
|
+
readNamespaces: readNamespaces2,
|
|
950
|
+
scopeProfile: profilePlan.profileId,
|
|
951
|
+
writeLayer: profilePlan.writeLayer,
|
|
952
|
+
layers: profilePlan.layers,
|
|
953
|
+
promotionTargets: profilePlan.promotionTargets,
|
|
954
|
+
codingOverlayApplied: profileCodingOverlayApplied,
|
|
955
|
+
warnings: [...warnings, ...profilePlan.warnings]
|
|
956
|
+
};
|
|
957
|
+
}
|
|
890
958
|
if (!codingOverlayApplied) {
|
|
891
959
|
const writeNamespace2 = this.resolveWritableNamespace(
|
|
892
960
|
void 0,
|
|
@@ -926,12 +994,7 @@ var EngramAccessService = class {
|
|
|
926
994
|
}
|
|
927
995
|
const writeNamespace = overlaidBase;
|
|
928
996
|
const readNamespaces = [writeNamespace];
|
|
929
|
-
const
|
|
930
|
-
attachedContext,
|
|
931
|
-
this.orchestrator.config.codingMode,
|
|
932
|
-
this.orchestrator.config.defaultNamespace
|
|
933
|
-
);
|
|
934
|
-
for (const fallback of overlay?.readFallbacks ?? []) {
|
|
997
|
+
for (const fallback of codingOverlay?.readFallbacks ?? []) {
|
|
935
998
|
const ns = combineNamespaces(baseNamespace, fallback);
|
|
936
999
|
if (!readNamespaces.includes(ns)) readNamespaces.push(ns);
|
|
937
1000
|
}
|
|
@@ -945,6 +1008,13 @@ var EngramAccessService = class {
|
|
|
945
1008
|
warnings
|
|
946
1009
|
};
|
|
947
1010
|
}
|
|
1011
|
+
legacyResponseNamespaceForScope(scope) {
|
|
1012
|
+
if (scope.explicitNamespace) return scope.writeNamespace;
|
|
1013
|
+
if (scope.scopeProfile && scope.writeLayer !== "userProject") {
|
|
1014
|
+
return scope.writeNamespace;
|
|
1015
|
+
}
|
|
1016
|
+
return scope.codingOverlayApplied ? this.orchestrator.config.defaultNamespace : scope.writeNamespace;
|
|
1017
|
+
}
|
|
948
1018
|
async objectiveStateStoreLocationForNamespace(namespace) {
|
|
949
1019
|
if (!this.orchestrator.config.namespacesEnabled) {
|
|
950
1020
|
return {
|
|
@@ -992,7 +1062,28 @@ var EngramAccessService = class {
|
|
|
992
1062
|
"authentication required: namespaces are enabled and no principal was supplied"
|
|
993
1063
|
);
|
|
994
1064
|
}
|
|
995
|
-
|
|
1065
|
+
const legacyRecallNamespaces = recallNamespacesForPrincipal(
|
|
1066
|
+
principal,
|
|
1067
|
+
this.orchestrator.config
|
|
1068
|
+
);
|
|
1069
|
+
const profilePlan = resolveScopeProfilePlan({
|
|
1070
|
+
config: this.orchestrator.config,
|
|
1071
|
+
principal,
|
|
1072
|
+
codingContext: null,
|
|
1073
|
+
codingOverlay: null
|
|
1074
|
+
});
|
|
1075
|
+
const namespaces = profilePlan ? expandScopeProfileReadNamespaces({
|
|
1076
|
+
profilePlan,
|
|
1077
|
+
principalSelfNamespace: profilePlan.baseNamespace,
|
|
1078
|
+
config: this.orchestrator.config,
|
|
1079
|
+
principal,
|
|
1080
|
+
codingOverlay: null,
|
|
1081
|
+
legacyRecallNamespaces
|
|
1082
|
+
}) : legacyRecallNamespaces;
|
|
1083
|
+
if (profilePlan) return namespaces;
|
|
1084
|
+
return namespaces.filter(
|
|
1085
|
+
(ns) => canReadNamespace(principal, ns, this.orchestrator.config)
|
|
1086
|
+
);
|
|
996
1087
|
}
|
|
997
1088
|
resolveAllReadableConfiguredNamespaces(principal) {
|
|
998
1089
|
const config = this.orchestrator.config;
|
|
@@ -1011,7 +1102,13 @@ var EngramAccessService = class {
|
|
|
1011
1102
|
if (!collection || collection === "global" || collection === baseCollection) {
|
|
1012
1103
|
return namespaces;
|
|
1013
1104
|
}
|
|
1014
|
-
const
|
|
1105
|
+
const activeScopeProfilePlan = collectionPrincipal ? resolveScopeProfilePlan({
|
|
1106
|
+
config: this.orchestrator.config,
|
|
1107
|
+
principal: collectionPrincipal,
|
|
1108
|
+
codingContext: null,
|
|
1109
|
+
codingOverlay: null
|
|
1110
|
+
}) : null;
|
|
1111
|
+
const candidates = collectionPrincipal ? activeScopeProfilePlan ? namespaces : this.resolveAllReadableConfiguredNamespaces(collectionPrincipal) : namespaces;
|
|
1015
1112
|
const matchedNamespaces = candidates.filter((namespace) => {
|
|
1016
1113
|
const canonical = namespaceCollectionName(baseCollection, namespace, {
|
|
1017
1114
|
defaultNamespace: this.orchestrator.config.defaultNamespace,
|
|
@@ -1078,7 +1175,7 @@ var EngramAccessService = class {
|
|
|
1078
1175
|
query: options.query,
|
|
1079
1176
|
...options.sessionKey ? { sessionKey: options.sessionKey } : {},
|
|
1080
1177
|
...options.rawExcerptNamespace ? { rawExcerptNamespace: options.rawExcerptNamespace } : {},
|
|
1081
|
-
...options.rawExcerptSessionIds ? { rawExcerptSessionIds: options.rawExcerptSessionIds } : {},
|
|
1178
|
+
...options.rawExcerptSessionIds !== void 0 ? { rawExcerptSessionIds: options.rawExcerptSessionIds } : {},
|
|
1082
1179
|
...options.rawExcerptsSuppressed ? { rawExcerptsSuppressed: options.rawExcerptsSuppressed } : {}
|
|
1083
1180
|
}
|
|
1084
1181
|
);
|
|
@@ -1222,7 +1319,7 @@ var EngramAccessService = class {
|
|
|
1222
1319
|
query: rawContext.query,
|
|
1223
1320
|
...rawContext.sessionKey ? { sessionKey: rawContext.sessionKey } : {},
|
|
1224
1321
|
namespace: rawContext.rawExcerptNamespace ?? namespace,
|
|
1225
|
-
...rawContext.rawExcerptSessionIds ? { lcmSessionIds: rawContext.rawExcerptSessionIds } : {}
|
|
1322
|
+
...rawContext.rawExcerptSessionIds !== void 0 ? { lcmSessionIds: rawContext.rawExcerptSessionIds } : {}
|
|
1226
1323
|
} : null
|
|
1227
1324
|
);
|
|
1228
1325
|
const rawExcerpts = rawExcerptsResult ?? void 0;
|
|
@@ -1322,18 +1419,19 @@ var EngramAccessService = class {
|
|
|
1322
1419
|
if (!lcm || !lcm.enabled) return [];
|
|
1323
1420
|
try {
|
|
1324
1421
|
const legacyKey = context.namespace && context.namespace !== this.orchestrator.config.defaultNamespace ? `${context.namespace}:${context.sessionKey}` : context.sessionKey;
|
|
1325
|
-
const lcmSessionIds = context.lcmSessionIds
|
|
1422
|
+
const lcmSessionIds = context.lcmSessionIds !== void 0 ? context.lcmSessionIds : [legacyKey];
|
|
1326
1423
|
const limit = 5;
|
|
1327
1424
|
const seenRows = /* @__PURE__ */ new Set();
|
|
1328
1425
|
const excerpts = [];
|
|
1329
|
-
|
|
1426
|
+
const settledRows = await Promise.allSettled(
|
|
1427
|
+
lcmSessionIds.map(
|
|
1428
|
+
async (lcmSessionKey) => lcm.searchContextFull(context.query, limit, lcmSessionKey)
|
|
1429
|
+
)
|
|
1430
|
+
);
|
|
1431
|
+
for (const result of settledRows) {
|
|
1330
1432
|
if (excerpts.length >= limit) break;
|
|
1331
|
-
|
|
1332
|
-
|
|
1333
|
-
limit,
|
|
1334
|
-
lcmSessionKey
|
|
1335
|
-
);
|
|
1336
|
-
for (const r of rows) {
|
|
1433
|
+
if (result.status !== "fulfilled") continue;
|
|
1434
|
+
for (const r of result.value) {
|
|
1337
1435
|
const dedupeKey = `${r.session_id} ${r.turn_index}`;
|
|
1338
1436
|
if (seenRows.has(dedupeKey)) continue;
|
|
1339
1437
|
seenRows.add(dedupeKey);
|
|
@@ -1923,8 +2021,29 @@ var EngramAccessService = class {
|
|
|
1923
2021
|
}
|
|
1924
2022
|
const principal = maybePrincipal ?? "default";
|
|
1925
2023
|
const principalNamespace = defaultNamespaceForPrincipal(principal, this.orchestrator.config);
|
|
2024
|
+
const profileCodingContext = request.sessionKey && typeof this.orchestrator.getCodingContextForSession === "function" ? this.orchestrator.getCodingContextForSession(request.sessionKey) : null;
|
|
2025
|
+
const profileCodingOverlay = !namespaceOverride && profileCodingContext && this.orchestrator.config.namespacesEnabled && this.orchestrator.config.codingMode?.projectScope ? resolveCodingNamespaceOverlay(
|
|
2026
|
+
profileCodingContext,
|
|
2027
|
+
this.orchestrator.config.codingMode,
|
|
2028
|
+
this.orchestrator.config.defaultNamespace
|
|
2029
|
+
) : null;
|
|
2030
|
+
const profilePlan = namespaceOverride ? null : resolveScopeProfilePlan({
|
|
2031
|
+
config: this.orchestrator.config,
|
|
2032
|
+
principal,
|
|
2033
|
+
codingContext: profileCodingContext,
|
|
2034
|
+
codingOverlay: profileCodingOverlay
|
|
2035
|
+
});
|
|
1926
2036
|
const modeSkipsBudget = mode === "no_recall";
|
|
1927
|
-
const
|
|
2037
|
+
const legacyRecallNamespaces = Array.isArray(this.orchestrator.config.defaultRecallNamespaces) ? recallNamespacesForPrincipal(principal, this.orchestrator.config) : [];
|
|
2038
|
+
const effectiveNamespaces = namespaceOverride ? [namespaceOverride] : profilePlan ? expandScopeProfileReadNamespaces({
|
|
2039
|
+
profilePlan,
|
|
2040
|
+
principalSelfNamespace: profilePlan.baseNamespace,
|
|
2041
|
+
config: this.orchestrator.config,
|
|
2042
|
+
principal,
|
|
2043
|
+
codingOverlay: profileCodingOverlay,
|
|
2044
|
+
legacyRecallNamespaces
|
|
2045
|
+
}) : legacyRecallNamespaces;
|
|
2046
|
+
const budgetPrincipalNamespace = profilePlan?.baseNamespace ?? principalNamespace;
|
|
1928
2047
|
let budgetDecision;
|
|
1929
2048
|
let recordBudgetAfterSuccess = false;
|
|
1930
2049
|
if (modeSkipsBudget) {
|
|
@@ -1945,7 +2064,7 @@ var EngramAccessService = class {
|
|
|
1945
2064
|
for (const ns of effectiveNamespaces) {
|
|
1946
2065
|
const peek = this.budget.peek({
|
|
1947
2066
|
principal,
|
|
1948
|
-
principalNamespace,
|
|
2067
|
+
principalNamespace: budgetPrincipalNamespace,
|
|
1949
2068
|
queryNamespace: ns
|
|
1950
2069
|
});
|
|
1951
2070
|
if (peek.reason !== "allowed-same-namespace") {
|
|
@@ -2049,7 +2168,7 @@ var EngramAccessService = class {
|
|
|
2049
2168
|
query,
|
|
2050
2169
|
sessionKey: trimmedSessionKey,
|
|
2051
2170
|
...rawExcerptNamespace ? { rawExcerptNamespace } : {},
|
|
2052
|
-
...rawExcerptSessionIds ? { rawExcerptSessionIds } : {},
|
|
2171
|
+
...rawExcerptSessionIds !== void 0 ? { rawExcerptSessionIds } : {},
|
|
2053
2172
|
...rawExcerptsSuppressed ? { rawExcerptsSuppressed } : {}
|
|
2054
2173
|
});
|
|
2055
2174
|
const filterTags = normalizeTags(request.tags);
|
|
@@ -2347,7 +2466,7 @@ var EngramAccessService = class {
|
|
|
2347
2466
|
query,
|
|
2348
2467
|
...trimmedSessionKey ? { sessionKey: trimmedSessionKey } : {},
|
|
2349
2468
|
...rawExcerptNamespace ? { namespace: rawExcerptNamespace } : {},
|
|
2350
|
-
...rawExcerptSessionIds ? { lcmSessionIds: rawExcerptSessionIds } : {}
|
|
2469
|
+
...rawExcerptSessionIds !== void 0 ? { lcmSessionIds: rawExcerptSessionIds } : {}
|
|
2351
2470
|
}) : disclosure2 === "raw" ? [] : null;
|
|
2352
2471
|
const rawExcerptText = rawExcerpts && rawExcerpts.length > 0 ? rawExcerpts.map((e) => e.content).join("\n") : "";
|
|
2353
2472
|
const memoryByIndex = await Promise.all(
|
|
@@ -2426,7 +2545,7 @@ var EngramAccessService = class {
|
|
|
2426
2545
|
requestedMode: request.mode,
|
|
2427
2546
|
normalizedMode: mode,
|
|
2428
2547
|
...xrayRawExcerptNamespace ? { rawExcerptNamespace: xrayRawExcerptNamespace } : {},
|
|
2429
|
-
...xrayRawExcerptSessionIds ? { rawExcerptSessionIds: xrayRawExcerptSessionIds } : {},
|
|
2548
|
+
...xrayRawExcerptSessionIds !== void 0 ? { rawExcerptSessionIds: xrayRawExcerptSessionIds } : {},
|
|
2430
2549
|
...xrayRawExcerptsSuppressed ? { rawExcerptsSuppressed: xrayRawExcerptsSuppressed } : {}
|
|
2431
2550
|
})
|
|
2432
2551
|
};
|
|
@@ -3366,7 +3485,7 @@ var EngramAccessService = class {
|
|
|
3366
3485
|
}
|
|
3367
3486
|
const scope = await this.resolveMemoryScopePlan(request);
|
|
3368
3487
|
const writeNamespace = scope.writeNamespace;
|
|
3369
|
-
const namespace =
|
|
3488
|
+
const namespace = this.legacyResponseNamespaceForScope(scope);
|
|
3370
3489
|
const shouldWriteObjectiveState = this.orchestrator.config.objectiveStateMemoryEnabled === true && this.orchestrator.config.objectiveStateSnapshotWritesEnabled === true;
|
|
3371
3490
|
await this.maybeAttachCodingContext(request.sessionKey, {
|
|
3372
3491
|
cwd: request.cwd,
|
|
@@ -3455,7 +3574,11 @@ var EngramAccessService = class {
|
|
|
3455
3574
|
baseNamespace: scope.baseNamespace,
|
|
3456
3575
|
writeNamespace: scope.writeNamespace,
|
|
3457
3576
|
codingOverlayApplied: scope.codingOverlayApplied,
|
|
3458
|
-
readNamespaces: scope.readNamespaces
|
|
3577
|
+
readNamespaces: scope.readNamespaces,
|
|
3578
|
+
scopeProfile: scope.scopeProfile,
|
|
3579
|
+
writeLayer: scope.writeLayer,
|
|
3580
|
+
layers: scope.layers,
|
|
3581
|
+
promotionTargets: scope.promotionTargets
|
|
3459
3582
|
},
|
|
3460
3583
|
lcmArchived,
|
|
3461
3584
|
extractionQueued
|
|
@@ -3467,7 +3590,11 @@ var EngramAccessService = class {
|
|
|
3467
3590
|
}
|
|
3468
3591
|
const principal = this.resolveRequestPrincipal(request.sessionKey, request.authenticatedPrincipal);
|
|
3469
3592
|
const hasExplicitNamespace = typeof request.namespace === "string" && request.namespace.trim().length > 0;
|
|
3470
|
-
const
|
|
3593
|
+
const profileLcmReadNamespaces = hasExplicitNamespace ? null : this.resolveScopeProfileLcmReadNamespaces(
|
|
3594
|
+
request.sessionKey,
|
|
3595
|
+
request.authenticatedPrincipal
|
|
3596
|
+
);
|
|
3597
|
+
const namespace = hasExplicitNamespace ? this.resolveReadableNamespace(request.namespace, principal) : profileLcmReadNamespaces !== null ? profileLcmReadNamespaces[0] : this.resolveImplicitLcmReadFallbackNamespace(principal);
|
|
3471
3598
|
if (!this.orchestrator.lcmEngine || !this.orchestrator.lcmEngine.enabled) {
|
|
3472
3599
|
return {
|
|
3473
3600
|
query: request.query,
|
|
@@ -3477,6 +3604,15 @@ var EngramAccessService = class {
|
|
|
3477
3604
|
lcmEnabled: false
|
|
3478
3605
|
};
|
|
3479
3606
|
}
|
|
3607
|
+
if (profileLcmReadNamespaces !== null && profileLcmReadNamespaces.length === 0) {
|
|
3608
|
+
return {
|
|
3609
|
+
query: request.query,
|
|
3610
|
+
namespace: this.orchestrator.config.defaultNamespace,
|
|
3611
|
+
results: [],
|
|
3612
|
+
count: 0,
|
|
3613
|
+
lcmEnabled: true
|
|
3614
|
+
};
|
|
3615
|
+
}
|
|
3480
3616
|
if (namespace === void 0) {
|
|
3481
3617
|
return {
|
|
3482
3618
|
query: request.query,
|
|
@@ -3487,24 +3623,32 @@ var EngramAccessService = class {
|
|
|
3487
3623
|
};
|
|
3488
3624
|
}
|
|
3489
3625
|
const limit = Math.max(1, Math.min(request.limit ?? 10, 100));
|
|
3490
|
-
const lcmReadNamespace = this.resolveLcmReadNamespace(
|
|
3626
|
+
const lcmReadNamespace = profileLcmReadNamespaces !== null ? profileLcmReadNamespaces[0] ?? this.orchestrator.config.defaultNamespace : this.resolveLcmReadNamespace(
|
|
3491
3627
|
request.namespace,
|
|
3492
3628
|
namespace,
|
|
3493
3629
|
request.sessionKey,
|
|
3494
3630
|
request.authenticatedPrincipal
|
|
3495
3631
|
);
|
|
3496
|
-
const lcmSessionKeyIds = request.sessionKey ? this.
|
|
3632
|
+
const lcmSessionKeyIds = request.sessionKey ? profileLcmReadNamespaces !== null ? this.lcmSessionIdsForNamespaces(
|
|
3633
|
+
profileLcmReadNamespaces,
|
|
3634
|
+
request.sessionKey
|
|
3635
|
+
) : this.resolveLcmReadSessionIds(
|
|
3497
3636
|
request.namespace,
|
|
3498
3637
|
namespace,
|
|
3499
3638
|
request.sessionKey,
|
|
3500
3639
|
request.authenticatedPrincipal
|
|
3501
3640
|
) : [void 0];
|
|
3502
|
-
const
|
|
3503
|
-
|
|
3504
|
-
request.sessionPrefix
|
|
3505
|
-
|
|
3506
|
-
|
|
3507
|
-
|
|
3641
|
+
const lcmSessionPrefixes = request.sessionPrefix ? profileLcmReadNamespaces !== null && !request.sessionKey ? this.lcmSessionIdsForNamespaces(
|
|
3642
|
+
profileLcmReadNamespaces,
|
|
3643
|
+
request.sessionPrefix
|
|
3644
|
+
) : [
|
|
3645
|
+
lcmSessionKeyForNamespace(
|
|
3646
|
+
lcmReadNamespace,
|
|
3647
|
+
request.sessionPrefix,
|
|
3648
|
+
this.orchestrator.config.defaultNamespace
|
|
3649
|
+
) ?? request.sessionPrefix
|
|
3650
|
+
] : [void 0];
|
|
3651
|
+
const hasScopedSession = typeof request.sessionKey === "string" && request.sessionKey.length > 0 || lcmSessionPrefixes.some((prefix) => typeof prefix === "string" && prefix.length > 0);
|
|
3508
3652
|
if (!hasScopedSession && this.orchestrator.config.namespacesEnabled === true) {
|
|
3509
3653
|
return {
|
|
3510
3654
|
query: request.query,
|
|
@@ -3516,15 +3660,35 @@ var EngramAccessService = class {
|
|
|
3516
3660
|
}
|
|
3517
3661
|
const seenRows = /* @__PURE__ */ new Set();
|
|
3518
3662
|
const results = [];
|
|
3663
|
+
const lcmSearches = [];
|
|
3519
3664
|
for (const lcmSessionKey of lcmSessionKeyIds) {
|
|
3665
|
+
for (const lcmSessionPrefix of lcmSessionPrefixes) {
|
|
3666
|
+
lcmSearches.push({
|
|
3667
|
+
key: lcmSessionKey,
|
|
3668
|
+
prefix: lcmSessionPrefix,
|
|
3669
|
+
promise: this.orchestrator.lcmEngine.searchContextFull(
|
|
3670
|
+
request.query,
|
|
3671
|
+
limit,
|
|
3672
|
+
lcmSessionKey,
|
|
3673
|
+
lcmSessionPrefix
|
|
3674
|
+
)
|
|
3675
|
+
});
|
|
3676
|
+
}
|
|
3677
|
+
}
|
|
3678
|
+
const settledSearches = await Promise.allSettled(
|
|
3679
|
+
lcmSearches.map((search) => search.promise)
|
|
3680
|
+
);
|
|
3681
|
+
for (let i = 0; i < settledSearches.length; i += 1) {
|
|
3520
3682
|
if (results.length >= limit) break;
|
|
3521
|
-
const
|
|
3522
|
-
|
|
3523
|
-
|
|
3524
|
-
|
|
3525
|
-
|
|
3526
|
-
|
|
3527
|
-
|
|
3683
|
+
const settled = settledSearches[i];
|
|
3684
|
+
if (!settled || settled.status === "rejected") {
|
|
3685
|
+
const failed = lcmSearches[i];
|
|
3686
|
+
log.warn(
|
|
3687
|
+
`lcmSearch: failed for key=${failed?.key ?? "<none>"} prefix=${failed?.prefix ?? "<none>"}: ${settled?.status === "rejected" ? settled.reason : "missing result"}`
|
|
3688
|
+
);
|
|
3689
|
+
continue;
|
|
3690
|
+
}
|
|
3691
|
+
for (const r of settled.value) {
|
|
3528
3692
|
const dedupeKey = `${r.session_id}\0${r.turn_index}`;
|
|
3529
3693
|
if (seenRows.has(dedupeKey)) continue;
|
|
3530
3694
|
seenRows.add(dedupeKey);
|
|
@@ -3669,6 +3833,11 @@ var EngramAccessService = class {
|
|
|
3669
3833
|
"read"
|
|
3670
3834
|
);
|
|
3671
3835
|
}
|
|
3836
|
+
const profileReadNamespaces = this.resolveScopeProfileLcmReadNamespaces(
|
|
3837
|
+
sessionKey,
|
|
3838
|
+
authenticatedPrincipal
|
|
3839
|
+
);
|
|
3840
|
+
if (profileReadNamespaces !== null) return profileReadNamespaces[0];
|
|
3672
3841
|
const fallbackNamespace = this.resolveImplicitLcmReadFallbackNamespace(principal);
|
|
3673
3842
|
if (fallbackNamespace === void 0) return void 0;
|
|
3674
3843
|
return this.resolveLcmReadNamespace(
|
|
@@ -3763,6 +3932,49 @@ var EngramAccessService = class {
|
|
|
3763
3932
|
* `<principal>-project-*` key is ever searched for an unauthorized reader (no
|
|
3764
3933
|
* cross-tenant read leak).
|
|
3765
3934
|
*/
|
|
3935
|
+
resolveScopeProfileLcmReadNamespaces(sessionKey, authenticatedPrincipal) {
|
|
3936
|
+
const config = this.orchestrator.config;
|
|
3937
|
+
const principal = this.resolveRequestPrincipal(sessionKey, authenticatedPrincipal);
|
|
3938
|
+
const codingContext = sessionKey ? this.orchestrator.getCodingContextForSession(sessionKey) : null;
|
|
3939
|
+
const codingOverlay = resolveCodingNamespaceOverlay(
|
|
3940
|
+
codingContext,
|
|
3941
|
+
config.codingMode,
|
|
3942
|
+
config.defaultNamespace
|
|
3943
|
+
);
|
|
3944
|
+
const profilePlan = resolveScopeProfilePlan({
|
|
3945
|
+
config,
|
|
3946
|
+
principal,
|
|
3947
|
+
codingContext,
|
|
3948
|
+
codingOverlay
|
|
3949
|
+
});
|
|
3950
|
+
if (!profilePlan) return null;
|
|
3951
|
+
const principalSelfNamespace = defaultNamespaceForPrincipal(principal, config);
|
|
3952
|
+
const legacyRecallNamespaces = Array.isArray(config.defaultRecallNamespaces) ? recallNamespacesForPrincipal(principal, config) : [];
|
|
3953
|
+
return expandScopeProfileReadNamespaces({
|
|
3954
|
+
profilePlan,
|
|
3955
|
+
principalSelfNamespace: profilePlan.baseNamespace,
|
|
3956
|
+
config,
|
|
3957
|
+
principal,
|
|
3958
|
+
codingOverlay,
|
|
3959
|
+
legacyRecallNamespaces
|
|
3960
|
+
});
|
|
3961
|
+
}
|
|
3962
|
+
lcmSessionIdsForNamespaces(namespaces, sessionKey) {
|
|
3963
|
+
const out = [];
|
|
3964
|
+
const seen = /* @__PURE__ */ new Set();
|
|
3965
|
+
for (const namespace of namespaces) {
|
|
3966
|
+
const key = lcmSessionKeyForNamespace(
|
|
3967
|
+
namespace,
|
|
3968
|
+
sessionKey,
|
|
3969
|
+
this.orchestrator.config.defaultNamespace
|
|
3970
|
+
) ?? sessionKey;
|
|
3971
|
+
if (!seen.has(key)) {
|
|
3972
|
+
seen.add(key);
|
|
3973
|
+
out.push(key);
|
|
3974
|
+
}
|
|
3975
|
+
}
|
|
3976
|
+
return out;
|
|
3977
|
+
}
|
|
3766
3978
|
resolveLcmReadSessionIds(explicitNamespace, resolvedNamespace, sessionKey, authenticatedPrincipal) {
|
|
3767
3979
|
const primary = this.resolveLcmReadSessionKey(
|
|
3768
3980
|
explicitNamespace,
|
|
@@ -3773,6 +3985,13 @@ var EngramAccessService = class {
|
|
|
3773
3985
|
);
|
|
3774
3986
|
const hasExplicitNamespace = typeof explicitNamespace === "string" && explicitNamespace.trim().length > 0;
|
|
3775
3987
|
if (hasExplicitNamespace) return [primary];
|
|
3988
|
+
const profileReadNamespaces = this.resolveScopeProfileLcmReadNamespaces(
|
|
3989
|
+
sessionKey,
|
|
3990
|
+
authenticatedPrincipal
|
|
3991
|
+
);
|
|
3992
|
+
if (profileReadNamespaces !== null) {
|
|
3993
|
+
return this.lcmSessionIdsForNamespaces(profileReadNamespaces, sessionKey);
|
|
3994
|
+
}
|
|
3776
3995
|
const principal = this.resolveRequestPrincipal(
|
|
3777
3996
|
sessionKey,
|
|
3778
3997
|
authenticatedPrincipal
|
|
@@ -3819,7 +4038,7 @@ var EngramAccessService = class {
|
|
|
3819
4038
|
throw new EngramAccessInputError("sessionKey is required and must be a non-empty string");
|
|
3820
4039
|
}
|
|
3821
4040
|
const scope = await this.resolveMemoryScopePlan(request);
|
|
3822
|
-
const namespace =
|
|
4041
|
+
const namespace = this.legacyResponseNamespaceForScope(scope);
|
|
3823
4042
|
if (!this.orchestrator.lcmEngine || !this.orchestrator.lcmEngine.enabled) {
|
|
3824
4043
|
return {
|
|
3825
4044
|
enabled: false,
|
|
@@ -3854,7 +4073,7 @@ var EngramAccessService = class {
|
|
|
3854
4073
|
throw new EngramAccessInputError("tokensAfter must be a non-negative integer");
|
|
3855
4074
|
}
|
|
3856
4075
|
const scope = await this.resolveMemoryScopePlan(request);
|
|
3857
|
-
const namespace =
|
|
4076
|
+
const namespace = this.legacyResponseNamespaceForScope(scope);
|
|
3858
4077
|
if (!this.orchestrator.lcmEngine || !this.orchestrator.lcmEngine.enabled) {
|
|
3859
4078
|
return {
|
|
3860
4079
|
enabled: false,
|
|
@@ -5360,4 +5579,4 @@ export {
|
|
|
5360
5579
|
shapeMemorySummary,
|
|
5361
5580
|
EngramAccessService
|
|
5362
5581
|
};
|
|
5363
|
-
//# sourceMappingURL=chunk-
|
|
5582
|
+
//# sourceMappingURL=chunk-4UL7VPTD.js.map
|