@remnic/core 9.3.768 → 9.3.770
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-admin-ops-surface.js +29 -29
- package/dist/access-boundary.d.ts +2 -1
- package/dist/access-boundary.js +30 -30
- package/dist/access-cli.js +85 -83
- package/dist/access-cli.js.map +1 -1
- package/dist/access-errors.d.ts +5 -0
- package/dist/access-errors.js +8 -0
- package/dist/access-errors.js.map +1 -0
- package/dist/access-http.d.ts +51 -1
- package/dist/access-http.js +38 -36
- package/dist/access-identity-continuity-surface.js +29 -29
- package/dist/access-lcm-surface.js +29 -29
- package/dist/access-mcp.d.ts +7 -1
- package/dist/access-mcp.js +41 -37
- package/dist/access-observe-write-surface.js +29 -29
- package/dist/access-operations-batch.js +34 -32
- package/dist/access-operations.d.ts +4 -4
- package/dist/access-operations.js +36 -34
- package/dist/access-recall-surface.js +29 -29
- package/dist/access-schema.d.ts +68 -68
- package/dist/access-service.js +29 -29
- package/dist/access-surface-catalog.js +1 -0
- package/dist/access-surface-catalog.js.map +1 -1
- package/dist/active-recall.js +5 -5
- package/dist/auto-sync-2SOUW4JW.js +1 -1
- package/dist/briefing.js +7 -7
- package/dist/causal-behavior.js +5 -5
- package/dist/causal-chain.js +3 -3
- package/dist/causal-consolidation.js +11 -11
- package/dist/causal-retrieval.js +3 -3
- package/dist/causal-trajectory.js +1 -1
- package/dist/{chunk-R3K4CXPR.js → chunk-3JOFWTQD.js} +2 -2
- package/dist/{chunk-QOGXUNWL.js → chunk-3O3BZNSH.js} +4 -4
- package/dist/{chunk-SFNQDXXL.js → chunk-3YYWUHA7.js} +3 -3
- package/dist/{chunk-GLERZDM7.js → chunk-52TEPNL7.js} +29 -7
- package/dist/chunk-52TEPNL7.js.map +1 -0
- package/dist/{chunk-N4ZA2I7M.js → chunk-5ACKQLGA.js} +2 -2
- package/dist/{chunk-YDYC6PIS.js → chunk-5QJZLJ7Q.js} +2 -2
- package/dist/{chunk-ORAK3LNZ.js → chunk-6SHAUM5S.js} +5 -5
- package/dist/{chunk-CKNAVW34.js → chunk-7OSULYN2.js} +2 -2
- package/dist/{chunk-PA5ALD3S.js → chunk-7XGF5HCC.js} +106 -86
- package/dist/chunk-7XGF5HCC.js.map +1 -0
- package/dist/{chunk-6T4LTI2F.js → chunk-7XH7VJN4.js} +4 -4
- package/dist/{chunk-OX272PBW.js → chunk-CSHUSYUM.js} +2 -2
- package/dist/{chunk-UG274TNV.js → chunk-E2SPGGUI.js} +13 -8
- package/dist/chunk-E2SPGGUI.js.map +1 -0
- package/dist/{chunk-HBOPSFQQ.js → chunk-E6LXM2GE.js} +41 -41
- package/dist/{chunk-OAREUC7N.js → chunk-EWGMA5W5.js} +28 -28
- package/dist/{chunk-YNDLCWXS.js → chunk-EZ25VE3G.js} +4 -4
- package/dist/chunk-FTYDWKO6.js +101 -0
- package/dist/chunk-FTYDWKO6.js.map +1 -0
- package/dist/{chunk-2RLECZ6J.js → chunk-IOENSSZC.js} +2 -2
- package/dist/{chunk-VKHZFF5P.js → chunk-KFIAFHOC.js} +2 -2
- package/dist/{chunk-NDXJJKT2.js → chunk-KMKBD66B.js} +2 -2
- package/dist/{chunk-SQNED75R.js → chunk-KYC3RLYJ.js} +1 -1
- package/dist/{chunk-V5RVMULT.js → chunk-MLDAD27I.js} +7 -7
- package/dist/{chunk-IGVKWKR2.js → chunk-O5EKTMOJ.js} +6 -6
- package/dist/{chunk-TVLN5EZZ.js → chunk-OP43P53G.js} +83 -8
- package/dist/chunk-OP43P53G.js.map +1 -0
- package/dist/{chunk-4HYFKIGH.js → chunk-PSNMICC2.js} +4 -4
- package/dist/{chunk-IVFIYAIP.js → chunk-QKUWPSU3.js} +5 -5
- package/dist/{chunk-4DLFJJOQ.js → chunk-QMN3CIFS.js} +2 -2
- package/dist/chunk-RANHFI3P.js +8 -0
- package/dist/chunk-RANHFI3P.js.map +1 -0
- package/dist/{chunk-AS2NRB45.js → chunk-RZ3KJZYE.js} +2 -2
- package/dist/{chunk-4JG55YV3.js → chunk-SRSPVFSJ.js} +3 -3
- package/dist/{chunk-DTTVX6EO.js → chunk-STN5KMSS.js} +12 -12
- package/dist/{chunk-J3UJJZKI.js → chunk-TGROC2UP.js} +108 -7
- package/dist/chunk-TGROC2UP.js.map +1 -0
- package/dist/{chunk-QPTP6SKC.js → chunk-U72WWTLR.js} +2 -2
- package/dist/{chunk-U5GFYMV7.js → chunk-W7VA5667.js} +3 -3
- package/dist/{chunk-X7HTU4HO.js → chunk-WB4CFKZ4.js} +2 -2
- package/dist/{chunk-NFWTMM2M.js → chunk-XDRJQMYL.js} +2 -2
- package/dist/{chunk-CVINPTKG.js → chunk-ZG4FT6IT.js} +5 -5
- package/dist/{chunk-MSGPLITO.js → chunk-ZT34X56N.js} +2 -2
- package/dist/{chunk-MSGPLITO.js.map → chunk-ZT34X56N.js.map} +1 -1
- package/dist/cli.js +58 -56
- package/dist/compounding/engine.js +7 -7
- package/dist/config.js +2 -2
- package/dist/connectors/codex-materialize-runner.js +7 -7
- package/dist/connectors/index.js +9 -9
- package/dist/consolidation-provenance-check.js +2 -2
- package/dist/dashboard-runtime.js +2 -2
- package/dist/entity-retrieval.js +7 -7
- package/dist/extraction.js +3 -3
- package/dist/index.d.ts +1 -1
- package/dist/index.js +141 -133
- package/dist/lcm/engine.js +3 -3
- package/dist/lcm/index.js +11 -11
- package/dist/maintenance/memory-governance.js +8 -8
- package/dist/maintenance/rebuild-memory-lifecycle-ledger.js +7 -7
- package/dist/maintenance/rebuild-memory-projection.js +9 -9
- package/dist/namespaces/migrate.js +12 -12
- package/dist/namespaces/search.js +4 -4
- package/dist/namespaces/storage.js +7 -7
- package/dist/operator-toolkit.js +17 -17
- package/dist/orchestration/maintenance.js +9 -9
- package/dist/orchestrator.js +85 -83
- package/dist/recall-timings.d.ts +26 -0
- package/dist/recall-timings.js +16 -0
- package/dist/recall-timings.js.map +1 -0
- package/dist/resume-bundles.js +3 -3
- package/dist/schemas.d.ts +84 -84
- package/dist/search/factory.js +3 -3
- package/dist/search/index.js +7 -7
- package/dist/semantic-consolidation.js +10 -10
- package/dist/semantic-rule-promotion.js +7 -7
- package/dist/semantic-rule-verifier.js +8 -8
- package/dist/shared-context/manager.d.ts +8 -8
- package/dist/storage.js +8 -8
- package/dist/tokens.d.ts +3 -1
- package/dist/tokens.js +3 -1
- package/dist/transfer/types.d.ts +66 -66
- package/dist/verified-recall.js +8 -8
- package/package.json +2 -2
- package/src/access-boundary.ts +2 -0
- package/src/access-errors.ts +2 -0
- package/src/access-http.test.ts +350 -0
- package/src/access-http.ts +192 -7
- package/src/access-mcp.ts +120 -3
- package/src/access-operations-batch.ts +19 -0
- package/src/access-surface-catalog.ts +1 -0
- package/src/index.ts +3 -0
- package/src/orchestration/recall-internal.ts +21 -3
- package/src/recall-timings-access.test.ts +301 -0
- package/src/recall-timings.ts +141 -0
- package/src/tokens.test.ts +58 -0
- package/src/tokens.ts +19 -8
- package/dist/chunk-GLERZDM7.js.map +0 -1
- package/dist/chunk-J3UJJZKI.js.map +0 -1
- package/dist/chunk-PA5ALD3S.js.map +0 -1
- package/dist/chunk-TVLN5EZZ.js.map +0 -1
- package/dist/chunk-UG274TNV.js.map +0 -1
- /package/dist/{chunk-R3K4CXPR.js.map → chunk-3JOFWTQD.js.map} +0 -0
- /package/dist/{chunk-QOGXUNWL.js.map → chunk-3O3BZNSH.js.map} +0 -0
- /package/dist/{chunk-SFNQDXXL.js.map → chunk-3YYWUHA7.js.map} +0 -0
- /package/dist/{chunk-N4ZA2I7M.js.map → chunk-5ACKQLGA.js.map} +0 -0
- /package/dist/{chunk-YDYC6PIS.js.map → chunk-5QJZLJ7Q.js.map} +0 -0
- /package/dist/{chunk-ORAK3LNZ.js.map → chunk-6SHAUM5S.js.map} +0 -0
- /package/dist/{chunk-CKNAVW34.js.map → chunk-7OSULYN2.js.map} +0 -0
- /package/dist/{chunk-6T4LTI2F.js.map → chunk-7XH7VJN4.js.map} +0 -0
- /package/dist/{chunk-OX272PBW.js.map → chunk-CSHUSYUM.js.map} +0 -0
- /package/dist/{chunk-HBOPSFQQ.js.map → chunk-E6LXM2GE.js.map} +0 -0
- /package/dist/{chunk-OAREUC7N.js.map → chunk-EWGMA5W5.js.map} +0 -0
- /package/dist/{chunk-YNDLCWXS.js.map → chunk-EZ25VE3G.js.map} +0 -0
- /package/dist/{chunk-2RLECZ6J.js.map → chunk-IOENSSZC.js.map} +0 -0
- /package/dist/{chunk-VKHZFF5P.js.map → chunk-KFIAFHOC.js.map} +0 -0
- /package/dist/{chunk-NDXJJKT2.js.map → chunk-KMKBD66B.js.map} +0 -0
- /package/dist/{chunk-SQNED75R.js.map → chunk-KYC3RLYJ.js.map} +0 -0
- /package/dist/{chunk-V5RVMULT.js.map → chunk-MLDAD27I.js.map} +0 -0
- /package/dist/{chunk-IGVKWKR2.js.map → chunk-O5EKTMOJ.js.map} +0 -0
- /package/dist/{chunk-4HYFKIGH.js.map → chunk-PSNMICC2.js.map} +0 -0
- /package/dist/{chunk-IVFIYAIP.js.map → chunk-QKUWPSU3.js.map} +0 -0
- /package/dist/{chunk-4DLFJJOQ.js.map → chunk-QMN3CIFS.js.map} +0 -0
- /package/dist/{chunk-AS2NRB45.js.map → chunk-RZ3KJZYE.js.map} +0 -0
- /package/dist/{chunk-4JG55YV3.js.map → chunk-SRSPVFSJ.js.map} +0 -0
- /package/dist/{chunk-DTTVX6EO.js.map → chunk-STN5KMSS.js.map} +0 -0
- /package/dist/{chunk-QPTP6SKC.js.map → chunk-U72WWTLR.js.map} +0 -0
- /package/dist/{chunk-U5GFYMV7.js.map → chunk-W7VA5667.js.map} +0 -0
- /package/dist/{chunk-X7HTU4HO.js.map → chunk-WB4CFKZ4.js.map} +0 -0
- /package/dist/{chunk-NFWTMM2M.js.map → chunk-XDRJQMYL.js.map} +0 -0
- /package/dist/{chunk-CVINPTKG.js.map → chunk-ZG4FT6IT.js.map} +0 -0
|
@@ -1,3 +1,6 @@
|
|
|
1
|
+
import {
|
|
2
|
+
LanceDbBackend
|
|
3
|
+
} from "./chunk-K2I3AWBR.js";
|
|
1
4
|
import {
|
|
2
5
|
MeilisearchBackend
|
|
3
6
|
} from "./chunk-DMKMQTBH.js";
|
|
@@ -13,9 +16,6 @@ import {
|
|
|
13
16
|
import {
|
|
14
17
|
EmbedHelper
|
|
15
18
|
} from "./chunk-HM6UJPPO.js";
|
|
16
|
-
import {
|
|
17
|
-
LanceDbBackend
|
|
18
|
-
} from "./chunk-K2I3AWBR.js";
|
|
19
19
|
import {
|
|
20
20
|
createConversationIndexBackend
|
|
21
21
|
} from "./chunk-DCWIQFNA.js";
|
|
@@ -175,4 +175,4 @@ export {
|
|
|
175
175
|
createConversationSearchBackend,
|
|
176
176
|
createConversationIndexRuntime
|
|
177
177
|
};
|
|
178
|
-
//# sourceMappingURL=chunk-
|
|
178
|
+
//# sourceMappingURL=chunk-PSNMICC2.js.map
|
|
@@ -1,15 +1,15 @@
|
|
|
1
1
|
import {
|
|
2
2
|
StorageManager
|
|
3
|
-
} from "./chunk-
|
|
3
|
+
} from "./chunk-STN5KMSS.js";
|
|
4
4
|
import {
|
|
5
5
|
assertPathInsideRoot
|
|
6
6
|
} from "./chunk-5GPPACXK.js";
|
|
7
|
-
import {
|
|
8
|
-
decideLifecycleTransition
|
|
9
|
-
} from "./chunk-TBBDFYXW.js";
|
|
10
7
|
import {
|
|
11
8
|
RECALL_FALLBACK_DIRS
|
|
12
9
|
} from "./chunk-VS2IYZRU.js";
|
|
10
|
+
import {
|
|
11
|
+
decideLifecycleTransition
|
|
12
|
+
} from "./chunk-TBBDFYXW.js";
|
|
13
13
|
|
|
14
14
|
// src/maintenance/memory-governance.ts
|
|
15
15
|
import path from "path";
|
|
@@ -751,4 +751,4 @@ export {
|
|
|
751
751
|
listMemoryGovernanceRuns,
|
|
752
752
|
readMemoryGovernanceRunArtifact
|
|
753
753
|
};
|
|
754
|
-
//# sourceMappingURL=chunk-
|
|
754
|
+
//# sourceMappingURL=chunk-QKUWPSU3.js.map
|
|
@@ -5,7 +5,7 @@ import {
|
|
|
5
5
|
loadTokenStore,
|
|
6
6
|
revokeToken,
|
|
7
7
|
saveTokenStore
|
|
8
|
-
} from "./chunk-
|
|
8
|
+
} from "./chunk-E2SPGGUI.js";
|
|
9
9
|
import {
|
|
10
10
|
getConnectorsDir,
|
|
11
11
|
getRegistryPath
|
|
@@ -2257,4 +2257,4 @@ export {
|
|
|
2257
2257
|
resolveWeCloneProxyConfigPath,
|
|
2258
2258
|
buildWeCloneProxyConfig
|
|
2259
2259
|
};
|
|
2260
|
-
//# sourceMappingURL=chunk-
|
|
2260
|
+
//# sourceMappingURL=chunk-QMN3CIFS.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"sources":["../src/access-errors.ts"],"sourcesContent":["/** Authenticated caller lacks the required authorization (HTTP 403). */\nexport class EngramAccessForbiddenError extends Error {}\n"],"mappings":";AACO,IAAM,6BAAN,cAAyC,MAAM;AAAC;","names":[]}
|
|
@@ -4,7 +4,7 @@ import {
|
|
|
4
4
|
import {
|
|
5
5
|
compareEntityTimestamps,
|
|
6
6
|
normalizeEntityName
|
|
7
|
-
} from "./chunk-
|
|
7
|
+
} from "./chunk-STN5KMSS.js";
|
|
8
8
|
import {
|
|
9
9
|
resolveNamespaceCapabilities
|
|
10
10
|
} from "./chunk-VSF7AAGE.js";
|
|
@@ -682,4 +682,4 @@ export {
|
|
|
682
682
|
entityIndexVersion,
|
|
683
683
|
entityRecentTranscriptLookbackHours
|
|
684
684
|
};
|
|
685
|
-
//# sourceMappingURL=chunk-
|
|
685
|
+
//# sourceMappingURL=chunk-RZ3KJZYE.js.map
|
|
@@ -3,14 +3,14 @@ import {
|
|
|
3
3
|
} from "./chunk-2MR3MFQB.js";
|
|
4
4
|
import {
|
|
5
5
|
defineOperation
|
|
6
|
-
} from "./chunk-
|
|
6
|
+
} from "./chunk-ZT34X56N.js";
|
|
7
7
|
import {
|
|
8
8
|
CorrectionContractError,
|
|
9
9
|
DECISION_SUBCOMMANDS,
|
|
10
10
|
DELTA_SUBCOMMANDS,
|
|
11
11
|
EngramAccessInputError,
|
|
12
12
|
isCodegraphToolName
|
|
13
|
-
} from "./chunk-
|
|
13
|
+
} from "./chunk-EWGMA5W5.js";
|
|
14
14
|
|
|
15
15
|
// src/access-operations.ts
|
|
16
16
|
import { z } from "zod";
|
|
@@ -463,4 +463,4 @@ export {
|
|
|
463
463
|
codegraphIngestTracesOperation,
|
|
464
464
|
REGISTERED_OPERATIONS
|
|
465
465
|
};
|
|
466
|
-
//# sourceMappingURL=chunk-
|
|
466
|
+
//# sourceMappingURL=chunk-SRSPVFSJ.js.map
|
|
@@ -1,18 +1,21 @@
|
|
|
1
|
-
import {
|
|
2
|
-
WEARABLES_DIR_NAME,
|
|
3
|
-
isValidTranscriptDate
|
|
4
|
-
} from "./chunk-M7XQSUBB.js";
|
|
5
1
|
import {
|
|
6
2
|
TombstoneStore,
|
|
7
3
|
buildRetiredFactTombstoneInputs,
|
|
8
4
|
collectRetiredMemoriesForRebuild
|
|
9
5
|
} from "./chunk-L2B3EE7B.js";
|
|
6
|
+
import {
|
|
7
|
+
WEARABLES_DIR_NAME,
|
|
8
|
+
isValidTranscriptDate
|
|
9
|
+
} from "./chunk-M7XQSUBB.js";
|
|
10
10
|
import {
|
|
11
11
|
isErrnoCode
|
|
12
12
|
} from "./chunk-5UZXUTVO.js";
|
|
13
13
|
import {
|
|
14
14
|
assertPathInsideRoot
|
|
15
15
|
} from "./chunk-5GPPACXK.js";
|
|
16
|
+
import {
|
|
17
|
+
stripAttributesSuffix
|
|
18
|
+
} from "./chunk-SVOZFLIQ.js";
|
|
16
19
|
import {
|
|
17
20
|
supersessionKeysForFact
|
|
18
21
|
} from "./chunk-TKZ3AL5V.js";
|
|
@@ -25,9 +28,6 @@ import {
|
|
|
25
28
|
assertMemoryFrontmatterId,
|
|
26
29
|
warnProjectionFallback
|
|
27
30
|
} from "./chunk-DQC3ZZYM.js";
|
|
28
|
-
import {
|
|
29
|
-
stripAttributesSuffix
|
|
30
|
-
} from "./chunk-SVOZFLIQ.js";
|
|
31
31
|
import {
|
|
32
32
|
SPECULATIVE_TTL_DAYS,
|
|
33
33
|
confidenceTier
|
|
@@ -71,6 +71,10 @@ import {
|
|
|
71
71
|
parseFaithfulnessField,
|
|
72
72
|
serializeFaithfulnessFields
|
|
73
73
|
} from "./chunk-YTU7WKYN.js";
|
|
74
|
+
import {
|
|
75
|
+
isConsolidationOperator,
|
|
76
|
+
isValidDerivedFromEntry
|
|
77
|
+
} from "./chunk-G7D6GZ5J.js";
|
|
74
78
|
import {
|
|
75
79
|
createVersion
|
|
76
80
|
} from "./chunk-VF4XKTX3.js";
|
|
@@ -78,10 +82,6 @@ import {
|
|
|
78
82
|
computeContentHash,
|
|
79
83
|
normalizeContent
|
|
80
84
|
} from "./chunk-W5H6ZRPT.js";
|
|
81
|
-
import {
|
|
82
|
-
isConsolidationOperator,
|
|
83
|
-
isValidDerivedFromEntry
|
|
84
|
-
} from "./chunk-G7D6GZ5J.js";
|
|
85
85
|
import {
|
|
86
86
|
parseProvenanceSources,
|
|
87
87
|
parseProvenanceTag,
|
|
@@ -6154,4 +6154,4 @@ export {
|
|
|
6154
6154
|
isValidBufferSurpriseEvent,
|
|
6155
6155
|
StorageManager3 as StorageManager
|
|
6156
6156
|
};
|
|
6157
|
-
//# sourceMappingURL=chunk-
|
|
6157
|
+
//# sourceMappingURL=chunk-STN5KMSS.js.map
|
|
@@ -6,22 +6,23 @@ import {
|
|
|
6
6
|
} from "./chunk-JBPKEARU.js";
|
|
7
7
|
import {
|
|
8
8
|
EngramMcpServer,
|
|
9
|
+
MCP_SUPPORTED_PROTOCOL_VERSIONS,
|
|
9
10
|
cleanupExpiredChatSessions,
|
|
10
11
|
loadChatSession,
|
|
11
12
|
processChatMessage,
|
|
12
13
|
sessionBelongsToPrincipal,
|
|
13
14
|
subscribeChatTranscript
|
|
14
|
-
} from "./chunk-
|
|
15
|
+
} from "./chunk-OP43P53G.js";
|
|
15
16
|
import {
|
|
16
17
|
validateRequest
|
|
17
18
|
} from "./chunk-2MR3MFQB.js";
|
|
18
19
|
import {
|
|
19
20
|
getOperation
|
|
20
|
-
} from "./chunk-
|
|
21
|
+
} from "./chunk-ZT34X56N.js";
|
|
21
22
|
import {
|
|
22
23
|
CorrectionContractError,
|
|
23
24
|
EngramAccessInputError
|
|
24
|
-
} from "./chunk-
|
|
25
|
+
} from "./chunk-EWGMA5W5.js";
|
|
25
26
|
import {
|
|
26
27
|
isTrustZoneName
|
|
27
28
|
} from "./chunk-JGSKJHF7.js";
|
|
@@ -49,6 +50,9 @@ import {
|
|
|
49
50
|
abortError,
|
|
50
51
|
isAbortError
|
|
51
52
|
} from "./chunk-PVGDJXVK.js";
|
|
53
|
+
import {
|
|
54
|
+
EngramAccessForbiddenError
|
|
55
|
+
} from "./chunk-RANHFI3P.js";
|
|
52
56
|
|
|
53
57
|
// src/access-http.ts
|
|
54
58
|
import { createServer } from "http";
|
|
@@ -272,6 +276,23 @@ function parseHttpServerPort(port) {
|
|
|
272
276
|
}
|
|
273
277
|
return port;
|
|
274
278
|
}
|
|
279
|
+
function assertResourceMetadataUrl(value) {
|
|
280
|
+
if (value === void 0) return void 0;
|
|
281
|
+
let parsed;
|
|
282
|
+
try {
|
|
283
|
+
parsed = new URL(value);
|
|
284
|
+
} catch {
|
|
285
|
+
throw new Error(
|
|
286
|
+
`access HTTP resourceMetadataUrl must be an absolute http(s) URL, got: ${value}`
|
|
287
|
+
);
|
|
288
|
+
}
|
|
289
|
+
if (parsed.protocol !== "http:" && parsed.protocol !== "https:") {
|
|
290
|
+
throw new Error(
|
|
291
|
+
`access HTTP resourceMetadataUrl must use http or https, got: ${parsed.protocol}`
|
|
292
|
+
);
|
|
293
|
+
}
|
|
294
|
+
return value;
|
|
295
|
+
}
|
|
275
296
|
function parseTrustZoneKindFilter(raw) {
|
|
276
297
|
if (raw === null) return void 0;
|
|
277
298
|
if (TRUST_ZONE_RECORD_KINDS.includes(raw)) {
|
|
@@ -343,6 +364,8 @@ var EngramAccessHttpServer = class {
|
|
|
343
364
|
authToken;
|
|
344
365
|
authTokens;
|
|
345
366
|
authTokensGetter;
|
|
367
|
+
authTokenEntriesGetter;
|
|
368
|
+
tokenPathPolicy;
|
|
346
369
|
authenticatedPrincipal;
|
|
347
370
|
maxBodyBytes;
|
|
348
371
|
adminConsoleEnabled;
|
|
@@ -352,6 +375,8 @@ var EngramAccessHttpServer = class {
|
|
|
352
375
|
trustPrincipalHeader;
|
|
353
376
|
adapterRegistry;
|
|
354
377
|
readiness;
|
|
378
|
+
resourceMetadataUrl;
|
|
379
|
+
externalRequestHandler;
|
|
355
380
|
writeRequestTimestamps = [];
|
|
356
381
|
mcpServer;
|
|
357
382
|
server = null;
|
|
@@ -381,6 +406,8 @@ var EngramAccessHttpServer = class {
|
|
|
381
406
|
this.authToken = options.authToken?.trim() || void 0;
|
|
382
407
|
this.authTokens = (options.authTokens ?? []).map((t) => t.trim()).filter(Boolean);
|
|
383
408
|
this.authTokensGetter = options.authTokensGetter;
|
|
409
|
+
this.authTokenEntriesGetter = options.authTokenEntriesGetter;
|
|
410
|
+
this.tokenPathPolicy = options.tokenPathPolicy;
|
|
384
411
|
this.authenticatedPrincipal = options.principal?.trim() || void 0;
|
|
385
412
|
this.maxBodyBytes = Number.isFinite(options.maxBodyBytes) ? Math.max(1, Math.floor(options.maxBodyBytes ?? 131072)) : 131072;
|
|
386
413
|
this.adminConsoleEnabled = options.adminConsoleEnabled !== false;
|
|
@@ -389,6 +416,8 @@ var EngramAccessHttpServer = class {
|
|
|
389
416
|
this.adminControls = options.adminControls;
|
|
390
417
|
this.trustPrincipalHeader = options.trustPrincipalHeader === true;
|
|
391
418
|
this.readiness = options.readiness ?? (() => ({ ready: true, warmupAttempts: 0 }));
|
|
419
|
+
this.resourceMetadataUrl = assertResourceMetadataUrl(options.resourceMetadataUrl);
|
|
420
|
+
this.externalRequestHandler = options.externalRequestHandler;
|
|
392
421
|
this.adapterRegistry = options.enableAdapters !== false ? options.adapterRegistry ?? new AdapterRegistry() : null;
|
|
393
422
|
this.mcpServer = new EngramMcpServer(this.service, {
|
|
394
423
|
principal: options.principal,
|
|
@@ -404,7 +433,7 @@ var EngramAccessHttpServer = class {
|
|
|
404
433
|
});
|
|
405
434
|
}
|
|
406
435
|
async start() {
|
|
407
|
-
if (!this.authToken && this.authTokens.length === 0 && !this.authTokensGetter) {
|
|
436
|
+
if (!this.authToken && this.authTokens.length === 0 && !this.authTokensGetter && !this.authTokenEntriesGetter) {
|
|
408
437
|
throw new Error("engram access HTTP requires authToken or authTokens");
|
|
409
438
|
}
|
|
410
439
|
if (this.server) return this.status();
|
|
@@ -437,6 +466,10 @@ var EngramAccessHttpServer = class {
|
|
|
437
466
|
this.respondJson(res, 400, { error: err.message, code: "input_error" });
|
|
438
467
|
return;
|
|
439
468
|
}
|
|
469
|
+
if (err instanceof EngramAccessForbiddenError) {
|
|
470
|
+
this.respondJson(res, 403, { error: err.message, code: "forbidden" });
|
|
471
|
+
return;
|
|
472
|
+
}
|
|
440
473
|
if (err instanceof CorrectionContractError) {
|
|
441
474
|
this.respondJson(res, 400, { error: err.message, code: "correction_contract_error" });
|
|
442
475
|
return;
|
|
@@ -647,11 +680,27 @@ var EngramAccessHttpServer = class {
|
|
|
647
680
|
return;
|
|
648
681
|
}
|
|
649
682
|
}
|
|
683
|
+
if (this.externalRequestHandler) {
|
|
684
|
+
const authorized = this.isAuthorized(req, pathname);
|
|
685
|
+
if (await this.externalRequestHandler(req, res, { authorized })) {
|
|
686
|
+
return;
|
|
687
|
+
}
|
|
688
|
+
}
|
|
650
689
|
if (!this.isAuthorized(req, pathname)) {
|
|
651
690
|
const body = JSON.stringify({ error: "unauthorized", code: "unauthorized" });
|
|
652
691
|
res.writeHead(401, {
|
|
653
692
|
"content-type": "application/json; charset=utf-8",
|
|
654
|
-
"www-authenticate":
|
|
693
|
+
"www-authenticate": this.bearerChallenge(),
|
|
694
|
+
"x-request-id": correlationId
|
|
695
|
+
});
|
|
696
|
+
res.end(body);
|
|
697
|
+
return;
|
|
698
|
+
}
|
|
699
|
+
if (pathname === "/mcp" && (req.method === "GET" || req.method === "DELETE")) {
|
|
700
|
+
const body = JSON.stringify({ error: "method_not_allowed", code: "method_not_allowed" });
|
|
701
|
+
res.writeHead(405, {
|
|
702
|
+
"content-type": "application/json; charset=utf-8",
|
|
703
|
+
allow: "POST",
|
|
655
704
|
"x-request-id": correlationId
|
|
656
705
|
});
|
|
657
706
|
res.end(body);
|
|
@@ -1416,6 +1465,20 @@ var EngramAccessHttpServer = class {
|
|
|
1416
1465
|
this.respondJson(res, 200, response);
|
|
1417
1466
|
return;
|
|
1418
1467
|
}
|
|
1468
|
+
if (req.method === "GET" && pathname === "/engram/v1/recall/timings") {
|
|
1469
|
+
const op = getOperation("recall_timings");
|
|
1470
|
+
if (!op) {
|
|
1471
|
+
throw new Error("access-boundary: operation not registered: recall_timings");
|
|
1472
|
+
}
|
|
1473
|
+
res.setHeader("cache-control", "no-store");
|
|
1474
|
+
const output = await op.run({}, {
|
|
1475
|
+
service: this.service,
|
|
1476
|
+
authenticatedPrincipal: this.resolveRequestPrincipal(req),
|
|
1477
|
+
operatorPrincipal: this.authenticatedPrincipal
|
|
1478
|
+
});
|
|
1479
|
+
this.respondJson(res, 200, output.result);
|
|
1480
|
+
return;
|
|
1481
|
+
}
|
|
1419
1482
|
const memoryMatch = pathname.match(/^\/engram\/v1\/memories\/([^/]+)$/);
|
|
1420
1483
|
if (req.method === "GET" && memoryMatch) {
|
|
1421
1484
|
const memoryId = decodeURIComponent(memoryMatch[1] ?? "");
|
|
@@ -2253,6 +2316,20 @@ var EngramAccessHttpServer = class {
|
|
|
2253
2316
|
req.once("error", cleanup);
|
|
2254
2317
|
}
|
|
2255
2318
|
async handleMcpRequest(req, res) {
|
|
2319
|
+
const headerVersion = req.headers["mcp-protocol-version"];
|
|
2320
|
+
if (typeof headerVersion === "string" && headerVersion.length > 0) {
|
|
2321
|
+
if (!MCP_SUPPORTED_PROTOCOL_VERSIONS.includes(headerVersion)) {
|
|
2322
|
+
this.respondJson(res, 400, {
|
|
2323
|
+
jsonrpc: "2.0",
|
|
2324
|
+
id: null,
|
|
2325
|
+
error: {
|
|
2326
|
+
code: -32e3,
|
|
2327
|
+
message: `unsupported MCP-Protocol-Version: ${headerVersion}; supported: ${MCP_SUPPORTED_PROTOCOL_VERSIONS.join(", ")}`
|
|
2328
|
+
}
|
|
2329
|
+
});
|
|
2330
|
+
return;
|
|
2331
|
+
}
|
|
2332
|
+
}
|
|
2256
2333
|
const body = await this.readJsonBody(req);
|
|
2257
2334
|
const request = body;
|
|
2258
2335
|
const toolName = typeof request.params?.name === "string" ? request.params.name : "";
|
|
@@ -2552,8 +2629,23 @@ var EngramAccessHttpServer = class {
|
|
|
2552
2629
|
}
|
|
2553
2630
|
return result.data;
|
|
2554
2631
|
}
|
|
2632
|
+
/**
|
|
2633
|
+
* Build the WWW-Authenticate challenge string for 401 responses.
|
|
2634
|
+
* When `resourceMetadataUrl` is configured, includes the RFC 9728
|
|
2635
|
+
* `resource_metadata` parameter so MCP clients (e.g. ChatGPT) can
|
|
2636
|
+
* discover the OAuth 2.0 protected-resource metadata document.
|
|
2637
|
+
* Otherwise the bare `Bearer` challenge is returned (unchanged).
|
|
2638
|
+
*/
|
|
2639
|
+
bearerChallenge() {
|
|
2640
|
+
if (this.resourceMetadataUrl) {
|
|
2641
|
+
return `Bearer resource_metadata="${this.resourceMetadataUrl}"`;
|
|
2642
|
+
}
|
|
2643
|
+
return "Bearer";
|
|
2644
|
+
}
|
|
2555
2645
|
isAuthorized(req, pathname) {
|
|
2556
|
-
if (!this.authToken && this.authTokens.length === 0 && !this.authTokensGetter)
|
|
2646
|
+
if (!this.authToken && this.authTokens.length === 0 && !this.authTokensGetter && !this.authTokenEntriesGetter) {
|
|
2647
|
+
return false;
|
|
2648
|
+
}
|
|
2557
2649
|
const raw = req.headers.authorization;
|
|
2558
2650
|
let candidate = null;
|
|
2559
2651
|
if (raw) {
|
|
@@ -2581,6 +2673,15 @@ var EngramAccessHttpServer = class {
|
|
|
2581
2673
|
for (const valid of this.authTokens) {
|
|
2582
2674
|
if (this.timingSafeStringEqual(token, valid)) return true;
|
|
2583
2675
|
}
|
|
2676
|
+
if (this.authTokenEntriesGetter) {
|
|
2677
|
+
for (const entry of this.authTokenEntriesGetter()) {
|
|
2678
|
+
if (!this.timingSafeStringEqual(token, entry.token)) continue;
|
|
2679
|
+
if (!this.tokenPathPolicy) return true;
|
|
2680
|
+
if (typeof entry.connector !== "string" || entry.connector.length === 0) return false;
|
|
2681
|
+
return this.tokenPathPolicy(entry.connector, pathname);
|
|
2682
|
+
}
|
|
2683
|
+
return false;
|
|
2684
|
+
}
|
|
2584
2685
|
if (this.authTokensGetter) {
|
|
2585
2686
|
for (const valid of this.authTokensGetter()) {
|
|
2586
2687
|
if (this.timingSafeStringEqual(token, valid)) return true;
|
|
@@ -2664,4 +2765,4 @@ function positiveIntQueryParam(value, label) {
|
|
|
2664
2765
|
export {
|
|
2665
2766
|
EngramAccessHttpServer
|
|
2666
2767
|
};
|
|
2667
|
-
//# sourceMappingURL=chunk-
|
|
2768
|
+
//# sourceMappingURL=chunk-TGROC2UP.js.map
|