Agents & applications
Alpha AGI Insight Follow an insight-generation scenario through its documented verification workflow.
Code & guide What to expect This directory includes code and documentation. Its guide defines dependencies, execution modes and what the results demonstrate.
Guides & runbooks 3
Registered commands 1 Environment setup ↗ Guided tour Inspect the sources Try it locally Architecture Complete library
A CLOSER LOOK
What does an insight exchange actually record and verify? For application builders: inspect insight scenarios, access-token behavior and the local contract evidence behind an exchange demonstration.
01 02 Follow the contract scenario Trace contract deployment and the insight exchange actions. The dedicated Hardhat configuration isolates the scenario from other demo contracts.
demo/alpha-agi-insight-mark/scripts/runDemo.ts ↗ Inspect this source ↓ 03
REAL REPOSITORY MATERIAL
Inspect. Understand. Reproduce. Reading the exact source at revision 5b4cebb3. This browser inspection does not execute the demo.
demo/alpha-agi-insight-mark/data/insight-scenarios.json
Select a walkthrough step to explore its source.
Show more fields ↓ Full source text {
"meta": {
"version": "1.0.0",
"source": "alpha-agi-insight-simulator"
},
"agents": [
"Meta-Sentinel",
"Thermodynamic Oracle",
"FusionSmith",
"Venture Cartographer",
"Guardian Auditor"
],
"scenarios": [
{
"sector": "Finance",
"thesis": "Self-directing AGI treasuries autonomously arbitrage every global market in milliseconds.",
"ruptureYear": 2027,
"sealedURI": "ipfs://alpha-agi-insight/finance/seed.json",
"fusionURI": "ipfs://alpha-agi-insight/finance/fusion.json",
"confidence": 0.91,
"forecastValue": "42T"
},
{
"sector": "Healthcare",
"thesis": "Cognitive wetlabs co-designed with AGI compress drug discovery cycles from years to hours.",
"ruptureYear": 2028,
"sealedURI": "ipfs://alpha-agi-insight/healthcare/seed.json",
"fusionURI": "ipfs://alpha-agi-insight/healthcare/fusion.json",
"confidence": 0.88,
"forecastValue": "17T"
},
{
"sector": "Energy",
"thesis": "Planetary energy grids self-orchestrate via AGI thermodynamic twins unlocking abundance.",
"ruptureYear": 2029,
"sealedURI": "ipfs://alpha-agi-insight/energy/seed.json",
"fusionURI": "ipfs://alpha-agi-insight/energy/fusion.json",
"confidence": 0.86,
"forecastValue": "11T"
}
]
}
SHA-256 0eb2254f82fb25ff1110cb3ed74c5f291ede24c1acf1e7a3cf73ff9f79608f63
The first source is shown in full. All walkthrough source links and the complete document library remain available without JavaScript.
{"revision":"5b4cebb309a83a7a6749d8911d8bf96a1921e042","sources":[{"file":"demo/alpha-agi-insight-mark/data/insight-scenarios.json","content":"{\n \"meta\": {\n \"version\": \"1.0.0\",\n \"source\": \"alpha-agi-insight-simulator\"\n },\n \"agents\": [\n \"Meta-Sentinel\",\n \"Thermodynamic Oracle\",\n \"FusionSmith\",\n \"Venture Cartographer\",\n \"Guardian Auditor\"\n ],\n \"scenarios\": [\n {\n \"sector\": \"Finance\",\n \"thesis\": \"Self-directing AGI treasuries autonomously arbitrage every global market in milliseconds.\",\n \"ruptureYear\": 2027,\n \"sealedURI\": \"ipfs://alpha-agi-insight/finance/seed.json\",\n \"fusionURI\": \"ipfs://alpha-agi-insight/finance/fusion.json\",\n \"confidence\": 0.91,\n \"forecastValue\": \"42T\"\n },\n {\n \"sector\": \"Healthcare\",\n \"thesis\": \"Cognitive wetlabs co-designed with AGI compress drug discovery cycles from years to hours.\",\n \"ruptureYear\": 2028,\n \"sealedURI\": \"ipfs://alpha-agi-insight/healthcare/seed.json\",\n \"fusionURI\": \"ipfs://alpha-agi-insight/healthcare/fusion.json\",\n \"confidence\": 0.88,\n \"forecastValue\": \"17T\"\n },\n {\n \"sector\": \"Energy\",\n \"thesis\": \"Planetary energy grids self-orchestrate via AGI thermodynamic twins unlocking abundance.\",\n \"ruptureYear\": 2029,\n \"sealedURI\": \"ipfs://alpha-agi-insight/energy/seed.json\",\n \"fusionURI\": \"ipfs://alpha-agi-insight/energy/fusion.json\",\n \"confidence\": 0.86,\n \"forecastValue\": \"11T\"\n }\n ]\n}\n","format":"json","sha256":"0eb2254f82fb25ff1110cb3ed74c5f291ede24c1acf1e7a3cf73ff9f79608f63","bytes":1342,"download":"/AGIJobsv0/examples/0eb2254f82fb25ff-insight-scenarios.json","source":"https://github.com/MontrealAI/AGIJobsv0/blob/5b4cebb309a83a7a6749d8911d8bf96a1921e042/demo/alpha-agi-insight-mark/data/insight-scenarios.json"},{"file":"demo/alpha-agi-insight-mark/scripts/runDemo.ts","content":"import { mkdir, writeFile, readFile, stat } from \"fs/promises\";\nimport path from \"path\";\nimport { createHash } from \"crypto\";\nimport { createInterface } from \"readline/promises\";\nimport { stdin as input, stdout as output } from \"process\";\n\nimport { ethers } from \"hardhat\";\nimport type { ContractTransactionReceipt, ContractTransactionResponse } from \"ethers\";\n\nimport type { AlphaInsightExchange, AlphaInsightNovaSeed, InsightAccessToken } from \"../typechain-types\";\n\ntype InsightScenario = {\n sector: string;\n thesis: string;\n ruptureYear: number;\n sealedURI: string;\n fusionURI: string;\n confidence: number;\n forecastValue: string;\n};\n\ntype ScenarioConfig = {\n meta: { version: string; source: string };\n agents: string[];\n scenarios: InsightScenario[];\n};\n\ntype OwnerSupremacyControl = {\n name: string;\n address: string;\n owner: string;\n sentinel: string | null;\n hooks: string[];\n};\n\ntype OwnerSupremacyCrossCheck = {\n mintedRecap: number;\n mintedLedger: number;\n mintedMatch: boolean;\n onchainOwnership: Array<{ tokenId: string; owner: string }>;\n treasuryBalance: string;\n sentinelPauses: number;\n ownerResumes: number;\n};\n\ntype OwnerSupremacyDossier = {\n generatedAt: string;\n network: { chainId: string; name: string };\n owner: string;\n sentinel: string;\n oracle: string;\n treasury: string;\n feeBps: number;\n controls: OwnerSupremacyControl[];\n crossChecks: OwnerSupremacyCrossCheck;\n assertions: string[];\n};\n\nconst reportsDir = path.join(__dirname, \"..\", \"reports\");\nconst defaultScenarioFile = path.join(__dirname, \"..\", \"data\", \"insight-scenarios.json\");\nconst ledgerFileName = \"insight-ledger.json\";\n\nfunction resolveScenarioFile(): string {\n const override = process.env.INSIGHT_MARK_SCENARIO_FILE;\n if (!override) {\n return defaultScenarioFile;\n }\n if (path.isAbsolute(override)) {\n return override;\n }\n return path.join(process.cwd(), override);\n}\n\nfunction toTimestamp(year: number): bigint {\n return BigInt(Math.floor(Date.UTC(year, 0, 1) / 1000));\n}\n\nfunction sha256(content: string | Buffer): string {\n const hash = createHash(\"sha256\");\n hash.update(content);\n return hash.digest(\"hex\");\n}\n\nfunction escapeHtml(input: string): string {\n return input\n .replace(/&/g, \"&\")\n .replace(/</g, \"<\")\n .replace(/>/g, \">\")\n .replace(/\"/g, \""\")\n .replace(/'/g, \"'\");\n}\n\nfunction shortenUri(uri: string, maxLength = 42): string {\n if (uri.length <= maxLength) {\n return uri;\n }\n const prefixLength = Math.floor((maxLength - 1) / 2);\n const suffixLength = maxLength - 1 - prefixLength;\n return `${uri.slice(0, prefixLength)}…${uri.slice(-suffixLength)}`;\n}\n\nfunction shortenAddress(address: string, prefix = 6, suffix = 4): string {\n if (address.length <= prefix + suffix + 1) {\n return address;\n }\n return `${address.slice(0, prefix)}…${address.slice(-suffix)}`;\n}\n\nfunction escapeMermaidLabel(label: string): string {\n return label.replace(/\"/g, '\\\"');\n}\n\nfunction toMermaidId(label: string, prefix: string): string {\n const sanitized = label.replace(/[^A-Za-z0-9]/g, \"_\");\n if (!sanitized.length) {\n return `${prefix}_${Math.random().toString(16).slice(2, 6)}`;\n }\n return `${prefix}_${sanitized}`;\n}\n\nfunction parseForecastValueTrillions(value: string): number {\n const trimmed = value.trim();\n const match = trimmed.match(/^([0-9]+(?:\\.[0-9]+)?)\\s*([TtMmBb]?)$/);\n if (!match) {\n return 0;\n }\n const amount = Number(match[1]);\n const unit = match[2]?.toUpperCase() ?? \"\";\n switch (unit) {\n case \"T\":\n return amount;\n case \"B\":\n return amount / 1000;\n case \"M\":\n return amount / 1_000_000;\n default:\n return amount;\n }\n}\n\nfunction transactionHash(\n tx: ContractTransactionResponse,\n receipt?: ContractTransactionReceipt | null,\n): string {\n return receipt?.hash ?? tx.hash;\n}\n\nfunction csvEscape(value: string | number | boolean | null | undefined): string {\n if (value === null || value === undefined) {\n return \"\";\n }\n const stringValue = String(value);\n if (/[\",\\n]/.test(stringValue)) {\n return `\"${stringValue.replace(/\"/g, '\"\"')}\"`;\n }\n return stringValue;\n}\n\nfunction formatPercent(value: number, decimals = 1): string {\n return `${(value * 100).toFixed(decimals)}%`;\n}\n\nfunction formatTitleCase(value: string): string {\n return value\n .toLowerCase()\n .split(/[_\\s]+/)\n .filter((segment) => segment.length > 0)\n .map((segment) => segment.charAt(0).toUpperCase() + segment.slice(1))\n .join(\" \");\n}\n\nfunction formatControlHook(name: string): string {\n switch (name) {\n case \"mint\":\n return \"`mint(address,uint256)`\";\n case \"pause\":\n return \"`pause()`\";\n case \"unpause\":\n return \"`unpause()`\";\n case \"setSystemPause\":\n return \"`setSystemPause(address)`\";\n case \"setMinter\":\n return \"`setMinter(address,bool)`\";\n case \"updateInsightDetails\":\n return \"`updateInsightDetails(tokenId,sector,thesis,timestamp,confidenceBps,forecastValue)`\";\n case \"revealFusionPlan\":\n return \"`revealFusionPlan(tokenId,uri)`\";\n case \"updateFusionPlan\":\n return \"`updateFusionPlan(tokenId,uri)`\";\n case \"setOracle\":\n return \"`setOracle(address)`\";\n case \"setTreasury\":\n return \"`setTreasury(address)`\";\n case \"setFeeBps\":\n return \"`setFeeBps(uint96)`\";\n case \"setPaymentToken\":\n return \"`setPaymentToken(address)`\";\n case \"updateListingPrice\":\n return \"`updateListingPrice(tokenId,newPrice)`\";\n case \"forceDelist\":\n return \"`forceDelist(tokenId,recipient)`\";\n default:\n return `\\`${name}(…)\\``;\n }\n}\n\nasync function loadScenarioConfig(scenarioPath: string): Promise<ScenarioConfig> {\n try {\n await stat(scenarioPath);\n } catch (error) {\n throw new Error(`Scenario file not found at ${scenarioPath}. Set INSIGHT_MARK_SCENARIO_FILE to a valid JSON file.`);\n }\n const raw = await readFile(scenarioPath, \"utf8\");\n return JSON.parse(raw) as ScenarioConfig;\n}\n\nasync function ensureReportsDir() {\n await mkdir(reportsDir, { recursive: true });\n}\n\ninterface AgentLogEntry {\n agent: string;\n message: string;\n timestamp: string;\n}\n\ninterface MintedInsightRecord {\n tokenId: string;\n scenario: InsightScenario;\n mintedTo: string;\n mintedBy: string;\n listed: boolean;\n status: \"HELD\" | \"LISTED\" | \"SOLD\" | \"FORCE_DELISTED\";\n listingPrice?: string;\n sale?: {\n buyer: string;\n price: string;\n fee: string;\n netPayout: string;\n transactionHash: string;\n };\n fusionRevealed: boolean;\n fusionURI: string;\n disruptionTimestamp: string;\n onchainVerified: boolean;\n ownerActions: string[];\n finalCustodian: string;\n confidenceBps: number;\n confidenceDecimal: number;\n confidencePercent: number;\n forecastValue: string;\n mintTxHash: string;\n listingTxHash?: string;\n repricingTxHashes: string[];\n forceDelistTxHash?: string;\n resolutionTxHash?: string;\n}\n\nasync function main() {\n await ensureReportsDir();\n const scenarioPath = resolveScenarioFile();\n const config = await loadScenarioConfig(scenarioPath);\n\n const dryRunFlag = (process.env.AGIJOBS_DEMO_DRY_RUN ?? \"true\").toLowerCase();\n const requireLaunchConfirmation = dryRunFlag === \"false\";\n\n if (requireLaunchConfirmation) {\n const rl = createInterface({ input, output });\n try {\n const confirmation = await rl.question(\n \"Launch confirmation required (AGIJOBS_DEMO_DRY_RUN=false). Type LAUNCH to continue: \"\n );\n if (confirmation.trim().toUpperCase() !== \"LAUNCH\") {\n throw new Error(\"Launch aborted by operator.\");\n }\n } finally {\n rl.close();\n }\n }\n\n const [operator, oracle, strategist, buyerA, buyerB] = await ethers.getSigners();\n const network = await ethers.provider.getNetwork();\n\n const expectedNetworkName = process.env.INSIGHT_MARK_NETWORK;\n if (expectedNetworkName && expectedNetworkName !== network.name) {\n throw new Error(\n `Network mismatch: expected ${expectedNetworkName} (INSIGHT_MARK_NETWORK) but connected to ${network.name}.`\n );\n }\n\n const expectedChainId = process.env.INSIGHT_MARK_CHAIN_ID;\n if (expectedChainId && expectedChainId !== network.chainId.toString()) {\n throw new Error(\n `Chain ID mismatch: expected ${expectedChainId} (INSIGHT_MARK_CHAIN_ID) but connected to ${network.chainId}.`\n );\n }\n\n const expectedOperator = process.env.INSIGHT_MARK_EXPECTED_OWNER?.toLowerCase();\n if (expectedOperator && expectedOperator !== operator.address.toLowerCase()) {\n throw new Error(\n `Owner mismatch: expected deployer ${process.env.INSIGHT_MARK_EXPECTED_OWNER} but signer[0] is ${operator.address}.`\n );\n }\n\n const AccessToken = await ethers.getContractFactory(\"InsightAccessToken\");\n const accessToken = (await AccessToken.deploy(operator.address)) as unknown as InsightAccessToken;\n await accessToken.waitForDeployment();\n\n const NovaSeed = await ethers.getContractFactory(\"AlphaInsightNovaSeed\");\n const novaSeed = (await NovaSeed.deploy(operator.address)) as unknown as AlphaInsightNovaSeed;\n await novaSeed.waitForDeployment();\n\n const Exchange = await ethers.getContractFactory(\"AlphaInsightExchange\");\n const exchange = (await Exchange.deploy(operator.address, novaSeed, accessToken, operator.address, 500)) as unknown as AlphaInsightExchange;\n await exchange.waitForDeployment();\n\n await exchange.setOracle(oracle.address);\n await novaSeed.setMinter(operator.address, true);\n await novaSeed.setMinter(oracle.address, true);\n await accessToken.setSystemPause(strategist.address);\n await novaSeed.setSystemPause(strategist.address);\n await exchange.setSystemPause(strategist.address);\n\n const settlementTokenAddress = await accessToken.getAddress();\n const novaSeedAddress = await novaSeed.getAddress();\n const exchangeAddress = await exchange.getAddress();\n const accessTokenSystemPause = await accessToken.systemPause();\n const novaSeedSystemPause = await novaSeed.systemPause();\n const exchangeSystemPause = await exchange.systemPause();\n const exchangeTreasury = await exchange.treasury();\n const exchangeFeeBps = await exchange.feeBps();\n const exchangeFeeBpsNumber = Number(exchangeFeeBps);\n const exchangeFeePercentDisplay = (exchangeFeeBpsNumber / 100).toFixed(2);\n\n const telemetry: AgentLogEntry[] = [];\n const minted: MintedInsightRecord[] = [];\n const sentinelPauseTransactions: { contract: string; address: string; hash: string }[] = [];\n const ownerResumeTransactions: { contract: string; address: string; hash: string }[] = [];\n\n function addressEquals(a: string, b: string): boolean {\n return a.toLowerCase() === b.toLowerCase();\n }\n\n function governanceCustodianTitle(address: string): string {\n if (addressEquals(address, operator.address)) {\n return \"Operator Treasury\";\n }\n if (addressEquals(address, strategist.address)) {\n return \"System Pause Sentinel\";\n }\n if (addressEquals(address, oracle.address)) {\n return \"Insight Oracle\";\n }\n if (addressEquals(address, buyerA.address)) {\n return \"Alpha Capital Desk\";\n }\n if (addressEquals(address, buyerB.address)) {\n return \"Liquidity Reserve\";\n }\n return \"Custodian\";\n }\n\n function governanceCustodianLabel(address: string): string {\n return `${governanceCustodianTitle(address)}\\\\n${shortenAddress(address)}`;\n }\n\n function log(agent: string, message: string) {\n const entry: AgentLogEntry = { agent, message, timestamp: new Date().toISOString() };\n telemetry.push(entry);\n console.log(`🤖 [${agent}] ${message}`);\n }\n\n log(\"Guardian Auditor\", `SystemPause sentinel anchored to ${strategist.address} for cross-contract halts.`);\n log(\"Meta-Sentinel\", \"Initialising α-AGI Insight MARK deployment lattice.\");\n log(\n \"MATS Engine\",\n \"Meta-Agentic Tree Search (NSGA-II) swarm bootstrapped – generating Pareto-efficient foresight strategies.\"\n );\n log(\n \"Thermodynamic Trigger\",\n \"Monitoring AGI capability index T_AGI across disruption domains for imminent phase transitions.\"\n );\n\n const scenarioAllocations = [\n { minter: operator, receiver: operator },\n { minter: oracle, receiver: oracle },\n { minter: operator, receiver: strategist },\n ];\n\n const priceSchedule = [ethers.parseUnits(\"250\", 18), ethers.parseUnits(\"180\", 18), ethers.parseUnits(\"420\", 18)];\n\n for (let i = 0; i < config.scenarios.length; i += 1) {\n const scenario = config.scenarios[i];\n const { minter, receiver } = scenarioAllocations[i] ?? scenarioAllocations[0];\n\n log(\n \"Thermodynamic Oracle\",\n `Evaluating ${scenario.sector} rupture – confidence ${(scenario.confidence * 100).toFixed(1)}%.`\n );\n log(\n \"MATS Engine\",\n `Pareto frontier surfaced ${scenario.sector} vector at ${(scenario.confidence * 100).toFixed(1)}% certainty.`\n );\n\n const boundedConfidence = Math.min(Math.max(scenario.confidence, 0), 1);\n const confidenceBps = Math.round(boundedConfidence * 10_000);\n\n const tx = await novaSeed\n .connect(minter)\n .mintInsight(receiver.address, {\n sector: scenario.sector,\n thesis: scenario.thesis,\n disruptionTimestamp: toTimestamp(scenario.ruptureYear),\n sealedURI: scenario.sealedURI,\n confidenceBps,\n forecastValue: scenario.forecastValue,\n });\n const receipt = await tx.wait();\n if (receipt?.status !== 1n && receipt?.status !== 1) {\n throw new Error(`Mint transaction for ${scenario.sector} failed`);\n }\n const mintTxHash = transactionHash(tx, receipt);\n\n const mintedId = (await novaSeed.nextTokenId()) - 1n;\n log(\"FusionSmith\", `Seed ${mintedId.toString()} forged for ${scenario.sector}.`);\n\n let fusionRevealed = false;\n let activeFusionURI = scenario.sealedURI;\n const ownerActions: string[] = [];\n let finalCustodian = receiver.address;\n let listingTxHash: string | undefined;\n const repricingTxHashes: string[] = [];\n let forceDelistTxHash: string | undefined;\n let resolutionTxHash: string | undefined;\n if (i === 0) {\n await novaSeed.revealFusionPlan(mintedId, scenario.fusionURI);\n fusionRevealed = true;\n activeFusionURI = scenario.fusionURI;\n log(\"Guardian Auditor\", `Fusion plan for token ${mintedId.toString()} revealed under owner control.`);\n\n const revisionedFusionURI = `${scenario.fusionURI}?revision=2`;\n await novaSeed.updateFusionPlan(mintedId, revisionedFusionURI);\n activeFusionURI = revisionedFusionURI;\n log(\"Guardian Auditor\", `Fusion dossier for token ${mintedId.toString()} retargeted to ${revisionedFusionURI}.`);\n }\n\n const price = priceSchedule[i] ?? priceSchedule[0];\n let status: MintedInsightRecord[\"status\"] = \"HELD\";\n let sale: MintedInsightRecord[\"sale\"] | undefined;\n let listingPrice: string | undefined;\n\n if (i < 2) {\n await novaSeed.connect(receiver).approve(exchangeAddress, mintedId);\n const listTx = await exchange.connect(receiver).listInsight(mintedId, price);\n const listReceipt = await listTx.wait();\n listingTxHash = transactionHash(listTx, listReceipt);\n status = \"LISTED\";\n listingPrice = ethers.formatUnits(price, 18);\n log(\"Venture Cartographer\", `Token ${mintedId.toString()} listed on α-AGI MARK at ${listingPrice} AIC.`);\n\n if (i === 0) {\n const repriced = price - ethers.parseUnits(\"10\", 18);\n const repriceTx = await exchange.connect(receiver).updateListingPrice(mintedId, repriced);\n const repriceReceipt = await repriceTx.wait();\n repricingTxHashes.push(transactionHash(repriceTx, repriceReceipt));\n const listingState = await exchange.listing(mintedId);\n listingPrice = ethers.formatUnits(listingState.price, 18);\n ownerActions.push(`Seller repriced to ${listingPrice} AIC`);\n log(\n \"Venture Cartographer\",\n `Token ${mintedId.toString()} repriced by seller to ${listingPrice} AIC for strategic acceleration.`\n );\n }\n\n if (i === 1) {\n const adjustedPrice = price + ethers.parseUnits(\"15\", 18);\n const ownerRepriceTx = await exchange.updateListingPrice(mintedId, adjustedPrice);\n const ownerRepriceReceipt = await ownerRepriceTx.wait();\n repricingTxHashes.push(transactionHash(ownerRepriceTx, ownerRepriceReceipt));\n const listingState = await exchange.listing(mintedId);\n listingPrice = ethers.formatUnits(listingState.price, 18);\n ownerActions.push(`Owner repriced to ${listingPrice} AIC`);\n log(\"Guardian Auditor\", `Owner repriced token ${mintedId.toString()} to ${listingPrice} AIC for governance alignment.`);\n }\n\n if (i === 0) {\n await accessToken.mint(buyerA.address, ethers.parseUnits(\"1000\", 18));\n await accessToken.connect(buyerA).approve(exchangeAddress, ethers.parseUnits(\"1000\", 18));\n const listingState = await exchange.listing(mintedId);\n const buyTx = await exchange.connect(buyerA).buyInsight(mintedId);\n const buyReceipt = await buyTx.wait();\n const clearedPrice = listingState.price;\n const fee = (clearedPrice * exchangeFeeBps) / 10_000n;\n const net = clearedPrice - fee;\n sale = {\n buyer: buyerA.address,\n price: ethers.formatUnits(clearedPrice, 18),\n fee: ethers.formatUnits(fee, 18),\n netPayout: ethers.formatUnits(net, 18),\n transactionHash: transactionHash(buyTx, buyReceipt),\n };\n status = \"SOLD\";\n finalCustodian = buyerA.address;\n log(\n \"Meta-Sentinel\",\n `Token ${mintedId.toString()} acquired by ${buyerA.address}. Net payout ${ethers.formatUnits(net, 18)} AIC.`\n );\n const resolveTx = await exchange.resolvePrediction(\n mintedId,\n true,\n `${scenario.sector} rupture confirmed by insight engine.`,\n );\n const resolveReceipt = await resolveTx.wait();\n resolutionTxHash = transactionHash(resolveTx, resolveReceipt);\n } else if (i === 1) {\n const forceTx = await exchange.forceDelist(mintedId, strategist.address);\n const forceReceipt = await forceTx.wait();\n forceDelistTxHash = transactionHash(forceTx, forceReceipt);\n ownerActions.push(`Owner force-delisted to ${strategist.address}`);\n finalCustodian = strategist.address;\n status = \"FORCE_DELISTED\";\n listingPrice = undefined;\n log(\n \"System Sentinel\",\n `Owner executed force delist for token ${mintedId.toString()} sending custody to sentinel ${strategist.address}.`\n );\n }\n }\n\n const onchain = await novaSeed.getInsight(mintedId);\n if (onchain.sector !== scenario.sector || onchain.thesis !== scenario.thesis) {\n throw new Error(`On-chain insight metadata mismatch for token ${mintedId.toString()}.`);\n }\n if (onchain.disruptionTimestamp !== toTimestamp(scenario.ruptureYear)) {\n throw new Error(`Disruption timestamp mismatch for token ${mintedId.toString()}.`);\n }\n if (onchain.fusionURI !== activeFusionURI) {\n throw new Error(`Fusion URI mismatch for token ${mintedId.toString()}.`);\n }\n if (onchain.fusionRevealed !== fusionRevealed) {\n throw new Error(`Fusion reveal state mismatch for token ${mintedId.toString()}.`);\n }\n\n const onchainConfidenceBps = Number(onchain.confidenceBps);\n if (onchainConfidenceBps !== confidenceBps) {\n throw new Error(`Confidence basis points mismatch for token ${mintedId.toString()}.`);\n }\n if (onchain.forecastValue !== scenario.forecastValue) {\n throw new Error(`Forecast value mismatch for token ${mintedId.toString()}.`);\n }\n const confidenceDecimal = onchainConfidenceBps / 10_000;\n const confidencePercent = Number((confidenceDecimal * 100).toFixed(2));\n\n minted.push({\n tokenId: mintedId.toString(),\n scenario,\n mintedTo: receiver.address,\n mintedBy: minter.address,\n listed: status !== \"HELD\",\n status,\n listingPrice,\n sale,\n fusionRevealed,\n fusionURI: activeFusionURI,\n disruptionTimestamp: toTimestamp(scenario.ruptureYear).toString(),\n onchainVerified: true,\n ownerActions,\n finalCustodian,\n confidenceBps: onchainConfidenceBps,\n confidenceDecimal,\n confidencePercent,\n forecastValue: onchain.forecastValue,\n mintTxHash,\n listingTxHash,\n repricingTxHashes,\n forceDelistTxHash,\n resolutionTxHash,\n });\n }\n\n await accessToken.mint(buyerB.address, ethers.parseUnits(\"800\", 18));\n await accessToken.connect(buyerB).approve(exchangeAddress, ethers.parseUnits(\"800\", 18));\n log(\"Guardian Auditor\", \"Liquidity buffers provisioned for additional foresight acquisitions.\");\n\n log(\"System Sentinel\", \"Triggering cross-contract pause sweep via delegated sentinel.\");\n const exchangePauseTx = await exchange.connect(strategist).pause();\n const exchangePauseReceipt = await exchangePauseTx.wait();\n sentinelPauseTransactions.push({\n contract: \"AlphaInsightExchange\",\n address: exchangeAddress,\n hash: transactionHash(exchangePauseTx, exchangePauseReceipt),\n });\n const novaPauseTx = await novaSeed.connect(strategist).pause();\n const novaPauseReceipt = await novaPauseTx.wait();\n sentinelPauseTransactions.push({\n contract: \"AlphaInsightNovaSeed\",\n address: novaSeedAddress,\n hash: transactionHash(novaPauseTx, novaPauseReceipt),\n });\n const tokenPauseTx = await accessToken.connect(strategist).pause();\n const tokenPauseReceipt = await tokenPauseTx.wait();\n sentinelPauseTransactions.push({\n contract: \"InsightAccessToken\",\n address: settlementTokenAddress,\n hash: transactionHash(tokenPauseTx, tokenPauseReceipt),\n });\n log(\"System Sentinel\", \"Emergency pause executed. Awaiting owner clearance.\");\n\n const exchangeUnpauseTx = await exchange.unpause();\n const exchangeUnpauseReceipt = await exchangeUnpauseTx.wait();\n ownerResumeTransactions.push({\n contract: \"AlphaInsightExchange\",\n address: exchangeAddress,\n hash: transactionHash(exchangeUnpauseTx, exchangeUnpauseReceipt),\n });\n const novaUnpauseTx = await novaSeed.unpause();\n const novaUnpauseReceipt = await novaUnpauseTx.wait();\n ownerResumeTransactions.push({\n contract: \"AlphaInsightNovaSeed\",\n address: novaSeedAddress,\n hash: transactionHash(novaUnpauseTx, novaUnpauseReceipt),\n });\n const tokenUnpauseTx = await accessToken.unpause();\n const tokenUnpauseReceipt = await tokenUnpauseTx.wait();\n ownerResumeTransactions.push({\n contract: \"InsightAccessToken\",\n address: settlementTokenAddress,\n hash: transactionHash(tokenUnpauseTx, tokenUnpauseReceipt),\n });\n log(\"Meta-Sentinel\", \"Owner restored foresight lattice following sentinel drill.\");\n\n const recapPath = path.join(reportsDir, \"insight-recap.json\");\n const reportPath = path.join(reportsDir, \"insight-report.md\");\n const matrixPath = path.join(reportsDir, \"insight-control-matrix.json\");\n const mermaidPath = path.join(reportsDir, \"insight-control-map.mmd\");\n const governancePath = path.join(reportsDir, \"insight-governance.mmd\");\n const superintelligencePath = path.join(reportsDir, \"insight-superintelligence.mmd\");\n const telemetryPath = path.join(reportsDir, \"insight-telemetry.log\");\n const htmlPath = path.join(reportsDir, \"insight-report.html\");\n const ownerBriefPath = path.join(reportsDir, \"insight-owner-brief.md\");\n const safetyChecklistPath = path.join(reportsDir, \"insight-safety-checklist.md\");\n const csvPath = path.join(reportsDir, \"insight-market-matrix.csv\");\n const constellationPath = path.join(reportsDir, \"insight-constellation.mmd\");\n const agencyOrbitPath = path.join(reportsDir, \"insight-agency-orbit.mmd\");\n const lifecyclePath = path.join(reportsDir, \"insight-lifecycle.mmd\");\n const ledgerPath = path.join(reportsDir, ledgerFileName);\n const ownerSupremacyPath = path.join(reportsDir, \"insight-owner-supremacy.json\");\n const ownerLatticePath = path.join(reportsDir, \"insight-owner-lattice.mmd\");\n const manifestPath = path.join(reportsDir, \"insight-manifest.json\");\n\n const scenarioRelativePath = path\n .relative(path.join(__dirname, \"..\"), scenarioPath)\n .replace(/\\\\/g, \"/\");\n const scenarioHash = sha256(await readFile(scenarioPath));\n\n const onchainOwnership = await Promise.all(\n minted.map(async (entry) => {\n const ownerAddress = await novaSeed.ownerOf(BigInt(entry.tokenId));\n if (!addressEquals(ownerAddress, entry.finalCustodian)) {\n throw new Error(\n `Custody mismatch for token ${entry.tokenId}: recorded ${entry.finalCustodian}, on-chain ${ownerAddress}.`\n );\n }\n return { tokenId: entry.tokenId, owner: ownerAddress };\n }),\n );\n\n const treasuryBalanceRaw = await accessToken.balanceOf(exchangeTreasury);\n const treasuryBalance = ethers.formatUnits(treasuryBalanceRaw, 18);\n\n const mintedByOwnerCount = minted.filter((entry) => entry.mintedBy.toLowerCase() === operator.address.toLowerCase()).length;\n const delegatedMintCount = minted.length - mintedByOwnerCount;\n const soldCount = minted.filter((entry) => entry.status === \"SOLD\").length;\n const listedCount = minted.filter((entry) => entry.status === \"LISTED\").length;\n const forceDelistedCount = minted.filter((entry) => entry.status === \"FORCE_DELISTED\").length;\n const sealedCount = minted.filter((entry) => !entry.fusionRevealed).length;\n const revealedCount = minted.length - sealedCount;\n\n const mintedTotalConfidenceDecimal = minted.reduce((acc, entry) => acc + entry.confidenceDecimal, 0);\n const averageConfidenceDecimal = minted.length ? mintedTotalConfidenceDecimal / minted.length : 0;\n\n const totalForecastTrillions = minted.reduce(\n (acc, entry) => acc + parseForecastValueTrillions(entry.forecastValue ?? \"0\"),\n 0\n );\n const peakConfidenceDecimal = minted.reduce((acc, entry) => Math.max(acc, entry.confidenceDecimal), 0);\n const floorConfidenceDecimal = minted.reduce(\n (acc, entry) => Math.min(acc, entry.confidenceDecimal),\n minted.length ? minted[0].confidenceDecimal : 0\n );\n const agiCapabilityIndexDecimal = minted.length\n ? averageConfidenceDecimal * 0.6 + peakConfidenceDecimal * 0.4\n : 0;\n const capabilityPercent = Math.round(agiCapabilityIndexDecimal * 100);\n const peakPercent = Math.round(peakConfidenceDecimal * 100);\n const floorPercent = Math.round(floorConfidenceDecimal * 100);\n const totalForecastDisplay = `${totalForecastTrillions.toFixed(2)}T`;\n const forecastValuePrecise = Number(totalForecastTrillions.toFixed(2));\n const averageConfidencePercent = Number((averageConfidenceDecimal * 100).toFixed(2));\n const capabilityPercentPrecise = Number((agiCapabilityIndexDecimal * 100).toFixed(2));\n const peakPercentPrecise = Number((peakConfidenceDecimal * 100).toFixed(2));\n const floorPercentPrecise = Number((floorConfidenceDecimal * 100).toFixed(2));\n\n const mintedStats = {\n minted: minted.length,\n mintedByOwner: mintedByOwnerCount,\n mintedByDelegates: delegatedMintCount,\n sold: soldCount,\n listed: listedCount,\n forceDelisted: forceDelistedCount,\n sealed: sealedCount,\n revealed: revealedCount,\n averageConfidencePercent,\n capabilityIndexPercent: capabilityPercentPrecise,\n confidenceFloorPercent: floorPercentPrecise,\n confidencePeakPercent: peakPercentPrecise,\n forecastValueTrillions: forecastValuePrecise,\n telemetryEntries: telemetry.length,\n };\n\n const averageConfidenceSummary = averageConfidencePercent.toFixed(1);\n const capabilityPercentSummary = capabilityPercentPrecise.toFixed(1);\n const confidenceFloorSummary = floorPercentPrecise.toFixed(1);\n const confidencePeakSummary = peakPercentPrecise.toFixed(1);\n const marketStatusSummary = `${soldCount} sold, ${listedCount} listed, ${forceDelistedCount} sentinel custody`;\n const fusionPlanSummary = `${revealedCount} revealed, ${sealedCount} sealed`;\n\n const recap = {\n generatedAt: new Date().toISOString(),\n network: { chainId: network.chainId.toString(), name: network.name },\n contracts: {\n novaSeed: novaSeedAddress,\n foresightExchange: exchangeAddress,\n settlementToken: settlementTokenAddress,\n },\n scenarioSource: {\n path: scenarioRelativePath,\n sha256: scenarioHash,\n },\n operator: operator.address,\n oracle: oracle.address,\n systemPause: strategist.address,\n treasury: exchangeTreasury,\n feeBps: exchangeFeeBpsNumber,\n stats: mintedStats,\n minted,\n telemetry,\n };\n\n const tableRows = minted\n .map((entry) => {\n const saleDetails = entry.sale\n ? `${entry.sale.price} AIC → net ${entry.sale.netPayout} AIC`\n : entry.status === \"LISTED\"\n ? entry.listingPrice\n ? `Listed @ ${entry.listingPrice} AIC`\n : \"Listed\"\n : entry.status === \"FORCE_DELISTED\"\n ? `Force delisted to ${shortenAddress(entry.finalCustodian)}`\n : \"Held by operator\";\n const fusionStatus = entry.fusionRevealed\n ? `Revealed ↦ ${shortenUri(entry.fusionURI)}`\n : `Sealed ↦ ${shortenUri(entry.fusionURI)}`;\n const ownerNotes = entry.ownerActions.length ? entry.ownerActions.join(\"; \") : \"—\";\n const custodian = shortenAddress(entry.finalCustodian ?? entry.mintedTo);\n const confidenceDisplay = `${entry.confidencePercent.toFixed(1)}%`;\n return `| ${entry.tokenId} | ${entry.scenario.sector} | ${entry.scenario.ruptureYear} | ${confidenceDisplay} | ${entry.forecastValue} | ${entry.scenario.thesis} | ${fusionStatus} | ${entry.status} | ${saleDetails} | ${custodian} | ${ownerNotes} |`;\n })\n .join(\"\\n\");\n\n const markdown = `# α-AGI Insight MARK Recap\\n\\n` +\n `**Network:** ${network.name} (chainId ${network.chainId})\\\\\\n` +\n `**Operator:** ${operator.address}\\\\\\n` +\n `**Oracle:** ${oracle.address}\\\\\\n` +\n `**System Pause Sentinel:** ${strategist.address}\\\\\\n` +\n `**Fee:** ${exchangeFeePercentDisplay}%\\\\\\n` +\n `**Treasury:** ${exchangeTreasury}\\\\\\n\\n` +\n `## Superintelligent Engine Summary\\n` +\n `- Meta-Agentic Tree Search agents engaged: ${config.agents.join(\", \")}.\\\\\\n` +\n `- Composite AGI capability index (weighted): ${(agiCapabilityIndexDecimal * 100).toFixed(1)}%.\\\\\\n` +\n `- Confidence band: min ${(floorConfidenceDecimal * 100).toFixed(1)}% → max ${(peakConfidenceDecimal * 100).toFixed(1)}%.\\\\\\n` +\n `- Portfolio forecast value: ${totalForecastTrillions.toFixed(2)}T equivalent.\\\\\\n` +\n `- Scenario dataset fingerprint: ${scenarioHash}.\\\\\\n\\n` +\n `## Operational Command Metrics\\n` +\n `- Minted insights: ${minted.length} (owner minted ${mintedByOwnerCount}, delegated minted ${delegatedMintCount}).\\\\\\n` +\n `- Market state: ${marketStatusSummary}.\\\\\\n` +\n `- Fusion dossiers: ${fusionPlanSummary}.\\\\\\n` +\n `- Confidence band: ${confidenceFloorSummary}% → ${confidencePeakSummary}% (avg ${averageConfidenceSummary}%).\\\\\\n` +\n `- Forecast value tokenised: ${forecastValuePrecise.toFixed(2)}T.\\\\\\n\\n` +\n `## Foresight Portfolio Ledger\\n` +\n `| Token | Sector | Rupture Year | Confidence | Forecast Value | Thesis | Fusion Plan | Status | Market State | Custodian | Owner Controls |\\n| --- | --- | --- | --- | --- | --- | --- | --- | --- | --- | --- |\\n${tableRows}\\n\\n` +\n `## Owner Command Hooks\\n- Owner may pause tokens, exchange, and settlement token immediately.\\n- Oracle address (${oracle.address}) can resolve predictions without redeploying contracts.\\n- Treasury destination configurable via \\`setTreasury\\`.\\n- Sentinel (${strategist.address}) authorised through \\`setSystemPause\\` to trigger emergency halts across modules.\\n- Retune disruption metadata and forecasts via \\`updateInsightDetails(tokenId, sector, thesis, timestamp, confidenceBps, forecastValue)\\`.\\n- Listings can be repriced live with \\`updateListingPrice\\` (owner override supported).\\n- Owner may invoke \\`forceDelist\\` to evacuate foresight assets to a safe wallet instantly.\\n\\n` +\n `## Scenario Dataset\\n- Config file: ${scenarioRelativePath}\\\\\\n- SHA-256: ${scenarioHash}\\n\\n` +\n `## Telemetry Snapshot\\n` +\n telemetry\n .map((entry) => `- ${entry.timestamp} — **${entry.agent}**: ${entry.message}`)\n .join(\"\\n\") +\n \"\\n\";\n\n const sortedByRupture = [...minted].sort((a, b) => a.scenario.ruptureYear - b.scenario.ruptureYear);\n const timelineStart = sortedByRupture[0]?.scenario.ruptureYear ?? 0;\n const timelineEnd = sortedByRupture.at(-1)?.scenario.ruptureYear ?? timelineStart;\n const timelineSpan = Math.max(1, timelineEnd - timelineStart);\n\n const htmlRows = sortedByRupture\n .map((entry) => {\n const confidencePercent = Math.round(entry.confidencePercent);\n const confidenceLabel = `${entry.confidencePercent.toFixed(1)}%`;\n const saleDetails =\n entry.sale\n ? `${escapeHtml(entry.sale.price)} AIC → net ${escapeHtml(entry.sale.netPayout)} AIC`\n : entry.status === \"LISTED\"\n ? entry.listingPrice\n ? `Listed @ ${escapeHtml(entry.listingPrice)} AIC`\n : \"Listed\"\n : entry.status === \"FORCE_DELISTED\"\n ? `Force delisted to ${escapeHtml(shortenAddress(entry.finalCustodian))}`\n : \"Held by operator\";\n const fusionStatus = entry.fusionRevealed\n ? `Revealed ↦ ${escapeHtml(shortenUri(entry.fusionURI))}`\n : `Sealed ↦ ${escapeHtml(shortenUri(entry.fusionURI))}`;\n const ownerNotes = entry.ownerActions.length\n ? entry.ownerActions.map((note) => escapeHtml(note)).join(\"<br />\")\n : \"—\";\n const custodianDisplay = escapeHtml(shortenAddress(entry.finalCustodian ?? entry.mintedTo));\n return ` <tr>\n <td>${escapeHtml(entry.tokenId)}</td>\n <td>${escapeHtml(entry.scenario.sector)}</td>\n <td>${entry.scenario.ruptureYear}</td>\n <td>${escapeHtml(entry.scenario.thesis)}</td>\n <td>\n <div class=\"confidence-bar\">\n <div class=\"confidence-fill\" style=\"width:${confidencePercent}%\"></div>\n <span>${confidenceLabel}</span>\n </div>\n </td>\n <td>${escapeHtml(entry.forecastValue)}</td>\n <td>${fusionStatus}</td>\n <td>${escapeHtml(entry.status)}</td>\n <td>${saleDetails}</td>\n <td>${custodianDisplay}</td>\n <td>${ownerNotes}</td>\n </tr>`;\n })\n .join(\"\\n\");\n\n const timelineMarks = sortedByRupture\n .map((entry) => {\n const offset = timelineSpan === 0 ? 0 : ((entry.scenario.ruptureYear - timelineStart) / timelineSpan) * 100;\n const confidencePercent = Math.round(entry.confidencePercent);\n return ` <div class=\"timeline-node\" style=\"left:${offset}%\">\n <div class=\"timeline-node__label\">${escapeHtml(entry.scenario.sector)}</div>\n <div class=\"timeline-node__year\">${entry.scenario.ruptureYear}</div>\n <div class=\"timeline-node__confidence\">${confidencePercent}% confidence</div>\n </div>`;\n })\n .join(\"\\n\");\n\n const scenarioHashShort = `${scenarioHash.substring(0, 16)}…`;\n\n const html = `<!DOCTYPE html>\n<html lang=\"en\">\n <head>\n <meta charset=\"utf-8\" />\n <title>α-AGI Insight MARK Executive Report</title>\n <style>\n :root {\n color-scheme: dark;\n font-family: 'Inter', 'Segoe UI', system-ui, -apple-system, sans-serif;\n background: #030712;\n color: #e8f1ff;\n }\n body {\n margin: 0;\n padding: 32px 24px 48px;\n }\n h1 {\n font-size: 2.5rem;\n margin-bottom: 0.25rem;\n }\n h2 {\n margin-top: 2.5rem;\n margin-bottom: 1rem;\n font-size: 1.5rem;\n }\n p, li {\n line-height: 1.6;\n }\n .meta-grid {\n display: grid;\n gap: 0.5rem 1.5rem;\n grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));\n margin: 1.5rem 0;\n padding: 1.5rem;\n border-radius: 18px;\n background: linear-gradient(135deg, rgba(51, 141, 255, 0.2), rgba(166, 86, 255, 0.08));\n border: 1px solid rgba(146, 214, 255, 0.2);\n }\n .meta-grid__item {\n display: flex;\n flex-direction: column;\n gap: 0.35rem;\n }\n .meta-grid__label {\n font-size: 0.75rem;\n letter-spacing: 0.08em;\n text-transform: uppercase;\n color: rgba(206, 234, 255, 0.7);\n }\n .meta-grid__value {\n font-size: 1.05rem;\n word-break: break-all;\n }\n table {\n width: 100%;\n border-collapse: collapse;\n margin-top: 1.5rem;\n font-size: 0.95rem;\n }\n thead {\n background: rgba(31, 64, 128, 0.4);\n }\n th, td {\n padding: 0.75rem 0.85rem;\n border-bottom: 1px solid rgba(71, 116, 194, 0.35);\n vertical-align: top;\n text-align: left;\n }\n tbody tr:hover {\n background: rgba(41, 71, 145, 0.25);\n }\n .confidence-bar {\n position: relative;\n width: 100%;\n height: 18px;\n border-radius: 12px;\n background: rgba(22, 40, 86, 0.65);\n overflow: hidden;\n }\n .confidence-fill {\n position: absolute;\n inset: 0;\n background: linear-gradient(90deg, #3ddff5, #9178ff);\n }\n .confidence-bar span {\n position: absolute;\n inset: 0;\n display: grid;\n place-items: center;\n font-weight: 600;\n color: #021321;\n }\n .engine {\n margin: 2rem 0;\n padding: 1.75rem;\n border-radius: 22px;\n background: linear-gradient(135deg, rgba(34, 95, 183, 0.45), rgba(116, 70, 208, 0.28));\n border: 1px solid rgba(129, 205, 255, 0.3);\n box-shadow: 0 24px 64px rgba(12, 25, 68, 0.55);\n }\n .engine__intro {\n margin-bottom: 1.25rem;\n max-width: 960px;\n }\n .engine__gauges {\n display: grid;\n gap: 1.25rem;\n grid-template-columns: repeat(auto-fit, minmax(240px, 1fr));\n }\n .gauge {\n position: relative;\n padding: 1.15rem 1.35rem 1.5rem;\n border-radius: 18px;\n background: rgba(10, 27, 64, 0.55);\n border: 1px solid rgba(146, 214, 255, 0.35);\n overflow: hidden;\n }\n .gauge__label {\n font-size: 0.8rem;\n letter-spacing: 0.12em;\n text-transform: uppercase;\n color: rgba(198, 229, 255, 0.7);\n margin-bottom: 0.75rem;\n }\n .gauge__bar {\n position: relative;\n height: 14px;\n border-radius: 12px;\n background: rgba(22, 40, 86, 0.7);\n overflow: hidden;\n }\n .gauge__fill {\n position: absolute;\n top: 0;\n left: 0;\n height: 100%;\n background: linear-gradient(90deg, #48e8ff, #9d7bff);\n box-shadow: 0 0 16px rgba(132, 246, 255, 0.55);\n }\n .gauge__value {\n margin-top: 0.75rem;\n font-size: 1.35rem;\n font-weight: 600;\n }\n .gauge__meta {\n font-size: 0.85rem;\n color: rgba(198, 229, 255, 0.75);\n }\n .gauge--forecast {\n background: rgba(27, 12, 64, 0.55);\n border: 1px solid rgba(193, 172, 255, 0.35);\n }\n .engine__agents {\n margin-top: 1.5rem;\n display: flex;\n flex-wrap: wrap;\n gap: 0.5rem;\n }\n .engine__agent {\n padding: 0.45rem 0.85rem;\n border-radius: 999px;\n background: rgba(30, 71, 155, 0.55);\n border: 1px solid rgba(135, 217, 255, 0.35);\n font-size: 0.85rem;\n }\n .metrics {\n margin: 2rem 0;\n }\n .metrics-grid {\n display: grid;\n gap: 1.35rem;\n grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));\n }\n .metric-card {\n padding: 1.25rem 1.5rem;\n border-radius: 18px;\n background: linear-gradient(135deg, rgba(24, 58, 131, 0.55), rgba(91, 43, 168, 0.35));\n border: 1px solid rgba(141, 206, 255, 0.35);\n box-shadow: 0 18px 44px rgba(8, 18, 54, 0.55);\n display: flex;\n flex-direction: column;\n gap: 0.5rem;\n min-height: 160px;\n }\n .metric-label {\n font-size: 0.78rem;\n text-transform: uppercase;\n letter-spacing: 0.1em;\n color: rgba(204, 232, 255, 0.72);\n }\n .metric-value {\n font-size: 2.1rem;\n font-weight: 700;\n color: #ffffff;\n }\n .metric-meta {\n font-size: 0.95rem;\n color: rgba(198, 229, 255, 0.78);\n }\n .timeline {\n position: relative;\n margin: 2rem 0 3rem;\n padding: 60px 12px 28px;\n border-radius: 20px;\n background: linear-gradient(180deg, rgba(23, 52, 132, 0.45), rgba(18, 34, 88, 0.3));\n border: 1px solid rgba(141, 188, 255, 0.25);\n }\n .timeline::before {\n content: '';\n position: absolute;\n top: 50%;\n left: 24px;\n right: 24px;\n height: 2px;\n background: linear-gradient(90deg, rgba(110, 185, 255, 0.5), rgba(133, 99, 255, 0.7));\n }\n .timeline-node {\n position: absolute;\n transform: translateX(-50%);\n text-align: center;\n min-width: 160px;\n }\n .timeline-node__label {\n font-weight: 600;\n margin-bottom: 8px;\n }\n .timeline-node__year {\n font-size: 1.35rem;\n margin-bottom: 6px;\n color: #7cf9ff;\n }\n .timeline-node__confidence {\n font-size: 0.85rem;\n color: rgba(202, 230, 255, 0.85);\n }\n .timeline-node::after {\n content: '';\n position: absolute;\n top: 52px;\n left: 50%;\n transform: translate(-50%, 0);\n width: 16px;\n height: 16px;\n border-radius: 50%;\n background: radial-gradient(circle at 50% 50%, #b2f5ff, #5d73ff);\n box-shadow: 0 0 18px rgba(118, 255, 255, 0.6);\n }\n footer {\n margin-top: 3rem;\n font-size: 0.85rem;\n color: rgba(173, 217, 255, 0.75);\n }\n code {\n font-family: 'JetBrains Mono', 'Source Code Pro', monospace;\n font-size: 0.85rem;\n color: #8ae5ff;\n }\n </style>\n </head>\n <body>\n <header>\n <h1>α-AGI Insight MARK Executive Report</h1>\n <p>The foresight lattice autonomously mapped AGI rupture points and tokenised them as Nova-Seeds. The operator retains complete command via pause levers, oracle rotation, and treasury retargeting without redeployments.</p>\n </header>\n <section class=\"meta-grid\">\n <div class=\"meta-grid__item\">\n <span class=\"meta-grid__label\">Network</span>\n <span class=\"meta-grid__value\">${escapeHtml(network.name)} (chainId ${escapeHtml(network.chainId.toString())})</span>\n </div>\n <div class=\"meta-grid__item\">\n <span class=\"meta-grid__label\">Operator</span>\n <span class=\"meta-grid__value\">${escapeHtml(operator.address)}</span>\n </div>\n <div class=\"meta-grid__item\">\n <span class=\"meta-grid__label\">Oracle</span>\n <span class=\"meta-grid__value\">${escapeHtml(oracle.address)}</span>\n </div>\n <div class=\"meta-grid__item\">\n <span class=\"meta-grid__label\">System Pause Sentinel</span>\n <span class=\"meta-grid__value\">${escapeHtml(strategist.address)}</span>\n </div>\n <div class=\"meta-grid__item\">\n <span class=\"meta-grid__label\">Scenario Dataset</span>\n <span class=\"meta-grid__value\">${escapeHtml(scenarioRelativePath)}<br /><small>sha256 ${escapeHtml(scenarioHashShort)}</small></span>\n </div>\n <div class=\"meta-grid__item\">\n <span class=\"meta-grid__label\">Treasury</span>\n <span class=\"meta-grid__value\">${escapeHtml(exchangeTreasury)}</span>\n </div>\n <div class=\"meta-grid__item\">\n <span class=\"meta-grid__label\">Fee</span>\n <span class=\"meta-grid__value\">${exchangeFeePercentDisplay}%</span>\n </div>\n </section>\n <section class=\"engine\">\n <h2>Superintelligent Engine Pulse</h2>\n <p class=\"engine__intro\">\n The Meta-Agentic Tree Search lattice and thermodynamic trigger collaborate to forecast rupture points beyond human foresight.\n Capability gauges below surface the live AGI index, certainty band, and total forecast value commanding the marketplace.\n </p>\n <div class=\"engine__gauges\">\n <div class=\"gauge\">\n <div class=\"gauge__label\">Composite Capability Index</div>\n <div class=\"gauge__bar\">\n <div class=\"gauge__fill\" style=\"width:${capabilityPercent}%\"></div>\n </div>\n <div class=\"gauge__value\">${capabilityPercent}% certainty</div>\n <div class=\"gauge__meta\">Weighted blend of swarm average and peak disruption confidence.</div>\n </div>\n <div class=\"gauge\">\n <div class=\"gauge__label\">Confidence Band</div>\n <div class=\"gauge__bar\">\n <div class=\"gauge__fill\" style=\"width:${peakPercent}%\"></div>\n </div>\n <div class=\"gauge__value\">${floorPercent}% → ${peakPercent}%</div>\n <div class=\"gauge__meta\">Floor and ceiling disruption certainty across analysed sectors.</div>\n </div>\n <div class=\"gauge gauge--forecast\">\n <div class=\"gauge__label\">Tokenised Opportunity Mass</div>\n <div class=\"gauge__value\">${totalForecastDisplay}</div>\n <div class=\"gauge__meta\">Cumulative forecast value distilled into Nova-Seed inventory (trillion-equivalent).</div>\n </div>\n </div>\n <div class=\"engine__agents\">\n ${config.agents\n .map((agent) => `<span class=\"engine__agent\">${escapeHtml(agent)}</span>`)\n .join(\"\\n \")}\n </div>\n </section>\n <section class=\"metrics\">\n <h2>Operational Command Metrics</h2>\n <div class=\"metrics-grid\">\n <article class=\"metric-card\">\n <span class=\"metric-label\">Minted Nova-Seeds</span>\n <span class=\"metric-value\">${mintedStats.minted}</span>\n <span class=\"metric-meta\">${mintedStats.mintedByOwner} owner • ${mintedStats.mintedByDelegates} delegated</span>\n </article>\n <article class=\"metric-card\">\n <span class=\"metric-label\">Market State</span>\n <span class=\"metric-value\">${soldCount + listedCount + forceDelistedCount}</span>\n <span class=\"metric-meta\">${marketStatusSummary}</span>\n </article>\n <article class=\"metric-card\">\n <span class=\"metric-label\">Fusion Dossiers</span>\n <span class=\"metric-value\">${revealedCount}</span>\n <span class=\"metric-meta\">${fusionPlanSummary}</span>\n </article>\n <article class=\"metric-card\">\n <span class=\"metric-label\">Confidence & Capability</span>\n <span class=\"metric-value\">${averageConfidenceSummary}%</span>\n <span class=\"metric-meta\">Band ${confidenceFloorSummary}% → ${confidencePeakSummary}% • Capability ${capabilityPercentSummary}%</span>\n </article>\n </div>\n </section>\n <section class=\"timeline\">\n <h2>Disruption Timeline</h2>\n${timelineMarks}\n </section>\n <section>\n <h2>Nova-Seed Market Matrix</h2>\n <table>\n <thead>\n <tr>\n <th>Token</th>\n <th>Sector</th>\n <th>Rupture Year</th>\n <th>Disruption Thesis</th>\n <th>Confidence</th>\n <th>Forecast Value</th>\n <th>Fusion Plan</th>\n <th>Status</th>\n <th>Market State</th>\n <th>Custodian</th>\n <th>Owner Controls</th>\n </tr>\n </thead>\n <tbody>\n${htmlRows}\n </tbody>\n </table>\n </section>\n <section>\n <h2>Owner Command Hooks</h2>\n <ul>\n <li>Invoke <code>pause()</code> on the exchange, Nova-Seed, or settlement token to halt activity instantly.</li>\n <li>Reassign the oracle via <code>setOracle(address)</code> for immediate foresight adjudication.</li>\n <li>Redirect protocol yield by calling <code>setTreasury(address)</code>.</li>\n <li>Authorise or rotate the cross-contract sentinel with <code>setSystemPause(address)</code>.</li>\n <li>Recalibrate disruption metadata and forecasts via <code>updateInsightDetails(tokenId, sector, thesis, timestamp, confidenceBps, forecastValue)</code>.</li>\n <li>Reveal a FusionPlan at will using <code>revealFusionPlan(tokenId, uri)</code>.</li>\n <li>Reprice any listing in-place using <code>updateListingPrice(tokenId, newPrice)</code>.</li>\n <li>Evacuate a listing to cold storage instantly with <code>forceDelist(tokenId, recipient)</code>.</li>\n </ul>\n </section>\n <footer>\n Generated ${escapeHtml(new Date().toISOString())}. Manifest fingerprints in <code>insight-manifest.json</code> attest to dossier integrity.\n </footer>\n </body>\n</html>`;\n\n const controlMatrix = {\n generatedAt: new Date().toISOString(),\n owner: operator.address,\n oracle: oracle.address,\n systemPause: strategist.address,\n contracts: [\n {\n name: \"InsightAccessToken\",\n address: settlementTokenAddress,\n owner: operator.address,\n pausable: true,\n systemPause: accessTokenSystemPause,\n configurable: [\"mint\", \"pause\", \"unpause\", \"setSystemPause\"],\n },\n {\n name: \"AlphaInsightNovaSeed\",\n address: novaSeedAddress,\n owner: operator.address,\n pausable: true,\n systemPause: novaSeedSystemPause,\n configurable: [\"setMinter\", \"updateInsightDetails\", \"revealFusionPlan\", \"updateFusionPlan\", \"setSystemPause\"],\n },\n {\n name: \"AlphaInsightExchange\",\n address: exchangeAddress,\n owner: operator.address,\n pausable: true,\n systemPause: exchangeSystemPause,\n configurable: [\n \"setOracle\",\n \"setTreasury\",\n \"setFeeBps\",\n \"setPaymentToken\",\n \"setSystemPause\",\n \"updateListingPrice\",\n \"forceDelist\",\n ],\n },\n ],\n };\n\n const controlTableRows = controlMatrix.contracts\n .map((entry) => {\n const sentinelAddress = entry.systemPause && entry.systemPause !== ethers.ZeroAddress ? entry.systemPause : \"—\";\n const hookList = entry.configurable.map((hook) => formatControlHook(hook)).join(\"<br />\");\n const sentinelCell = sentinelAddress === \"—\" ? \"—\" : `\\`${sentinelAddress}\\``;\n return `| ${entry.name} | \\`${entry.address}\\` | \\`${entry.owner}\\` | ${sentinelCell} | ${hookList} |`;\n })\n .join(\"\\n\");\n\n const sentinelDrillLines = [\n `- Delegated sentinel \\`${strategist.address}\\` executed pause() across Insight Access Token, α-AGI Nova-Seed, and Insight Exchange before owner \\`${operator.address}\\` restored operations.`,\n `- Liquidity reserve minted via \\`mint(address,uint256)\\` on the settlement token to rehydrate markets immediately after the drill.`,\n ].join(\"\\n\");\n\n const parameterOverrideLines = [\n `- Exchange treasury routed to \\`${exchangeTreasury}\\`; retarget via \\`setTreasury(address)\\`.`,\n `- Exchange oracle anchored to \\`${oracle.address}\\`; rotate via \\`setOracle(address)\\`.`,\n `- Trading fee configured at ${exchangeFeePercentDisplay}% (\\`${exchangeFeeBpsNumber} bps\\`); adjust with \\`setFeeBps(uint96)\\`.`,\n `- Settlement token \\`${settlementTokenAddress}\\` remains owner-mintable and can be rotated with \\`setPaymentToken(address)\\`.`,\n `- System sentinel handshake enforced across modules via \\`setSystemPause(address)\\` (current \\`${strategist.address}\\`).`,\n ].join(\"\\n\");\n\n const integrityAssertionLines = [\n `- Nova-Seeds minted: ${mintedStats.minted} (owner ${mintedByOwnerCount}, delegates ${delegatedMintCount}).`,\n `- Market custody positions: ${soldCount} sold • ${listedCount} listed • ${forceDelistedCount} sentinel custody.`,\n `- Fusion dossiers: ${revealedCount} revealed • ${sealedCount} sealed.`,\n `- Confidence envelope: floor ${confidenceFloorSummary}% → peak ${confidencePeakSummary}% (capability ${capabilityPercentSummary}%).`,\n `- Opportunity magnitude: ${totalForecastDisplay}.`,\n `- Scenario dataset sha256 ${scenarioHash}.`,\n ].join(\"\\n\");\n\n const safetyChecklist = `# α-AGI Insight MARK – Safety & Control Checklist\\n\\n` +\n `Generated ${new Date().toISOString()} on ${network.name} (chainId ${network.chainId}).\\n\\n` +\n `## Contract Command Matrix\\n` +\n `| Contract | Address | Owner | Sentinel | Owner Hooks |\\n` +\n `| --- | --- | --- | --- | --- |\\n` +\n `${controlTableRows}\\n\\n` +\n `## Sentinel Drills\\n` +\n `${sentinelDrillLines}\\n\\n` +\n `## Parameter Overrides\\n` +\n `${parameterOverrideLines}\\n\\n` +\n `## Integrity Assertions\\n` +\n `${integrityAssertionLines}\\n`;\n\n const mermaid = `flowchart TD\\n` +\n ` operator((Operator)):::actor -->|Mints insights| nova[α-AGI Nova-Seed]:::contract\\n` +\n ` operator -->|Configures| exchange[Insight Exchange]:::contract\\n` +\n ` operator -->|Mints credits| credit[Insight Access Token]:::contract\\n` +\n ` nova -->|Lists foresight| exchange\\n` +\n ` buyers((Market Participants)):::actor -->|Acquire foresight| exchange\\n` +\n ` exchange -->|Fee flow| treasury((Treasury)):::control\\n` +\n ` exchange -->|Settlement| credit\\n` +\n ` operator -->|Reveal / Update fusion plans| nova\\n` +\n ` sentinel((System Pause Sentinel)):::control -->|Pause command| nova\\n` +\n ` sentinel -->|Pause command| exchange\\n` +\n ` sentinel -->|Pause command| credit\\n` +\n ` operator -->|Resume operations| exchange\\n` +\n ` operator -->|Resume operations| nova\\n` +\n ` operator -->|Resume operations| credit\\n` +\n ` classDef actor fill:#102a43,stroke:#8ff7ff,color:#e5f9ff;\\n` +\n ` classDef contract fill:#1b2845,stroke:#9ef6ff,color:#f0f8ff;\\n` +\n ` classDef control fill:#2c1f3d,stroke:#d2b0ff,color:#f8f5ff;\\n`;\n\n const governanceLines: string[] = [\n \"flowchart LR\",\n ' subgraph Intelligence_Swarm[\"Meta-Agentic Insight Swarm\"]',\n ' metasentinel[[Meta-Sentinel]]:::agent',\n ' planner[[Strategic Planner]]:::agent',\n ' oracleAgent[[Thermodynamic Oracle]]:::agent',\n ' cartographer[[Venture Cartographer]]:::agent',\n ' guardian[[Guardian Auditor]]:::agent',\n ' end',\n ' metasentinel --> planner --> oracleAgent --> cartographer --> guardian --> metasentinel',\n ' metasentinel -->|Mint directives| nova[α-AGI Nova-Seed]:::contract',\n ' guardian -->|Seal / Reveal| nova',\n ' metasentinel -->|Configure| exchange[Insight Exchange]:::contract',\n ' guardian -->|Assign sentinel| pauseSentinel((System Pause Sentinel)):::control',\n ' pauseSentinel -->|Pause| nova',\n ' pauseSentinel -->|Pause| exchange',\n ' pauseSentinel -->|Pause| credit[Insight Access Token]:::contract',\n ' exchange --> buyers((Market Operators)):::actor',\n ' buyers --> exchange',\n ' exchange --> treasury((Treasury)):::control',\n ' classDef actor fill:#102a43,stroke:#8ff7ff,color:#e5f9ff;',\n ' classDef contract fill:#1b2845,stroke:#9ef6ff,color:#f0f8ff;',\n ' classDef control fill:#2c1f3d,stroke:#d2b0ff,color:#f8f5ff;',\n ' classDef agent fill:#14233b,stroke:#60d2ff,color:#e8f6ff;',\n ' classDef asset fill:#1e3a5f,stroke:#ffd166,color:#fff9e6;',\n ' classDef custody fill:#2b1d42,stroke:#f38eb0,color:#fff0fa;',\n ];\n\n const governanceCustodianNodes = new Map<string, string>();\n function ensureGovernanceCustodianNode(address: string): string {\n const key = address.toLowerCase();\n const existing = governanceCustodianNodes.get(key);\n if (existing) {\n return existing;\n }\n const nodeId = toMermaidId(address, \"custodian\");\n governanceLines.push(` ${nodeId}[\"${escapeMermaidLabel(governanceCustodianLabel(address))}\"]:::custody`);\n governanceCustodianNodes.set(key, nodeId);\n return nodeId;\n }\n\n for (const entry of minted) {\n const tokenNode = toMermaidId(`Token_${entry.tokenId}`, `token${entry.tokenId}`);\n const tokenLabel = `Token #${entry.tokenId}\\\\n${escapeMermaidLabel(entry.scenario.sector)}`;\n governanceLines.push(` ${tokenNode}[\"${tokenLabel}\"]:::asset`);\n governanceLines.push(` nova -->|Forge| ${tokenNode}`);\n const mintedToNode = ensureGovernanceCustodianNode(entry.mintedTo);\n governanceLines.push(` ${tokenNode} -->|Minted to| ${mintedToNode}`);\n const finalNode = ensureGovernanceCustodianNode(entry.finalCustodian);\n const statusParts = [formatTitleCase(entry.status)];\n if (entry.sale) {\n statusParts.push(`${entry.sale.price} AIC`);\n }\n const statusLabel = statusParts.join(\" · \");\n governanceLines.push(` ${tokenNode} -.->|${escapeMermaidLabel(statusLabel)}| ${finalNode}`);\n }\n\n const governanceMermaid = governanceLines.join(\"\\n\");\n\n const agentMermaidNodes = config.agents.map((agent, index) => ({\n id: toMermaidId(agent, `agent${index}`),\n label: agent,\n }));\n const agentMermaidDefinitions = agentMermaidNodes\n .map(({ id, label }) => ` ${id}[\"${escapeMermaidLabel(label)}\"]:::agent`)\n .join(\"\\n\");\n const agentMermaidFlow = agentMermaidNodes\n .map(({ id }, index) => {\n const next = agentMermaidNodes[index + 1];\n if (next) {\n return ` ${id} --> ${next.id}`;\n }\n return ` ${id} --> guardianSentinel`;\n })\n .join(\"\\n\");\n\n const superintelligenceMermaid = `flowchart LR\\n` +\n ` mats[[Meta-Agentic Tree Search (NSGA-II)]]:::engine\\n` +\n ` thermo[[Thermodynamic Rupture Trigger]]:::engine\\n` +\n ` capability[[AGI Capability Index]]:::signal\\n` +\n ` novaSeed[α-AGI Nova-Seed Forge]:::contract\\n` +\n ` market[α-AGI MARK Exchange]:::contract\\n` +\n ` treasuryNode((Treasury Governance)):::control\\n` +\n ` guardianSentinel((System Sentinel)):::control\\n` +\n (agentMermaidDefinitions ? `${agentMermaidDefinitions}\\n` : \"\") +\n ` mats --> thermo\\n` +\n ` thermo --> capability\\n` +\n ` capability --> novaSeed\\n` +\n ` novaSeed --> market\\n` +\n ` market --> treasuryNode\\n` +\n ` guardianSentinel --> mats\\n` +\n ` guardianSentinel --> market\\n` +\n (agentMermaidNodes.length ? ` mats --> ${agentMermaidNodes[0].id}\\n` : \"\") +\n (agentMermaidFlow ? `${agentMermaidFlow}\\n` : \"\") +\n ` classDef engine fill:#162d59,stroke:#8ff6ff,color:#e8f6ff;\\n` +\n ` classDef signal fill:#1e3d76,stroke:#ffe174,color:#fff9d4;\\n` +\n ` classDef contract fill:#1b2845,stroke:#9ef6ff,color:#f0f8ff;\\n` +\n ` classDef control fill:#2c1f3d,stroke:#d2b0ff,color:#f8f5ff;\\n` +\n ` classDef agent fill:#14233b,stroke:#60d2ff,color:#e8f6ff;\\n`;\n\n const csvHeader = [\n \"tokenId\",\n \"sector\",\n \"ruptureYear\",\n \"confidence\",\n \"confidenceBps\",\n \"status\",\n \"marketState\",\n \"custodian\",\n \"mintedTo\",\n \"mintedBy\",\n \"fusionURI\",\n \"sealedURI\",\n \"disruptionTimestamp\",\n \"forecastValue\",\n \"ownerActions\",\n ].join(\",\");\n\n const csvRows = minted.map((entry) => {\n const marketState = entry.sale\n ? `${entry.sale.price} AIC → ${entry.sale.netPayout} AIC`\n : entry.status === \"LISTED\"\n ? entry.listingPrice\n ? `Listed @ ${entry.listingPrice} AIC`\n : \"Listed\"\n : entry.status === \"FORCE_DELISTED\"\n ? `Force delisted → ${shortenAddress(entry.finalCustodian)}`\n : \"Held\";\n\n return [\n csvEscape(entry.tokenId),\n csvEscape(entry.scenario.sector),\n csvEscape(entry.scenario.ruptureYear),\n csvEscape(formatPercent(entry.confidenceDecimal)),\n csvEscape(entry.confidenceBps),\n csvEscape(entry.status),\n csvEscape(marketState),\n csvEscape(shortenAddress(entry.finalCustodian)),\n csvEscape(shortenAddress(entry.mintedTo)),\n csvEscape(shortenAddress(entry.mintedBy)),\n csvEscape(entry.fusionURI),\n csvEscape(entry.scenario.sealedURI),\n csvEscape(entry.disruptionTimestamp),\n csvEscape(entry.forecastValue),\n csvEscape(entry.ownerActions.join(\"; \")),\n ].join(\",\");\n });\n\n const csvContent = [csvHeader, ...csvRows].join(\"\\n\");\n\n const ownerBriefTableRows = minted\n .map((entry) => {\n const custodian = shortenAddress(entry.finalCustodian);\n const ownerNotes = entry.ownerActions.length ? entry.ownerActions.join(\"; \") : \"—\";\n return `| #${entry.tokenId} | ${entry.scenario.sector} | ${entry.scenario.ruptureYear} | ${formatPercent(entry.confidenceDecimal)} | ${entry.forecastValue} | ${entry.status} | ${custodian} | ${ownerNotes} |`;\n })\n .join(\"\\n\");\n\n const ownerBrief = `# α-AGI Insight MARK – Owner Command Brief\\n\\n` +\n `Generated ${new Date().toISOString()} on ${network.name} (chainId ${network.chainId}).\\\\\\n` +\n `- Minted Nova-Seeds: ${minted.length} (owner minted ${mintedByOwnerCount}, delegated minted ${delegatedMintCount}).\\\\\\n` +\n `- Live market activity: ${soldCount} sold, ${listedCount} listed, ${forceDelistedCount} under sentinel custody.\\\\\\n` +\n `- Fusion dossier state: ${revealedCount} revealed, ${sealedCount} sealed.\\\\\\n` +\n `- Average confidence: ${formatPercent(averageConfidenceDecimal)}.\\\\\\n` +\n `- Composite AGI capability index: ${capabilityPercent}%.\\\\\\n` +\n `- Portfolio forecast magnitude: ${totalForecastDisplay}.\\\\\\n\\n` +\n `## Rapid Command Checklist\\n` +\n `- [ ] Trigger \\`pause()\\` on Insight Exchange (${exchangeAddress}) for market freeze.\\n` +\n `- [ ] Invoke \\`pause()\\` on α-AGI Nova-Seed (${novaSeedAddress}) to freeze custody flows.\\n` +\n `- [ ] Confirm sentinel ${shortenAddress(strategist.address)} retains \\`setSystemPause\\` authority across modules.\\n` +\n `- [ ] Rotate oracle via \\`setOracle(${shortenAddress(oracle.address)})\\` if adjudication policy must change.\\n` +\n `- [ ] Validate treasury destination ${shortenAddress(exchangeTreasury)} with finance desk.\\n\\n` +\n `## Sector Timeline\\n` +\n `| Token | Sector | Rupture Year | Confidence | Forecast Value | Status | Custodian | Owner Actions |\\n` +\n `| --- | --- | --- | --- | --- | --- | --- | --- |\\n` +\n `${ownerBriefTableRows}\\n\\n` +\n `## Intelligence Signals\\n` +\n minted\n .map((entry) => `- ${entry.scenario.sector}: ${entry.scenario.thesis} (forecast value ${entry.forecastValue}).`)\n .join(\"\\n\") +\n \"\\n\";\n\n const mintedNodeLines = minted\n .map((entry) => {\n const saleDescriptor = entry.sale\n ? `Sold @ ${entry.sale.price} AIC`\n : entry.status === \"LISTED\" && entry.listingPrice\n ? `Listed @ ${entry.listingPrice} AIC`\n : entry.status === \"FORCE_DELISTED\"\n ? `Custody ${shortenAddress(entry.finalCustodian)}`\n : `Held ${shortenAddress(entry.finalCustodian)}`;\n return ` token${entry.tokenId}(\"#${entry.tokenId} ${entry.scenario.sector}\\\\n${entry.scenario.ruptureYear} • ${saleDescriptor}\")`;\n })\n .join(\"\\n\");\n\n const mintedConnections = minted\n .map((entry) => {\n const mintedByLabel = entry.mintedBy.toLowerCase() === operator.address.toLowerCase() ? \"Owner\" : \"Delegate\";\n const listingEdge = entry.status === \"SOLD\" || entry.status === \"LISTED\" || entry.status === \"FORCE_DELISTED\"\n ? `\\n token${entry.tokenId} --> exchangeNode`\n : \"\";\n const custodyEdge = entry.status === \"FORCE_DELISTED\"\n ? `\\n token${entry.tokenId} -.custody.-> sentinel`\n : entry.status === \"SOLD\"\n ? `\\n token${entry.tokenId} --> buyers`\n : \"\";\n return ` operator -.${mintedByLabel}.-> token${entry.tokenId}${listingEdge}${custodyEdge}`;\n })\n .join(\"\\n\");\n\n const mintedClassLines = minted\n .map((entry) => {\n const className =\n entry.status === \"SOLD\"\n ? \"sold\"\n : entry.status === \"LISTED\"\n ? \"listed\"\n : entry.status === \"FORCE_DELISTED\"\n ? \"custody\"\n : entry.fusionRevealed\n ? \"revealed\"\n : \"sealed\";\n return ` class token${entry.tokenId} ${className};`;\n })\n .join(\"\\n\");\n\n const constellationMermaid = `flowchart TB\\n` +\n ` operator((Owner ${shortenAddress(operator.address)})):::actor\\n` +\n ` sentinel((System Pause ${shortenAddress(strategist.address)})):::control\\n` +\n ` oracleNode((Oracle ${shortenAddress(oracle.address)})):::control\\n` +\n ` exchangeNode{{Insight Exchange}}:::contract\\n` +\n ` treasuryNode((Treasury ${shortenAddress(exchangeTreasury)})):::control\\n` +\n ` buyers((Market Operators)):::actor\\n` +\n ` subgraph NovaSeeds[\"α-AGI Nova-Seeds\"]\\n${mintedNodeLines}\\n end\\n` +\n ` operator --> exchangeNode\\n` +\n ` oracleNode --> exchangeNode\\n` +\n ` exchangeNode --> treasuryNode\\n` +\n ` sentinel -.pause sweep.-> exchangeNode\\n` +\n ` sentinel -.pause sweep.-> NovaSeeds\\n` +\n ` buyers --> exchangeNode\\n` +\n `${mintedConnections ? `${mintedConnections}\\n` : \"\"}` +\n `${mintedClassLines ? `${mintedClassLines}\\n` : \"\"}` +\n ` classDef actor fill:#102a43,stroke:#8ff7ff,color:#e5f9ff;\\n` +\n ` classDef contract fill:#1b2845,stroke:#9ef6ff,color:#f0f8ff;\\n` +\n ` classDef control fill:#2c1f3d,stroke:#d2b0ff,color:#f8f5ff;\\n` +\n ` classDef sold fill:#0f5132,stroke:#1bff82,color:#eafff5;\\n` +\n ` classDef listed fill:#1f3d7a,stroke:#90c2ff,color:#eaf3ff;\\n` +\n ` classDef custody fill:#553c9a,stroke:#c1a8ff,color:#f3edff;\\n` +\n ` classDef sealed fill:#343a55,stroke:#7a8bbd,color:#f1f5ff;\\n` +\n ` classDef revealed fill:#214d6d,stroke:#7fe6ff,color:#ecfbff;\\n`;\n\n const agencySeedNodes = minted\n .map((entry) =>\n ` seed${entry.tokenId}(\"#${entry.tokenId} ${escapeMermaidLabel(entry.scenario.sector)}\\\\n${formatPercent(entry.confidenceDecimal)} certainty\")`\n )\n .join(\"\\n\");\n\n const agencySeedEdges = minted\n .map((entry) => {\n const custodyTarget =\n entry.status === \"SOLD\"\n ? \"Market\"\n : entry.status === \"FORCE_DELISTED\"\n ? \"SentinelCustody\"\n : \"OwnerVault\";\n const mintedByEdge =\n entry.mintedBy.toLowerCase() === operator.address.toLowerCase()\n ? ` MetaSentinel -.owner mint.-> seed${entry.tokenId}`\n : ` ThermodynamicOracle -.delegate mint.-> seed${entry.tokenId}`;\n const listingEdge =\n entry.status === \"SOLD\" || entry.status === \"LISTED\"\n ? `\\n seed${entry.tokenId} --> VentureCartographer`\n : \"\";\n return [\n ` FusionSmith --> seed${entry.tokenId}`,\n ` GuardianAuditor --> seed${entry.tokenId}`,\n ` ThermodynamicOracle --> seed${entry.tokenId}`,\n mintedByEdge,\n `${listingEdge}`,\n ` seed${entry.tokenId} --> ${custodyTarget}`,\n ]\n .filter((segment) => segment.length > 0)\n .join(\"\\n\");\n })\n .join(\"\\n\");\n\n const agencyClassLines = minted\n .map((entry) => {\n const className =\n entry.status === \"SOLD\"\n ? \"seedSold\"\n : entry.status === \"LISTED\"\n ? \"seedListed\"\n : entry.status === \"FORCE_DELISTED\"\n ? \"seedCustody\"\n : entry.fusionRevealed\n ? \"seedRevealed\"\n : \"seedSealed\";\n return ` class seed${entry.tokenId} ${className};`;\n })\n .join(\"\\n\");\n\n const agencyOrbitMermaid = `flowchart LR\\n` +\n ` classDef agent fill:#1a2c4f,stroke:#9cc9ff,color:#f4fbff;\\n` +\n ` classDef custody fill:#2c1f4f,stroke:#d0b0ff,color:#fdf9ff;\\n` +\n ` classDef seedSold fill:#0f5132,stroke:#1bff82,color:#eafff5;\\n` +\n ` classDef seedListed fill:#1f3d7a,stroke:#90c2ff,color:#eaf3ff;\\n` +\n ` classDef seedCustody fill:#553c9a,stroke:#c1a8ff,color:#f3edff;\\n` +\n ` classDef seedSealed fill:#343a55,stroke:#7a8bbd,color:#f1f5ff;\\n` +\n ` classDef seedRevealed fill:#214d6d,stroke:#7fe6ff,color:#ecfbff;\\n` +\n ` subgraph AgentSwarm[\"Meta-Agent Constellation\"]\\n` +\n ` MetaSentinel((Meta-Sentinel)):::agent\\n` +\n ` MATSEngine((MATS Engine)):::agent\\n` +\n ` ThermodynamicOracle((Thermodynamic Oracle)):::agent\\n` +\n ` FusionSmith((FusionSmith)):::agent\\n` +\n ` GuardianAuditor((Guardian Auditor)):::agent\\n` +\n ` VentureCartographer((Venture Cartographer)):::agent\\n` +\n ` SystemSentinel((System Sentinel)):::agent\\n` +\n ` end\\n` +\n ` subgraph NovaSeedFoundry[\"α-AGI Nova-Seed Forge\"]\\n${agencySeedNodes}\\n end\\n` +\n ` subgraph MarketGrid[\"α-AGI MARK Market Grid\"]\\n` +\n ` OwnerVault((Owner Vault)):::custody\\n` +\n ` SentinelCustody((Sentinel Custody)):::custody\\n` +\n ` Market((Market Operators)):::custody\\n` +\n ` end\\n` +\n ` MetaSentinel --> MATSEngine\\n` +\n ` MATSEngine --> ThermodynamicOracle\\n` +\n ` ThermodynamicOracle --> FusionSmith\\n` +\n ` FusionSmith --> GuardianAuditor\\n` +\n ` GuardianAuditor --> VentureCartographer\\n` +\n ` SystemSentinel -.pause sweep.-> NovaSeedFoundry\\n` +\n ` SystemSentinel -.pause sweep.-> VentureCartographer\\n` +\n ` VentureCartographer --> Market\\n` +\n ` GuardianAuditor --> OwnerVault\\n` +\n `${agencySeedEdges ? `${agencySeedEdges}\\n` : \"\"}` +\n `${agencyClassLines ? `${agencyClassLines}\\n` : \"\"}`;\n\n const lifecycleMermaid =\n `sequenceDiagram\\n` +\n ` autonumber\\n` +\n ` participant Operator as Owner / Operator\\n` +\n ` participant MetaSwarm as Meta-Agentic Swarm\\n` +\n ` participant Forge as α-AGI Nova-Seed Forge\\n` +\n ` participant Exchange as α-AGI MARK Exchange\\n` +\n ` participant Sentinel as System Pause Sentinel\\n` +\n ` participant Treasury as Treasury Governance\\n` +\n ` Operator->>MetaSwarm: Define disruption mandate + guardrails\\n` +\n ` MetaSwarm-->>MetaSwarm: Thermodynamic rupture exploration\\n` +\n ` MetaSwarm->>Forge: Submit cryptosealed Nova-Seed blueprint\\n` +\n ` Forge-->>Operator: Mint #seedId + notarise provenance hash\\n` +\n ` Operator->>Exchange: Configure listing, fees, oracle policy\\n` +\n ` Exchange-->>Treasury: Route settlement fees (${exchangeFeePercentDisplay}%)\\n` +\n ` Exchange-)Operator: Emit trade + custody attestations\\n` +\n ` Sentinel-->>Forge: Pause / resume custody lattice\\n` +\n ` Sentinel-->>Exchange: Trigger market circuit-break\\n` +\n ` Operator->>Forge: Reveal FusionPlan when strategic window opens\\n` +\n ` Operator->>Exchange: Resolve prediction via oracle rotation\\n` +\n ` Exchange-->>MetaSwarm: Feed confirmed rupture telemetry\\n` +\n ` MetaSwarm-->>Operator: Update capability index + executive dossier\\n` +\n ` note over Operator,Exchange: Owner retains unilateral pause, repricing, oracle and treasury authority.\\n`;\n\n const telemetryLog = telemetry.map((entry) => `${entry.timestamp} [${entry.agent}] ${entry.message}`).join(\"\\n\");\n\n const ledger = {\n generatedAt: new Date().toISOString(),\n network: { chainId: network.chainId.toString(), name: network.name },\n contracts: {\n novaSeed: novaSeedAddress,\n foresightExchange: exchangeAddress,\n settlementToken: settlementTokenAddress,\n },\n scenario: {\n path: scenarioRelativePath,\n sha256: scenarioHash,\n },\n stats: mintedStats,\n feeBps: exchangeFeeBpsNumber,\n treasury: exchangeTreasury,\n minted: minted.map((entry) => ({\n tokenId: entry.tokenId,\n sector: entry.scenario.sector,\n status: entry.status,\n mintedBy: entry.mintedBy,\n mintedTo: entry.mintedTo,\n finalCustodian: entry.finalCustodian,\n mintTxHash: entry.mintTxHash,\n listingTxHash: entry.listingTxHash ?? null,\n repricingTxHashes: entry.repricingTxHashes,\n saleTxHash: entry.sale?.transactionHash ?? null,\n forceDelistTxHash: entry.forceDelistTxHash ?? null,\n resolutionTxHash: entry.resolutionTxHash ?? null,\n listingPrice: entry.listingPrice ?? null,\n sale: entry.sale ?? null,\n ownerActions: entry.ownerActions,\n fusion: {\n revealed: entry.fusionRevealed,\n uri: entry.fusionURI,\n sealedURI: entry.scenario.sealedURI,\n },\n disruptionTimestamp: entry.disruptionTimestamp,\n confidenceBps: entry.confidenceBps,\n confidencePercent: entry.confidencePercent,\n forecastValue: entry.forecastValue,\n })),\n sentinelPause: sentinelPauseTransactions,\n ownerResume: ownerResumeTransactions,\n };\n\n const ledgerTokenIds = new Set(ledger.minted.map((entry) => entry.tokenId));\n const mintedTokenIds = minted.map((entry) => entry.tokenId);\n const mintedMatchesLedger =\n mintedTokenIds.length === ledgerTokenIds.size && mintedTokenIds.every((tokenId) => ledgerTokenIds.has(tokenId));\n if (!mintedMatchesLedger) {\n throw new Error(\"Minted insight set does not align with ledger entries.\");\n }\n if (onchainOwnership.length !== minted.length) {\n throw new Error(\"On-chain ownership cross-check incomplete.\");\n }\n\n const ownerSupremacy: OwnerSupremacyDossier = {\n generatedAt: new Date().toISOString(),\n network: { chainId: network.chainId.toString(), name: network.name },\n owner: operator.address,\n sentinel: strategist.address,\n oracle: oracle.address,\n treasury: exchangeTreasury,\n feeBps: exchangeFeeBpsNumber,\n controls: controlMatrix.contracts.map((entry) => ({\n name: entry.name,\n address: entry.address,\n owner: entry.owner,\n sentinel: entry.systemPause ?? null,\n hooks: entry.configurable,\n })),\n crossChecks: {\n mintedRecap: minted.length,\n mintedLedger: ledger.minted.length,\n mintedMatch: mintedMatchesLedger,\n onchainOwnership,\n treasuryBalance,\n sentinelPauses: sentinelPauseTransactions.length,\n ownerResumes: ownerResumeTransactions.length,\n },\n assertions: [\n `Owner ${operator.address} can rotate oracle ${oracle.address}, treasury ${exchangeTreasury}, and sentinel ${strategist.address} through dedicated setters.`,\n `Fee regime enforced at ${exchangeFeeBpsNumber} bps with immediate recalibration via setFeeBps(uint96).`,\n `On-chain custody verification confirms ${minted.length} / ${minted.length} Nova-Seeds tracked by the ledger.`,\n ],\n };\n\n const supremacyLines: string[] = [\n \"flowchart TD\",\n ` owner((Owner\\\\n${shortenAddress(operator.address)})):::owner`,\n ` sentinel((Sentinel\\\\n${shortenAddress(strategist.address)})):::sentinel`,\n ` oracleNode((Oracle\\\\n${shortenAddress(oracle.address)})):::oracle`,\n ` treasuryNode((Treasury\\\\n${shortenAddress(exchangeTreasury)})):::treasury`,\n ` novaNode[\\\"α-AGI Nova-Seed\\\\n${shortenAddress(novaSeedAddress)}\\\"]:::contract`,\n ` exchangeNode[\\\"α-AGI MARK Exchange\\\\n${shortenAddress(exchangeAddress)}\\\"]:::contract`,\n ` settlementNode[\\\"Insight Access Token\\\\n${shortenAddress(settlementTokenAddress)}\\\"]:::contract`,\n ` owner -->|Controls| novaNode`,\n ` owner -->|Controls| exchangeNode`,\n ` owner -->|Controls| settlementNode`,\n ` owner -.setOracle().-> oracleNode`,\n ` owner -.setTreasury().-> treasuryNode`,\n ` owner -.setSystemPause().-> sentinel`,\n ` sentinel -->|pause()| novaNode`,\n ` sentinel -->|pause()| exchangeNode`,\n ` sentinel -->|pause()| settlementNode`,\n ` owner -.unpause().-> sentinel`,\n ` oracleNode -.resolvePrediction().-> exchangeNode`,\n ` exchangeNode -->|fee flow| treasuryNode`,\n ];\n\n const supremacyCustodians = new Map<string, string>();\n function ensureSupremacyCustodian(address: string): string {\n const key = address.toLowerCase();\n const cached = supremacyCustodians.get(key);\n if (cached) {\n return cached;\n }\n const nodeId = toMermaidId(address, \"cust\");\n supremacyLines.push(` ${nodeId}((Custodian\\\\n${shortenAddress(address)})):::custody`);\n supremacyCustodians.set(key, nodeId);\n return nodeId;\n }\n\n for (const entry of minted) {\n const seedNode = toMermaidId(`Seed_${entry.tokenId}`, `seed${entry.tokenId}`);\n const statusLabel = `${formatTitleCase(entry.status)} → ${shortenAddress(entry.finalCustodian)}`;\n supremacyLines.push(` ${seedNode}[\\\"Nova-Seed #${entry.tokenId}\\\\n${escapeMermaidLabel(entry.scenario.sector)}\\\"]:::asset`);\n supremacyLines.push(` novaNode -->|Forge| ${seedNode}`);\n const custodyNode = ensureSupremacyCustodian(entry.finalCustodian);\n supremacyLines.push(` ${seedNode} -->|${escapeMermaidLabel(statusLabel)}| ${custodyNode}`);\n if (entry.status === \"LISTED\" || entry.status === \"SOLD\") {\n supremacyLines.push(` ${seedNode} -.Market-.-> exchangeNode`);\n }\n if (entry.status === \"FORCE_DELISTED\") {\n supremacyLines.push(` owner -.forceDelist().-> ${seedNode}`);\n }\n }\n\n supremacyLines.push(\n \" classDef owner fill:#051937,stroke:#8de4ff,color:#e9f7ff;\",\n \" classDef sentinel fill:#2c1f3d,stroke:#d2b0ff,color:#f8f5ff;\",\n \" classDef oracle fill:#1b2845,stroke:#9ef6ff,color:#f0f8ff;\",\n \" classDef treasury fill:#0f2a3f,stroke:#6ae6ff,color:#ebfbff;\",\n \" classDef contract fill:#162a4d,stroke:#7bdfff,color:#f3fbff;\",\n \" classDef asset fill:#1e3a5f,stroke:#ffd166,color:#fff9e6;\",\n \" classDef custody fill:#2b1d42,stroke:#f38eb0,color:#fff0fa;\",\n );\n\n const ownerSupremacyMermaid = supremacyLines.join(\"\\n\");\n\n await writeFile(recapPath, JSON.stringify(recap, null, 2));\n await writeFile(reportPath, markdown);\n await writeFile(matrixPath, JSON.stringify(controlMatrix, null, 2));\n await writeFile(mermaidPath, mermaid);\n await writeFile(governancePath, governanceMermaid);\n await writeFile(superintelligencePath, superintelligenceMermaid);\n await writeFile(telemetryPath, telemetryLog);\n await writeFile(htmlPath, html);\n await writeFile(ownerBriefPath, ownerBrief);\n await writeFile(safetyChecklistPath, safetyChecklist);\n await writeFile(csvPath, csvContent);\n await writeFile(constellationPath, constellationMermaid);\n await writeFile(agencyOrbitPath, agencyOrbitMermaid);\n await writeFile(lifecyclePath, lifecycleMermaid);\n await writeFile(ledgerPath, JSON.stringify(ledger, null, 2));\n await writeFile(ownerSupremacyPath, JSON.stringify(ownerSupremacy, null, 2));\n await writeFile(ownerLatticePath, ownerSupremacyMermaid);\n\n const manifestEntries: { path: string; sha256: string }[] = [];\n for (const file of [\n recapPath,\n reportPath,\n htmlPath,\n matrixPath,\n mermaidPath,\n governancePath,\n superintelligencePath,\n telemetryPath,\n ownerBriefPath,\n safetyChecklistPath,\n csvPath,\n constellationPath,\n agencyOrbitPath,\n lifecyclePath,\n ledgerPath,\n ownerSupremacyPath,\n ownerLatticePath,\n ]) {\n const content = await readFile(file);\n const relativePath = path.relative(path.join(__dirname, \"..\"), file);\n manifestEntries.push({ path: relativePath.replace(/\\\\/g, \"/\"), sha256: sha256(content) });\n }\n\n manifestEntries.push({ path: scenarioRelativePath, sha256: scenarioHash });\n\n const manifest = {\n generatedAt: new Date().toISOString(),\n files: manifestEntries,\n };\n await writeFile(manifestPath, JSON.stringify(manifest, null, 2));\n\n console.log(\"\\n✅ α-AGI Insight MARK demo completed. Reports available in demo/alpha-agi-insight-mark/reports.\");\n}\n\nmain().catch((error) => {\n console.error(error);\n process.exitCode = 1;\n});\n","format":"text","sha256":"cede9d03543889c542286e98b4e98fa26bb420a2d4d5cd30b8f4b774a0061e60","bytes":79596,"download":"/AGIJobsv0/examples/cede9d03543889c5-runDemo.ts","source":"https://github.com/MontrealAI/AGIJobsv0/blob/5b4cebb309a83a7a6749d8911d8bf96a1921e042/demo/alpha-agi-insight-mark/scripts/runDemo.ts"},{"file":"demo/alpha-agi-insight-mark/scripts/verifyReports.ts","content":"import { readFile, stat } from \"fs/promises\";\nimport path from \"path\";\nimport { createHash } from \"crypto\";\n\ninterface ManifestEntry {\n path: string;\n sha256: string;\n}\n\ninterface Manifest {\n generatedAt: string;\n files: ManifestEntry[];\n}\n\ninterface RecapContractAddresses {\n novaSeed: string;\n foresightExchange: string;\n settlementToken: string;\n}\n\ninterface RecapMintedScenario {\n sector: string;\n ruptureYear: number;\n thesis: string;\n confidence: number;\n forecastValue: string;\n sealedURI: string;\n fusionURI: string;\n}\n\ninterface RecapSaleRecord {\n buyer: string;\n price: string;\n fee: string;\n netPayout: string;\n transactionHash: string;\n}\n\ninterface RecapMintedEntry {\n tokenId: string;\n status: string;\n fusionRevealed: boolean;\n onchainVerified: boolean;\n scenario: RecapMintedScenario;\n mintedBy: string;\n mintedTo: string;\n finalCustodian: string;\n ownerActions: string[];\n listingPrice?: string;\n sale?: RecapSaleRecord;\n fusionURI: string;\n disruptionTimestamp: string;\n confidenceBps?: number;\n confidenceDecimal?: number;\n confidencePercent?: number;\n forecastValue?: string;\n mintTxHash?: string;\n listingTxHash?: string | null;\n repricingTxHashes?: string[];\n forceDelistTxHash?: string | null;\n resolutionTxHash?: string | null;\n}\n\ninterface RecapStats {\n minted: number;\n mintedByOwner: number;\n mintedByDelegates: number;\n sold: number;\n listed: number;\n forceDelisted: number;\n sealed: number;\n revealed: number;\n averageConfidencePercent: number;\n capabilityIndexPercent: number;\n confidenceFloorPercent: number;\n confidencePeakPercent: number;\n forecastValueTrillions: number;\n telemetryEntries: number;\n}\n\ninterface TelemetryEntry {\n agent: string;\n message: string;\n timestamp: string;\n}\n\ninterface LedgerMintEntry {\n tokenId: string;\n sector: string;\n status: string;\n mintedBy: string;\n mintedTo: string;\n finalCustodian: string;\n mintTxHash: string;\n listingTxHash?: string | null;\n repricingTxHashes?: string[];\n saleTxHash?: string | null;\n forceDelistTxHash?: string | null;\n resolutionTxHash?: string | null;\n listingPrice?: string | null;\n sale?: RecapSaleRecord | null;\n ownerActions?: string[];\n fusion?: {\n revealed: boolean;\n uri: string;\n sealedURI?: string;\n };\n disruptionTimestamp: string;\n confidenceBps: number;\n confidencePercent: number;\n forecastValue: string;\n}\n\ninterface LedgerFile {\n generatedAt: string;\n network: { chainId: string; name: string };\n contracts: RecapContractAddresses;\n scenario: { path: string; sha256: string };\n stats?: RecapStats;\n feeBps?: number;\n treasury?: string;\n minted: LedgerMintEntry[];\n sentinelPause: Array<{ contract: string; address: string; hash: string }>;\n ownerResume: Array<{ contract: string; address: string; hash: string }>;\n}\n\ninterface RecapFile {\n generatedAt: string;\n network: { chainId: string; name: string };\n contracts: RecapContractAddresses;\n scenarioSource: { path: string; sha256: string };\n operator: string;\n oracle: string;\n systemPause: string;\n treasury: string;\n feeBps: number;\n stats?: RecapStats;\n minted: RecapMintedEntry[];\n telemetry: TelemetryEntry[];\n}\n\ninterface ControlMatrixEntry {\n name: string;\n address: string;\n owner: string;\n systemPause?: string | null;\n configurable?: string[];\n}\n\ninterface ControlMatrixFile {\n generatedAt?: string;\n owner?: string;\n oracle?: string;\n systemPause?: string;\n contracts: ControlMatrixEntry[];\n}\n\ninterface OwnerSupremacyControl {\n name: string;\n address: string;\n owner: string;\n sentinel?: string | null;\n hooks: string[];\n}\n\ninterface OwnerSupremacyCrossChecks {\n mintedRecap: number;\n mintedLedger: number;\n mintedMatch: boolean;\n onchainOwnership: Array<{ tokenId: string; owner: string }>;\n treasuryBalance: string;\n sentinelPauses: number;\n ownerResumes: number;\n}\n\ninterface OwnerSupremacyFile {\n generatedAt: string;\n network: { chainId: string; name: string };\n owner: string;\n sentinel: string;\n oracle: string;\n treasury: string;\n feeBps: number;\n controls: OwnerSupremacyControl[];\n crossChecks: OwnerSupremacyCrossChecks;\n assertions: string[];\n}\n\nconst baseDir = path.join(__dirname, \"..\");\nconst reportsDir = path.join(baseDir, \"reports\");\nconst manifestPath = path.join(reportsDir, \"insight-manifest.json\");\nconst recapPath = path.join(reportsDir, \"insight-recap.json\");\nconst markdownPath = path.join(reportsDir, \"insight-report.md\");\nconst htmlPath = path.join(reportsDir, \"insight-report.html\");\nconst matrixPath = path.join(reportsDir, \"insight-control-matrix.json\");\nconst mermaidSuperintelligencePath = path.join(reportsDir, \"insight-superintelligence.mmd\");\nconst mermaidControlMapPath = path.join(reportsDir, \"insight-control-map.mmd\");\nconst mermaidGovernancePath = path.join(reportsDir, \"insight-governance.mmd\");\nconst mermaidConstellationPath = path.join(reportsDir, \"insight-constellation.mmd\");\nconst mermaidAgencyOrbitPath = path.join(reportsDir, \"insight-agency-orbit.mmd\");\nconst mermaidLifecyclePath = path.join(reportsDir, \"insight-lifecycle.mmd\");\nconst telemetryPath = path.join(reportsDir, \"insight-telemetry.log\");\nconst ownerBriefPath = path.join(reportsDir, \"insight-owner-brief.md\");\nconst safetyChecklistPath = path.join(reportsDir, \"insight-safety-checklist.md\");\nconst csvPath = path.join(reportsDir, \"insight-market-matrix.csv\");\nconst ledgerPath = path.join(reportsDir, \"insight-ledger.json\");\nconst ownerSupremacyPath = path.join(reportsDir, \"insight-owner-supremacy.json\");\nconst ownerLatticePath = path.join(reportsDir, \"insight-owner-lattice.mmd\");\n\nfunction hashBuffer(buffer: Buffer): string {\n const hash = createHash(\"sha256\");\n hash.update(buffer);\n return hash.digest(\"hex\");\n}\n\nasync function ensureExists(targetPath: string, label: string) {\n try {\n await stat(targetPath);\n } catch (error) {\n throw new Error(`${label} not found at ${path.relative(baseDir, targetPath)}`);\n }\n}\n\nfunction parseForecastValueTrillions(value: string): number {\n const trimmed = value.trim();\n const match = trimmed.match(/^([0-9]+(?:\\.[0-9]+)?)\\s*([TtMmBb]?)$/);\n if (!match) {\n return 0;\n }\n const amount = Number(match[1]);\n const unit = match[2]?.toUpperCase() ?? \"\";\n switch (unit) {\n case \"T\":\n return amount;\n case \"B\":\n return amount / 1000;\n case \"M\":\n return amount / 1_000_000;\n default:\n return amount;\n }\n}\n\nfunction formatPercent(value: number, decimals = 1): string {\n return `${(value * 100).toFixed(decimals)}%`;\n}\n\nfunction formatTitleCase(value: string): string {\n return value\n .toLowerCase()\n .split(/[_\\s]+/)\n .filter((segment) => segment.length > 0)\n .map((segment) => segment.charAt(0).toUpperCase() + segment.slice(1))\n .join(\" \");\n}\n\nfunction shortenAddress(address: string, prefix = 6, suffix = 4): string {\n if (!address || address.length <= prefix + suffix + 1) {\n return address;\n }\n return `${address.slice(0, prefix)}…${address.slice(-suffix)}`;\n}\n\nfunction expectedMarketState(entry: RecapMintedEntry): string {\n if (entry.sale) {\n return `${entry.sale.price} AIC → ${entry.sale.netPayout} AIC`;\n }\n if (entry.status === \"LISTED\") {\n return entry.listingPrice ? `Listed @ ${entry.listingPrice} AIC` : \"Listed\";\n }\n if (entry.status === \"FORCE_DELISTED\") {\n return `Force delisted → ${shortenAddress(entry.finalCustodian)}`;\n }\n return \"Held\";\n}\n\nfunction entryConfidenceBps(entry: RecapMintedEntry): number {\n if (typeof entry.confidenceBps === \"number\") {\n return entry.confidenceBps;\n }\n const scenarioConfidence = entry.scenario?.confidence ?? 0;\n return Math.round(scenarioConfidence * 10_000);\n}\n\nfunction entryConfidenceDecimal(entry: RecapMintedEntry): number {\n return entryConfidenceBps(entry) / 10_000;\n}\n\nfunction splitCsvLine(line: string): string[] {\n const result: string[] = [];\n let current = \"\";\n let inQuotes = false;\n for (let i = 0; i < line.length; i += 1) {\n const char = line[i];\n if (char === '\"') {\n const nextChar = line[i + 1];\n if (inQuotes && nextChar === '\"') {\n current += '\"';\n i += 1;\n } else {\n inQuotes = !inQuotes;\n }\n } else if (char === ',' && !inQuotes) {\n result.push(current);\n current = \"\";\n } else {\n current += char;\n }\n }\n result.push(current);\n return result;\n}\n\nfunction assertWithinTolerance(value: number, expected: number, tolerance: number, label: string) {\n if (Number.isNaN(value) || Number.isNaN(expected)) {\n throw new Error(`${label} comparison received NaN values.`);\n }\n const delta = Math.abs(value - expected);\n if (delta > tolerance) {\n throw new Error(`${label} mismatch – expected ${expected}, received ${value} (delta ${delta} > ${tolerance}).`);\n }\n}\n\nasync function loadManifest(): Promise<Manifest> {\n await ensureExists(manifestPath, \"Manifest\");\n const raw = await readFile(manifestPath, \"utf8\");\n const parsed = JSON.parse(raw) as Manifest;\n if (!parsed || !Array.isArray(parsed.files)) {\n throw new Error(\"Manifest structure invalid – expected `files` array.\");\n }\n return parsed;\n}\n\nasync function verifyManifest(manifest: Manifest) {\n const requiredFiles = [\n path.relative(baseDir, recapPath).replace(/\\\\/g, \"/\"),\n path.relative(baseDir, markdownPath).replace(/\\\\/g, \"/\"),\n path.relative(baseDir, htmlPath).replace(/\\\\/g, \"/\"),\n path.relative(baseDir, matrixPath).replace(/\\\\/g, \"/\"),\n path.relative(baseDir, mermaidSuperintelligencePath).replace(/\\\\/g, \"/\"),\n path.relative(baseDir, mermaidControlMapPath).replace(/\\\\/g, \"/\"),\n path.relative(baseDir, mermaidAgencyOrbitPath).replace(/\\\\/g, \"/\"),\n path.relative(baseDir, mermaidLifecyclePath).replace(/\\\\/g, \"/\"),\n path.relative(baseDir, telemetryPath).replace(/\\\\/g, \"/\"),\n path.relative(baseDir, ownerBriefPath).replace(/\\\\/g, \"/\"),\n path.relative(baseDir, safetyChecklistPath).replace(/\\\\/g, \"/\"),\n path.relative(baseDir, csvPath).replace(/\\\\/g, \"/\"),\n path.relative(baseDir, ledgerPath).replace(/\\\\/g, \"/\"),\n path.relative(baseDir, ownerSupremacyPath).replace(/\\\\/g, \"/\"),\n path.relative(baseDir, ownerLatticePath).replace(/\\\\/g, \"/\"),\n ];\n\n const missingRequired = requiredFiles.filter(\n (file) => !manifest.files.some((entry) => entry.path === file)\n );\n if (missingRequired.length > 0) {\n throw new Error(`Manifest missing required artefacts: ${missingRequired.join(\", \")}`);\n }\n\n for (const entry of manifest.files) {\n const resolved = path.resolve(baseDir, entry.path);\n if (!resolved.startsWith(baseDir)) {\n throw new Error(`Manifest entry escapes demo directory: ${entry.path}`);\n }\n await ensureExists(resolved, `Manifest entry ${entry.path}`);\n const buffer = await readFile(resolved);\n const computedHash = hashBuffer(buffer);\n if (computedHash !== entry.sha256) {\n throw new Error(`Hash mismatch for ${entry.path} – expected ${entry.sha256}, got ${computedHash}`);\n }\n }\n}\n\nasync function verifyRecap(): Promise<RecapFile> {\n await ensureExists(recapPath, \"Recap dossier\");\n const raw = await readFile(recapPath, \"utf8\");\n const recap = JSON.parse(raw) as RecapFile;\n if (!recap.contracts?.novaSeed || !recap.contracts.foresightExchange || !recap.contracts.settlementToken) {\n throw new Error(\"Recap dossier missing contract addresses.\");\n }\n if (!Array.isArray(recap.minted) || recap.minted.length < 3) {\n throw new Error(\"Recap dossier expected at least three minted insights.\");\n }\n for (const minted of recap.minted) {\n if (!minted.onchainVerified) {\n throw new Error(`Minted token ${minted.tokenId} missing on-chain verification flag.`);\n }\n }\n if (!Array.isArray(recap.telemetry) || recap.telemetry.length === 0) {\n throw new Error(\"Recap telemetry is empty.\");\n }\n return recap;\n}\n\nfunction validateRecapStats(recap: RecapFile) {\n if (!recap.stats) {\n throw new Error(\"Recap stats block missing.\");\n }\n const stats = recap.stats;\n const minted = recap.minted;\n if (stats.minted !== minted.length) {\n throw new Error(`Recap stats minted count mismatch: expected ${minted.length}, found ${stats.minted}.`);\n }\n const operatorLower = recap.operator?.toLowerCase?.() ?? \"\";\n const mintedByOwner = minted.filter((entry) => entry.mintedBy?.toLowerCase() === operatorLower).length;\n const mintedByDelegates = minted.length - mintedByOwner;\n if (stats.mintedByOwner !== mintedByOwner) {\n throw new Error(`Recap stats mintedByOwner mismatch: expected ${mintedByOwner}, found ${stats.mintedByOwner}.`);\n }\n if (stats.mintedByDelegates !== mintedByDelegates) {\n throw new Error(`Recap stats mintedByDelegates mismatch: expected ${mintedByDelegates}, found ${stats.mintedByDelegates}.`);\n }\n const soldCount = minted.filter((entry) => entry.status === \"SOLD\").length;\n const listedCount = minted.filter((entry) => entry.status === \"LISTED\").length;\n const forceDelistedCount = minted.filter((entry) => entry.status === \"FORCE_DELISTED\").length;\n const sealedCount = minted.filter((entry) => !entry.fusionRevealed).length;\n const revealedCount = minted.filter((entry) => entry.fusionRevealed).length;\n\n if (stats.sold !== soldCount) {\n throw new Error(`Recap stats sold mismatch: expected ${soldCount}, found ${stats.sold}.`);\n }\n if (stats.listed !== listedCount) {\n throw new Error(`Recap stats listed mismatch: expected ${listedCount}, found ${stats.listed}.`);\n }\n if (stats.forceDelisted !== forceDelistedCount) {\n throw new Error(`Recap stats forceDelisted mismatch: expected ${forceDelistedCount}, found ${stats.forceDelisted}.`);\n }\n if (stats.sealed !== sealedCount) {\n throw new Error(`Recap stats sealed mismatch: expected ${sealedCount}, found ${stats.sealed}.`);\n }\n if (stats.revealed !== revealedCount) {\n throw new Error(`Recap stats revealed mismatch: expected ${revealedCount}, found ${stats.revealed}.`);\n }\n if (stats.sealed + stats.revealed !== minted.length) {\n throw new Error(\"Recap stats sealed/revealed counts do not total minted count.\");\n }\n\n const totalConfidenceDecimal = minted.reduce((acc, entry) => acc + entryConfidenceDecimal(entry), 0);\n const averageConfidence = minted.length ? totalConfidenceDecimal / minted.length : 0;\n const peakConfidence = minted.reduce(\n (acc, entry) => Math.max(acc, entryConfidenceDecimal(entry)),\n minted.length ? entryConfidenceDecimal(minted[0]) : 0,\n );\n const floorConfidence = minted.reduce(\n (acc, entry) => Math.min(acc, entryConfidenceDecimal(entry)),\n minted.length ? entryConfidenceDecimal(minted[0]) : 0,\n );\n const capabilityIndex = averageConfidence * 0.6 + peakConfidence * 0.4;\n\n assertWithinTolerance(stats.averageConfidencePercent, Number((averageConfidence * 100).toFixed(2)), 0.15, \"Average confidence percent\");\n assertWithinTolerance(stats.capabilityIndexPercent, Number((capabilityIndex * 100).toFixed(2)), 0.2, \"Capability index percent\");\n assertWithinTolerance(stats.confidencePeakPercent, Number((peakConfidence * 100).toFixed(2)), 0.15, \"Peak confidence percent\");\n assertWithinTolerance(stats.confidenceFloorPercent, Number((floorConfidence * 100).toFixed(2)), 0.2, \"Floor confidence percent\");\n\n for (const entry of minted) {\n const scenarioConfidenceBps = Math.round((entry.scenario?.confidence ?? 0) * 10_000);\n if (entryConfidenceBps(entry) !== scenarioConfidenceBps) {\n throw new Error(`Confidence basis points mismatch for recap token ${entry.tokenId}.`);\n }\n const scenarioForecast = entry.scenario?.forecastValue ?? \"\";\n if (!entry.forecastValue) {\n throw new Error(`Forecast value missing for recap token ${entry.tokenId}.`);\n }\n if (scenarioForecast && entry.forecastValue !== scenarioForecast) {\n throw new Error(`Forecast value divergence for recap token ${entry.tokenId}.`);\n }\n }\n\n const forecastTotal = minted.reduce(\n (acc, entry) =>\n acc + parseForecastValueTrillions(entry.forecastValue ?? entry.scenario?.forecastValue ?? \"0\"),\n 0,\n );\n assertWithinTolerance(stats.forecastValueTrillions, Number(forecastTotal.toFixed(2)), 0.2, \"Forecast value trillions\");\n\n if (stats.telemetryEntries !== recap.telemetry.length) {\n throw new Error(\n `Recap stats telemetryEntries mismatch: expected ${recap.telemetry.length}, found ${stats.telemetryEntries}.`,\n );\n }\n}\n\nfunction addressesEqual(a?: string, b?: string): boolean {\n return (a ?? \"\").toLowerCase() === (b ?? \"\").toLowerCase();\n}\n\nasync function verifyLedger(recap: RecapFile): Promise<LedgerFile> {\n await ensureExists(ledgerPath, \"Ledger dataset\");\n const raw = await readFile(ledgerPath, \"utf8\");\n const ledger = JSON.parse(raw) as LedgerFile;\n\n if (!ledger || !Array.isArray(ledger.minted)) {\n throw new Error(\"Ledger structure invalid – expected minted array.\");\n }\n if (ledger.minted.length !== recap.minted.length) {\n throw new Error(\n `Ledger minted count mismatch: expected ${recap.minted.length}, found ${ledger.minted.length}.`,\n );\n }\n\n if (!Array.isArray(ledger.sentinelPause) || !Array.isArray(ledger.ownerResume)) {\n throw new Error(\"Ledger missing sentinelPause/ownerResume arrays.\");\n }\n\n if (!ledger.scenario || ledger.scenario.path !== recap.scenarioSource.path) {\n throw new Error(\"Ledger scenario path mismatch compared to recap.\");\n }\n if (!ledger.scenario || ledger.scenario.sha256 !== recap.scenarioSource.sha256) {\n throw new Error(\"Ledger scenario hash mismatch compared to recap.\");\n }\n\n if (typeof ledger.feeBps === \"number\" && ledger.feeBps !== recap.feeBps) {\n throw new Error(`Ledger feeBps (${ledger.feeBps}) does not match recap feeBps (${recap.feeBps}).`);\n }\n if (ledger.treasury && !addressesEqual(ledger.treasury, recap.treasury)) {\n throw new Error(\"Ledger treasury address does not match recap treasury.\");\n }\n\n const recapByToken = new Map(recap.minted.map((entry) => [entry.tokenId, entry]));\n for (const entry of ledger.minted) {\n const recapEntry = recapByToken.get(entry.tokenId);\n if (!recapEntry) {\n throw new Error(`Ledger references unknown token ${entry.tokenId}.`);\n }\n if (!entry.mintTxHash || entry.mintTxHash.length < 10) {\n throw new Error(`Ledger mintTxHash missing or invalid for token ${entry.tokenId}.`);\n }\n if (!addressesEqual(entry.mintedBy, recapEntry.mintedBy)) {\n throw new Error(`Ledger mintedBy mismatch for token ${entry.tokenId}.`);\n }\n if (!addressesEqual(entry.mintedTo, recapEntry.mintedTo)) {\n throw new Error(`Ledger mintedTo mismatch for token ${entry.tokenId}.`);\n }\n if (!addressesEqual(entry.finalCustodian, recapEntry.finalCustodian)) {\n throw new Error(`Ledger finalCustodian mismatch for token ${entry.tokenId}.`);\n }\n if (entry.status !== recapEntry.status) {\n throw new Error(`Ledger status mismatch for token ${entry.tokenId}.`);\n }\n if (entry.confidenceBps !== entryConfidenceBps(recapEntry)) {\n throw new Error(`Ledger confidenceBps mismatch for token ${entry.tokenId}.`);\n }\n if (entry.confidencePercent !== Math.round(entryConfidenceDecimal(recapEntry) * 10000) / 100) {\n throw new Error(`Ledger confidencePercent mismatch for token ${entry.tokenId}.`);\n }\n if (entry.forecastValue !== (recapEntry.forecastValue ?? recapEntry.scenario?.forecastValue ?? \"\")) {\n throw new Error(`Ledger forecastValue mismatch for token ${entry.tokenId}.`);\n }\n if (recapEntry.status !== \"HELD\" && (!entry.listingTxHash || entry.listingTxHash.length < 10)) {\n throw new Error(`Ledger missing listingTxHash for active market token ${entry.tokenId}.`);\n }\n const repricingNotes = (recapEntry.ownerActions ?? []).filter((action) =>\n action.toLowerCase().includes(\"repriced\"),\n ).length;\n const repricingHashes = entry.repricingTxHashes ?? [];\n if (repricingHashes.length < repricingNotes) {\n throw new Error(\n `Ledger repricingTxHashes count ${repricingHashes.length} lower than repricing actions ${repricingNotes} for token ${entry.tokenId}.`,\n );\n }\n const ledgerSaleHash = entry.sale?.transactionHash ?? entry.saleTxHash ?? null;\n const recapSaleHash = recapEntry.sale?.transactionHash ?? null;\n if (ledgerSaleHash || recapSaleHash) {\n if (!ledgerSaleHash || !recapSaleHash || ledgerSaleHash !== recapSaleHash) {\n throw new Error(`Ledger sale hash mismatch for token ${entry.tokenId}.`);\n }\n }\n if (recapEntry.sale && entry.sale) {\n if (entry.sale.price !== recapEntry.sale.price || entry.sale.netPayout !== recapEntry.sale.netPayout) {\n throw new Error(`Ledger sale details mismatch for token ${entry.tokenId}.`);\n }\n } else if (!!recapEntry.sale !== !!entry.sale) {\n throw new Error(`Ledger sale presence mismatch for token ${entry.tokenId}.`);\n }\n if (recapEntry.status === \"FORCE_DELISTED\" && (!entry.forceDelistTxHash || entry.forceDelistTxHash.length < 10)) {\n throw new Error(`Ledger missing forceDelistTxHash for token ${entry.tokenId}.`);\n }\n if (recapEntry.status === \"SOLD\" && (!entry.resolutionTxHash || entry.resolutionTxHash.length < 10)) {\n throw new Error(`Ledger missing resolutionTxHash for sold token ${entry.tokenId}.`);\n }\n if (entry.fusion) {\n if (entry.fusion.revealed !== recapEntry.fusionRevealed) {\n throw new Error(`Ledger fusion.revealed mismatch for token ${entry.tokenId}.`);\n }\n if (entry.fusion.uri !== recapEntry.fusionURI) {\n throw new Error(`Ledger fusion.uri mismatch for token ${entry.tokenId}.`);\n }\n }\n }\n\n const requiredPauseContracts = [\n { name: \"AlphaInsightExchange\", address: recap.contracts.foresightExchange },\n { name: \"AlphaInsightNovaSeed\", address: recap.contracts.novaSeed },\n { name: \"InsightAccessToken\", address: recap.contracts.settlementToken },\n ];\n\n if (ledger.sentinelPause.length < requiredPauseContracts.length) {\n throw new Error(\"Ledger sentinelPause section missing entries for pause drill.\");\n }\n for (const contract of requiredPauseContracts) {\n const pauseRecord = ledger.sentinelPause.find(\n (entry) => entry.contract === contract.name && addressesEqual(entry.address, contract.address),\n );\n if (!pauseRecord || !pauseRecord.hash || pauseRecord.hash.length < 10) {\n throw new Error(`Ledger missing sentinel pause transaction for ${contract.name}.`);\n }\n const resumeRecord = ledger.ownerResume.find(\n (entry) => entry.contract === contract.name && addressesEqual(entry.address, contract.address),\n );\n if (!resumeRecord || !resumeRecord.hash || resumeRecord.hash.length < 10) {\n throw new Error(`Ledger missing owner resume transaction for ${contract.name}.`);\n }\n }\n\n return ledger;\n}\n\nasync function verifyOwnerBrief(minted: RecapMintedEntry[], stats: RecapStats) {\n await ensureExists(ownerBriefPath, \"Owner brief\");\n const content = await readFile(ownerBriefPath, \"utf8\");\n const requiredSections = [\n \"# α-AGI Insight MARK – Owner Command Brief\",\n \"## Rapid Command Checklist\",\n \"## Sector Timeline\",\n \"## Intelligence Signals\",\n ];\n for (const section of requiredSections) {\n if (!content.includes(section)) {\n throw new Error(`Owner brief missing section: ${section}`);\n }\n }\n const mintedLine = content\n .split(/\\r?\\n/)\n .find((line) => line.includes(\"Minted Nova-Seeds:\"));\n if (!mintedLine) {\n throw new Error(\"Owner brief missing Minted Nova-Seeds line.\");\n }\n if (!mintedLine.includes(String(stats.minted))) {\n throw new Error(\"Owner brief minted count does not match stats block.\");\n }\n const marketLine = content\n .split(/\\r?\\n/)\n .find((line) => line.includes(\"Live market activity:\"));\n if (!marketLine) {\n throw new Error(\"Owner brief missing Live market activity line.\");\n }\n if (!marketLine.includes(`${stats.sold}`) || !marketLine.includes(`${stats.listed}`) || !marketLine.includes(`${stats.forceDelisted}`)) {\n throw new Error(\"Owner brief market activity line does not match stats block.\");\n }\n\n const tableRows = content\n .split(/\\r?\\n/)\n .filter((line) => line.startsWith(\"| #\"));\n if (tableRows.length !== minted.length) {\n throw new Error(`Owner brief table expected ${minted.length} rows, found ${tableRows.length}.`);\n }\n for (const entry of minted) {\n const row = tableRows.find((line) => line.includes(`#${entry.tokenId}`));\n if (!row) {\n throw new Error(`Owner brief table missing token ${entry.tokenId}.`);\n }\n if (!row.includes(entry.scenario.sector)) {\n throw new Error(`Owner brief row for token ${entry.tokenId} missing sector ${entry.scenario.sector}.`);\n }\n }\n}\n\nasync function verifySafetyChecklist(recap: RecapFile) {\n await ensureExists(safetyChecklistPath, \"Safety checklist\");\n const content = await readFile(safetyChecklistPath, \"utf8\");\n const requiredSections = [\n \"# α-AGI Insight MARK – Safety & Control Checklist\",\n \"## Contract Command Matrix\",\n \"## Sentinel Drills\",\n \"## Parameter Overrides\",\n \"## Integrity Assertions\",\n ];\n for (const section of requiredSections) {\n if (!content.includes(section)) {\n throw new Error(`Safety checklist missing section: ${section}`);\n }\n }\n\n const lines = content.split(/\\r?\\n/);\n const tableRows = lines.filter(\n (line) => line.startsWith(\"| \") && !line.startsWith(\"| Contract \") && !line.startsWith(\"| ---\")\n );\n const expectedContracts = [\n { name: \"InsightAccessToken\", address: recap.contracts.settlementToken },\n { name: \"AlphaInsightNovaSeed\", address: recap.contracts.novaSeed },\n { name: \"AlphaInsightExchange\", address: recap.contracts.foresightExchange },\n ];\n if (tableRows.length !== expectedContracts.length) {\n throw new Error(\n `Safety checklist expected ${expectedContracts.length} contract rows, found ${tableRows.length}.`\n );\n }\n for (const contract of expectedContracts) {\n const row = tableRows.find((line) => line.includes(`| ${contract.name} |`));\n if (!row) {\n throw new Error(`Safety checklist table missing contract ${contract.name}.`);\n }\n if (!row.includes(contract.address)) {\n throw new Error(`Safety checklist row for ${contract.name} missing address ${contract.address}.`);\n }\n }\n\n const addressTokens = [\n recap.operator,\n recap.oracle,\n recap.systemPause,\n recap.treasury,\n recap.contracts.novaSeed,\n recap.contracts.foresightExchange,\n recap.contracts.settlementToken,\n ];\n for (const token of addressTokens) {\n if (!content.includes(token)) {\n throw new Error(`Safety checklist missing critical address ${token}.`);\n }\n }\n\n if (!recap.stats) {\n throw new Error(\"Safety checklist validation requires stats block.\");\n }\n const stats = recap.stats;\n const mintedLine = `Nova-Seeds minted: ${stats.minted} (owner ${stats.mintedByOwner}, delegates ${stats.mintedByDelegates}).`;\n const marketLine = `Market custody positions: ${stats.sold} sold • ${stats.listed} listed • ${stats.forceDelisted} sentinel custody.`;\n const fusionLine = `Fusion dossiers: ${stats.revealed} revealed • ${stats.sealed} sealed.`;\n const floorSummary = stats.confidenceFloorPercent.toFixed(1);\n const peakSummary = stats.confidencePeakPercent.toFixed(1);\n const capabilitySummary = stats.capabilityIndexPercent.toFixed(1);\n const capabilityLine = `Confidence envelope: floor ${floorSummary}% → peak ${peakSummary}% (capability ${capabilitySummary}%).`;\n const opportunityLine = `Opportunity magnitude: ${stats.forecastValueTrillions.toFixed(2)}T.`;\n const scenarioLine = `Scenario dataset sha256 ${recap.scenarioSource.sha256}.`;\n const checklistLines = [mintedLine, marketLine, fusionLine, capabilityLine, opportunityLine, scenarioLine];\n for (const line of checklistLines) {\n if (!content.includes(line)) {\n throw new Error(`Safety checklist missing integrity assertion: ${line}`);\n }\n }\n\n const treasuryLine = `Exchange treasury routed to \\`${recap.treasury}\\`; retarget via \\`setTreasury(address)\\`.`;\n if (!content.includes(treasuryLine)) {\n throw new Error(\"Safety checklist missing treasury override line.\");\n }\n const oracleLine = `Exchange oracle anchored to \\`${recap.oracle}\\`; rotate via \\`setOracle(address)\\`.`;\n if (!content.includes(oracleLine)) {\n throw new Error(\"Safety checklist missing oracle override line.\");\n }\n const feePercentDisplay = (recap.feeBps / 100).toFixed(2);\n const feeLine = `- Trading fee configured at ${feePercentDisplay}% (\\`${recap.feeBps} bps\\`); adjust with \\`setFeeBps(uint96)\\`.`;\n if (!content.includes(feeLine)) {\n throw new Error(\"Safety checklist missing fee override line.\");\n }\n const tokenLine = `- Settlement token \\`${recap.contracts.settlementToken}\\` remains owner-mintable and can be rotated with \\`setPaymentToken(address)\\`.`;\n if (!content.includes(tokenLine)) {\n throw new Error(\"Safety checklist missing settlement token override line.\");\n }\n const sentinelLine = `- System sentinel handshake enforced across modules via \\`setSystemPause(address)\\` (current \\`${recap.systemPause}\\`).`;\n if (!content.includes(sentinelLine)) {\n throw new Error(\"Safety checklist missing sentinel override line.\");\n }\n const drillLine = `- Delegated sentinel \\`${recap.systemPause}\\` executed pause() across Insight Access Token, α-AGI Nova-Seed, and Insight Exchange before owner \\`${recap.operator}\\` restored operations.`;\n if (!content.includes(drillLine)) {\n throw new Error(\"Safety checklist missing sentinel drill summary.\");\n }\n if (!content.includes(\"Liquidity reserve minted via `mint(address,uint256)`\")) {\n throw new Error(\"Safety checklist missing liquidity reserve drill line.\");\n }\n}\n\nasync function verifyCsv(minted: RecapMintedEntry[]) {\n await ensureExists(csvPath, \"Market matrix CSV\");\n const content = await readFile(csvPath, \"utf8\");\n const lines = content\n .split(/\\r?\\n/)\n .map((line) => line.trim())\n .filter((line) => line.length > 0);\n if (lines.length < minted.length + 1) {\n throw new Error(\"Market matrix CSV has fewer rows than minted entries.\");\n }\n const header = splitCsvLine(lines[0]);\n const expectedHeader = [\n \"tokenId\",\n \"sector\",\n \"ruptureYear\",\n \"confidence\",\n \"confidenceBps\",\n \"status\",\n \"marketState\",\n \"custodian\",\n \"mintedTo\",\n \"mintedBy\",\n \"fusionURI\",\n \"sealedURI\",\n \"disruptionTimestamp\",\n \"forecastValue\",\n \"ownerActions\",\n ];\n if (header.join(\",\") !== expectedHeader.join(\",\")) {\n throw new Error(\"Market matrix CSV header mismatch.\");\n }\n const records = new Map<string, Record<string, string>>();\n for (const line of lines.slice(1)) {\n const values = splitCsvLine(line);\n if (values.length !== header.length) {\n throw new Error(`CSV row has unexpected column count: ${line}`);\n }\n const record: Record<string, string> = {};\n for (let i = 0; i < header.length; i += 1) {\n record[header[i]] = values[i];\n }\n if (records.has(record.tokenId)) {\n throw new Error(`Duplicate token ${record.tokenId} detected in CSV.`);\n }\n records.set(record.tokenId, record);\n }\n if (records.size !== minted.length) {\n throw new Error(`CSV records (${records.size}) do not match minted count (${minted.length}).`);\n }\n for (const entry of minted) {\n const record = records.get(entry.tokenId);\n if (!record) {\n throw new Error(`CSV missing record for token ${entry.tokenId}.`);\n }\n if (record.status !== entry.status) {\n throw new Error(`CSV status mismatch for token ${entry.tokenId}.`);\n }\n if (record.fusionURI !== entry.fusionURI) {\n throw new Error(`CSV fusionURI mismatch for token ${entry.tokenId}.`);\n }\n if (record.sealedURI !== entry.scenario.sealedURI) {\n throw new Error(`CSV sealedURI mismatch for token ${entry.tokenId}.`);\n }\n if (record.disruptionTimestamp !== entry.disruptionTimestamp) {\n throw new Error(`CSV disruptionTimestamp mismatch for token ${entry.tokenId}.`);\n }\n if (record.forecastValue !== (entry.forecastValue ?? entry.scenario.forecastValue)) {\n throw new Error(`CSV forecastValue mismatch for token ${entry.tokenId}.`);\n }\n const expectedConfidence = formatPercent(entryConfidenceDecimal(entry));\n if (record.confidence !== expectedConfidence) {\n throw new Error(`CSV confidence mismatch for token ${entry.tokenId}: expected ${expectedConfidence}, got ${record.confidence}.`);\n }\n const expectedConfidenceBps = entryConfidenceBps(entry).toString();\n if (record.confidenceBps !== expectedConfidenceBps) {\n throw new Error(`CSV confidenceBps mismatch for token ${entry.tokenId}.`);\n }\n const expectedCustodian = shortenAddress(entry.finalCustodian);\n if (record.custodian !== expectedCustodian) {\n throw new Error(`CSV custodian mismatch for token ${entry.tokenId}.`);\n }\n const expectedMintedTo = shortenAddress(entry.mintedTo);\n const expectedMintedBy = shortenAddress(entry.mintedBy);\n if (record.mintedTo !== expectedMintedTo) {\n throw new Error(`CSV mintedTo mismatch for token ${entry.tokenId}.`);\n }\n if (record.mintedBy !== expectedMintedBy) {\n throw new Error(`CSV mintedBy mismatch for token ${entry.tokenId}.`);\n }\n const expectedState = expectedMarketState(entry);\n if (record.marketState !== expectedState) {\n throw new Error(`CSV marketState mismatch for token ${entry.tokenId}.`);\n }\n const expectedOwnerActions = entry.ownerActions.join(\"; \");\n if (record.ownerActions !== expectedOwnerActions) {\n throw new Error(`CSV ownerActions mismatch for token ${entry.tokenId}.`);\n }\n }\n}\n\nasync function verifyTelemetry(expected: TelemetryEntry[]) {\n await ensureExists(telemetryPath, \"Telemetry log\");\n const content = await readFile(telemetryPath, \"utf8\");\n const lines = content\n .split(/\\r?\\n/)\n .map((line) => line.trim())\n .filter((line) => line.length > 0);\n if (lines.length !== expected.length) {\n throw new Error(`Telemetry log length mismatch: expected ${expected.length} entries, found ${lines.length}.`);\n }\n const requiredAgents = [\"Meta-Sentinel\", \"Thermodynamic Oracle\", \"Guardian Auditor\"];\n for (const agent of requiredAgents) {\n if (!lines.some((line) => line.includes(`[${agent}]`))) {\n throw new Error(`Telemetry log missing agent transcript for ${agent}.`);\n }\n }\n}\n\nasync function verifyMarkdown() {\n await ensureExists(markdownPath, \"Markdown report\");\n const content = await readFile(markdownPath, \"utf8\");\n const requiredSections = [\n \"# α-AGI Insight MARK Recap\",\n \"## Superintelligent Engine Summary\",\n \"## Operational Command Metrics\",\n \"## Owner Command Hooks\",\n \"## Telemetry Snapshot\",\n ];\n for (const section of requiredSections) {\n if (!content.includes(section)) {\n throw new Error(`Markdown report missing section: ${section}`);\n }\n }\n}\n\nasync function verifyHtml() {\n await ensureExists(htmlPath, \"Executive HTML report\");\n const content = await readFile(htmlPath, \"utf8\");\n const snippets = [\n \"α-AGI Insight MARK Executive Report\",\n \"Superintelligent Engine Pulse\",\n \"Operational Command Metrics\",\n \"Disruption Timeline\",\n \"Nova-Seed Market Matrix\",\n \"Owner Command Hooks\",\n ];\n for (const snippet of snippets) {\n if (!content.includes(snippet)) {\n throw new Error(`Executive HTML report missing snippet: ${snippet}`);\n }\n }\n}\n\nasync function verifyControlMatrix(): Promise<ControlMatrixFile> {\n await ensureExists(matrixPath, \"Control matrix\");\n const content = await readFile(matrixPath, \"utf8\");\n const parsed = JSON.parse(content) as ControlMatrixFile;\n const expectedNames = [\"InsightAccessToken\", \"AlphaInsightNovaSeed\", \"AlphaInsightExchange\"];\n const contracts = parsed.contracts ?? [];\n for (const name of expectedNames) {\n if (!contracts.some((entry) => entry.name === name)) {\n throw new Error(`Control matrix missing contract entry: ${name}`);\n }\n }\n for (const entry of contracts) {\n if (!entry.address || !entry.owner) {\n throw new Error(`Control matrix entry ${entry.name} missing address or owner.`);\n }\n if (!Array.isArray(entry.configurable) || entry.configurable.length === 0) {\n throw new Error(`Control matrix entry ${entry.name} missing configurable hooks.`);\n }\n }\n return parsed;\n}\n\nasync function verifyMermaidFiles(minted: RecapMintedEntry[]) {\n await ensureExists(mermaidSuperintelligencePath, \"Superintelligence mermaid\");\n await ensureExists(mermaidGovernancePath, \"Governance mermaid\");\n await ensureExists(mermaidConstellationPath, \"Constellation mermaid\");\n await ensureExists(mermaidControlMapPath, \"Control map mermaid\");\n await ensureExists(mermaidAgencyOrbitPath, \"Agency orbit mermaid\");\n await ensureExists(mermaidLifecyclePath, \"Lifecycle mermaid\");\n await ensureExists(ownerSupremacyPath, \"Owner supremacy dossier\");\n await ensureExists(ownerLatticePath, \"Owner lattice mermaid\");\n\n const superintelligence = await readFile(mermaidSuperintelligencePath, \"utf8\");\n const governance = await readFile(mermaidGovernancePath, \"utf8\");\n const constellation = await readFile(mermaidConstellationPath, \"utf8\");\n const controlMap = await readFile(mermaidControlMapPath, \"utf8\");\n const agencyOrbit = await readFile(mermaidAgencyOrbitPath, \"utf8\");\n const lifecycle = await readFile(mermaidLifecyclePath, \"utf8\");\n const ownerLattice = await readFile(ownerLatticePath, \"utf8\");\n\n const superTokens = [\"Meta-Agentic Tree Search\", \"Thermodynamic Rupture Trigger\", \"AGI Capability Index\"];\n for (const token of superTokens) {\n if (!superintelligence.includes(token)) {\n throw new Error(`Superintelligence mermaid missing token: ${token}`);\n }\n }\n\n if (!governance.includes(\"System Pause Sentinel\")) {\n throw new Error(\"Governance mermaid missing sentinel reference.\");\n }\n if (!controlMap.includes(\"System Pause Sentinel\")) {\n throw new Error(\"Control map mermaid missing sentinel node.\");\n }\n const requiredControlNodes = [\"Insight Exchange\", \"Insight Access Token\", \"α-AGI Nova-Seed\"];\n for (const label of requiredControlNodes) {\n if (!controlMap.includes(label)) {\n throw new Error(`Control map mermaid missing ${label} node.`);\n }\n }\n if (!constellation.includes(\"Insight Exchange\")) {\n throw new Error(\"Constellation mermaid missing Insight Exchange node.\");\n }\n if (!constellation.includes(\"pause sweep\")) {\n throw new Error(\"Constellation mermaid missing pause sweep annotations.\");\n }\n const agentOrbitLabels = [\n \"Meta-Agent Constellation\",\n \"Meta-Sentinel\",\n \"MATS Engine\",\n \"Thermodynamic Oracle\",\n \"FusionSmith\",\n \"Guardian Auditor\",\n \"Venture Cartographer\",\n \"System Sentinel\",\n \"α-AGI MARK Market Grid\",\n ];\n for (const label of agentOrbitLabels) {\n if (!agencyOrbit.includes(label)) {\n throw new Error(`Agency orbit mermaid missing ${label} annotation.`);\n }\n }\n const lifecycleTokens = [\n \"Meta-Agentic Swarm\",\n \"α-AGI Nova-Seed Forge\",\n \"α-AGI MARK Exchange\",\n \"System Pause Sentinel\",\n \"Treasury Governance\",\n ];\n for (const token of lifecycleTokens) {\n if (!lifecycle.includes(token)) {\n throw new Error(`Lifecycle mermaid missing ${token} participant.`);\n }\n }\n if (!ownerLattice.includes(\"owner((Owner\")) {\n throw new Error(\"Owner lattice mermaid missing owner node.\");\n }\n if (!ownerLattice.includes(\"sentinel((Sentinel\")) {\n throw new Error(\"Owner lattice mermaid missing sentinel node.\");\n }\n if (!ownerLattice.includes(\"fee flow\")) {\n throw new Error(\"Owner lattice mermaid missing fee flow edge.\");\n }\n for (const entry of minted) {\n const nodeId = `seed${entry.tokenId}`;\n if (!agencyOrbit.includes(nodeId)) {\n throw new Error(`Agency orbit mermaid missing node ${nodeId}.`);\n }\n if (!agencyOrbit.includes(entry.scenario.sector)) {\n throw new Error(`Agency orbit mermaid missing sector label ${entry.scenario.sector}.`);\n }\n }\n for (const entry of minted) {\n const tokenSnippet = `Token #${entry.tokenId}`;\n if (!governance.includes(tokenSnippet)) {\n throw new Error(`Governance mermaid missing token snippet for #${entry.tokenId}.`);\n }\n const mintedShort = shortenAddress(entry.mintedTo);\n if (!governance.includes(mintedShort)) {\n throw new Error(`Governance mermaid missing minted custodian ${mintedShort} for token ${entry.tokenId}.`);\n }\n const finalShort = shortenAddress(entry.finalCustodian);\n if (!governance.includes(finalShort)) {\n throw new Error(`Governance mermaid missing final custodian ${finalShort} for token ${entry.tokenId}.`);\n }\n const statusParts = [formatTitleCase(entry.status)];\n if (entry.sale) {\n statusParts.push(`${entry.sale.price} AIC`);\n }\n for (const snippet of statusParts) {\n if (!governance.includes(snippet)) {\n throw new Error(\n `Governance mermaid missing status snippet \"${snippet}\" for token ${entry.tokenId}.`,\n );\n }\n }\n }\n for (const entry of minted) {\n const tokenNode = `token${entry.tokenId}`;\n if (!constellation.includes(tokenNode)) {\n throw new Error(`Constellation mermaid missing node for token ${entry.tokenId}.`);\n }\n if (!ownerLattice.includes(`#${entry.tokenId}`)) {\n throw new Error(`Owner lattice mermaid missing Nova-Seed #${entry.tokenId} node.`);\n }\n }\n}\n\nasync function verifyOwnerSupremacy(\n recap: RecapFile,\n ledger: LedgerFile,\n controlMatrix: ControlMatrixFile,\n) {\n await ensureExists(ownerSupremacyPath, \"Owner supremacy dossier\");\n const content = await readFile(ownerSupremacyPath, \"utf8\");\n const dossier = JSON.parse(content) as OwnerSupremacyFile;\n\n if (!addressesEqual(dossier.owner, recap.operator)) {\n throw new Error(\"Owner supremacy owner address mismatch with recap operator.\");\n }\n if (!addressesEqual(dossier.sentinel, recap.systemPause)) {\n throw new Error(\"Owner supremacy sentinel mismatch with recap system pause.\");\n }\n if (!addressesEqual(dossier.oracle, recap.oracle)) {\n throw new Error(\"Owner supremacy oracle mismatch with recap oracle.\");\n }\n if (!addressesEqual(dossier.treasury, recap.treasury)) {\n throw new Error(\"Owner supremacy treasury mismatch with recap treasury.\");\n }\n if (dossier.feeBps !== recap.feeBps) {\n throw new Error(\"Owner supremacy feeBps mismatch with recap fee configuration.\");\n }\n\n if (dossier.crossChecks.mintedRecap !== recap.minted.length) {\n throw new Error(\"Owner supremacy mintedRecap count mismatch.\");\n }\n if (dossier.crossChecks.mintedLedger !== ledger.minted.length) {\n throw new Error(\"Owner supremacy mintedLedger count mismatch.\");\n }\n if (!dossier.crossChecks.mintedMatch) {\n throw new Error(\"Owner supremacy mintedMatch assertion failed.\");\n }\n if (!Array.isArray(dossier.crossChecks.onchainOwnership)) {\n throw new Error(\"Owner supremacy onchainOwnership missing.\");\n }\n if (dossier.crossChecks.onchainOwnership.length !== recap.minted.length) {\n throw new Error(\"Owner supremacy on-chain ownership length mismatch.\");\n }\n const ledgerByToken = new Map(ledger.minted.map((entry) => [entry.tokenId, entry]));\n const recapByToken = new Map(recap.minted.map((entry) => [entry.tokenId, entry]));\n for (const record of dossier.crossChecks.onchainOwnership) {\n const ledgerEntry = ledgerByToken.get(record.tokenId);\n if (!ledgerEntry) {\n throw new Error(`Owner supremacy references unknown token ${record.tokenId}.`);\n }\n if (!record.owner || record.owner.length < 10) {\n throw new Error(`Owner supremacy ownership entry missing owner for token ${record.tokenId}.`);\n }\n const recapEntry = recapByToken.get(record.tokenId);\n if (!recapEntry) {\n throw new Error(`Owner supremacy token ${record.tokenId} missing from recap dossier.`);\n }\n if (!addressesEqual(record.owner, ledgerEntry.finalCustodian)) {\n throw new Error(\n `Owner supremacy on-chain owner ${record.owner} does not match ledger custodian ${ledgerEntry.finalCustodian} for token ${record.tokenId}.`,\n );\n }\n if (!addressesEqual(record.owner, recapEntry.finalCustodian)) {\n throw new Error(\n `Owner supremacy on-chain owner ${record.owner} does not match recap custodian ${recapEntry.finalCustodian} for token ${record.tokenId}.`,\n );\n }\n }\n if (!dossier.crossChecks.treasuryBalance || Number.isNaN(Number(dossier.crossChecks.treasuryBalance))) {\n throw new Error(\"Owner supremacy treasuryBalance missing or invalid.\");\n }\n if (dossier.crossChecks.sentinelPauses !== ledger.sentinelPause.length) {\n throw new Error(\"Owner supremacy sentinelPauses count mismatch.\");\n }\n if (dossier.crossChecks.ownerResumes !== ledger.ownerResume.length) {\n throw new Error(\"Owner supremacy ownerResumes count mismatch.\");\n }\n\n const controlEntries = controlMatrix.contracts ?? [];\n const controlByName = new Map(controlEntries.map((entry) => [entry.name, entry]));\n if (!Array.isArray(dossier.controls) || dossier.controls.length !== controlByName.size) {\n throw new Error(\"Owner supremacy controls set mismatch.\");\n }\n for (const control of dossier.controls) {\n const matrixEntry = controlByName.get(control.name);\n if (!matrixEntry) {\n throw new Error(`Owner supremacy control ${control.name} not present in control matrix.`);\n }\n if (!addressesEqual(control.address, matrixEntry.address)) {\n throw new Error(`Owner supremacy control address mismatch for ${control.name}.`);\n }\n if (!addressesEqual(control.owner, matrixEntry.owner)) {\n throw new Error(`Owner supremacy control owner mismatch for ${control.name}.`);\n }\n const matrixHooks = new Set((matrixEntry.configurable ?? []).map((hook) => hook.toLowerCase()));\n for (const hook of control.hooks) {\n if (!matrixHooks.has(hook.toLowerCase())) {\n throw new Error(`Owner supremacy control hook ${hook} missing from control matrix for ${control.name}.`);\n }\n }\n if (matrixEntry.systemPause && !addressesEqual(control.sentinel ?? undefined, matrixEntry.systemPause)) {\n throw new Error(`Owner supremacy sentinel mismatch for ${control.name}.`);\n }\n }\n\n if (!Array.isArray(dossier.assertions) || dossier.assertions.length === 0) {\n throw new Error(\"Owner supremacy dossier missing assertions content.\");\n }\n}\n\nasync function main() {\n console.log(\"🔍 Validating α-AGI Insight MARK dossiers…\\n\");\n const manifest = await loadManifest();\n console.log(\"✅ Manifest loaded.\");\n\n await verifyManifest(manifest);\n console.log(\"✅ Manifest hashes verified.\");\n\n const recap = await verifyRecap();\n console.log(\n `✅ Recap dossier valid – ${recap.minted.length} insights minted on ${recap.network.name} (chainId ${recap.network.chainId}).`\n );\n\n validateRecapStats(recap);\n console.log(\"✅ Recap stats block cross-checked against minted ledger.\");\n\n const ledger = await verifyLedger(recap);\n console.log(\"✅ Foresight ledger validated against recap and transaction hashes.\");\n\n await verifyMarkdown();\n console.log(\"✅ Markdown executive summary verified.\");\n\n await verifyHtml();\n console.log(\"✅ Executive HTML dashboard verified.\");\n\n const controlMatrix = await verifyControlMatrix();\n console.log(\"✅ Owner control matrix verified.\");\n\n await verifyOwnerSupremacy(recap, ledger, controlMatrix);\n console.log(\"✅ Owner supremacy dossier aligned with ledger and governance controls.\");\n\n await verifyMermaidFiles(recap.minted);\n console.log(\"✅ Mermaid schematics verified.\");\n\n if (!recap.stats) {\n throw new Error(\"Recap stats unexpectedly missing after validation.\");\n }\n\n await verifyOwnerBrief(recap.minted, recap.stats);\n console.log(\"✅ Owner command brief aligned with minted inventory.\");\n\n await verifySafetyChecklist(recap);\n console.log(\"✅ Safety and control checklist validated.\");\n\n await verifyCsv(recap.minted);\n console.log(\"✅ Market matrix CSV synchronised with minted ledger.\");\n\n await verifyTelemetry(recap.telemetry);\n console.log(\"✅ Telemetry log matches orchestrator transcript.\");\n\n console.log(\"\\n🎖️ All α-AGI Insight MARK dossiers passed verification.\");\n}\n\nmain().catch((error) => {\n console.error(`❌ Verification failed: ${error instanceof Error ? error.message : String(error)}`);\n process.exitCode = 1;\n});\n","format":"text","sha256":"bbf5a5a411807f3a8670e91b3df723fbe9e5a70c920e69d69f382a660e2426ec","bytes":48426,"download":"/AGIJobsv0/examples/bbf5a5a411807f3a-verifyReports.ts","source":"https://github.com/MontrealAI/AGIJobsv0/blob/5b4cebb309a83a7a6749d8911d8bf96a1921e042/demo/alpha-agi-insight-mark/scripts/verifyReports.ts"}]}
FROM READING TO A REPRODUCIBLE RUN
Try the selected path. Node.js workspace Run from the repository root after nvm install, nvm use and npm ci. Use the versions pinned in .nvmrc and package.json. Commands below describe the selected path; optional app/server packages can have their own locked dependencies.
Complete environment setup ↗ SELECTED EXECUTION PATH Copy
npm run demo:alpha-agi-insight-markWhat you should observe The dedicated Hardhat scenario runs and produces insight reports. Inspect contract assertions and generated reports together.
The source inspector above reads bundled repository material. Local commands run separately on your computer. Recorded examples may contain historical timestamps, placeholders and simulated metrics.
MAKE IT YOUR OWN
One useful experiment. Trace one insight through issuance, access and exchange evidence. Identify which claim would still require independent evaluation of the insight itself.
THE SYSTEM, MADE VISIBLE
Architecture & relationships Architecture diagram · source preserved below
View original Mermaid source flowchart LR
Operators((Mission Owners)) --> demo_alpha_agi_insight_mark[[Demo → Alpha AGI Insight Mark]]
demo_alpha_agi_insight_mark --> Core[[AGI Jobs v0 (v2) Core Intelligence]]
Core --> Observability[[Unified CI / CD & Observability]]
Core --> Governance[[Owner Control Plane]]
WHEN SOMETHING DOESN’T MATCH
Troubleshooting A command or service fails Start at the first error, confirm the working directory and pinned toolchain, then follow the linked component guide. Optional packages and provider services have separate prerequisites.
A report looks successful but lacks evidence Check its source revision, configuration, timestamps and underlying events. Historical fixtures and generated plans do not prove a fresh execution.
TRACE THE CHECKS
Verification & next steps 3 tracked test source files are available in this directory. Inspect the tests and their environment before choosing a suite; file counts do not establish test results.
Browse the test sources For live commissioning, consult the production readiness record .
EVERY VARIANT, PRESERVED
Complete document library REPRODUCE & INSPECT
Registered commands Run commands from the repository root after following this demo's guide. Network and owner actions require their documented setup.
npm run demo:alpha-agi-insight-markCopy
Full command catalog and troubleshooting ↗