@remnic/core 9.24.0 → 9.25.1

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 (149) hide show
  1. package/dist/access-admin-ops-surface.js +21 -21
  2. package/dist/access-authorization-probe.d.ts +122 -0
  3. package/dist/access-authorization-probe.js +154 -0
  4. package/dist/access-authorization-probe.js.map +1 -0
  5. package/dist/access-boundary.js +21 -21
  6. package/dist/access-cli.js +68 -67
  7. package/dist/access-cli.js.map +1 -1
  8. package/dist/access-http.js +28 -27
  9. package/dist/access-identity-continuity-surface.js +21 -21
  10. package/dist/access-lcm-surface.js +21 -21
  11. package/dist/access-mcp.js +26 -26
  12. package/dist/access-namespace-preflight.js +21 -21
  13. package/dist/access-observe-write-surface.js +21 -21
  14. package/dist/access-operations-batch.js +23 -23
  15. package/dist/access-operations.d.ts +3 -3
  16. package/dist/access-operations.js +24 -24
  17. package/dist/access-recall-concurrency.js +21 -21
  18. package/dist/access-recall-response.js +21 -21
  19. package/dist/access-recall-surface.js +21 -21
  20. package/dist/access-schema.d.ts +76 -76
  21. package/dist/access-service.js +21 -21
  22. package/dist/access-token-capabilities.d.ts +15 -1
  23. package/dist/access-token-capabilities.js +3 -1
  24. package/dist/active-recall.js +5 -5
  25. package/dist/auto-sync-5OE5QOZB.js +1 -1
  26. package/dist/briefing.js +7 -7
  27. package/dist/causal-consolidation.js +8 -8
  28. package/dist/{chunk-34RC5RT7.js → chunk-2SA56WMI.js} +4 -4
  29. package/dist/{chunk-NM7SKDZM.js → chunk-3CDMIR3C.js} +2 -2
  30. package/dist/{chunk-V4MAO2Y4.js → chunk-3I35RLJW.js} +17 -5
  31. package/dist/chunk-3I35RLJW.js.map +1 -0
  32. package/dist/{chunk-XBRPEGXF.js → chunk-3UOSVTFR.js} +5 -5
  33. package/dist/{chunk-7IECFM4E.js → chunk-5ZGWA4AG.js} +10 -10
  34. package/dist/{chunk-WNSQOXWS.js → chunk-6LRTGCRV.js} +6 -6
  35. package/dist/{chunk-2NAFR36N.js → chunk-AGR7MGUX.js} +2 -2
  36. package/dist/{chunk-ZLNOX7B2.js → chunk-AL4TZWI3.js} +2 -2
  37. package/dist/{chunk-ECG64R7B.js → chunk-AT6DNUCM.js} +2 -2
  38. package/dist/{chunk-WO7KBATL.js → chunk-CKMO4RDY.js} +2 -2
  39. package/dist/{chunk-DFTCJVXI.js → chunk-DPYYSG6F.js} +8 -8
  40. package/dist/{chunk-MX4TUDMB.js → chunk-FIGDB2HR.js} +2 -2
  41. package/dist/{chunk-NHPROHJD.js → chunk-GNFZFJBJ.js} +2 -2
  42. package/dist/{chunk-TBJV4BZE.js → chunk-IE4HB6O5.js} +10 -10
  43. package/dist/chunk-JMDZDT24.js +38 -0
  44. package/dist/chunk-JMDZDT24.js.map +1 -0
  45. package/dist/{chunk-TGHUJC64.js → chunk-LARPWF3S.js} +3 -3
  46. package/dist/{chunk-M6ZJR6HU.js → chunk-LFHMUWA2.js} +67 -67
  47. package/dist/{chunk-L7DTBRTI.js → chunk-LXKJNUND.js} +2 -2
  48. package/dist/{chunk-BHKDCWGH.js → chunk-MNLZGCM2.js} +7 -7
  49. package/dist/{chunk-3FLPLDIL.js → chunk-MPDX5QMH.js} +2 -2
  50. package/dist/{chunk-7AMFUATK.js → chunk-MZWSOLMT.js} +14 -1
  51. package/dist/chunk-MZWSOLMT.js.map +1 -0
  52. package/dist/{chunk-SGMORUEU.js → chunk-NMGO2HAZ.js} +2 -2
  53. package/dist/{chunk-XHYCPA5C.js → chunk-NVYCTASB.js} +2 -2
  54. package/dist/{chunk-ONHRRJZM.js → chunk-QJAQNXWI.js} +6 -6
  55. package/dist/{chunk-GCKIDUHE.js → chunk-RROMWDDC.js} +22 -33
  56. package/dist/{chunk-GCKIDUHE.js.map → chunk-RROMWDDC.js.map} +1 -1
  57. package/dist/{chunk-4KAIGQVU.js → chunk-SZN6XVFC.js} +2 -2
  58. package/dist/{chunk-RENY3AIW.js → chunk-TG2DJFH7.js} +51 -51
  59. package/dist/{chunk-Z3B4V4YI.js → chunk-THHPDPMS.js} +5 -5
  60. package/dist/{chunk-WMR5WPZU.js → chunk-U37RGPJT.js} +2 -2
  61. package/dist/{chunk-FHH6R3QI.js → chunk-UGH6VPPO.js} +2 -2
  62. package/dist/{chunk-EFYACT2X.js → chunk-VY6SDKWZ.js} +2 -2
  63. package/dist/{chunk-NQ7E27HN.js → chunk-W4ZDTHWZ.js} +3 -3
  64. package/dist/{chunk-2WSX7U2N.js → chunk-X6ROIHFE.js} +2 -2
  65. package/dist/{chunk-AVPXXV6J.js → chunk-XKGPIWGI.js} +4 -4
  66. package/dist/{chunk-7CP7SO32.js → chunk-XTAAG4SQ.js} +11 -11
  67. package/dist/{chunk-A5N6ISRK.js → chunk-ZN4UZWMT.js} +2 -2
  68. package/dist/cli.js +48 -47
  69. package/dist/compounding/engine.js +7 -7
  70. package/dist/config.js +2 -2
  71. package/dist/connectors/codex-materialize-runner.js +7 -7
  72. package/dist/connectors/index.js +10 -10
  73. package/dist/consolidation-provenance-check.js +2 -2
  74. package/dist/contradiction/index.js +1 -1
  75. package/dist/corpus-watermark.js +16 -16
  76. package/dist/entity-retrieval.js +7 -7
  77. package/dist/explicit-capture.js +1 -1
  78. package/dist/extraction.js +1 -1
  79. package/dist/index.d.ts +388 -388
  80. package/dist/index.js +113 -112
  81. package/dist/lcm/index.js +3 -3
  82. package/dist/maintenance/memory-governance.js +7 -7
  83. package/dist/maintenance/rebuild-memory-lifecycle-ledger.js +7 -7
  84. package/dist/maintenance/rebuild-memory-projection.js +8 -8
  85. package/dist/namespaces/migrate.js +14 -14
  86. package/dist/namespaces/search.js +6 -6
  87. package/dist/namespaces/storage.js +7 -7
  88. package/dist/offline-sync-impression-drain.js +4 -4
  89. package/dist/operator-doctor-corpus.js +17 -17
  90. package/dist/operator-toolkit.js +22 -22
  91. package/dist/orchestration/maintenance.js +13 -13
  92. package/dist/orchestrator.js +68 -67
  93. package/dist/qmd.js +4 -4
  94. package/dist/resolution-3K27T4VO.js +1 -1
  95. package/dist/resume-bundles.js +2 -2
  96. package/dist/salvage-envelope.js +1 -1
  97. package/dist/schemas.d.ts +76 -76
  98. package/dist/search/factory.js +5 -5
  99. package/dist/search/index.js +9 -9
  100. package/dist/semantic-consolidation.js +12 -12
  101. package/dist/semantic-rule-promotion.js +7 -7
  102. package/dist/semantic-rule-verifier.js +7 -7
  103. package/dist/shared-context/manager.d.ts +8 -8
  104. package/dist/storage.js +6 -6
  105. package/dist/tokens.js +2 -2
  106. package/dist/transfer/types.d.ts +66 -66
  107. package/dist/verified-recall.js +7 -7
  108. package/dist/write-envelope.js +1 -1
  109. package/package.json +2 -2
  110. package/src/access-authorization-probe.ts +43 -0
  111. package/src/access-boundary.ts +2 -31
  112. package/src/access-http.test.ts +76 -0
  113. package/src/access-http.ts +11 -0
  114. package/src/access-surface-catalog.test.ts +4 -3
  115. package/src/access-token-capabilities.ts +31 -0
  116. package/dist/chunk-7AMFUATK.js.map +0 -1
  117. package/dist/chunk-V4MAO2Y4.js.map +0 -1
  118. /package/dist/{chunk-34RC5RT7.js.map → chunk-2SA56WMI.js.map} +0 -0
  119. /package/dist/{chunk-NM7SKDZM.js.map → chunk-3CDMIR3C.js.map} +0 -0
  120. /package/dist/{chunk-XBRPEGXF.js.map → chunk-3UOSVTFR.js.map} +0 -0
  121. /package/dist/{chunk-7IECFM4E.js.map → chunk-5ZGWA4AG.js.map} +0 -0
  122. /package/dist/{chunk-WNSQOXWS.js.map → chunk-6LRTGCRV.js.map} +0 -0
  123. /package/dist/{chunk-2NAFR36N.js.map → chunk-AGR7MGUX.js.map} +0 -0
  124. /package/dist/{chunk-ZLNOX7B2.js.map → chunk-AL4TZWI3.js.map} +0 -0
  125. /package/dist/{chunk-ECG64R7B.js.map → chunk-AT6DNUCM.js.map} +0 -0
  126. /package/dist/{chunk-WO7KBATL.js.map → chunk-CKMO4RDY.js.map} +0 -0
  127. /package/dist/{chunk-DFTCJVXI.js.map → chunk-DPYYSG6F.js.map} +0 -0
  128. /package/dist/{chunk-MX4TUDMB.js.map → chunk-FIGDB2HR.js.map} +0 -0
  129. /package/dist/{chunk-NHPROHJD.js.map → chunk-GNFZFJBJ.js.map} +0 -0
  130. /package/dist/{chunk-TBJV4BZE.js.map → chunk-IE4HB6O5.js.map} +0 -0
  131. /package/dist/{chunk-TGHUJC64.js.map → chunk-LARPWF3S.js.map} +0 -0
  132. /package/dist/{chunk-M6ZJR6HU.js.map → chunk-LFHMUWA2.js.map} +0 -0
  133. /package/dist/{chunk-L7DTBRTI.js.map → chunk-LXKJNUND.js.map} +0 -0
  134. /package/dist/{chunk-BHKDCWGH.js.map → chunk-MNLZGCM2.js.map} +0 -0
  135. /package/dist/{chunk-3FLPLDIL.js.map → chunk-MPDX5QMH.js.map} +0 -0
  136. /package/dist/{chunk-SGMORUEU.js.map → chunk-NMGO2HAZ.js.map} +0 -0
  137. /package/dist/{chunk-XHYCPA5C.js.map → chunk-NVYCTASB.js.map} +0 -0
  138. /package/dist/{chunk-ONHRRJZM.js.map → chunk-QJAQNXWI.js.map} +0 -0
  139. /package/dist/{chunk-4KAIGQVU.js.map → chunk-SZN6XVFC.js.map} +0 -0
  140. /package/dist/{chunk-RENY3AIW.js.map → chunk-TG2DJFH7.js.map} +0 -0
  141. /package/dist/{chunk-Z3B4V4YI.js.map → chunk-THHPDPMS.js.map} +0 -0
  142. /package/dist/{chunk-WMR5WPZU.js.map → chunk-U37RGPJT.js.map} +0 -0
  143. /package/dist/{chunk-FHH6R3QI.js.map → chunk-UGH6VPPO.js.map} +0 -0
  144. /package/dist/{chunk-EFYACT2X.js.map → chunk-VY6SDKWZ.js.map} +0 -0
  145. /package/dist/{chunk-NQ7E27HN.js.map → chunk-W4ZDTHWZ.js.map} +0 -0
  146. /package/dist/{chunk-2WSX7U2N.js.map → chunk-X6ROIHFE.js.map} +0 -0
  147. /package/dist/{chunk-AVPXXV6J.js.map → chunk-XKGPIWGI.js.map} +0 -0
  148. /package/dist/{chunk-7CP7SO32.js.map → chunk-XTAAG4SQ.js.map} +0 -0
  149. /package/dist/{chunk-A5N6ISRK.js.map → chunk-ZN4UZWMT.js.map} +0 -0
@@ -4,7 +4,7 @@ import {
4
4
  } from "./chunk-ZBJMUXZH.js";
5
5
  import {
6
6
  StorageManager
7
- } from "./chunk-7CP7SO32.js";
7
+ } from "./chunk-XTAAG4SQ.js";
8
8
  import {
9
9
  getCachedRuleMemories,
10
10
  setCachedRuleMemories
@@ -119,4 +119,4 @@ export {
119
119
  compareVerifiedSemanticRuleResults,
120
120
  searchVerifiedSemanticRules
121
121
  };
122
- //# sourceMappingURL=chunk-L7DTBRTI.js.map
122
+ //# sourceMappingURL=chunk-LXKJNUND.js.map
@@ -1,9 +1,9 @@
1
- import {
2
- runGraphEdgeDecayMaintenanceAcrossNamespaces
3
- } from "./chunk-HNZKVLAN.js";
4
1
  import {
5
2
  normalizeDreamsStatusWindowHours
6
3
  } from "./chunk-EQWEIIKQ.js";
4
+ import {
5
+ runGraphEdgeDecayMaintenanceAcrossNamespaces
6
+ } from "./chunk-HNZKVLAN.js";
7
7
  import {
8
8
  runContradictionScan
9
9
  } from "./chunk-BJJAX3IZ.js";
@@ -28,20 +28,20 @@ import {
28
28
  defineOperation,
29
29
  parseNamespacePreflightWriteOp,
30
30
  resolveAuthorizedNamespaceWritablePreflight
31
- } from "./chunk-GCKIDUHE.js";
31
+ } from "./chunk-RROMWDDC.js";
32
32
  import {
33
33
  projectTagProjectId
34
34
  } from "./chunk-MQVINOJQ.js";
35
35
  import {
36
36
  validateBriefingFormat
37
- } from "./chunk-4KAIGQVU.js";
37
+ } from "./chunk-SZN6XVFC.js";
38
38
  import {
39
39
  expandTildePath
40
40
  } from "./chunk-EYIEWJNI.js";
41
41
  import {
42
42
  enforceNamespaceAllowList,
43
43
  tokenCapabilityStore
44
- } from "./chunk-7AMFUATK.js";
44
+ } from "./chunk-MZWSOLMT.js";
45
45
  import {
46
46
  resolvePrincipal
47
47
  } from "./chunk-2H7OEVPO.js";
@@ -484,4 +484,4 @@ defineOperation({ name: "graph_events", description: "SSE graph events.", schema
484
484
  defineOperation({ name: "chat_message", description: "Chat message.", schema: strictSchema({ message: S.str, chatSessionId: S.str }), handler: async (_i, _ctx) => ({ result: { ok: true } }) });
485
485
  defineOperation({ name: "chat_events", description: "SSE chat events.", schema: strictSchema({}), handler: async (_i, _ctx) => ({ result: { stream: "sse" } }) });
486
486
  defineOperation({ name: "adapters_status", description: "Adapter registry metadata (issue #1850 round 5). Marker op: the HTTP transport builds the response from its own adapterRegistry, but the op still must be registered so it appears in listRegisteredOperations and enforceTokenOp can gate it for scoped tokens.", schema: strictSchema({}), handler: async (_i, _ctx) => ({ result: { ok: true } }) });
487
- //# sourceMappingURL=chunk-BHKDCWGH.js.map
487
+ //# sourceMappingURL=chunk-MNLZGCM2.js.map
@@ -7,7 +7,7 @@ import {
7
7
  } from "./chunk-3UXOZBHV.js";
8
8
  import {
9
9
  StorageManager
10
- } from "./chunk-7CP7SO32.js";
10
+ } from "./chunk-XTAAG4SQ.js";
11
11
  import {
12
12
  isSafeRouteNamespace
13
13
  } from "./chunk-U3PN77QT.js";
@@ -118,4 +118,4 @@ export {
118
118
  runCodexMaterialize,
119
119
  runPostConsolidationMaterialize
120
120
  };
121
- //# sourceMappingURL=chunk-3FLPLDIL.js.map
121
+ //# sourceMappingURL=chunk-MPDX5QMH.js.map
@@ -114,6 +114,18 @@ function capabilityAllowsOp(caps, op) {
114
114
  if (caps?.ops === void 0) return true;
115
115
  return caps.ops.includes(op);
116
116
  }
117
+ function assertOperationAuthorizationAllowed(caps, operation) {
118
+ if (operation.allowedByOps && operation.allowedByOps.length > 0) {
119
+ if (!operation.allowedByOps.some((allowedOperation) => capabilityAllowsOp(caps, allowedOperation))) {
120
+ throw new EngramAccessForbiddenError(`token is not permitted to call operation: ${operation.name}`);
121
+ }
122
+ } else {
123
+ assertOperationAllowed(caps, operation.name);
124
+ }
125
+ if (operation.fleetWide) {
126
+ assertFleetWideOperationAllowed(caps);
127
+ }
128
+ }
117
129
  function capabilityAllowsNamespace(caps, namespace) {
118
130
  if (caps?.namespaces === void 0) return true;
119
131
  if (namespace === void 0) return false;
@@ -164,6 +176,7 @@ export {
164
176
  validateCapabilitiesForMint,
165
177
  isCapabilityRestricted,
166
178
  capabilityAllowsOp,
179
+ assertOperationAuthorizationAllowed,
167
180
  capabilityAllowsNamespace,
168
181
  assertOperationAllowed,
169
182
  assertNamespaceAllowed,
@@ -173,4 +186,4 @@ export {
173
186
  assertFleetWideOperationAllowed,
174
187
  tokenCapabilityStore
175
188
  };
176
- //# sourceMappingURL=chunk-7AMFUATK.js.map
189
+ //# sourceMappingURL=chunk-MZWSOLMT.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"sources":["../src/access-token-capabilities.ts"],"sourcesContent":["/**\n * Per-token capabilities (issue #1837).\n *\n * A token entry MAY carry an explicit, versioned capabilities record. The\n * record's PRESENCE is mechanically detectable, which is load-bearing for\n * security:\n *\n * - ABSENT `capabilities` field ⇒ a PRE-FEATURE legacy entry (minted\n * before this feature). It is UNRESTRICTED — full access — purely for\n * backward compatibility. This is the ONLY path by which \"full access\"\n * is granted by omission.\n *\n * - PRESENT `capabilities` record (always carries a `version` marker) ⇒ a\n * token minted by the capability-aware path. Even a new token minted\n * without `--ops`/`--namespaces` records an EXPLICIT unrestricted record\n * (`{ version: 1 }`) — a deliberate, auditable choice, never an\n * accidentally-omitted field. Within the record, the two axes follow\n * absent-vs-present semantics:\n * * axis ABSENT (e.g. no `ops` key) ⇒ unrestricted on that axis.\n * * axis PRESENT and empty (`ops: []`) ⇒ deny all (fail-closed).\n * * axis PRESENT and non-empty ⇒ allow only the listed values.\n *\n * Malformed capability input at mint time (bad version, non-array axes,\n * non-string elements, unknown op names against the catalog, malformed\n * namespace values) is REJECTED — a token is never created from invalid\n * input (rule: invalid input rejected, not defaulted).\n *\n * This module owns the pure capability logic (shape validation, allow-list\n * checks) and the per-request AsyncLocalStorage carrying the presenting\n * token's resolved capabilities down to the access boundary. It imports\n * nothing else in the package except the forbidden-error class, so it can be\n * reused by the token store, the boundary, and the HTTP/MCP surfaces without\n * cycles.\n */\n\nimport { AsyncLocalStorage } from \"node:async_hooks\";\nimport { EngramAccessForbiddenError } from \"./access-errors.js\";\n\n/** Current capability-record schema version. */\nexport const TOKEN_CAPABILITIES_VERSION = 1 as const;\n\n/**\n * Versioned capabilities record stored on a token entry. Presence of this\n * record (vs. an absent field) is what distinguishes a capability-aware\n * token from a pre-feature legacy entry.\n */\nexport interface TokenCapabilities {\n readonly version: typeof TOKEN_CAPABILITIES_VERSION;\n /**\n * Operations allow-list. `undefined` (key absent) ⇒ unrestricted on this\n * axis. `[]` ⇒ deny all ops (fail-closed). Non-empty ⇒ allow only listed.\n */\n ops?: string[];\n /**\n * Namespaces allow-list. `undefined` ⇒ unrestricted. `[]` ⇒ deny all.\n * Non-empty ⇒ allow only listed.\n */\n namespaces?: string[];\n}\n\n/**\n * Namespace value validation. Namespace identifiers are flexible (default,\n * team, self, principal-prefixed, project-prefixed) but must never contain\n * whitespace, path separators, traversal segments, or control characters —\n * such values are malformed at mint time and rejected, never silently\n * coerced.\n */\nconst NAMESPACE_VALUE_MAX_LENGTH = 128;\n// Non-empty, no whitespace, no path separators, no control chars. `.` and\n// `..` are rejected separately so legitimate dotted names (e.g. a domain)\n// remain allowed while traversal is not.\nconst NAMESPACE_VALUE_PATTERN = /^[^\\s\\/\\\\\\x00-\\x1F]+$/;\n\n/** True when `value` is an acceptable namespace allow-list entry. */\nexport function isValidNamespaceValue(value: unknown): value is string {\n if (typeof value !== \"string\" || value.length === 0 || value.length > NAMESPACE_VALUE_MAX_LENGTH) {\n return false;\n }\n if (!NAMESPACE_VALUE_PATTERN.test(value)) return false;\n if (value === \".\" || value === \"..\") return false;\n return true;\n}\n\nfunction isStringArray(value: unknown): value is unknown[] {\n return Array.isArray(value) && value.every((v) => typeof v === \"string\");\n}\n\nfunction dedupeSort(values: string[]): string[] {\n return [...new Set(values)].sort();\n}\n\n/**\n * Parse one axis (ops or namespaces) for PERSISTENCE/LOAD. Returns the\n * cleaned array (deduped, sorted; possibly empty to preserve \"present ⇒\n * fail-closed\") or `undefined` when the key is absent. Throws on a malformed\n * shape (non-array, non-string elements, malformed namespace values). Op\n * validation against the catalog happens only at mint time.\n */\nfunction parseAxis(\n obj: Record<string, unknown>,\n key: \"ops\" | \"namespaces\",\n validateValue: (v: unknown) => boolean,\n valueLabel: string,\n): string[] | undefined {\n if (!Object.prototype.hasOwnProperty.call(obj, key)) return undefined;\n const value = obj[key];\n if (value === undefined || value === null) return undefined;\n if (!isStringArray(value)) {\n throw new Error(`capabilities ${key} must be an array of non-empty strings`);\n }\n const cleaned: string[] = [];\n for (const v of value) {\n if (typeof v !== \"string\" || v.length === 0) {\n throw new Error(`capabilities ${key} must be an array of non-empty strings`);\n }\n if (!validateValue(v)) {\n throw new Error(`capabilities ${key} contains a malformed ${valueLabel}: ${JSON.stringify(v)}`);\n }\n cleaned.push(v);\n }\n // Preserve presence: an explicitly empty array stays [] (fail-closed),\n // NOT coerced to undefined (which would mean unrestricted).\n return dedupeSort(cleaned);\n}\n\n/**\n * Normalize a capabilities record for PERSISTENCE/LOAD. Returns `undefined`\n * ONLY when the record is entirely absent (a pre-feature legacy entry ⇒\n * unrestricted). When present, an absent/`undefined` `version` is COERCED to\n * the current default (1) — mirroring {@link validateCapabilitiesForMint} — so\n * a record that mint-validated also load-normalizes without a schema throw.\n * An explicitly-present WRONG version (not 1) is still rejected. Throws on a\n * malformed record (non-object, explicitly-wrong version, malformed axes).\n */\nexport function normalizeCapabilities(raw: unknown): TokenCapabilities | undefined {\n if (raw === undefined || raw === null) return undefined;\n if (typeof raw !== \"object\" || Array.isArray(raw)) {\n throw new Error(\"capabilities must be an object with a version marker\");\n }\n const obj = raw as Record<string, unknown>;\n // Coerce absent/undefined version → 1, mirroring validateCapabilitiesForMint\n // (version 1 is the only schema version; coercing keeps mint-validated\n // records reloadable). Only an explicitly-present WRONG version throws.\n if (obj.version !== undefined && obj.version !== TOKEN_CAPABILITIES_VERSION) {\n throw new Error(`capabilities.version must be ${TOKEN_CAPABILITIES_VERSION}`);\n }\n const ops = parseAxis(obj, \"ops\", () => true, \"operation\");\n const namespaces = parseAxis(obj, \"namespaces\", isValidNamespaceValue, \"namespace\");\n const result: TokenCapabilities = { version: TOKEN_CAPABILITIES_VERSION };\n if (ops !== undefined) result.ops = ops;\n if (namespaces !== undefined) result.namespaces = namespaces;\n return result;\n}\n\n/**\n * Validate a capabilities record at MINT time. ALWAYS returns a versioned\n * record (never `undefined`) so every newly-minted token carries an explicit\n * capability decision — a new token can never gain full access by OMITTING\n * the field. When `raw` is absent/null, the result is an explicit\n * unrestricted record (`{ version: 1 }`), a deliberate/auditable choice. A\n * present-but-`undefined` (or absent) `version` is coerced to the current\n * default (1); an explicitly-wrong version is rejected. This version rule is\n * identical to {@link normalizeCapabilities} (mint/load symmetry). Rejects\n * unknown op names against the catalog and malformed namespace values;\n * throws a plain Error — the caller must NOT create a token when this throws.\n */\nexport function validateCapabilitiesForMint(\n raw: unknown,\n validOps: readonly string[],\n): TokenCapabilities {\n const result: TokenCapabilities = { version: TOKEN_CAPABILITIES_VERSION };\n if (raw === undefined || raw === null) {\n return result;\n }\n if (typeof raw !== \"object\" || Array.isArray(raw)) {\n throw new Error(\"capabilities must be an object with optional ops/namespaces arrays\");\n }\n const obj = raw as Record<string, unknown>;\n if (Object.prototype.hasOwnProperty.call(obj, \"version\") && obj.version !== undefined) {\n if (obj.version !== TOKEN_CAPABILITIES_VERSION) {\n throw new Error(`capabilities.version must be ${TOKEN_CAPABILITIES_VERSION}`);\n }\n }\n const validOpSet = new Set(validOps);\n\n if (Object.prototype.hasOwnProperty.call(obj, \"ops\") && obj.ops !== undefined && obj.ops !== null) {\n if (!isStringArray(obj.ops)) {\n throw new Error(\"capabilities ops must be an array of non-empty strings\");\n }\n const ops = obj.ops as unknown[];\n for (const v of ops) {\n if (typeof v !== \"string\" || v.length === 0) {\n throw new Error(\"capabilities ops must be an array of non-empty strings\");\n }\n }\n // Reject unknown op names against the catalog (unknown ⇒ reject, never drop).\n const unknown = ops.filter((op) => typeof op === \"string\" && !validOpSet.has(op));\n if (unknown.length > 0) {\n throw new Error(\n `capabilities ops contains unknown operation name(s): ${unknown.map((o) => JSON.stringify(o)).join(\", \")}`,\n );\n }\n // Preserve presence (empty stays [] ⇒ deny all ops).\n result.ops = dedupeSort(ops as string[]);\n }\n\n if (\n Object.prototype.hasOwnProperty.call(obj, \"namespaces\") &&\n obj.namespaces !== undefined &&\n obj.namespaces !== null\n ) {\n if (!isStringArray(obj.namespaces)) {\n throw new Error(\"capabilities namespaces must be an array of non-empty strings\");\n }\n const namespaces = obj.namespaces as unknown[];\n for (const v of namespaces) {\n if (typeof v !== \"string\" || v.length === 0) {\n throw new Error(\"capabilities namespaces must be an array of non-empty strings\");\n }\n if (!isValidNamespaceValue(v)) {\n throw new Error(`capabilities namespaces contains a malformed namespace: ${JSON.stringify(v)}`);\n }\n }\n result.namespaces = dedupeSort(namespaces as string[]);\n }\n\n return result;\n}\n\n/**\n * True when `caps` imposes any restriction (a present record with at least\n * one axis key). `undefined` (legacy / absent record) ⇒ unrestricted. A\n * present `{ version: 1 }` record with no axes ⇒ also unrestricted (but\n * auditable — it is a deliberate new-token decision, not omission).\n */\nexport function isCapabilityRestricted(caps: TokenCapabilities | undefined | null): boolean {\n if (!caps) return false;\n return caps.ops !== undefined || caps.namespaces !== undefined;\n}\n\n/**\n * True when `caps` permits `op`.\n * - record ABSENT (legacy) ⇒ unrestricted (true).\n * - ops axis ABSENT ⇒ unrestricted on this axis (true).\n * - ops axis PRESENT ⇒ `op` must be listed; `[]` ⇒ false (deny all).\n */\nexport function capabilityAllowsOp(caps: TokenCapabilities | undefined | null, op: string): boolean {\n if (caps?.ops === undefined) return true;\n return caps.ops.includes(op);\n}\n\n/**\n * The operation policy that all access surfaces use to decide whether a token\n * can invoke an operation.\n */\nexport interface OperationAuthorizationPolicy {\n readonly name: string;\n readonly allowedByOps?: readonly string[];\n readonly fleetWide?: boolean;\n}\n\n/**\n * Apply an operation's alternate grant and fleet-wide restrictions without\n * invoking its handler.\n */\nexport function assertOperationAuthorizationAllowed(\n caps: TokenCapabilities | undefined | null,\n operation: OperationAuthorizationPolicy,\n): void {\n if (operation.allowedByOps && operation.allowedByOps.length > 0) {\n if (!operation.allowedByOps.some((allowedOperation) => capabilityAllowsOp(caps, allowedOperation))) {\n throw new EngramAccessForbiddenError(`token is not permitted to call operation: ${operation.name}`);\n }\n } else {\n assertOperationAllowed(caps, operation.name);\n }\n\n if (operation.fleetWide) {\n assertFleetWideOperationAllowed(caps);\n }\n}\n\n/**\n * True when `caps` permits `namespace`.\n * - record ABSENT / namespaces axis ABSENT ⇒ unrestricted (true).\n * - namespaces axis PRESENT ⇒ `namespace` must be listed; undefined\n * namespace ⇒ false; `[]` ⇒ false (deny all).\n */\nexport function capabilityAllowsNamespace(\n caps: TokenCapabilities | undefined | null,\n namespace: string | undefined,\n): boolean {\n if (caps?.namespaces === undefined) return true;\n if (namespace === undefined) return false;\n return caps.namespaces.includes(namespace);\n}\n\n/**\n * Throw {@link EngramAccessForbiddenError} when `caps` restricts ops and\n * `op` is not permitted. No-op for unrestricted tokens.\n */\nexport function assertOperationAllowed(\n caps: TokenCapabilities | undefined | null,\n op: string,\n): void {\n if (!capabilityAllowsOp(caps, op)) {\n throw new EngramAccessForbiddenError(\n `token is not permitted to call operation: ${op}`,\n );\n }\n}\n\n/**\n * Throw {@link EngramAccessForbiddenError} when `caps` restricts namespaces\n * and `namespace` is not permitted. No-op for unrestricted tokens.\n */\nexport function assertNamespaceAllowed(\n caps: TokenCapabilities | undefined | null,\n namespace: string | undefined,\n): void {\n if (!capabilityAllowsNamespace(caps, namespace)) {\n throw new EngramAccessForbiddenError(\n namespace === undefined\n ? \"token is scoped to specific namespaces and this operation requires an explicit namespace\"\n : `token is not permitted to access namespace: ${namespace}`,\n );\n }\n}\n\n/**\n * Resolve the EFFECTIVE namespace an operation runs against: a present,\n * non-empty request namespace wins, otherwise the server default — the same\n * resolution downstream storage applies\n * (`getWritableStorageForNamespace(undefined)` → `defaultNamespace`). Empty\n * strings are treated as absent. Centralized so every invocation surface\n * (HTTP query/body, MCP `tools/call`, id-loaded records, legacy pairs that\n * carry no namespace) applies ONE rule and none can dodge the check by\n * dropping the param. (issue #1850)\n */\nexport function resolveEffectiveNamespace(\n namespace: string | undefined,\n defaultNamespace: string | undefined,\n): string | undefined {\n const normalized = namespace !== undefined && namespace.length > 0 ? namespace : undefined;\n return normalized ?? defaultNamespace;\n}\n\n/**\n * The single effective-namespace allow-list chokepoint (issues #1837/#1850).\n * Throws {@link EngramAccessForbiddenError} when `caps` carries a namespaces\n * allow-list and the EFFECTIVE namespace (request value OR server default) is\n * not a member. FAIL CLOSED:\n * - a scoped token whose allow-list does not cover the effective namespace\n * (explicit OR defaulted) is rejected;\n * - an absent server default (unconfigured) is also rejected for scoped\n * tokens, so omitting `?namespace=` can never bypass the allow-list.\n * No-op for unrestricted tokens (no namespaces axis) so legacy/unrestricted\n * behavior is unchanged. Both the HTTP transport (`resolveNamespace`) and the\n * MCP dispatch route through this ONE function so no surface is missed.\n */\nexport function isNamespaceAllowed(\n caps: TokenCapabilities | undefined | null,\n namespace: string | undefined,\n defaultNamespace: string | undefined,\n): boolean {\n if (caps?.namespaces === undefined) return true; // unrestricted token\n const effective = resolveEffectiveNamespace(namespace, defaultNamespace);\n return effective !== undefined && caps.namespaces.includes(effective);\n}\n\nexport function enforceNamespaceAllowList(\n caps: TokenCapabilities | undefined | null,\n namespace: string | undefined,\n defaultNamespace: string | undefined,\n): void {\n if (isNamespaceAllowed(caps, namespace, defaultNamespace)) return;\n throw new EngramAccessForbiddenError(\n namespace === undefined\n ? \"token is scoped to specific namespaces; the server default namespace is not permitted — supply an allowed namespace\"\n : `token is not permitted to access namespace: ${namespace}`,\n );\n}\n\n/**\n * Fleet-wide / global maintenance operation guard (issue #1850 round 10).\n *\n * A distinct escalation class from the id-addressed routes (round 9) and the\n * param-namespace ops (round 4): some boundary operations inherently run\n * ACROSS ALL namespaces — or against a single global layer (compression\n * guidelines, shared context, compounding) that is not namespace-partitioned\n * — and carry NO `namespace` argument, so the MCP `tools/call` effective-\n * namespace chokepoint ({@link enforceNamespaceAllowList}, which only fires\n * when `toolAcceptsNamespace`) never applies. Without this guard a bearer\n * scoped to ONE tenant could trigger maintenance that mutates state in EVERY\n * namespace (privilege escalation).\n *\n * Fail CLOSED exactly like the other shared guards: a namespace-SCOPED token\n * (namespaces axis present) is rejected; unrestricted / legacy tokens (absent\n * record or no namespaces axis — i.e. cron and internal callers that never\n * bind a capability record) are unaffected. Reuses the EXISTING capability\n * model via {@link capabilityAllowsNamespace} — no new \"all\"/\"*\" scope concept.\n * Must run BEFORE any side effect so a denial never leaks a partial mutation.\n */\nexport function assertFleetWideOperationAllowed(\n caps: TokenCapabilities | undefined | null,\n): void {\n // capabilityAllowsNamespace returns false for ANY scoped token when the\n // namespace is undefined (a fleet-wide op has no single namespace), and\n // true for unrestricted/legacy tokens — exactly the desired policy.\n if (!capabilityAllowsNamespace(caps, undefined)) {\n throw new EngramAccessForbiddenError(\n \"token is scoped to specific namespaces; this maintenance operation runs across all namespaces and is not permitted for a namespace-scoped token\",\n );\n }\n}\n\n/**\n * Per-request AsyncLocalStorage carrying the presenting token's resolved\n * capabilities. The HTTP surface binds the resolved capabilities with\n * `.run(caps, handler)` for the WHOLE authorized request dispatch (NOT\n * `.enterWith()`, which mutates the current async resource and does not\n * reliably isolate the store across the handler's awaits / concurrent\n * requests — risking a fail-open read of undefined mid-handler); the\n * access boundary reads `.getStore()` to enforce the ops allow-list for\n * every boundary operation without each dispatch site threading the value\n * explicitly. Unset (CLI, direct boundary callers, tests) ⇒ undefined ⇒\n * unrestricted (issue #1850 round 7).\n */\nexport const tokenCapabilityStore = new AsyncLocalStorage<TokenCapabilities | undefined>();\n"],"mappings":";;;;;AAmCA,SAAS,yBAAyB;A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,
8
8
  defineOperation,
9
9
  isCodegraphToolName
10
- } from "./chunk-GCKIDUHE.js";
10
+ } from "./chunk-RROMWDDC.js";
11
11
  import {
12
12
  serializeMutations,
13
13
  withHeldFileLock
@@ -1805,4 +1805,4 @@ export {
1805
1805
  codegraphIngestTracesOperation,
1806
1806
  REGISTERED_OPERATIONS
1807
1807
  };
1808
- //# sourceMappingURL=chunk-SGMORUEU.js.map
1808
+ //# sourceMappingURL=chunk-NMGO2HAZ.js.map
@@ -1,6 +1,6 @@
1
1
  import {
2
2
  StorageManager
3
- } from "./chunk-7CP7SO32.js";
3
+ } from "./chunk-XTAAG4SQ.js";
4
4
  import {
5
5
  namespaceIdentityToken,
6
6
  normalizeNamespaceIdentity
@@ -386,4 +386,4 @@ export {
386
386
  resolveNamespaceStorageRoot,
387
387
  NamespaceStorageRouter
388
388
  };
389
- //# sourceMappingURL=chunk-XHYCPA5C.js.map
389
+ //# sourceMappingURL=chunk-NVYCTASB.js.map
@@ -1,11 +1,6 @@
1
1
  import {
2
2
  resolveEnsureCollectionArgs
3
3
  } from "./chunk-YV32N67O.js";
4
- import {
5
- EMPTY_QMD_STATUS,
6
- embedQmdFiles,
7
- fetchQmdStatus
8
- } from "./chunk-IUM3VSHI.js";
9
4
  import {
10
5
  QMD_PROBE_RETRY_BACKOFF_MS,
11
6
  QMD_PROBE_TIMEOUT_MS,
@@ -18,6 +13,11 @@ import {
18
13
  qmdVersionToString,
19
14
  resolveQmdCapabilities
20
15
  } from "./chunk-64UDOIMI.js";
16
+ import {
17
+ EMPTY_QMD_STATUS,
18
+ embedQmdFiles,
19
+ fetchQmdStatus
20
+ } from "./chunk-IUM3VSHI.js";
21
21
  import {
22
22
  launchProcess
23
23
  } from "./chunk-O75CRYGF.js";
@@ -2228,4 +2228,4 @@ export {
2228
2228
  sharedDaemonSessionCountForTest,
2229
2229
  QmdClient
2230
2230
  };
2231
- //# sourceMappingURL=chunk-ONHRRJZM.js.map
2231
+ //# sourceMappingURL=chunk-QJAQNXWI.js.map
@@ -46,7 +46,7 @@ import {
46
46
  listMemoryGovernanceRuns,
47
47
  readMemoryGovernanceRunArtifact,
48
48
  runMemoryGovernance
49
- } from "./chunk-NM7SKDZM.js";
49
+ } from "./chunk-3CDMIR3C.js";
50
50
  import {
51
51
  recordObjectiveStateSnapshotsFromObservedMessages
52
52
  } from "./chunk-ICP53SKG.js";
@@ -55,7 +55,7 @@ import {
55
55
  } from "./chunk-6HMYUWXR.js";
56
56
  import {
57
57
  offlineSyncStorageForSnapshot
58
- } from "./chunk-FHH6R3QI.js";
58
+ } from "./chunk-UGH6VPPO.js";
59
59
  import {
60
60
  combineNamespaces,
61
61
  defaultGitInvoker,
@@ -82,25 +82,25 @@ import {
82
82
  import {
83
83
  formatProfileTraceAscii
84
84
  } from "./chunk-NLE6TSLG.js";
85
+ import {
86
+ buildProcedurePersistBody,
87
+ normalizeProcedureSteps
88
+ } from "./chunk-QDW3E4RD.js";
85
89
  import {
86
90
  persistExplicitCapture,
87
91
  queueExplicitCaptureForReview,
88
92
  validateExplicitCaptureInput
89
93
  } from "./chunk-IKMAO55B.js";
90
- import {
91
- buildProcedurePersistBody,
92
- normalizeProcedureSteps
93
- } from "./chunk-QDW3E4RD.js";
94
94
  import {
95
95
  lcmEvidenceIdentity
96
96
  } from "./chunk-C37ZRXX7.js";
97
97
  import {
98
98
  CorpusWatermarkCache,
99
99
  computeServiceCorpusWatermarks
100
- } from "./chunk-NQ7E27HN.js";
100
+ } from "./chunk-W4ZDTHWZ.js";
101
101
  import {
102
102
  namespaceCollectionName
103
- } from "./chunk-A5N6ISRK.js";
103
+ } from "./chunk-ZN4UZWMT.js";
104
104
  import {
105
105
  CrossNamespaceBudget,
106
106
  toBudgetWarning
@@ -122,13 +122,13 @@ import {
122
122
  enqueuePassiveCorrectionNotification,
123
123
  parseBriefingFocus,
124
124
  parseBriefingWindow
125
- } from "./chunk-4KAIGQVU.js";
125
+ } from "./chunk-SZN6XVFC.js";
126
126
  import {
127
127
  parseEntityFile,
128
128
  qmdCollectionPathParts,
129
129
  qmdResultPathCandidates,
130
130
  selfDeps
131
- } from "./chunk-7CP7SO32.js";
131
+ } from "./chunk-XTAAG4SQ.js";
132
132
  import {
133
133
  supersessionKeysForFact
134
134
  } from "./chunk-DNHVPZOD.js";
@@ -142,6 +142,10 @@ import {
142
142
  import {
143
143
  serializeMutations
144
144
  } from "./chunk-WL5EBRDH.js";
145
+ import {
146
+ inferMemoryStatus,
147
+ toMemoryPathRel
148
+ } from "./chunk-ILGC6JH6.js";
145
149
  import {
146
150
  normalizeProjectionPreview,
147
151
  normalizeProjectionTags
@@ -152,10 +156,6 @@ import {
152
156
  import {
153
157
  displayErrorDetail
154
158
  } from "./chunk-RL6NEVXT.js";
155
- import {
156
- inferMemoryStatus,
157
- toMemoryPathRel
158
- } from "./chunk-ILGC6JH6.js";
159
159
  import {
160
160
  STRUCTURED_ATTRIBUTE_LIMITS,
161
161
  buildAccessWriteRequestFingerprint,
@@ -183,6 +183,10 @@ import {
183
183
  import {
184
184
  expandTildePath
185
185
  } from "./chunk-EYIEWJNI.js";
186
+ import {
187
+ buildHandleIndexForResults,
188
+ isHandleToken
189
+ } from "./chunk-JAKIDQB2.js";
186
190
  import {
187
191
  exportCapsule
188
192
  } from "./chunk-KQAFEZQX.js";
@@ -198,13 +202,12 @@ import {
198
202
  readOfflineSyncFileContentChunk
199
203
  } from "./chunk-E4OCKU67.js";
200
204
  import {
201
- assertFleetWideOperationAllowed,
202
- assertOperationAllowed,
205
+ assertOperationAuthorizationAllowed,
203
206
  capabilityAllowsOp,
204
207
  enforceNamespaceAllowList,
205
208
  isNamespaceAllowed,
206
209
  tokenCapabilityStore
207
- } from "./chunk-7AMFUATK.js";
210
+ } from "./chunk-MZWSOLMT.js";
208
211
  import {
209
212
  meetingsBuild,
210
213
  meetingsGet,
@@ -218,10 +221,6 @@ import {
218
221
  import {
219
222
  evaluateActionConfidence
220
223
  } from "./chunk-Z2YFLXHU.js";
221
- import {
222
- buildHandleIndexForResults,
223
- isHandleToken
224
- } from "./chunk-JAKIDQB2.js";
225
224
  import {
226
225
  defaultNamespaceAtFlatRoot,
227
226
  mergeMemorySearchDefaultFallback,
@@ -5050,17 +5049,7 @@ function defineOperation(spec) {
5050
5049
  if (!parseResult.success) {
5051
5050
  throw new EngramAccessInputError(formatZodIssues(parseResult.error));
5052
5051
  }
5053
- if (spec.allowedByOps && spec.allowedByOps.length > 0) {
5054
- const store = tokenCapabilityStore.getStore();
5055
- if (!spec.allowedByOps.some((op) => capabilityAllowsOp(store, op))) {
5056
- throw new EngramAccessForbiddenError(`token is not permitted to call operation: ${spec.name}`);
5057
- }
5058
- } else {
5059
- assertOperationAllowed(tokenCapabilityStore.getStore(), spec.name);
5060
- }
5061
- if (spec.fleetWide) {
5062
- assertFleetWideOperationAllowed(tokenCapabilityStore.getStore());
5063
- }
5052
+ assertOperationAuthorizationAllowed(tokenCapabilityStore.getStore(), spec);
5064
5053
  return spec.handler(parseResult.data, ctx);
5065
5054
  }
5066
5055
  };
@@ -12457,4 +12446,4 @@ export {
12457
12446
  EngramAccessService,
12458
12447
  AccessAdminOpsSurface
12459
12448
  };
12460
- //# sourceMappingURL=chunk-GCKIDUHE.js.map
12449
+ //# sourceMappingURL=chunk-RROMWDDC.js.map