enigma-memory 0.1.18 → 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 +76 -24
- package/apps/cli/bin/enigma-desktop.mjs +140 -0
- package/apps/cli/bin/enigma-terminal.mjs +78 -0
- package/apps/cli/bin/enigma.mjs +1923 -285
- 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/docker-compose.local-production-simulation.yml +36 -0
- package/docs/browser-extension-install.md +8 -6
- package/docs/client-connectors.md +15 -11
- package/docs/developer-ecosystem.md +15 -13
- package/docs/enigma-memory-ready-conformance.md +11 -9
- package/docs/install-anywhere.md +61 -28
- package/docs/installers-and-desktop.md +8 -7
- package/docs/novelty-invention-candidates.md +161 -161
- package/docs/proof-network-claim-boundaries.md +320 -318
- 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 +142 -11
- 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 +248 -1
- 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 +1418 -105
- 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 +426 -1
- 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 +1018 -155
- 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 +26 -8
- package/scripts/build-hosted-customer-lifecycle.mjs +20 -3
- package/scripts/build-hosted-probe-worker.mjs +19 -4
- package/scripts/build-installer-assets.mjs +41 -21
- 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 +3 -0
- package/scripts/check.mjs +17 -3
- package/scripts/collect-hosted-backend-live-evidence.mjs +49 -12
- package/scripts/install-enigma-local.mjs +18 -5
- package/scripts/release-audit.mjs +65 -109
- package/scripts/release-provenance.mjs +6 -0
- package/scripts/run-backend-readiness-smoke.mjs +112 -10
- package/scripts/scan-secrets.mjs +1 -0
- package/scripts/simulate-production-env.mjs +7 -2
- 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,248 +0,0 @@
|
|
|
1
|
-
#!/usr/bin/env node
|
|
2
|
-
import { mkdir, readFile, writeFile } from 'node:fs/promises';
|
|
3
|
-
import { dirname } from 'node:path';
|
|
4
|
-
import { fileURLToPath } from 'node:url';
|
|
5
|
-
|
|
6
|
-
export const AI_ORCHESTRATION_PLAN_SCHEMA = 'enigma.ai_orchestration_plan.v1';
|
|
7
|
-
|
|
8
|
-
const SECRET_RE = /(?:Bearer\s+[A-Za-z0-9._~+/=-]{12,}|Basic\s+[A-Za-z0-9+/=-]{12,}|-----BEGIN [A-Z ]*PRIVATE KEY-----|sk-[A-Za-z0-9_-]{16,}|cf-[A-Za-z0-9_-]{12,}|https?:\/\/[^\s/@]+:[^\s/@]+@|AKIA[0-9A-Z]{16}|\b[0-9a-f]{32}\b|(?:api[_-]?key|api[_-]?token|access[_-]?token|refresh[_-]?token|secret|password|private[_-]?key|token)\s*[:=]\s*["']?[A-Za-z0-9._~+/=-]{16,})/iu;
|
|
9
|
-
const LOCAL_PATH_RE = /(?<![A-Za-z])(?:[A-Za-z]:[\\/]|\\\\[^\\/]+[\\/][^\\/]+|\/(?:Users|home)\/[^\s"']+)/u;
|
|
10
|
-
|
|
11
|
-
function parseArgs(argv = process.argv.slice(2)) {
|
|
12
|
-
const out = { statusBoard: null, out: null, help: false };
|
|
13
|
-
for (let index = 0; index < argv.length; index += 1) {
|
|
14
|
-
const token = argv[index];
|
|
15
|
-
const readValue = () => {
|
|
16
|
-
const value = argv[index + 1];
|
|
17
|
-
if (typeof value !== 'string' || value.length === 0 || value.startsWith('--')) throw new Error(`${token} requires a value`);
|
|
18
|
-
index += 1;
|
|
19
|
-
return value;
|
|
20
|
-
};
|
|
21
|
-
if (token === '--status-board' || token === '--statusBoard') out.statusBoard = readValue();
|
|
22
|
-
else if (token === '--out') out.out = readValue();
|
|
23
|
-
else if (token === '--help' || token === '-h') out.help = true;
|
|
24
|
-
else throw new Error(`Unknown AI orchestration option: ${token}`);
|
|
25
|
-
}
|
|
26
|
-
return out;
|
|
27
|
-
}
|
|
28
|
-
|
|
29
|
-
function usage() {
|
|
30
|
-
return 'Usage: node scripts/build-ai-orchestration-plan.mjs --status-board <production-status-board.json> [--out <file>]\n\nBuilds a public-safe AI/operator orchestration plan from the current production status board.\n';
|
|
31
|
-
}
|
|
32
|
-
|
|
33
|
-
async function readJson(path, label) {
|
|
34
|
-
try {
|
|
35
|
-
return JSON.parse(await readFile(path, 'utf8'));
|
|
36
|
-
} catch {
|
|
37
|
-
throw new Error(`Unable to read ${label}`);
|
|
38
|
-
}
|
|
39
|
-
}
|
|
40
|
-
|
|
41
|
-
function assertPublicSafe(value, label = 'AI orchestration plan') {
|
|
42
|
-
const text = JSON.stringify(value);
|
|
43
|
-
if (SECRET_RE.test(text)) throw new Error(`${label} contains secret-looking material`);
|
|
44
|
-
if (LOCAL_PATH_RE.test(text)) throw new Error(`${label} contains a local path`);
|
|
45
|
-
}
|
|
46
|
-
|
|
47
|
-
function requireObject(value, label) {
|
|
48
|
-
if (value === null || typeof value !== 'object' || Array.isArray(value)) throw new Error(`${label} must be an object`);
|
|
49
|
-
assertPublicSafe(value, label);
|
|
50
|
-
return value;
|
|
51
|
-
}
|
|
52
|
-
|
|
53
|
-
function compactCommands(values, limit = 4) {
|
|
54
|
-
const out = [];
|
|
55
|
-
const seen = new Set();
|
|
56
|
-
for (const value of Array.isArray(values) ? values : []) {
|
|
57
|
-
if (typeof value !== 'string' || value.length === 0 || seen.has(value)) continue;
|
|
58
|
-
seen.add(value);
|
|
59
|
-
out.push(value);
|
|
60
|
-
if (out.length >= limit) break;
|
|
61
|
-
}
|
|
62
|
-
return out;
|
|
63
|
-
}
|
|
64
|
-
|
|
65
|
-
function phaseById(statusBoard, id) {
|
|
66
|
-
const phases = Array.isArray(statusBoard.blocked_phases) ? statusBoard.blocked_phases : [];
|
|
67
|
-
return phases.find((phase) => phase.id === id) ?? null;
|
|
68
|
-
}
|
|
69
|
-
|
|
70
|
-
function groupByName(statusBoard, name) {
|
|
71
|
-
const groups = Array.isArray(statusBoard.blocked_groups) ? statusBoard.blocked_groups : [];
|
|
72
|
-
return groups.find((group) => group.name === name) ?? null;
|
|
73
|
-
}
|
|
74
|
-
|
|
75
|
-
function blockersFor(item) {
|
|
76
|
-
return Array.isArray(item?.blockers) ? item.blockers.slice(0, 8) : [];
|
|
77
|
-
}
|
|
78
|
-
|
|
79
|
-
function commandsFor(item) {
|
|
80
|
-
if (Array.isArray(item?.commands)) return compactCommands(item.commands, 5);
|
|
81
|
-
if (typeof item?.next_command === 'string') return [item.next_command];
|
|
82
|
-
return [];
|
|
83
|
-
}
|
|
84
|
-
|
|
85
|
-
function buildLane({ id, role, model, charter, owns, waits_for = [], commands = [], blockers = [], acceptance = [] }) {
|
|
86
|
-
return {
|
|
87
|
-
id,
|
|
88
|
-
role,
|
|
89
|
-
model,
|
|
90
|
-
charter,
|
|
91
|
-
owns,
|
|
92
|
-
waits_for,
|
|
93
|
-
blocker_count: blockers.length,
|
|
94
|
-
blockers,
|
|
95
|
-
commands: compactCommands(commands, 6),
|
|
96
|
-
acceptance,
|
|
97
|
-
};
|
|
98
|
-
}
|
|
99
|
-
|
|
100
|
-
function buildRoleLanes(statusBoard) {
|
|
101
|
-
const credentialPhase = phaseById(statusBoard, 'cloudflare_credentials') ?? groupByName(statusBoard, 'cloudflare_credentials');
|
|
102
|
-
const workerPhase = phaseById(statusBoard, 'cloudflare_worker_permission') ?? groupByName(statusBoard, 'cloudflare_worker_permission');
|
|
103
|
-
const hostedPhase = phaseById(statusBoard, 'hosted_backend_refs') ?? groupByName(statusBoard, 'hosted_backend_live');
|
|
104
|
-
const operatorPhase = phaseById(statusBoard, 'operator_acceptance') ?? groupByName(statusBoard, 'operator_acceptance');
|
|
105
|
-
const finalPhase = phaseById(statusBoard, 'final_release_verification');
|
|
106
|
-
return [
|
|
107
|
-
buildLane({
|
|
108
|
-
id: 'human_operator_credentials',
|
|
109
|
-
role: 'Human operator',
|
|
110
|
-
model: 'human-controlled Cloudflare/account owner',
|
|
111
|
-
charter: 'Create or inject credentials out-of-band without pasting secrets into chat, then rerun credential and status evidence.',
|
|
112
|
-
owns: ['cloudflare_credentials'],
|
|
113
|
-
blockers: blockersFor(credentialPhase),
|
|
114
|
-
commands: commandsFor(credentialPhase),
|
|
115
|
-
acceptance: ['production:cloudflare-credentials reports credentials_present:true', 'No token values, account ids, local paths, or contact data appear in artifacts.'],
|
|
116
|
-
}),
|
|
117
|
-
buildLane({
|
|
118
|
-
id: 'gpt55_architecture',
|
|
119
|
-
role: 'Architecture and structure planner',
|
|
120
|
-
model: 'GPT-5.5',
|
|
121
|
-
charter: 'Keep the end-to-end production graph coherent, claim-bounded, and testable while external credentials and hosted refs are supplied.',
|
|
122
|
-
owns: ['execution_order', 'claim_boundaries', 'status_board', 'workplan'],
|
|
123
|
-
waits_for: ['human_operator_credentials'],
|
|
124
|
-
blockers: [...blockersFor(workerPhase), ...blockersFor(hostedPhase)].slice(0, 8),
|
|
125
|
-
commands: ['npm run production:status -- --goal-audit .enigma/goal-audit-current.json --dependencies .enigma/production-dependencies-current.json --workplan .enigma/production-workplan-current.json --out .enigma/production-status-board-current.json', 'npm run production:workplan -- --dependencies .enigma/production-dependencies-current.json --operator-acceptance .enigma/operator-acceptance-template-result.json --hosted-ref-catalog .enigma/operator-evidence-starter/hosted-ref-catalog.json --out .enigma/production-workplan-current.json'],
|
|
126
|
-
acceptance: ['Status board has fresh_input_evidence:true.', 'Workplan execution_order covers every phase and has no cycles.', 'No broad completion claim is emitted while external blockers remain.'],
|
|
127
|
-
}),
|
|
128
|
-
buildLane({
|
|
129
|
-
id: 'kimi_coding',
|
|
130
|
-
role: 'Fast implementation lane',
|
|
131
|
-
model: 'Kimi coding agent',
|
|
132
|
-
charter: 'Implement the exact next production code, validator, deploy-script, or artifact change selected by the architecture lane; no design drift or compatibility shims.',
|
|
133
|
-
owns: ['worker_permission_probe', 'hosted_backend_refs', 'operator_evidence_starter', 'validator_scripts'],
|
|
134
|
-
waits_for: ['gpt55_architecture', 'human_operator_credentials'],
|
|
135
|
-
blockers: [...blockersFor(workerPhase), ...blockersFor(hostedPhase)].slice(0, 8),
|
|
136
|
-
commands: [...commandsFor(workerPhase), ...commandsFor(hostedPhase)].slice(0, 6),
|
|
137
|
-
acceptance: ['Targeted tests for changed files pass.', 'Release audit optional gate for the changed artifact passes.', 'Generated artifacts remain public-safe.'],
|
|
138
|
-
}),
|
|
139
|
-
buildLane({
|
|
140
|
-
id: 'gpt55_review',
|
|
141
|
-
role: 'Production reviewer',
|
|
142
|
-
model: 'GPT-5.5 reviewer',
|
|
143
|
-
charter: 'Review Kimi-coded changes for security, completeness, claim boundaries, and operator usability before final gates are rerun.',
|
|
144
|
-
owns: ['security_review', 'release_gate_review', 'operator_acceptance_review'],
|
|
145
|
-
waits_for: ['kimi_coding'],
|
|
146
|
-
blockers: blockersFor(operatorPhase),
|
|
147
|
-
commands: commandsFor(operatorPhase),
|
|
148
|
-
acceptance: ['No secrets, raw memory, personal data, account IDs, or local paths in public artifacts.', 'Operator acceptance blocker breakdown is zero before go-live.', 'Review findings are resolved or explicitly represented as blockers.'],
|
|
149
|
-
}),
|
|
150
|
-
buildLane({
|
|
151
|
-
id: 'final_verification',
|
|
152
|
-
role: 'Release verification lane',
|
|
153
|
-
model: 'automation plus reviewer',
|
|
154
|
-
charter: 'Rerun all current gates and regenerate status artifacts after external blockers clear.',
|
|
155
|
-
owns: ['release_audit', 'goal_audit', 'dependency_report', 'status_board'],
|
|
156
|
-
waits_for: ['gpt55_review', 'human_operator_credentials'],
|
|
157
|
-
blockers: blockersFor(finalPhase),
|
|
158
|
-
commands: commandsFor(finalPhase),
|
|
159
|
-
acceptance: ['npm run check passes.', 'npm test passes.', 'npm run release:audit passes with required_failed:[]', 'production:status reports launch_ready:true only with fresh current inputs.'],
|
|
160
|
-
}),
|
|
161
|
-
];
|
|
162
|
-
}
|
|
163
|
-
|
|
164
|
-
function buildWaves(statusBoard, lanes) {
|
|
165
|
-
const laneById = new Map(lanes.map((lane) => [lane.id, lane]));
|
|
166
|
-
return [
|
|
167
|
-
{
|
|
168
|
-
id: 'wave_1_external_access',
|
|
169
|
-
objective: 'Resolve external account and credential blockers without exposing secrets.',
|
|
170
|
-
lanes: ['human_operator_credentials'].filter((id) => laneById.has(id)),
|
|
171
|
-
acceptance: ['Cloudflare credentials are available only out-of-band and validated by production:cloudflare-credentials.'],
|
|
172
|
-
},
|
|
173
|
-
{
|
|
174
|
-
id: 'wave_2_architecture_and_coding',
|
|
175
|
-
objective: 'Architect, implement, and verify the next production-hardening slice against current blockers.',
|
|
176
|
-
lanes: ['gpt55_architecture', 'kimi_coding'].filter((id) => laneById.has(id)),
|
|
177
|
-
acceptance: ['Changed scripts/tests/docs pass targeted checks before review.'],
|
|
178
|
-
},
|
|
179
|
-
{
|
|
180
|
-
id: 'wave_3_review_and_acceptance',
|
|
181
|
-
objective: 'Review the implementation and complete operator acceptance evidence only with real hosted refs.',
|
|
182
|
-
lanes: ['gpt55_review'].filter((id) => laneById.has(id)),
|
|
183
|
-
acceptance: ['Operator acceptance remains blocked unless decision is go and blockers are zero.'],
|
|
184
|
-
},
|
|
185
|
-
{
|
|
186
|
-
id: 'wave_4_final_release',
|
|
187
|
-
objective: 'Rerun final gates and regenerate status after all external blockers clear.',
|
|
188
|
-
lanes: ['final_verification'].filter((id) => laneById.has(id)),
|
|
189
|
-
acceptance: ['production:status, production:dependencies, and goal audit all report launch_ready:true with fresh evidence.'],
|
|
190
|
-
},
|
|
191
|
-
];
|
|
192
|
-
}
|
|
193
|
-
|
|
194
|
-
export function buildAiOrchestrationPlan(inputs = {}, options = {}) {
|
|
195
|
-
const statusBoard = requireObject(inputs.statusBoard, 'production status board');
|
|
196
|
-
if (statusBoard.schema !== 'enigma.production_status_board.v1') throw new Error('production status board schema mismatch');
|
|
197
|
-
const lanes = buildRoleLanes(statusBoard);
|
|
198
|
-
const plan = {
|
|
199
|
-
schema: AI_ORCHESTRATION_PLAN_SCHEMA,
|
|
200
|
-
generated_at: options.generated_at ?? new Date().toISOString(),
|
|
201
|
-
status: statusBoard.launch_ready === true ? 'ready' : 'blocked',
|
|
202
|
-
launch_ready: statusBoard.launch_ready === true,
|
|
203
|
-
source_status_board_generated_at: statusBoard.generated_at ?? null,
|
|
204
|
-
source_status_next_phase_id: statusBoard.next_phase_id ?? null,
|
|
205
|
-
source_status_fresh_input_evidence: statusBoard.fresh_input_evidence === true,
|
|
206
|
-
next_phase_details: statusBoard.next_phase?.details ?? null,
|
|
207
|
-
orchestration_mode: 'human_secret_custody_plus_ai_architecture_coding_review',
|
|
208
|
-
role_lane_count: lanes.length,
|
|
209
|
-
wave_count: 4,
|
|
210
|
-
lanes,
|
|
211
|
-
waves: buildWaves(statusBoard, lanes),
|
|
212
|
-
non_delegable_controls: [
|
|
213
|
-
'Cloudflare token values, account ids, registrar purchases, payments, 2FA, CAPTCHAs, and legal approvals stay human-controlled unless explicitly and safely provided out-of-band.',
|
|
214
|
-
'No AI lane may mark the goal complete without fresh goal/dependency/workplan evidence and launch_ready:true.',
|
|
215
|
-
'No lane may paste secrets, personal information, raw memory, prompts, transcripts, provider responses, or private keys into public artifacts.',
|
|
216
|
-
],
|
|
217
|
-
claim_boundary: [
|
|
218
|
-
'This artifact orchestrates work from existing production status evidence; it does not invoke external AI systems, create accounts, deploy infrastructure, approve operators, or certify launch readiness.',
|
|
219
|
-
'Kimi/GPT role labels are execution lanes and review responsibilities, not proof that an external model has already performed the work.',
|
|
220
|
-
'Launch readiness remains false until status, dependency, goal, hosted, and operator evidence all prove readiness with fresh current inputs.',
|
|
221
|
-
],
|
|
222
|
-
};
|
|
223
|
-
assertPublicSafe(plan);
|
|
224
|
-
return plan;
|
|
225
|
-
}
|
|
226
|
-
|
|
227
|
-
export async function main(argv = process.argv.slice(2)) {
|
|
228
|
-
const args = parseArgs(argv);
|
|
229
|
-
if (args.help) return { text: usage(), status: 0 };
|
|
230
|
-
if (!args.statusBoard) throw new Error('--status-board is required');
|
|
231
|
-
const plan = buildAiOrchestrationPlan({ statusBoard: await readJson(args.statusBoard, 'production status board') });
|
|
232
|
-
const json = `${JSON.stringify(plan, null, 2)}\n`;
|
|
233
|
-
if (args.out) {
|
|
234
|
-
await mkdir(dirname(args.out), { recursive: true });
|
|
235
|
-
await writeFile(args.out, json, 'utf8');
|
|
236
|
-
}
|
|
237
|
-
return { text: json, status: plan.launch_ready ? 0 : 1 };
|
|
238
|
-
}
|
|
239
|
-
|
|
240
|
-
if (fileURLToPath(import.meta.url) === process.argv[1]) {
|
|
241
|
-
main().then(({ text, status }) => {
|
|
242
|
-
process.stdout.write(text);
|
|
243
|
-
process.exitCode = status;
|
|
244
|
-
}).catch((error) => {
|
|
245
|
-
process.stdout.write(`${JSON.stringify({ schema: AI_ORCHESTRATION_PLAN_SCHEMA, status: 'blocked', launch_ready: false, blockers: [error.message] }, null, 2)}\n`);
|
|
246
|
-
process.exitCode = 1;
|
|
247
|
-
});
|
|
248
|
-
}
|