chainlesschain 0.166.16 → 0.166.18
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 +17 -10
- package/completions/_cc +1 -1
- package/completions/cc.bash +1 -1
- package/completions/cc.fish +1 -1
- package/completions/cc.ps1 +1 -1
- package/package.json +2 -2
- package/src/assets/web-panel/assets/{AIOps-CTxa2Wbq.js → AIOps-CQSBl3hY.js} +1 -1
- package/src/assets/web-panel/assets/{ActionButton-DHrQyYhy.js → ActionButton-IQt-vRLt.js} +1 -1
- package/src/assets/web-panel/assets/{Analytics-DQiUqcNl.js → Analytics-DkHC8O7k.js} +3 -3
- package/src/assets/web-panel/assets/{AppLayout-_Iz4r6wt.js → AppLayout-CSti2P2T.js} +5 -5
- package/src/assets/web-panel/assets/{Artifacts-BNs63YHo.js → Artifacts-C57hxn3v.js} +1 -1
- package/src/assets/web-panel/assets/{Audit-BgHIqRLn.js → Audit-DByLntcf.js} +1 -1
- package/src/assets/web-panel/assets/{BackgroundAgents-DUQ5axBB.js → BackgroundAgents-D1Bd2EOa.js} +1 -1
- package/src/assets/web-panel/assets/{Backup-CJ51E9Vw.js → Backup-VstHzHng.js} +1 -1
- package/src/assets/web-panel/assets/{BaseInput-o-5toA_R.js → BaseInput-CLhdexIf.js} +1 -1
- package/src/assets/web-panel/assets/{Chat-Cu7a-x1L.js → Chat-BefC_JZS.js} +6 -6
- package/src/assets/web-panel/assets/{ChatBubbleRenderer-BUyYkAXr.js → ChatBubbleRenderer-DbXMvgmn.js} +1 -1
- package/src/assets/web-panel/assets/{Checkbox-DwdmZ71L.js → Checkbox-CEY982vx.js} +1 -1
- package/src/assets/web-panel/assets/{Codegen-BrH2eYiP.js → Codegen-Dcm_DTvJ.js} +1 -1
- package/src/assets/web-panel/assets/{Col-BVJQEP2j.js → Col-C8SSu4KA.js} +1 -1
- package/src/assets/web-panel/assets/{Community-FGO3vZPq.js → Community-BVV9vwRR.js} +1 -1
- package/src/assets/web-panel/assets/{Compact-DYGAFVnT.js → Compact-B7c5Vo18.js} +1 -1
- package/src/assets/web-panel/assets/{Compliance-CRvc8Bdt.js → Compliance-Tq9jSZ5a.js} +1 -1
- package/src/assets/web-panel/assets/{Cowork-D6Ah2m7A.js → Cowork-BJUjT09Q.js} +3 -3
- package/src/assets/web-panel/assets/{Cron-AXbU2ifR.js → Cron-CjV9PEaS.js} +2 -2
- package/src/assets/web-panel/assets/{Crosschain-C5DXgEFd.js → Crosschain-Dl7ReL8F.js} +1 -1
- package/src/assets/web-panel/assets/{DID-Bxh9QV9v.js → DID-CG8PjWmM.js} +2 -2
- package/src/assets/web-panel/assets/{Dashboard-B-ZHEta-.js → Dashboard-CDBM6wmF.js} +2 -2
- package/src/assets/web-panel/assets/{Dropdown-66Ik1jqa.js → Dropdown-8_55bXTD.js} +1 -1
- package/src/assets/web-panel/assets/{EmailListRenderer-CCWk1BIM.js → EmailListRenderer-D3qOU1Cm.js} +1 -1
- package/src/assets/web-panel/assets/{FamilyGuardDashboard--9faIULK.js → FamilyGuardDashboard-Bv5oWMZF.js} +1 -1
- package/src/assets/web-panel/assets/{Federation-CejW9CgX.js → Federation-hpZ1xkKd.js} +1 -1
- package/src/assets/web-panel/assets/{FormItemContext-acHgcXki.js → FormItemContext-BN7GT191.js} +1 -1
- package/src/assets/web-panel/assets/{GenericCardRenderer-D2ghd_K4.js → GenericCardRenderer-PCRhfA7M.js} +1 -1
- package/src/assets/web-panel/assets/{Git-BOe1YJrV.js → Git-CIlP2vy7.js} +2 -2
- package/src/assets/web-panel/assets/{Governance-BjgzJsof.js → Governance-81lgm7YL.js} +1 -1
- package/src/assets/web-panel/assets/{Inference-CXCD5rnP.js → Inference-Cs24xMOV.js} +1 -1
- package/src/assets/web-panel/assets/{KnowledgeGraph-CHA8QgJT.js → KnowledgeGraph-CrJLVCZo.js} +1 -1
- package/src/assets/web-panel/assets/{Logs-DORPMcL6.js → Logs-DLyO8RKT.js} +2 -2
- package/src/assets/web-panel/assets/{MarkdownRenderer-CPPHz01z.js → MarkdownRenderer-DBOqijrP.js} +1 -1
- package/src/assets/web-panel/assets/{Marketplace-BCFlo1Yx.js → Marketplace-Dz7AbQZc.js} +1 -1
- package/src/assets/web-panel/assets/{McpTools-Dl_uZAKh.js → McpTools-BM0aFiWv.js} +3 -3
- package/src/assets/web-panel/assets/{Memory-DupHamwz.js → Memory-C9SJzENX.js} +2 -2
- package/src/assets/web-panel/assets/{MobileBridge-BRSMPJxW.js → MobileBridge-BO2HnNRk.js} +1 -1
- package/src/assets/web-panel/assets/{MobileProjects-BHpuzsDl.js → MobileProjects-CK_jMz0l.js} +1 -1
- package/src/assets/web-panel/assets/{Mtc-Ch0jOQfZ.js → Mtc-CfhrJsdO.js} +2 -2
- package/src/assets/web-panel/assets/{MtcAudit-qzwQrDi7.js → MtcAudit-BE2ELxgI.js} +4 -4
- package/src/assets/web-panel/assets/{Multisig-B5wHzUcm.js → Multisig-CgR_E3Jd.js} +3 -3
- package/src/assets/web-panel/assets/{NLProgramming-Hy9uAiA0.js → NLProgramming-Cw9445_K.js} +1 -1
- package/src/assets/web-panel/assets/{Notes-DkuchMC7.js → Notes-DZimkTrb.js} +3 -3
- package/src/assets/web-panel/assets/{NotificationSettings-CYZhD7Pi.js → NotificationSettings-DxHVh4uT.js} +1 -1
- package/src/assets/web-panel/assets/{OrderTableRenderer-DKOoqajt.js → OrderTableRenderer-Iy-pnX56.js} +1 -1
- package/src/assets/web-panel/assets/{Organization-D9AXn6j8.js → Organization-pPXJtWo4.js} +4 -4
- package/src/assets/web-panel/assets/{Overflow-Bg15J6hX.js → Overflow-YamdTJwA.js} +1 -1
- package/src/assets/web-panel/assets/{P2P--B54HoQn.js → P2P-BvqP53x7.js} +2 -2
- package/src/assets/web-panel/assets/{PdhVaultBrowser-Cz9Kk2Nb.js → PdhVaultBrowser-Blz1Xn2n.js} +3 -3
- package/src/assets/web-panel/assets/{Permissions-DHx38eS1.js → Permissions-CgFRQqFJ.js} +4 -4
- package/src/assets/web-panel/assets/{PersonalDataHub-Dw8i2hAs.js → PersonalDataHub-CFeo3-6O.js} +4 -4
- package/src/assets/web-panel/assets/{Pipeline-B2o6Ur2G.js → Pipeline-BkaRojEK.js} +1 -1
- package/src/assets/web-panel/assets/{Privacy-8g-h2fnu.js → Privacy-BNZEx2Qp.js} +1 -1
- package/src/assets/web-panel/assets/{ProjectInit-DuVTcINx.js → ProjectInit-HUBOgEEK.js} +2 -2
- package/src/assets/web-panel/assets/{ProjectSettings-C8njvdZX.js → ProjectSettings-CFMmhROS.js} +2 -2
- package/src/assets/web-panel/assets/Projects-Dc517BXp.js +1 -0
- package/src/assets/web-panel/assets/{Providers-wFqgod_W.js → Providers-DTLf8bgj.js} +1 -1
- package/src/assets/web-panel/assets/{QrScannerModal-9NCXrpmA.js → QrScannerModal-BBNjPszk.js} +1 -1
- package/src/assets/web-panel/assets/{QuickAsk-WUTNvFkY.js → QuickAsk-DCsHvk3G.js} +1 -1
- package/src/assets/web-panel/assets/{Recommend-xT4nYmju.js → Recommend-Dpr5YSop.js} +1 -1
- package/src/assets/web-panel/assets/{RemoteSession-fak1PBGC.js → RemoteSession-DmKnvqGg.js} +2 -2
- package/src/assets/web-panel/assets/{Reputation-D1AkQvD-.js → Reputation-CSRfuurX.js} +1 -1
- package/src/assets/web-panel/assets/{Row-DVfm6xGt.js → Row-CDj3pQ_w.js} +1 -1
- package/src/assets/web-panel/assets/{RssFeed-BDunoLSE.js → RssFeed-DI0a_kNq.js} +2 -2
- package/src/assets/web-panel/assets/{Search-OPycRoU3.js → Search-jAy7B2nU.js} +1 -1
- package/src/assets/web-panel/assets/{Security-C8-Fm3Dt.js → Security-CkHTqYhc.js} +4 -4
- package/src/assets/web-panel/assets/{Services-qM_sMpMl.js → Services-CP-0Nzga.js} +2 -2
- package/src/assets/web-panel/assets/{Skeleton-D3HBJjVF.js → Skeleton-BkF5-p3n.js} +1 -1
- package/src/assets/web-panel/assets/{Skills-jr67X-tP.js → Skills-BDu-utDE.js} +1 -1
- package/src/assets/web-panel/assets/{Sla-CS3ggyCg.js → Sla-CQvq_2Qb.js} +1 -1
- package/src/assets/web-panel/assets/{SpeechSettings-CTOCYxOi.js → SpeechSettings-T7Ap512g.js} +1 -1
- package/src/assets/web-panel/assets/{SyncSettings-D3s3cLT5.js → SyncSettings-Bt-PLvot.js} +2 -2
- package/src/assets/web-panel/assets/{Tasks-CdfoJ25m.js → Tasks-yLEcCogg.js} +1 -1
- package/src/assets/web-panel/assets/{Templates-Drb4AI8X.js → Templates-ByN3fmbr.js} +1 -1
- package/src/assets/web-panel/assets/{Tenant-DzwR3Qkz.js → Tenant-DBI7hITH.js} +1 -1
- package/src/assets/web-panel/assets/{Terminal-D-ESq7xp.js → Terminal-B77_DlGX.js} +2 -2
- package/src/assets/web-panel/assets/{TimelineRenderer-BK-AUuws.js → TimelineRenderer-CsLTB_QO.js} +1 -1
- package/src/assets/web-panel/assets/{Tokens-xGTouuNp.js → Tokens-BV2N6cR8.js} +1 -1
- package/src/assets/web-panel/assets/{Trigger-BvZj-v2H.js → Trigger-CjXWGH3p.js} +1 -1
- package/src/assets/web-panel/assets/{Trust-BLC9CGmc.js → Trust-uqXIq3WC.js} +1 -1
- package/src/assets/web-panel/assets/{UkeySign-BSuCXpmE.js → UkeySign-D-6qu4vY.js} +1 -1
- package/src/assets/web-panel/assets/{VideoEditing-DT3A-_Ql.js → VideoEditing-CxGmx_2e.js} +1 -1
- package/src/assets/web-panel/assets/{Wallet-c1OXao85.js → Wallet-DSq7WlAg.js} +4 -4
- package/src/assets/web-panel/assets/{WebAuthn-CuA-F7KJ.js → WebAuthn-CDBiD57O.js} +2 -2
- package/src/assets/web-panel/assets/{WorkflowEditor-MANZrf82.js → WorkflowEditor-Z8f63TSb.js} +1 -1
- package/src/assets/web-panel/assets/{chat-D4Y4Ey0O.js → chat-B-UZFBjy.js} +1 -1
- package/src/assets/web-panel/assets/{colors-DDH06hKO.js → colors-CFk7K-7Q.js} +1 -1
- package/src/assets/web-panel/assets/{compact-item-Cym756Xj.js → compact-item-X0IVMvgi.js} +1 -1
- package/src/assets/web-panel/assets/{createContext-By4Nb1k-.js → createContext-DWg4j2n6.js} +1 -1
- package/src/assets/web-panel/assets/devWarning-B2IW1J_J.js +1 -0
- package/src/assets/web-panel/assets/{hasIn-Ch7OY258.js → hasIn-CkVCwNNF.js} +1 -1
- package/src/assets/web-panel/assets/{index-D9le0-dc.js → index-5OcZHdzc.js} +1 -1
- package/src/assets/web-panel/assets/{index-CykROEJA.js → index-B273IY-E.js} +1 -1
- package/src/assets/web-panel/assets/{index-DjwgJ5Jd.js → index-B3-B3FWD.js} +1 -1
- package/src/assets/web-panel/assets/{index-CjNUTBwe.js → index-BB4KHHcv.js} +1 -1
- package/src/assets/web-panel/assets/index-BCp2ir-1.js +1 -0
- package/src/assets/web-panel/assets/{index-BFydNU6a.js → index-BG-GaZri.js} +1 -1
- package/src/assets/web-panel/assets/{index-mL3nOcH6.js → index-BPBia4b-.js} +1 -1
- package/src/assets/web-panel/assets/{index-XGeQMvWK.js → index-BipwEbTA.js} +1 -1
- package/src/assets/web-panel/assets/{index-D5sADPGY.js → index-BoskgPt9.js} +1 -1
- package/src/assets/web-panel/assets/{index-CV8qXTvb.js → index-Btqk6zWb.js} +1 -1
- package/src/assets/web-panel/assets/index-Bw4iuzRD.js +1 -0
- package/src/assets/web-panel/assets/{index-CJPks33Y.js → index-BzXjYUmd.js} +1 -1
- package/src/assets/web-panel/assets/{index-BBBUn5v7.js → index-C1ZAOJRW.js} +1 -1
- package/src/assets/web-panel/assets/{index-DiewptTL.js → index-CCLwoATF.js} +1 -1
- package/src/assets/web-panel/assets/{index-OU8DZ9BL.js → index-CDfSD07S.js} +1 -1
- package/src/assets/web-panel/assets/{index-DvnywwUj.js → index-CLlP1E4X.js} +1 -1
- package/src/assets/web-panel/assets/{index-CT-3FYwd.js → index-CMCEXBRh.js} +1 -1
- package/src/assets/web-panel/assets/{index-tZ5BUdad.js → index-CN8HZlLH.js} +1 -1
- package/src/assets/web-panel/assets/{index-DNlxihs8.js → index-CNKFsBlz.js} +1 -1
- package/src/assets/web-panel/assets/{index-CF3Lhyns.js → index-CUBkvFPH.js} +1 -1
- package/src/assets/web-panel/assets/{index-CV1UC4zo.js → index-Ca0mij1n.js} +1 -1
- package/src/assets/web-panel/assets/{index-DAkk1M7x.js → index-CbIAWbma.js} +1 -1
- package/src/assets/web-panel/assets/{index-DNEJzc0r.js → index-CbihMThv.js} +1 -1
- package/src/assets/web-panel/assets/{index-q-s04OKn.js → index-CvOa-IFV.js} +1 -1
- package/src/assets/web-panel/assets/{index-BZB9q-Lp.js → index-Cvwu_rA_.js} +1 -1
- package/src/assets/web-panel/assets/{index-oBsfUbyH.js → index-D-EJNxgR.js} +1 -1
- package/src/assets/web-panel/assets/{index-ZY2Qs_Sn.js → index-D8uEL8Uw.js} +1 -1
- package/src/assets/web-panel/assets/{index-DtGValNi.js → index-D92g4l3n.js} +1 -1
- package/src/assets/web-panel/assets/{index-CpudmDhf.js → index-DCqpl_E_.js} +1 -1
- package/src/assets/web-panel/assets/{index-Bo20BfdS.js → index-DLSBks8h.js} +1 -1
- package/src/assets/web-panel/assets/{index-CUSUzaB8.js → index-Db_5xhrU.js} +1 -1
- package/src/assets/web-panel/assets/{index-CZn6dmZe.js → index-DcDggpWR.js} +1 -1
- package/src/assets/web-panel/assets/{index-CGsvEbbq.js → index-DeWKPQGs.js} +1 -1
- package/src/assets/web-panel/assets/{index-jx7kr6mB.js → index-DhVHoqGL.js} +3 -3
- package/src/assets/web-panel/assets/{index-BIrRX-ra.js → index-DyWlOuak.js} +1 -1
- package/src/assets/web-panel/assets/{index-6CpOV3Pn.js → index-LU54bChK.js} +1 -1
- package/src/assets/web-panel/assets/{index-6-2eYBXr.js → index-OjnAwUJo.js} +1 -1
- package/src/assets/web-panel/assets/{index-B51otVoZ.js → index-P83LDnCz.js} +1 -1
- package/src/assets/web-panel/assets/{index-ArMrnx0v.js → index-_-9k3Tna.js} +1 -1
- package/src/assets/web-panel/assets/{initDefaultProps-DGcX9iPP.js → initDefaultProps-CFNgY8lJ.js} +1 -1
- package/src/assets/web-panel/assets/{motion-2SeL1D8A.js → motion-D-5RrDzn.js} +1 -1
- package/src/assets/web-panel/assets/{move-3cYbQCpS.js → move-DN-L0Bd-.js} +1 -1
- package/src/assets/web-panel/assets/{mtc-parser-IDdxfw0z.js → mtc-parser-6mgLSeCK.js} +1 -1
- package/src/assets/web-panel/assets/{omit-BNswdKO6.js → omit-ClWW8eTP.js} +1 -1
- package/src/assets/web-panel/assets/{pickAttrs-BwCnem2I.js → pickAttrs-Vystq3R8.js} +1 -1
- package/src/assets/web-panel/assets/{placementArrow-B9PtZ5rq.js → placementArrow-D0H9hK4W.js} +1 -1
- package/src/assets/web-panel/assets/{responsiveObserve-CPB6iSzV.js → responsiveObserve-B3iNRU-a.js} +1 -1
- package/src/assets/web-panel/assets/{slide-DZgyblZa.js → slide-CiMXe6am.js} +1 -1
- package/src/assets/web-panel/assets/{statusUtils-D82IBdsx.js → statusUtils-CGDZJ1uT.js} +1 -1
- package/src/assets/web-panel/assets/{styleChecker-qSHtosM-.js → styleChecker-D2zA6NkY.js} +1 -1
- package/src/assets/web-panel/assets/{useFlexGapSupport-CmWO7h0I.js → useFlexGapSupport-C1sYU6QE.js} +1 -1
- package/src/assets/web-panel/assets/{useFs-yLrs_ub4.js → useFs-BzUHSjg2.js} +1 -1
- package/src/assets/web-panel/assets/{usePersonalDataHub-CJ1VW6rh.js → usePersonalDataHub-CxB5yZCq.js} +1 -1
- package/src/assets/web-panel/assets/{vnode-CzY_moQ4.js → vnode-BfUfMwtc.js} +1 -1
- package/src/assets/web-panel/assets/{zoom-DAa7rEY5.js → zoom-CFYmj1TO.js} +1 -1
- package/src/assets/web-panel/index.html +1 -1
- package/src/command-help-index.json +2 -2
- package/src/command-manifest.json +2 -2
- package/src/commands/agent.js +80 -2
- package/src/commands/evolution.js +61 -42
- package/src/commands/learning.js +24 -8
- package/src/commands/serve.js +11 -2
- package/src/data/changelog.json +13 -0
- package/src/gateways/ws/session-protocol.js +1 -0
- package/src/gateways/ws/ws-agent-handler.js +70 -2
- package/src/gateways/ws/ws-server.js +8 -0
- package/src/lib/app-server/cli-agent-kernel-adapter.js +4 -0
- package/src/lib/app-server/graph-runtime.js +115 -8
- package/src/lib/app-server/server.js +21 -2
- package/src/lib/app-server/websocket-transport.js +2 -0
- package/src/lib/evolution/agent-evolution-ingress.js +300 -0
- package/src/lib/evolution/agent-evolution-runtime-composition-brand.js +22 -0
- package/src/lib/evolution/agent-evolution-runtime-composition.js +369 -0
- package/src/lib/evolution/bounded-skill-improvement-pilot.js +498 -0
- package/src/lib/evolution/evidence-backed-wiki-maintainer.js +752 -0
- package/src/lib/evolution/evolution-artifact-ports.js +48 -0
- package/src/lib/evolution/evolution-eval-gate.js +11 -4
- package/src/lib/evolution/evolution-evidence-artifact-adapter.js +499 -0
- package/src/lib/evolution/evolution-evidence-projector.js +61 -1
- package/src/lib/evolution/evolution-file-witness.js +601 -0
- package/src/lib/evolution/evolution-ledger-file-backend.js +176 -0
- package/src/lib/evolution/evolution-ledger-ports.js +353 -16
- package/src/lib/evolution/evolution-ledger.js +1355 -54
- package/src/lib/evolution/evolution-run-ledger-adapter.js +409 -0
- package/src/lib/evolution/evolution-run-runtime-adapter.js +5 -0
- package/src/lib/evolution/evolution-run-wiki-maintenance-source.js +300 -0
- package/src/lib/evolution/scheduled-batch-wiki-maintenance-source.js +368 -0
- package/src/lib/evolution/skill-candidate-registry.js +649 -0
- package/src/lib/evolution/skill-evaluated-promotion-durability.js +899 -0
- package/src/lib/evolution/skill-evaluated-promotion.js +481 -0
- package/src/lib/evolution/skill-promotion-controller.js +220 -37
- package/src/lib/evolution/skill-promotion-review-ledger-adapter.js +451 -0
- package/src/lib/evolution/skill-promotion-review.js +793 -0
- package/src/lib/evolution/skill-registry-transition-capability.js +55 -0
- package/src/lib/evolution/skill-registry-transition-ledger-adapter.js +1280 -0
- package/src/lib/evolution/skill-registry-transition-source.js +372 -0
- package/src/lib/evolution/skill-release-registry.js +2191 -11
- package/src/lib/evolution/skill-target-matrix-eval.js +133 -10
- package/src/lib/evolution/structured-memory-agent-control-plane.js +222 -0
- package/src/lib/evolution/structured-memory-authority-ledger-adapter.js +351 -0
- package/src/lib/evolution/structured-memory-ledger-adapter.js +220 -0
- package/src/lib/evolution/structured-memory-policy-receipt-writer.js +164 -0
- package/src/lib/evolution/structured-memory-post-compact-hook.js +87 -0
- package/src/lib/evolution/structured-memory-promotion-receipt-writer.js +221 -0
- package/src/lib/evolution/structured-memory-semantic-review-pipeline.js +313 -0
- package/src/lib/evolution/wiki-informed-skill-proposer.js +343 -0
- package/src/lib/evolution/wiki-maintainer-ledger-adapter.js +200 -0
- package/src/lib/evolution/wiki-maintenance-trigger-ledger-adapter.js +687 -0
- package/src/lib/evolution-system.js +65 -30
- package/src/lib/graph-kernel/evolution-run-runtime-adapter.js +5 -0
- package/src/lib/hooks-v2-runtime.js +20 -0
- package/src/lib/mcp-lifecycle-authority.js +21 -2
- package/src/lib/remote-approval-bridge.js +24 -0
- package/src/lib/scheduler-kernel/store.js +62 -14
- package/src/repl/agent-repl.js +45 -0
- package/src/runtime/agent-core.js +68 -0
- package/src/runtime/agent-runtime.js +114 -1
- package/src/runtime/headless-runner.js +19 -0
- package/src/runtime/headless-stream.js +43 -0
- package/src/runtime/runtime-factory.js +19 -1
- package/src/assets/web-panel/assets/Projects-Ca9BAfu7.js +0 -1
- package/src/assets/web-panel/assets/devWarning-KO3pAGeO.js +0 -1
- package/src/assets/web-panel/assets/index-Bh4Rgkg2.js +0 -1
- package/src/assets/web-panel/assets/index-Dox_coTY.js +0 -1
- package/src/lib/learning/learning-hooks.js +0 -123
|
@@ -0,0 +1,369 @@
|
|
|
1
|
+
import crypto from "node:crypto";
|
|
2
|
+
import fs from "node:fs";
|
|
3
|
+
import path from "node:path";
|
|
4
|
+
import { types as utilTypes } from "node:util";
|
|
5
|
+
|
|
6
|
+
import { ArtifactStore } from "../artifact-store.js";
|
|
7
|
+
import {
|
|
8
|
+
ArtifactStoreEncryptedRawStore,
|
|
9
|
+
EvolutionEvidenceArtifactAdapter,
|
|
10
|
+
} from "./evolution-evidence-artifact-adapter.js";
|
|
11
|
+
import {
|
|
12
|
+
EvolutionEvidenceBundleVerifier,
|
|
13
|
+
EvolutionEvidenceProjector,
|
|
14
|
+
} from "./evolution-evidence-projector.js";
|
|
15
|
+
import { EvolutionArtifactPorts } from "./evolution-artifact-ports.js";
|
|
16
|
+
import {
|
|
17
|
+
captureEvolutionLedgerFileBackend,
|
|
18
|
+
createEvolutionLedgerFileBackend,
|
|
19
|
+
} from "./evolution-ledger-file-backend.js";
|
|
20
|
+
import { EvolutionRunLedgerAdapter } from "./evolution-run-ledger-adapter.js";
|
|
21
|
+
import {
|
|
22
|
+
captureAgentEvolutionIngress,
|
|
23
|
+
createAgentEvolutionIngress,
|
|
24
|
+
} from "./agent-evolution-ingress.js";
|
|
25
|
+
import { sealAgentEvolutionRuntimeComposition } from "./agent-evolution-runtime-composition-brand.js";
|
|
26
|
+
|
|
27
|
+
export {
|
|
28
|
+
AGENT_EVOLUTION_RUNTIME_COMPOSITION_SCHEMA,
|
|
29
|
+
captureAgentEvolutionRuntimeComposition,
|
|
30
|
+
} from "./agent-evolution-runtime-composition-brand.js";
|
|
31
|
+
const SAFE_ID = /^[A-Za-z0-9][A-Za-z0-9._:@/-]{0,255}$/u;
|
|
32
|
+
const AUTHORITY_KEYS = new Set([
|
|
33
|
+
"artifact",
|
|
34
|
+
"attestationSigner",
|
|
35
|
+
"attestationVerifier",
|
|
36
|
+
"keyedCommitter",
|
|
37
|
+
"ledger",
|
|
38
|
+
"rawEncryptor",
|
|
39
|
+
"sourceEnvelope",
|
|
40
|
+
"sourceVerifier",
|
|
41
|
+
"storagePolicy",
|
|
42
|
+
"witness",
|
|
43
|
+
]);
|
|
44
|
+
const ARTIFACT_AUTHORITY_KEYS = new Set([
|
|
45
|
+
"currentAuthorityResolver",
|
|
46
|
+
"envelopeSigner",
|
|
47
|
+
"envelopeVerifier",
|
|
48
|
+
]);
|
|
49
|
+
|
|
50
|
+
function exactRecord(value, keys, label) {
|
|
51
|
+
if (
|
|
52
|
+
!value ||
|
|
53
|
+
typeof value !== "object" ||
|
|
54
|
+
Array.isArray(value) ||
|
|
55
|
+
utilTypes.isProxy(value) ||
|
|
56
|
+
Reflect.ownKeys(value).length !== keys.size ||
|
|
57
|
+
Reflect.ownKeys(value).some(
|
|
58
|
+
(key) => typeof key !== "string" || !keys.has(key),
|
|
59
|
+
)
|
|
60
|
+
) {
|
|
61
|
+
throw new TypeError(`${label} must contain exactly the required ports`);
|
|
62
|
+
}
|
|
63
|
+
for (const key of Reflect.ownKeys(value)) {
|
|
64
|
+
const descriptor = Object.getOwnPropertyDescriptor(value, key);
|
|
65
|
+
if (!descriptor || !("value" in descriptor) || !descriptor.enumerable) {
|
|
66
|
+
throw new TypeError(`${label}.${String(key)} must be a data property`);
|
|
67
|
+
}
|
|
68
|
+
}
|
|
69
|
+
return value;
|
|
70
|
+
}
|
|
71
|
+
|
|
72
|
+
function identifier(value, label) {
|
|
73
|
+
if (typeof value !== "string" || !SAFE_ID.test(value)) {
|
|
74
|
+
throw new TypeError(`${label} is invalid`);
|
|
75
|
+
}
|
|
76
|
+
return value;
|
|
77
|
+
}
|
|
78
|
+
|
|
79
|
+
function capture(owner, method, label) {
|
|
80
|
+
if (
|
|
81
|
+
!owner ||
|
|
82
|
+
typeof owner !== "object" ||
|
|
83
|
+
utilTypes.isProxy(owner) ||
|
|
84
|
+
typeof owner[method] !== "function"
|
|
85
|
+
) {
|
|
86
|
+
throw new TypeError(`${label}.${method} port is required`);
|
|
87
|
+
}
|
|
88
|
+
const operation = owner[method];
|
|
89
|
+
return Object.freeze((...args) => Reflect.apply(operation, owner, args));
|
|
90
|
+
}
|
|
91
|
+
|
|
92
|
+
function captureAuthority(authority, method, label) {
|
|
93
|
+
return Object.freeze({ [method]: capture(authority, method, label) });
|
|
94
|
+
}
|
|
95
|
+
|
|
96
|
+
function normalizeClock(clock) {
|
|
97
|
+
if (typeof clock !== "function" || utilTypes.isProxy(clock)) {
|
|
98
|
+
throw new TypeError("clock must be a non-proxy function");
|
|
99
|
+
}
|
|
100
|
+
return Object.freeze(() => {
|
|
101
|
+
const milliseconds = Number(clock());
|
|
102
|
+
if (!Number.isFinite(milliseconds)) {
|
|
103
|
+
throw new TypeError("clock must return epoch milliseconds");
|
|
104
|
+
}
|
|
105
|
+
return milliseconds;
|
|
106
|
+
});
|
|
107
|
+
}
|
|
108
|
+
|
|
109
|
+
function layout(stateRootDir, tenantId, runId) {
|
|
110
|
+
if (typeof stateRootDir !== "string" || stateRootDir.trim() === "") {
|
|
111
|
+
throw new TypeError("stateRootDir is required");
|
|
112
|
+
}
|
|
113
|
+
const rootDir = path.resolve(stateRootDir);
|
|
114
|
+
const scope = path.join(
|
|
115
|
+
rootDir,
|
|
116
|
+
encodeURIComponent(tenantId),
|
|
117
|
+
encodeURIComponent(runId),
|
|
118
|
+
);
|
|
119
|
+
const result = Object.freeze({
|
|
120
|
+
rootDir,
|
|
121
|
+
artifactDir: path.join(scope, "artifacts"),
|
|
122
|
+
rawDir: path.join(scope, "raw"),
|
|
123
|
+
ledgerRootDir: path.join(scope, "ledger-events"),
|
|
124
|
+
ledgerAuthorityRootDir: path.join(scope, "ledger-authority"),
|
|
125
|
+
witnessFilePath: path.join(scope, "witness", "checkpoint.json"),
|
|
126
|
+
});
|
|
127
|
+
fs.mkdirSync(path.dirname(result.witnessFilePath), {
|
|
128
|
+
recursive: true,
|
|
129
|
+
mode: 0o700,
|
|
130
|
+
});
|
|
131
|
+
return result;
|
|
132
|
+
}
|
|
133
|
+
|
|
134
|
+
function defaultWitnessId(tenantId, runId) {
|
|
135
|
+
return `agent-evolution-${crypto
|
|
136
|
+
.createHash("sha256")
|
|
137
|
+
.update(`${tenantId}\0${runId}`, "utf8")
|
|
138
|
+
.digest("hex")}`;
|
|
139
|
+
}
|
|
140
|
+
|
|
141
|
+
function assertIndependentSigningAuthorities(ledger, witness) {
|
|
142
|
+
if (
|
|
143
|
+
!ledger?.trust ||
|
|
144
|
+
!witness?.trust ||
|
|
145
|
+
ledger === witness ||
|
|
146
|
+
ledger.signer === witness.signer ||
|
|
147
|
+
ledger.verifier === witness.verifier ||
|
|
148
|
+
ledger.trust === witness.trust ||
|
|
149
|
+
ledger.trust.keyId === witness.trust.keyId ||
|
|
150
|
+
ledger.trust.trustPolicyDigest === witness.trust.trustPolicyDigest
|
|
151
|
+
) {
|
|
152
|
+
throw new TypeError(
|
|
153
|
+
"ledger and witness production authorities must be independent",
|
|
154
|
+
);
|
|
155
|
+
}
|
|
156
|
+
}
|
|
157
|
+
|
|
158
|
+
/**
|
|
159
|
+
* Production composition root for the CLI Agent evolution ingress.
|
|
160
|
+
*
|
|
161
|
+
* Every cryptographic, identity, policy, commitment and encryption operation
|
|
162
|
+
* is supplied by the host. This module deliberately contains no local key,
|
|
163
|
+
* permissive policy, environment fallback, or auto-enable path.
|
|
164
|
+
*/
|
|
165
|
+
export function createAgentEvolutionRuntimeComposition({
|
|
166
|
+
tenantId: tenantIdInput,
|
|
167
|
+
runId: runIdInput,
|
|
168
|
+
audience: audienceInput = "evolution-runtime",
|
|
169
|
+
stateRootDir,
|
|
170
|
+
authorities: authorityInput,
|
|
171
|
+
evidenceTtlMs,
|
|
172
|
+
witnessId: witnessIdInput,
|
|
173
|
+
clock: clockInput = Date.now,
|
|
174
|
+
evidenceIdGenerator,
|
|
175
|
+
ingressIdGenerator,
|
|
176
|
+
wikiMaintenanceProducer = null,
|
|
177
|
+
completionTriggerKind,
|
|
178
|
+
secure = true,
|
|
179
|
+
fsImpl,
|
|
180
|
+
lock,
|
|
181
|
+
random,
|
|
182
|
+
lockTimeoutMs,
|
|
183
|
+
witnessMaximumBytes,
|
|
184
|
+
} = {}) {
|
|
185
|
+
const tenantId = identifier(tenantIdInput, "tenantId");
|
|
186
|
+
const runId = identifier(runIdInput, "runId");
|
|
187
|
+
const audience = identifier(audienceInput, "audience");
|
|
188
|
+
const witnessId = identifier(
|
|
189
|
+
witnessIdInput ?? defaultWitnessId(tenantId, runId),
|
|
190
|
+
"witnessId",
|
|
191
|
+
);
|
|
192
|
+
const authorities = exactRecord(
|
|
193
|
+
authorityInput,
|
|
194
|
+
AUTHORITY_KEYS,
|
|
195
|
+
"authorities",
|
|
196
|
+
);
|
|
197
|
+
const artifactAuthority = exactRecord(
|
|
198
|
+
authorities.artifact,
|
|
199
|
+
ARTIFACT_AUTHORITY_KEYS,
|
|
200
|
+
"authorities.artifact",
|
|
201
|
+
);
|
|
202
|
+
const clock = normalizeClock(clockInput);
|
|
203
|
+
if (
|
|
204
|
+
typeof evidenceIdGenerator !== "function" ||
|
|
205
|
+
utilTypes.isProxy(evidenceIdGenerator)
|
|
206
|
+
) {
|
|
207
|
+
throw new TypeError("evidenceIdGenerator port is required");
|
|
208
|
+
}
|
|
209
|
+
if (
|
|
210
|
+
typeof ingressIdGenerator !== "function" ||
|
|
211
|
+
utilTypes.isProxy(ingressIdGenerator)
|
|
212
|
+
) {
|
|
213
|
+
throw new TypeError("ingressIdGenerator port is required");
|
|
214
|
+
}
|
|
215
|
+
const ports = Object.freeze({
|
|
216
|
+
artifactEnvelopeSigner: captureAuthority(
|
|
217
|
+
artifactAuthority.envelopeSigner,
|
|
218
|
+
"sign",
|
|
219
|
+
"artifact envelope signer",
|
|
220
|
+
),
|
|
221
|
+
artifactEnvelopeVerifier: captureAuthority(
|
|
222
|
+
artifactAuthority.envelopeVerifier,
|
|
223
|
+
"verify",
|
|
224
|
+
"artifact envelope verifier",
|
|
225
|
+
),
|
|
226
|
+
artifactCurrentAuthorityResolver: captureAuthority(
|
|
227
|
+
artifactAuthority.currentAuthorityResolver,
|
|
228
|
+
"resolve",
|
|
229
|
+
"artifact current authority resolver",
|
|
230
|
+
),
|
|
231
|
+
rawEncryptor: captureAuthority(
|
|
232
|
+
authorities.rawEncryptor,
|
|
233
|
+
"encrypt",
|
|
234
|
+
"Raw encryptor",
|
|
235
|
+
),
|
|
236
|
+
sourceEnvelope: captureAuthority(
|
|
237
|
+
authorities.sourceEnvelope,
|
|
238
|
+
"issue",
|
|
239
|
+
"source envelope authority",
|
|
240
|
+
),
|
|
241
|
+
sourceVerifier: captureAuthority(
|
|
242
|
+
authorities.sourceVerifier,
|
|
243
|
+
"verify",
|
|
244
|
+
"source verifier",
|
|
245
|
+
),
|
|
246
|
+
keyedCommitter: captureAuthority(
|
|
247
|
+
authorities.keyedCommitter,
|
|
248
|
+
"commit",
|
|
249
|
+
"keyed committer",
|
|
250
|
+
),
|
|
251
|
+
storagePolicy: captureAuthority(
|
|
252
|
+
authorities.storagePolicy,
|
|
253
|
+
"resolve",
|
|
254
|
+
"storage policy",
|
|
255
|
+
),
|
|
256
|
+
attestationSigner: captureAuthority(
|
|
257
|
+
authorities.attestationSigner,
|
|
258
|
+
"sign",
|
|
259
|
+
"attestation signer",
|
|
260
|
+
),
|
|
261
|
+
attestationVerifier: captureAuthority(
|
|
262
|
+
authorities.attestationVerifier,
|
|
263
|
+
"verify",
|
|
264
|
+
"attestation verifier",
|
|
265
|
+
),
|
|
266
|
+
});
|
|
267
|
+
capture(authorities.ledger?.signer, "sign", "ledger signer");
|
|
268
|
+
capture(authorities.ledger?.verifier, "verify", "ledger verifier");
|
|
269
|
+
capture(authorities.witness?.signer, "sign", "witness signer");
|
|
270
|
+
capture(authorities.witness?.verifier, "verify", "witness verifier");
|
|
271
|
+
assertIndependentSigningAuthorities(authorities.ledger, authorities.witness);
|
|
272
|
+
const storage = layout(stateRootDir, tenantId, runId);
|
|
273
|
+
const artifactPorts = new EvolutionArtifactPorts({
|
|
274
|
+
tenantId,
|
|
275
|
+
audience,
|
|
276
|
+
artifactStore: new ArtifactStore({
|
|
277
|
+
dir: storage.artifactDir,
|
|
278
|
+
now: clock,
|
|
279
|
+
}),
|
|
280
|
+
envelopeSigner: ports.artifactEnvelopeSigner,
|
|
281
|
+
envelopeVerifier: ports.artifactEnvelopeVerifier,
|
|
282
|
+
currentAuthorityResolver: ports.artifactCurrentAuthorityResolver,
|
|
283
|
+
now: clock,
|
|
284
|
+
});
|
|
285
|
+
const rawStore = new ArtifactStoreEncryptedRawStore({
|
|
286
|
+
tenantId,
|
|
287
|
+
artifactStore: new ArtifactStore({
|
|
288
|
+
dir: storage.rawDir,
|
|
289
|
+
now: clock,
|
|
290
|
+
}),
|
|
291
|
+
encryptor: ports.rawEncryptor,
|
|
292
|
+
});
|
|
293
|
+
const projector = new EvolutionEvidenceProjector({
|
|
294
|
+
sourceVerifier: ports.sourceVerifier,
|
|
295
|
+
keyedCommitter: ports.keyedCommitter,
|
|
296
|
+
storagePolicy: ports.storagePolicy,
|
|
297
|
+
rawStore,
|
|
298
|
+
attestationSigner: ports.attestationSigner,
|
|
299
|
+
attestationVerifier: ports.attestationVerifier,
|
|
300
|
+
idGenerator: evidenceIdGenerator,
|
|
301
|
+
now: () => new Date(clock()),
|
|
302
|
+
});
|
|
303
|
+
const bundleVerifier = new EvolutionEvidenceBundleVerifier({
|
|
304
|
+
attestationVerifier: ports.attestationVerifier,
|
|
305
|
+
now: () => new Date(clock()),
|
|
306
|
+
});
|
|
307
|
+
const evidenceAdapter = new EvolutionEvidenceArtifactAdapter({
|
|
308
|
+
tenantId,
|
|
309
|
+
audience,
|
|
310
|
+
projector,
|
|
311
|
+
bundleVerifier,
|
|
312
|
+
artifactPorts,
|
|
313
|
+
...(evidenceTtlMs === undefined ? {} : { ttlMs: evidenceTtlMs }),
|
|
314
|
+
});
|
|
315
|
+
const ledgerArtifactResolver =
|
|
316
|
+
artifactPorts.createEvolutionLedgerArtifactResolver({
|
|
317
|
+
purpose: "evolution-ledger",
|
|
318
|
+
});
|
|
319
|
+
const backend = createEvolutionLedgerFileBackend({
|
|
320
|
+
rootDir: storage.ledgerRootDir,
|
|
321
|
+
authorityRootDir: storage.ledgerAuthorityRootDir,
|
|
322
|
+
witnessFilePath: storage.witnessFilePath,
|
|
323
|
+
witnessId,
|
|
324
|
+
ledgerAuthority: authorities.ledger,
|
|
325
|
+
witnessAuthority: authorities.witness,
|
|
326
|
+
artifactResolver: ledgerArtifactResolver,
|
|
327
|
+
secure,
|
|
328
|
+
clock,
|
|
329
|
+
...(fsImpl === undefined ? {} : { fsImpl }),
|
|
330
|
+
...(lock === undefined ? {} : { lock }),
|
|
331
|
+
...(random === undefined ? {} : { random }),
|
|
332
|
+
...(lockTimeoutMs === undefined ? {} : { lockTimeoutMs }),
|
|
333
|
+
...(witnessMaximumBytes === undefined ? {} : { witnessMaximumBytes }),
|
|
334
|
+
});
|
|
335
|
+
captureEvolutionLedgerFileBackend(backend);
|
|
336
|
+
const runAdapter = new EvolutionRunLedgerAdapter({
|
|
337
|
+
descriptor: {
|
|
338
|
+
tenantId,
|
|
339
|
+
artifactTenantId: tenantId,
|
|
340
|
+
runId,
|
|
341
|
+
audience,
|
|
342
|
+
purpose: "evolution-ledger",
|
|
343
|
+
},
|
|
344
|
+
artifactPorts,
|
|
345
|
+
ledger: backend.ledger,
|
|
346
|
+
ledgerArtifactResolver,
|
|
347
|
+
now: clock,
|
|
348
|
+
});
|
|
349
|
+
const evolutionIngress = createAgentEvolutionIngress({
|
|
350
|
+
evidenceAdapter,
|
|
351
|
+
runAdapter,
|
|
352
|
+
sourceEnvelopeAuthority: ports.sourceEnvelope,
|
|
353
|
+
wikiMaintenanceProducer,
|
|
354
|
+
...(completionTriggerKind === undefined ? {} : { completionTriggerKind }),
|
|
355
|
+
now: () => new Date(clock()),
|
|
356
|
+
idGenerator: ingressIdGenerator,
|
|
357
|
+
});
|
|
358
|
+
captureAgentEvolutionIngress(evolutionIngress, { tenantId });
|
|
359
|
+
|
|
360
|
+
const composition = sealAgentEvolutionRuntimeComposition({
|
|
361
|
+
tenantId,
|
|
362
|
+
runId,
|
|
363
|
+
evolutionIngress,
|
|
364
|
+
loadRun: Object.freeze(() => runAdapter.load()),
|
|
365
|
+
ledgerDescriptor: backend.descriptor,
|
|
366
|
+
storage,
|
|
367
|
+
});
|
|
368
|
+
return composition;
|
|
369
|
+
}
|