chainlesschain 0.166.149 → 0.166.156
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 +33 -5
- 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 +1 -1
- package/src/assets/web-panel/.build-hash +1 -1
- package/src/assets/web-panel/assets/{AIOps-BjBY1txq.js → AIOps-CraNGNgc.js} +1 -1
- package/src/assets/web-panel/assets/{ActionButton-CS2ov4iK.js → ActionButton-C0jn6sgg.js} +1 -1
- package/src/assets/web-panel/assets/{Analytics-C9LS7ahG.js → Analytics-DVrR_wjl.js} +1 -1
- package/src/assets/web-panel/assets/{AppLayout-4_s9gBVg.js → AppLayout-CeKP8mgC.js} +1 -1
- package/src/assets/web-panel/assets/{Artifacts-CwS17ayg.js → Artifacts-OHCS9wLN.js} +1 -1
- package/src/assets/web-panel/assets/{Audit-D3QMRsd-.js → Audit-C77b6pDl.js} +1 -1
- package/src/assets/web-panel/assets/{BackgroundAgents-Bxau9H9Q.js → BackgroundAgents-CefiwCgM.js} +1 -1
- package/src/assets/web-panel/assets/{Backup--YSJyAuP.js → Backup-B-5KmWNA.js} +1 -1
- package/src/assets/web-panel/assets/{BaseInput-DZolkmdu.js → BaseInput-C3bJ1Qlc.js} +1 -1
- package/src/assets/web-panel/assets/{Chat-DA-7fNKq.js → Chat-DBahPz9B.js} +1 -1
- package/src/assets/web-panel/assets/{ChatBubbleRenderer-DniEWT5j.js → ChatBubbleRenderer-J4BVVrXZ.js} +1 -1
- package/src/assets/web-panel/assets/{Checkbox-B4hgbnOB.js → Checkbox-w856fzfY.js} +1 -1
- package/src/assets/web-panel/assets/{Codegen-BQ3HSq9S.js → Codegen-XKmsL_C3.js} +1 -1
- package/src/assets/web-panel/assets/{Col-DJwxq_Wu.js → Col-B37-gr7d.js} +1 -1
- package/src/assets/web-panel/assets/{Community-DZYVM_iz.js → Community-DdahlN0f.js} +1 -1
- package/src/assets/web-panel/assets/{Compact-1Yq5o53N.js → Compact-oKnoE-9_.js} +1 -1
- package/src/assets/web-panel/assets/{Compliance-52Per8mR.js → Compliance-CnCRlOB_.js} +1 -1
- package/src/assets/web-panel/assets/{Cowork-BaCNxzo7.js → Cowork-D3Vr5R3E.js} +1 -1
- package/src/assets/web-panel/assets/{Cron-DADTMPPr.js → Cron-X46CdLRQ.js} +1 -1
- package/src/assets/web-panel/assets/{Crosschain-CS3rx96X.js → Crosschain-CV3_6jVw.js} +1 -1
- package/src/assets/web-panel/assets/{DID-B8eatIvd.js → DID-Kr6H4WKr.js} +1 -1
- package/src/assets/web-panel/assets/{Dashboard-0vsurC1X.js → Dashboard-Bj4usrhx.js} +1 -1
- package/src/assets/web-panel/assets/{Dropdown-BULy3ccq.js → Dropdown-V3DPV21D.js} +1 -1
- package/src/assets/web-panel/assets/{EmailListRenderer-CcwgCUpu.js → EmailListRenderer-8MCX0Y4b.js} +1 -1
- package/src/assets/web-panel/assets/{EvolutionSettings-DLs_6II3.js → EvolutionSettings-SUoykpjc.js} +1 -1
- package/src/assets/web-panel/assets/{FamilyGuardDashboard-DpUpWwQP.js → FamilyGuardDashboard-C0iE0T9x.js} +1 -1
- package/src/assets/web-panel/assets/{Federation-6hx8MMYA.js → Federation-CSU3kpK2.js} +1 -1
- package/src/assets/web-panel/assets/{FormItemContext-CsdE-ZR5.js → FormItemContext-Bcv2XJNw.js} +1 -1
- package/src/assets/web-panel/assets/{GenericCardRenderer-DzXneQPV.js → GenericCardRenderer-PdEqwQZd.js} +1 -1
- package/src/assets/web-panel/assets/{Git-D_ThKL1Q.js → Git-CVZ0MSRN.js} +1 -1
- package/src/assets/web-panel/assets/{Governance-BFBSlr-9.js → Governance-CF64-eGc.js} +1 -1
- package/src/assets/web-panel/assets/{Inference-BAI0b1Jl.js → Inference-DJ1J40Th.js} +1 -1
- package/src/assets/web-panel/assets/{KnowledgeGraph-CpO6Bdtr.js → KnowledgeGraph-Cf3ULXmf.js} +1 -1
- package/src/assets/web-panel/assets/{Logs-BcRaS_HC.js → Logs-DM_RbXG_.js} +1 -1
- package/src/assets/web-panel/assets/{MarkdownRenderer-CmZaA7Ct.js → MarkdownRenderer-B2wey_j8.js} +1 -1
- package/src/assets/web-panel/assets/{Marketplace-BpHBn0Nw.js → Marketplace-tqdANxLa.js} +1 -1
- package/src/assets/web-panel/assets/{McpTools-auVxEYSE.js → McpTools-BiSYAtKB.js} +1 -1
- package/src/assets/web-panel/assets/{Memory-DpCyb656.js → Memory-hOvA-Tqp.js} +1 -1
- package/src/assets/web-panel/assets/{MobileBridge-CEIGi769.js → MobileBridge-CIpwBK6G.js} +1 -1
- package/src/assets/web-panel/assets/{MobileProjects-pphH0a8n.js → MobileProjects-DMpV98oD.js} +1 -1
- package/src/assets/web-panel/assets/{Mtc-CMJXBEp1.js → Mtc-CVoJZMuY.js} +1 -1
- package/src/assets/web-panel/assets/{MtcAudit-BI25yvzM.js → MtcAudit-Dz9YsrvV.js} +1 -1
- package/src/assets/web-panel/assets/{Multisig-BhMDExsQ.js → Multisig-CamW3sTK.js} +1 -1
- package/src/assets/web-panel/assets/{NLProgramming-CatOR9Ez.js → NLProgramming-DlZo8q6W.js} +1 -1
- package/src/assets/web-panel/assets/{Notes-BHG6SBpu.js → Notes-DZJSYibx.js} +1 -1
- package/src/assets/web-panel/assets/{NotificationSettings-BB-m0AbL.js → NotificationSettings-BSlIIGOM.js} +1 -1
- package/src/assets/web-panel/assets/{OrderTableRenderer-W-WReAih.js → OrderTableRenderer-Bo9vImgU.js} +1 -1
- package/src/assets/web-panel/assets/{Organization-BkQCgon_.js → Organization-B1sBf0Kk.js} +1 -1
- package/src/assets/web-panel/assets/{Overflow-kCTwPrIc.js → Overflow-CD8GUNOV.js} +1 -1
- package/src/assets/web-panel/assets/{P2P-CvOF8whc.js → P2P-CeaIuSa9.js} +1 -1
- package/src/assets/web-panel/assets/{PdhVaultBrowser-DYkTzn6u.js → PdhVaultBrowser-DCOkcRse.js} +2 -2
- package/src/assets/web-panel/assets/{Permissions-F-UzeWVt.js → Permissions-DQCZnN_y.js} +1 -1
- package/src/assets/web-panel/assets/{PersonalDataHub-BURpZBb6.js → PersonalDataHub-D_9PtVvT.js} +1 -1
- package/src/assets/web-panel/assets/{Pipeline-lZYx_7qc.js → Pipeline-BawUxj0i.js} +1 -1
- package/src/assets/web-panel/assets/{Privacy-DdfYgt1_.js → Privacy-CPyw19Ai.js} +1 -1
- package/src/assets/web-panel/assets/{ProjectInit-DbMBCojn.js → ProjectInit-GDtYLbL6.js} +1 -1
- package/src/assets/web-panel/assets/{ProjectSettings-DPGbzkyi.js → ProjectSettings-DhmGKXVL.js} +1 -1
- package/src/assets/web-panel/assets/{Projects-B9-t2ofM.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-BIth1Lij.js → QrScannerModal-Dcqm-i6j.js} +1 -1
- package/src/assets/web-panel/assets/{QuickAsk-C928WbdK.js → QuickAsk-C6uPAeAE.js} +1 -1
- package/src/assets/web-panel/assets/{Recommend-CzDNsNPZ.js → Recommend-ClVlhga7.js} +1 -1
- package/src/assets/web-panel/assets/{RemoteSession-CedjOslI.js → RemoteSession-2raJDKUb.js} +1 -1
- package/src/assets/web-panel/assets/{Reputation-B8ggKVtj.js → Reputation-BYWC8k3t.js} +1 -1
- package/src/assets/web-panel/assets/{Row-Cx167nF6.js → Row-Bv7Y68ai.js} +1 -1
- package/src/assets/web-panel/assets/{RssFeed-Cj8hwiLP.js → RssFeed-Ba54MKvz.js} +1 -1
- package/src/assets/web-panel/assets/{Search-Dsyrkogu.js → Search-B9EkRkZK.js} +1 -1
- package/src/assets/web-panel/assets/{Security-DfOcWFt-.js → Security-DuXQGU4o.js} +1 -1
- package/src/assets/web-panel/assets/{Services-CSyv-JgS.js → Services-DJnCtY8x.js} +1 -1
- package/src/assets/web-panel/assets/{Skeleton-B0chhFP5.js → Skeleton-BVDdtf_S.js} +1 -1
- package/src/assets/web-panel/assets/{Skills-B_jrR_AF.js → Skills-DGkYCesm.js} +1 -1
- package/src/assets/web-panel/assets/{Sla-krP10aUI.js → Sla-CHND6lwC.js} +1 -1
- package/src/assets/web-panel/assets/{SpeechSettings-Cm_Cjvf2.js → SpeechSettings-Bg0Bgy9c.js} +1 -1
- package/src/assets/web-panel/assets/{SyncSettings-Cmb-KoqG.js → SyncSettings-DwtcZ2Ml.js} +1 -1
- package/src/assets/web-panel/assets/{Tasks-DUOiwTxY.js → Tasks-BoHc0cP2.js} +1 -1
- package/src/assets/web-panel/assets/{Templates-DcEPspsP.js → Templates-DAMs4m8X.js} +1 -1
- package/src/assets/web-panel/assets/{Tenant-Dw93LtrE.js → Tenant-DkVQbOzT.js} +1 -1
- package/src/assets/web-panel/assets/{Terminal-B04i0AIG.js → Terminal-BTOLM8Yu.js} +1 -1
- package/src/assets/web-panel/assets/{TimelineRenderer-C-aAORNK.js → TimelineRenderer-BO5ZyxUU.js} +1 -1
- package/src/assets/web-panel/assets/{Tokens-W1RBfDKb.js → Tokens-D0LjCtSA.js} +1 -1
- package/src/assets/web-panel/assets/{Trigger-BuuH9sMn.js → Trigger-DgGXg9VB.js} +1 -1
- package/src/assets/web-panel/assets/{Trust-Bma-Vz-f.js → Trust-BAEQrND-.js} +1 -1
- package/src/assets/web-panel/assets/{UkeySign-CqWw3_ha.js → UkeySign-TtBclFRw.js} +1 -1
- package/src/assets/web-panel/assets/{VideoEditing-6NYmQRUe.js → VideoEditing-ByxvpIpS.js} +1 -1
- package/src/assets/web-panel/assets/{Wallet-CTUuBxsr.js → Wallet-CTa7jqur.js} +1 -1
- package/src/assets/web-panel/assets/{WebAuthn-D8mN5UQU.js → WebAuthn-oHbCSjrD.js} +1 -1
- package/src/assets/web-panel/assets/{WorkflowEditor-DOB46XMH.js → WorkflowEditor-DQKQAdUS.js} +1 -1
- package/src/assets/web-panel/assets/{chat-BPNlNLwi.js → chat-BcCU2FuK.js} +1 -1
- package/src/assets/web-panel/assets/{colors-D-LNng0Q.js → colors-BcXAFjHT.js} +1 -1
- package/src/assets/web-panel/assets/{compact-item-Vkl3KOAb.js → compact-item-GhZzQppm.js} +1 -1
- package/src/assets/web-panel/assets/{createContext-CFsJ9Bmp.js → createContext-Bc6nwTUy.js} +1 -1
- package/src/assets/web-panel/assets/{hasIn-C1v7eiIB.js → hasIn-DRH8Xt0Y.js} +1 -1
- package/src/assets/web-panel/assets/{index-BGyhWFpc.js → index-60aCmptm.js} +1 -1
- package/src/assets/web-panel/assets/{index-BefXafSw.js → index-B7hScRVB.js} +1 -1
- package/src/assets/web-panel/assets/{index-Dq9SDl82.js → index-BDIN9KWp.js} +1 -1
- package/src/assets/web-panel/assets/{index-BQr5mmyc.js → index-BEQha9Ur.js} +1 -1
- package/src/assets/web-panel/assets/{index-Cjxxw-1P.js → index-BFFyqn3k.js} +1 -1
- package/src/assets/web-panel/assets/{index-MGJzHAw_.js → index-BOquBdmK.js} +1 -1
- package/src/assets/web-panel/assets/{index-DbmhJVc3.js → index-BQ6b5kJR.js} +1 -1
- package/src/assets/web-panel/assets/{index-DFErisPY.js → index-BaUmYzDB.js} +1 -1
- package/src/assets/web-panel/assets/{index-9JeeBF92.js → index-Bb5XCEKT.js} +1 -1
- package/src/assets/web-panel/assets/{index-ChGe005u.js → index-BdOccG1D.js} +1 -1
- package/src/assets/web-panel/assets/{index-BObyCZ2w.js → index-Bebe5WYu.js} +1 -1
- package/src/assets/web-panel/assets/index-BlS3EjXM.js +1 -0
- package/src/assets/web-panel/assets/{index-CaJvbmCw.js → index-BsRmNZCk.js} +1 -1
- package/src/assets/web-panel/assets/{index-CD8egQCF.js → index-CB1Thk9t.js} +1 -1
- package/src/assets/web-panel/assets/{index-CmkppTkH.js → index-CSHz8UnK.js} +1 -1
- package/src/assets/web-panel/assets/{index-a_H30VZX.js → index-Cexk6Y1r.js} +1 -1
- package/src/assets/web-panel/assets/{index-hBzgHVea.js → index-CtC-B6Zy.js} +1 -1
- package/src/assets/web-panel/assets/{index-DZ16Oxcu.js → index-D08s-CJ_.js} +1 -1
- package/src/assets/web-panel/assets/{index-PiL6D-FC.js → index-D6B_ELy6.js} +1 -1
- package/src/assets/web-panel/assets/{index-BoZnaD3Q.js → index-D6pWvvp-.js} +1 -1
- package/src/assets/web-panel/assets/{index-BMcTUbpz.js → index-D9QfJDQg.js} +1 -1
- package/src/assets/web-panel/assets/{index-BiPmMm38.js → index-DCCEt-pU.js} +1 -1
- package/src/assets/web-panel/assets/{index-BMsRfvkp.js → index-DCgr2bDL.js} +1 -1
- package/src/assets/web-panel/assets/{index-BgvrlrtJ.js → index-DNi_t23H.js} +1 -1
- package/src/assets/web-panel/assets/{index-DgYmI2pD.js → index-DOBzu5UO.js} +1 -1
- package/src/assets/web-panel/assets/{index-0oRhV07J.js → index-DOtNt1m7.js} +1 -1
- package/src/assets/web-panel/assets/{index-DmUZGqe2.js → index-DQnXn3vs.js} +1 -1
- package/src/assets/web-panel/assets/{index-DuIfomtv.js → index-DXip1xUj.js} +1 -1
- package/src/assets/web-panel/assets/{index-PCe8NA3J.js → index-DoRIPzwv.js} +1 -1
- package/src/assets/web-panel/assets/index-DwIMwROa.js +1 -0
- package/src/assets/web-panel/assets/{index-Dd0OgZmt.js → index-Dzh9Ud2R.js} +3 -3
- package/src/assets/web-panel/assets/{index-BH5PxoVq.js → index-DzhMohzV.js} +1 -1
- package/src/assets/web-panel/assets/{index-CfVl0Oqt.js → index-IW9dUJK_.js} +1 -1
- package/src/assets/web-panel/assets/{index-BPwv3l6X.js → index-WrMfehhj.js} +1 -1
- package/src/assets/web-panel/assets/{index-uDSUo2y2.js → index-gvsatTPZ.js} +1 -1
- package/src/assets/web-panel/assets/{index-BVHaJNpn.js → index-lEDZUWRO.js} +1 -1
- package/src/assets/web-panel/assets/{index-5oK4ICcR.js → index-mqlLcSgP.js} +1 -1
- package/src/assets/web-panel/assets/{index-BxJC59QT.js → index-owU4npmQ.js} +1 -1
- package/src/assets/web-panel/assets/{index-DVfUt2bK.js → index-wnmY4P7_.js} +1 -1
- package/src/assets/web-panel/assets/{initDefaultProps-CCYgHcTH.js → initDefaultProps-DfHPrIA5.js} +1 -1
- package/src/assets/web-panel/assets/{motion-4Yr4ZkjE.js → motion-CCzrK3c5.js} +1 -1
- package/src/assets/web-panel/assets/{move-ZP90E-ji.js → move-B2uu6I9f.js} +1 -1
- package/src/assets/web-panel/assets/{mtc-parser-s0N3WyRA.js → mtc-parser-DtFu2-C_.js} +1 -1
- package/src/assets/web-panel/assets/{omit-BZ6gx9Kf.js → omit-BFjLuAHb.js} +1 -1
- package/src/assets/web-panel/assets/parsers-DftYMnlk.js +3 -0
- package/src/assets/web-panel/assets/{pickAttrs-DxUtFOOQ.js → pickAttrs-DfsjYq45.js} +1 -1
- package/src/assets/web-panel/assets/{placementArrow-Btzjn1hK.js → placementArrow-CDdYIVXw.js} +1 -1
- package/src/assets/web-panel/assets/{responsiveObserve-DYcoe1XJ.js → responsiveObserve-CfrplFjn.js} +1 -1
- package/src/assets/web-panel/assets/{slide-BiBewdr4.js → slide-DHNX5Xwt.js} +1 -1
- package/src/assets/web-panel/assets/{statusUtils-D9vt0dkG.js → statusUtils-BI-C3SSk.js} +1 -1
- package/src/assets/web-panel/assets/{styleChecker-BXsm_vG0.js → styleChecker-C5Y3Oyy2.js} +1 -1
- package/src/assets/web-panel/assets/{useFlexGapSupport-CIG8zET4.js → useFlexGapSupport-atF45w0U.js} +1 -1
- package/src/assets/web-panel/assets/{useFs-ChFPF8GI.js → useFs-C4M8-xm9.js} +1 -1
- package/src/assets/web-panel/assets/{usePersonalDataHub-D4CzWJhY.js → usePersonalDataHub-jjZdnfs_.js} +1 -1
- package/src/assets/web-panel/assets/{vnode-6V5tphk5.js → vnode-BRTSCmU3.js} +1 -1
- package/src/assets/web-panel/assets/{zoom-B2H_VwfU.js → zoom-BaS5ZYRC.js} +1 -1
- package/src/assets/web-panel/index.html +1 -1
- package/src/command-help-index.json +1 -1
- package/src/commands/llm.js +45 -0
- package/src/commands/setup.js +100 -47
- package/src/data/changelog.json +91 -0
- package/src/gateways/ws/message-dispatcher.js +68 -0
- package/src/lib/config-manager.js +23 -5
- package/src/lib/config-schema.js +10 -5
- package/src/lib/evolution/evolution-artifact-ports.js +304 -0
- package/src/lib/evolution/evolution-file-retained-segment-backend.js +291 -0
- package/src/lib/evolution/evolution-file-witness.js +111 -6
- package/src/lib/evolution/evolution-immutable-ledger-segment-store.js +112 -0
- package/src/lib/evolution/evolution-ledger-file-backend.js +18 -1
- package/src/lib/evolution/evolution-ledger-manifest-chain.js +65 -1
- package/src/lib/evolution/evolution-ledger-manifest-witness-adapter.js +41 -2
- package/src/lib/evolution/evolution-ledger-v2-journal.js +126 -0
- package/src/lib/evolution/evolution-ledger-v2-manifest-backend.js +261 -2
- 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 +216 -12
- package/src/lib/evolution/rrsi-tenant-index-anchor-history.js +30 -0
- package/src/lib/lk-account-api.cjs +245 -0
- package/src/lib/lk-account.js +20 -0
- package/src/lib/lk-model-catalog.json +1840 -0
- package/src/lib/llm-channel-presets.js +111 -0
- package/src/lib/llm-connection-config.js +110 -19
- 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-CpAXh_6c.css +0 -1
- package/src/assets/web-panel/assets/Providers-q9dSBLsP.js +0 -1
- package/src/assets/web-panel/assets/index-CLafGdQC.js +0 -1
- package/src/assets/web-panel/assets/index-DYHw3Xoi.js +0 -1
- package/src/assets/web-panel/assets/parsers-YNLm7sQ0.js +0 -4
|
@@ -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
|
+
}
|
|
@@ -1,4 +1,9 @@
|
|
|
1
1
|
import { types as utilTypes } from "node:util";
|
|
2
|
+
import {
|
|
3
|
+
captureEvolutionFileWitnessDirectoryBoundaries,
|
|
4
|
+
hasEvolutionFileWitnessDirectoryBoundaries,
|
|
5
|
+
getEvolutionFileWitnessReadOnlyReader,
|
|
6
|
+
} from "./evolution-file-witness.js";
|
|
2
7
|
|
|
3
8
|
import { EVOLUTION_LEDGER_WITNESS_SCHEMA } from "./evolution-ledger.js";
|
|
4
9
|
import {
|
|
@@ -22,6 +27,8 @@ export const EVOLUTION_LEDGER_MANIFEST_WITNESS_COMMIT_UNKNOWN_CODE =
|
|
|
22
27
|
|
|
23
28
|
const DIGEST = /^sha256:[a-f0-9]{64}$/u;
|
|
24
29
|
const ADAPTERS = new WeakSet();
|
|
30
|
+
const ORIGINAL_WITNESSES = new WeakMap();
|
|
31
|
+
const READ_ONLY_READERS = new WeakMap();
|
|
25
32
|
const CONFIG_KEYS = new Set(["descriptor", "manifestAuthority", "witness"]);
|
|
26
33
|
const DESCRIPTOR_KEYS = new Set([
|
|
27
34
|
"epoch",
|
|
@@ -384,10 +391,10 @@ export function createEvolutionLedgerManifestWitnessAdapter(
|
|
|
384
391
|
);
|
|
385
392
|
const witness = captureWitness(data(fields, "witness"));
|
|
386
393
|
|
|
387
|
-
const
|
|
394
|
+
const readUsing = (operation) => {
|
|
388
395
|
let raw;
|
|
389
396
|
try {
|
|
390
|
-
raw = sync(
|
|
397
|
+
raw = sync(operation(), "manifest witness read result");
|
|
391
398
|
} catch (cause) {
|
|
392
399
|
if (cause instanceof EvolutionLedgerManifestWitnessError) throw cause;
|
|
393
400
|
throw failure(
|
|
@@ -403,6 +410,7 @@ export function createEvolutionLedgerManifestWitnessAdapter(
|
|
|
403
410
|
EVOLUTION_LEDGER_MANIFEST_WITNESS_CORRUPT_CODE,
|
|
404
411
|
);
|
|
405
412
|
};
|
|
413
|
+
const read = () => readUsing(witness.read);
|
|
406
414
|
|
|
407
415
|
const adapter = Object.freeze({
|
|
408
416
|
descriptor: Object.freeze({
|
|
@@ -523,6 +531,15 @@ export function createEvolutionLedgerManifestWitnessAdapter(
|
|
|
523
531
|
},
|
|
524
532
|
});
|
|
525
533
|
ADAPTERS.add(adapter);
|
|
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
|
+
);
|
|
526
543
|
return adapter;
|
|
527
544
|
}
|
|
528
545
|
|
|
@@ -552,3 +569,25 @@ export function captureEvolutionLedgerManifestWitnessAdapter(
|
|
|
552
569
|
}
|
|
553
570
|
return value;
|
|
554
571
|
}
|
|
572
|
+
|
|
573
|
+
export function hasEvolutionLedgerManifestWitnessDirectoryBoundaries(value) {
|
|
574
|
+
return hasEvolutionFileWitnessDirectoryBoundaries(
|
|
575
|
+
ORIGINAL_WITNESSES.get(value),
|
|
576
|
+
);
|
|
577
|
+
}
|
|
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
|
+
|
|
585
|
+
export function captureEvolutionLedgerManifestWitnessDirectoryBoundaries(
|
|
586
|
+
value,
|
|
587
|
+
) {
|
|
588
|
+
if (arguments.length !== 1 || !ORIGINAL_WITNESSES.has(value))
|
|
589
|
+
throw new TypeError("one original manifest witness adapter is required");
|
|
590
|
+
return captureEvolutionFileWitnessDirectoryBoundaries(
|
|
591
|
+
ORIGINAL_WITNESSES.get(value),
|
|
592
|
+
);
|
|
593
|
+
}
|
|
@@ -9,10 +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,
|
|
17
|
+
captureEvolutionLedgerV2ManifestWitnessDirectoryBoundaries,
|
|
18
|
+
captureEvolutionLedgerV2RetainedSegmentDirectoryBoundary,
|
|
19
|
+
captureEvolutionLedgerV2ReferencedSegmentInventory,
|
|
20
|
+
captureEvolutionLedgerV2LocalRetentionInventory,
|
|
21
|
+
getEvolutionLedgerV2ReadOnlyEventsReader,
|
|
16
22
|
hasEvolutionLedgerV2ManifestDirectoryBoundaries,
|
|
17
23
|
} from "./evolution-ledger-v2-manifest-backend.js";
|
|
18
24
|
|
|
@@ -22,6 +28,9 @@ export const EVOLUTION_LEDGER_V2_FINALIZATION_SCHEMA =
|
|
|
22
28
|
"chainlesschain.evolution-ledger-v2-finalization/v2";
|
|
23
29
|
const JOURNALS = new WeakSet();
|
|
24
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";
|
|
25
34
|
const RESERVED = new Set([
|
|
26
35
|
EVOLUTION_LEDGER_V2_MIGRATION_INTENT,
|
|
27
36
|
EVOLUTION_LEDGER_V2_CUTOVER_COMPLETED,
|
|
@@ -524,6 +533,13 @@ export function createEvolutionLedgerV2Journal(options) {
|
|
|
524
533
|
locked(recover);
|
|
525
534
|
JOURNALS.add(journal);
|
|
526
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
|
+
);
|
|
527
543
|
return journal;
|
|
528
544
|
}
|
|
529
545
|
|
|
@@ -539,10 +555,120 @@ export function captureEvolutionLedgerV2JournalManifestDirectoryBoundaries(
|
|
|
539
555
|
return captureEvolutionLedgerV2ManifestDirectoryBoundaries(backend);
|
|
540
556
|
}
|
|
541
557
|
|
|
558
|
+
export function captureEvolutionLedgerV2JournalWitnessDirectoryBoundaries(
|
|
559
|
+
value,
|
|
560
|
+
) {
|
|
561
|
+
if (arguments.length !== 1 || !MANIFEST_BACKENDS.has(value))
|
|
562
|
+
throw new TypeError("one original v2 journal is required");
|
|
563
|
+
return captureEvolutionLedgerV2ManifestWitnessDirectoryBoundaries(
|
|
564
|
+
MANIFEST_BACKENDS.get(value),
|
|
565
|
+
);
|
|
566
|
+
}
|
|
567
|
+
|
|
542
568
|
export function isEvolutionLedgerV2Journal(value) {
|
|
543
569
|
return JOURNALS.has(value);
|
|
544
570
|
}
|
|
545
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
|
+
|
|
546
672
|
// Production factory receives authenticated scope, not a structural ledger or a
|
|
547
673
|
// capability to bypass cutover. Capturing the result enforces the backend brand.
|
|
548
674
|
export function createEvolutionLedgerV2JournalFromFactory(
|
|
@@ -1,13 +1,18 @@
|
|
|
1
1
|
import { types as utilTypes } from "node:util";
|
|
2
2
|
import { createHash } from "node:crypto";
|
|
3
3
|
|
|
4
|
-
import {
|
|
4
|
+
import {
|
|
5
|
+
captureImmutableLedgerSegmentStorePort,
|
|
6
|
+
captureImmutableLedgerSegmentStoreDirectoryBoundary,
|
|
7
|
+
captureImmutableLedgerSegmentStoreFileInventory,
|
|
8
|
+
} from "./evolution-immutable-ledger-segment-store.js";
|
|
5
9
|
import {
|
|
6
10
|
captureEvolutionLedgerManifestAuthority,
|
|
7
11
|
deriveEvolutionLedgerManifestHead,
|
|
8
12
|
sealEvolutionLedgerManifestSegment,
|
|
9
13
|
verifyEvolutionLedgerManifestChain,
|
|
10
14
|
readEvolutionLedgerManifestEvents,
|
|
15
|
+
inspectEvolutionLedgerReferencedSegmentInventory,
|
|
11
16
|
} from "./evolution-ledger-manifest-chain.js";
|
|
12
17
|
import {
|
|
13
18
|
captureEvolutionLedgerManifestHeadStore,
|
|
@@ -19,7 +24,12 @@ import {
|
|
|
19
24
|
captureEvolutionLedgerManifestCatalogDirectoryBoundary,
|
|
20
25
|
hasEvolutionLedgerManifestCatalogDirectoryBoundary,
|
|
21
26
|
} from "./evolution-ledger-manifest-catalog.js";
|
|
22
|
-
import {
|
|
27
|
+
import {
|
|
28
|
+
captureEvolutionLedgerManifestWitnessAdapter,
|
|
29
|
+
captureEvolutionLedgerManifestWitnessDirectoryBoundaries,
|
|
30
|
+
hasEvolutionLedgerManifestWitnessDirectoryBoundaries,
|
|
31
|
+
getEvolutionLedgerManifestWitnessReadOnlyReader,
|
|
32
|
+
} from "./evolution-ledger-manifest-witness-adapter.js";
|
|
23
33
|
|
|
24
34
|
export const EVOLUTION_LEDGER_V2_MANIFEST_BACKEND_SCHEMA =
|
|
25
35
|
"chainlesschain.evolution-ledger-v2-manifest-backend/v2";
|
|
@@ -61,6 +71,7 @@ const APPEND_KEYS = new Set([
|
|
|
61
71
|
const VERIFY_KEYS = new Set();
|
|
62
72
|
const BACKENDS = new WeakSet();
|
|
63
73
|
const ORIGINAL_MANIFEST_COMPONENTS = new WeakMap();
|
|
74
|
+
const READ_ONLY_EVENT_READERS = new WeakMap();
|
|
64
75
|
|
|
65
76
|
export class EvolutionLedgerV2ManifestBackendError extends Error {
|
|
66
77
|
constructor(code, message, options = undefined) {
|
|
@@ -614,11 +625,123 @@ export function createEvolutionLedgerV2ManifestBackend(options = undefined) {
|
|
|
614
625
|
ORIGINAL_MANIFEST_COMPONENTS.set(backend, {
|
|
615
626
|
catalog,
|
|
616
627
|
headStore,
|
|
628
|
+
witnessAdapter,
|
|
629
|
+
segmentStore,
|
|
617
630
|
boundaries: null,
|
|
631
|
+
captureReferencedInventory() {
|
|
632
|
+
// Inspection must not repair a partial checkpoint or publish any state.
|
|
633
|
+
const read = () => {
|
|
634
|
+
const boundaries = hasEvolutionLedgerV2ManifestDirectoryBoundaries(
|
|
635
|
+
backend,
|
|
636
|
+
)
|
|
637
|
+
? captureEvolutionLedgerV2ManifestDirectoryBoundaries(backend)
|
|
638
|
+
: null;
|
|
639
|
+
const witness =
|
|
640
|
+
captureEvolutionLedgerV2ManifestWitnessDirectoryBoundaries(backend);
|
|
641
|
+
const retained =
|
|
642
|
+
captureEvolutionLedgerV2RetainedSegmentDirectoryBoundary(backend);
|
|
643
|
+
const recheckDirectories = () => {
|
|
644
|
+
boundaries?.catalog.recheck();
|
|
645
|
+
boundaries?.head.recheck();
|
|
646
|
+
witness?.recheck();
|
|
647
|
+
retained?.recheck();
|
|
648
|
+
};
|
|
649
|
+
const before = coherentSnapshot(catalog, headStore, witnessAdapter);
|
|
650
|
+
if (before.head === null)
|
|
651
|
+
throw failure(
|
|
652
|
+
EVOLUTION_LEDGER_V2_MANIFEST_INVALID_CODE,
|
|
653
|
+
"an empty manifest chain has no referenced inventory",
|
|
654
|
+
);
|
|
655
|
+
const snapshot = inspectEvolutionLedgerReferencedSegmentInventory({
|
|
656
|
+
authority: manifestAuthority,
|
|
657
|
+
descriptor: normalizedDescriptor,
|
|
658
|
+
head: before.head,
|
|
659
|
+
manifests: catalog.list(),
|
|
660
|
+
segmentStore,
|
|
661
|
+
});
|
|
662
|
+
const after = coherentSnapshot(catalog, headStore, witnessAdapter);
|
|
663
|
+
if (canonical(before) !== canonical(after))
|
|
664
|
+
throw failure(
|
|
665
|
+
EVOLUTION_LEDGER_V2_MANIFEST_CORRUPT_CODE,
|
|
666
|
+
"manifest checkpoint changed during referenced inventory readback",
|
|
667
|
+
);
|
|
668
|
+
recheckDirectories();
|
|
669
|
+
return snapshot;
|
|
670
|
+
};
|
|
671
|
+
const snapshot = read();
|
|
672
|
+
return Object.freeze({
|
|
673
|
+
snapshot,
|
|
674
|
+
recheck(...args) {
|
|
675
|
+
if (args.length)
|
|
676
|
+
throw new TypeError(
|
|
677
|
+
"referenced inventory takes no replacement context",
|
|
678
|
+
);
|
|
679
|
+
if (read().inventoryDigest !== snapshot.inventoryDigest)
|
|
680
|
+
throw failure(
|
|
681
|
+
EVOLUTION_LEDGER_V2_MANIFEST_CORRUPT_CODE,
|
|
682
|
+
"referenced segment inventory changed after capture",
|
|
683
|
+
);
|
|
684
|
+
return true;
|
|
685
|
+
},
|
|
686
|
+
});
|
|
687
|
+
},
|
|
618
688
|
});
|
|
689
|
+
const readOnlyWitness =
|
|
690
|
+
getEvolutionLedgerManifestWitnessReadOnlyReader(witnessAdapter);
|
|
691
|
+
if (
|
|
692
|
+
readOnlyWitness !== null &&
|
|
693
|
+
hasEvolutionLedgerV2ManifestDirectoryBoundaries(backend)
|
|
694
|
+
)
|
|
695
|
+
READ_ONLY_EVENT_READERS.set(
|
|
696
|
+
backend,
|
|
697
|
+
Object.freeze((...args) => {
|
|
698
|
+
if (args.length)
|
|
699
|
+
throw new TypeError(
|
|
700
|
+
"read-only manifest events take no replacement context",
|
|
701
|
+
);
|
|
702
|
+
const retention =
|
|
703
|
+
captureEvolutionLedgerV2RetainedSegmentDirectoryBoundary(backend);
|
|
704
|
+
if (retention === null) return null;
|
|
705
|
+
const directories =
|
|
706
|
+
captureEvolutionLedgerV2ManifestDirectoryBoundaries(backend);
|
|
707
|
+
const witnessDirectories =
|
|
708
|
+
captureEvolutionLedgerV2ManifestWitnessDirectoryBoundaries(backend);
|
|
709
|
+
const observer = Object.freeze({ read: readOnlyWitness });
|
|
710
|
+
const before = coherentSnapshot(catalog, headStore, observer);
|
|
711
|
+
if (before.head === null)
|
|
712
|
+
throw failure(
|
|
713
|
+
EVOLUTION_LEDGER_V2_MANIFEST_INVALID_CODE,
|
|
714
|
+
"read-only manifest events require a committed head",
|
|
715
|
+
);
|
|
716
|
+
const result = readEvolutionLedgerManifestEvents({
|
|
717
|
+
authority: manifestAuthority,
|
|
718
|
+
descriptor: normalizedDescriptor,
|
|
719
|
+
head: before.head,
|
|
720
|
+
manifests: catalog.list(),
|
|
721
|
+
segmentStore,
|
|
722
|
+
});
|
|
723
|
+
const after = coherentSnapshot(catalog, headStore, observer);
|
|
724
|
+
if (canonical(before) !== canonical(after))
|
|
725
|
+
throw failure(
|
|
726
|
+
EVOLUTION_LEDGER_V2_MANIFEST_CORRUPT_CODE,
|
|
727
|
+
"manifest checkpoint changed during read-only event capture",
|
|
728
|
+
);
|
|
729
|
+
directories.catalog.recheck();
|
|
730
|
+
directories.head.recheck();
|
|
731
|
+
witnessDirectories.recheck();
|
|
732
|
+
retention.recheck();
|
|
733
|
+
return result;
|
|
734
|
+
}),
|
|
735
|
+
);
|
|
619
736
|
return backend;
|
|
620
737
|
}
|
|
621
738
|
|
|
739
|
+
export function getEvolutionLedgerV2ReadOnlyEventsReader(value) {
|
|
740
|
+
if (arguments.length !== 1 || !ORIGINAL_MANIFEST_COMPONENTS.has(value))
|
|
741
|
+
throw new TypeError("one original v2 manifest backend is required");
|
|
742
|
+
return READ_ONLY_EVENT_READERS.get(value) ?? null;
|
|
743
|
+
}
|
|
744
|
+
|
|
622
745
|
/** Local metadata only. Capturing these components does not authenticate state. */
|
|
623
746
|
export function hasEvolutionLedgerV2ManifestDirectoryBoundaries(value) {
|
|
624
747
|
const components = ORIGINAL_MANIFEST_COMPONENTS.get(value);
|
|
@@ -643,6 +766,19 @@ export function captureEvolutionLedgerV2ManifestDirectoryBoundaries(value) {
|
|
|
643
766
|
return components.boundaries;
|
|
644
767
|
}
|
|
645
768
|
|
|
769
|
+
export function captureEvolutionLedgerV2ManifestWitnessDirectoryBoundaries(
|
|
770
|
+
value,
|
|
771
|
+
) {
|
|
772
|
+
if (arguments.length !== 1 || !ORIGINAL_MANIFEST_COMPONENTS.has(value))
|
|
773
|
+
throw new TypeError("one original v2 manifest backend is required");
|
|
774
|
+
const { witnessAdapter } = ORIGINAL_MANIFEST_COMPONENTS.get(value);
|
|
775
|
+
if (!hasEvolutionLedgerManifestWitnessDirectoryBoundaries(witnessAdapter))
|
|
776
|
+
return null;
|
|
777
|
+
return captureEvolutionLedgerManifestWitnessDirectoryBoundaries(
|
|
778
|
+
witnessAdapter,
|
|
779
|
+
);
|
|
780
|
+
}
|
|
781
|
+
|
|
646
782
|
export function captureEvolutionLedgerV2ManifestBackend(value) {
|
|
647
783
|
if (!BACKENDS.has(value)) {
|
|
648
784
|
throw new TypeError(
|
|
@@ -655,3 +791,126 @@ export function captureEvolutionLedgerV2ManifestBackend(value) {
|
|
|
655
791
|
export function isEvolutionLedgerV2ManifestBackend(value) {
|
|
656
792
|
return BACKENDS.has(value);
|
|
657
793
|
}
|
|
794
|
+
|
|
795
|
+
export function captureEvolutionLedgerV2RetainedSegmentDirectoryBoundary(
|
|
796
|
+
value,
|
|
797
|
+
) {
|
|
798
|
+
if (arguments.length !== 1 || !ORIGINAL_MANIFEST_COMPONENTS.has(value))
|
|
799
|
+
throw new TypeError("one original v2 manifest backend is required");
|
|
800
|
+
return captureImmutableLedgerSegmentStoreDirectoryBoundary(
|
|
801
|
+
ORIGINAL_MANIFEST_COMPONENTS.get(value).segmentStore,
|
|
802
|
+
);
|
|
803
|
+
}
|
|
804
|
+
|
|
805
|
+
/** Original factory chain only; caller-supplied manifests cannot trim inventory. */
|
|
806
|
+
export function captureEvolutionLedgerV2ReferencedSegmentInventory(value) {
|
|
807
|
+
if (arguments.length !== 1 || !ORIGINAL_MANIFEST_COMPONENTS.has(value))
|
|
808
|
+
throw new TypeError("one original v2 manifest backend is required");
|
|
809
|
+
return ORIGINAL_MANIFEST_COMPONENTS.get(value).captureReferencedInventory();
|
|
810
|
+
}
|
|
811
|
+
|
|
812
|
+
/** Full local retention audit is explicit; ordinary referenced replay is unchanged. */
|
|
813
|
+
export function captureEvolutionLedgerV2LocalRetentionInventory(value) {
|
|
814
|
+
if (arguments.length !== 1 || !ORIGINAL_MANIFEST_COMPONENTS.has(value))
|
|
815
|
+
throw new TypeError("one original v2 manifest backend is required");
|
|
816
|
+
const components = ORIGINAL_MANIFEST_COMPONENTS.get(value);
|
|
817
|
+
const read = () => {
|
|
818
|
+
const files = captureImmutableLedgerSegmentStoreFileInventory(
|
|
819
|
+
components.segmentStore,
|
|
820
|
+
);
|
|
821
|
+
if (files === null) return null;
|
|
822
|
+
const before = coherentSnapshot(
|
|
823
|
+
components.catalog,
|
|
824
|
+
components.headStore,
|
|
825
|
+
components.witnessAdapter,
|
|
826
|
+
);
|
|
827
|
+
const references = components.captureReferencedInventory();
|
|
828
|
+
const after = coherentSnapshot(
|
|
829
|
+
components.catalog,
|
|
830
|
+
components.headStore,
|
|
831
|
+
components.witnessAdapter,
|
|
832
|
+
);
|
|
833
|
+
if (
|
|
834
|
+
canonical(before) !== canonical(after) ||
|
|
835
|
+
before.head?.headDigest !== references.snapshot.head.headDigest
|
|
836
|
+
)
|
|
837
|
+
throw failure(
|
|
838
|
+
EVOLUTION_LEDGER_V2_MANIFEST_CORRUPT_CODE,
|
|
839
|
+
"manifest checkpoint changed during local retention audit",
|
|
840
|
+
);
|
|
841
|
+
const referenced = new Map(
|
|
842
|
+
references.snapshot.entries.map((entry) => [entry.segmentRef, entry]),
|
|
843
|
+
);
|
|
844
|
+
const entries = files.snapshot.entries.map((entry) => {
|
|
845
|
+
const reference = referenced.get(entry.segmentRef);
|
|
846
|
+
if (reference) {
|
|
847
|
+
if (
|
|
848
|
+
[
|
|
849
|
+
"contentDigest",
|
|
850
|
+
"proofDigest",
|
|
851
|
+
"storageVersion",
|
|
852
|
+
"sequenceStart",
|
|
853
|
+
"sequenceEnd",
|
|
854
|
+
"payloadBytes",
|
|
855
|
+
].some((field) => reference[field] !== entry[field])
|
|
856
|
+
)
|
|
857
|
+
throw failure(
|
|
858
|
+
EVOLUTION_LEDGER_V2_MANIFEST_CORRUPT_CODE,
|
|
859
|
+
"referenced segment differs from the complete local file inventory",
|
|
860
|
+
);
|
|
861
|
+
referenced.delete(entry.segmentRef);
|
|
862
|
+
}
|
|
863
|
+
return Object.freeze({
|
|
864
|
+
...entry,
|
|
865
|
+
disposition: reference ? "referenced" : "unreferenced-retained",
|
|
866
|
+
manifestDigest: reference?.manifestDigest ?? null,
|
|
867
|
+
});
|
|
868
|
+
});
|
|
869
|
+
if (referenced.size)
|
|
870
|
+
throw failure(
|
|
871
|
+
EVOLUTION_LEDGER_V2_MANIFEST_CORRUPT_CODE,
|
|
872
|
+
"referenced segments are missing from local file inventory",
|
|
873
|
+
);
|
|
874
|
+
// After ALL signing/verifier callbacks, check captured files without invoking
|
|
875
|
+
// those callbacks again. This is still a sequential, local state window.
|
|
876
|
+
files.recheckPhysicalSnapshot();
|
|
877
|
+
const core = Object.freeze({
|
|
878
|
+
schema: "chainlesschain.evolution-local-retention-audit/v1",
|
|
879
|
+
scope: "original-local-retention-directory-and-current-manifest-chain",
|
|
880
|
+
head: references.snapshot.head,
|
|
881
|
+
directoryInventoryDigest: files.snapshot.inventoryDigest,
|
|
882
|
+
referencedInventoryDigest: references.snapshot.inventoryDigest,
|
|
883
|
+
entries: Object.freeze(entries),
|
|
884
|
+
fileCount: entries.length,
|
|
885
|
+
referencedCount: references.snapshot.segmentCount,
|
|
886
|
+
unreferencedCount: entries.length - references.snapshot.segmentCount,
|
|
887
|
+
totalEncodedBytes: files.snapshot.totalEncodedBytes,
|
|
888
|
+
totalPayloadBytes: files.snapshot.totalPayloadBytes,
|
|
889
|
+
localDirectoryInventoryVerified: true,
|
|
890
|
+
externalWormVerified: false,
|
|
891
|
+
fullPhysicalStorageGraphVerified: false,
|
|
892
|
+
grantsMutationOrPromotionAuthority: false,
|
|
893
|
+
});
|
|
894
|
+
return Object.freeze({
|
|
895
|
+
...core,
|
|
896
|
+
auditDigest: `sha256:${createHash("sha256").update(`${core.schema}\0`).update(canonical(core)).digest("hex")}`,
|
|
897
|
+
});
|
|
898
|
+
};
|
|
899
|
+
const snapshot = read();
|
|
900
|
+
if (snapshot === null) return null;
|
|
901
|
+
return Object.freeze({
|
|
902
|
+
snapshot,
|
|
903
|
+
recheck(...args) {
|
|
904
|
+
if (args.length)
|
|
905
|
+
throw new TypeError(
|
|
906
|
+
"local retention audit takes no replacement context",
|
|
907
|
+
);
|
|
908
|
+
if (read().auditDigest !== snapshot.auditDigest)
|
|
909
|
+
throw failure(
|
|
910
|
+
EVOLUTION_LEDGER_V2_MANIFEST_CORRUPT_CODE,
|
|
911
|
+
"local retention inventory changed after capture",
|
|
912
|
+
);
|
|
913
|
+
return true;
|
|
914
|
+
},
|
|
915
|
+
});
|
|
916
|
+
}
|