chainlesschain 0.166.150 → 0.166.157
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +45 -29
- package/package.json +2 -2
- package/src/assets/linux-subreaper/linux-arm64/manifest.json +1 -1
- package/src/assets/linux-subreaper/linux-x64/manifest.json +3 -3
- package/src/assets/linux-subreaper/linux-x64/supervisor +0 -0
- package/src/assets/web-panel/.build-hash +1 -1
- package/src/assets/web-panel/assets/{AIOps-bYMRw36k.js → AIOps-CraNGNgc.js} +1 -1
- package/src/assets/web-panel/assets/{ActionButton-xprOFj7C.js → ActionButton-C0jn6sgg.js} +1 -1
- package/src/assets/web-panel/assets/{Analytics-BRZ6F3vk.js → Analytics-DVrR_wjl.js} +1 -1
- package/src/assets/web-panel/assets/{AppLayout-C_volo3Y.js → AppLayout-CeKP8mgC.js} +1 -1
- package/src/assets/web-panel/assets/{Artifacts-Db0iD_H2.js → Artifacts-OHCS9wLN.js} +1 -1
- package/src/assets/web-panel/assets/{Audit-Bzp7NOA9.js → Audit-C77b6pDl.js} +1 -1
- package/src/assets/web-panel/assets/{BackgroundAgents-CPa5KqjU.js → BackgroundAgents-CefiwCgM.js} +1 -1
- package/src/assets/web-panel/assets/{Backup-BraBbkcd.js → Backup-B-5KmWNA.js} +1 -1
- package/src/assets/web-panel/assets/{BaseInput-D8LlXxCM.js → BaseInput-C3bJ1Qlc.js} +1 -1
- package/src/assets/web-panel/assets/{Chat-FWtdQ7HW.js → Chat-DBahPz9B.js} +1 -1
- package/src/assets/web-panel/assets/{ChatBubbleRenderer-DtxhjGV3.js → ChatBubbleRenderer-J4BVVrXZ.js} +1 -1
- package/src/assets/web-panel/assets/{Checkbox-BoCeVuib.js → Checkbox-w856fzfY.js} +1 -1
- package/src/assets/web-panel/assets/{Codegen-C58CW3JB.js → Codegen-XKmsL_C3.js} +1 -1
- package/src/assets/web-panel/assets/{Col-BlkVpYfD.js → Col-B37-gr7d.js} +1 -1
- package/src/assets/web-panel/assets/{Community-BmQ95FuI.js → Community-DdahlN0f.js} +1 -1
- package/src/assets/web-panel/assets/{Compact-BzWphLgo.js → Compact-oKnoE-9_.js} +1 -1
- package/src/assets/web-panel/assets/{Compliance-CG1Plf7v.js → Compliance-CnCRlOB_.js} +1 -1
- package/src/assets/web-panel/assets/{Cowork-CS8_XrAS.js → Cowork-D3Vr5R3E.js} +1 -1
- package/src/assets/web-panel/assets/{Cron-C1m-mGo0.js → Cron-X46CdLRQ.js} +1 -1
- package/src/assets/web-panel/assets/{Crosschain-TU1UPo_V.js → Crosschain-CV3_6jVw.js} +1 -1
- package/src/assets/web-panel/assets/{DID-bhbIsq__.js → DID-Kr6H4WKr.js} +1 -1
- package/src/assets/web-panel/assets/{Dashboard-B0wCsqTw.js → Dashboard-Bj4usrhx.js} +1 -1
- package/src/assets/web-panel/assets/{Dropdown-CVokY3lt.js → Dropdown-V3DPV21D.js} +1 -1
- package/src/assets/web-panel/assets/{EmailListRenderer-CfatTKx0.js → EmailListRenderer-8MCX0Y4b.js} +1 -1
- package/src/assets/web-panel/assets/{EvolutionSettings-DnT_Uiag.js → EvolutionSettings-SUoykpjc.js} +1 -1
- package/src/assets/web-panel/assets/{FamilyGuardDashboard-Dyahx8jQ.js → FamilyGuardDashboard-C0iE0T9x.js} +1 -1
- package/src/assets/web-panel/assets/{Federation-DuJ39hyj.js → Federation-CSU3kpK2.js} +1 -1
- package/src/assets/web-panel/assets/{FormItemContext-V4Ic5oQ_.js → FormItemContext-Bcv2XJNw.js} +1 -1
- package/src/assets/web-panel/assets/{GenericCardRenderer-UlZdAl_W.js → GenericCardRenderer-PdEqwQZd.js} +1 -1
- package/src/assets/web-panel/assets/{Git-B_363OIs.js → Git-CVZ0MSRN.js} +1 -1
- package/src/assets/web-panel/assets/{Governance-C61_SW_q.js → Governance-CF64-eGc.js} +1 -1
- package/src/assets/web-panel/assets/{Inference-CU80t_tb.js → Inference-DJ1J40Th.js} +1 -1
- package/src/assets/web-panel/assets/{KnowledgeGraph-BEtPQz8C.js → KnowledgeGraph-Cf3ULXmf.js} +1 -1
- package/src/assets/web-panel/assets/{Logs-CXqWvdFk.js → Logs-DM_RbXG_.js} +1 -1
- package/src/assets/web-panel/assets/{MarkdownRenderer-BFgkiBfA.js → MarkdownRenderer-B2wey_j8.js} +1 -1
- package/src/assets/web-panel/assets/{Marketplace-oKgzevz2.js → Marketplace-tqdANxLa.js} +1 -1
- package/src/assets/web-panel/assets/{McpTools-DHcNKyfb.js → McpTools-BiSYAtKB.js} +1 -1
- package/src/assets/web-panel/assets/{Memory-DEVpDL-x.js → Memory-hOvA-Tqp.js} +1 -1
- package/src/assets/web-panel/assets/{MobileBridge-D92T6ztp.js → MobileBridge-CIpwBK6G.js} +1 -1
- package/src/assets/web-panel/assets/{MobileProjects-B2Y7xpPw.js → MobileProjects-DMpV98oD.js} +1 -1
- package/src/assets/web-panel/assets/{Mtc-VOiGefD2.js → Mtc-CVoJZMuY.js} +1 -1
- package/src/assets/web-panel/assets/{MtcAudit-CAnmf1Im.js → MtcAudit-Dz9YsrvV.js} +1 -1
- package/src/assets/web-panel/assets/{Multisig-BCPOmJxC.js → Multisig-CamW3sTK.js} +1 -1
- package/src/assets/web-panel/assets/{NLProgramming-DYFqTLhe.js → NLProgramming-DlZo8q6W.js} +1 -1
- package/src/assets/web-panel/assets/{Notes--N-8WbHM.js → Notes-DZJSYibx.js} +1 -1
- package/src/assets/web-panel/assets/{NotificationSettings-Dka_XX0P.js → NotificationSettings-BSlIIGOM.js} +1 -1
- package/src/assets/web-panel/assets/{OrderTableRenderer-CIVkknQY.js → OrderTableRenderer-Bo9vImgU.js} +1 -1
- package/src/assets/web-panel/assets/{Organization-MToqvn2N.js → Organization-B1sBf0Kk.js} +1 -1
- package/src/assets/web-panel/assets/{Overflow-DgYLr6Hh.js → Overflow-CD8GUNOV.js} +1 -1
- package/src/assets/web-panel/assets/{P2P-DiRHC93-.js → P2P-CeaIuSa9.js} +1 -1
- package/src/assets/web-panel/assets/{PdhVaultBrowser-Cw8MYDt-.js → PdhVaultBrowser-DCOkcRse.js} +2 -2
- package/src/assets/web-panel/assets/{Permissions-JhxdHQqC.js → Permissions-DQCZnN_y.js} +1 -1
- package/src/assets/web-panel/assets/{PersonalDataHub-CcEeur_W.js → PersonalDataHub-D_9PtVvT.js} +1 -1
- package/src/assets/web-panel/assets/{Pipeline-Dau0R1tw.js → Pipeline-BawUxj0i.js} +1 -1
- package/src/assets/web-panel/assets/{Privacy-UF1HoZ-q.js → Privacy-CPyw19Ai.js} +1 -1
- package/src/assets/web-panel/assets/{ProjectInit-DyPmrkmp.js → ProjectInit-GDtYLbL6.js} +1 -1
- package/src/assets/web-panel/assets/{ProjectSettings-DZ4DQBbI.js → ProjectSettings-DhmGKXVL.js} +1 -1
- package/src/assets/web-panel/assets/{Projects-BRhaPrL4.js → Projects-O2spSrud.js} +1 -1
- package/src/assets/web-panel/assets/Providers-CNKCrJbY.css +1 -0
- package/src/assets/web-panel/assets/Providers-lEDu4Qdj.js +1 -0
- package/src/assets/web-panel/assets/{QrScannerModal-Dgvs6EGu.js → QrScannerModal-Dcqm-i6j.js} +1 -1
- package/src/assets/web-panel/assets/{QuickAsk-DqKybfXf.js → QuickAsk-C6uPAeAE.js} +1 -1
- package/src/assets/web-panel/assets/{Recommend-BGQDw5cu.js → Recommend-ClVlhga7.js} +1 -1
- package/src/assets/web-panel/assets/{RemoteSession-KE-6VZN0.js → RemoteSession-2raJDKUb.js} +1 -1
- package/src/assets/web-panel/assets/{Reputation-Ifxvbk7U.js → Reputation-BYWC8k3t.js} +1 -1
- package/src/assets/web-panel/assets/{Row-DoD3nauz.js → Row-Bv7Y68ai.js} +1 -1
- package/src/assets/web-panel/assets/{RssFeed-BlMKhrqt.js → RssFeed-Ba54MKvz.js} +1 -1
- package/src/assets/web-panel/assets/{Search-D4MaHzRS.js → Search-B9EkRkZK.js} +1 -1
- package/src/assets/web-panel/assets/{Security-DMpqDgSc.js → Security-DuXQGU4o.js} +1 -1
- package/src/assets/web-panel/assets/{Services-C9yzBSd8.js → Services-DJnCtY8x.js} +1 -1
- package/src/assets/web-panel/assets/{Skeleton-h8kJILZh.js → Skeleton-BVDdtf_S.js} +1 -1
- package/src/assets/web-panel/assets/{Skills-jXdYN4vu.js → Skills-DGkYCesm.js} +1 -1
- package/src/assets/web-panel/assets/{Sla-Cuk7apSe.js → Sla-CHND6lwC.js} +1 -1
- package/src/assets/web-panel/assets/{SpeechSettings-B5hPI4N_.js → SpeechSettings-Bg0Bgy9c.js} +1 -1
- package/src/assets/web-panel/assets/{SyncSettings-MGyaOfUD.js → SyncSettings-DwtcZ2Ml.js} +1 -1
- package/src/assets/web-panel/assets/{Tasks-BSqf89Jx.js → Tasks-BoHc0cP2.js} +1 -1
- package/src/assets/web-panel/assets/{Templates-BYjHba7u.js → Templates-DAMs4m8X.js} +1 -1
- package/src/assets/web-panel/assets/{Tenant-CEkhV7yX.js → Tenant-DkVQbOzT.js} +1 -1
- package/src/assets/web-panel/assets/{Terminal-D2deCxuf.js → Terminal-BTOLM8Yu.js} +1 -1
- package/src/assets/web-panel/assets/{TimelineRenderer-C8YVFoC3.js → TimelineRenderer-BO5ZyxUU.js} +1 -1
- package/src/assets/web-panel/assets/{Tokens-DN-S9EsT.js → Tokens-D0LjCtSA.js} +1 -1
- package/src/assets/web-panel/assets/{Trigger-F6LwAuyn.js → Trigger-DgGXg9VB.js} +1 -1
- package/src/assets/web-panel/assets/{Trust-Cx8jhn1i.js → Trust-BAEQrND-.js} +1 -1
- package/src/assets/web-panel/assets/{UkeySign-BN--f0JV.js → UkeySign-TtBclFRw.js} +1 -1
- package/src/assets/web-panel/assets/{VideoEditing-i32OtN88.js → VideoEditing-ByxvpIpS.js} +1 -1
- package/src/assets/web-panel/assets/{Wallet-DQImHu1X.js → Wallet-CTa7jqur.js} +1 -1
- package/src/assets/web-panel/assets/{WebAuthn-5waEqMup.js → WebAuthn-oHbCSjrD.js} +1 -1
- package/src/assets/web-panel/assets/{WorkflowEditor-Bh0xyyOO.js → WorkflowEditor-DQKQAdUS.js} +1 -1
- package/src/assets/web-panel/assets/{chat-EXJ3Usf5.js → chat-BcCU2FuK.js} +1 -1
- package/src/assets/web-panel/assets/{colors-Cdoap8Z7.js → colors-BcXAFjHT.js} +1 -1
- package/src/assets/web-panel/assets/{compact-item-QPjKEhW_.js → compact-item-GhZzQppm.js} +1 -1
- package/src/assets/web-panel/assets/{createContext-BOGUY650.js → createContext-Bc6nwTUy.js} +1 -1
- package/src/assets/web-panel/assets/{hasIn-DRN_I25i.js → hasIn-DRH8Xt0Y.js} +1 -1
- package/src/assets/web-panel/assets/{index-BoDNVZfc.js → index-60aCmptm.js} +1 -1
- package/src/assets/web-panel/assets/{index-B_J_PUwW.js → index-B7hScRVB.js} +1 -1
- package/src/assets/web-panel/assets/{index-BeRxNc4x.js → index-BDIN9KWp.js} +1 -1
- package/src/assets/web-panel/assets/{index-DAuglUM-.js → index-BEQha9Ur.js} +1 -1
- package/src/assets/web-panel/assets/{index-BFh62a_Z.js → index-BFFyqn3k.js} +1 -1
- package/src/assets/web-panel/assets/{index-jo9saD-R.js → index-BOquBdmK.js} +1 -1
- package/src/assets/web-panel/assets/{index-9hwjpOFE.js → index-BQ6b5kJR.js} +1 -1
- package/src/assets/web-panel/assets/{index-BvX72fLD.js → index-BaUmYzDB.js} +1 -1
- package/src/assets/web-panel/assets/{index-Dusibyek.js → index-Bb5XCEKT.js} +1 -1
- package/src/assets/web-panel/assets/{index-D_pIGWDh.js → index-BdOccG1D.js} +1 -1
- package/src/assets/web-panel/assets/{index-shByGhT7.js → index-Bebe5WYu.js} +1 -1
- package/src/assets/web-panel/assets/index-BlS3EjXM.js +1 -0
- package/src/assets/web-panel/assets/{index-DULwfIin.js → index-BsRmNZCk.js} +1 -1
- package/src/assets/web-panel/assets/{index-15P436aq.js → index-CB1Thk9t.js} +1 -1
- package/src/assets/web-panel/assets/{index-B_pCKR-k.js → index-CSHz8UnK.js} +1 -1
- package/src/assets/web-panel/assets/{index-_fW5KelD.js → index-Cexk6Y1r.js} +1 -1
- package/src/assets/web-panel/assets/{index-BRo2j8Jz.js → index-CtC-B6Zy.js} +1 -1
- package/src/assets/web-panel/assets/{index-DID83zEQ.js → index-D08s-CJ_.js} +1 -1
- package/src/assets/web-panel/assets/{index-DzUL46rU.js → index-D6B_ELy6.js} +1 -1
- package/src/assets/web-panel/assets/{index-CXP_MepL.js → index-D6pWvvp-.js} +1 -1
- package/src/assets/web-panel/assets/{index-BmVIyCgf.js → index-D9QfJDQg.js} +1 -1
- package/src/assets/web-panel/assets/{index-DISFHFjT.js → index-DCCEt-pU.js} +1 -1
- package/src/assets/web-panel/assets/{index-iYCp3otx.js → index-DCgr2bDL.js} +1 -1
- package/src/assets/web-panel/assets/{index-DBb3W3bA.js → index-DNi_t23H.js} +1 -1
- package/src/assets/web-panel/assets/{index-DfXsHnc0.js → index-DOBzu5UO.js} +1 -1
- package/src/assets/web-panel/assets/{index-BFXhCqpm.js → index-DOtNt1m7.js} +1 -1
- package/src/assets/web-panel/assets/{index-FBoQQHLy.js → index-DQnXn3vs.js} +1 -1
- package/src/assets/web-panel/assets/{index-Lwktngzr.js → index-DXip1xUj.js} +1 -1
- package/src/assets/web-panel/assets/{index-C33cfAQE.js → index-DoRIPzwv.js} +1 -1
- package/src/assets/web-panel/assets/index-DwIMwROa.js +1 -0
- package/src/assets/web-panel/assets/{index-hmILMYKF.js → index-Dzh9Ud2R.js} +3 -3
- package/src/assets/web-panel/assets/{index-kc4lgpMy.js → index-DzhMohzV.js} +1 -1
- package/src/assets/web-panel/assets/{index-6KPTDWDG.js → index-IW9dUJK_.js} +1 -1
- package/src/assets/web-panel/assets/{index-6nTP4-QK.js → index-WrMfehhj.js} +1 -1
- package/src/assets/web-panel/assets/{index-DNpnprSx.js → index-gvsatTPZ.js} +1 -1
- package/src/assets/web-panel/assets/{index-CafxYv7t.js → index-lEDZUWRO.js} +1 -1
- package/src/assets/web-panel/assets/{index-CVJG_i6e.js → index-mqlLcSgP.js} +1 -1
- package/src/assets/web-panel/assets/{index-L3zdSmTh.js → index-owU4npmQ.js} +1 -1
- package/src/assets/web-panel/assets/{index-CKfdYM3I.js → index-wnmY4P7_.js} +1 -1
- package/src/assets/web-panel/assets/{initDefaultProps-Bno49hyl.js → initDefaultProps-DfHPrIA5.js} +1 -1
- package/src/assets/web-panel/assets/{motion-Cs9KpFRZ.js → motion-CCzrK3c5.js} +1 -1
- package/src/assets/web-panel/assets/{move-DN2kt6Fk.js → move-B2uu6I9f.js} +1 -1
- package/src/assets/web-panel/assets/{mtc-parser-IXnfFKcF.js → mtc-parser-DtFu2-C_.js} +1 -1
- package/src/assets/web-panel/assets/{omit-ULuXK3m0.js → omit-BFjLuAHb.js} +1 -1
- package/src/assets/web-panel/assets/{pickAttrs-B3f1sg_2.js → pickAttrs-DfsjYq45.js} +1 -1
- package/src/assets/web-panel/assets/{placementArrow-CB3ISXbH.js → placementArrow-CDdYIVXw.js} +1 -1
- package/src/assets/web-panel/assets/{responsiveObserve-BhRD48Wz.js → responsiveObserve-CfrplFjn.js} +1 -1
- package/src/assets/web-panel/assets/{slide-B4qkLP8K.js → slide-DHNX5Xwt.js} +1 -1
- package/src/assets/web-panel/assets/{statusUtils-KfItOu2F.js → statusUtils-BI-C3SSk.js} +1 -1
- package/src/assets/web-panel/assets/{styleChecker-BeLQUf-Z.js → styleChecker-C5Y3Oyy2.js} +1 -1
- package/src/assets/web-panel/assets/{useFlexGapSupport-CPIJfd28.js → useFlexGapSupport-atF45w0U.js} +1 -1
- package/src/assets/web-panel/assets/{useFs-CUBjOVdy.js → useFs-C4M8-xm9.js} +1 -1
- package/src/assets/web-panel/assets/{usePersonalDataHub-DEKScTxs.js → usePersonalDataHub-jjZdnfs_.js} +1 -1
- package/src/assets/web-panel/assets/{vnode-DhNnfLeH.js → vnode-BRTSCmU3.js} +1 -1
- package/src/assets/web-panel/assets/{zoom-D5rdpCyb.js → zoom-BaS5ZYRC.js} +1 -1
- package/src/assets/web-panel/index.html +1 -1
- package/src/data/changelog.json +91 -0
- package/src/lib/evolution/evolution-artifact-ports.js +304 -0
- package/src/lib/evolution/evolution-deployment-loader.js +15 -18
- package/src/lib/evolution/evolution-file-retained-segment-backend.js +291 -0
- package/src/lib/evolution/evolution-file-witness.js +46 -4
- package/src/lib/evolution/evolution-immutable-ledger-segment-store.js +112 -0
- package/src/lib/evolution/evolution-ledger-manifest-chain.js +65 -1
- package/src/lib/evolution/evolution-ledger-manifest-witness-adapter.js +19 -2
- package/src/lib/evolution/evolution-ledger-storage-audit.js +222 -0
- package/src/lib/evolution/evolution-ledger-v2-journal.js +115 -0
- package/src/lib/evolution/evolution-ledger-v2-manifest-backend.js +242 -1
- package/src/lib/evolution/evolution-ledger.js +215 -27
- package/src/lib/evolution/evolution-witness-contracts.js +5 -0
- package/src/lib/evolution/evolution-witness-segments.js +2 -0
- package/src/lib/evolution/rrsi-observed-text-index.js +187 -9
- package/src/lib/evolution/rrsi-tenant-index-anchor-history.js +20 -0
- package/src/lib/lk-account-api.cjs +14 -2
- package/src/lib/lk-model-catalog.json +324 -289
- package/src/lib/llm-channel-presets.js +27 -8
- package/src/lib/llm-connection-config.js +6 -1
- package/src/lib/llm-connection-resolution.js +3 -1
- package/src/lib/llm-onboarding-catalog.json +16 -16
- package/src/lib/read-file-loop-guard.js +36 -12
- package/src/assets/web-panel/assets/Providers-DVyNl0mO.css +0 -1
- package/src/assets/web-panel/assets/Providers-TFpSkyej.js +0 -1
- package/src/assets/web-panel/assets/index-BFYVw5aJ.js +0 -1
- package/src/assets/web-panel/assets/index-wtySft9h.js +0 -1
|
@@ -17,6 +17,9 @@ export const EVOLUTION_LEDGER_SEGMENT_MANIFEST_SCHEMA =
|
|
|
17
17
|
"chainlesschain.evolution-ledger-segment-manifest/v2";
|
|
18
18
|
export const EVOLUTION_LEDGER_MANIFEST_HEAD_SCHEMA =
|
|
19
19
|
"chainlesschain.evolution-ledger-manifest-head/v2";
|
|
20
|
+
export const EVOLUTION_LEDGER_REFERENCED_SEGMENT_INVENTORY_SCHEMA =
|
|
21
|
+
"chainlesschain.evolution-ledger-referenced-segment-inventory/v1";
|
|
22
|
+
export const EVOLUTION_LEDGER_REFERENCED_SEGMENT_INVENTORY_LIMIT = 4096;
|
|
20
23
|
|
|
21
24
|
export const EVOLUTION_LEDGER_MANIFEST_INVALID_CODE =
|
|
22
25
|
"CC_EVOLUTION_LEDGER_MANIFEST_INVALID";
|
|
@@ -1153,7 +1156,7 @@ export function verifyEvolutionLedgerSegmentManifest(options = undefined) {
|
|
|
1153
1156
|
);
|
|
1154
1157
|
}
|
|
1155
1158
|
|
|
1156
|
-
function verifyChain(options, includeEvents) {
|
|
1159
|
+
function verifyChain(options, includeEvents, includeInventory = false) {
|
|
1157
1160
|
const fields = exactRecord(
|
|
1158
1161
|
options,
|
|
1159
1162
|
VERIFY_CONFIG_KEYS,
|
|
@@ -1183,6 +1186,16 @@ function verifyChain(options, includeEvents) {
|
|
|
1183
1186
|
}
|
|
1184
1187
|
let previous = null;
|
|
1185
1188
|
const events = [];
|
|
1189
|
+
const entries = [];
|
|
1190
|
+
let totalPayloadBytes = 0;
|
|
1191
|
+
if (
|
|
1192
|
+
includeInventory &&
|
|
1193
|
+
manifests.length > EVOLUTION_LEDGER_REFERENCED_SEGMENT_INVENTORY_LIMIT
|
|
1194
|
+
)
|
|
1195
|
+
throw failure(
|
|
1196
|
+
EVOLUTION_LEDGER_MANIFEST_INVALID_CODE,
|
|
1197
|
+
"referenced segment inventory exceeds segment limit",
|
|
1198
|
+
);
|
|
1186
1199
|
for (const rawManifest of manifests) {
|
|
1187
1200
|
const manifest = normalizeManifest(rawManifest, descriptorValue, authority);
|
|
1188
1201
|
if (
|
|
@@ -1237,6 +1250,24 @@ function verifyChain(options, includeEvents) {
|
|
|
1237
1250
|
"manifest event digests differ from immutable bytes",
|
|
1238
1251
|
);
|
|
1239
1252
|
}
|
|
1253
|
+
if (includeInventory) {
|
|
1254
|
+
totalPayloadBytes += resolution.bytes.length;
|
|
1255
|
+
entries.push(
|
|
1256
|
+
Object.freeze({
|
|
1257
|
+
manifestSequence: manifest.manifestSequence,
|
|
1258
|
+
manifestDigest: manifest.manifestDigest,
|
|
1259
|
+
segmentRef: manifest.segmentRef,
|
|
1260
|
+
contentDigest: manifest.contentDigest,
|
|
1261
|
+
storageVersion: manifest.storageVersion,
|
|
1262
|
+
sequenceStart: manifest.sequenceStart,
|
|
1263
|
+
sequenceEnd: manifest.sequenceEnd,
|
|
1264
|
+
minimumRetainedUntil: manifest.retainedUntil,
|
|
1265
|
+
proofDigest: resolution.proof.proofDigest,
|
|
1266
|
+
retainedUntil: resolution.proof.retainedUntil,
|
|
1267
|
+
payloadBytes: resolution.bytes.length,
|
|
1268
|
+
}),
|
|
1269
|
+
);
|
|
1270
|
+
}
|
|
1240
1271
|
previous = manifest;
|
|
1241
1272
|
}
|
|
1242
1273
|
const head = normalizeHead(data(fields, "head"), descriptorValue, authority);
|
|
@@ -1251,6 +1282,32 @@ function verifyChain(options, includeEvents) {
|
|
|
1251
1282
|
"manifest head does not bind the final manifest",
|
|
1252
1283
|
);
|
|
1253
1284
|
}
|
|
1285
|
+
if (includeInventory) {
|
|
1286
|
+
const core = Object.freeze({
|
|
1287
|
+
schema: EVOLUTION_LEDGER_REFERENCED_SEGMENT_INVENTORY_SCHEMA,
|
|
1288
|
+
scope: "authenticated-manifest-referenced-segments",
|
|
1289
|
+
descriptor: descriptorValue,
|
|
1290
|
+
manifestAuthority: authority.descriptor,
|
|
1291
|
+
segmentStore: store.descriptor,
|
|
1292
|
+
head,
|
|
1293
|
+
entries: Object.freeze(entries),
|
|
1294
|
+
segmentCount: entries.length,
|
|
1295
|
+
totalPayloadBytes,
|
|
1296
|
+
referencedContentsVerified: true,
|
|
1297
|
+
directoryInventoryVerified: false,
|
|
1298
|
+
fullPhysicalStorageGraphVerified: false,
|
|
1299
|
+
grantsMutationOrPromotionAuthority: false,
|
|
1300
|
+
});
|
|
1301
|
+
return Object.freeze({
|
|
1302
|
+
...core,
|
|
1303
|
+
inventoryDigest: sha256(
|
|
1304
|
+
Buffer.from(
|
|
1305
|
+
`${EVOLUTION_LEDGER_REFERENCED_SEGMENT_INVENTORY_SCHEMA}\0${canonical(core)}`,
|
|
1306
|
+
"utf8",
|
|
1307
|
+
),
|
|
1308
|
+
),
|
|
1309
|
+
});
|
|
1310
|
+
}
|
|
1254
1311
|
return Object.freeze({
|
|
1255
1312
|
authenticated: true,
|
|
1256
1313
|
head,
|
|
@@ -1267,3 +1324,10 @@ export function verifyEvolutionLedgerManifestChain(options = undefined) {
|
|
|
1267
1324
|
export function readEvolutionLedgerManifestEvents(options = undefined) {
|
|
1268
1325
|
return verifyChain(options, true);
|
|
1269
1326
|
}
|
|
1327
|
+
|
|
1328
|
+
/** Complete references of the supplied signed chain, never a directory listing. */
|
|
1329
|
+
export function inspectEvolutionLedgerReferencedSegmentInventory(
|
|
1330
|
+
options = undefined,
|
|
1331
|
+
) {
|
|
1332
|
+
return verifyChain(options, false, true);
|
|
1333
|
+
}
|
|
@@ -2,6 +2,7 @@ import { types as utilTypes } from "node:util";
|
|
|
2
2
|
import {
|
|
3
3
|
captureEvolutionFileWitnessDirectoryBoundaries,
|
|
4
4
|
hasEvolutionFileWitnessDirectoryBoundaries,
|
|
5
|
+
getEvolutionFileWitnessReadOnlyReader,
|
|
5
6
|
} from "./evolution-file-witness.js";
|
|
6
7
|
|
|
7
8
|
import { EVOLUTION_LEDGER_WITNESS_SCHEMA } from "./evolution-ledger.js";
|
|
@@ -27,6 +28,7 @@ export const EVOLUTION_LEDGER_MANIFEST_WITNESS_COMMIT_UNKNOWN_CODE =
|
|
|
27
28
|
const DIGEST = /^sha256:[a-f0-9]{64}$/u;
|
|
28
29
|
const ADAPTERS = new WeakSet();
|
|
29
30
|
const ORIGINAL_WITNESSES = new WeakMap();
|
|
31
|
+
const READ_ONLY_READERS = new WeakMap();
|
|
30
32
|
const CONFIG_KEYS = new Set(["descriptor", "manifestAuthority", "witness"]);
|
|
31
33
|
const DESCRIPTOR_KEYS = new Set([
|
|
32
34
|
"epoch",
|
|
@@ -389,10 +391,10 @@ export function createEvolutionLedgerManifestWitnessAdapter(
|
|
|
389
391
|
);
|
|
390
392
|
const witness = captureWitness(data(fields, "witness"));
|
|
391
393
|
|
|
392
|
-
const
|
|
394
|
+
const readUsing = (operation) => {
|
|
393
395
|
let raw;
|
|
394
396
|
try {
|
|
395
|
-
raw = sync(
|
|
397
|
+
raw = sync(operation(), "manifest witness read result");
|
|
396
398
|
} catch (cause) {
|
|
397
399
|
if (cause instanceof EvolutionLedgerManifestWitnessError) throw cause;
|
|
398
400
|
throw failure(
|
|
@@ -408,6 +410,7 @@ export function createEvolutionLedgerManifestWitnessAdapter(
|
|
|
408
410
|
EVOLUTION_LEDGER_MANIFEST_WITNESS_CORRUPT_CODE,
|
|
409
411
|
);
|
|
410
412
|
};
|
|
413
|
+
const read = () => readUsing(witness.read);
|
|
411
414
|
|
|
412
415
|
const adapter = Object.freeze({
|
|
413
416
|
descriptor: Object.freeze({
|
|
@@ -529,6 +532,14 @@ export function createEvolutionLedgerManifestWitnessAdapter(
|
|
|
529
532
|
});
|
|
530
533
|
ADAPTERS.add(adapter);
|
|
531
534
|
ORIGINAL_WITNESSES.set(adapter, data(fields, "witness"));
|
|
535
|
+
const readOnly = getEvolutionFileWitnessReadOnlyReader(
|
|
536
|
+
data(fields, "witness"),
|
|
537
|
+
);
|
|
538
|
+
if (readOnly !== null)
|
|
539
|
+
READ_ONLY_READERS.set(
|
|
540
|
+
adapter,
|
|
541
|
+
Object.freeze(() => readUsing(readOnly)),
|
|
542
|
+
);
|
|
532
543
|
return adapter;
|
|
533
544
|
}
|
|
534
545
|
|
|
@@ -565,6 +576,12 @@ export function hasEvolutionLedgerManifestWitnessDirectoryBoundaries(value) {
|
|
|
565
576
|
);
|
|
566
577
|
}
|
|
567
578
|
|
|
579
|
+
export function getEvolutionLedgerManifestWitnessReadOnlyReader(value) {
|
|
580
|
+
if (arguments.length !== 1)
|
|
581
|
+
throw new TypeError("read-only manifest witness capture takes one adapter");
|
|
582
|
+
return READ_ONLY_READERS.get(value) ?? null;
|
|
583
|
+
}
|
|
584
|
+
|
|
568
585
|
export function captureEvolutionLedgerManifestWitnessDirectoryBoundaries(
|
|
569
586
|
value,
|
|
570
587
|
) {
|
|
@@ -0,0 +1,222 @@
|
|
|
1
|
+
/** Explicit, read-only composition of the original local v2 storage checks. */
|
|
2
|
+
import { createHash } from "node:crypto";
|
|
3
|
+
import { isProxy } from "node:util/types";
|
|
4
|
+
import {
|
|
5
|
+
captureEvolutionLedgerFileBackend,
|
|
6
|
+
captureEvolutionLedgerFileBackendBinding,
|
|
7
|
+
captureEvolutionLedgerFileBackendSourceDirectoryBoundary,
|
|
8
|
+
captureEvolutionLedgerFileBackendWitnessDirectoryBoundaries,
|
|
9
|
+
} from "./evolution-ledger-file-backend.js";
|
|
10
|
+
import {
|
|
11
|
+
captureEvolutionLedgerArtifactResolverBinding,
|
|
12
|
+
captureEvolutionArtifactStoreDirectoryBoundary,
|
|
13
|
+
captureEvolutionArtifactStoreLocalInventory,
|
|
14
|
+
} from "./evolution-artifact-ports.js";
|
|
15
|
+
import {
|
|
16
|
+
isEvolutionLedgerV2Journal,
|
|
17
|
+
captureEvolutionLedgerV2JournalManifestDirectoryBoundaries,
|
|
18
|
+
captureEvolutionLedgerV2JournalWitnessDirectoryBoundaries,
|
|
19
|
+
captureEvolutionLedgerV2JournalRetainedSegmentDirectoryBoundary,
|
|
20
|
+
captureEvolutionLedgerV2JournalLocalRetentionInventory,
|
|
21
|
+
captureEvolutionLedgerV2JournalSourceConsistency,
|
|
22
|
+
} from "./evolution-ledger-v2-journal.js";
|
|
23
|
+
|
|
24
|
+
export const EVOLUTION_LEDGER_STORAGE_AUDIT_SCHEMA =
|
|
25
|
+
"chainlesschain.evolution-local-storage-audit/v1";
|
|
26
|
+
export const EVOLUTION_LEDGER_STORAGE_AUDIT_HELD_CODE =
|
|
27
|
+
"CC_EVOLUTION_STORAGE_AUDIT_HELD";
|
|
28
|
+
|
|
29
|
+
function held(message, cause) {
|
|
30
|
+
throw Object.assign(new Error(message, cause ? { cause } : undefined), {
|
|
31
|
+
code: EVOLUTION_LEDGER_STORAGE_AUDIT_HELD_CODE,
|
|
32
|
+
});
|
|
33
|
+
}
|
|
34
|
+
|
|
35
|
+
function canonical(value) {
|
|
36
|
+
if (value === null || typeof value !== "object") return JSON.stringify(value);
|
|
37
|
+
if (Array.isArray(value)) return `[${value.map(canonical).join(",")}]`;
|
|
38
|
+
return `{${Object.keys(value)
|
|
39
|
+
.sort()
|
|
40
|
+
.map((key) => `${JSON.stringify(key)}:${canonical(value[key])}`)
|
|
41
|
+
.join(",")}}`;
|
|
42
|
+
}
|
|
43
|
+
|
|
44
|
+
function digest(value) {
|
|
45
|
+
return `sha256:${createHash("sha256")
|
|
46
|
+
.update(`${EVOLUTION_LEDGER_STORAGE_AUDIT_SCHEMA}\0`)
|
|
47
|
+
.update(canonical(value))
|
|
48
|
+
.digest("hex")}`;
|
|
49
|
+
}
|
|
50
|
+
|
|
51
|
+
function frozen(value) {
|
|
52
|
+
if (value && typeof value === "object") {
|
|
53
|
+
Object.values(value).forEach(frozen);
|
|
54
|
+
Object.freeze(value);
|
|
55
|
+
}
|
|
56
|
+
return value;
|
|
57
|
+
}
|
|
58
|
+
|
|
59
|
+
function ports(input) {
|
|
60
|
+
const keys = ["backend", "artifactPorts", "ledgerArtifactResolver"];
|
|
61
|
+
if (
|
|
62
|
+
!input ||
|
|
63
|
+
isProxy(input) ||
|
|
64
|
+
Object.getPrototypeOf(input) !== Object.prototype ||
|
|
65
|
+
Reflect.ownKeys(input).length !== keys.length
|
|
66
|
+
)
|
|
67
|
+
throw new TypeError("storage audit requires exactly three original ports");
|
|
68
|
+
return Object.fromEntries(
|
|
69
|
+
keys.map((key) => {
|
|
70
|
+
const field = Object.getOwnPropertyDescriptor(input, key);
|
|
71
|
+
if (!field?.enumerable || !("value" in field))
|
|
72
|
+
throw new TypeError("storage audit ports must be own data properties");
|
|
73
|
+
return [key, field.value];
|
|
74
|
+
}),
|
|
75
|
+
);
|
|
76
|
+
}
|
|
77
|
+
|
|
78
|
+
/**
|
|
79
|
+
* No caller paths, inventory filters, recovery, installation or trust defaults.
|
|
80
|
+
* Separate component read windows do not constitute an atomic disk snapshot.
|
|
81
|
+
*/
|
|
82
|
+
export function captureEvolutionLedgerStorageAudit(input) {
|
|
83
|
+
if (arguments.length !== 1)
|
|
84
|
+
throw new TypeError("storage audit takes one original composition");
|
|
85
|
+
const options = ports(input);
|
|
86
|
+
const backend = captureEvolutionLedgerFileBackend(options.backend);
|
|
87
|
+
const binding = captureEvolutionLedgerFileBackendBinding(backend);
|
|
88
|
+
const resolver = captureEvolutionLedgerArtifactResolverBinding(
|
|
89
|
+
options.ledgerArtifactResolver,
|
|
90
|
+
);
|
|
91
|
+
const journal = backend.ledger;
|
|
92
|
+
if (
|
|
93
|
+
!binding.matchesArtifactResolver(options.ledgerArtifactResolver) ||
|
|
94
|
+
!resolver.matchesArtifactPorts(options.artifactPorts)
|
|
95
|
+
)
|
|
96
|
+
held("storage audit requires the same original backend and artifact ports");
|
|
97
|
+
if (!isEvolutionLedgerV2Journal(journal))
|
|
98
|
+
held("storage audit requires an original v2 journal");
|
|
99
|
+
if (
|
|
100
|
+
resolver.tenantId !== journal.descriptor.artifactTenantId ||
|
|
101
|
+
resolver.audience !== journal.descriptor.audience ||
|
|
102
|
+
resolver.purpose !== "evolution-ledger"
|
|
103
|
+
)
|
|
104
|
+
held("storage audit artifact scope differs from the original journal");
|
|
105
|
+
|
|
106
|
+
function capture() {
|
|
107
|
+
const sourceBoundary =
|
|
108
|
+
captureEvolutionLedgerFileBackendSourceDirectoryBoundary(backend);
|
|
109
|
+
const sourceWitnessBoundary =
|
|
110
|
+
captureEvolutionLedgerFileBackendWitnessDirectoryBoundaries(backend);
|
|
111
|
+
const manifestBoundaries =
|
|
112
|
+
captureEvolutionLedgerV2JournalManifestDirectoryBoundaries(journal);
|
|
113
|
+
const manifestWitnessBoundary =
|
|
114
|
+
captureEvolutionLedgerV2JournalWitnessDirectoryBoundaries(journal);
|
|
115
|
+
const retentionBoundary =
|
|
116
|
+
captureEvolutionLedgerV2JournalRetainedSegmentDirectoryBoundary(journal);
|
|
117
|
+
const artifactBoundary = captureEvolutionArtifactStoreDirectoryBoundary(
|
|
118
|
+
options.artifactPorts,
|
|
119
|
+
);
|
|
120
|
+
if (!manifestBoundaries || !manifestWitnessBoundary || !retentionBoundary)
|
|
121
|
+
held(
|
|
122
|
+
"storage audit requires original physical manifest and retention ports",
|
|
123
|
+
);
|
|
124
|
+
|
|
125
|
+
const boundaries = [
|
|
126
|
+
sourceBoundary,
|
|
127
|
+
sourceWitnessBoundary,
|
|
128
|
+
manifestBoundaries.catalog,
|
|
129
|
+
manifestBoundaries.head,
|
|
130
|
+
manifestWitnessBoundary,
|
|
131
|
+
retentionBoundary,
|
|
132
|
+
artifactBoundary,
|
|
133
|
+
];
|
|
134
|
+
const recheckDirectories = () => {
|
|
135
|
+
for (const boundary of boundaries) boundary.recheck();
|
|
136
|
+
};
|
|
137
|
+
recheckDirectories();
|
|
138
|
+
// These explicit readers never call journal.verify()/recover(), take a
|
|
139
|
+
// source lock, advance a witness or finalize an outstanding WAL suffix.
|
|
140
|
+
const source = captureEvolutionLedgerV2JournalSourceConsistency(journal);
|
|
141
|
+
if (source === null)
|
|
142
|
+
held("storage audit requires a finalized read-only source/v2 history");
|
|
143
|
+
const retention =
|
|
144
|
+
captureEvolutionLedgerV2JournalLocalRetentionInventory(journal);
|
|
145
|
+
const artifacts = captureEvolutionArtifactStoreLocalInventory(
|
|
146
|
+
options.artifactPorts,
|
|
147
|
+
);
|
|
148
|
+
if (retention === null || artifacts === null)
|
|
149
|
+
held("storage audit cannot substitute custom or incomplete inventories");
|
|
150
|
+
|
|
151
|
+
const head = source.snapshot.manifestHead;
|
|
152
|
+
if (
|
|
153
|
+
canonical(head) !== canonical(retention.snapshot.head) ||
|
|
154
|
+
artifacts.snapshot.tenantId !== journal.descriptor.artifactTenantId ||
|
|
155
|
+
artifacts.snapshot.audience !== journal.descriptor.audience
|
|
156
|
+
)
|
|
157
|
+
held("storage audit components do not share one journal head and scope");
|
|
158
|
+
|
|
159
|
+
// Re-read all three components rather than trusting their reported hashes.
|
|
160
|
+
// Retention includes unreferenced files; artifacts includes the full index.
|
|
161
|
+
source.recheck();
|
|
162
|
+
retention.recheck();
|
|
163
|
+
artifacts.recheck();
|
|
164
|
+
recheckDirectories();
|
|
165
|
+
const core = frozen({
|
|
166
|
+
schema: EVOLUTION_LEDGER_STORAGE_AUDIT_SCHEMA,
|
|
167
|
+
scope: "original-v2-source-witnesses-local-retention-and-artifact-store",
|
|
168
|
+
tenantId: journal.descriptor.tenantId,
|
|
169
|
+
artifactTenantId: journal.descriptor.artifactTenantId,
|
|
170
|
+
audience: journal.descriptor.audience,
|
|
171
|
+
head,
|
|
172
|
+
directories: {
|
|
173
|
+
source: sourceBoundary.descriptor,
|
|
174
|
+
sourceWitness: sourceWitnessBoundary.descriptor,
|
|
175
|
+
manifestCatalog: manifestBoundaries.catalog.descriptor,
|
|
176
|
+
manifestHead: manifestBoundaries.head.descriptor,
|
|
177
|
+
manifestWitness: manifestWitnessBoundary.descriptor,
|
|
178
|
+
retention: retentionBoundary.descriptor,
|
|
179
|
+
artifacts: artifactBoundary.descriptor,
|
|
180
|
+
},
|
|
181
|
+
source: source.snapshot,
|
|
182
|
+
retention: retention.snapshot,
|
|
183
|
+
artifacts: artifacts.snapshot,
|
|
184
|
+
readOnlyOpen: true,
|
|
185
|
+
recoveryPerformed: false,
|
|
186
|
+
originalCompositionVerified: true,
|
|
187
|
+
sourceEventsExactlyMirrored: true,
|
|
188
|
+
localRetentionInventoryVerified: true,
|
|
189
|
+
localArtifactInventoryVerified: true,
|
|
190
|
+
independentInstallationVerified: false,
|
|
191
|
+
crossProcessRollbackProtectionVerified: false,
|
|
192
|
+
atomicSnapshotVerified: false,
|
|
193
|
+
fullPhysicalStorageGraphVerified: false,
|
|
194
|
+
externalWormVerified: false,
|
|
195
|
+
productionAuthorityVerified: false,
|
|
196
|
+
generationProvenanceVerified: false,
|
|
197
|
+
grantsMutationOrPromotionAuthority: false,
|
|
198
|
+
decision: "HOLD",
|
|
199
|
+
});
|
|
200
|
+
return frozen({ ...core, storageAuditDigest: digest(core) });
|
|
201
|
+
}
|
|
202
|
+
|
|
203
|
+
function guardedCapture() {
|
|
204
|
+
try {
|
|
205
|
+
return capture();
|
|
206
|
+
} catch (cause) {
|
|
207
|
+
if (cause?.code === EVOLUTION_LEDGER_STORAGE_AUDIT_HELD_CODE) throw cause;
|
|
208
|
+
held("original local storage audit could not be authenticated", cause);
|
|
209
|
+
}
|
|
210
|
+
}
|
|
211
|
+
const snapshot = guardedCapture();
|
|
212
|
+
return Object.freeze({
|
|
213
|
+
snapshot,
|
|
214
|
+
recheck(...args) {
|
|
215
|
+
if (args.length)
|
|
216
|
+
throw new TypeError("storage audit takes no replacement context");
|
|
217
|
+
if (guardedCapture().storageAuditDigest !== snapshot.storageAuditDigest)
|
|
218
|
+
held("original local storage changed after audit capture");
|
|
219
|
+
return true;
|
|
220
|
+
},
|
|
221
|
+
});
|
|
222
|
+
}
|
|
@@ -9,11 +9,16 @@ import {
|
|
|
9
9
|
EVOLUTION_LEDGER_MAX_EVENTS,
|
|
10
10
|
EVOLUTION_LEDGER_V2_MIGRATION_INTENT,
|
|
11
11
|
EVOLUTION_LEDGER_V2_CUTOVER_COMPLETED,
|
|
12
|
+
getEvolutionLedgerReadOnlyHistoryReader,
|
|
12
13
|
} from "./evolution-ledger.js";
|
|
13
14
|
import {
|
|
14
15
|
captureEvolutionLedgerV2ManifestBackend,
|
|
15
16
|
captureEvolutionLedgerV2ManifestDirectoryBoundaries,
|
|
16
17
|
captureEvolutionLedgerV2ManifestWitnessDirectoryBoundaries,
|
|
18
|
+
captureEvolutionLedgerV2RetainedSegmentDirectoryBoundary,
|
|
19
|
+
captureEvolutionLedgerV2ReferencedSegmentInventory,
|
|
20
|
+
captureEvolutionLedgerV2LocalRetentionInventory,
|
|
21
|
+
getEvolutionLedgerV2ReadOnlyEventsReader,
|
|
17
22
|
hasEvolutionLedgerV2ManifestDirectoryBoundaries,
|
|
18
23
|
} from "./evolution-ledger-v2-manifest-backend.js";
|
|
19
24
|
|
|
@@ -23,6 +28,9 @@ export const EVOLUTION_LEDGER_V2_FINALIZATION_SCHEMA =
|
|
|
23
28
|
"chainlesschain.evolution-ledger-v2-finalization/v2";
|
|
24
29
|
const JOURNALS = new WeakSet();
|
|
25
30
|
const MANIFEST_BACKENDS = new WeakMap();
|
|
31
|
+
const READ_ONLY_BINDINGS = new WeakMap();
|
|
32
|
+
export const EVOLUTION_LEDGER_V2_SOURCE_AUDIT_HELD_CODE =
|
|
33
|
+
"CC_EVOLUTION_LEDGER_V2_SOURCE_AUDIT_HELD";
|
|
26
34
|
const RESERVED = new Set([
|
|
27
35
|
EVOLUTION_LEDGER_V2_MIGRATION_INTENT,
|
|
28
36
|
EVOLUTION_LEDGER_V2_CUTOVER_COMPLETED,
|
|
@@ -525,6 +533,13 @@ export function createEvolutionLedgerV2Journal(options) {
|
|
|
525
533
|
locked(recover);
|
|
526
534
|
JOURNALS.add(journal);
|
|
527
535
|
MANIFEST_BACKENDS.set(journal, backend);
|
|
536
|
+
READ_ONLY_BINDINGS.set(
|
|
537
|
+
journal,
|
|
538
|
+
Object.freeze({
|
|
539
|
+
readSource: getEvolutionLedgerReadOnlyHistoryReader(ledger),
|
|
540
|
+
readManifest: getEvolutionLedgerV2ReadOnlyEventsReader(backend),
|
|
541
|
+
}),
|
|
542
|
+
);
|
|
528
543
|
return journal;
|
|
529
544
|
}
|
|
530
545
|
|
|
@@ -554,6 +569,106 @@ export function isEvolutionLedgerV2Journal(value) {
|
|
|
554
569
|
return JOURNALS.has(value);
|
|
555
570
|
}
|
|
556
571
|
|
|
572
|
+
export function captureEvolutionLedgerV2JournalRetainedSegmentDirectoryBoundary(
|
|
573
|
+
value,
|
|
574
|
+
) {
|
|
575
|
+
if (arguments.length !== 1 || !MANIFEST_BACKENDS.has(value))
|
|
576
|
+
throw new TypeError("one original v2 journal is required");
|
|
577
|
+
return captureEvolutionLedgerV2RetainedSegmentDirectoryBoundary(
|
|
578
|
+
MANIFEST_BACKENDS.get(value),
|
|
579
|
+
);
|
|
580
|
+
}
|
|
581
|
+
|
|
582
|
+
export function captureEvolutionLedgerV2JournalReferencedSegmentInventory(
|
|
583
|
+
value,
|
|
584
|
+
) {
|
|
585
|
+
if (arguments.length !== 1 || !MANIFEST_BACKENDS.has(value))
|
|
586
|
+
throw new TypeError("one original v2 journal is required");
|
|
587
|
+
return captureEvolutionLedgerV2ReferencedSegmentInventory(
|
|
588
|
+
MANIFEST_BACKENDS.get(value),
|
|
589
|
+
);
|
|
590
|
+
}
|
|
591
|
+
|
|
592
|
+
export function captureEvolutionLedgerV2JournalLocalRetentionInventory(value) {
|
|
593
|
+
if (arguments.length !== 1 || !MANIFEST_BACKENDS.has(value))
|
|
594
|
+
throw new TypeError("one original v2 journal is required");
|
|
595
|
+
return captureEvolutionLedgerV2LocalRetentionInventory(
|
|
596
|
+
MANIFEST_BACKENDS.get(value),
|
|
597
|
+
);
|
|
598
|
+
}
|
|
599
|
+
|
|
600
|
+
/** Existing source and witnessed v2 only. No source locks or v2 recovery. */
|
|
601
|
+
export function captureEvolutionLedgerV2JournalSourceConsistency(value) {
|
|
602
|
+
if (arguments.length !== 1 || !READ_ONLY_BINDINGS.has(value))
|
|
603
|
+
throw new TypeError("one original v2 journal is required");
|
|
604
|
+
const { readSource, readManifest } = READ_ONLY_BINDINGS.get(value);
|
|
605
|
+
if (readSource === null || readManifest === null) return null;
|
|
606
|
+
const held = (message) =>
|
|
607
|
+
fail(message, undefined, EVOLUTION_LEDGER_V2_SOURCE_AUDIT_HELD_CODE);
|
|
608
|
+
const read = () => {
|
|
609
|
+
const before = readSource();
|
|
610
|
+
const manifest = readManifest();
|
|
611
|
+
if (manifest === null) return null;
|
|
612
|
+
const after = readSource();
|
|
613
|
+
if (
|
|
614
|
+
before.eventsDigest !== after.eventsDigest ||
|
|
615
|
+
canonical(before.frontier) !== canonical(after.frontier)
|
|
616
|
+
)
|
|
617
|
+
held("source frontier changed during v2 consistency audit");
|
|
618
|
+
const frontier = before.frontier;
|
|
619
|
+
if (
|
|
620
|
+
manifest.head.ledgerId !== frontier.ledgerId ||
|
|
621
|
+
manifest.head.epoch !== frontier.epoch ||
|
|
622
|
+
manifest.head.tenantId !== value.descriptor.tenantId ||
|
|
623
|
+
manifest.head.sequence !== frontier.sequence ||
|
|
624
|
+
manifest.head.eventDigest !== frontier.headDigest ||
|
|
625
|
+
manifest.events.length !== before.events.length
|
|
626
|
+
)
|
|
627
|
+
held(
|
|
628
|
+
"source WAL is not exactly finalized in the current v2 manifest head",
|
|
629
|
+
);
|
|
630
|
+
for (let index = 0; index < before.events.length; index++)
|
|
631
|
+
if (canonical(before.events[index]) !== canonical(manifest.events[index]))
|
|
632
|
+
held(
|
|
633
|
+
"v2 event payload differs from the original authenticated source event",
|
|
634
|
+
);
|
|
635
|
+
const core = Object.freeze({
|
|
636
|
+
schema: "chainlesschain.evolution-source-v2-consistency/v1",
|
|
637
|
+
sourceFrontier: frontier,
|
|
638
|
+
sourceEventsDigest: before.eventsDigest,
|
|
639
|
+
manifestHead: manifest.head,
|
|
640
|
+
manifestCount: manifest.manifestCount,
|
|
641
|
+
eventCount: before.events.length,
|
|
642
|
+
readOnlyOpen: true,
|
|
643
|
+
recoveryPerformed: false,
|
|
644
|
+
sourceEventsExactlyMirrored: true,
|
|
645
|
+
artifactCurrentAuthorityVerified: false,
|
|
646
|
+
fullPhysicalStorageGraphVerified: false,
|
|
647
|
+
grantsMutationOrPromotionAuthority: false,
|
|
648
|
+
});
|
|
649
|
+
return Object.freeze({
|
|
650
|
+
...core,
|
|
651
|
+
consistencyDigest: `sha256:${createHash("sha256").update(`${core.schema}\0`).update(canonical(core)).digest("hex")}`,
|
|
652
|
+
});
|
|
653
|
+
};
|
|
654
|
+
const snapshot = read();
|
|
655
|
+
if (snapshot === null) return null;
|
|
656
|
+
return Object.freeze({
|
|
657
|
+
snapshot,
|
|
658
|
+
recheck(...args) {
|
|
659
|
+
if (args.length)
|
|
660
|
+
throw new TypeError("source consistency takes no replacement context");
|
|
661
|
+
const current = read();
|
|
662
|
+
if (
|
|
663
|
+
current === null ||
|
|
664
|
+
current.consistencyDigest !== snapshot.consistencyDigest
|
|
665
|
+
)
|
|
666
|
+
held("source/v2 consistency changed after capture");
|
|
667
|
+
return true;
|
|
668
|
+
},
|
|
669
|
+
});
|
|
670
|
+
}
|
|
671
|
+
|
|
557
672
|
// Production factory receives authenticated scope, not a structural ledger or a
|
|
558
673
|
// capability to bypass cutover. Capturing the result enforces the backend brand.
|
|
559
674
|
export function createEvolutionLedgerV2JournalFromFactory(
|