chainlesschain 0.162.148 → 0.162.150
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 +1 -1
- package/package.json +1 -1
- package/src/assets/web-panel/.build-hash +1 -1
- package/src/assets/web-panel/assets/{AIOps-DwpCCp64.js → AIOps-CBLvrjeG.js} +1 -1
- package/src/assets/web-panel/assets/{ActionButton-C9pBYocA.js → ActionButton-DYv2GtE0.js} +1 -1
- package/src/assets/web-panel/assets/{Analytics-BWAkeXxK.js → Analytics-CL6PZ-Ww.js} +3 -3
- package/src/assets/web-panel/assets/{AppLayout-CivFGH6B.js → AppLayout-xuyHt4uA.js} +3 -3
- package/src/assets/web-panel/assets/{Audit-Cm8hRpZm.js → Audit-DOvSVycq.js} +1 -1
- package/src/assets/web-panel/assets/{Backup-DXdFMsE8.js → Backup-DMhfTswr.js} +1 -1
- package/src/assets/web-panel/assets/{BaseInput-uAwSTeql.js → BaseInput-CQxDdm63.js} +1 -1
- package/src/assets/web-panel/assets/{Chat-KU8eeJJE.js → Chat-BEeNhK2a.js} +5 -5
- package/src/assets/web-panel/assets/ChatBubbleRenderer-8nul8eTq.js +1 -0
- package/src/assets/web-panel/assets/{Checkbox-C6AMDkjd.js → Checkbox-CL04O-ER.js} +1 -1
- package/src/assets/web-panel/assets/{Codegen-t2moDxcO.js → Codegen-C50o-n7x.js} +1 -1
- package/src/assets/web-panel/assets/{Col-DCcsRRhN.js → Col-CH-bDkzs.js} +1 -1
- package/src/assets/web-panel/assets/{Community-DtB-8SAC.js → Community-DqAIMvSe.js} +1 -1
- package/src/assets/web-panel/assets/{Compact-CZm8THYA.js → Compact-C43fo_my.js} +1 -1
- package/src/assets/web-panel/assets/{Compliance-LiQgC7g1.js → Compliance-BERnMrdP.js} +1 -1
- package/src/assets/web-panel/assets/{Cowork-CA8SAxht.js → Cowork-Baw3w1gp.js} +4 -4
- package/src/assets/web-panel/assets/{Cron-CtRaF1wD.js → Cron-BEqAHF1-.js} +2 -2
- package/src/assets/web-panel/assets/{Crosschain-6-br6Hub.js → Crosschain-CvnmKwK4.js} +1 -1
- package/src/assets/web-panel/assets/{DID-Do2EccrL.js → DID-iMPxgVdt.js} +2 -2
- package/src/assets/web-panel/assets/{Dashboard-wrXcbzGe.js → Dashboard--4SJX3YR.js} +2 -2
- package/src/assets/web-panel/assets/{Dropdown-p3FsT245.js → Dropdown-BgLV6xgz.js} +1 -1
- package/src/assets/web-panel/assets/{EmailListRenderer-D95A2L8q.js → EmailListRenderer-Bvb8oUD8.js} +1 -1
- package/src/assets/web-panel/assets/{FamilyGuardDashboard-cLuJW2zo.js → FamilyGuardDashboard-DpXPjJB5.js} +1 -1
- package/src/assets/web-panel/assets/{Federation-Brgq_cbN.js → Federation-BbFfJ1Xi.js} +1 -1
- package/src/assets/web-panel/assets/{FormItemContext-DWLCkNgh.js → FormItemContext-DeGq1B-q.js} +1 -1
- package/src/assets/web-panel/assets/{GenericCardRenderer-BBqUfQd6.js → GenericCardRenderer-CNW7s9zM.js} +1 -1
- package/src/assets/web-panel/assets/{Git-8F090w4I.js → Git-L1PjW-lT.js} +2 -2
- package/src/assets/web-panel/assets/{Governance-CCogEbxb.js → Governance-PK-X58to.js} +1 -1
- package/src/assets/web-panel/assets/{Inference-CfLD7v7C.js → Inference-BePWEH-d.js} +1 -1
- package/src/assets/web-panel/assets/{KnowledgeGraph-DDuHJewd.js → KnowledgeGraph-LF_sBvdL.js} +1 -1
- package/src/assets/web-panel/assets/{Logs-CE8KSEVC.js → Logs-BKkfk9hy.js} +2 -2
- package/src/assets/web-panel/assets/{Marketplace-DmwpZmhT.js → Marketplace-BNMqUDla.js} +1 -1
- package/src/assets/web-panel/assets/{McpTools-Bf7AazU8.js → McpTools-w4WPiyz2.js} +5 -5
- package/src/assets/web-panel/assets/{Memory-D0QU_00S.js → Memory-DUKMVGNi.js} +2 -2
- package/src/assets/web-panel/assets/{MobileBridge-yXS9xdhx.js → MobileBridge-BWhiEyTJ.js} +1 -1
- package/src/assets/web-panel/assets/{MobileProjects-BuDUoGUP.js → MobileProjects-Ocf5JEkX.js} +1 -1
- package/src/assets/web-panel/assets/{Mtc-BYyHy28p.js → Mtc-D2B6MMhU.js} +4 -4
- package/src/assets/web-panel/assets/{MtcAudit-CK0aqpiZ.js → MtcAudit-DdYjCq1O.js} +4 -4
- package/src/assets/web-panel/assets/{Multisig-mNimKYeb.js → Multisig-Cb1hfuUZ.js} +3 -3
- package/src/assets/web-panel/assets/{NLProgramming-AioAJ0YA.js → NLProgramming-CTeImGp7.js} +1 -1
- package/src/assets/web-panel/assets/{Notes-CVVNCLHE.js → Notes-BjYNc7eQ.js} +4 -4
- package/src/assets/web-panel/assets/{NotificationSettings-C4ABj-TK.js → NotificationSettings-Dn_NtRXQ.js} +1 -1
- package/src/assets/web-panel/assets/{OrderTableRenderer-DIp8Xcbd.js → OrderTableRenderer-DVYYIizh.js} +1 -1
- package/src/assets/web-panel/assets/{Organization-uozl_gWK.js → Organization-Be2Kmr5j.js} +4 -4
- package/src/assets/web-panel/assets/{Overflow-BCZOM2hK.js → Overflow-Cu_-qRlR.js} +1 -1
- package/src/assets/web-panel/assets/{P2P-CArcaiaj.js → P2P-DD2HoGzE.js} +2 -2
- package/src/assets/web-panel/assets/{PdhVaultBrowser-Sgq2Srr8.js → PdhVaultBrowser-BRI7DVth.js} +3 -3
- package/src/assets/web-panel/assets/{Permissions-BYrQrXnH.js → Permissions-C9Srcs2M.js} +4 -4
- package/src/assets/web-panel/assets/{PersonalDataHub-BzHStAbz.js → PersonalDataHub-CUqcMgo1.js} +3 -3
- package/src/assets/web-panel/assets/{Pipeline-k7KqxX1M.js → Pipeline-HBrQGLXt.js} +1 -1
- package/src/assets/web-panel/assets/{Privacy-IumTUWqx.js → Privacy-D-B0vjwh.js} +1 -1
- package/src/assets/web-panel/assets/{ProjectInit-BRyImYTf.js → ProjectInit-eTeLIu9e.js} +2 -2
- package/src/assets/web-panel/assets/{ProjectSettings-BFIqTBFk.js → ProjectSettings-DrRqCsC6.js} +2 -2
- package/src/assets/web-panel/assets/{Projects-Dpid9CDg.js → Projects-1G9DNOhI.js} +1 -1
- package/src/assets/web-panel/assets/{Providers-CyyFnUPs.js → Providers-RkTZzpxP.js} +1 -1
- package/src/assets/web-panel/assets/{QrScannerModal-C82cRx-X.js → QrScannerModal-BSCUgsgC.js} +1 -1
- package/src/assets/web-panel/assets/{QuickAsk-DGxDF521.js → QuickAsk-CHgyM3Bz.js} +1 -1
- package/src/assets/web-panel/assets/{Recommend-Cns-Am1y.js → Recommend-0lry4OZq.js} +1 -1
- package/src/assets/web-panel/assets/{RemoteSession-R7OqAIlg.js → RemoteSession-Cn45UroZ.js} +2 -2
- package/src/assets/web-panel/assets/{Reputation-D7mgPIYV.js → Reputation-Q-Zjb707.js} +1 -1
- package/src/assets/web-panel/assets/{Row-B3lEURyd.js → Row-BdM70oda.js} +1 -1
- package/src/assets/web-panel/assets/{RssFeed-9_UVrpBt.js → RssFeed-DmOAKKap.js} +2 -2
- package/src/assets/web-panel/assets/{Search-ClZeO80q.js → Search-Dwavbm07.js} +1 -1
- package/src/assets/web-panel/assets/{Security-BNNJczEp.js → Security-DukXFCnk.js} +3 -3
- package/src/assets/web-panel/assets/{Services-C5SjrWUj.js → Services-BIlRnITu.js} +2 -2
- package/src/assets/web-panel/assets/{Skeleton-Ci_obQ-g.js → Skeleton-YYVQdhhQ.js} +1 -1
- package/src/assets/web-panel/assets/{Skills-DdebN15P.js → Skills-B8_iYHz2.js} +1 -1
- package/src/assets/web-panel/assets/{Sla-OinZP2vi.js → Sla-BdVrhT31.js} +1 -1
- package/src/assets/web-panel/assets/{SpeechSettings-CxzbNF51.js → SpeechSettings-CD3ggRx7.js} +1 -1
- package/src/assets/web-panel/assets/{SyncSettings-D06N_66b.js → SyncSettings-Bp02VZFH.js} +2 -2
- package/src/assets/web-panel/assets/{Tasks-BdEdW0AZ.js → Tasks-DEVmCEsr.js} +1 -1
- package/src/assets/web-panel/assets/{Templates-F1ctKmPa.js → Templates-B6czWc4N.js} +1 -1
- package/src/assets/web-panel/assets/{Tenant-CVz1Urot.js → Tenant-BCJLv17r.js} +1 -1
- package/src/assets/web-panel/assets/Terminal-CD132d2Y.js +3 -0
- package/src/assets/web-panel/assets/{TimelineRenderer-Doitzjmf.js → TimelineRenderer-ZB-CvkZl.js} +1 -1
- package/src/assets/web-panel/assets/{Tokens-BpyVRpVA.js → Tokens-BnSY0S-s.js} +1 -1
- package/src/assets/web-panel/assets/{Trigger-nWhWYTbU.js → Trigger-VZw9Oy2w.js} +1 -1
- package/src/assets/web-panel/assets/{Trust-DK_G-wLx.js → Trust-pZq7Hjd2.js} +1 -1
- package/src/assets/web-panel/assets/{UkeySign-B5yBUojO.js → UkeySign-DnQaqk4q.js} +1 -1
- package/src/assets/web-panel/assets/{VideoEditing-C5D51qAe.js → VideoEditing-BEUfmvJV.js} +1 -1
- package/src/assets/web-panel/assets/{Wallet-CLbL9K7v.js → Wallet-CoZKMXJ2.js} +4 -4
- package/src/assets/web-panel/assets/{WebAuthn-DZUelI3V.js → WebAuthn-CBOGVx1I.js} +5 -5
- package/src/assets/web-panel/assets/{WorkflowEditor-8RPxt4KW.js → WorkflowEditor-huSKn7TT.js} +1 -1
- package/src/assets/web-panel/assets/{chat-4N4tOA3d.js → chat-A_3w6FBO.js} +1 -1
- package/src/assets/web-panel/assets/{colors-zbbGVrua.js → colors-D1Bem9Oy.js} +1 -1
- package/src/assets/web-panel/assets/{compact-item-D7iMkbnE.js → compact-item-CJYJj0oO.js} +1 -1
- package/src/assets/web-panel/assets/{createContext-CBzPJv-w.js → createContext-BkbFiKT4.js} +1 -1
- package/src/assets/web-panel/assets/devWarning-WDr3_M_N.js +1 -0
- package/src/assets/web-panel/assets/{hasIn-bHdrQSqZ.js → hasIn-CKvUafVY.js} +1 -1
- package/src/assets/web-panel/assets/{index-DbE5D0WL.js → index-AjrSPnvv.js} +1 -1
- package/src/assets/web-panel/assets/{index-BCr0geV9.js → index-B8i0lViZ.js} +1 -1
- package/src/assets/web-panel/assets/{index-CiG1IZao.js → index-B9Svn0zc.js} +1 -1
- package/src/assets/web-panel/assets/{index-B1s0Bz9O.js → index-BHdHSX06.js} +1 -1
- package/src/assets/web-panel/assets/{index-QFObYeo1.js → index-BHdailyo.js} +1 -1
- package/src/assets/web-panel/assets/{index-BnBOpqv3.js → index-BJwlEnYo.js} +1 -1
- package/src/assets/web-panel/assets/{index-CdmMoYN1.js → index-BOoAQjJz.js} +1 -1
- package/src/assets/web-panel/assets/{index-DUyjUkY7.js → index-BSgWxAOG.js} +1 -1
- package/src/assets/web-panel/assets/{index-CqdPyWm5.js → index-BdutMsne.js} +1 -1
- package/src/assets/web-panel/assets/{index-DmqlJed-.js → index-BiDWxzbn.js} +1 -1
- package/src/assets/web-panel/assets/{index-S74FpAIn.js → index-By5a0T_W.js} +1 -1
- package/src/assets/web-panel/assets/{index-kmh1TxRa.js → index-C-WIY-FQ.js} +1 -1
- package/src/assets/web-panel/assets/{index-BTIjjXry.js → index-C37f6iey.js} +1 -1
- package/src/assets/web-panel/assets/{index-BS4_Mwk6.js → index-C9bWmTcO.js} +1 -1
- package/src/assets/web-panel/assets/{index-BBNr77E1.js → index-CBaosWRO.js} +1 -1
- package/src/assets/web-panel/assets/{index-QNAG4JtR.js → index-CBlBVJ_m.js} +1 -1
- package/src/assets/web-panel/assets/{index-Bqmx24kh.js → index-CD62EEGo.js} +1 -1
- package/src/assets/web-panel/assets/{index-CQfu1U78.js → index-CUj-l7GM.js} +1 -1
- package/src/assets/web-panel/assets/{index-BJ4ZGyW0.js → index-CVS8Ymuq.js} +1 -1
- package/src/assets/web-panel/assets/{index-Ci009ijp.js → index-ChkXUj3f.js} +1 -1
- package/src/assets/web-panel/assets/{index-oDKNgCsP.js → index-Cj0OZ-37.js} +1 -1
- package/src/assets/web-panel/assets/{index-BZb8F8YG.js → index-Co3OFL0t.js} +1 -1
- package/src/assets/web-panel/assets/{index-308gCGh7.js → index-Crp8CbRg.js} +1 -1
- package/src/assets/web-panel/assets/{index-CPxkoKgA.js → index-D22zNXiS.js} +1 -1
- package/src/assets/web-panel/assets/{index-xYCm6W2h.js → index-DTs_D1OL.js} +1 -1
- package/src/assets/web-panel/assets/{index-BtbbdLnf.js → index-DfgCdFrN.js} +3 -3
- package/src/assets/web-panel/assets/{index-BsKehmmS.js → index-DjYrecNb.js} +1 -1
- package/src/assets/web-panel/assets/{index-CkxK86vf.js → index-DpW9cf3e.js} +1 -1
- package/src/assets/web-panel/assets/index-Dwix3p4g.js +1 -0
- package/src/assets/web-panel/assets/{index-CvRMA9uT.js → index-F--HuPG1.js} +1 -1
- package/src/assets/web-panel/assets/{index-DE9j5YgT.js → index-Fuk6t_3K.js} +1 -1
- package/src/assets/web-panel/assets/{index-B7b1hGry.js → index-JEAGMii9.js} +1 -1
- package/src/assets/web-panel/assets/{index-D1YDh7Wr.js → index-PF-mpv8K.js} +1 -1
- package/src/assets/web-panel/assets/index-SHaoZ0CA.js +1 -0
- package/src/assets/web-panel/assets/{index-CQ6NcfWz.js → index-b-sbVdjQ.js} +1 -1
- package/src/assets/web-panel/assets/{index-DyoNgbXl.js → index-pyvMVX8r.js} +1 -1
- package/src/assets/web-panel/assets/{index-DISWAYce.js → index-qNTtOVi_.js} +1 -1
- package/src/assets/web-panel/assets/{index-D4XKpj6c.js → index-tgO8iza6.js} +1 -1
- package/src/assets/web-panel/assets/{index-CahryTX0.js → index-ttDQVhZy.js} +1 -1
- package/src/assets/web-panel/assets/{initDefaultProps-BD55yNBt.js → initDefaultProps-DtrnfsZH.js} +1 -1
- package/src/assets/web-panel/assets/{motion-B5Bbe77U.js → motion-D4zqSaX3.js} +1 -1
- package/src/assets/web-panel/assets/{move-CTvIqHEH.js → move-CGFGOUQj.js} +1 -1
- package/src/assets/web-panel/assets/{mtc-parser-BkNyPQKB.js → mtc-parser-DH2HvkJl.js} +1 -1
- package/src/assets/web-panel/assets/{omit-BaXJXgHA.js → omit-jJ2at5HX.js} +1 -1
- package/src/assets/web-panel/assets/{pickAttrs-Bw6-YTxH.js → pickAttrs-CRyMT1Fv.js} +1 -1
- package/src/assets/web-panel/assets/{placementArrow-BLdbkLqJ.js → placementArrow-DZ_CX0Pt.js} +1 -1
- package/src/assets/web-panel/assets/{responsiveObserve-IVYkzntU.js → responsiveObserve-wruHk-h5.js} +1 -1
- package/src/assets/web-panel/assets/{slide-DFMFwwtY.js → slide-BGgx8q67.js} +1 -1
- package/src/assets/web-panel/assets/{statusUtils-CURYRtZ1.js → statusUtils-Do5M7gKm.js} +1 -1
- package/src/assets/web-panel/assets/{styleChecker-Cfz63s1r.js → styleChecker-CRa-GZpX.js} +1 -1
- package/src/assets/web-panel/assets/{useFlexGapSupport-COJL0KE3.js → useFlexGapSupport-BxPcq6pj.js} +1 -1
- package/src/assets/web-panel/assets/{useFs-YLLojQQf.js → useFs-v5O2ZcJm.js} +1 -1
- package/src/assets/web-panel/assets/{usePersonalDataHub-BF_21qUC.js → usePersonalDataHub--z2FU0Px.js} +1 -1
- package/src/assets/web-panel/assets/{vnode-9ZpkA7bb.js → vnode-1emidVKd.js} +1 -1
- package/src/assets/web-panel/assets/{zoom-DhtAfhl8.js → zoom-CcJaRyHs.js} +1 -1
- package/src/assets/web-panel/index.html +1 -1
- package/src/assets/web-panel/remote-session-sw.js +43 -0
- package/src/command-manifest.json +22 -1
- package/src/commands/a2a.js +19 -4
- package/src/commands/activitypub.js +20 -3
- package/src/commands/agent.js +71 -10
- package/src/commands/audit.js +40 -24
- package/src/commands/codeintel.js +320 -0
- package/src/commands/collab.js +15 -2
- package/src/commands/compliance.js +5 -0
- package/src/commands/config.js +4 -1
- package/src/commands/dao.js +86 -14
- package/src/commands/dev.js +2 -0
- package/src/commands/did.js +7 -1
- package/src/commands/dlp.js +23 -1
- package/src/commands/economy.js +29 -3
- package/src/commands/eval.js +255 -0
- package/src/commands/evomap.js +26 -0
- package/src/commands/governance.js +17 -3
- package/src/commands/hardening.js +18 -0
- package/src/commands/incentive.js +5 -0
- package/src/commands/init.js +46 -2
- package/src/commands/kg.js +4 -0
- package/src/commands/loop.js +6 -1
- package/src/commands/lowcode.js +15 -2
- package/src/commands/marketplace.js +40 -6
- package/src/commands/matrix.js +20 -1
- package/src/commands/memory.js +4 -1
- package/src/commands/mtc.js +7 -1
- package/src/commands/nostr.js +31 -4
- package/src/commands/note.js +7 -4
- package/src/commands/plugin.js +474 -0
- package/src/commands/pqc.js +5 -0
- package/src/commands/reputation.js +10 -1
- package/src/commands/scim.js +6 -0
- package/src/commands/session.js +32 -10
- package/src/commands/siem.js +11 -0
- package/src/commands/sla.js +18 -3
- package/src/commands/social.js +38 -5
- package/src/commands/sso.js +10 -2
- package/src/commands/stress.js +23 -4
- package/src/commands/team.js +463 -0
- package/src/commands/tech.js +2 -0
- package/src/commands/tenant.js +10 -1
- package/src/commands/terraform.js +6 -0
- package/src/commands/update.js +1 -1
- package/src/commands/zkp.js +20 -0
- package/src/gateways/ws/message-dispatcher.js +48 -2
- package/src/gateways/ws/remote-session-protocol.js +140 -42
- package/src/gateways/ws/ws-server.js +1 -1
- package/src/harness/jsonl-session-store.js +12 -5
- package/src/harness/plugin-manager.js +16 -4
- package/src/harness/prompt-compressor.js +27 -1
- package/src/harness/remote-command-ledger.js +189 -0
- package/src/harness/remote-session-push-apns.js +246 -0
- package/src/harness/remote-session-push-errors.js +15 -0
- package/src/harness/remote-session-push-fcm.js +9 -25
- package/src/harness/remote-session-push-huawei.js +174 -0
- package/src/harness/remote-session-push-oppo.js +171 -0
- package/src/harness/remote-session-push-senders.js +42 -0
- package/src/harness/remote-session-push-vivo.js +179 -0
- package/src/harness/remote-session-push-web.js +299 -0
- package/src/harness/remote-session-push-xiaomi.js +99 -0
- package/src/harness/worktree-isolator.js +16 -6
- package/src/index.js +6 -0
- package/src/lib/__tests__/logger.test.js +5 -2
- package/src/lib/a2a-protocol.js +25 -1
- package/src/lib/activitypub-bridge.js +61 -0
- package/src/lib/agent-core.js +4 -0
- package/src/lib/agent-economy.js +262 -29
- package/src/lib/agent-network.js +7 -1
- package/src/lib/agent-sandbox.js +161 -5
- package/src/lib/agent-team/task-lease.js +434 -0
- package/src/lib/agent-team/team-budget.js +165 -0
- package/src/lib/agent-team/team-mailbox.js +106 -0
- package/src/lib/agent-team/team-runner.js +282 -0
- package/src/lib/agent-team/team-worktree.js +236 -0
- package/src/lib/agents.js +18 -0
- package/src/lib/async-hook-supervisor.cjs +391 -0
- package/src/lib/audit-logger.js +7 -6
- package/src/lib/autonomous-developer.js +60 -0
- package/src/lib/chat-core.js +17 -4
- package/src/lib/collaboration-governance.js +56 -0
- package/src/lib/community-governance.js +68 -0
- package/src/lib/compliance-manager.js +63 -0
- package/src/lib/cross-chain.js +5 -0
- package/src/lib/dao-governance.js +151 -2
- package/src/lib/did-manager.js +23 -10
- package/src/lib/dlp-engine.js +70 -0
- package/src/lib/eval/runner.js +251 -0
- package/src/lib/eval/tasks.js +626 -0
- package/src/lib/eval/trend.js +200 -0
- package/src/lib/evolution-system.js +92 -0
- package/src/lib/evomap-federation.js +55 -0
- package/src/lib/evomap-governance.js +94 -0
- package/src/lib/fatal-handler.js +17 -1
- package/src/lib/hardening-manager.js +73 -0
- package/src/lib/hierarchical-memory.js +14 -8
- package/src/lib/knowledge-exporter.js +8 -2
- package/src/lib/knowledge-graph.js +79 -0
- package/src/lib/llm-providers.js +23 -14
- package/src/lib/logger.js +4 -1
- package/src/lib/lsp/__tests__/benchmark.test.js +88 -0
- package/src/lib/lsp/__tests__/code-intelligence.integration.test.js +129 -0
- package/src/lib/lsp/__tests__/code-intelligence.test.js +228 -0
- package/src/lib/lsp/__tests__/jsonrpc-stream.test.js +104 -0
- package/src/lib/lsp/__tests__/lsp-client.test.js +269 -0
- package/src/lib/lsp/__tests__/lsp-manager.test.js +333 -0
- package/src/lib/lsp/__tests__/lsp-server-registry.test.js +128 -0
- package/src/lib/lsp/benchmark.js +257 -0
- package/src/lib/lsp/code-intelligence.js +356 -0
- package/src/lib/lsp/jsonrpc-stream.js +139 -0
- package/src/lib/lsp/lsp-client.js +339 -0
- package/src/lib/lsp/lsp-manager.js +375 -0
- package/src/lib/lsp/lsp-server-registry.js +196 -0
- package/src/lib/matrix-bridge.js +84 -0
- package/src/lib/memory-manager.js +5 -3
- package/src/lib/nostr-bridge.js +53 -0
- package/src/lib/permission-engine.js +22 -4
- package/src/lib/plugin-monitor-supervisor.js +238 -0
- package/src/lib/plugin-runtime/__tests__/remote-source.test.js +256 -0
- package/src/lib/plugin-runtime/agents.js +51 -0
- package/src/lib/plugin-runtime/bin.js +100 -0
- package/src/lib/plugin-runtime/hooks.js +100 -0
- package/src/lib/plugin-runtime/install.js +396 -0
- package/src/lib/plugin-runtime/lsp.js +75 -0
- package/src/lib/plugin-runtime/manifest.js +458 -0
- package/src/lib/plugin-runtime/mcp.js +89 -0
- package/src/lib/plugin-runtime/monitors.js +100 -0
- package/src/lib/plugin-runtime/policy.js +152 -0
- package/src/lib/plugin-runtime/reload.js +79 -0
- package/src/lib/plugin-runtime/remote-source.js +240 -0
- package/src/lib/plugin-runtime/scopes.js +197 -0
- package/src/lib/plugin-runtime/settings.js +119 -0
- package/src/lib/plugin-runtime/signature.js +107 -0
- package/src/lib/plugin-runtime/skills.js +43 -0
- package/src/lib/plugin-runtime/trust.js +140 -0
- package/src/lib/pqc-manager.js +64 -0
- package/src/lib/reputation-optimizer.js +101 -0
- package/src/lib/sandbox-egress-proxy.js +262 -0
- package/src/lib/sandbox-fs-policy.js +112 -0
- package/src/lib/sandbox-network-policy.js +151 -0
- package/src/lib/sandbox-v2.js +24 -18
- package/src/lib/scim-manager.js +36 -0
- package/src/lib/session-manager.js +5 -2
- package/src/lib/settings-hook-events.cjs +78 -6
- package/src/lib/settings-hooks.cjs +30 -3
- package/src/lib/settings-loader.cjs +35 -1
- package/src/lib/siem-exporter.js +45 -0
- package/src/lib/skill-loader.js +38 -2
- package/src/lib/skill-marketplace.js +83 -0
- package/src/lib/sla-manager.js +88 -0
- package/src/lib/social-manager.js +74 -0
- package/src/lib/stress-tester.js +65 -0
- package/src/lib/tech-learning-engine.js +75 -0
- package/src/lib/telemetry/span-recorder.js +237 -0
- package/src/lib/tenant-saas.js +107 -0
- package/src/lib/terraform-manager.js +67 -0
- package/src/lib/token-incentive.js +180 -29
- package/src/lib/wallet-manager.js +81 -35
- package/src/lib/zkp-engine.js +87 -0
- package/src/repl/agent-repl.js +417 -6
- package/src/runtime/__tests__/auto-pin.test.js +104 -0
- package/src/runtime/agent-core.js +771 -104
- package/src/runtime/auto-pin.js +117 -0
- package/src/runtime/coding-agent-contract-shared.cjs +82 -8
- package/src/runtime/coding-agent-policy.cjs +32 -7
- package/src/runtime/fallback-model.js +134 -7
- package/src/runtime/headless-runner.js +388 -108
- package/src/runtime/mcp-config.js +46 -0
- package/src/assets/web-panel/assets/ChatBubbleRenderer-DCNfbdlx.js +0 -1
- package/src/assets/web-panel/assets/Terminal-BvAK_Zel.js +0 -3
- package/src/assets/web-panel/assets/devWarning-C2Z5LRgq.js +0 -1
- package/src/assets/web-panel/assets/index-BGp6Yr-Y.js +0 -1
- package/src/assets/web-panel/assets/index-BXiw9dQf.js +0 -1
|
@@ -0,0 +1,200 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Eval trend analysis (Phase 7) — turn a history of `cc eval` runs into a
|
|
3
|
+
* release-gate signal: is the task-success rate trending down, and did any task
|
|
4
|
+
* that used to pass start failing (a regression)?
|
|
5
|
+
*
|
|
6
|
+
* The eval RUNS themselves need a real model (a dry-run is always 0%), but the
|
|
7
|
+
* REPORTING is pure: given the recorded per-run summaries (pass-rate + which
|
|
8
|
+
* tasks passed), computing the delta, per-task regressions, and the gate verdict
|
|
9
|
+
* is deterministic and unit-testable with fixtures — which is what a release
|
|
10
|
+
* pipeline actually wires up. This module is that consumer.
|
|
11
|
+
*
|
|
12
|
+
* A run record is the JSON `cc eval --json` emits, optionally tagged with
|
|
13
|
+
* `ranAt` / `label` (version or commit). `perTask` is derived from `results`.
|
|
14
|
+
*/
|
|
15
|
+
|
|
16
|
+
/** Normalize one `cc eval` summary into a compact trend record. */
|
|
17
|
+
export function summarizeRun(record, { ranAt = null, label = null } = {}) {
|
|
18
|
+
const results = Array.isArray(record?.results) ? record.results : [];
|
|
19
|
+
let perTask = {};
|
|
20
|
+
for (const r of results) {
|
|
21
|
+
if (r && r.id != null) perTask[r.id] = r.pass === true;
|
|
22
|
+
}
|
|
23
|
+
// Idempotency: an already-summarized record carries `perTask` but NO
|
|
24
|
+
// `results` (that's exactly this function's own output shape). computeTrend
|
|
25
|
+
// documents "already-summarized" records as valid input and re-runs every
|
|
26
|
+
// record through summarizeRun — so if we always rebuilt perTask from
|
|
27
|
+
// `results` alone, a summarized record would come back with an EMPTY perTask,
|
|
28
|
+
// silently erasing every per-task regression/fix/drop and making the release
|
|
29
|
+
// gate report "no regression" when there was one. Preserve the record's own
|
|
30
|
+
// perTask when it has no results to derive from.
|
|
31
|
+
if (
|
|
32
|
+
results.length === 0 &&
|
|
33
|
+
record?.perTask &&
|
|
34
|
+
typeof record.perTask === "object"
|
|
35
|
+
) {
|
|
36
|
+
perTask = { ...record.perTask };
|
|
37
|
+
}
|
|
38
|
+
const total = Number.isFinite(record?.total) ? record.total : results.length;
|
|
39
|
+
const passed = Number.isFinite(record?.passed)
|
|
40
|
+
? record.passed
|
|
41
|
+
: results.filter((r) => r && r.pass === true).length;
|
|
42
|
+
const passRate = Number.isFinite(record?.passRate)
|
|
43
|
+
? record.passRate
|
|
44
|
+
: total > 0
|
|
45
|
+
? passed / total
|
|
46
|
+
: 0;
|
|
47
|
+
return {
|
|
48
|
+
ranAt: record?.ranAt ?? ranAt,
|
|
49
|
+
label: record?.label ?? label,
|
|
50
|
+
passed,
|
|
51
|
+
total,
|
|
52
|
+
passRate,
|
|
53
|
+
perTask,
|
|
54
|
+
};
|
|
55
|
+
}
|
|
56
|
+
|
|
57
|
+
/** Stable chronological order: by `ranAt` when present, else preserve input order. */
|
|
58
|
+
function ordered(records) {
|
|
59
|
+
const withIdx = records.map((r, i) => ({ r, i }));
|
|
60
|
+
withIdx.sort((a, b) => {
|
|
61
|
+
const ax = a.r.ranAt,
|
|
62
|
+
bx = b.r.ranAt;
|
|
63
|
+
if (ax != null && bx != null && ax !== bx) return ax < bx ? -1 : 1;
|
|
64
|
+
if (ax != null && bx == null) return 1; // timestamped runs sort after untimestamped
|
|
65
|
+
if (ax == null && bx != null) return -1;
|
|
66
|
+
return a.i - b.i; // stable fallback
|
|
67
|
+
});
|
|
68
|
+
return withIdx.map((x) => x.r);
|
|
69
|
+
}
|
|
70
|
+
|
|
71
|
+
/**
|
|
72
|
+
* Compare the latest run against the previous one and report the trend.
|
|
73
|
+
*
|
|
74
|
+
* @param {object[]} runs array of run records (raw `cc eval` summaries or
|
|
75
|
+
* already-summarized); ordered by `ranAt` when available, else input order.
|
|
76
|
+
* @param {object} [opts]
|
|
77
|
+
* @param {number} [opts.regressionThreshold] pass-rate drop (0..1) that trips the
|
|
78
|
+
* gate on its own, independent of per-task regressions. Default 0 (any drop or
|
|
79
|
+
* any newly-failing task trips it).
|
|
80
|
+
* @returns {{
|
|
81
|
+
* runs:number, latest:object|null, previous:object|null, delta:number,
|
|
82
|
+
* direction:"up"|"down"|"flat"|"n/a", regressions:string[], fixed:string[],
|
|
83
|
+
* newlyMissing:string[], regressed:boolean, history:number[]
|
|
84
|
+
* }}
|
|
85
|
+
*/
|
|
86
|
+
export function computeTrend(runs, { regressionThreshold = 0 } = {}) {
|
|
87
|
+
const norm = ordered((runs || []).map((r) => summarizeRun(r)));
|
|
88
|
+
const history = norm.map((r) => r.passRate);
|
|
89
|
+
if (norm.length === 0) {
|
|
90
|
+
return {
|
|
91
|
+
runs: 0,
|
|
92
|
+
latest: null,
|
|
93
|
+
previous: null,
|
|
94
|
+
delta: 0,
|
|
95
|
+
direction: "n/a",
|
|
96
|
+
regressions: [],
|
|
97
|
+
fixed: [],
|
|
98
|
+
newlyMissing: [],
|
|
99
|
+
regressed: false,
|
|
100
|
+
history,
|
|
101
|
+
};
|
|
102
|
+
}
|
|
103
|
+
const latest = norm[norm.length - 1];
|
|
104
|
+
const previous = norm.length >= 2 ? norm[norm.length - 2] : null;
|
|
105
|
+
if (!previous) {
|
|
106
|
+
return {
|
|
107
|
+
runs: norm.length,
|
|
108
|
+
latest,
|
|
109
|
+
previous: null,
|
|
110
|
+
delta: 0,
|
|
111
|
+
direction: "n/a",
|
|
112
|
+
regressions: [],
|
|
113
|
+
fixed: [],
|
|
114
|
+
newlyMissing: [],
|
|
115
|
+
regressed: false,
|
|
116
|
+
history,
|
|
117
|
+
};
|
|
118
|
+
}
|
|
119
|
+
const delta = latest.passRate - previous.passRate;
|
|
120
|
+
const regressions = []; // passed before, fails now
|
|
121
|
+
const fixed = []; // failed before, passes now
|
|
122
|
+
const newlyMissing = []; // in previous suite, absent from latest (dropped task)
|
|
123
|
+
for (const [id, prevPass] of Object.entries(previous.perTask)) {
|
|
124
|
+
if (!(id in latest.perTask)) {
|
|
125
|
+
newlyMissing.push(id);
|
|
126
|
+
continue;
|
|
127
|
+
}
|
|
128
|
+
const nowPass = latest.perTask[id];
|
|
129
|
+
if (prevPass && !nowPass) regressions.push(id);
|
|
130
|
+
else if (!prevPass && nowPass) fixed.push(id);
|
|
131
|
+
}
|
|
132
|
+
const direction = delta > 1e-9 ? "up" : delta < -1e-9 ? "down" : "flat";
|
|
133
|
+
// The gate trips on ANY task regression, or a pass-rate drop beyond the
|
|
134
|
+
// threshold. A per-task regression matters even when the aggregate holds
|
|
135
|
+
// (one task fixed while another broke = flat rate but a real regression).
|
|
136
|
+
const regressed =
|
|
137
|
+
regressions.length > 0 || delta < -Math.abs(regressionThreshold);
|
|
138
|
+
return {
|
|
139
|
+
runs: norm.length,
|
|
140
|
+
latest,
|
|
141
|
+
previous,
|
|
142
|
+
delta,
|
|
143
|
+
direction,
|
|
144
|
+
regressions: regressions.sort(),
|
|
145
|
+
fixed: fixed.sort(),
|
|
146
|
+
newlyMissing: newlyMissing.sort(),
|
|
147
|
+
regressed,
|
|
148
|
+
history,
|
|
149
|
+
};
|
|
150
|
+
}
|
|
151
|
+
|
|
152
|
+
const BARS = "▁▂▃▄▅▆▇█";
|
|
153
|
+
/** Tiny unicode sparkline of pass-rates (0..1) across the run history. */
|
|
154
|
+
export function sparkline(rates) {
|
|
155
|
+
if (!rates || rates.length === 0) return "";
|
|
156
|
+
return rates
|
|
157
|
+
.map((r) => {
|
|
158
|
+
const clamped = Math.max(0, Math.min(1, Number(r) || 0));
|
|
159
|
+
return BARS[
|
|
160
|
+
Math.min(BARS.length - 1, Math.round(clamped * (BARS.length - 1)))
|
|
161
|
+
];
|
|
162
|
+
})
|
|
163
|
+
.join("");
|
|
164
|
+
}
|
|
165
|
+
|
|
166
|
+
/** Human-readable trend report. */
|
|
167
|
+
export function formatTrend(trend) {
|
|
168
|
+
if (!trend || trend.runs === 0) return "No eval history to report.";
|
|
169
|
+
const pct = (n) => `${(n * 100).toFixed(1)}%`;
|
|
170
|
+
const lines = [];
|
|
171
|
+
const l = trend.latest;
|
|
172
|
+
lines.push(
|
|
173
|
+
`Eval trend over ${trend.runs} run(s) ${sparkline(trend.history)}`,
|
|
174
|
+
);
|
|
175
|
+
lines.push(
|
|
176
|
+
` latest: ${l.passed}/${l.total} (${pct(l.passRate)})` +
|
|
177
|
+
(l.label ? ` [${l.label}]` : ""),
|
|
178
|
+
);
|
|
179
|
+
if (!trend.previous) {
|
|
180
|
+
lines.push(" (only one run — no delta yet)");
|
|
181
|
+
return lines.join("\n");
|
|
182
|
+
}
|
|
183
|
+
const arrow =
|
|
184
|
+
trend.direction === "up" ? "▲" : trend.direction === "down" ? "▼" : "▬";
|
|
185
|
+
const sign = trend.delta >= 0 ? "+" : "";
|
|
186
|
+
lines.push(
|
|
187
|
+
` vs previous: ${arrow} ${sign}${(trend.delta * 100).toFixed(1)} pts`,
|
|
188
|
+
);
|
|
189
|
+
if (trend.regressions.length)
|
|
190
|
+
lines.push(` ✗ regressions: ${trend.regressions.join(", ")}`);
|
|
191
|
+
if (trend.fixed.length) lines.push(` ✔ fixed: ${trend.fixed.join(", ")}`);
|
|
192
|
+
if (trend.newlyMissing.length)
|
|
193
|
+
lines.push(` · dropped tasks: ${trend.newlyMissing.join(", ")}`);
|
|
194
|
+
lines.push(
|
|
195
|
+
trend.regressed
|
|
196
|
+
? " RESULT: REGRESSED (gate fails)"
|
|
197
|
+
: " RESULT: ok (no regression)",
|
|
198
|
+
);
|
|
199
|
+
return lines.join("\n");
|
|
200
|
+
}
|
|
@@ -63,6 +63,79 @@ export function ensureEvolutionTables(db) {
|
|
|
63
63
|
`);
|
|
64
64
|
}
|
|
65
65
|
|
|
66
|
+
/**
|
|
67
|
+
* Rehydrate the capabilities/models/growthLog stores from the persisted
|
|
68
|
+
* evolution_* tables. The `cc` CLI runs every command in a fresh process, so
|
|
69
|
+
* without this the Maps/array start empty and a capability/model/growth event
|
|
70
|
+
* recorded in a prior invocation is invisible (`cc evolution stats`/`growth`
|
|
71
|
+
* report nothing; `cc evolution export <id>` throws "not found"; `diagnose`
|
|
72
|
+
* always reports healthy/idle). It also lets assessCapability find an existing
|
|
73
|
+
* capability by name across processes instead of minting a fresh id each time
|
|
74
|
+
* (which would leave duplicate persisted rows). Call after
|
|
75
|
+
* ensureEvolutionTables(db). (diagnoses is write-only — no reader — so it is
|
|
76
|
+
* not rehydrated.)
|
|
77
|
+
*/
|
|
78
|
+
export function loadFromDb(db) {
|
|
79
|
+
if (!db) return 0;
|
|
80
|
+
capabilities.clear();
|
|
81
|
+
models.clear();
|
|
82
|
+
growthLog.length = 0;
|
|
83
|
+
|
|
84
|
+
const capRows = db.prepare(`SELECT * FROM evolution_capabilities`).all();
|
|
85
|
+
for (const row of capRows) {
|
|
86
|
+
let history = [];
|
|
87
|
+
try {
|
|
88
|
+
history = row.history ? JSON.parse(row.history) : [];
|
|
89
|
+
} catch {
|
|
90
|
+
history = [];
|
|
91
|
+
}
|
|
92
|
+
// keyed by name (matches assessCapability)
|
|
93
|
+
capabilities.set(row.name, {
|
|
94
|
+
id: row.id,
|
|
95
|
+
name: row.name,
|
|
96
|
+
score: row.score ?? 0,
|
|
97
|
+
category: row.category,
|
|
98
|
+
trend: row.trend,
|
|
99
|
+
history,
|
|
100
|
+
});
|
|
101
|
+
}
|
|
102
|
+
|
|
103
|
+
const modelRows = db.prepare(`SELECT * FROM evolution_models`).all();
|
|
104
|
+
for (const row of modelRows) {
|
|
105
|
+
let parameters = {};
|
|
106
|
+
try {
|
|
107
|
+
parameters = row.parameters ? JSON.parse(row.parameters) : {};
|
|
108
|
+
} catch {
|
|
109
|
+
parameters = {};
|
|
110
|
+
}
|
|
111
|
+
// keyed by id (matches trainIncremental modelId)
|
|
112
|
+
models.set(row.id, {
|
|
113
|
+
id: row.id,
|
|
114
|
+
name: row.name,
|
|
115
|
+
type: row.type,
|
|
116
|
+
accuracy: row.accuracy ?? 0.5,
|
|
117
|
+
dataPoints: row.data_points ?? 0,
|
|
118
|
+
parameters,
|
|
119
|
+
createdAt: row.created_at ?? null,
|
|
120
|
+
updatedAt: row.updated_at ?? null,
|
|
121
|
+
});
|
|
122
|
+
}
|
|
123
|
+
|
|
124
|
+
const logRows = db.prepare(`SELECT * FROM evolution_growth_log`).all();
|
|
125
|
+
for (const row of logRows) {
|
|
126
|
+
growthLog.push({
|
|
127
|
+
id: row.id,
|
|
128
|
+
eventType: row.event_type,
|
|
129
|
+
description: row.description,
|
|
130
|
+
capabilityId: row.capability_id ?? null,
|
|
131
|
+
delta: row.delta ?? 0,
|
|
132
|
+
timestamp: row.timestamp,
|
|
133
|
+
});
|
|
134
|
+
}
|
|
135
|
+
|
|
136
|
+
return capabilities.size + models.size + growthLog.length;
|
|
137
|
+
}
|
|
138
|
+
|
|
66
139
|
// ─── Core functions ───────────────────────────────────────────
|
|
67
140
|
|
|
68
141
|
/**
|
|
@@ -70,6 +143,7 @@ export function ensureEvolutionTables(db) {
|
|
|
70
143
|
*/
|
|
71
144
|
export function assessCapability(db, name, score, category = "general") {
|
|
72
145
|
ensureEvolutionTables(db);
|
|
146
|
+
loadFromDb(db);
|
|
73
147
|
|
|
74
148
|
let cap = capabilities.get(name);
|
|
75
149
|
if (!cap) {
|
|
@@ -151,6 +225,7 @@ export function assessCapability(db, name, score, category = "general") {
|
|
|
151
225
|
*/
|
|
152
226
|
export function trainIncremental(db, modelId, newData, options = {}) {
|
|
153
227
|
ensureEvolutionTables(db);
|
|
228
|
+
loadFromDb(db);
|
|
154
229
|
|
|
155
230
|
let model = models.get(modelId);
|
|
156
231
|
if (!model) {
|
|
@@ -217,6 +292,7 @@ export function trainIncremental(db, modelId, newData, options = {}) {
|
|
|
217
292
|
*/
|
|
218
293
|
export function selfDiagnose(db) {
|
|
219
294
|
ensureEvolutionTables(db);
|
|
295
|
+
loadFromDb(db);
|
|
220
296
|
|
|
221
297
|
const components = [];
|
|
222
298
|
const issues = [];
|
|
@@ -327,6 +403,7 @@ export function selfDiagnose(db) {
|
|
|
327
403
|
*/
|
|
328
404
|
export function selfRepair(db, issue) {
|
|
329
405
|
ensureEvolutionTables(db);
|
|
406
|
+
loadFromDb(db);
|
|
330
407
|
|
|
331
408
|
const actions = [];
|
|
332
409
|
const timestamp = new Date().toISOString();
|
|
@@ -349,6 +426,10 @@ export function selfRepair(db, issue) {
|
|
|
349
426
|
cap.history = cap.history.filter(
|
|
350
427
|
(h) => new Date(h.timestamp).getTime() > cutoff,
|
|
351
428
|
);
|
|
429
|
+
// Persist the prune, else the repair is lost when the process exits.
|
|
430
|
+
db.prepare(
|
|
431
|
+
`UPDATE evolution_capabilities SET history = ?, updated_at = datetime('now') WHERE id = ?`,
|
|
432
|
+
).run(JSON.stringify(cap.history), cap.id);
|
|
352
433
|
}
|
|
353
434
|
actions.push("Pruned stale capability history entries");
|
|
354
435
|
break;
|
|
@@ -359,6 +440,12 @@ export function selfRepair(db, issue) {
|
|
|
359
440
|
if (model.accuracy < 0.6) {
|
|
360
441
|
model.accuracy = 0.5;
|
|
361
442
|
model.dataPoints = 0;
|
|
443
|
+
model.updatedAt = new Date().toISOString();
|
|
444
|
+
// Persist the reset, else the repair is lost when the process exits
|
|
445
|
+
// (the DB row keeps the degraded accuracy across invocations).
|
|
446
|
+
db.prepare(
|
|
447
|
+
`UPDATE evolution_models SET accuracy = ?, data_points = ?, updated_at = datetime('now') WHERE id = ?`,
|
|
448
|
+
).run(model.accuracy, model.dataPoints, model.id);
|
|
362
449
|
actions.push(`Reset model ${model.id} for retraining`);
|
|
363
450
|
}
|
|
364
451
|
}
|
|
@@ -400,6 +487,7 @@ export function selfRepair(db, issue) {
|
|
|
400
487
|
*/
|
|
401
488
|
export function predictBehavior(db, userId, options = {}) {
|
|
402
489
|
ensureEvolutionTables(db);
|
|
490
|
+
loadFromDb(db);
|
|
403
491
|
|
|
404
492
|
// Build predictions from capability patterns and growth log
|
|
405
493
|
const recentEvents = growthLog.slice(-50);
|
|
@@ -431,6 +519,7 @@ export function predictBehavior(db, userId, options = {}) {
|
|
|
431
519
|
*/
|
|
432
520
|
export function getGrowthLog(db, options = {}) {
|
|
433
521
|
ensureEvolutionTables(db);
|
|
522
|
+
loadFromDb(db);
|
|
434
523
|
|
|
435
524
|
let entries = [...growthLog];
|
|
436
525
|
|
|
@@ -449,6 +538,7 @@ export function getGrowthLog(db, options = {}) {
|
|
|
449
538
|
*/
|
|
450
539
|
export function getCapabilities(db) {
|
|
451
540
|
ensureEvolutionTables(db);
|
|
541
|
+
loadFromDb(db);
|
|
452
542
|
|
|
453
543
|
return [...capabilities.values()].map((c) => ({
|
|
454
544
|
id: c.id,
|
|
@@ -465,6 +555,7 @@ export function getCapabilities(db) {
|
|
|
465
555
|
*/
|
|
466
556
|
export function getModels(db) {
|
|
467
557
|
ensureEvolutionTables(db);
|
|
558
|
+
loadFromDb(db);
|
|
468
559
|
|
|
469
560
|
return [...models.values()].map((m) => ({
|
|
470
561
|
id: m.id,
|
|
@@ -480,6 +571,7 @@ export function getModels(db) {
|
|
|
480
571
|
*/
|
|
481
572
|
export function exportModel(db, modelId) {
|
|
482
573
|
ensureEvolutionTables(db);
|
|
574
|
+
loadFromDb(db);
|
|
483
575
|
|
|
484
576
|
const model = models.get(modelId);
|
|
485
577
|
if (!model) {
|
|
@@ -47,6 +47,61 @@ export function ensureEvoMapFederationTables(db) {
|
|
|
47
47
|
`);
|
|
48
48
|
}
|
|
49
49
|
|
|
50
|
+
/**
|
|
51
|
+
* Hydrate the in-memory _hubs/_lineage Maps from the DB. The CLI is one-shot:
|
|
52
|
+
* both start empty each process. Writes dual-write (Map + INSERT) but every read
|
|
53
|
+
* (listFederatedHubs/getPressureReport/getLineage/listHubsV2/buildFederationContext/
|
|
54
|
+
* getFederationStatsV2) is Map-only, and syncGenes/setHubStatus look up _hubs —
|
|
55
|
+
* so persisted hubs/lineage were invisible and sync/status-change threw
|
|
56
|
+
* "Hub not found". Call after ensureEvoMapFederationTables(db).
|
|
57
|
+
*/
|
|
58
|
+
export function loadFromDb(db) {
|
|
59
|
+
if (!db) return 0;
|
|
60
|
+
ensureEvoMapFederationTables(db);
|
|
61
|
+
_hubs.clear();
|
|
62
|
+
_lineage.clear();
|
|
63
|
+
|
|
64
|
+
for (const r of db
|
|
65
|
+
.prepare(
|
|
66
|
+
`SELECT id, hub_url, hub_name, status, region, gene_count, last_sync, trust_score, created_at
|
|
67
|
+
FROM evomap_hub_federation`,
|
|
68
|
+
)
|
|
69
|
+
.all()) {
|
|
70
|
+
_hubs.set(r.id, {
|
|
71
|
+
id: r.id,
|
|
72
|
+
hubUrl: r.hub_url,
|
|
73
|
+
hubName: r.hub_name,
|
|
74
|
+
status: r.status,
|
|
75
|
+
region: r.region,
|
|
76
|
+
geneCount: Number(r.gene_count) || 0,
|
|
77
|
+
lastSync: r.last_sync,
|
|
78
|
+
trustScore: Number(r.trust_score) || 0,
|
|
79
|
+
createdAt: r.created_at,
|
|
80
|
+
});
|
|
81
|
+
}
|
|
82
|
+
|
|
83
|
+
for (const r of db
|
|
84
|
+
.prepare(
|
|
85
|
+
`SELECT id, gene_id, parent_gene_id, hub_id, generation, fitness_score, mutation_type, recombination_source, created_at
|
|
86
|
+
FROM gene_lineage`,
|
|
87
|
+
)
|
|
88
|
+
.all()) {
|
|
89
|
+
_lineage.set(r.id, {
|
|
90
|
+
id: r.id,
|
|
91
|
+
geneId: r.gene_id,
|
|
92
|
+
parentGeneId: r.parent_gene_id,
|
|
93
|
+
hubId: r.hub_id,
|
|
94
|
+
generation: Number(r.generation) || 0,
|
|
95
|
+
fitnessScore: Number(r.fitness_score) || 0,
|
|
96
|
+
mutationType: r.mutation_type,
|
|
97
|
+
recombinationSource: r.recombination_source,
|
|
98
|
+
createdAt: r.created_at,
|
|
99
|
+
});
|
|
100
|
+
}
|
|
101
|
+
|
|
102
|
+
return _hubs.size + _lineage.size;
|
|
103
|
+
}
|
|
104
|
+
|
|
50
105
|
/* ── Hub Management ────────────────────────────────────────── */
|
|
51
106
|
|
|
52
107
|
export function listFederatedHubs(db, filter = {}) {
|
|
@@ -51,6 +51,100 @@ export function ensureEvoMapGovernanceTables(db) {
|
|
|
51
51
|
`);
|
|
52
52
|
}
|
|
53
53
|
|
|
54
|
+
/**
|
|
55
|
+
* Hydrate the in-memory _ownerships/_proposals Maps from the DB. The CLI is
|
|
56
|
+
* one-shot: both start empty each process. Writes dual-write (Map + INSERT) but
|
|
57
|
+
* every read (traceOwnership/getGovernanceDashboard/listProposalsV2/
|
|
58
|
+
* getGovernanceStatsV2) is Map-only and voteOnGovernanceProposal/castVoteV2/
|
|
59
|
+
* setProposalStatus look up _proposals — so persisted ownerships/proposals were
|
|
60
|
+
* invisible and voting threw "Proposal not found". Call after
|
|
61
|
+
* ensureEvoMapGovernanceTables(db).
|
|
62
|
+
*
|
|
63
|
+
* Note: the proposals table stores only the legacy columns; V2-only fields
|
|
64
|
+
* (abstain/weight tallies, custom quorum/threshold) are not persisted, so they
|
|
65
|
+
* default here (0 / quorum 3 / threshold 0.5) to keep V2 reads and votes
|
|
66
|
+
* non-crashing. votesFor/votesAgainst/status ARE faithfully restored.
|
|
67
|
+
*/
|
|
68
|
+
export function loadFromDb(db) {
|
|
69
|
+
if (!db) return 0;
|
|
70
|
+
ensureEvoMapGovernanceTables(db);
|
|
71
|
+
_ownerships.clear();
|
|
72
|
+
_proposals.clear();
|
|
73
|
+
|
|
74
|
+
for (const r of db
|
|
75
|
+
.prepare(
|
|
76
|
+
`SELECT id, gene_id, owner_did, originality_proof, derivation_chain, revenue_split, verified, plagiarism_score, created_at
|
|
77
|
+
FROM gene_ownership`,
|
|
78
|
+
)
|
|
79
|
+
.all()) {
|
|
80
|
+
// One corrupt JSON cell must not crash the whole load.
|
|
81
|
+
let originalityProof = null;
|
|
82
|
+
let derivationChain = [];
|
|
83
|
+
let revenueSplit = {};
|
|
84
|
+
try {
|
|
85
|
+
originalityProof = r.originality_proof
|
|
86
|
+
? JSON.parse(r.originality_proof)
|
|
87
|
+
: null;
|
|
88
|
+
} catch {
|
|
89
|
+
originalityProof = null;
|
|
90
|
+
}
|
|
91
|
+
try {
|
|
92
|
+
derivationChain = r.derivation_chain
|
|
93
|
+
? JSON.parse(r.derivation_chain)
|
|
94
|
+
: [];
|
|
95
|
+
} catch {
|
|
96
|
+
derivationChain = [];
|
|
97
|
+
}
|
|
98
|
+
try {
|
|
99
|
+
revenueSplit = r.revenue_split ? JSON.parse(r.revenue_split) : {};
|
|
100
|
+
} catch {
|
|
101
|
+
revenueSplit = {};
|
|
102
|
+
}
|
|
103
|
+
_ownerships.set(r.id, {
|
|
104
|
+
id: r.id,
|
|
105
|
+
geneId: r.gene_id,
|
|
106
|
+
ownerDid: r.owner_did,
|
|
107
|
+
originalityProof,
|
|
108
|
+
derivationChain,
|
|
109
|
+
revenueSplit,
|
|
110
|
+
verified: r.verified,
|
|
111
|
+
plagiarismScore: Number(r.plagiarism_score) || 0,
|
|
112
|
+
createdAt: r.created_at,
|
|
113
|
+
});
|
|
114
|
+
}
|
|
115
|
+
|
|
116
|
+
for (const r of db
|
|
117
|
+
.prepare(
|
|
118
|
+
`SELECT id, title, description, proposer_did, type, status, votes_for, votes_against, quorum_reached, voting_deadline, executed_at, created_at
|
|
119
|
+
FROM evomap_governance_proposals`,
|
|
120
|
+
)
|
|
121
|
+
.all()) {
|
|
122
|
+
_proposals.set(r.id, {
|
|
123
|
+
id: r.id,
|
|
124
|
+
title: r.title,
|
|
125
|
+
description: r.description || "",
|
|
126
|
+
proposerDid: r.proposer_did,
|
|
127
|
+
type: r.type,
|
|
128
|
+
status: r.status,
|
|
129
|
+
votesFor: Number(r.votes_for) || 0,
|
|
130
|
+
votesAgainst: Number(r.votes_against) || 0,
|
|
131
|
+
quorumReached: !!r.quorum_reached,
|
|
132
|
+
votingDeadline: r.voting_deadline,
|
|
133
|
+
executedAt: r.executed_at,
|
|
134
|
+
createdAt: r.created_at,
|
|
135
|
+
// Non-persisted V2 fields — default to stay NaN-safe (see fn doc).
|
|
136
|
+
votesAbstain: 0,
|
|
137
|
+
weightFor: 0,
|
|
138
|
+
weightAgainst: 0,
|
|
139
|
+
weightAbstain: 0,
|
|
140
|
+
quorum: 3,
|
|
141
|
+
threshold: 0.5,
|
|
142
|
+
});
|
|
143
|
+
}
|
|
144
|
+
|
|
145
|
+
return _ownerships.size + _proposals.size;
|
|
146
|
+
}
|
|
147
|
+
|
|
54
148
|
/* ── Ownership Registration ───────────────────────────────── */
|
|
55
149
|
|
|
56
150
|
export function registerOwnership(db, geneId, ownerDid, opts = {}) {
|
package/src/lib/fatal-handler.js
CHANGED
|
@@ -21,6 +21,19 @@ export function reportFatal(
|
|
|
21
21
|
env = process.env,
|
|
22
22
|
} = {},
|
|
23
23
|
) {
|
|
24
|
+
// Ctrl-C / Esc on an interactive @inquirer prompt throws ExitPromptError.
|
|
25
|
+
// That's a normal user cancel, not a failure — printing `error: User force
|
|
26
|
+
// closed the prompt...` + a non-descript exit is confusing. Treat it as a
|
|
27
|
+
// clean cancel: a brief note to stderr and the conventional SIGINT exit code
|
|
28
|
+
// (130 = 128 + SIGINT), so scripts can tell "cancelled" from "succeeded".
|
|
29
|
+
if (
|
|
30
|
+
err &&
|
|
31
|
+
(err.name === "ExitPromptError" || err.code === "ERR_USE_AFTER_CLOSE")
|
|
32
|
+
) {
|
|
33
|
+
stderr.write("\nCancelled.\n");
|
|
34
|
+
exit(130);
|
|
35
|
+
return;
|
|
36
|
+
}
|
|
24
37
|
const verbose =
|
|
25
38
|
argv.includes("--verbose") || Boolean(env.CC_DEBUG) || Boolean(env.DEBUG);
|
|
26
39
|
if (verbose && err && err.stack) {
|
|
@@ -38,7 +51,10 @@ export function reportFatal(
|
|
|
38
51
|
* this only swaps the ugly default stack for the friendly boundary — it is not
|
|
39
52
|
* a behavior change (still exits non-zero).
|
|
40
53
|
*/
|
|
41
|
-
export function installGlobalErrorHandlers(
|
|
54
|
+
export function installGlobalErrorHandlers(
|
|
55
|
+
proc = process,
|
|
56
|
+
report = reportFatal,
|
|
57
|
+
) {
|
|
42
58
|
proc.on("unhandledRejection", (reason) =>
|
|
43
59
|
report(reason instanceof Error ? reason : new Error(String(reason))),
|
|
44
60
|
);
|
|
@@ -67,6 +67,79 @@ export function ensureHardeningTables(db) {
|
|
|
67
67
|
`);
|
|
68
68
|
}
|
|
69
69
|
|
|
70
|
+
/**
|
|
71
|
+
* Rehydrate _baselines/_audits from the persisted performance_baselines/
|
|
72
|
+
* hardening_audits tables. The `cc` CLI runs every command in a fresh process,
|
|
73
|
+
* so without this the Maps start empty and a baseline/audit collected in a
|
|
74
|
+
* prior invocation is invisible (`cc hardening baseline list`/`audit reports`
|
|
75
|
+
* show nothing; `baseline compare`/`audit report <id>` throw "not found"; and —
|
|
76
|
+
* most damagingly — `cc hardening deploy-check` reports "No baseline / No audit"
|
|
77
|
+
* and yields a silently-wrong go/no-go verdict even when the rows exist). Call
|
|
78
|
+
* after ensureHardeningTables(db).
|
|
79
|
+
*/
|
|
80
|
+
export function loadFromDb(db) {
|
|
81
|
+
if (!db) return 0;
|
|
82
|
+
_baselines.clear();
|
|
83
|
+
_audits.clear();
|
|
84
|
+
|
|
85
|
+
const baselineRows = db.prepare(`SELECT * FROM performance_baselines`).all();
|
|
86
|
+
for (const row of baselineRows) {
|
|
87
|
+
let metrics = {};
|
|
88
|
+
let environment = {};
|
|
89
|
+
try {
|
|
90
|
+
metrics = row.metrics ? JSON.parse(row.metrics) : {};
|
|
91
|
+
} catch {
|
|
92
|
+
metrics = {};
|
|
93
|
+
}
|
|
94
|
+
try {
|
|
95
|
+
environment = row.environment ? JSON.parse(row.environment) : {};
|
|
96
|
+
} catch {
|
|
97
|
+
environment = {};
|
|
98
|
+
}
|
|
99
|
+
_baselines.set(row.id, {
|
|
100
|
+
id: row.id,
|
|
101
|
+
name: row.name,
|
|
102
|
+
version: row.version,
|
|
103
|
+
status: row.status,
|
|
104
|
+
metrics,
|
|
105
|
+
environment,
|
|
106
|
+
sampleCount: row.sample_count ?? 0,
|
|
107
|
+
createdAt: row.created_at ?? null,
|
|
108
|
+
completedAt: row.completed_at ?? null,
|
|
109
|
+
});
|
|
110
|
+
}
|
|
111
|
+
|
|
112
|
+
const auditRows = db.prepare(`SELECT * FROM hardening_audits`).all();
|
|
113
|
+
for (const row of auditRows) {
|
|
114
|
+
let checks = [];
|
|
115
|
+
let recommendations = [];
|
|
116
|
+
try {
|
|
117
|
+
checks = row.checks ? JSON.parse(row.checks) : [];
|
|
118
|
+
} catch {
|
|
119
|
+
checks = [];
|
|
120
|
+
}
|
|
121
|
+
try {
|
|
122
|
+
recommendations = row.recommendations
|
|
123
|
+
? JSON.parse(row.recommendations)
|
|
124
|
+
: [];
|
|
125
|
+
} catch {
|
|
126
|
+
recommendations = [];
|
|
127
|
+
}
|
|
128
|
+
_audits.set(row.id, {
|
|
129
|
+
id: row.id,
|
|
130
|
+
name: row.name,
|
|
131
|
+
checks,
|
|
132
|
+
passed: row.passed ?? 0,
|
|
133
|
+
failed: row.failed ?? 0,
|
|
134
|
+
score: row.score ?? 0,
|
|
135
|
+
recommendations,
|
|
136
|
+
createdAt: row.created_at ?? null,
|
|
137
|
+
});
|
|
138
|
+
}
|
|
139
|
+
|
|
140
|
+
return _baselines.size + _audits.size;
|
|
141
|
+
}
|
|
142
|
+
|
|
70
143
|
/* ── Baseline Collection ──────────────────────────────────── */
|
|
71
144
|
|
|
72
145
|
export function collectBaseline(db, name, version) {
|