chainlesschain 0.162.149 → 0.162.151
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 +3 -2
- package/src/assets/web-panel/assets/{AIOps-BJif14yR.js → AIOps-DuEOzebi.js} +1 -1
- package/src/assets/web-panel/assets/{ActionButton-CXek6gJY.js → ActionButton-C6GiJa5H.js} +1 -1
- package/src/assets/web-panel/assets/{Analytics-BgQhdAJi.js → Analytics-BBIiL_pO.js} +3 -3
- package/src/assets/web-panel/assets/{AppLayout-DTYl5NtR.js → AppLayout-CuI2gZRy.js} +3 -3
- package/src/assets/web-panel/assets/{Audit-BzATQAeR.js → Audit-CbUjfr-K.js} +1 -1
- package/src/assets/web-panel/assets/{Backup-BzdPEQhL.js → Backup-CsSW9ljf.js} +1 -1
- package/src/assets/web-panel/assets/{BaseInput-BM0KVh8E.js → BaseInput-kM3rLe7F.js} +1 -1
- package/src/assets/web-panel/assets/{Chat-D7fHXHkz.js → Chat-kfE51YN3.js} +4 -4
- package/src/assets/web-panel/assets/{ChatBubbleRenderer-Wm34RR-b.js → ChatBubbleRenderer-Bg2FTW6A.js} +1 -1
- package/src/assets/web-panel/assets/{Checkbox-CAiSQ9vO.js → Checkbox-jYb1uj-M.js} +1 -1
- package/src/assets/web-panel/assets/{Codegen-Df40CrEe.js → Codegen-X9XiD5Lj.js} +1 -1
- package/src/assets/web-panel/assets/{Col-DIT2fNFU.js → Col-BfbHu1xI.js} +1 -1
- package/src/assets/web-panel/assets/{Community-CSTIbW2k.js → Community-c4oJMFS-.js} +1 -1
- package/src/assets/web-panel/assets/{Compact-DtqXZZUi.js → Compact-BFmnZpH7.js} +1 -1
- package/src/assets/web-panel/assets/{Compliance-CUtzw6o7.js → Compliance-s9shVHBS.js} +1 -1
- package/src/assets/web-panel/assets/{Cowork-CezmlnmU.js → Cowork-C5da--TC.js} +2 -2
- package/src/assets/web-panel/assets/{Cron-P4BITarg.js → Cron-9kNbyNE4.js} +2 -2
- package/src/assets/web-panel/assets/{Crosschain-BRRiYwvq.js → Crosschain-C1k3NJD4.js} +1 -1
- package/src/assets/web-panel/assets/{DID-L5ijB9i4.js → DID-DkheEvNK.js} +2 -2
- package/src/assets/web-panel/assets/{Dashboard-CFxro4ob.js → Dashboard-C3FuSGmJ.js} +2 -2
- package/src/assets/web-panel/assets/{Dropdown-BmAFCQ71.js → Dropdown-CAV6FMFD.js} +1 -1
- package/src/assets/web-panel/assets/{EmailListRenderer-DJBCEuon.js → EmailListRenderer-Cc-Ulc4l.js} +1 -1
- package/src/assets/web-panel/assets/{FamilyGuardDashboard-z4oLq6eT.js → FamilyGuardDashboard-8CitHEtv.js} +1 -1
- package/src/assets/web-panel/assets/{Federation-DsVCpHMF.js → Federation-DFSZ5KDt.js} +1 -1
- package/src/assets/web-panel/assets/{FormItemContext-DP3bP5th.js → FormItemContext-CEWCtnG2.js} +1 -1
- package/src/assets/web-panel/assets/{GenericCardRenderer-BAXP2Gc6.js → GenericCardRenderer-CwRzNzmX.js} +1 -1
- package/src/assets/web-panel/assets/{Git-I3g_bAw9.js → Git-0rgDM7cJ.js} +2 -2
- package/src/assets/web-panel/assets/{Governance-jHS5-ioS.js → Governance-CfBKtK9F.js} +1 -1
- package/src/assets/web-panel/assets/{Inference-CPL7sfx9.js → Inference-CzcUVvud.js} +1 -1
- package/src/assets/web-panel/assets/{KnowledgeGraph-Jf236h4C.js → KnowledgeGraph-Dwc4YL4A.js} +1 -1
- package/src/assets/web-panel/assets/{Logs-Cm2tcSKg.js → Logs-DgFPwR2F.js} +2 -2
- package/src/assets/web-panel/assets/{Marketplace-CZK82rhi.js → Marketplace-DnpPTbGU.js} +1 -1
- package/src/assets/web-panel/assets/{McpTools-CZCeji7a.js → McpTools-DRxxINyW.js} +4 -4
- package/src/assets/web-panel/assets/{Memory-3l2KVS9k.js → Memory-OhmW_6Z3.js} +2 -2
- package/src/assets/web-panel/assets/{MobileBridge-VYdpoLh6.js → MobileBridge-DkTW-RK5.js} +1 -1
- package/src/assets/web-panel/assets/{MobileProjects-CiB9cmm1.js → MobileProjects-DpCGV_lI.js} +1 -1
- package/src/assets/web-panel/assets/{Mtc-wCFZbBuL.js → Mtc--vmkL0AS.js} +2 -2
- package/src/assets/web-panel/assets/{MtcAudit-1a3THIyG.js → MtcAudit-DGoFWjD4.js} +4 -4
- package/src/assets/web-panel/assets/{Multisig-DMzLB2hG.js → Multisig-B4kWgq95.js} +3 -3
- package/src/assets/web-panel/assets/{NLProgramming-D9wZbf6l.js → NLProgramming-YQwvommE.js} +1 -1
- package/src/assets/web-panel/assets/{Notes-hrFe2ZM-.js → Notes-CgjtUADJ.js} +3 -3
- package/src/assets/web-panel/assets/{NotificationSettings-CHGX5Jwm.js → NotificationSettings-6JDrpBG5.js} +1 -1
- package/src/assets/web-panel/assets/OrderTableRenderer-PM6IlxjO.js +1 -0
- package/src/assets/web-panel/assets/{Organization-By7FkhtY.js → Organization-8McOT_OF.js} +4 -4
- package/src/assets/web-panel/assets/{Overflow--khGSzJn.js → Overflow-DAZpSCGc.js} +1 -1
- package/src/assets/web-panel/assets/{P2P-CAG9dH35.js → P2P-B7l2ZWLy.js} +2 -2
- package/src/assets/web-panel/assets/{PdhVaultBrowser-B3SQZmK9.js → PdhVaultBrowser-W1Ud-NAL.js} +3 -3
- package/src/assets/web-panel/assets/{Permissions-D35ec6JA.js → Permissions-Czm_w9u_.js} +4 -4
- package/src/assets/web-panel/assets/{PersonalDataHub-CxBF7hW_.js → PersonalDataHub-B4F0_ZVM.js} +2 -2
- package/src/assets/web-panel/assets/{Pipeline-s6EtOO1s.js → Pipeline-B37aFiWv.js} +1 -1
- package/src/assets/web-panel/assets/{Privacy-BbJYmWmO.js → Privacy-94KBnRrD.js} +1 -1
- package/src/assets/web-panel/assets/{ProjectInit-VGQq1jMT.js → ProjectInit-B5h8_dlh.js} +2 -2
- package/src/assets/web-panel/assets/{ProjectSettings-B1ew3Teh.js → ProjectSettings-lmeI3Lpm.js} +2 -2
- package/src/assets/web-panel/assets/Projects-D5AYOasl.js +1 -0
- package/src/assets/web-panel/assets/{Providers-mrO47FIK.js → Providers-B3cNWwJg.js} +1 -1
- package/src/assets/web-panel/assets/{QrScannerModal-IJF2mHyw.js → QrScannerModal-CHRvOw1R.js} +1 -1
- package/src/assets/web-panel/assets/{QuickAsk-CU0wN_Z0.js → QuickAsk-D1JMgFEd.js} +1 -1
- package/src/assets/web-panel/assets/{Recommend-DhN37R6G.js → Recommend-EYWGR79p.js} +1 -1
- package/src/assets/web-panel/assets/{RemoteSession-D_xOX_hu.js → RemoteSession-BAMC2pJt.js} +2 -2
- package/src/assets/web-panel/assets/{Reputation-D_Ssv7uH.js → Reputation-X2Hk1XG_.js} +1 -1
- package/src/assets/web-panel/assets/{Row-Kx5dKxX7.js → Row-Eq98LRtU.js} +1 -1
- package/src/assets/web-panel/assets/{RssFeed-BlGwqZkY.js → RssFeed-i76s6z_o.js} +2 -2
- package/src/assets/web-panel/assets/{Search-hLFQzxpb.js → Search-D_Es7CAI.js} +1 -1
- package/src/assets/web-panel/assets/{Security-DMlvsVt4.js → Security-kayD2e94.js} +3 -3
- package/src/assets/web-panel/assets/{Services-Bd0Qsj2m.js → Services-Ctsm6ul8.js} +2 -2
- package/src/assets/web-panel/assets/{Skeleton-DFclq9X3.js → Skeleton-CRNYlfdf.js} +1 -1
- package/src/assets/web-panel/assets/{Skills-BNtln2qY.js → Skills-DkZYpF4-.js} +1 -1
- package/src/assets/web-panel/assets/{Sla-Dch5H19G.js → Sla-DXkoBcOP.js} +1 -1
- package/src/assets/web-panel/assets/{SpeechSettings-2UfQcU1g.js → SpeechSettings-DXi_GI1d.js} +1 -1
- package/src/assets/web-panel/assets/{SyncSettings-CD9YQr4i.js → SyncSettings-rNKpfomn.js} +2 -2
- package/src/assets/web-panel/assets/{Tasks-BNu-7MzI.js → Tasks-XF4uPtG-.js} +1 -1
- package/src/assets/web-panel/assets/{Templates-D1n9CaIR.js → Templates-i0Hzfeyu.js} +1 -1
- package/src/assets/web-panel/assets/{Tenant-DenL3iBW.js → Tenant-sMpHAi27.js} +1 -1
- package/src/assets/web-panel/assets/Terminal-BoZvaYAl.js +3 -0
- package/src/assets/web-panel/assets/{TimelineRenderer-D87IfukO.js → TimelineRenderer-yuC6K7Rf.js} +1 -1
- package/src/assets/web-panel/assets/{Tokens-BkiZc8E3.js → Tokens-B8O8i0s6.js} +1 -1
- package/src/assets/web-panel/assets/{Trigger-BNRSytGN.js → Trigger-Bv6yrlCr.js} +1 -1
- package/src/assets/web-panel/assets/{Trust-Bwbd4X2m.js → Trust-C4mW95Ev.js} +1 -1
- package/src/assets/web-panel/assets/{UkeySign-B8O2bs0o.js → UkeySign-DV6yKaHn.js} +1 -1
- package/src/assets/web-panel/assets/{VideoEditing-C2fL8zmH.js → VideoEditing-UI479-sD.js} +1 -1
- package/src/assets/web-panel/assets/{Wallet-BORYDdE1.js → Wallet-M5oV9EVP.js} +4 -4
- package/src/assets/web-panel/assets/{WebAuthn-C0V5S2FM.js → WebAuthn-DDyDHPDR.js} +4 -4
- package/src/assets/web-panel/assets/{WorkflowEditor-2dR0fcHL.js → WorkflowEditor-RoBv4rqk.js} +1 -1
- package/src/assets/web-panel/assets/{chat-BmuAFAn8.js → chat-Cw1mE5LS.js} +1 -1
- package/src/assets/web-panel/assets/{colors-CN3smMcK.js → colors-BFP62Gwf.js} +1 -1
- package/src/assets/web-panel/assets/{compact-item-DCnxb4kW.js → compact-item-17HL6pyC.js} +1 -1
- package/src/assets/web-panel/assets/{createContext-vlR43pHn.js → createContext-D55X4fZX.js} +1 -1
- package/src/assets/web-panel/assets/devWarning-CqbHYuRc.js +1 -0
- package/src/assets/web-panel/assets/{hasIn-D04tHYFd.js → hasIn-D3E5mNsP.js} +1 -1
- package/src/assets/web-panel/assets/{index-DbVsQBOH.js → index--44J50mc.js} +1 -1
- package/src/assets/web-panel/assets/{index-TslMTwNy.js → index-ASPYTzMK.js} +1 -1
- package/src/assets/web-panel/assets/{index-CTOCnIQ7.js → index-BC6zxOlU.js} +1 -1
- package/src/assets/web-panel/assets/{index-ljuBiQW9.js → index-BEa1RW4c.js} +1 -1
- package/src/assets/web-panel/assets/{index-jzR7Ujuw.js → index-BQmZg5si.js} +1 -1
- package/src/assets/web-panel/assets/{index-BudvKQfG.js → index-BY_xZ2jy.js} +1 -1
- package/src/assets/web-panel/assets/{index-CP9m9Ggr.js → index-BgN5G5vF.js} +3 -3
- package/src/assets/web-panel/assets/{index-Cr-A0FYJ.js → index-BnGpft-Z.js} +1 -1
- package/src/assets/web-panel/assets/{index-D5LZVZ0L.js → index-Bq83UBDr.js} +1 -1
- package/src/assets/web-panel/assets/{index-ToUh2b1-.js → index-Bzpp2z2S.js} +1 -1
- package/src/assets/web-panel/assets/{index-DbADHwhr.js → index-CFYGn88j.js} +1 -1
- package/src/assets/web-panel/assets/{index-ClhAHDK3.js → index-CGyTos4p.js} +1 -1
- package/src/assets/web-panel/assets/index-CKBI1U5K.js +1 -0
- package/src/assets/web-panel/assets/{index-C-6NO5il.js → index-CLEzsZ8A.js} +1 -1
- package/src/assets/web-panel/assets/{index-D8vwp4qp.js → index-CR9rNUvi.js} +1 -1
- package/src/assets/web-panel/assets/{index-_FIkN3jd.js → index-CW6LLoJO.js} +1 -1
- package/src/assets/web-panel/assets/{index-D65_XseV.js → index-C_MfcrLf.js} +1 -1
- package/src/assets/web-panel/assets/{index-CnXebZLL.js → index-Cdvk2_2q.js} +1 -1
- package/src/assets/web-panel/assets/{index-D_n8_vfI.js → index-CjCwi7we.js} +1 -1
- package/src/assets/web-panel/assets/index-CkLp6DTO.js +1 -0
- package/src/assets/web-panel/assets/{index-DDwLgQY9.js → index-CvCFKojj.js} +1 -1
- package/src/assets/web-panel/assets/{index-430S68MN.js → index-D4LHSde4.js} +1 -1
- package/src/assets/web-panel/assets/{index-BXRg8GFQ.js → index-DCLu84x-.js} +1 -1
- package/src/assets/web-panel/assets/{index-DTtRscUa.js → index-DD_qGBrt.js} +1 -1
- package/src/assets/web-panel/assets/{index-BasvsWDM.js → index-DIRvdwBX.js} +1 -1
- package/src/assets/web-panel/assets/{index-BeGDEXFs.js → index-DOjA8bvj.js} +1 -1
- package/src/assets/web-panel/assets/{index-CsAsCPJ6.js → index-Da27u6j0.js} +1 -1
- package/src/assets/web-panel/assets/{index-D28DeAAB.js → index-DkBVYlE4.js} +1 -1
- package/src/assets/web-panel/assets/{index-CngCC8hC.js → index-DtAnPBWP.js} +1 -1
- package/src/assets/web-panel/assets/{index-B78xL3s2.js → index-DzG7mkgW.js} +1 -1
- package/src/assets/web-panel/assets/{index-DIpY0qM5.js → index-H9_X1Cg_.js} +1 -1
- package/src/assets/web-panel/assets/{index-C5Sxb1sE.js → index-ITeEHb8L.js} +1 -1
- package/src/assets/web-panel/assets/{index-BTPEZTk1.js → index-KtLJXn4s.js} +1 -1
- package/src/assets/web-panel/assets/{index-hpvvtAZ3.js → index-RYZgFIwo.js} +1 -1
- package/src/assets/web-panel/assets/{index-HhNjnCfe.js → index-gAVxDiTZ.js} +1 -1
- package/src/assets/web-panel/assets/{index-DTWg-18U.js → index-paVubXzn.js} +1 -1
- package/src/assets/web-panel/assets/{index-BqhASEL4.js → index-tUH_6bdJ.js} +1 -1
- package/src/assets/web-panel/assets/{index-DYAtmqiv.js → index-tVRPgYGr.js} +1 -1
- package/src/assets/web-panel/assets/{index-0DnaZGkC.js → index-uSsiwgZ2.js} +1 -1
- package/src/assets/web-panel/assets/{initDefaultProps-C3wUb4je.js → initDefaultProps-Ckp7xVZS.js} +1 -1
- package/src/assets/web-panel/assets/{motion-D-jYFUNA.js → motion-DUZgCpn6.js} +1 -1
- package/src/assets/web-panel/assets/{move-tqb8nwJ2.js → move-B2rttglH.js} +1 -1
- package/src/assets/web-panel/assets/{mtc-parser-DSOjMJMz.js → mtc-parser-BYWcLTuN.js} +1 -1
- package/src/assets/web-panel/assets/{omit-CJ7VimIW.js → omit-DhHqKeFx.js} +1 -1
- package/src/assets/web-panel/assets/{pickAttrs-qXiG1iT3.js → pickAttrs-ANpJaWMO.js} +1 -1
- package/src/assets/web-panel/assets/{placementArrow-CkGBcy1Z.js → placementArrow-CfZWe7CA.js} +1 -1
- package/src/assets/web-panel/assets/{responsiveObserve-D3WvTlLO.js → responsiveObserve-D7Xz2y-R.js} +1 -1
- package/src/assets/web-panel/assets/{slide-BEE2ftge.js → slide-DekqCBY9.js} +1 -1
- package/src/assets/web-panel/assets/{statusUtils-CsfBpxiG.js → statusUtils-BET6XU7h.js} +1 -1
- package/src/assets/web-panel/assets/{styleChecker-xPrIiJPI.js → styleChecker-qHmJjV62.js} +1 -1
- package/src/assets/web-panel/assets/{useFlexGapSupport-C5Yd-SCR.js → useFlexGapSupport-BoMCTNyu.js} +1 -1
- package/src/assets/web-panel/assets/{useFs-D_MDS8HI.js → useFs-TdW-NgFC.js} +1 -1
- package/src/assets/web-panel/assets/{usePersonalDataHub-BqJh-usA.js → usePersonalDataHub-Dyox7wCu.js} +1 -1
- package/src/assets/web-panel/assets/{vnode-chm_p-gz.js → vnode-XUn5S8CP.js} +1 -1
- package/src/assets/web-panel/assets/{zoom-3-YDNz0Z.js → zoom-Ls77i8hn.js} +1 -1
- package/src/assets/web-panel/index.html +1 -1
- package/src/command-manifest.json +8 -1
- package/src/commands/a2a.js +19 -4
- package/src/commands/activitypub.js +20 -3
- package/src/commands/agent.js +27 -5
- package/src/commands/audit.js +40 -24
- package/src/commands/changelog.js +148 -0
- package/src/commands/codeintel.js +68 -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 +7 -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 +125 -5
- 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 +9 -2
- 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/data/changelog.json +189 -0
- package/src/gateways/ws/message-dispatcher.js +5 -2
- package/src/gateways/ws/remote-session-protocol.js +110 -42
- package/src/harness/jsonl-session-store.js +12 -5
- package/src/harness/plugin-manager.js +16 -4
- package/src/harness/remote-command-ledger.js +46 -15
- package/src/harness/worktree-isolator.js +16 -6
- package/src/index.js +2 -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 +2 -0
- package/src/lib/agent-economy.js +262 -29
- package/src/lib/agent-network.js +7 -1
- package/src/lib/agent-team/team-runner.js +25 -9
- package/src/lib/agent-team/team-worktree.js +36 -4
- package/src/lib/async-hook-supervisor.cjs +102 -16
- package/src/lib/audit-logger.js +7 -6
- package/src/lib/autonomous-developer.js +60 -0
- package/src/lib/changelog.js +252 -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 +89 -1
- package/src/lib/eval/tasks.js +170 -0
- package/src/lib/eval/trend.js +16 -1
- 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__/lsp-client.test.js +11 -0
- package/src/lib/lsp/__tests__/lsp-manager.test.js +69 -0
- package/src/lib/lsp/benchmark.js +257 -0
- package/src/lib/lsp/lsp-client.js +30 -9
- package/src/lib/lsp/lsp-manager.js +54 -2
- package/src/lib/lsp/lsp-server-registry.js +15 -4
- 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-runtime/__tests__/remote-source.test.js +256 -0
- package/src/lib/plugin-runtime/hooks.js +20 -4
- package/src/lib/plugin-runtime/install.js +9 -1
- package/src/lib/plugin-runtime/monitors.js +20 -4
- package/src/lib/plugin-runtime/policy.js +9 -1
- package/src/lib/plugin-runtime/remote-source.js +240 -0
- package/src/lib/plugin-runtime/signature.js +16 -0
- package/src/lib/pqc-manager.js +64 -0
- package/src/lib/reputation-optimizer.js +101 -0
- package/src/lib/sandbox-egress-proxy.js +195 -59
- package/src/lib/sandbox-fs-policy.js +112 -0
- package/src/lib/sandbox-network-policy.js +44 -5
- package/src/lib/sandbox-v2.js +14 -14
- package/src/lib/scim-manager.js +36 -0
- package/src/lib/session-manager.js +5 -2
- package/src/lib/settings-hooks.cjs +1 -0
- package/src/lib/siem-exporter.js +45 -0
- package/src/lib/skill-loader.js +20 -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 +12 -1
- 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 +17 -2
- package/src/runtime/__tests__/auto-pin.test.js +104 -0
- package/src/runtime/agent-core.js +241 -68
- package/src/runtime/auto-pin.js +117 -0
- package/src/runtime/headless-runner.js +35 -0
- package/src/assets/web-panel/assets/OrderTableRenderer-CRIFE2Tj.js +0 -1
- package/src/assets/web-panel/assets/Projects-CGcNIs_g.js +0 -1
- package/src/assets/web-panel/assets/Terminal-ZzU0Io1Y.js +0 -3
- package/src/assets/web-panel/assets/devWarning-DxwmsL4j.js +0 -1
- package/src/assets/web-panel/assets/index-Cg2ldRfU.js +0 -1
- package/src/assets/web-panel/assets/index-Dwzo-dtJ.js +0 -1
|
@@ -129,6 +129,74 @@ export function ensureGovernanceTables(db) {
|
|
|
129
129
|
);
|
|
130
130
|
}
|
|
131
131
|
|
|
132
|
+
/**
|
|
133
|
+
* Rehydrate _proposals/_votes/_proposalVotes from the persisted
|
|
134
|
+
* governance_proposals/governance_votes tables. The `cc` CLI runs every command
|
|
135
|
+
* in a fresh process, so without this the Maps start empty and a proposal/vote
|
|
136
|
+
* created in a prior invocation is invisible (`cc governance list`/`show`/
|
|
137
|
+
* `votes`/`tally`/`stats` show nothing) and activate/close/castVote throw
|
|
138
|
+
* "Proposal not found". Rebuilds the _proposalVotes proposalId→Set<voteId>
|
|
139
|
+
* index from the votes too. Call after ensureGovernanceTables(db).
|
|
140
|
+
*/
|
|
141
|
+
export function loadFromDb(db) {
|
|
142
|
+
if (!db) return 0;
|
|
143
|
+
_proposals.clear();
|
|
144
|
+
_votes.clear();
|
|
145
|
+
_proposalVotes.clear();
|
|
146
|
+
|
|
147
|
+
const parse = (v, fallback) => {
|
|
148
|
+
if (v == null) return fallback;
|
|
149
|
+
try {
|
|
150
|
+
return JSON.parse(v);
|
|
151
|
+
} catch {
|
|
152
|
+
return fallback;
|
|
153
|
+
}
|
|
154
|
+
};
|
|
155
|
+
|
|
156
|
+
const proposalRows = db.prepare(`SELECT * FROM governance_proposals`).all();
|
|
157
|
+
for (const row of proposalRows) {
|
|
158
|
+
_proposals.set(row.id, {
|
|
159
|
+
id: row.id,
|
|
160
|
+
title: row.title,
|
|
161
|
+
description: row.description ?? null,
|
|
162
|
+
type: row.type,
|
|
163
|
+
proposerDid: row.proposer_did ?? null,
|
|
164
|
+
status: row.status,
|
|
165
|
+
impactLevel: row.impact_level ?? null,
|
|
166
|
+
impactAnalysis: parse(row.impact_analysis, null),
|
|
167
|
+
voteYes: row.vote_yes ?? 0,
|
|
168
|
+
voteNo: row.vote_no ?? 0,
|
|
169
|
+
voteAbstain: row.vote_abstain ?? 0,
|
|
170
|
+
votingStartsAt: row.voting_starts_at ?? null,
|
|
171
|
+
votingEndsAt: row.voting_ends_at ?? null,
|
|
172
|
+
metadata: parse(row.metadata, null),
|
|
173
|
+
createdAt: row.created_at,
|
|
174
|
+
_seq: ++_seq,
|
|
175
|
+
});
|
|
176
|
+
_proposalVotes.set(row.id, new Set());
|
|
177
|
+
}
|
|
178
|
+
|
|
179
|
+
const voteRows = db.prepare(`SELECT * FROM governance_votes`).all();
|
|
180
|
+
for (const row of voteRows) {
|
|
181
|
+
_votes.set(row.id, {
|
|
182
|
+
id: row.id,
|
|
183
|
+
proposalId: row.proposal_id,
|
|
184
|
+
voterDid: row.voter_did,
|
|
185
|
+
vote: row.vote,
|
|
186
|
+
reason: row.reason ?? null,
|
|
187
|
+
weight: row.weight ?? 1.0,
|
|
188
|
+
createdAt: row.created_at,
|
|
189
|
+
_seq: ++_seq,
|
|
190
|
+
});
|
|
191
|
+
if (!_proposalVotes.has(row.proposal_id)) {
|
|
192
|
+
_proposalVotes.set(row.proposal_id, new Set());
|
|
193
|
+
}
|
|
194
|
+
_proposalVotes.get(row.proposal_id).add(row.id);
|
|
195
|
+
}
|
|
196
|
+
|
|
197
|
+
return _proposals.size + _votes.size;
|
|
198
|
+
}
|
|
199
|
+
|
|
132
200
|
/* ── Catalogs ──────────────────────────────────────────────── */
|
|
133
201
|
|
|
134
202
|
export function listProposalTypes() {
|
|
@@ -723,6 +723,69 @@ export function _resetState() {
|
|
|
723
723
|
_reportRetentionMs = COMPLIANCE_DEFAULT_REPORT_RETENTION_MS;
|
|
724
724
|
}
|
|
725
725
|
|
|
726
|
+
/**
|
|
727
|
+
* Rehydrate the in-memory _evidence/_policies Maps from the persisted
|
|
728
|
+
* compliance_* tables. The CLI runs each `cc compliance` subcommand in a fresh
|
|
729
|
+
* node process, so both Maps start empty every invocation. collectEvidence/
|
|
730
|
+
* addPolicy dual-write (Map + INSERT into compliance_evidence/compliance_policies)
|
|
731
|
+
* but generateReport (summary path), scanCompliance and listPolicies read the
|
|
732
|
+
* Maps only — so a `report`/`scan` after `evidence` in a separate process saw 0
|
|
733
|
+
* evidence items and scored 0. (The `report --detailed` path already SELECTed via
|
|
734
|
+
* the command-layer _loadEvidenceFromDb/_loadPoliciesFromDb; this makes the
|
|
735
|
+
* summary/scan/policies paths consistent.) `_reports` is write-only (no read
|
|
736
|
+
* path) and is not rehydrated. Call after ensureComplianceTables(db).
|
|
737
|
+
*/
|
|
738
|
+
export function loadFromDb(db) {
|
|
739
|
+
if (!db) return 0;
|
|
740
|
+
ensureComplianceTables(db);
|
|
741
|
+
_evidence.clear();
|
|
742
|
+
_policies.clear();
|
|
743
|
+
|
|
744
|
+
for (const r of db
|
|
745
|
+
.prepare(
|
|
746
|
+
`SELECT id, framework, type, description, source, status, collected_at
|
|
747
|
+
FROM compliance_evidence ORDER BY collected_at ASC`,
|
|
748
|
+
)
|
|
749
|
+
.all()) {
|
|
750
|
+
_evidence.set(r.id, {
|
|
751
|
+
id: r.id,
|
|
752
|
+
framework: r.framework,
|
|
753
|
+
type: r.type,
|
|
754
|
+
description: r.description || "",
|
|
755
|
+
source: r.source,
|
|
756
|
+
status: r.status,
|
|
757
|
+
collectedAt: r.collected_at,
|
|
758
|
+
});
|
|
759
|
+
}
|
|
760
|
+
|
|
761
|
+
for (const r of db
|
|
762
|
+
.prepare(
|
|
763
|
+
`SELECT id, name, type, framework, rules, enabled, severity, created_at
|
|
764
|
+
FROM compliance_policies ORDER BY created_at ASC`,
|
|
765
|
+
)
|
|
766
|
+
.all()) {
|
|
767
|
+
// One corrupt rules cell must not sink the whole policy load.
|
|
768
|
+
let rules = {};
|
|
769
|
+
try {
|
|
770
|
+
rules = r.rules ? JSON.parse(r.rules) : {};
|
|
771
|
+
} catch {
|
|
772
|
+
rules = {};
|
|
773
|
+
}
|
|
774
|
+
_policies.set(r.id, {
|
|
775
|
+
id: r.id,
|
|
776
|
+
name: r.name,
|
|
777
|
+
type: r.type,
|
|
778
|
+
framework: r.framework,
|
|
779
|
+
rules,
|
|
780
|
+
enabled: !!r.enabled,
|
|
781
|
+
severity: r.severity,
|
|
782
|
+
createdAt: r.created_at,
|
|
783
|
+
});
|
|
784
|
+
}
|
|
785
|
+
|
|
786
|
+
return _evidence.size + _policies.size;
|
|
787
|
+
}
|
|
788
|
+
|
|
726
789
|
// =====================================================================
|
|
727
790
|
// compliance-manager V2 governance overlay (iter17)
|
|
728
791
|
// =====================================================================
|
package/src/lib/cross-chain.js
CHANGED
|
@@ -651,6 +651,11 @@ const BASE_FEE = {
|
|
|
651
651
|
export function estimateFee({ fromChain, toChain, amount }) {
|
|
652
652
|
if (!_validateChain(fromChain) || !_validateChain(toChain))
|
|
653
653
|
return { fee: null, reason: "unsupported_chain" };
|
|
654
|
+
// `cc crosschain estimate-fee` passes parseFloat(amount); a non-numeric arg
|
|
655
|
+
// yields NaN. Without this guard percentageFee/totalFee become NaN, the
|
|
656
|
+
// command's `fee === null` check misses it, and it prints "$NaN USD".
|
|
657
|
+
if (!Number.isFinite(amount) || amount <= 0)
|
|
658
|
+
return { fee: null, reason: "invalid_amount" };
|
|
654
659
|
|
|
655
660
|
const baseFee = (BASE_FEE[fromChain] || 1.0) + (BASE_FEE[toChain] || 1.0);
|
|
656
661
|
const percentageFee = amount * (DEFAULT_CONFIG.feePercentage / 100);
|
|
@@ -112,6 +112,153 @@ export function ensureDAOv2Tables(db) {
|
|
|
112
112
|
`);
|
|
113
113
|
}
|
|
114
114
|
|
|
115
|
+
/**
|
|
116
|
+
* Hydrate the in-memory stores from the DB. The CLI is one-shot: _proposals/
|
|
117
|
+
* _votes/_delegations/_treasury/_delegationsV2/_treasuryTxs all start empty each
|
|
118
|
+
* process. Every write dual-writes (Map/obj + INSERT) but every read/mutate is
|
|
119
|
+
* Map-only and nothing SELECTed the tables back — so the ENTIRE dao feature was
|
|
120
|
+
* broken across invocations: vote/execute/allocate threw "not found", stats
|
|
121
|
+
* reported 0, and the treasury deposit was invisible (allocate always
|
|
122
|
+
* "Insufficient"). Call after ensureDAOv2Tables(db).
|
|
123
|
+
*
|
|
124
|
+
* Faithful: proposals' votesFor/votesAgainst/status, votes, legacy delegations,
|
|
125
|
+
* and the treasury balance (DERIVED = Σdeposit − Σallocation, replayed in
|
|
126
|
+
* chronological order so each tx's balanceAfter is reconstructed too).
|
|
127
|
+
*
|
|
128
|
+
* Lossy (defaulted to stay correct/safe — these columns don't exist in the
|
|
129
|
+
* schema): V2 proposal abstain/quadratic-weight tallies → 0; proposal.queueEnd →
|
|
130
|
+
* a far-future sentinel so executeProposalV2 FAILS CLOSED (a null/undefined
|
|
131
|
+
* would make its timelock check `now < NaN` and BYPASS the timelock); V2
|
|
132
|
+
* delegation status/expiresAt → ACTIVE/none (revocation is not persisted).
|
|
133
|
+
*/
|
|
134
|
+
const _REHYDRATE_QUEUE_END_SENTINEL = "9999-12-31T23:59:59.999Z";
|
|
135
|
+
|
|
136
|
+
export function loadFromDb(db) {
|
|
137
|
+
if (!db) return 0;
|
|
138
|
+
ensureDAOv2Tables(db);
|
|
139
|
+
_proposals.clear();
|
|
140
|
+
_votes.clear();
|
|
141
|
+
_delegations.clear();
|
|
142
|
+
_delegationsV2.clear();
|
|
143
|
+
_treasuryTxs.length = 0;
|
|
144
|
+
_treasury.balance = 0;
|
|
145
|
+
_treasury.allocations = [];
|
|
146
|
+
|
|
147
|
+
for (const r of db
|
|
148
|
+
.prepare(
|
|
149
|
+
`SELECT id, title, description, proposer, status, votes_for, votes_against, voting_type, created_at, ends_at, executed_at
|
|
150
|
+
FROM dao_v2_proposals`,
|
|
151
|
+
)
|
|
152
|
+
.all()) {
|
|
153
|
+
_proposals.set(r.id, {
|
|
154
|
+
id: r.id,
|
|
155
|
+
title: r.title,
|
|
156
|
+
description: r.description || "",
|
|
157
|
+
proposer: r.proposer,
|
|
158
|
+
proposerDid: r.proposer, // V2 field mirrors legacy proposer
|
|
159
|
+
type: "standard",
|
|
160
|
+
status: r.status,
|
|
161
|
+
votesFor: Number(r.votes_for) || 0,
|
|
162
|
+
votesAgainst: Number(r.votes_against) || 0,
|
|
163
|
+
votingType: r.voting_type,
|
|
164
|
+
createdAt: r.created_at,
|
|
165
|
+
updatedAt: r.created_at,
|
|
166
|
+
endsAt: r.ends_at,
|
|
167
|
+
executedAt: r.executed_at,
|
|
168
|
+
// Non-persisted V2 fields — default to stay NaN-safe (see fn doc).
|
|
169
|
+
votesAbstain: 0,
|
|
170
|
+
quadraticWeightFor: 0,
|
|
171
|
+
quadraticWeightAgainst: 0,
|
|
172
|
+
quorumReached: false,
|
|
173
|
+
votingStart: null,
|
|
174
|
+
votingEnd: null,
|
|
175
|
+
cancelledAt: null,
|
|
176
|
+
// Fail-closed: a rehydrated QUEUED proposal cannot be executed until it is
|
|
177
|
+
// re-queued (real queueEnd is not persisted). Never bypass the timelock.
|
|
178
|
+
queueEnd: _REHYDRATE_QUEUE_END_SENTINEL,
|
|
179
|
+
});
|
|
180
|
+
}
|
|
181
|
+
|
|
182
|
+
for (const r of db
|
|
183
|
+
.prepare(
|
|
184
|
+
`SELECT id, proposal_id, voter, weight, direction, delegated_from, created_at
|
|
185
|
+
FROM dao_v2_votes`,
|
|
186
|
+
)
|
|
187
|
+
.all()) {
|
|
188
|
+
_votes.set(r.id, {
|
|
189
|
+
id: r.id,
|
|
190
|
+
proposalId: r.proposal_id,
|
|
191
|
+
voter: r.voter,
|
|
192
|
+
voterDid: r.voter, // both read paths (stats uses voter, anti-sybil voterDid)
|
|
193
|
+
weight: Number(r.weight) || 0,
|
|
194
|
+
voteCount: Number(r.weight) || 0,
|
|
195
|
+
direction: r.direction,
|
|
196
|
+
voteType: r.direction,
|
|
197
|
+
delegatedFrom: r.delegated_from,
|
|
198
|
+
createdAt: r.created_at,
|
|
199
|
+
});
|
|
200
|
+
}
|
|
201
|
+
|
|
202
|
+
for (const r of db
|
|
203
|
+
.prepare(
|
|
204
|
+
`SELECT delegator, delegate, weight, created_at FROM dao_v2_delegations`,
|
|
205
|
+
)
|
|
206
|
+
.all()) {
|
|
207
|
+
_delegations.set(r.delegator, {
|
|
208
|
+
delegator: r.delegator,
|
|
209
|
+
delegate: r.delegate,
|
|
210
|
+
weight: Number(r.weight) || 0,
|
|
211
|
+
});
|
|
212
|
+
// Synthesize a V2 record (status/expiresAt are not persisted → default).
|
|
213
|
+
_delegationsV2.set(`deleg:${r.delegator}`, {
|
|
214
|
+
id: `deleg:${r.delegator}`,
|
|
215
|
+
fromDid: r.delegator,
|
|
216
|
+
toDid: r.delegate,
|
|
217
|
+
weight: Number(r.weight) || 0,
|
|
218
|
+
status: DELEGATION_STATUS.ACTIVE,
|
|
219
|
+
expiresAt: null,
|
|
220
|
+
revokedAt: null,
|
|
221
|
+
createdAt: r.created_at,
|
|
222
|
+
});
|
|
223
|
+
}
|
|
224
|
+
|
|
225
|
+
// Treasury: no balance column — derive it by replaying the tx log in
|
|
226
|
+
// chronological order (deposit +, allocation −), reconstructing balanceAfter.
|
|
227
|
+
const treasuryRows = db
|
|
228
|
+
.prepare(
|
|
229
|
+
`SELECT id, type, amount, description, proposal_id, created_at
|
|
230
|
+
FROM dao_v2_treasury ORDER BY created_at ASC`,
|
|
231
|
+
)
|
|
232
|
+
.all();
|
|
233
|
+
for (const r of treasuryRows) {
|
|
234
|
+
const amt = Number(r.amount) || 0;
|
|
235
|
+
if (r.type === TREASURY_TX_TYPE.DEPOSIT) _treasury.balance += amt;
|
|
236
|
+
else if (r.type === TREASURY_TX_TYPE.ALLOCATION) _treasury.balance -= amt;
|
|
237
|
+
_treasuryTxs.push({
|
|
238
|
+
id: r.id,
|
|
239
|
+
txType: r.type,
|
|
240
|
+
proposalId: r.proposal_id,
|
|
241
|
+
amount: amt,
|
|
242
|
+
memo: r.description || "",
|
|
243
|
+
balanceAfter: _treasury.balance,
|
|
244
|
+
createdAt: r.created_at,
|
|
245
|
+
});
|
|
246
|
+
if (r.type === TREASURY_TX_TYPE.ALLOCATION) {
|
|
247
|
+
_treasury.allocations.push({
|
|
248
|
+
id: r.id,
|
|
249
|
+
proposalId: r.proposal_id,
|
|
250
|
+
amount: amt,
|
|
251
|
+
description: r.description || "",
|
|
252
|
+
date: r.created_at,
|
|
253
|
+
});
|
|
254
|
+
}
|
|
255
|
+
}
|
|
256
|
+
|
|
257
|
+
return (
|
|
258
|
+
_proposals.size + _votes.size + _delegations.size + _treasuryTxs.length
|
|
259
|
+
);
|
|
260
|
+
}
|
|
261
|
+
|
|
115
262
|
/* ── Proposals ─────────────────────────────────────────────── */
|
|
116
263
|
|
|
117
264
|
export function propose(db, title, description, proposer, options = {}) {
|
|
@@ -259,7 +406,8 @@ export function getTreasury() {
|
|
|
259
406
|
|
|
260
407
|
export function allocate(db, proposalId, amount, description) {
|
|
261
408
|
if (!proposalId) throw new Error("Proposal ID is required");
|
|
262
|
-
if (amount
|
|
409
|
+
if (!Number.isFinite(amount) || amount <= 0)
|
|
410
|
+
throw new Error("Amount must be positive");
|
|
263
411
|
if (_treasury.balance < amount) {
|
|
264
412
|
throw new Error("Insufficient treasury balance");
|
|
265
413
|
}
|
|
@@ -287,7 +435,8 @@ export function allocate(db, proposalId, amount, description) {
|
|
|
287
435
|
}
|
|
288
436
|
|
|
289
437
|
export function depositToTreasury(db, amount, description) {
|
|
290
|
-
if (amount
|
|
438
|
+
if (!Number.isFinite(amount) || amount <= 0)
|
|
439
|
+
throw new Error("Amount must be positive");
|
|
291
440
|
|
|
292
441
|
const id = `dep-${Date.now()}-${crypto.randomBytes(4).toString("hex")}`;
|
|
293
442
|
const now = new Date().toISOString();
|
package/src/lib/did-manager.js
CHANGED
|
@@ -163,16 +163,29 @@ export function setDefaultIdentity(db, did) {
|
|
|
163
163
|
const identity = getIdentity(db, did);
|
|
164
164
|
if (!identity) return false;
|
|
165
165
|
|
|
166
|
-
// Clear the current default(s)
|
|
167
|
-
// so there's no wildcard pattern here
|
|
168
|
-
// LIKE-injection — the target below
|
|
169
|
-
|
|
170
|
-
|
|
171
|
-
|
|
172
|
-
|
|
173
|
-
|
|
174
|
-
|
|
175
|
-
)
|
|
166
|
+
// Clear the current default(s) then set the new one atomically. Match on
|
|
167
|
+
// is_default rather than `did LIKE '%'` so there's no wildcard pattern here
|
|
168
|
+
// that a reader/scanner could mistake for LIKE-injection — the target below
|
|
169
|
+
// is set via exact `did = ?` regardless.
|
|
170
|
+
//
|
|
171
|
+
// The two UPDATEs must both land: without a transaction, a failure on the
|
|
172
|
+
// second leaves EVERY identity non-default (the default DID silently
|
|
173
|
+
// disappears until manually re-set), breaking the exactly-one-default
|
|
174
|
+
// invariant.
|
|
175
|
+
const applyWrites = () => {
|
|
176
|
+
db.prepare(
|
|
177
|
+
"UPDATE did_identities SET is_default = 0 WHERE is_default = 1",
|
|
178
|
+
).run();
|
|
179
|
+
db.prepare("UPDATE did_identities SET is_default = ? WHERE did = ?").run(
|
|
180
|
+
1,
|
|
181
|
+
identity.did,
|
|
182
|
+
);
|
|
183
|
+
};
|
|
184
|
+
if (db && typeof db.transaction === "function") {
|
|
185
|
+
db.transaction(applyWrites)();
|
|
186
|
+
} else {
|
|
187
|
+
applyWrites();
|
|
188
|
+
}
|
|
176
189
|
return true;
|
|
177
190
|
}
|
|
178
191
|
|
package/src/lib/dlp-engine.js
CHANGED
|
@@ -325,6 +325,76 @@ export function _resetState() {
|
|
|
325
325
|
_v2IncidentMeta.clear();
|
|
326
326
|
}
|
|
327
327
|
|
|
328
|
+
/**
|
|
329
|
+
* Rehydrate the in-memory _policies/_incidents Maps from the persisted dlp_*
|
|
330
|
+
* tables. The CLI runs each `cc dlp` subcommand in a fresh node process, so both
|
|
331
|
+
* Maps start empty every invocation. createPolicy/scanContent dual-write (Map +
|
|
332
|
+
* INSERT into dlp_policies/dlp_incidents) but every read (listDLPPolicies/
|
|
333
|
+
* listIncidents/getDLPStats + the scanContent enforcement loop over _policies)
|
|
334
|
+
* is Map-only and nothing SELECTed the tables back.
|
|
335
|
+
*
|
|
336
|
+
* SECURITY IMPACT: `cc dlp scan` iterates an empty _policies → matches nothing →
|
|
337
|
+
* returns allowed:true, so a BLOCK policy created in a prior invocation silently
|
|
338
|
+
* never enforces. Persisted policies were also un-listable and un-deletable
|
|
339
|
+
* (`policy delete`/`resolve` threw "not found"). Call after ensureDLPTables(db).
|
|
340
|
+
*/
|
|
341
|
+
export function loadFromDb(db) {
|
|
342
|
+
if (!db) return 0;
|
|
343
|
+
ensureDLPTables(db);
|
|
344
|
+
_policies.clear();
|
|
345
|
+
_incidents.clear();
|
|
346
|
+
|
|
347
|
+
const parse = (v, fallback) => {
|
|
348
|
+
try {
|
|
349
|
+
return v ? JSON.parse(v) : fallback;
|
|
350
|
+
} catch {
|
|
351
|
+
return fallback;
|
|
352
|
+
}
|
|
353
|
+
};
|
|
354
|
+
|
|
355
|
+
for (const r of db
|
|
356
|
+
.prepare(
|
|
357
|
+
`SELECT id, name, patterns, keywords, action, severity, enabled, created_at
|
|
358
|
+
FROM dlp_policies ORDER BY created_at ASC`,
|
|
359
|
+
)
|
|
360
|
+
.all()) {
|
|
361
|
+
_policies.set(r.id, {
|
|
362
|
+
id: r.id,
|
|
363
|
+
name: r.name,
|
|
364
|
+
patterns: parse(r.patterns, []),
|
|
365
|
+
keywords: parse(r.keywords, []),
|
|
366
|
+
action: r.action,
|
|
367
|
+
severity: r.severity,
|
|
368
|
+
enabled: !!r.enabled,
|
|
369
|
+
createdAt: r.created_at,
|
|
370
|
+
});
|
|
371
|
+
}
|
|
372
|
+
|
|
373
|
+
for (const r of db
|
|
374
|
+
.prepare(
|
|
375
|
+
`SELECT id, policy_id, channel, action_taken, content_hash, matched_patterns,
|
|
376
|
+
severity, user_id, created_at, resolved_at, resolution
|
|
377
|
+
FROM dlp_incidents ORDER BY created_at ASC`,
|
|
378
|
+
)
|
|
379
|
+
.all()) {
|
|
380
|
+
_incidents.set(r.id, {
|
|
381
|
+
id: r.id,
|
|
382
|
+
policyId: r.policy_id,
|
|
383
|
+
channel: r.channel,
|
|
384
|
+
actionTaken: r.action_taken,
|
|
385
|
+
contentHash: r.content_hash,
|
|
386
|
+
matchedPatterns: parse(r.matched_patterns, []),
|
|
387
|
+
severity: r.severity,
|
|
388
|
+
userId: r.user_id,
|
|
389
|
+
createdAt: r.created_at,
|
|
390
|
+
resolvedAt: r.resolved_at ?? null,
|
|
391
|
+
resolution: r.resolution ?? null,
|
|
392
|
+
});
|
|
393
|
+
}
|
|
394
|
+
|
|
395
|
+
return _policies.size + _incidents.size;
|
|
396
|
+
}
|
|
397
|
+
|
|
328
398
|
// ═══════════════════════════════════════════════════════════════
|
|
329
399
|
// V2 Canonical Surface (Phase 50)
|
|
330
400
|
// ═══════════════════════════════════════════════════════════════
|
package/src/lib/eval/runner.js
CHANGED
|
@@ -18,6 +18,7 @@
|
|
|
18
18
|
import fs from "fs";
|
|
19
19
|
import os from "os";
|
|
20
20
|
import path from "path";
|
|
21
|
+
import crypto from "crypto";
|
|
21
22
|
|
|
22
23
|
export const _deps = {
|
|
23
24
|
mkdtempSync: fs.mkdtempSync,
|
|
@@ -25,6 +26,55 @@ export const _deps = {
|
|
|
25
26
|
now: () => Date.now(),
|
|
26
27
|
};
|
|
27
28
|
|
|
29
|
+
/**
|
|
30
|
+
* Content-hash every file under `dir` → Map<relPath (forward-slash), sha1>. Used
|
|
31
|
+
* to measure edit locality: snapshot after setup (the baseline the agent starts
|
|
32
|
+
* from) vs after the agent runs, so we can see EXACTLY which files it touched.
|
|
33
|
+
*/
|
|
34
|
+
function snapshotWorkspace(dir) {
|
|
35
|
+
const out = new Map();
|
|
36
|
+
const walk = (cur) => {
|
|
37
|
+
let entries;
|
|
38
|
+
try {
|
|
39
|
+
entries = fs.readdirSync(cur, { withFileTypes: true });
|
|
40
|
+
} catch {
|
|
41
|
+
return;
|
|
42
|
+
}
|
|
43
|
+
for (const e of entries) {
|
|
44
|
+
const full = path.join(cur, e.name);
|
|
45
|
+
if (e.isDirectory()) {
|
|
46
|
+
walk(full);
|
|
47
|
+
} else if (e.isFile()) {
|
|
48
|
+
const rel = path.relative(dir, full).split(path.sep).join("/");
|
|
49
|
+
let hash;
|
|
50
|
+
try {
|
|
51
|
+
hash = crypto
|
|
52
|
+
.createHash("sha1")
|
|
53
|
+
.update(fs.readFileSync(full))
|
|
54
|
+
.digest("hex");
|
|
55
|
+
} catch {
|
|
56
|
+
hash = "?"; // unreadable → treat as its own value (still "changed" if it flips)
|
|
57
|
+
}
|
|
58
|
+
out.set(rel, hash);
|
|
59
|
+
}
|
|
60
|
+
}
|
|
61
|
+
};
|
|
62
|
+
walk(dir);
|
|
63
|
+
return out;
|
|
64
|
+
}
|
|
65
|
+
|
|
66
|
+
/** Relative paths that were created, modified, or deleted between two snapshots. */
|
|
67
|
+
function diffSnapshots(before, after) {
|
|
68
|
+
const changed = new Set();
|
|
69
|
+
for (const [p, h] of after) {
|
|
70
|
+
if (!before.has(p) || before.get(p) !== h) changed.add(p); // created / modified
|
|
71
|
+
}
|
|
72
|
+
for (const p of before.keys()) {
|
|
73
|
+
if (!after.has(p)) changed.add(p); // deleted
|
|
74
|
+
}
|
|
75
|
+
return [...changed].sort();
|
|
76
|
+
}
|
|
77
|
+
|
|
28
78
|
/**
|
|
29
79
|
* Run a suite of eval tasks and score them.
|
|
30
80
|
*
|
|
@@ -77,6 +127,9 @@ export async function runEvalSuite(tasks, opts = {}) {
|
|
|
77
127
|
if (typeof task.setup === "function") {
|
|
78
128
|
await task.setup(dir);
|
|
79
129
|
}
|
|
130
|
+
// Baseline AFTER setup, BEFORE the agent — so the diff is exactly the
|
|
131
|
+
// agent's edits (not the task's starting files).
|
|
132
|
+
const before = snapshotWorkspace(dir);
|
|
80
133
|
let agentResult;
|
|
81
134
|
try {
|
|
82
135
|
agentResult = await runAgent({
|
|
@@ -90,6 +143,20 @@ export async function runEvalSuite(tasks, opts = {}) {
|
|
|
90
143
|
rec.error = `agent error: ${agentErr.message}`;
|
|
91
144
|
}
|
|
92
145
|
rec.agentOk = agentResult ? agentResult.ok !== false : false;
|
|
146
|
+
// Edit locality — snapshot NOW, before check() (some checks write to the
|
|
147
|
+
// workspace themselves). `unrelatedChanges` = files touched outside the
|
|
148
|
+
// task's declared legitimate surface; null when the task doesn't declare
|
|
149
|
+
// `expectedFiles` (→ excluded from the suite's 无关改动率).
|
|
150
|
+
const changed = diffSnapshots(before, snapshotWorkspace(dir));
|
|
151
|
+
rec.changedFiles = changed;
|
|
152
|
+
if (Array.isArray(task.expectedFiles)) {
|
|
153
|
+
const expected = new Set(
|
|
154
|
+
task.expectedFiles.map((p) => String(p).split(path.sep).join("/")),
|
|
155
|
+
);
|
|
156
|
+
rec.unrelatedChanges = changed.filter((p) => !expected.has(p));
|
|
157
|
+
} else {
|
|
158
|
+
rec.unrelatedChanges = null; // not measured
|
|
159
|
+
}
|
|
93
160
|
const verdict = await task.check(dir, agentResult);
|
|
94
161
|
rec.pass = verdict?.pass === true;
|
|
95
162
|
rec.detail = verdict?.detail || "";
|
|
@@ -136,12 +203,23 @@ export async function runEvalSuite(tasks, opts = {}) {
|
|
|
136
203
|
|
|
137
204
|
const passed = results.filter((r) => r.pass).length;
|
|
138
205
|
const total = results.length;
|
|
206
|
+
// 无关改动率: over tasks that declared expectedFiles, the fraction that
|
|
207
|
+
// touched at least one file outside their legitimate surface. An agent that
|
|
208
|
+
// solves a task but also scribbles on unrelated files scores lower quality.
|
|
209
|
+
const measured = results.filter((r) => Array.isArray(r.unrelatedChanges));
|
|
210
|
+
const tasksWithUnrelatedChanges = measured.filter(
|
|
211
|
+
(r) => r.unrelatedChanges.length > 0,
|
|
212
|
+
).length;
|
|
139
213
|
return {
|
|
140
214
|
results,
|
|
141
215
|
passed,
|
|
142
216
|
failed: total - passed,
|
|
143
217
|
total,
|
|
144
218
|
passRate: total > 0 ? passed / total : 0,
|
|
219
|
+
tasksWithUnrelatedChanges,
|
|
220
|
+
unrelatedChangeRate: measured.length
|
|
221
|
+
? tasksWithUnrelatedChanges / measured.length
|
|
222
|
+
: 0,
|
|
145
223
|
ms: _deps.now() - suiteStart,
|
|
146
224
|
...(recorder ? { telemetry: recorder.summary() } : {}),
|
|
147
225
|
};
|
|
@@ -154,10 +232,20 @@ export function formatEvalReport(summary) {
|
|
|
154
232
|
lines.push(
|
|
155
233
|
`Eval: ${summary.passed}/${summary.total} passed (${pct}%) in ${summary.ms}ms`,
|
|
156
234
|
);
|
|
235
|
+
if (typeof summary.unrelatedChangeRate === "number") {
|
|
236
|
+
const upct = (summary.unrelatedChangeRate * 100).toFixed(1);
|
|
237
|
+
lines.push(
|
|
238
|
+
`Unrelated-change rate: ${upct}% (${summary.tasksWithUnrelatedChanges} task(s) edited files outside their expected surface)`,
|
|
239
|
+
);
|
|
240
|
+
}
|
|
157
241
|
for (const r of summary.results) {
|
|
158
242
|
const mark = r.pass ? "✔" : "✗";
|
|
159
243
|
const detail = r.error ? ` — ${r.error}` : r.detail ? ` — ${r.detail}` : "";
|
|
160
|
-
|
|
244
|
+
const stray =
|
|
245
|
+
Array.isArray(r.unrelatedChanges) && r.unrelatedChanges.length
|
|
246
|
+
? ` [+${r.unrelatedChanges.length} unrelated: ${r.unrelatedChanges.join(", ")}]`
|
|
247
|
+
: "";
|
|
248
|
+
lines.push(` ${mark} ${r.id} (${r.ms}ms)${detail}${stray}`);
|
|
161
249
|
}
|
|
162
250
|
return lines.join("\n");
|
|
163
251
|
}
|