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.
- package/README.md +85 -27
- package/apps/cli/bin/enigma-desktop.mjs +140 -0
- package/apps/cli/bin/enigma-terminal.mjs +78 -0
- package/apps/cli/bin/enigma.mjs +4979 -3263
- package/apps/desktop/electron-main.cjs +217 -0
- package/apps/desktop/package.json +12 -0
- package/apps/desktop/src/app.js +264 -7
- package/apps/desktop/src/index.html +3514 -1373
- package/apps/desktop/src/launch-electron.mjs +51 -0
- package/apps/desktop/src/server.mjs +2914 -0
- package/apps/desktop/src/styles.css +2972 -260
- package/apps/desktop/src/zk-browser-prove.mjs +53 -0
- package/apps/desktop/src/zk-state.mjs +1789 -0
- package/apps/gateway/bin/enigma-gateway.mjs +102 -5
- package/apps/gateway/src/server.mjs +271 -8
- package/apps/ios/EnigmaCore/Package.swift +12 -0
- package/apps/ios/EnigmaCore/Sources/EnigmaCore/EnigmaAPIClient.swift +227 -0
- package/apps/ios/EnigmaCore/Sources/EnigmaCore/Models.swift +278 -0
- package/apps/ios/EnigmaCore/Sources/EnigmaCore/PKCE.swift +96 -0
- package/apps/ios/EnigmaCore/Sources/EnigmaCore/PrivacyMinimizer.swift +187 -0
- package/apps/ios/EnigmaCore/Sources/EnigmaCore/ToolModels.swift +129 -0
- package/apps/ios/EnigmaCore/Tests/EnigmaCoreTests/EnigmaCoreTests.swift +42 -0
- package/apps/ios/EnigmaIOS/Enigma/AppModel.swift +346 -0
- package/apps/ios/EnigmaIOS/Enigma/Assets.xcassets/AccentColor.colorset/Contents.json +12 -0
- package/apps/ios/EnigmaIOS/Enigma/Assets.xcassets/AppIcon.appiconset/Contents.json +11 -0
- package/apps/ios/EnigmaIOS/Enigma/Assets.xcassets/AppIcon.appiconset/EnigmaAppIcon.png +0 -0
- package/apps/ios/EnigmaIOS/Enigma/Assets.xcassets/Contents.json +3 -0
- package/apps/ios/EnigmaIOS/Enigma/Assets.xcassets/LaunchBackground.colorset/Contents.json +12 -0
- package/apps/ios/EnigmaIOS/Enigma/ChatView.swift +181 -0
- package/apps/ios/EnigmaIOS/Enigma/CouncilView.swift +78 -0
- package/apps/ios/EnigmaIOS/Enigma/CreateView.swift +152 -0
- package/apps/ios/EnigmaIOS/Enigma/EnigmaApp.swift +52 -0
- package/apps/ios/EnigmaIOS/Enigma/Info.plist +52 -0
- package/apps/ios/EnigmaIOS/Enigma/NaturalLanguagePrivacyTagger.swift +26 -0
- package/apps/ios/EnigmaIOS/Enigma/OAuthClient.swift +321 -0
- package/apps/ios/EnigmaIOS/Enigma/OnboardingView.swift +105 -0
- package/apps/ios/EnigmaIOS/Enigma/PrivateVaultView.swift +275 -0
- package/apps/ios/EnigmaIOS/Enigma/SecureStore.swift +76 -0
- package/apps/ios/EnigmaIOS/Enigma/SettingsView.swift +60 -0
- package/apps/ios/EnigmaIOS/Enigma/Theme.swift +80 -0
- package/apps/ios/EnigmaIOS/EnigmaIOS.xcodeproj/project.pbxproj +211 -0
- package/apps/ios/EnigmaIOS/EnigmaIOS.xcodeproj/xcshareddata/xcschemes/Enigma.xcscheme +23 -0
- package/apps/native-host/README.md +19 -8
- package/apps/native-host/bin/enigma-native-host.mjs +229 -13
- package/apps/relay/bin/enigma-relay.mjs +103 -5
- package/apps/relay/src/federation-runtime.mjs +618 -0
- package/apps/relay/src/server.mjs +310 -9
- package/apps/verifier/bin/enigma-verify.mjs +327 -11
- package/cortex-v3/circuits/build/intent_vk_bytes.json +35 -0
- package/cortex-v3/circuits/build/sale_vk_bytes.json +35 -0
- package/cortex-v3/circuits/build/vk_bytes.json +32 -0
- package/cortex-v3/proving-assets.json +64 -0
- package/cortex-v3/zk/BUILD-CONTRACT.md +87 -0
- package/cortex-v3/zk/action-transition-vk.json +119 -0
- package/cortex-v3/zk/alias-adversarial.test.mjs +220 -0
- package/cortex-v3/zk/groth16-verify-child.mjs +17 -0
- package/cortex-v3/zk/intent-witness.mjs +365 -0
- package/cortex-v3/zk/intent-witness.test.mjs +485 -0
- package/cortex-v3/zk/proving-assets.mjs +203 -0
- package/cortex-v3/zk/sale-witness.mjs +783 -0
- package/cortex-v3/zk/sale-witness.test.mjs +784 -0
- package/cortex-v3/zk/sealed-sale-release-vk.json +119 -0
- package/cortex-v3/zk/settlement-evidence.mjs +722 -0
- package/cortex-v3/zk/setup-intent.mjs +688 -0
- package/cortex-v3/zk/setup-sale.mjs +666 -0
- package/cortex-v3/zk/setup.mjs +594 -0
- package/cortex-v3/zk/witness.mjs +184 -0
- package/cortex-v3/zk/zk-codec.mjs +232 -0
- package/cortex-v3/zk/zk-codec.test.mjs +293 -0
- package/cortex-v3/zk/zk-settle.mjs +370 -0
- package/cortex-v3/zk/zk-tree.mjs +256 -0
- package/cortex-v3/zk/zk-tree.test.mjs +419 -0
- package/deploy/SIMULATION.md +14 -9
- package/deploy/docker-compose.local-production-simulation.yml +54 -12
- package/docs/benchmark-attestation-network.md +487 -487
- package/docs/benchmark-reproducibility.md +289 -289
- package/docs/blockchain-only-mechanisms.md +400 -400
- package/docs/browser-extension-install.md +8 -6
- package/docs/client-connectors.md +16 -12
- package/docs/demo-proof-network.md +275 -275
- package/docs/developer-ecosystem.md +15 -13
- package/docs/developer-proof-quickstart.md +325 -325
- package/docs/enigma-memory-ready-conformance.md +378 -376
- package/docs/install-anywhere.md +64 -30
- package/docs/installers-and-desktop.md +8 -7
- package/docs/memory-benchmarks.md +1 -1
- package/docs/memory-drive-health-model.md +690 -690
- package/docs/novelty-invention-candidates.md +161 -161
- package/docs/proof-network-build-notes.md +240 -240
- package/docs/proof-network-claim-boundaries.md +320 -318
- package/docs/proof-network.md +339 -339
- package/docs/sdk-api.md +324 -324
- package/docs/solana-proof-rail.md +453 -453
- package/examples/01-quickstart-agent/index.mjs +49 -0
- package/examples/01_agent_memory_quickstart.mjs +57 -0
- package/examples/02-multi-agent-swarm/index.mjs +57 -0
- package/examples/02_cross_model_passport.mjs +64 -0
- package/examples/03-langchain-memory/index.mjs +41 -0
- package/examples/03_poseidon_commitment_verification.mjs +71 -0
- package/examples/04-python-trading-agent/trader.py +49 -0
- package/examples/README.md +27 -0
- package/examples/ci/github-actions.yml +7 -2
- package/package.json +410 -278
- package/packages/adapters/PACKAGE_CONTRACT.md +1 -1
- package/packages/connectors/src/index.js +196 -4
- package/packages/connectors/swarm-router.mjs +168 -0
- package/packages/core/src/index.js +249 -2
- package/packages/core/src/version.mjs +7 -0
- package/packages/dev-tools/package.json +19 -0
- package/packages/dev-tools/src/index.js +4 -0
- package/packages/dev-tools/src/memory-benchmark-suite.js +112 -0
- package/packages/dev-tools/src/swarm-simulator.js +101 -0
- package/packages/dev-tools/src/vault-inspector.js +114 -0
- package/packages/dev-tools/src/vector-benchmark.js +100 -0
- package/packages/developer-platform/src/access-credentials.js +341 -0
- package/packages/developer-platform/src/http.js +132 -0
- package/packages/developer-platform/src/index.js +4 -0
- package/packages/developer-platform/src/usage-http.js +60 -0
- package/packages/developer-platform/src/usage.js +295 -0
- package/packages/enclave-runtime/attestation.mjs +159 -0
- package/packages/enclave-runtime/index.mjs +47 -0
- package/packages/enclave-runtime/session-manager.mjs +253 -0
- package/packages/enclave-runtime/zeroization-proof.mjs +227 -0
- package/packages/enigma-reflex/package.json +14 -0
- package/packages/enigma-reflex/src/index.js +204 -0
- package/packages/enigma-reflex/training/generate-dataset.mjs +40 -0
- package/packages/enigma-reflex/training/requirements.txt +8 -0
- package/packages/enigma-reflex/training/train.py +314 -0
- package/packages/enigma-weave/LICENSE +22 -0
- package/packages/enigma-weave/UPSTREAM.json +21 -0
- package/packages/enigma-weave/package.json +14 -0
- package/packages/enigma-weave/src/index.js +286 -0
- package/packages/hosted-cloud/src/index.js +80 -5
- package/packages/importers/src/index.js +432 -0
- package/packages/inference-runtime/src/browser.js +401 -0
- package/packages/inference-runtime/src/chat.js +265 -0
- package/packages/inference-runtime/src/code.js +407 -0
- package/packages/inference-runtime/src/contracts.js +162 -0
- package/packages/inference-runtime/src/http.js +232 -0
- package/packages/inference-runtime/src/image.js +186 -0
- package/packages/inference-runtime/src/index.js +10 -0
- package/packages/inference-runtime/src/model-router.js +320 -0
- package/packages/inference-runtime/src/platform.js +125 -0
- package/packages/inference-runtime/src/privacy.js +400 -0
- package/packages/inference-runtime/src/video.js +253 -0
- package/packages/mcp-server/README.md +22 -6
- package/packages/mcp-server/bin/enigma-mcp.mjs +2 -1
- package/packages/mcp-server/src/index.js +2498 -1185
- package/packages/mcp-server/src/oauth.js +561 -0
- package/packages/mcp-server/src/private-handoff.js +84 -0
- package/packages/mcp-server/src/remote-http.js +273 -0
- package/packages/mcp-server/src/remote-policy.js +72 -0
- package/packages/mcp-server/swarm-bridge.mjs +361 -0
- package/packages/mesh/index.d.ts +283 -0
- package/packages/mesh/package.json +23 -0
- package/packages/mesh/src/crypto.js +189 -0
- package/packages/mesh/src/federation-packets.js +353 -0
- package/packages/mesh/src/gossip.js +311 -0
- package/packages/mesh/src/index.js +6 -0
- package/packages/mesh/src/protocol.js +255 -0
- package/packages/mesh/src/router.js +279 -0
- package/packages/mesh/src/transport.js +306 -0
- package/packages/passport/src/index.js +436 -7
- package/packages/private-economy/src/credits-http.js +100 -0
- package/packages/private-economy/src/credits.js +447 -0
- package/packages/private-economy/src/index.js +5 -0
- package/packages/private-economy/src/payments-http.js +120 -0
- package/packages/private-economy/src/payments.js +509 -0
- package/packages/private-economy/src/x402.js +346 -0
- package/packages/proof-network/PACKAGE_CONTRACT.md +21 -0
- package/packages/rag/index.d.ts +182 -0
- package/packages/rag/models/Xenova/all-MiniLM-L6-v2/THIRD_PARTY_LICENSES.txt +207 -0
- package/packages/rag/models/Xenova/all-MiniLM-L6-v2/config.json +25 -0
- package/packages/rag/models/Xenova/all-MiniLM-L6-v2/onnx/model_quantized.onnx +0 -0
- package/packages/rag/models/Xenova/all-MiniLM-L6-v2/sha256-manifest.json +28 -0
- package/packages/rag/models/Xenova/all-MiniLM-L6-v2/tokenizer.json +30686 -0
- package/packages/rag/models/Xenova/all-MiniLM-L6-v2/tokenizer_config.json +15 -0
- package/packages/rag/package.json +27 -0
- package/packages/rag/src/blinded-search.js +109 -0
- package/packages/rag/src/bm25.js +169 -0
- package/packages/rag/src/embeddings.js +459 -0
- package/packages/rag/src/hybrid.js +76 -0
- package/packages/rag/src/index.js +38 -0
- package/packages/rag/src/reranker.js +61 -0
- package/packages/rag/src/research.js +107 -0
- package/packages/rag/src/vector-store.js +430 -0
- package/packages/rag/src/verify-model-artifacts.mjs +4 -0
- package/packages/sdk/index.d.ts +760 -0
- package/packages/sdk/package.json +33 -0
- package/packages/sdk/python/README.md +24 -0
- package/packages/sdk/python/enigma_sdk.py +250 -0
- package/packages/sdk/python/pyproject.toml +34 -0
- package/packages/sdk/python/requirements.txt +1 -0
- package/packages/sdk/python/setup.py +20 -0
- package/packages/sdk/src/federation/capability-grant.js +389 -0
- package/packages/sdk/src/federation/federation-router.js +360 -0
- package/packages/sdk/src/federation/ghostmesh-bridge.js +497 -0
- package/packages/sdk/src/federation/index.js +3 -0
- package/packages/sdk/src/index.js +1796 -0
- package/packages/sdk/src/intelligence/contradiction.js +337 -0
- package/packages/sdk/src/intelligence/decision-engine.js +155 -0
- package/packages/sdk/src/intelligence/index.js +4 -0
- package/packages/sdk/src/intelligence/ontology.js +122 -0
- package/packages/sdk/src/intelligence/temporal.js +123 -0
- package/packages/sdk/src/market-client.js +142 -0
- package/packages/sdk/src/mesh-client.js +110 -0
- package/packages/sdk/src/middleware/index.js +3 -0
- package/packages/sdk/src/middleware/langchain.js +159 -0
- package/packages/sdk/src/middleware/llamaindex.js +101 -0
- package/packages/sdk/src/middleware/vercel-ai.js +112 -0
- package/packages/sdk/src/rag-client.js +85 -0
- package/packages/sdk/src/swarm-orchestrator.js +260 -0
- package/packages/settlement/PACKAGE_CONTRACT.md +1 -1
- package/packages/snapcompact/THIRD_PARTY_LICENSES.txt +40 -0
- package/packages/snapcompact/assets/8x13-latin1.bdf +3837 -0
- package/packages/snapcompact/index.d.ts +284 -0
- package/packages/snapcompact/package.json +25 -0
- package/packages/snapcompact/src/index.js +716 -0
- package/packages/storage/PACKAGE_CONTRACT.md +1 -1
- package/packages/terminal-console/animations.mjs +240 -0
- package/packages/terminal-console/auto-anchor.mjs +220 -0
- package/packages/terminal-console/banner.mjs +91 -0
- package/packages/terminal-console/commands.mjs +459 -0
- package/packages/terminal-console/delegation.mjs +152 -0
- package/packages/terminal-console/index.mjs +5 -0
- package/packages/terminal-console/outbox.mjs +143 -0
- package/packages/terminal-console/phantom-bridge.mjs +637 -0
- package/packages/terminal-console/repl.mjs +136 -0
- package/packages/terminal-console/signer-store.mjs +130 -0
- package/packages/terminal-console/solana-rpc.mjs +214 -0
- package/packages/terminal-console/solana-transport.mjs +189 -0
- package/packages/terminal-tui/dashboard.mjs +214 -0
- package/packages/terminal-tui/index.mjs +28 -0
- package/packages/terminal-tui/merkle-tree-renderer.mjs +268 -0
- package/packages/terminal-tui/telemetry-hud.mjs +137 -0
- package/packages/vault/index.d.ts +449 -0
- package/packages/vault/package.json +27 -0
- package/packages/vault/src/e2ee.mjs +393 -0
- package/packages/vault/src/enclave.js +481 -0
- package/packages/vault/src/erasure.js +207 -0
- package/packages/vault/src/index.js +1150 -125
- package/packages/vault/src/persistence.js +307 -0
- package/packages/vault/src/poseidon.js +354 -0
- package/packages/vault/src/receipt.js +459 -0
- package/scripts/benchmark-optical-context.mjs +166 -0
- package/scripts/bootstrap-enigma.mjs +502 -0
- package/scripts/build-edge-backend-workers.mjs +20 -5
- package/scripts/build-goal-completion-audit.mjs +72 -25
- package/scripts/build-hosted-api-key-lifecycle.mjs +292 -274
- package/scripts/build-hosted-customer-lifecycle.mjs +493 -476
- package/scripts/build-hosted-probe-worker.mjs +19 -4
- package/scripts/build-installer-assets.mjs +409 -389
- package/scripts/build-operator-evidence-starter.mjs +59 -1
- package/scripts/build-production-backend-env-kit.mjs +2 -0
- package/scripts/build-production-unblocker.mjs +4 -1
- package/scripts/build-proof-network-packet.mjs +213 -213
- package/scripts/check.mjs +25 -4
- package/scripts/collect-hosted-backend-live-evidence.mjs +49 -12
- package/scripts/install-enigma-local.mjs +18 -5
- package/scripts/release-audit.mjs +74 -115
- package/scripts/release-provenance.mjs +12 -2
- package/scripts/run-backend-readiness-smoke.mjs +112 -10
- package/scripts/run-standard-memory-benchmarks.mjs +1354 -1352
- package/scripts/scan-secrets.mjs +178 -0
- package/scripts/simulate-production-env.mjs +71 -10
- package/scripts/validate-hosted-backend-live.mjs +112 -1
- package/specs/antibody-pack-v1.schema.json +95 -0
- package/specs/antigen-envelope-v1.schema.json +81 -0
- package/specs/boundary-manifest-v1.schema.json +35 -35
- package/specs/capsule-v1.schema.json +55 -55
- package/specs/claim-boundary-manifest-v1.schema.json +22 -22
- package/specs/claim-ledger-v1.schema.json +291 -0
- package/specs/context-passport-v1.schema.json +59 -0
- package/specs/deletion-tombstone-v1.schema.json +26 -26
- package/specs/evidence-packet-v1.schema.json +177 -0
- package/specs/hosted-backend-live-evidence-v1.schema.json +72 -3
- package/specs/immune-scan-report-v1.schema.json +112 -0
- package/specs/lifecycle-receipt-log-v1.schema.json +67 -0
- package/specs/memory-atom-v1.schema.json +59 -0
- package/specs/memory-event-v1.schema.json +42 -42
- package/specs/passport-v1.schema.json +50 -50
- package/specs/proof-of-non-use-v1.schema.json +65 -0
- package/specs/quarantine-record-v1.schema.json +126 -0
- package/specs/receipt-v1.schema.json +61 -61
- package/specs/state-checkpoint-v1.schema.json +37 -37
- package/specs/trust-bundle-v1.schema.json +56 -56
- package/specs/trust-card-v1.schema.json +119 -0
- package/docs/proof-network-launch-plan.md +0 -421
- package/packages/metering/PACKAGE_CONTRACT.md +0 -20
- package/scripts/build-ai-orchestration-plan.mjs +0 -248
|
@@ -1,8 +1,17 @@
|
|
|
1
1
|
#!/usr/bin/env node
|
|
2
2
|
import { once } from 'node:events';
|
|
3
3
|
import { pathToFileURL } from 'node:url';
|
|
4
|
-
import {
|
|
5
|
-
|
|
4
|
+
import {
|
|
5
|
+
FEDERATION_STORAGE_ADAPTER_SCHEMA,
|
|
6
|
+
RELAY_STATE_ADAPTER_SCHEMA,
|
|
7
|
+
createRelayServer,
|
|
8
|
+
} from '../apps/relay/src/server.mjs';
|
|
9
|
+
import {
|
|
10
|
+
GATEWAY_KMS_SIGNER_ADAPTER_SCHEMA,
|
|
11
|
+
GATEWAY_SIEM_SINK_ADAPTER_SCHEMA,
|
|
12
|
+
GATEWAY_STATE_ADAPTER_SCHEMA,
|
|
13
|
+
createGatewayServer,
|
|
14
|
+
} from '../apps/gateway/src/server.mjs';
|
|
6
15
|
|
|
7
16
|
export const BACKEND_READINESS_SMOKE_SCHEMA = 'enigma.backend_readiness_smoke.v1';
|
|
8
17
|
|
|
@@ -21,6 +30,76 @@ const SHARED_READINESS_REFS = Object.freeze({
|
|
|
21
30
|
incident_drill_ref: 'incident-drill-smoke-ref',
|
|
22
31
|
backup_restore_drill_ref: 'backup-restore-drill-smoke-ref',
|
|
23
32
|
});
|
|
33
|
+
function transactionalStateAdapter(schema, service, ready) {
|
|
34
|
+
let snapshot = null;
|
|
35
|
+
return {
|
|
36
|
+
schema,
|
|
37
|
+
ref: `fixture://${service}/durable-state`,
|
|
38
|
+
durable: true,
|
|
39
|
+
encryptedAtRest: true,
|
|
40
|
+
supportsMultiReplica: true,
|
|
41
|
+
async isReady() { return ready; },
|
|
42
|
+
async transaction(operation, options) {
|
|
43
|
+
const result = await operation(snapshot ?? options.initialSnapshot);
|
|
44
|
+
snapshot = structuredClone(result.snapshot);
|
|
45
|
+
return result.value;
|
|
46
|
+
},
|
|
47
|
+
};
|
|
48
|
+
}
|
|
49
|
+
|
|
50
|
+
function federationFixture(service, ready) {
|
|
51
|
+
const bridge = {
|
|
52
|
+
started: false,
|
|
53
|
+
async start() { this.started = true; },
|
|
54
|
+
async stop() { this.started = false; },
|
|
55
|
+
};
|
|
56
|
+
return {
|
|
57
|
+
storage: {
|
|
58
|
+
schema: FEDERATION_STORAGE_ADAPTER_SCHEMA,
|
|
59
|
+
ref: `fixture://${service}/opaque-federation-storage`,
|
|
60
|
+
durable: true,
|
|
61
|
+
async isReady() { return ready; },
|
|
62
|
+
async appendOpaqueFrame() {},
|
|
63
|
+
},
|
|
64
|
+
authenticator: {
|
|
65
|
+
ref: `fixture://${service}/federation-auth`,
|
|
66
|
+
async isReady() { return ready; },
|
|
67
|
+
async authenticate() { return { ok: false }; },
|
|
68
|
+
},
|
|
69
|
+
bridge,
|
|
70
|
+
kmsRef: `fixture://${service}/kms-custody`,
|
|
71
|
+
};
|
|
72
|
+
}
|
|
73
|
+
|
|
74
|
+
function relayRuntimeFixture(ready) {
|
|
75
|
+
return {
|
|
76
|
+
relayStateAdapter: transactionalStateAdapter(RELAY_STATE_ADAPTER_SCHEMA, 'relay', ready),
|
|
77
|
+
federation: federationFixture('relay', ready),
|
|
78
|
+
};
|
|
79
|
+
}
|
|
80
|
+
|
|
81
|
+
function gatewayRuntimeFixture(ready) {
|
|
82
|
+
return {
|
|
83
|
+
gatewayStateAdapter: transactionalStateAdapter(GATEWAY_STATE_ADAPTER_SCHEMA, 'gateway', ready),
|
|
84
|
+
kmsSignerAdapter: {
|
|
85
|
+
schema: GATEWAY_KMS_SIGNER_ADAPTER_SCHEMA,
|
|
86
|
+
ref: 'fixture://gateway/kms-signer',
|
|
87
|
+
publicKey: 'fixture-public-key-not-used-by-readiness-smoke',
|
|
88
|
+
async isReady() { return ready; },
|
|
89
|
+
async createDecision() { throw new Error('readiness smoke does not request a gateway decision'); },
|
|
90
|
+
},
|
|
91
|
+
siemSinkAdapter: {
|
|
92
|
+
schema: GATEWAY_SIEM_SINK_ADAPTER_SCHEMA,
|
|
93
|
+
ref: 'fixture://gateway/siem-sink',
|
|
94
|
+
durable: true,
|
|
95
|
+
idempotent: true,
|
|
96
|
+
async isReady() { return ready; },
|
|
97
|
+
async appendBatch() {},
|
|
98
|
+
},
|
|
99
|
+
federation: federationFixture('gateway', ready),
|
|
100
|
+
};
|
|
101
|
+
}
|
|
102
|
+
|
|
24
103
|
|
|
25
104
|
function parseArgs(argv = process.argv.slice(2)) {
|
|
26
105
|
const flags = new Map();
|
|
@@ -38,7 +117,7 @@ function parseArgs(argv = process.argv.slice(2)) {
|
|
|
38
117
|
}
|
|
39
118
|
|
|
40
119
|
function usage() {
|
|
41
|
-
return `Usage: node scripts/run-backend-readiness-smoke.mjs [--host 127.0.0.1]\n\nStarts in-process relay/gateway HTTP servers on loopback ephemeral ports, probes /livez and /readyz,\nand verifies fail-closed production readiness plus
|
|
120
|
+
return `Usage: node scripts/run-backend-readiness-smoke.mjs [--host 127.0.0.1]\n\nStarts in-process relay/gateway HTTP servers on loopback ephemeral ports, probes /livez and /readyz,\nand verifies fail-closed production readiness plus an explicit operational-runtime fixture with durable state, KMS signer, SIEM sink, federation storage/authentication, and all evidence refs.\nIt does not expose credentials, provision cloud resources, or prove hosted live infrastructure.\n`;
|
|
42
121
|
}
|
|
43
122
|
|
|
44
123
|
function listen(server, host) {
|
|
@@ -53,13 +132,19 @@ function listen(server, host) {
|
|
|
53
132
|
}
|
|
54
133
|
|
|
55
134
|
async function close(server) {
|
|
135
|
+
await server.federationRuntime?.stop();
|
|
56
136
|
if (!server.listening) return;
|
|
57
137
|
server.close();
|
|
138
|
+
server.closeAllConnections?.();
|
|
58
139
|
await once(server, 'close');
|
|
59
140
|
}
|
|
60
141
|
|
|
61
142
|
async function getJson(baseUrl, path) {
|
|
62
|
-
const response = await fetch(`${baseUrl}${path}`, {
|
|
143
|
+
const response = await fetch(`${baseUrl}${path}`, {
|
|
144
|
+
method: 'GET',
|
|
145
|
+
headers: { accept: 'application/json' },
|
|
146
|
+
signal: AbortSignal.timeout(5_000),
|
|
147
|
+
});
|
|
63
148
|
const text = await response.text();
|
|
64
149
|
if (SECRET_OUTPUT_RE.test(text)) throw new Error(`${baseUrl}${path} emitted secret-looking output`);
|
|
65
150
|
let body;
|
|
@@ -97,6 +182,7 @@ function relayReadyOptions() {
|
|
|
97
182
|
monitoring_ref: 'relay-monitoring-smoke-ref',
|
|
98
183
|
...SHARED_READINESS_REFS,
|
|
99
184
|
operator_acceptance: { decision: 'go', status: 'go', ref: 'relay-operator-acceptance-smoke-ref' },
|
|
185
|
+
...relayRuntimeFixture(true),
|
|
100
186
|
};
|
|
101
187
|
}
|
|
102
188
|
|
|
@@ -115,6 +201,9 @@ function gatewayReadyOptions() {
|
|
|
115
201
|
data_plane_auth_ref: 'gateway-data-plane-auth-smoke-ref',
|
|
116
202
|
...SHARED_READINESS_REFS,
|
|
117
203
|
operator_acceptance: { decision: 'go', status: 'go', ref: 'gateway-operator-acceptance-smoke-ref' },
|
|
204
|
+
admin_auth_bearer_sha256: `sha256:${'a'.repeat(64)}`,
|
|
205
|
+
data_plane_auth_bearer_sha256: `sha256:${'b'.repeat(64)}`,
|
|
206
|
+
...gatewayRuntimeFixture(true),
|
|
118
207
|
};
|
|
119
208
|
}
|
|
120
209
|
|
|
@@ -122,9 +211,18 @@ async function probeServer({ service, mode, serverFactory, host, expectedReadySt
|
|
|
122
211
|
const server = serverFactory();
|
|
123
212
|
try {
|
|
124
213
|
const address = await listen(server, host);
|
|
214
|
+
await server.federationRuntime?.start();
|
|
125
215
|
const baseUrl = `http://${address.address}:${address.port}`;
|
|
126
216
|
const livez = await getJson(baseUrl, '/livez');
|
|
127
217
|
const readyz = await getJson(baseUrl, '/readyz');
|
|
218
|
+
const failedChecks = Array.isArray(readyz.body?.checks)
|
|
219
|
+
? readyz.body.checks
|
|
220
|
+
.filter((check) => check?.ok !== true && typeof (check?.check ?? check?.name) === 'string')
|
|
221
|
+
.map((check) => check.check ?? check.name)
|
|
222
|
+
: [];
|
|
223
|
+
const missingChecks = Array.isArray(readyz.body?.missing_checks) && readyz.body.missing_checks.length > 0
|
|
224
|
+
? [...readyz.body.missing_checks]
|
|
225
|
+
: failedChecks;
|
|
128
226
|
return {
|
|
129
227
|
service,
|
|
130
228
|
mode,
|
|
@@ -134,6 +232,10 @@ async function probeServer({ service, mode, serverFactory, host, expectedReadySt
|
|
|
134
232
|
livez_ok: livez.body?.ok === true,
|
|
135
233
|
readyz_status: readyz.status,
|
|
136
234
|
readyz_ok: readyz.body?.ok === true,
|
|
235
|
+
readyz_missing_checks: missingChecks,
|
|
236
|
+
readyz_blocker_paths: missingChecks.length > 0
|
|
237
|
+
? missingChecks.map((check) => `checks.${check}`)
|
|
238
|
+
: (readyz.body?.error !== undefined ? ['error'] : []),
|
|
137
239
|
readyz_missing_evidence_ref_count: missingCount(readyz.body),
|
|
138
240
|
readyz_all_checks_ok: allChecksOk(readyz.body),
|
|
139
241
|
ok: livez.status === 200
|
|
@@ -157,7 +259,7 @@ export async function runBackendReadinessSmoke(options = {}) {
|
|
|
157
259
|
host,
|
|
158
260
|
expectedReadyStatus: 503,
|
|
159
261
|
expectedReadyOk: false,
|
|
160
|
-
serverFactory: () => createRelayServer({ mode: 'production', now: '1970-01-01T00:00:00.000Z' }),
|
|
262
|
+
serverFactory: () => createRelayServer({ mode: 'production', now: '1970-01-01T00:00:00.000Z', ...relayRuntimeFixture(false) }),
|
|
161
263
|
}));
|
|
162
264
|
checks.push(await probeServer({
|
|
163
265
|
service: 'gateway',
|
|
@@ -165,11 +267,11 @@ export async function runBackendReadinessSmoke(options = {}) {
|
|
|
165
267
|
host,
|
|
166
268
|
expectedReadyStatus: 503,
|
|
167
269
|
expectedReadyOk: false,
|
|
168
|
-
serverFactory: () => createGatewayServer({ mode: 'production' }),
|
|
270
|
+
serverFactory: () => createGatewayServer({ mode: 'production', ...gatewayRuntimeFixture(false) }),
|
|
169
271
|
}));
|
|
170
272
|
checks.push(await probeServer({
|
|
171
273
|
service: 'relay',
|
|
172
|
-
mode: 'production-
|
|
274
|
+
mode: 'production-operational-fixture',
|
|
173
275
|
host,
|
|
174
276
|
expectedReadyStatus: 200,
|
|
175
277
|
expectedReadyOk: true,
|
|
@@ -177,7 +279,7 @@ export async function runBackendReadinessSmoke(options = {}) {
|
|
|
177
279
|
}));
|
|
178
280
|
checks.push(await probeServer({
|
|
179
281
|
service: 'gateway',
|
|
180
|
-
mode: 'production-
|
|
282
|
+
mode: 'production-operational-fixture',
|
|
181
283
|
host,
|
|
182
284
|
expectedReadyStatus: 200,
|
|
183
285
|
expectedReadyOk: true,
|
|
@@ -192,8 +294,8 @@ export async function runBackendReadinessSmoke(options = {}) {
|
|
|
192
294
|
checks,
|
|
193
295
|
claim_boundary: [
|
|
194
296
|
'This smoke starts local in-process HTTP servers on loopback ephemeral ports only.',
|
|
195
|
-
'It verifies
|
|
196
|
-
'
|
|
297
|
+
'It verifies fail-closed production defaults and an explicit operational fixture with durable transactional state, gateway KMS/SIEM adapters, authenticated federation dependencies, and all readiness refs.',
|
|
298
|
+
'Fixture adapters are test-scoped and do not prove hosted DNS, TLS, durable cloud storage, KMS, SIEM, backup, operator acceptance, or customer BYOC infrastructure is live.',
|
|
197
299
|
],
|
|
198
300
|
};
|
|
199
301
|
if (SECRET_OUTPUT_RE.test(JSON.stringify(result))) throw new Error('backend readiness smoke output appears to contain a secret');
|