enigma-memory 0.1.17 → 0.1.22

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 (290) hide show
  1. package/README.md +85 -27
  2. package/apps/cli/bin/enigma-desktop.mjs +140 -0
  3. package/apps/cli/bin/enigma-terminal.mjs +78 -0
  4. package/apps/cli/bin/enigma.mjs +4979 -3263
  5. package/apps/desktop/electron-main.cjs +217 -0
  6. package/apps/desktop/package.json +12 -0
  7. package/apps/desktop/src/app.js +264 -7
  8. package/apps/desktop/src/index.html +3514 -1373
  9. package/apps/desktop/src/launch-electron.mjs +51 -0
  10. package/apps/desktop/src/server.mjs +2914 -0
  11. package/apps/desktop/src/styles.css +2972 -260
  12. package/apps/desktop/src/zk-browser-prove.mjs +53 -0
  13. package/apps/desktop/src/zk-state.mjs +1789 -0
  14. package/apps/gateway/bin/enigma-gateway.mjs +102 -5
  15. package/apps/gateway/src/server.mjs +271 -8
  16. package/apps/ios/EnigmaCore/Package.swift +12 -0
  17. package/apps/ios/EnigmaCore/Sources/EnigmaCore/EnigmaAPIClient.swift +227 -0
  18. package/apps/ios/EnigmaCore/Sources/EnigmaCore/Models.swift +278 -0
  19. package/apps/ios/EnigmaCore/Sources/EnigmaCore/PKCE.swift +96 -0
  20. package/apps/ios/EnigmaCore/Sources/EnigmaCore/PrivacyMinimizer.swift +187 -0
  21. package/apps/ios/EnigmaCore/Sources/EnigmaCore/ToolModels.swift +129 -0
  22. package/apps/ios/EnigmaCore/Tests/EnigmaCoreTests/EnigmaCoreTests.swift +42 -0
  23. package/apps/ios/EnigmaIOS/Enigma/AppModel.swift +346 -0
  24. package/apps/ios/EnigmaIOS/Enigma/Assets.xcassets/AccentColor.colorset/Contents.json +12 -0
  25. package/apps/ios/EnigmaIOS/Enigma/Assets.xcassets/AppIcon.appiconset/Contents.json +11 -0
  26. package/apps/ios/EnigmaIOS/Enigma/Assets.xcassets/AppIcon.appiconset/EnigmaAppIcon.png +0 -0
  27. package/apps/ios/EnigmaIOS/Enigma/Assets.xcassets/Contents.json +3 -0
  28. package/apps/ios/EnigmaIOS/Enigma/Assets.xcassets/LaunchBackground.colorset/Contents.json +12 -0
  29. package/apps/ios/EnigmaIOS/Enigma/ChatView.swift +181 -0
  30. package/apps/ios/EnigmaIOS/Enigma/CouncilView.swift +78 -0
  31. package/apps/ios/EnigmaIOS/Enigma/CreateView.swift +152 -0
  32. package/apps/ios/EnigmaIOS/Enigma/EnigmaApp.swift +52 -0
  33. package/apps/ios/EnigmaIOS/Enigma/Info.plist +52 -0
  34. package/apps/ios/EnigmaIOS/Enigma/NaturalLanguagePrivacyTagger.swift +26 -0
  35. package/apps/ios/EnigmaIOS/Enigma/OAuthClient.swift +321 -0
  36. package/apps/ios/EnigmaIOS/Enigma/OnboardingView.swift +105 -0
  37. package/apps/ios/EnigmaIOS/Enigma/PrivateVaultView.swift +275 -0
  38. package/apps/ios/EnigmaIOS/Enigma/SecureStore.swift +76 -0
  39. package/apps/ios/EnigmaIOS/Enigma/SettingsView.swift +60 -0
  40. package/apps/ios/EnigmaIOS/Enigma/Theme.swift +80 -0
  41. package/apps/ios/EnigmaIOS/EnigmaIOS.xcodeproj/project.pbxproj +211 -0
  42. package/apps/ios/EnigmaIOS/EnigmaIOS.xcodeproj/xcshareddata/xcschemes/Enigma.xcscheme +23 -0
  43. package/apps/native-host/README.md +19 -8
  44. package/apps/native-host/bin/enigma-native-host.mjs +229 -13
  45. package/apps/relay/bin/enigma-relay.mjs +103 -5
  46. package/apps/relay/src/federation-runtime.mjs +618 -0
  47. package/apps/relay/src/server.mjs +310 -9
  48. package/apps/verifier/bin/enigma-verify.mjs +327 -11
  49. package/cortex-v3/circuits/build/intent_vk_bytes.json +35 -0
  50. package/cortex-v3/circuits/build/sale_vk_bytes.json +35 -0
  51. package/cortex-v3/circuits/build/vk_bytes.json +32 -0
  52. package/cortex-v3/proving-assets.json +64 -0
  53. package/cortex-v3/zk/BUILD-CONTRACT.md +87 -0
  54. package/cortex-v3/zk/action-transition-vk.json +119 -0
  55. package/cortex-v3/zk/alias-adversarial.test.mjs +220 -0
  56. package/cortex-v3/zk/groth16-verify-child.mjs +17 -0
  57. package/cortex-v3/zk/intent-witness.mjs +365 -0
  58. package/cortex-v3/zk/intent-witness.test.mjs +485 -0
  59. package/cortex-v3/zk/proving-assets.mjs +203 -0
  60. package/cortex-v3/zk/sale-witness.mjs +783 -0
  61. package/cortex-v3/zk/sale-witness.test.mjs +784 -0
  62. package/cortex-v3/zk/sealed-sale-release-vk.json +119 -0
  63. package/cortex-v3/zk/settlement-evidence.mjs +722 -0
  64. package/cortex-v3/zk/setup-intent.mjs +688 -0
  65. package/cortex-v3/zk/setup-sale.mjs +666 -0
  66. package/cortex-v3/zk/setup.mjs +594 -0
  67. package/cortex-v3/zk/witness.mjs +184 -0
  68. package/cortex-v3/zk/zk-codec.mjs +232 -0
  69. package/cortex-v3/zk/zk-codec.test.mjs +293 -0
  70. package/cortex-v3/zk/zk-settle.mjs +370 -0
  71. package/cortex-v3/zk/zk-tree.mjs +256 -0
  72. package/cortex-v3/zk/zk-tree.test.mjs +419 -0
  73. package/deploy/SIMULATION.md +14 -9
  74. package/deploy/docker-compose.local-production-simulation.yml +54 -12
  75. package/docs/benchmark-attestation-network.md +487 -487
  76. package/docs/benchmark-reproducibility.md +289 -289
  77. package/docs/blockchain-only-mechanisms.md +400 -400
  78. package/docs/browser-extension-install.md +8 -6
  79. package/docs/client-connectors.md +16 -12
  80. package/docs/demo-proof-network.md +275 -275
  81. package/docs/developer-ecosystem.md +15 -13
  82. package/docs/developer-proof-quickstart.md +325 -325
  83. package/docs/enigma-memory-ready-conformance.md +378 -376
  84. package/docs/install-anywhere.md +64 -30
  85. package/docs/installers-and-desktop.md +8 -7
  86. package/docs/memory-benchmarks.md +1 -1
  87. package/docs/memory-drive-health-model.md +690 -690
  88. package/docs/novelty-invention-candidates.md +161 -161
  89. package/docs/proof-network-build-notes.md +240 -240
  90. package/docs/proof-network-claim-boundaries.md +320 -318
  91. package/docs/proof-network.md +339 -339
  92. package/docs/sdk-api.md +324 -324
  93. package/docs/solana-proof-rail.md +453 -453
  94. package/examples/01-quickstart-agent/index.mjs +49 -0
  95. package/examples/01_agent_memory_quickstart.mjs +57 -0
  96. package/examples/02-multi-agent-swarm/index.mjs +57 -0
  97. package/examples/02_cross_model_passport.mjs +64 -0
  98. package/examples/03-langchain-memory/index.mjs +41 -0
  99. package/examples/03_poseidon_commitment_verification.mjs +71 -0
  100. package/examples/04-python-trading-agent/trader.py +49 -0
  101. package/examples/README.md +27 -0
  102. package/examples/ci/github-actions.yml +7 -2
  103. package/package.json +410 -278
  104. package/packages/adapters/PACKAGE_CONTRACT.md +1 -1
  105. package/packages/connectors/src/index.js +196 -4
  106. package/packages/connectors/swarm-router.mjs +168 -0
  107. package/packages/core/src/index.js +249 -2
  108. package/packages/core/src/version.mjs +7 -0
  109. package/packages/dev-tools/package.json +19 -0
  110. package/packages/dev-tools/src/index.js +4 -0
  111. package/packages/dev-tools/src/memory-benchmark-suite.js +112 -0
  112. package/packages/dev-tools/src/swarm-simulator.js +101 -0
  113. package/packages/dev-tools/src/vault-inspector.js +114 -0
  114. package/packages/dev-tools/src/vector-benchmark.js +100 -0
  115. package/packages/developer-platform/src/access-credentials.js +341 -0
  116. package/packages/developer-platform/src/http.js +132 -0
  117. package/packages/developer-platform/src/index.js +4 -0
  118. package/packages/developer-platform/src/usage-http.js +60 -0
  119. package/packages/developer-platform/src/usage.js +295 -0
  120. package/packages/enclave-runtime/attestation.mjs +159 -0
  121. package/packages/enclave-runtime/index.mjs +47 -0
  122. package/packages/enclave-runtime/session-manager.mjs +253 -0
  123. package/packages/enclave-runtime/zeroization-proof.mjs +227 -0
  124. package/packages/enigma-reflex/package.json +14 -0
  125. package/packages/enigma-reflex/src/index.js +204 -0
  126. package/packages/enigma-reflex/training/generate-dataset.mjs +40 -0
  127. package/packages/enigma-reflex/training/requirements.txt +8 -0
  128. package/packages/enigma-reflex/training/train.py +314 -0
  129. package/packages/enigma-weave/LICENSE +22 -0
  130. package/packages/enigma-weave/UPSTREAM.json +21 -0
  131. package/packages/enigma-weave/package.json +14 -0
  132. package/packages/enigma-weave/src/index.js +286 -0
  133. package/packages/hosted-cloud/src/index.js +80 -5
  134. package/packages/importers/src/index.js +432 -0
  135. package/packages/inference-runtime/src/browser.js +401 -0
  136. package/packages/inference-runtime/src/chat.js +265 -0
  137. package/packages/inference-runtime/src/code.js +407 -0
  138. package/packages/inference-runtime/src/contracts.js +162 -0
  139. package/packages/inference-runtime/src/http.js +232 -0
  140. package/packages/inference-runtime/src/image.js +186 -0
  141. package/packages/inference-runtime/src/index.js +10 -0
  142. package/packages/inference-runtime/src/model-router.js +320 -0
  143. package/packages/inference-runtime/src/platform.js +125 -0
  144. package/packages/inference-runtime/src/privacy.js +400 -0
  145. package/packages/inference-runtime/src/video.js +253 -0
  146. package/packages/mcp-server/README.md +22 -6
  147. package/packages/mcp-server/bin/enigma-mcp.mjs +2 -1
  148. package/packages/mcp-server/src/index.js +2498 -1185
  149. package/packages/mcp-server/src/oauth.js +561 -0
  150. package/packages/mcp-server/src/private-handoff.js +84 -0
  151. package/packages/mcp-server/src/remote-http.js +273 -0
  152. package/packages/mcp-server/src/remote-policy.js +72 -0
  153. package/packages/mcp-server/swarm-bridge.mjs +361 -0
  154. package/packages/mesh/index.d.ts +283 -0
  155. package/packages/mesh/package.json +23 -0
  156. package/packages/mesh/src/crypto.js +189 -0
  157. package/packages/mesh/src/federation-packets.js +353 -0
  158. package/packages/mesh/src/gossip.js +311 -0
  159. package/packages/mesh/src/index.js +6 -0
  160. package/packages/mesh/src/protocol.js +255 -0
  161. package/packages/mesh/src/router.js +279 -0
  162. package/packages/mesh/src/transport.js +306 -0
  163. package/packages/passport/src/index.js +436 -7
  164. package/packages/private-economy/src/credits-http.js +100 -0
  165. package/packages/private-economy/src/credits.js +447 -0
  166. package/packages/private-economy/src/index.js +5 -0
  167. package/packages/private-economy/src/payments-http.js +120 -0
  168. package/packages/private-economy/src/payments.js +509 -0
  169. package/packages/private-economy/src/x402.js +346 -0
  170. package/packages/proof-network/PACKAGE_CONTRACT.md +21 -0
  171. package/packages/rag/index.d.ts +182 -0
  172. package/packages/rag/models/Xenova/all-MiniLM-L6-v2/THIRD_PARTY_LICENSES.txt +207 -0
  173. package/packages/rag/models/Xenova/all-MiniLM-L6-v2/config.json +25 -0
  174. package/packages/rag/models/Xenova/all-MiniLM-L6-v2/onnx/model_quantized.onnx +0 -0
  175. package/packages/rag/models/Xenova/all-MiniLM-L6-v2/sha256-manifest.json +28 -0
  176. package/packages/rag/models/Xenova/all-MiniLM-L6-v2/tokenizer.json +30686 -0
  177. package/packages/rag/models/Xenova/all-MiniLM-L6-v2/tokenizer_config.json +15 -0
  178. package/packages/rag/package.json +27 -0
  179. package/packages/rag/src/blinded-search.js +109 -0
  180. package/packages/rag/src/bm25.js +169 -0
  181. package/packages/rag/src/embeddings.js +459 -0
  182. package/packages/rag/src/hybrid.js +76 -0
  183. package/packages/rag/src/index.js +38 -0
  184. package/packages/rag/src/reranker.js +61 -0
  185. package/packages/rag/src/research.js +107 -0
  186. package/packages/rag/src/vector-store.js +430 -0
  187. package/packages/rag/src/verify-model-artifacts.mjs +4 -0
  188. package/packages/sdk/index.d.ts +760 -0
  189. package/packages/sdk/package.json +33 -0
  190. package/packages/sdk/python/README.md +24 -0
  191. package/packages/sdk/python/enigma_sdk.py +250 -0
  192. package/packages/sdk/python/pyproject.toml +34 -0
  193. package/packages/sdk/python/requirements.txt +1 -0
  194. package/packages/sdk/python/setup.py +20 -0
  195. package/packages/sdk/src/federation/capability-grant.js +389 -0
  196. package/packages/sdk/src/federation/federation-router.js +360 -0
  197. package/packages/sdk/src/federation/ghostmesh-bridge.js +497 -0
  198. package/packages/sdk/src/federation/index.js +3 -0
  199. package/packages/sdk/src/index.js +1796 -0
  200. package/packages/sdk/src/intelligence/contradiction.js +337 -0
  201. package/packages/sdk/src/intelligence/decision-engine.js +155 -0
  202. package/packages/sdk/src/intelligence/index.js +4 -0
  203. package/packages/sdk/src/intelligence/ontology.js +122 -0
  204. package/packages/sdk/src/intelligence/temporal.js +123 -0
  205. package/packages/sdk/src/market-client.js +142 -0
  206. package/packages/sdk/src/mesh-client.js +110 -0
  207. package/packages/sdk/src/middleware/index.js +3 -0
  208. package/packages/sdk/src/middleware/langchain.js +159 -0
  209. package/packages/sdk/src/middleware/llamaindex.js +101 -0
  210. package/packages/sdk/src/middleware/vercel-ai.js +112 -0
  211. package/packages/sdk/src/rag-client.js +85 -0
  212. package/packages/sdk/src/swarm-orchestrator.js +260 -0
  213. package/packages/settlement/PACKAGE_CONTRACT.md +1 -1
  214. package/packages/snapcompact/THIRD_PARTY_LICENSES.txt +40 -0
  215. package/packages/snapcompact/assets/8x13-latin1.bdf +3837 -0
  216. package/packages/snapcompact/index.d.ts +284 -0
  217. package/packages/snapcompact/package.json +25 -0
  218. package/packages/snapcompact/src/index.js +716 -0
  219. package/packages/storage/PACKAGE_CONTRACT.md +1 -1
  220. package/packages/terminal-console/animations.mjs +240 -0
  221. package/packages/terminal-console/auto-anchor.mjs +220 -0
  222. package/packages/terminal-console/banner.mjs +91 -0
  223. package/packages/terminal-console/commands.mjs +459 -0
  224. package/packages/terminal-console/delegation.mjs +152 -0
  225. package/packages/terminal-console/index.mjs +5 -0
  226. package/packages/terminal-console/outbox.mjs +143 -0
  227. package/packages/terminal-console/phantom-bridge.mjs +637 -0
  228. package/packages/terminal-console/repl.mjs +136 -0
  229. package/packages/terminal-console/signer-store.mjs +130 -0
  230. package/packages/terminal-console/solana-rpc.mjs +214 -0
  231. package/packages/terminal-console/solana-transport.mjs +189 -0
  232. package/packages/terminal-tui/dashboard.mjs +214 -0
  233. package/packages/terminal-tui/index.mjs +28 -0
  234. package/packages/terminal-tui/merkle-tree-renderer.mjs +268 -0
  235. package/packages/terminal-tui/telemetry-hud.mjs +137 -0
  236. package/packages/vault/index.d.ts +449 -0
  237. package/packages/vault/package.json +27 -0
  238. package/packages/vault/src/e2ee.mjs +393 -0
  239. package/packages/vault/src/enclave.js +481 -0
  240. package/packages/vault/src/erasure.js +207 -0
  241. package/packages/vault/src/index.js +1150 -125
  242. package/packages/vault/src/persistence.js +307 -0
  243. package/packages/vault/src/poseidon.js +354 -0
  244. package/packages/vault/src/receipt.js +459 -0
  245. package/scripts/benchmark-optical-context.mjs +166 -0
  246. package/scripts/bootstrap-enigma.mjs +502 -0
  247. package/scripts/build-edge-backend-workers.mjs +20 -5
  248. package/scripts/build-goal-completion-audit.mjs +72 -25
  249. package/scripts/build-hosted-api-key-lifecycle.mjs +292 -274
  250. package/scripts/build-hosted-customer-lifecycle.mjs +493 -476
  251. package/scripts/build-hosted-probe-worker.mjs +19 -4
  252. package/scripts/build-installer-assets.mjs +409 -389
  253. package/scripts/build-operator-evidence-starter.mjs +59 -1
  254. package/scripts/build-production-backend-env-kit.mjs +2 -0
  255. package/scripts/build-production-unblocker.mjs +4 -1
  256. package/scripts/build-proof-network-packet.mjs +213 -213
  257. package/scripts/check.mjs +25 -4
  258. package/scripts/collect-hosted-backend-live-evidence.mjs +49 -12
  259. package/scripts/install-enigma-local.mjs +18 -5
  260. package/scripts/release-audit.mjs +74 -115
  261. package/scripts/release-provenance.mjs +12 -2
  262. package/scripts/run-backend-readiness-smoke.mjs +112 -10
  263. package/scripts/run-standard-memory-benchmarks.mjs +1354 -1352
  264. package/scripts/scan-secrets.mjs +178 -0
  265. package/scripts/simulate-production-env.mjs +71 -10
  266. package/scripts/validate-hosted-backend-live.mjs +112 -1
  267. package/specs/antibody-pack-v1.schema.json +95 -0
  268. package/specs/antigen-envelope-v1.schema.json +81 -0
  269. package/specs/boundary-manifest-v1.schema.json +35 -35
  270. package/specs/capsule-v1.schema.json +55 -55
  271. package/specs/claim-boundary-manifest-v1.schema.json +22 -22
  272. package/specs/claim-ledger-v1.schema.json +291 -0
  273. package/specs/context-passport-v1.schema.json +59 -0
  274. package/specs/deletion-tombstone-v1.schema.json +26 -26
  275. package/specs/evidence-packet-v1.schema.json +177 -0
  276. package/specs/hosted-backend-live-evidence-v1.schema.json +72 -3
  277. package/specs/immune-scan-report-v1.schema.json +112 -0
  278. package/specs/lifecycle-receipt-log-v1.schema.json +67 -0
  279. package/specs/memory-atom-v1.schema.json +59 -0
  280. package/specs/memory-event-v1.schema.json +42 -42
  281. package/specs/passport-v1.schema.json +50 -50
  282. package/specs/proof-of-non-use-v1.schema.json +65 -0
  283. package/specs/quarantine-record-v1.schema.json +126 -0
  284. package/specs/receipt-v1.schema.json +61 -61
  285. package/specs/state-checkpoint-v1.schema.json +37 -37
  286. package/specs/trust-bundle-v1.schema.json +56 -56
  287. package/specs/trust-card-v1.schema.json +119 -0
  288. package/docs/proof-network-launch-plan.md +0 -421
  289. package/packages/metering/PACKAGE_CONTRACT.md +0 -20
  290. package/scripts/build-ai-orchestration-plan.mjs +0 -248
@@ -15,10 +15,13 @@ export const HOSTED_BACKEND_LIVE_COLLECTION_SCHEMA = 'enigma.hosted_backend_live
15
15
 
16
16
  const REQUIRED_PROBES = Object.freeze(['relay_livez', 'relay_readyz', 'gateway_livez', 'gateway_readyz']);
17
17
  const CLAIM_BOUNDARY = Object.freeze([
18
- 'This collector performs public HTTPS health probes and assembles evidence; it does not deploy infrastructure, mutate DNS, create credentials, or approve operator acceptance.',
19
- 'Collected evidence is accepted only if validate-hosted-backend-live also accepts it.',
20
- 'Probe response bodies must be public-safe readiness JSON and must not contain tokens, prompts, transcripts, provider responses, raw memory, or personal contact data.',
18
+ 'This collector performs public HTTPS health probes and assembles separately supplied runtime-capability and authenticated data-plane proof; it does not deploy infrastructure, mutate DNS, create credentials, or approve operator acceptance.',
19
+ 'Health-only collection remains blocked: validate-hosted-backend-live requires operational runtime markers and successful authenticated relay/gateway data-plane evidence.',
20
+ 'Local-simulation loopback collection is marked local_simulation:true and hosted_backend_live:false, so it cannot satisfy hosted production evidence.',
21
+ 'Probe response bodies and supplied evidence must be public-safe and must not contain tokens, prompts, transcripts, provider responses, raw memory, or personal contact data.',
21
22
  ]);
23
+ const DEFAULT_PROBE_TIMEOUT_MS = 10_000;
24
+
22
25
  const SAFE_PROBE_FIELD_NAMES = new Set(['evidence_refs', 'kms_or_secret_custody']);
23
26
 
24
27
  function sha256(text) {
@@ -36,6 +39,15 @@ function nonEmptyString(value) {
36
39
  function readFlag(flags, key, fallback = null) {
37
40
  return flags.has(key) ? flags.get(key) : fallback;
38
41
  }
42
+ function bounded(promise, timeoutMs, label) {
43
+ let timer;
44
+ const timeout = new Promise((_, reject) => {
45
+ timer = setTimeout(() => reject(new Error(`${label} timed out after ${timeoutMs}ms`)), timeoutMs);
46
+ timer.unref?.();
47
+ });
48
+ return Promise.race([promise, timeout]).finally(() => clearTimeout(timer));
49
+ }
50
+
39
51
 
40
52
  function parsePublicHealthUrl(value, label) {
41
53
  if (!nonEmptyString(value)) throw new Error(`${label} is required`);
@@ -88,6 +100,7 @@ export function localSimulationLoopbackFetch(url, init = {}) {
88
100
  if (parsed.protocol !== 'https:' || (host !== 'sim.enigmamemory.com' && !host.endsWith('.sim.enigmamemory.com'))) {
89
101
  throw new Error('--local-simulation-loopback only supports https://*.sim.enigmamemory.com simulation probes');
90
102
  }
103
+ const timeoutMs = Number.isSafeInteger(init.timeoutMs) && init.timeoutMs > 0 ? init.timeoutMs : DEFAULT_PROBE_TIMEOUT_MS;
91
104
  const request = {
92
105
  hostname: '127.0.0.1',
93
106
  port: parsed.port || 443,
@@ -102,6 +115,7 @@ export function localSimulationLoopbackFetch(url, init = {}) {
102
115
  const chunks = [];
103
116
  res.on('data', (chunk) => chunks.push(chunk));
104
117
  res.on('end', () => {
118
+ clearTimeout(timer);
105
119
  const text = Buffer.concat(chunks).toString('utf8');
106
120
  resolve({
107
121
  ok: res.statusCode >= 200 && res.statusCode < 300,
@@ -113,24 +127,33 @@ export function localSimulationLoopbackFetch(url, init = {}) {
113
127
  });
114
128
  });
115
129
  });
116
- req.on('error', reject);
130
+ const timer = setTimeout(() => req.destroy(new Error(`simulation probe timed out after ${timeoutMs}ms`)), timeoutMs);
131
+ timer.unref?.();
132
+ req.on('error', (error) => {
133
+ clearTimeout(timer);
134
+ reject(error);
135
+ });
117
136
  req.end();
118
137
  });
119
138
  }
120
139
 
121
- async function fetchProbe(url, { fetchImpl = globalThis.fetch, observedAt }) {
140
+ async function fetchProbe(url, { fetchImpl = globalThis.fetch, observedAt, timeoutMs = DEFAULT_PROBE_TIMEOUT_MS }) {
122
141
  if (typeof fetchImpl !== 'function') throw new Error('global fetch is not available in this Node runtime');
123
- const response = await fetchImpl(url, {
142
+ const response = await bounded(fetchImpl(url, {
124
143
  method: 'GET',
125
144
  headers: { Accept: 'application/json' },
126
145
  redirect: 'manual',
127
- });
146
+ signal: AbortSignal.timeout(timeoutMs),
147
+ timeoutMs,
148
+ }), timeoutMs, `hosted backend probe ${url}`);
128
149
  const statusCode = Number(response.status ?? 0);
129
150
  const responseUrl = typeof response.url === 'string' && response.url.length > 0 ? response.url : url;
130
151
  if (response.redirected === true || responseUrl !== url || (statusCode >= 300 && statusCode <= 399)) {
131
152
  throw new Error(`hosted backend probe ${url} must not redirect`);
132
153
  }
133
- const text = typeof response.text === 'function' ? await response.text() : '';
154
+ const text = typeof response.text === 'function'
155
+ ? await bounded(response.text(), timeoutMs, `hosted backend probe body ${url}`)
156
+ : '';
134
157
  let body = null;
135
158
  try {
136
159
  body = text.trim().length === 0 ? {} : JSON.parse(text);
@@ -158,7 +181,12 @@ function buildProbeUrls(options) {
158
181
  }
159
182
 
160
183
  function buildEnvironment(options) {
161
- if (isPlainObject(options.environment)) return options.environment;
184
+ if (isPlainObject(options.environment)) {
185
+ return {
186
+ ...options.environment,
187
+ local_simulation: options.localSimulation === true || options.environment.local_simulation === true,
188
+ };
189
+ }
162
190
  return {
163
191
  environment_id: options.environmentId,
164
192
  domain: options.domain,
@@ -166,6 +194,7 @@ function buildEnvironment(options) {
166
194
  region: options.region,
167
195
  owner: options.owner,
168
196
  status: options.environmentStatus ?? 'observed',
197
+ local_simulation: options.localSimulation === true,
169
198
  };
170
199
  }
171
200
 
@@ -187,16 +216,19 @@ function validateRefsShape(refs) {
187
216
  export async function collectHostedBackendLiveEvidence(options = {}) {
188
217
  const observedAt = options.observed_at ?? options.observedAt ?? new Date().toISOString();
189
218
  const probeUrls = buildProbeUrls(options);
190
- const probeEntries = await Promise.all(REQUIRED_PROBES.map(async (key) => [key, await fetchProbe(probeUrls[key], { fetchImpl: options.fetchImpl, observedAt })]));
219
+ const timeoutMs = options.probeTimeoutMs ?? DEFAULT_PROBE_TIMEOUT_MS;
220
+ const probeEntries = await Promise.all(REQUIRED_PROBES.map(async (key) => [key, await fetchProbe(probeUrls[key], { fetchImpl: options.fetchImpl, observedAt, timeoutMs })]));
191
221
  const evidence = {
192
222
  schema: HOSTED_BACKEND_LIVE_EVIDENCE_SCHEMA,
193
223
  observed_at: observedAt,
194
224
  environment: buildEnvironment(options),
195
225
  refs: validateRefsShape(options.refs),
196
226
  probes: Object.fromEntries(probeEntries),
227
+ runtime_capability: isPlainObject(options.runtime_capability ?? options.runtimeCapability) ? (options.runtime_capability ?? options.runtimeCapability) : null,
228
+ authenticated_data_plane: isPlainObject(options.authenticated_data_plane ?? options.authenticatedDataPlane) ? (options.authenticated_data_plane ?? options.authenticatedDataPlane) : null,
197
229
  operator_acceptance: buildOperatorAcceptance(options),
198
230
  claim_boundary: {
199
- hosted_backend_live: true,
231
+ hosted_backend_live: options.localSimulation !== true,
200
232
  public_site_live: false,
201
233
  cloudflare_credentials_claim: false,
202
234
  token_roi_claim: false,
@@ -239,7 +271,7 @@ function parseArgs(argv) {
239
271
  }
240
272
 
241
273
  function usage() {
242
- return `Usage: node scripts/collect-hosted-backend-live-evidence.mjs --relay-url <https-base> --gateway-url <https-base> --refs-json <refs.json> --domain <domain> --environment-id <id> --cloud-provider <provider> --region <region> --owner <owner> --operator-decision go --operator-packet-ref <ref> --operator-approved-at <iso> --operator-approved-by <name> [--out <collection.json>] [--evidence-out <evidence.json>] [--local-simulation-loopback]\n\nCollects public HTTPS /livez and /readyz evidence for relay and gateway, then validates it with validate-hosted-backend-live. It never sends credentials and does not deploy infrastructure. The --local-simulation-loopback flag is restricted to https://*.sim.enigmamemory.com local simulation probes with self-signed TLS and must not be used as production evidence.\n`;
274
+ return `Usage: node scripts/collect-hosted-backend-live-evidence.mjs --relay-url <https-base> --gateway-url <https-base> --refs-json <refs.json> --runtime-capability-json <runtime-capability.json> --authenticated-data-plane-json <authenticated-data-plane.json> --domain <domain> --environment-id <id> --cloud-provider <provider> --region <region> --owner <owner> --operator-decision go --operator-packet-ref <ref> --operator-approved-at <iso> --operator-approved-by <name> [--out <collection.json>] [--evidence-out <evidence.json>] [--local-simulation-loopback]\n\nCollects public HTTPS /livez and /readyz evidence and assembles separate public-safe runtime/authenticated data-plane evidence for relay and gateway, then validates it with validate-hosted-backend-live. It never sends credentials and does not deploy infrastructure. Health-only evidence is always blocked. The --local-simulation-loopback flag is restricted to https://*.sim.enigmamemory.com local simulation probes with self-signed TLS.\n`;
243
275
  }
244
276
 
245
277
  async function runCli(argv = process.argv.slice(2), { fetchImpl = globalThis.fetch } = {}) {
@@ -253,6 +285,8 @@ async function runCli(argv = process.argv.slice(2), { fetchImpl = globalThis.fet
253
285
  const refs = await readJsonFile(refsPath);
254
286
  const environment = await maybeReadJsonFile(readFlag(flags, 'environment-json'));
255
287
  const operatorAcceptance = await maybeReadJsonFile(readFlag(flags, 'operator-acceptance-json'));
288
+ const runtimeCapability = await maybeReadJsonFile(readFlag(flags, 'runtime-capability-json'));
289
+ const authenticatedDataPlane = await maybeReadJsonFile(readFlag(flags, 'authenticated-data-plane-json'));
256
290
  const selectedFetchImpl = flags.get('local-simulation-loopback') === true ? localSimulationLoopbackFetch : fetchImpl;
257
291
  const collection = await collectHostedBackendLiveEvidence({
258
292
  relayBaseUrl: readFlag(flags, 'relay-url'),
@@ -274,7 +308,10 @@ async function runCli(argv = process.argv.slice(2), { fetchImpl = globalThis.fet
274
308
  operatorPacketRef: readFlag(flags, 'operator-packet-ref'),
275
309
  operatorApprovedAt: readFlag(flags, 'operator-approved-at'),
276
310
  operatorApprovedBy: readFlag(flags, 'operator-approved-by'),
311
+ runtimeCapability,
312
+ authenticatedDataPlane,
277
313
  observed_at: readFlag(flags, 'observed-at') ?? new Date().toISOString(),
314
+ localSimulation: flags.get('local-simulation-loopback') === true,
278
315
  fetchImpl: selectedFetchImpl,
279
316
  });
280
317
  const collectionJson = `${JSON.stringify(collection, null, 2)}\n`;
@@ -8,6 +8,7 @@ import { fileURLToPath } from 'node:url';
8
8
  export const INSTALLER_SCHEMA = 'enigma.local_installer.v1';
9
9
  export const REQUIRED_NODE_MAJOR = 24;
10
10
  export const DEFAULT_BUNDLE_PATH = '.enigma/bundle.json';
11
+ export const DEFAULT_PASSPHRASE_FILE = '.enigma/passphrase';
11
12
 
12
13
  const execFileAsync = promisify(execFile);
13
14
  const SCRIPT_PATH = fileURLToPath(import.meta.url);
@@ -21,7 +22,7 @@ function readRequiredValue(argv, index, flag) {
21
22
  }
22
23
 
23
24
  export function usage() {
24
- return `Usage: node scripts/install-enigma-local.mjs [--dry-run|--execute] [--init-vault] [--bundle <path>]\n\nDry-run is the default. Execute mode runs npm install -g . from the local checkout.\nNo network download command is generated, and vault initialization runs only when --init-vault is present.\n`;
25
+ return `Usage: node scripts/install-enigma-local.mjs [--dry-run|--execute] [--init-vault] [--bundle <path>] [--passphrase-file <path>]\n\nDry-run is the default. Execute mode runs npm install -g . from the local checkout.\nVault initialization is encrypted and runs only when --init-vault is present; create the passphrase file through an approved secret manager or secure editor before execute mode.\nNo network download command is generated.\n`;
25
26
  }
26
27
 
27
28
  export function parseInstallerArgs(argv = process.argv.slice(2)) {
@@ -30,6 +31,7 @@ export function parseInstallerArgs(argv = process.argv.slice(2)) {
30
31
  execute: false,
31
32
  initVault: false,
32
33
  bundlePath: DEFAULT_BUNDLE_PATH,
34
+ passphraseFile: DEFAULT_PASSPHRASE_FILE,
33
35
  packageDir: DEFAULT_PACKAGE_DIR,
34
36
  subject: 'local-user',
35
37
  displayName: 'Local user',
@@ -56,6 +58,9 @@ export function parseInstallerArgs(argv = process.argv.slice(2)) {
56
58
  } else if (arg === '--bundle') {
57
59
  options.bundlePath = readRequiredValue(argv, index, arg);
58
60
  index += 1;
61
+ } else if (arg === '--passphrase-file') {
62
+ options.passphraseFile = readRequiredValue(argv, index, arg);
63
+ index += 1;
59
64
  } else if (arg === '--package-dir') {
60
65
  options.packageDir = readRequiredValue(argv, index, arg);
61
66
  index += 1;
@@ -114,8 +119,10 @@ export function validateCommandSpec(spec) {
114
119
 
115
120
  if (command === 'enigma' || command === 'enigma.cmd') {
116
121
  const bundleIndex = args.indexOf('--bundle');
117
- if (args[0] !== 'init' || bundleIndex === -1 || bundleIndex + 1 >= args.length) {
118
- throw new Error('Installer Enigma command must initialize a bundle with --bundle.');
122
+ const passphraseIndex = args.indexOf('--passphrase-file');
123
+ if (args[0] !== 'init' || bundleIndex === -1 || bundleIndex + 1 >= args.length
124
+ || passphraseIndex === -1 || passphraseIndex + 1 >= args.length) {
125
+ throw new Error('Installer Enigma command must initialize a bundle with --bundle and --passphrase-file.');
119
126
  }
120
127
  return true;
121
128
  }
@@ -125,7 +132,7 @@ export function validateCommandSpec(spec) {
125
132
 
126
133
  function publicCommand(command) {
127
134
  if (command.step === 'install_package') return { command: 'npm', args: ['install', '-g', '.'] };
128
- return { command: 'enigma', args: ['init', '--bundle', '<bundle-path>', '--subject', '<subject>', '--display-name', '<display-name>'] };
135
+ return { command: 'enigma', args: ['init', '--bundle', '<bundle-path>', '--passphrase-file', '<passphrase-file>', '--subject', '<subject>', '--display-name', '<display-name>'] };
129
136
  }
130
137
 
131
138
  export function buildInstallerPlan(options = {}, runtime = {}) {
@@ -137,6 +144,9 @@ export function buildInstallerPlan(options = {}, runtime = {}) {
137
144
  const requestedBundlePath = String(options.bundlePath ?? DEFAULT_BUNDLE_PATH);
138
145
  rejectUnsafeArg(requestedBundlePath, 'Bundle path');
139
146
  const bundlePath = isAbsolute(requestedBundlePath) ? resolvePath(requestedBundlePath) : resolvePath(cwd, requestedBundlePath);
147
+ const requestedPassphraseFile = String(options.passphraseFile ?? DEFAULT_PASSPHRASE_FILE);
148
+ rejectUnsafeArg(requestedPassphraseFile, 'Passphrase file');
149
+ const passphraseFile = isAbsolute(requestedPassphraseFile) ? resolvePath(requestedPassphraseFile) : resolvePath(cwd, requestedPassphraseFile);
140
150
 
141
151
  const commands = [
142
152
  {
@@ -152,7 +162,7 @@ export function buildInstallerPlan(options = {}, runtime = {}) {
152
162
  commands.push({
153
163
  step: 'initialize_vault',
154
164
  command: commandForPlatform('enigma', platform),
155
- args: ['init', '--bundle', bundlePath, '--subject', String(options.subject ?? 'local-user'), '--display-name', String(options.displayName ?? 'Local user')],
165
+ args: ['init', '--bundle', bundlePath, '--passphrase-file', passphraseFile, '--subject', String(options.subject ?? 'local-user'), '--display-name', String(options.displayName ?? 'Local user')],
156
166
  cwd: packageDir,
157
167
  mutates_local_filesystem: true,
158
168
  });
@@ -166,6 +176,7 @@ export function buildInstallerPlan(options = {}, runtime = {}) {
166
176
  packageDir,
167
177
  bundlePath,
168
178
  bundlePathKind: requestedBundlePath === DEFAULT_BUNDLE_PATH ? 'default' : (isAbsolute(requestedBundlePath) ? 'absolute' : 'relative'),
179
+ passphraseFile,
169
180
  initVault: options.initVault === true,
170
181
  commands,
171
182
  };
@@ -205,6 +216,8 @@ function publicOutput(plan, node, commandResults = []) {
205
216
  path_kind: plan.bundlePathKind,
206
217
  initialize_requested: plan.initVault,
207
218
  initialized: plan.execute && plan.initVault && resultByStep.get('initialize_vault')?.ok === true,
219
+ encrypted: plan.initVault,
220
+ credential_source: plan.initVault ? 'passphrase_file' : null,
208
221
  },
209
222
  commands,
210
223
  preview: {
@@ -58,6 +58,14 @@ const SHA256_PREFIXED_DIGEST = /^sha256:[0-9a-f]{64}$/;
58
58
  const PRIVATE_PUBLIC_SITE_COLLATERAL_PATH = /(?:^|\/)(?:private|internal|launch-code|investor|token(?:omics)?|sales|marketing|funnel|community|social|adoption|objections|faq|whitepaper)[^/]*\.(?:md|html|json)$/i;
59
59
  const LOCAL_BUNDLE_LOG_OR_SECRET_PATH = /(?:^|\/)(?:\.env(?:\.|$)|env\.local$|secrets?|credentials?|tokens?|api[-_]?keys?|private[-_]?keys?|\.enigma|enigma[-_]?bundle|vault[-_]?bundle|bundle\.json|logs?|npm-debug\.log|yarn-error\.log|pnpm-debug\.log)(?:\/|$|[._-])/i;
60
60
  const PRIVATE_REVIEW_PACKET_COLLATERAL_PATH = /(?:^|\/)(?:\d+[_-])?(?:private|internal|launch-code|executive|investor|partner|sales|marketing|funnel|community|social|adoption|objections|faq|pitch|demo[-_]?scripts?|content[-_]?calendar|brand[-_]?messaging)[^/]*\.(?:html|json|md|txt)$/i;
61
+ const PINNED_MODEL_ARTIFACT_PATHS = new Set([
62
+ 'packages/rag/models/Xenova/all-MiniLM-L6-v2/config.json',
63
+ 'packages/rag/models/Xenova/all-MiniLM-L6-v2/tokenizer.json',
64
+ 'packages/rag/models/Xenova/all-MiniLM-L6-v2/tokenizer_config.json',
65
+ 'packages/rag/models/Xenova/all-MiniLM-L6-v2/onnx/model_quantized.onnx',
66
+ 'packages/rag/models/Xenova/all-MiniLM-L6-v2/sha256-manifest.json',
67
+ 'packages/rag/models/Xenova/all-MiniLM-L6-v2/THIRD_PARTY_LICENSES.txt',
68
+ ]);
61
69
  const RAW_MEMORY_EXAMPLE_FIELD = /"(?:raw_memory|plaintext|prompt|response|memory)"\s*:\s*"[^"]+"/i;
62
70
  const NATIVE_HOST_MANIFEST_SMOKES = Object.freeze([
63
71
  {
@@ -123,8 +131,6 @@ const WHITEPAPER_CLAIMS_VALIDATOR_SCRIPT = resolve(PROJECT_ROOT, 'scripts', 'val
123
131
  const PRODUCTION_DEPENDENCY_REPORT_SCRIPT = resolve(PROJECT_ROOT, 'scripts', 'build-production-dependency-report.mjs');
124
132
  const PRODUCTION_WORKPLAN_SCRIPT = resolve(PROJECT_ROOT, 'scripts', 'build-production-workplan.mjs');
125
133
  const PRODUCTION_STATUS_BOARD_SCRIPT = resolve(PROJECT_ROOT, 'scripts', 'build-production-status-board.mjs');
126
- const AI_ORCHESTRATION_PLAN_SCHEMA = 'enigma.ai_orchestration_plan.v1';
127
- const AI_ORCHESTRATION_PLAN_SCRIPT = resolve(PROJECT_ROOT, 'scripts', 'build-ai-orchestration-plan.mjs');
128
134
  const CLOUDFLARE_WORKER_INSPECT_VALIDATOR_SCRIPT = resolve(PROJECT_ROOT, 'scripts', 'validate-cloudflare-worker-inspect.mjs');
129
135
  const CLOUDFLARE_CREDENTIALS_VALIDATOR_SCRIPT = resolve(PROJECT_ROOT, 'scripts', 'validate-cloudflare-credentials.mjs');
130
136
  const CLOUDFLARE_WORKER_INSPECT_CURRENT = resolve(PROJECT_ROOT, '.enigma', 'worker-inspect-current.json');
@@ -337,8 +343,9 @@ function isSha256PrefixedDigest(value) {
337
343
  function isSafeReleaseProvenancePath(value) {
338
344
  return typeof value === 'string'
339
345
  && value.length > 0
340
- && !PRIVATE_PUBLIC_SITE_COLLATERAL_PATH.test(value)
341
- && !LOCAL_BUNDLE_LOG_OR_SECRET_PATH.test(value);
346
+ && (PINNED_MODEL_ARTIFACT_PATHS.has(value)
347
+ || (!PRIVATE_PUBLIC_SITE_COLLATERAL_PATH.test(value)
348
+ && !LOCAL_BUNDLE_LOG_OR_SECRET_PATH.test(value)));
342
349
  }
343
350
 
344
351
  function isSafeReviewPacketPath(value) {
@@ -574,6 +581,7 @@ async function runCommandGate(name, command, args, options = {}) {
574
581
  }
575
582
 
576
583
  async function runJsonCommandStatus(command, args, expectedStatus, validate) {
584
+ const allowedStatuses = Array.isArray(expectedStatus) ? expectedStatus : [expectedStatus];
577
585
  const started = Date.now();
578
586
  const result = {
579
587
  command: commandLabel(command, args),
@@ -608,8 +616,8 @@ async function runJsonCommandStatus(command, args, expectedStatus, validate) {
608
616
  result.stderr_bytes = Buffer.byteLength(stderr);
609
617
  result.stdout_bytes = Buffer.byteLength(stdout);
610
618
  try {
611
- if (result.status !== expectedStatus) {
612
- throw new Error(`Expected status ${expectedStatus}, got ${result.status}`);
619
+ if (!allowedStatuses.includes(result.status)) {
620
+ throw new Error(`Expected status ${allowedStatuses.join(' or ')}, got ${result.status}`);
613
621
  }
614
622
  const parsed = parseJson(stdout);
615
623
  result.evidence = validate(parsed);
@@ -617,7 +625,7 @@ async function runJsonCommandStatus(command, args, expectedStatus, validate) {
617
625
  delete result.error;
618
626
  } catch (error) {
619
627
  result.error ??= {
620
- code: result.status === expectedStatus ? 'OUTPUT_VALIDATION_FAILED' : 'COMMAND_FAILED',
628
+ code: allowedStatuses.includes(result.status) ? 'OUTPUT_VALIDATION_FAILED' : 'COMMAND_FAILED',
621
629
  message: error.message,
622
630
  };
623
631
  } finally {
@@ -640,9 +648,11 @@ export async function runDirectBinSmokes() {
640
648
  return { usage: json.usage, command_count: json.commands.length, has_claim_boundaries: typeof json.claim_boundaries === 'string' };
641
649
  }));
642
650
 
643
- checks.push(await runJsonCommand(node, ['apps/cli/bin/enigma.mjs', 'doctor'], (json) => {
644
- requireJsonField(json, ['ok'], (value) => value === true, 'Doctor did not report ok: true.');
645
- return { package_bins_ok: json.package_bins?.ok === true, schema_count: json.schema_count };
651
+ checks.push(await runJsonCommandStatus(node, ['apps/cli/bin/enigma.mjs', 'doctor'], [0, 1], (json) => {
652
+ requireJsonField(json, ['package_bins', 'ok'], (value) => value === true, 'Doctor did not report package_bins ok.');
653
+ requireJsonField(json, ['node', 'ok'], (value) => value === true, 'Doctor did not report node ok.');
654
+ requireJsonField(json, ['schema_count'], (value) => typeof value === 'number' && value > 0, 'Doctor did not report schemas.');
655
+ return { package_bins_ok: json.package_bins?.ok === true, schema_count: json.schema_count, doctor_ok: json.ok === true };
646
656
  }));
647
657
 
648
658
  checks.push(await runJsonCommand(node, [
@@ -1721,6 +1731,7 @@ function hostedBackendLiveFixture() {
1721
1731
  region: 'us-central',
1722
1732
  owner: 'operator',
1723
1733
  status: 'verified',
1734
+ local_simulation: false,
1724
1735
  },
1725
1736
  refs,
1726
1737
  probes: {
@@ -1729,6 +1740,57 @@ function hostedBackendLiveFixture() {
1729
1740
  gateway_livez: { url: 'https://gateway.enigmamemory.com/livez', status_code: 200, body: { ok: true, service: 'enigma-gateway' }, observed_at: '2026-06-24T00:00:00.000Z', response_hash: responseHash },
1730
1741
  gateway_readyz: { url: 'https://gateway.enigmamemory.com/readyz', status_code: 200, body: readyBody('enigma-gateway'), observed_at: '2026-06-24T00:00:00.000Z', response_hash: responseHash },
1731
1742
  },
1743
+ runtime_capability: {
1744
+ schema: 'enigma.hosted_backend_runtime_capability.v1',
1745
+ marker: 'enigma.private_data_plane.runtime.v1',
1746
+ observed_at: '2026-06-24T00:00:00.000Z',
1747
+ services: {
1748
+ relay: {
1749
+ service: 'enigma-relay',
1750
+ private_data_plane_operational: true,
1751
+ authentication_enforced: true,
1752
+ bootstrap_worker: false,
1753
+ evidence_ref: 'runtime://enigma-relay/release-audit-fixture',
1754
+ },
1755
+ gateway: {
1756
+ service: 'enigma-gateway',
1757
+ private_data_plane_operational: true,
1758
+ authentication_enforced: true,
1759
+ bootstrap_worker: false,
1760
+ evidence_ref: 'runtime://enigma-gateway/release-audit-fixture',
1761
+ },
1762
+ },
1763
+ },
1764
+ authenticated_data_plane: {
1765
+ schema: 'enigma.hosted_backend_authenticated_data_plane.v1',
1766
+ observed_at: '2026-06-24T00:00:00.000Z',
1767
+ proofs: {
1768
+ relay: {
1769
+ service: 'enigma-relay',
1770
+ url: 'https://relay.enigmamemory.com/pairing/complete',
1771
+ method: 'POST',
1772
+ status_code: 200,
1773
+ authenticated: true,
1774
+ authorization_result: 'allowed',
1775
+ observed_at: '2026-06-24T00:00:00.000Z',
1776
+ request_hash: responseHash,
1777
+ response_hash: responseHash,
1778
+ evidence_ref: 'data-plane://enigma-relay/release-audit-fixture',
1779
+ },
1780
+ gateway: {
1781
+ service: 'enigma-gateway',
1782
+ url: 'https://gateway.enigmamemory.com/gateway/decision',
1783
+ method: 'POST',
1784
+ status_code: 200,
1785
+ authenticated: true,
1786
+ authorization_result: 'allowed',
1787
+ observed_at: '2026-06-24T00:00:00.000Z',
1788
+ request_hash: responseHash,
1789
+ response_hash: responseHash,
1790
+ evidence_ref: 'data-plane://enigma-gateway/release-audit-fixture',
1791
+ },
1792
+ },
1793
+ },
1732
1794
  operator_acceptance: {
1733
1795
  decision: 'go',
1734
1796
  packet_ref: 'operator-acceptance-release-audit#fixture',
@@ -1794,6 +1856,8 @@ export async function runHostedBackendLiveValidatorGate() {
1794
1856
  refs_missing: parsed.checked?.refs_missing ?? null,
1795
1857
  probes_covered: parsed.checked?.probes_covered ?? null,
1796
1858
  operator_decision: parsed.checked?.operator_decision ?? null,
1859
+ runtime_services_covered: parsed.checked?.runtime_services_covered ?? null,
1860
+ authenticated_data_plane_proofs_covered: parsed.checked?.authenticated_data_plane_proofs_covered ?? null,
1797
1861
  };
1798
1862
  } catch (error) {
1799
1863
  gate.ok = false;
@@ -2824,110 +2888,6 @@ export async function runProductionStatusBoardGate() {
2824
2888
  return gate;
2825
2889
  }
2826
2890
 
2827
- export async function runAiOrchestrationPlanGate() {
2828
- const started = Date.now();
2829
- const tempDir = await mkdtemp(join(tmpdir(), 'enigma-ai-orchestration-audit-'));
2830
- const gate = {
2831
- name: 'ai-orchestration-plan',
2832
- required: false,
2833
- command: commandLabel(process.execPath, ['scripts/build-ai-orchestration-plan.mjs', '--status-board', '<production-status-board.json>']),
2834
- ok: true,
2835
- status: null,
2836
- signal: null,
2837
- duration_ms: 0,
2838
- evidence: {},
2839
- };
2840
- try {
2841
- if (!(await pathExists(PRODUCTION_WORKPLAN_SCRIPT)) || !(await pathExists(PRODUCTION_STATUS_BOARD_SCRIPT)) || !(await pathExists(AI_ORCHESTRATION_PLAN_SCRIPT))) {
2842
- gate.evidence = {
2843
- skipped: true,
2844
- reason: 'AI orchestration plan builder or its production fixture builders are absent in this local checkout.',
2845
- };
2846
- return gate;
2847
- }
2848
- const files = await writeProductionStatusBoardFixtureFiles(tempDir);
2849
- const statusBoard = parseJson(await readFile(files.statusBoard, 'utf8'));
2850
- if (statusBoard.schema !== 'enigma.production_status_board.v1') throw new Error('AI orchestration fixture status board emitted wrong schema.');
2851
- if (statusBoard.fresh_input_evidence !== true || statusBoard.input_freshness?.stale !== false) throw new Error('AI orchestration fixture status board must provide fresh input evidence.');
2852
- if (statusBoard.launch_ready === true) throw new Error('AI orchestration fixture status board must remain blocked.');
2853
- const { stdout, stderr, status } = await execFile(process.execPath, [
2854
- 'scripts/build-ai-orchestration-plan.mjs',
2855
- '--status-board',
2856
- files.statusBoard,
2857
- ], {
2858
- cwd: PROJECT_ROOT,
2859
- env: localOnlyEnv(),
2860
- timeout: COMMAND_TIMEOUT_MS,
2861
- maxBuffer: MAX_OUTPUT_BYTES,
2862
- windowsHide: true,
2863
- }).then((result) => ({ ...result, status: 0 })).catch((error) => {
2864
- if (Number.isInteger(error.code) && error.code === 1 && typeof error.stdout === 'string') return { stdout: error.stdout, stderr: error.stderr ?? '', status: 1 };
2865
- throw error;
2866
- });
2867
- gate.status = status;
2868
- gate.stderr_bytes = Buffer.byteLength(stderr);
2869
- gate.stdout_bytes = Buffer.byteLength(stdout);
2870
- if (status !== 1) throw new Error('AI orchestration plan blocked fixture must exit with status 1.');
2871
- const output = `${stdout}\n${stderr}`;
2872
- const tempPathNeedles = [tempDir, tempDir.replaceAll('\\', '\\\\'), tempDir.replaceAll('\\', '/')];
2873
- if (tempPathNeedles.some((needle) => output.toLowerCase().includes(needle.toLowerCase()))) throw new Error('AI orchestration plan output leaked a temporary fixture path.');
2874
- if (SECRET_LOOKING_OUTPUT.test(output)) throw new Error('AI orchestration plan output appears to contain a secret.');
2875
- if (output.includes(RAW_MEMORY_SENTINEL)) throw new Error('AI orchestration plan output leaked raw memory sentinel text.');
2876
- const parsed = parseJson(stdout);
2877
- if (parsed.schema !== AI_ORCHESTRATION_PLAN_SCHEMA) throw new Error('AI orchestration plan emitted wrong schema.');
2878
- if (parsed.status !== 'blocked' || parsed.launch_ready !== false) throw new Error('AI orchestration plan must remain blocked while status board launch_ready is false.');
2879
- if (parsed.source_status_fresh_input_evidence !== true) throw new Error('AI orchestration plan must preserve fresh source status evidence.');
2880
- if (parsed.source_status_board_generated_at !== statusBoard.generated_at) throw new Error('AI orchestration plan source timestamp must match the fixture status board.');
2881
- if (!Array.isArray(parsed.lanes) || parsed.lanes.length !== parsed.role_lane_count || parsed.role_lane_count < 5) throw new Error('AI orchestration plan role_lane_count does not match lanes.');
2882
- if (!Array.isArray(parsed.waves) || parsed.waves.length !== parsed.wave_count || parsed.wave_count !== 4) throw new Error('AI orchestration plan wave_count does not match waves.');
2883
- const laneIds = new Set(parsed.lanes.map((lane) => lane?.id));
2884
- if (!laneIds.has('kimi_coding') || !laneIds.has('gpt55_architecture') || !laneIds.has('gpt55_review')) throw new Error('AI orchestration plan must include Kimi and GPT lane names.');
2885
- const controlText = Array.isArray(parsed.non_delegable_controls) ? parsed.non_delegable_controls.join('\n') : '';
2886
- if (!/Cloudflare token values/i.test(controlText) || !/human-controlled/i.test(controlText) || !/No AI lane may mark the goal complete/i.test(controlText)) throw new Error('AI orchestration plan must preserve non-delegable human control boundaries.');
2887
- const claimBoundary = requireJsonField(
2888
- parsed,
2889
- ['claim_boundary'],
2890
- (value) => Array.isArray(value) && value.length >= 3 && value.every((item) => typeof item === 'string'),
2891
- 'AI orchestration plan must emit claim_boundary strings.',
2892
- );
2893
- const claimText = claimBoundary.join('\n');
2894
- if (!/does not invoke external AI systems/i.test(claimText) || !/not proof that an external model/i.test(claimText) || !/Launch readiness remains false/i.test(claimText)) throw new Error('AI orchestration plan claim boundary must prevent overclaiming launch readiness or model execution.');
2895
- gate.evidence = {
2896
- schema: parsed.schema,
2897
- status: parsed.status,
2898
- launch_ready: parsed.launch_ready === true,
2899
- source_status_fresh_input_evidence: parsed.source_status_fresh_input_evidence === true,
2900
- source_status_board_generated_at: parsed.source_status_board_generated_at,
2901
- role_lane_count: parsed.role_lane_count,
2902
- wave_count: parsed.wave_count,
2903
- kimi_lane_present: laneIds.has('kimi_coding'),
2904
- gpt_architecture_lane_present: laneIds.has('gpt55_architecture'),
2905
- gpt_review_lane_present: laneIds.has('gpt55_review'),
2906
- non_delegable_control_count: Array.isArray(parsed.non_delegable_controls) ? parsed.non_delegable_controls.length : null,
2907
- claim_boundary_count: claimBoundary.length,
2908
- temp_path_leaked: false,
2909
- };
2910
- } catch (error) {
2911
- gate.ok = false;
2912
- gate.status = Number.isInteger(error.code) ? error.code : (gate.status ?? 1);
2913
- gate.signal = error.signal ?? null;
2914
- gate.stderr_bytes = Buffer.byteLength(error.stderr ?? '');
2915
- gate.stdout_bytes = Buffer.byteLength(error.stdout ?? '');
2916
- const tempPathNeedles = [tempDir, tempDir.replaceAll('\\', '\\\\'), tempDir.replaceAll('\\', '/')];
2917
- let message = scrubLocalPathText(error instanceof Error ? error.message : String(error));
2918
- for (const needle of tempPathNeedles) message = replaceInsensitive(message, needle, '<temp-fixture>');
2919
- if (SECRET_LOOKING_OUTPUT.test(message)) message = 'AI orchestration plan failed with secret-looking output redacted.';
2920
- if (message.includes(RAW_MEMORY_SENTINEL)) message = 'AI orchestration plan failed with raw-memory sentinel output redacted.';
2921
- gate.error = {
2922
- code: error.killed ? 'COMMAND_TIMEOUT' : (error.code ?? 'AI_ORCHESTRATION_PLAN_FAILED'),
2923
- message,
2924
- };
2925
- } finally {
2926
- await rm(tempDir, { recursive: true, force: true });
2927
- gate.duration_ms = Date.now() - started;
2928
- }
2929
- return gate;
2930
- }
2931
2891
 
2932
2892
  function validateCloudflareOpsHelp(stdout) {
2933
2893
  const text = String(stdout);
@@ -5583,7 +5543,6 @@ export async function runReleaseAudit() {
5583
5543
  gates.push(await runProductionDependencyReportGate());
5584
5544
  gates.push(await runProductionWorkplanGate());
5585
5545
  gates.push(await runProductionStatusBoardGate());
5586
- gates.push(await runAiOrchestrationPlanGate());
5587
5546
  gates.push(await runProductionManifestValidatorGate());
5588
5547
  gates.push(await runProductionManifestSafetyGate());
5589
5548
  gates.push(await runInfrastructureReadinessGate());
@@ -19,6 +19,16 @@ const PUBLIC_SITE_MANIFEST_CANDIDATES = Object.freeze([
19
19
  'site/public/public-site-manifest.json',
20
20
  'site/public/manifest.json'
21
21
  ]);
22
+ const KNOWN_SAFE_PATHS = new Set([
23
+ 'scripts/scan-secrets.mjs',
24
+ 'packages/rag/models/Xenova/all-MiniLM-L6-v2/config.json',
25
+ 'packages/rag/models/Xenova/all-MiniLM-L6-v2/tokenizer.json',
26
+ 'packages/rag/models/Xenova/all-MiniLM-L6-v2/tokenizer_config.json',
27
+ 'packages/rag/models/Xenova/all-MiniLM-L6-v2/onnx/model_quantized.onnx',
28
+ 'packages/rag/models/Xenova/all-MiniLM-L6-v2/sha256-manifest.json',
29
+ 'packages/rag/models/Xenova/all-MiniLM-L6-v2/THIRD_PARTY_LICENSES.txt',
30
+ ]);
31
+
22
32
 
23
33
  function normalizeRel(rel) {
24
34
  return String(rel).replace(/\\/g, '/').replace(/^\.\//, '').replace(/\/+/g, '/');
@@ -37,12 +47,12 @@ function safeProjectPath(rel) {
37
47
  }
38
48
 
39
49
  function assertSafeEvidencePath(rel) {
40
- const normalized = normalizeRel(rel);
50
+ const normalized = normalizeRel(rel).replace(/^!+/, '');
51
+ if (KNOWN_SAFE_PATHS.has(normalized)) return;
41
52
  if (SECRET_OR_LOCAL_BUNDLE_PATH.test(normalized) || SECRET_EXTENSION.test(normalized) || PRIVATE_PUBLIC_SITE_COLLATERAL.test(normalized)) {
42
53
  throw new Error(`Refusing release provenance over sensitive or private path: ${normalized}`);
43
54
  }
44
55
  }
45
-
46
56
  function sortedObject(value) {
47
57
  if (value === null || typeof value !== 'object' || Array.isArray(value)) return value;
48
58
  return Object.fromEntries(Object.keys(value).sort().map((key) => [key, sortedObject(value[key])]));