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
package/src/commands/agent.js
CHANGED
|
@@ -177,6 +177,23 @@ export function registerAgentCommand(program) {
|
|
|
177
177
|
"Run shell commands in an ephemeral Docker sandbox (network disabled by default)",
|
|
178
178
|
)
|
|
179
179
|
.option("--sandbox-network", "Allow network access inside --sandbox")
|
|
180
|
+
.option(
|
|
181
|
+
"--otlp <file>",
|
|
182
|
+
"Write the agent run's OpenTelemetry spans (model/tool/retry) as OTLP/JSON to <file>",
|
|
183
|
+
)
|
|
184
|
+
.option(
|
|
185
|
+
"--auto-rewake",
|
|
186
|
+
"When an async `asyncRewake` hook (e.g. a background test) fails at turn end, re-engage the agent to fix it (bounded by --max-rewakes)",
|
|
187
|
+
)
|
|
188
|
+
.option(
|
|
189
|
+
"--auto-pin",
|
|
190
|
+
"During auto-compaction, pin the original task (first user turn) so it always survives compaction (off by default)",
|
|
191
|
+
)
|
|
192
|
+
.option(
|
|
193
|
+
"--max-rewakes <n>",
|
|
194
|
+
"Max auto-rewake re-drives per run (default 1); implies --auto-rewake",
|
|
195
|
+
(v) => parseInt(v, 10),
|
|
196
|
+
)
|
|
180
197
|
.option(
|
|
181
198
|
"--bg, --background",
|
|
182
199
|
"Start as a detached background agent and return its id immediately",
|
|
@@ -252,7 +269,7 @@ export function registerAgentCommand(program) {
|
|
|
252
269
|
)
|
|
253
270
|
.option(
|
|
254
271
|
"--fallback-model <model>",
|
|
255
|
-
"Backup model(s) to try in order when the primary fails (transient error or model-not-found). Repeatable or comma-separated; up to 3. Defaults to config llm.fallbackModels.
|
|
272
|
+
"Backup model(s) to try in order when the primary fails (transient error or model-not-found). Repeatable or comma-separated; up to 3. A `provider:model` entry (e.g. openai:gpt-4o) falls back cross-provider, using that provider's API key from its env var (skipped if unset — never reuses the primary key). Defaults to config llm.fallbackModels.",
|
|
256
273
|
(val, prev) => (prev || []).concat([val]),
|
|
257
274
|
)
|
|
258
275
|
.option(
|
|
@@ -367,27 +384,45 @@ export function registerAgentCommand(program) {
|
|
|
367
384
|
// tree (and parallel sessions) stay untouched. chdir BEFORE everything
|
|
368
385
|
// else so project memory / checkpoint / completion all follow.
|
|
369
386
|
let _worktree = null;
|
|
387
|
+
let _worktreeFinished = false;
|
|
388
|
+
let _finishAgentWorktreeFn = null;
|
|
370
389
|
if (options.worktree) {
|
|
371
390
|
try {
|
|
372
|
-
const { setupAgentWorktree } =
|
|
391
|
+
const { setupAgentWorktree, finishAgentWorktree } =
|
|
373
392
|
await import("../lib/agent-worktree.js");
|
|
393
|
+
_finishAgentWorktreeFn = finishAgentWorktree;
|
|
374
394
|
_worktree = setupAgentWorktree({ cwd: process.cwd() });
|
|
375
395
|
process.chdir(_worktree.path);
|
|
376
396
|
process.stderr.write(
|
|
377
397
|
`worktree: ${_worktree.path} (branch ${_worktree.branch})\n`,
|
|
378
398
|
);
|
|
399
|
+
// The worktree is created BEFORE flag validation, and several
|
|
400
|
+
// `process.exit(1)` guards below (plus any future ones) would skip the
|
|
401
|
+
// normal cleanup and orphan an empty worktree + branch on disk. A sync
|
|
402
|
+
// exit handler guarantees the auto-removable worktree is cleaned up on
|
|
403
|
+
// EVERY exit path (finishAgentWorktree is synchronous). Deduped with
|
|
404
|
+
// the normal async _finishWorktree() via _worktreeFinished.
|
|
405
|
+
process.on("exit", () => {
|
|
406
|
+
if (!_worktree || _worktreeFinished) return;
|
|
407
|
+
_worktreeFinished = true;
|
|
408
|
+
try {
|
|
409
|
+
process.chdir(_worktree.repoRoot);
|
|
410
|
+
_finishAgentWorktreeFn(_worktree);
|
|
411
|
+
} catch {
|
|
412
|
+
/* never block exit */
|
|
413
|
+
}
|
|
414
|
+
});
|
|
379
415
|
} catch (err) {
|
|
380
416
|
process.stderr.write(`--worktree failed: ${err.message}\n`);
|
|
381
417
|
process.exit(1);
|
|
382
418
|
}
|
|
383
419
|
}
|
|
384
420
|
const _finishWorktree = async () => {
|
|
385
|
-
if (!_worktree) return;
|
|
421
|
+
if (!_worktree || _worktreeFinished) return;
|
|
422
|
+
_worktreeFinished = true;
|
|
386
423
|
try {
|
|
387
|
-
const { finishAgentWorktree } =
|
|
388
|
-
await import("../lib/agent-worktree.js");
|
|
389
424
|
process.chdir(_worktree.repoRoot); // release the dir before removal
|
|
390
|
-
const fin =
|
|
425
|
+
const fin = _finishAgentWorktreeFn(_worktree);
|
|
391
426
|
process.stderr.write(
|
|
392
427
|
fin.removed
|
|
393
428
|
? `worktree removed (${fin.reason}).\n`
|
|
@@ -509,6 +544,7 @@ export function registerAgentCommand(program) {
|
|
|
509
544
|
// over a settings model. Applied once here so every branch (headless +
|
|
510
545
|
// interactive, which all read options.model) picks it up; env vars are
|
|
511
546
|
// set on the process so the agent loop + child tools inherit them.
|
|
547
|
+
let settingsSandbox = null;
|
|
512
548
|
try {
|
|
513
549
|
const { loadSettingsConfig } =
|
|
514
550
|
await import("../lib/settings-loader.cjs");
|
|
@@ -520,6 +556,7 @@ export function registerAgentCommand(program) {
|
|
|
520
556
|
process.env[k] = v;
|
|
521
557
|
}
|
|
522
558
|
if (!options.model && sc.model) options.model = sc.model;
|
|
559
|
+
settingsSandbox = sc.sandbox || null;
|
|
523
560
|
} catch {
|
|
524
561
|
// settings overrides are best-effort 鈥?never block the run
|
|
525
562
|
}
|
|
@@ -651,10 +688,22 @@ export function registerAgentCommand(program) {
|
|
|
651
688
|
const fallbackChatFn = fallbackModels.length
|
|
652
689
|
? makeFallbackChatFn({
|
|
653
690
|
fallbackModels,
|
|
654
|
-
onFallback: ({
|
|
655
|
-
|
|
656
|
-
|
|
657
|
-
|
|
691
|
+
onFallback: ({
|
|
692
|
+
from,
|
|
693
|
+
to,
|
|
694
|
+
error,
|
|
695
|
+
skipped,
|
|
696
|
+
reason,
|
|
697
|
+
crossProvider,
|
|
698
|
+
}) =>
|
|
699
|
+
skipped
|
|
700
|
+
? process.stderr.write(
|
|
701
|
+
`Note: fallback "${to}" skipped (${reason}).\n`,
|
|
702
|
+
)
|
|
703
|
+
: process.stderr.write(
|
|
704
|
+
`Note: model "${from}" failed (${error}); retrying with ` +
|
|
705
|
+
`${crossProvider ? "cross-provider " : ""}fallback "${to}".\n`,
|
|
706
|
+
),
|
|
658
707
|
})
|
|
659
708
|
: undefined;
|
|
660
709
|
|
|
@@ -822,6 +871,7 @@ export function registerAgentCommand(program) {
|
|
|
822
871
|
const agentSandbox = normalizeAgentSandbox(options.sandbox, {
|
|
823
872
|
cwd: process.cwd(),
|
|
824
873
|
network: options.sandboxNetwork === true,
|
|
874
|
+
settings: settingsSandbox,
|
|
825
875
|
});
|
|
826
876
|
// Resume requested onto a session with no headless (JSONL) transcript?
|
|
827
877
|
// Warn instead of silently starting empty 鈥?headless resume rebuilds
|
|
@@ -864,6 +914,16 @@ export function registerAgentCommand(program) {
|
|
|
864
914
|
additionalDirectories,
|
|
865
915
|
sandbox: agentSandbox,
|
|
866
916
|
autoCheckpoint,
|
|
917
|
+
// --otlp <file>: capture + export the run's OTel spans as OTLP/JSON.
|
|
918
|
+
otlp: options.otlp || null,
|
|
919
|
+
// --auto-rewake / --max-rewakes: bounded re-drive on async-hook failure.
|
|
920
|
+
// --max-rewakes implies --auto-rewake (a positive budget turns it on).
|
|
921
|
+
autoRewake:
|
|
922
|
+
options.autoRewake === true ||
|
|
923
|
+
(Number.isFinite(options.maxRewakes) && options.maxRewakes > 0),
|
|
924
|
+
maxRewakes: Number.isFinite(options.maxRewakes)
|
|
925
|
+
? options.maxRewakes
|
|
926
|
+
: undefined,
|
|
867
927
|
maxTurns,
|
|
868
928
|
// commander maps --no-file-refs 鈫?options.fileRefs === false
|
|
869
929
|
expandFileRefs: options.fileRefs !== false,
|
|
@@ -975,6 +1035,7 @@ export function registerAgentCommand(program) {
|
|
|
975
1035
|
sandbox: normalizeAgentSandbox(options.sandbox, {
|
|
976
1036
|
cwd: process.cwd(),
|
|
977
1037
|
network: options.sandboxNetwork === true,
|
|
1038
|
+
settings: settingsSandbox,
|
|
978
1039
|
}),
|
|
979
1040
|
autoCheckpoint,
|
|
980
1041
|
// --vim: start the REPL in vim-mode editing (also CC_VIM=1 or /vim).
|
package/src/commands/audit.js
CHANGED
|
@@ -450,8 +450,10 @@ export function registerAuditCommand(program) {
|
|
|
450
450
|
.option("-r, --risk-level <rl>", "Risk level")
|
|
451
451
|
.option("-i, --ip-address <ip>", "IP address")
|
|
452
452
|
.option("-u, --user-agent <ua>", "User agent")
|
|
453
|
-
.action((logId, opts) => {
|
|
454
|
-
|
|
453
|
+
.action(async (logId, opts) => {
|
|
454
|
+
// await bootstrap() (it's async): the prior sync `bootstrap()` left an
|
|
455
|
+
// unawaited Promise and raced teardown against an unresolved init.
|
|
456
|
+
const db = (await bootstrap({ verbose: program.opts().verbose })).db;
|
|
455
457
|
try {
|
|
456
458
|
const details = parseJsonOption(opts.details, "--details");
|
|
457
459
|
const entry = logEventV2(db, {
|
|
@@ -467,7 +469,7 @@ export function registerAuditCommand(program) {
|
|
|
467
469
|
});
|
|
468
470
|
logger.log(JSON.stringify(entry, null, 2));
|
|
469
471
|
} finally {
|
|
470
|
-
shutdown();
|
|
472
|
+
await shutdown();
|
|
471
473
|
}
|
|
472
474
|
});
|
|
473
475
|
|
|
@@ -487,15 +489,17 @@ export function registerAuditCommand(program) {
|
|
|
487
489
|
.command("set-log-status-v2 <log-id> <status>")
|
|
488
490
|
.description("V2: transition log status (active|archived|purged)")
|
|
489
491
|
.option("-r, --reason <reason>", "Reason")
|
|
490
|
-
.action((logId, status, opts) => {
|
|
491
|
-
|
|
492
|
+
.action(async (logId, status, opts) => {
|
|
493
|
+
// await bootstrap() (it's async): the prior sync `bootstrap()` left an
|
|
494
|
+
// unawaited Promise and raced teardown against an unresolved init.
|
|
495
|
+
const db = (await bootstrap({ verbose: program.opts().verbose })).db;
|
|
492
496
|
try {
|
|
493
497
|
const entry = setLogStatusV2(db, logId, status, {
|
|
494
498
|
reason: opts.reason,
|
|
495
499
|
});
|
|
496
500
|
logger.log(JSON.stringify(entry, null, 2));
|
|
497
501
|
} finally {
|
|
498
|
-
shutdown();
|
|
502
|
+
await shutdown();
|
|
499
503
|
}
|
|
500
504
|
});
|
|
501
505
|
|
|
@@ -510,26 +514,30 @@ export function registerAuditCommand(program) {
|
|
|
510
514
|
audit
|
|
511
515
|
.command("auto-archive-logs")
|
|
512
516
|
.description("V2: bulk-flip stale ACTIVE logs → ARCHIVED")
|
|
513
|
-
.action(() => {
|
|
514
|
-
|
|
517
|
+
.action(async () => {
|
|
518
|
+
// await bootstrap() (it's async): the prior sync `bootstrap()` left an
|
|
519
|
+
// unawaited Promise and raced teardown against an unresolved init.
|
|
520
|
+
const db = (await bootstrap({ verbose: program.opts().verbose })).db;
|
|
515
521
|
try {
|
|
516
522
|
const archived = autoArchiveLogs(db);
|
|
517
523
|
logger.log(`Archived ${archived.length} log(s)`);
|
|
518
524
|
} finally {
|
|
519
|
-
shutdown();
|
|
525
|
+
await shutdown();
|
|
520
526
|
}
|
|
521
527
|
});
|
|
522
528
|
|
|
523
529
|
audit
|
|
524
530
|
.command("auto-purge-logs")
|
|
525
531
|
.description("V2: bulk-flip stale ARCHIVED logs → PURGED")
|
|
526
|
-
.action(() => {
|
|
527
|
-
|
|
532
|
+
.action(async () => {
|
|
533
|
+
// await bootstrap() (it's async): the prior sync `bootstrap()` left an
|
|
534
|
+
// unawaited Promise and raced teardown against an unresolved init.
|
|
535
|
+
const db = (await bootstrap({ verbose: program.opts().verbose })).db;
|
|
528
536
|
try {
|
|
529
537
|
const purged = autoPurgeLogs(db);
|
|
530
538
|
logger.log(`Purged ${purged.length} log(s)`);
|
|
531
539
|
} finally {
|
|
532
|
-
shutdown();
|
|
540
|
+
await shutdown();
|
|
533
541
|
}
|
|
534
542
|
});
|
|
535
543
|
|
|
@@ -552,8 +560,10 @@ export function registerAuditCommand(program) {
|
|
|
552
560
|
)
|
|
553
561
|
.option("-r, --reason <reason>", "Reason")
|
|
554
562
|
.option("-m, --metadata <meta>", "Metadata (JSON)")
|
|
555
|
-
.action((alertId, status, opts) => {
|
|
556
|
-
|
|
563
|
+
.action(async (alertId, status, opts) => {
|
|
564
|
+
// await bootstrap() (it's async): the prior sync `bootstrap()` left an
|
|
565
|
+
// unawaited Promise and raced teardown against an unresolved init.
|
|
566
|
+
const db = (await bootstrap({ verbose: program.opts().verbose })).db;
|
|
557
567
|
try {
|
|
558
568
|
const metadata = parseJsonOption(opts.metadata, "--metadata");
|
|
559
569
|
const entry = setAlertStatusV2(db, alertId, status, {
|
|
@@ -562,7 +572,7 @@ export function registerAuditCommand(program) {
|
|
|
562
572
|
});
|
|
563
573
|
logger.log(JSON.stringify(entry, null, 2));
|
|
564
574
|
} finally {
|
|
565
|
-
shutdown();
|
|
575
|
+
await shutdown();
|
|
566
576
|
}
|
|
567
577
|
});
|
|
568
578
|
|
|
@@ -570,13 +580,15 @@ export function registerAuditCommand(program) {
|
|
|
570
580
|
.command("acknowledge-alert <alert-id>")
|
|
571
581
|
.description("V2: shortcut → acknowledged")
|
|
572
582
|
.option("-r, --reason <reason>", "Reason")
|
|
573
|
-
.action((alertId, opts) => {
|
|
574
|
-
|
|
583
|
+
.action(async (alertId, opts) => {
|
|
584
|
+
// await bootstrap() (it's async): the prior sync `bootstrap()` left an
|
|
585
|
+
// unawaited Promise and raced teardown against an unresolved init.
|
|
586
|
+
const db = (await bootstrap({ verbose: program.opts().verbose })).db;
|
|
575
587
|
try {
|
|
576
588
|
const entry = acknowledgeAlert(db, alertId, opts.reason);
|
|
577
589
|
logger.log(JSON.stringify(entry, null, 2));
|
|
578
590
|
} finally {
|
|
579
|
-
shutdown();
|
|
591
|
+
await shutdown();
|
|
580
592
|
}
|
|
581
593
|
});
|
|
582
594
|
|
|
@@ -584,13 +596,15 @@ export function registerAuditCommand(program) {
|
|
|
584
596
|
.command("resolve-alert <alert-id>")
|
|
585
597
|
.description("V2: shortcut → resolved")
|
|
586
598
|
.option("-r, --reason <reason>", "Reason")
|
|
587
|
-
.action((alertId, opts) => {
|
|
588
|
-
|
|
599
|
+
.action(async (alertId, opts) => {
|
|
600
|
+
// await bootstrap() (it's async): the prior sync `bootstrap()` left an
|
|
601
|
+
// unawaited Promise and raced teardown against an unresolved init.
|
|
602
|
+
const db = (await bootstrap({ verbose: program.opts().verbose })).db;
|
|
589
603
|
try {
|
|
590
604
|
const entry = resolveAlert(db, alertId, opts.reason);
|
|
591
605
|
logger.log(JSON.stringify(entry, null, 2));
|
|
592
606
|
} finally {
|
|
593
|
-
shutdown();
|
|
607
|
+
await shutdown();
|
|
594
608
|
}
|
|
595
609
|
});
|
|
596
610
|
|
|
@@ -598,13 +612,15 @@ export function registerAuditCommand(program) {
|
|
|
598
612
|
.command("dismiss-alert <alert-id>")
|
|
599
613
|
.description("V2: shortcut → dismissed")
|
|
600
614
|
.option("-r, --reason <reason>", "Reason")
|
|
601
|
-
.action((alertId, opts) => {
|
|
602
|
-
|
|
615
|
+
.action(async (alertId, opts) => {
|
|
616
|
+
// await bootstrap() (it's async): the prior sync `bootstrap()` left an
|
|
617
|
+
// unawaited Promise and raced teardown against an unresolved init.
|
|
618
|
+
const db = (await bootstrap({ verbose: program.opts().verbose })).db;
|
|
603
619
|
try {
|
|
604
620
|
const entry = dismissAlert(db, alertId, opts.reason);
|
|
605
621
|
logger.log(JSON.stringify(entry, null, 2));
|
|
606
622
|
} finally {
|
|
607
|
-
shutdown();
|
|
623
|
+
await shutdown();
|
|
608
624
|
}
|
|
609
625
|
});
|
|
610
626
|
|
|
@@ -0,0 +1,320 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* cc code-intel — semantic code navigation via the Language Server Protocol.
|
|
3
|
+
*
|
|
4
|
+
* End-to-end surface for the LSP code-intelligence layer (Phase 2 of the CLI
|
|
5
|
+
* optimization plan). Proves the stack works without touching the contended
|
|
6
|
+
* agent-core; the agent `code_intelligence` tool is wired separately.
|
|
7
|
+
*
|
|
8
|
+
* cc code-intel status # which servers are installed
|
|
9
|
+
* cc code-intel def <file> <line> <col> # go to definition
|
|
10
|
+
* cc code-intel refs <file> <line> <col> # find references
|
|
11
|
+
* cc code-intel hover <file> <line> <col> # type / doc info
|
|
12
|
+
* cc code-intel symbols <file> # document symbols
|
|
13
|
+
* cc code-intel wsymbols <query> # workspace symbol search
|
|
14
|
+
* cc code-intel diag <file> # diagnostics
|
|
15
|
+
* cc code-intel rename <file> <line> <col> <newName> # preview a rename
|
|
16
|
+
*
|
|
17
|
+
* Positions are 1-based (line/col), matching editor gutters.
|
|
18
|
+
*/
|
|
19
|
+
|
|
20
|
+
import chalk from "chalk";
|
|
21
|
+
import { logger } from "../lib/logger.js";
|
|
22
|
+
|
|
23
|
+
function num(v, name) {
|
|
24
|
+
const n = Number.parseInt(v, 10);
|
|
25
|
+
if (!Number.isFinite(n) || n < 1) {
|
|
26
|
+
throw new Error(`${name} must be a positive integer (1-based), got "${v}"`);
|
|
27
|
+
}
|
|
28
|
+
return n;
|
|
29
|
+
}
|
|
30
|
+
|
|
31
|
+
async function withCI(fn, { json } = {}) {
|
|
32
|
+
const { CodeIntelligence } = await import("../lib/lsp/code-intelligence.js");
|
|
33
|
+
// coldStart: each CLI invocation spawns a fresh server, so wait for the
|
|
34
|
+
// project to load before querying (the warm agent path leaves this off).
|
|
35
|
+
const ci = new CodeIntelligence({
|
|
36
|
+
projectRoot: process.cwd(),
|
|
37
|
+
coldStart: true,
|
|
38
|
+
});
|
|
39
|
+
try {
|
|
40
|
+
const result = await fn(ci);
|
|
41
|
+
if (json) {
|
|
42
|
+
console.log(JSON.stringify(result, null, 2));
|
|
43
|
+
}
|
|
44
|
+
return result;
|
|
45
|
+
} finally {
|
|
46
|
+
await ci.dispose();
|
|
47
|
+
}
|
|
48
|
+
}
|
|
49
|
+
|
|
50
|
+
function reportUnavailable(res) {
|
|
51
|
+
logger.warn(
|
|
52
|
+
chalk.yellow(`LSP unavailable: ${res.reason}`) +
|
|
53
|
+
chalk.gray(
|
|
54
|
+
"\n → falling back to text search (`cc search` / agent search_files)",
|
|
55
|
+
),
|
|
56
|
+
);
|
|
57
|
+
process.exitCode = 3;
|
|
58
|
+
}
|
|
59
|
+
|
|
60
|
+
function fmtLoc(l) {
|
|
61
|
+
const pos = `${chalk.cyan(l.file)}:${chalk.yellow(l.line)}:${l.col}`;
|
|
62
|
+
return l.snippet ? `${pos} ${chalk.gray(l.snippet)}` : pos;
|
|
63
|
+
}
|
|
64
|
+
|
|
65
|
+
/** Right-align a millisecond number in a 6-char column for the bench table. */
|
|
66
|
+
function fmtMs(v) {
|
|
67
|
+
return String(v == null ? "-" : v).padStart(6);
|
|
68
|
+
}
|
|
69
|
+
|
|
70
|
+
export function registerCodeIntelCommand(program) {
|
|
71
|
+
const ci = program
|
|
72
|
+
.command("code-intel")
|
|
73
|
+
.alias("ci")
|
|
74
|
+
.description(
|
|
75
|
+
"Semantic code navigation via LSP (definition/references/symbols/diagnostics)",
|
|
76
|
+
);
|
|
77
|
+
|
|
78
|
+
ci.command("status")
|
|
79
|
+
.description("Show which language servers are installed and detectable")
|
|
80
|
+
.option("--json", "Output as JSON")
|
|
81
|
+
.action(async (options) => {
|
|
82
|
+
const { probeServers, supportedExtensions } =
|
|
83
|
+
await import("../lib/lsp/lsp-server-registry.js");
|
|
84
|
+
// Surface plugin-contributed servers too (Phase 3: .lsp.json).
|
|
85
|
+
const { ensurePluginLspServers } =
|
|
86
|
+
await import("../lib/plugin-runtime/lsp.js");
|
|
87
|
+
ensurePluginLspServers({ cwd: process.cwd() });
|
|
88
|
+
const servers = probeServers(process.cwd());
|
|
89
|
+
if (options.json) {
|
|
90
|
+
console.log(
|
|
91
|
+
JSON.stringify(
|
|
92
|
+
{ servers, extensions: supportedExtensions() },
|
|
93
|
+
null,
|
|
94
|
+
2,
|
|
95
|
+
),
|
|
96
|
+
);
|
|
97
|
+
return;
|
|
98
|
+
}
|
|
99
|
+
logger.log(chalk.bold("LSP servers:"));
|
|
100
|
+
for (const s of servers) {
|
|
101
|
+
const mark = s.available ? chalk.green("✔") : chalk.gray("✖");
|
|
102
|
+
const where = s.available
|
|
103
|
+
? chalk.gray(s.command)
|
|
104
|
+
: chalk.gray("not installed");
|
|
105
|
+
logger.log(` ${mark} ${s.id.padEnd(28)} ${where}`);
|
|
106
|
+
}
|
|
107
|
+
const anyAvail = servers.some((s) => s.available);
|
|
108
|
+
if (!anyAvail) {
|
|
109
|
+
logger.log(
|
|
110
|
+
chalk.yellow(
|
|
111
|
+
"\nNo language servers found. Install one to enable semantic navigation, e.g.:\n",
|
|
112
|
+
) + chalk.gray(" npm i -g typescript-language-server typescript"),
|
|
113
|
+
);
|
|
114
|
+
}
|
|
115
|
+
});
|
|
116
|
+
|
|
117
|
+
ci.command("def <file> <line> <col>")
|
|
118
|
+
.description("Go to definition of the symbol at file:line:col")
|
|
119
|
+
.option("--json", "Output as JSON")
|
|
120
|
+
.action(async (file, line, col, options) => {
|
|
121
|
+
const res = await withCI(
|
|
122
|
+
(c) => c.definition(file, num(line, "line"), num(col, "col")),
|
|
123
|
+
options,
|
|
124
|
+
);
|
|
125
|
+
if (!res.available) return reportUnavailable(res);
|
|
126
|
+
if (options.json) return;
|
|
127
|
+
if (!res.locations.length)
|
|
128
|
+
return logger.log(chalk.gray("No definition found."));
|
|
129
|
+
for (const l of res.locations) logger.log(fmtLoc(l));
|
|
130
|
+
});
|
|
131
|
+
|
|
132
|
+
ci.command("refs <file> <line> <col>")
|
|
133
|
+
.description("Find references to the symbol at file:line:col")
|
|
134
|
+
.option("--no-decl", "Exclude the declaration itself")
|
|
135
|
+
.option("--json", "Output as JSON")
|
|
136
|
+
.action(async (file, line, col, options) => {
|
|
137
|
+
const res = await withCI(
|
|
138
|
+
(c) =>
|
|
139
|
+
c.references(file, num(line, "line"), num(col, "col"), {
|
|
140
|
+
includeDeclaration: options.decl !== false,
|
|
141
|
+
}),
|
|
142
|
+
options,
|
|
143
|
+
);
|
|
144
|
+
if (!res.available) return reportUnavailable(res);
|
|
145
|
+
if (options.json) return;
|
|
146
|
+
logger.log(chalk.bold(`${res.locations.length} reference(s):`));
|
|
147
|
+
for (const l of res.locations) logger.log(" " + fmtLoc(l));
|
|
148
|
+
});
|
|
149
|
+
|
|
150
|
+
ci.command("hover <file> <line> <col>")
|
|
151
|
+
.description("Show type/doc info for the symbol at file:line:col")
|
|
152
|
+
.option("--json", "Output as JSON")
|
|
153
|
+
.action(async (file, line, col, options) => {
|
|
154
|
+
const res = await withCI(
|
|
155
|
+
(c) => c.hover(file, num(line, "line"), num(col, "col")),
|
|
156
|
+
options,
|
|
157
|
+
);
|
|
158
|
+
if (!res.available) return reportUnavailable(res);
|
|
159
|
+
if (options.json) return;
|
|
160
|
+
logger.log(res.contents || chalk.gray("No hover info."));
|
|
161
|
+
});
|
|
162
|
+
|
|
163
|
+
ci.command("symbols <file>")
|
|
164
|
+
.description("List symbols declared in a document")
|
|
165
|
+
.option("--json", "Output as JSON")
|
|
166
|
+
.action(async (file, options) => {
|
|
167
|
+
const res = await withCI((c) => c.documentSymbols(file), options);
|
|
168
|
+
if (!res.available) return reportUnavailable(res);
|
|
169
|
+
if (options.json) return;
|
|
170
|
+
for (const s of res.symbols) {
|
|
171
|
+
const loc = chalk.gray(`${s.line}:${s.col}`);
|
|
172
|
+
const kind = chalk.magenta(s.kind.padEnd(10));
|
|
173
|
+
const container = s.container ? chalk.gray(` (${s.container})`) : "";
|
|
174
|
+
logger.log(` ${loc} ${kind} ${s.name}${container}`);
|
|
175
|
+
}
|
|
176
|
+
});
|
|
177
|
+
|
|
178
|
+
ci.command("wsymbols <query>")
|
|
179
|
+
.description("Search symbols across the workspace by name")
|
|
180
|
+
.option("--json", "Output as JSON")
|
|
181
|
+
.action(async (query, options) => {
|
|
182
|
+
const res = await withCI((c) => c.workspaceSymbols(query), options);
|
|
183
|
+
if (!res.available) return reportUnavailable(res);
|
|
184
|
+
if (options.json) return;
|
|
185
|
+
logger.log(chalk.bold(`${res.symbols.length} symbol(s):`));
|
|
186
|
+
for (const s of res.symbols) {
|
|
187
|
+
logger.log(
|
|
188
|
+
` ${chalk.magenta(s.kind.padEnd(10))} ${s.name} ${chalk.gray(`${s.file}:${s.line}`)}`,
|
|
189
|
+
);
|
|
190
|
+
}
|
|
191
|
+
});
|
|
192
|
+
|
|
193
|
+
ci.command("diag <file>")
|
|
194
|
+
.description("Show diagnostics (errors/warnings) for a file")
|
|
195
|
+
.option(
|
|
196
|
+
"--timeout <ms>",
|
|
197
|
+
"How long to wait for the server to publish",
|
|
198
|
+
"5000",
|
|
199
|
+
)
|
|
200
|
+
.option("--json", "Output as JSON")
|
|
201
|
+
.action(async (file, options) => {
|
|
202
|
+
const res = await withCI(
|
|
203
|
+
(c) =>
|
|
204
|
+
c.diagnostics(file, { timeoutMs: num(options.timeout, "timeout") }),
|
|
205
|
+
options,
|
|
206
|
+
);
|
|
207
|
+
if (!res.available) return reportUnavailable(res);
|
|
208
|
+
if (options.json) return;
|
|
209
|
+
if (!res.diagnostics.length)
|
|
210
|
+
return logger.log(chalk.green("No diagnostics."));
|
|
211
|
+
for (const d of res.diagnostics) {
|
|
212
|
+
const sev =
|
|
213
|
+
d.severity === "error"
|
|
214
|
+
? chalk.red(d.severity)
|
|
215
|
+
: d.severity === "warning"
|
|
216
|
+
? chalk.yellow(d.severity)
|
|
217
|
+
: chalk.gray(d.severity);
|
|
218
|
+
logger.log(
|
|
219
|
+
` ${chalk.gray(`${d.line}:${d.col}`)} ${sev} ${d.message}${d.code ? chalk.gray(` [${d.code}]`) : ""}`,
|
|
220
|
+
);
|
|
221
|
+
}
|
|
222
|
+
});
|
|
223
|
+
|
|
224
|
+
ci.command("rename <file> <line> <col> <newName>")
|
|
225
|
+
.description(
|
|
226
|
+
"Preview a symbol rename across files (does NOT apply the edit)",
|
|
227
|
+
)
|
|
228
|
+
.option("--json", "Output as JSON")
|
|
229
|
+
.action(async (file, line, col, newName, options) => {
|
|
230
|
+
const res = await withCI(
|
|
231
|
+
(c) =>
|
|
232
|
+
c.renamePreview(file, num(line, "line"), num(col, "col"), newName),
|
|
233
|
+
options,
|
|
234
|
+
);
|
|
235
|
+
if (!res.available) return reportUnavailable(res);
|
|
236
|
+
if (options.json) return;
|
|
237
|
+
const total = res.edits.reduce((n, f) => n + f.edits.length, 0);
|
|
238
|
+
logger.log(
|
|
239
|
+
chalk.bold(
|
|
240
|
+
`Rename would touch ${res.edits.length} file(s), ${total} edit(s):`,
|
|
241
|
+
),
|
|
242
|
+
);
|
|
243
|
+
for (const f of res.edits) {
|
|
244
|
+
logger.log(` ${chalk.cyan(f.file)} — ${f.edits.length} edit(s)`);
|
|
245
|
+
for (const e of f.edits) {
|
|
246
|
+
logger.log(chalk.gray(` ${e.line}:${e.col} → "${e.newText}"`));
|
|
247
|
+
}
|
|
248
|
+
}
|
|
249
|
+
logger.log(
|
|
250
|
+
chalk.gray(
|
|
251
|
+
"\n(preview only — apply with your editor or agent edit tools)",
|
|
252
|
+
),
|
|
253
|
+
);
|
|
254
|
+
});
|
|
255
|
+
|
|
256
|
+
ci.command("bench <file>")
|
|
257
|
+
.description(
|
|
258
|
+
"Benchmark startup + per-query latency (and server RSS) against a real file",
|
|
259
|
+
)
|
|
260
|
+
.option("--runs <n>", "Timed iterations per operation", "20")
|
|
261
|
+
.option("--warmup <n>", "Untimed warmup iterations per operation", "2")
|
|
262
|
+
.option("--json", "Output as JSON")
|
|
263
|
+
.action(async (file, options) => {
|
|
264
|
+
const { runLatencyBenchmark } = await import("../lib/lsp/benchmark.js");
|
|
265
|
+
const runs = num(options.runs, "runs");
|
|
266
|
+
const warmup = Number.parseInt(options.warmup, 10);
|
|
267
|
+
const report = await runLatencyBenchmark({
|
|
268
|
+
projectRoot: process.cwd(),
|
|
269
|
+
file,
|
|
270
|
+
runs,
|
|
271
|
+
warmup: Number.isFinite(warmup) && warmup >= 0 ? warmup : 2,
|
|
272
|
+
onProgress: options.json
|
|
273
|
+
? () => {}
|
|
274
|
+
: (m) => process.stderr.write(chalk.gray(` … ${m}\n`)),
|
|
275
|
+
});
|
|
276
|
+
if (!report.available) {
|
|
277
|
+
return reportUnavailable(report);
|
|
278
|
+
}
|
|
279
|
+
if (options.json) {
|
|
280
|
+
console.log(JSON.stringify(report, null, 2));
|
|
281
|
+
return;
|
|
282
|
+
}
|
|
283
|
+
logger.log(chalk.bold(`\nLSP latency — ${chalk.cyan(file)}`));
|
|
284
|
+
logger.log(
|
|
285
|
+
` cold start (spawn + index + first query): ${chalk.yellow(report.coldStartMs + " ms")}`,
|
|
286
|
+
);
|
|
287
|
+
if (report.server) {
|
|
288
|
+
const rss =
|
|
289
|
+
report.server.rssMb != null ? `${report.server.rssMb} MB` : "n/a";
|
|
290
|
+
logger.log(
|
|
291
|
+
` server: ${report.server.serverId} (pid ${report.server.pid ?? "?"}), RSS ${chalk.yellow(rss)}`,
|
|
292
|
+
);
|
|
293
|
+
}
|
|
294
|
+
if (report.probe) {
|
|
295
|
+
logger.log(
|
|
296
|
+
chalk.gray(
|
|
297
|
+
` probe symbol: ${report.probe.name} (${report.probe.kind}) @ ${report.probe.line}:${report.probe.col}`,
|
|
298
|
+
),
|
|
299
|
+
);
|
|
300
|
+
}
|
|
301
|
+
logger.log(
|
|
302
|
+
chalk.bold(
|
|
303
|
+
`\n operation n min median p95 max (warm, ms)`,
|
|
304
|
+
),
|
|
305
|
+
);
|
|
306
|
+
for (const [name, s] of Object.entries(report.ops)) {
|
|
307
|
+
if (s.skipped) {
|
|
308
|
+
logger.log(
|
|
309
|
+
` ${name.padEnd(18)} ${chalk.gray("skipped: " + s.skipped)}`,
|
|
310
|
+
);
|
|
311
|
+
continue;
|
|
312
|
+
}
|
|
313
|
+
logger.log(
|
|
314
|
+
` ${name.padEnd(18)} ${String(s.n).padStart(3)} ${fmtMs(s.min)} ${fmtMs(s.median)} ${fmtMs(s.p95)} ${fmtMs(s.max)}`,
|
|
315
|
+
);
|
|
316
|
+
}
|
|
317
|
+
});
|
|
318
|
+
|
|
319
|
+
return ci;
|
|
320
|
+
}
|
package/src/commands/collab.js
CHANGED
|
@@ -12,6 +12,7 @@ import { logger } from "../lib/logger.js";
|
|
|
12
12
|
import { bootstrap, shutdown } from "../runtime/bootstrap.js";
|
|
13
13
|
import {
|
|
14
14
|
ensureGovernanceTables,
|
|
15
|
+
loadFromDb,
|
|
15
16
|
listDecisionTypes,
|
|
16
17
|
listConflictStrategies,
|
|
17
18
|
listQualityMetrics,
|
|
@@ -69,12 +70,24 @@ function _dbFromCtx(ctx) {
|
|
|
69
70
|
}
|
|
70
71
|
const db = ctx.db.getDatabase();
|
|
71
72
|
ensureGovernanceTables(db);
|
|
73
|
+
loadFromDb(db);
|
|
72
74
|
return db;
|
|
73
75
|
}
|
|
74
76
|
|
|
75
77
|
function _readJsonFile(filePath) {
|
|
76
|
-
|
|
77
|
-
|
|
78
|
+
let raw;
|
|
79
|
+
try {
|
|
80
|
+
raw = fs.readFileSync(filePath, "utf-8");
|
|
81
|
+
} catch (err) {
|
|
82
|
+
// A user-supplied path — surface which file and why instead of the bare
|
|
83
|
+
// global "error: ENOENT ..." with no context.
|
|
84
|
+
throw new Error(`could not read ${filePath}: ${err.message}`);
|
|
85
|
+
}
|
|
86
|
+
try {
|
|
87
|
+
return JSON.parse(raw);
|
|
88
|
+
} catch (err) {
|
|
89
|
+
throw new Error(`${filePath} is not valid JSON: ${err.message}`);
|
|
90
|
+
}
|
|
78
91
|
}
|
|
79
92
|
|
|
80
93
|
function _printDecision(d) {
|