chainlesschain 0.162.147 → 0.162.149

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.
Files changed (257) hide show
  1. package/README.md +1 -1
  2. package/package.json +2 -2
  3. package/src/assets/web-panel/.build-hash +1 -1
  4. package/src/assets/web-panel/assets/{AIOps-DywJ7xTv.js → AIOps-BJif14yR.js} +1 -1
  5. package/src/assets/web-panel/assets/{ActionButton-BTlqcY-q.js → ActionButton-CXek6gJY.js} +1 -1
  6. package/src/assets/web-panel/assets/{Analytics-FdG1Mvwy.js → Analytics-BgQhdAJi.js} +3 -3
  7. package/src/assets/web-panel/assets/{AppLayout-CVsnbvN1.js → AppLayout-DTYl5NtR.js} +5 -5
  8. package/src/assets/web-panel/assets/{Audit-ITdpJ7vR.js → Audit-BzATQAeR.js} +1 -1
  9. package/src/assets/web-panel/assets/{Backup-BfXqnXo1.js → Backup-BzdPEQhL.js} +1 -1
  10. package/src/assets/web-panel/assets/{BaseInput-C09ip3_E.js → BaseInput-BM0KVh8E.js} +1 -1
  11. package/src/assets/web-panel/assets/{Chat-qdkhB42l.js → Chat-D7fHXHkz.js} +6 -6
  12. package/src/assets/web-panel/assets/{ChatBubbleRenderer-D2KfETZD.js → ChatBubbleRenderer-Wm34RR-b.js} +1 -1
  13. package/src/assets/web-panel/assets/{Checkbox-j6WZCuff.js → Checkbox-CAiSQ9vO.js} +1 -1
  14. package/src/assets/web-panel/assets/{Codegen-CGZ-K3uK.js → Codegen-Df40CrEe.js} +1 -1
  15. package/src/assets/web-panel/assets/{Col-CIlPOAu6.js → Col-DIT2fNFU.js} +1 -1
  16. package/src/assets/web-panel/assets/{Community-sY-i-hic.js → Community-CSTIbW2k.js} +1 -1
  17. package/src/assets/web-panel/assets/{Compact-DcoEfyL8.js → Compact-DtqXZZUi.js} +1 -1
  18. package/src/assets/web-panel/assets/Compliance-CUtzw6o7.js +1 -0
  19. package/src/assets/web-panel/assets/{Cowork-DLY_fkLv.js → Cowork-CezmlnmU.js} +3 -3
  20. package/src/assets/web-panel/assets/{Cron-D049pZBC.js → Cron-P4BITarg.js} +2 -2
  21. package/src/assets/web-panel/assets/{Crosschain-DCXdE8M9.js → Crosschain-BRRiYwvq.js} +1 -1
  22. package/src/assets/web-panel/assets/{DID-JCvPZtjW.js → DID-L5ijB9i4.js} +2 -2
  23. package/src/assets/web-panel/assets/{Dashboard-Cg2xu3iE.js → Dashboard-CFxro4ob.js} +2 -2
  24. package/src/assets/web-panel/assets/{Dropdown-DjJLjbLh.js → Dropdown-BmAFCQ71.js} +1 -1
  25. package/src/assets/web-panel/assets/{EmailListRenderer-DugNcSLR.js → EmailListRenderer-DJBCEuon.js} +1 -1
  26. package/src/assets/web-panel/assets/{FamilyGuardDashboard-J6Nb-E30.js → FamilyGuardDashboard-z4oLq6eT.js} +1 -1
  27. package/src/assets/web-panel/assets/{Federation-CQ3Ttpbl.js → Federation-DsVCpHMF.js} +1 -1
  28. package/src/assets/web-panel/assets/{FormItemContext-Cz0NKag4.js → FormItemContext-DP3bP5th.js} +1 -1
  29. package/src/assets/web-panel/assets/{GenericCardRenderer-NYcMP6iz.js → GenericCardRenderer-BAXP2Gc6.js} +1 -1
  30. package/src/assets/web-panel/assets/{Git-B4hYN18N.js → Git-I3g_bAw9.js} +2 -2
  31. package/src/assets/web-panel/assets/{Governance-DOQPCcC0.js → Governance-jHS5-ioS.js} +1 -1
  32. package/src/assets/web-panel/assets/{Inference-HtLF746W.js → Inference-CPL7sfx9.js} +1 -1
  33. package/src/assets/web-panel/assets/{KnowledgeGraph-BXrk8rMm.js → KnowledgeGraph-Jf236h4C.js} +1 -1
  34. package/src/assets/web-panel/assets/{Logs-DS0JnD3-.js → Logs-Cm2tcSKg.js} +2 -2
  35. package/src/assets/web-panel/assets/{Marketplace-Cqnjihrz.js → Marketplace-CZK82rhi.js} +1 -1
  36. package/src/assets/web-panel/assets/{McpTools-Cx3Psk-U.js → McpTools-CZCeji7a.js} +5 -5
  37. package/src/assets/web-panel/assets/{Memory-BjyysPtj.js → Memory-3l2KVS9k.js} +2 -2
  38. package/src/assets/web-panel/assets/MobileBridge-D3Arxfeg.css +1 -0
  39. package/src/assets/web-panel/assets/MobileBridge-VYdpoLh6.js +1 -0
  40. package/src/assets/web-panel/assets/{MobileProjects-Xwf-fdOQ.js → MobileProjects-CiB9cmm1.js} +1 -1
  41. package/src/assets/web-panel/assets/{Mtc-Djkql5m5.js → Mtc-wCFZbBuL.js} +2 -2
  42. package/src/assets/web-panel/assets/{MtcAudit-D2BAZlu0.js → MtcAudit-1a3THIyG.js} +2 -2
  43. package/src/assets/web-panel/assets/{Multisig-ByqP1ZzH.js → Multisig-DMzLB2hG.js} +3 -3
  44. package/src/assets/web-panel/assets/{NLProgramming-C_kn0nE2.js → NLProgramming-D9wZbf6l.js} +1 -1
  45. package/src/assets/web-panel/assets/{Notes-7l7eXHPq.js → Notes-hrFe2ZM-.js} +3 -3
  46. package/src/assets/web-panel/assets/{NotificationSettings-BrCDoitw.js → NotificationSettings-CHGX5Jwm.js} +1 -1
  47. package/src/assets/web-panel/assets/OrderTableRenderer-CRIFE2Tj.js +1 -0
  48. package/src/assets/web-panel/assets/{Organization-DdoNAxsM.js → Organization-By7FkhtY.js} +4 -4
  49. package/src/assets/web-panel/assets/{Overflow-Bw7R6dE3.js → Overflow--khGSzJn.js} +1 -1
  50. package/src/assets/web-panel/assets/{OverrideContext-C2r4vyBb.js → OverrideContext-BlgL9440.js} +1 -1
  51. package/src/assets/web-panel/assets/{P2P-DJNtBugA.js → P2P-CAG9dH35.js} +2 -2
  52. package/src/assets/web-panel/assets/{PdhVaultBrowser-Dwhd5_ue.js → PdhVaultBrowser-B3SQZmK9.js} +3 -3
  53. package/src/assets/web-panel/assets/{Permissions-BYoSfhPR.js → Permissions-D35ec6JA.js} +4 -4
  54. package/src/assets/web-panel/assets/{PersonalDataHub-aYCYJbnH.js → PersonalDataHub-CxBF7hW_.js} +2 -2
  55. package/src/assets/web-panel/assets/{Pipeline-DJp6CprF.js → Pipeline-s6EtOO1s.js} +1 -1
  56. package/src/assets/web-panel/assets/{Privacy-Cq9HZweR.js → Privacy-BbJYmWmO.js} +1 -1
  57. package/src/assets/web-panel/assets/{ProjectInit-CmF0HsSt.js → ProjectInit-VGQq1jMT.js} +2 -2
  58. package/src/assets/web-panel/assets/{ProjectSettings-P8V5Aea2.js → ProjectSettings-B1ew3Teh.js} +2 -2
  59. package/src/assets/web-panel/assets/Projects-CGcNIs_g.js +1 -0
  60. package/src/assets/web-panel/assets/{Providers-D589v0q2.js → Providers-mrO47FIK.js} +1 -1
  61. package/src/assets/web-panel/assets/QrScannerModal-IJF2mHyw.js +1 -0
  62. package/src/assets/web-panel/assets/{MobileBridge-zJpPuf4E.css → QrScannerModal-NwAHNfiJ.css} +1 -1
  63. package/src/assets/web-panel/assets/{QuickAsk-lvRV2osB.js → QuickAsk-CU0wN_Z0.js} +1 -1
  64. package/src/assets/web-panel/assets/{Recommend-sb84MTpY.js → Recommend-DhN37R6G.js} +1 -1
  65. package/src/assets/web-panel/assets/RemoteSession-D_xOX_hu.js +4 -0
  66. package/src/assets/web-panel/assets/{Reputation-d9Y3vy-W.js → Reputation-D_Ssv7uH.js} +1 -1
  67. package/src/assets/web-panel/assets/{Row-DMdhLUTp.js → Row-Kx5dKxX7.js} +1 -1
  68. package/src/assets/web-panel/assets/{RssFeed-OL-SMDkz.js → RssFeed-BlGwqZkY.js} +2 -2
  69. package/src/assets/web-panel/assets/{Search-BjStLKq1.js → Search-hLFQzxpb.js} +1 -1
  70. package/src/assets/web-panel/assets/{Security-MeI411qr.js → Security-DMlvsVt4.js} +2 -2
  71. package/src/assets/web-panel/assets/{Services-UajosuhT.js → Services-Bd0Qsj2m.js} +2 -2
  72. package/src/assets/web-panel/assets/{Skeleton-CGpG-QJ1.js → Skeleton-DFclq9X3.js} +1 -1
  73. package/src/assets/web-panel/assets/{Skills-C6P2RPY-.js → Skills-BNtln2qY.js} +1 -1
  74. package/src/assets/web-panel/assets/{Sla-B_fPprgw.js → Sla-Dch5H19G.js} +1 -1
  75. package/src/assets/web-panel/assets/{SpeechSettings-CqxLjSlQ.js → SpeechSettings-2UfQcU1g.js} +1 -1
  76. package/src/assets/web-panel/assets/{SyncSettings-DixSfFOQ.js → SyncSettings-CD9YQr4i.js} +2 -2
  77. package/src/assets/web-panel/assets/{Tasks-PavzPBxc.js → Tasks-BNu-7MzI.js} +1 -1
  78. package/src/assets/web-panel/assets/{Templates-BYdGRnfX.js → Templates-D1n9CaIR.js} +1 -1
  79. package/src/assets/web-panel/assets/{Tenant-BQLgnarD.js → Tenant-DenL3iBW.js} +1 -1
  80. package/src/assets/web-panel/assets/Terminal-ZzU0Io1Y.js +3 -0
  81. package/src/assets/web-panel/assets/{TimelineRenderer-Bv7uZRM7.js → TimelineRenderer-D87IfukO.js} +1 -1
  82. package/src/assets/web-panel/assets/{Tokens-DxhgszRJ.js → Tokens-BkiZc8E3.js} +1 -1
  83. package/src/assets/web-panel/assets/{Trigger-nQYHayuc.js → Trigger-BNRSytGN.js} +1 -1
  84. package/src/assets/web-panel/assets/{Trust-CvqZDuZ4.js → Trust-Bwbd4X2m.js} +1 -1
  85. package/src/assets/web-panel/assets/{UkeySign-DaR8GV2I.js → UkeySign-B8O2bs0o.js} +1 -1
  86. package/src/assets/web-panel/assets/{VideoEditing-C6Mpsokw.js → VideoEditing-C2fL8zmH.js} +1 -1
  87. package/src/assets/web-panel/assets/{Wallet-B57VRrWc.js → Wallet-BORYDdE1.js} +4 -4
  88. package/src/assets/web-panel/assets/{WebAuthn-BbtEEtpq.js → WebAuthn-C0V5S2FM.js} +4 -4
  89. package/src/assets/web-panel/assets/{WorkflowEditor-C5LwvKmH.js → WorkflowEditor-2dR0fcHL.js} +1 -1
  90. package/src/assets/web-panel/assets/{chat-MzuPR5jh.js → chat-BmuAFAn8.js} +1 -1
  91. package/src/assets/web-panel/assets/{collapseMotion-mxzzcDsg.js → collapseMotion-DVfhbsdP.js} +1 -1
  92. package/src/assets/web-panel/assets/{colors-HyW8mi_y.js → colors-CN3smMcK.js} +1 -1
  93. package/src/assets/web-panel/assets/{compact-item-DvUSzWAp.js → compact-item-DCnxb4kW.js} +1 -1
  94. package/src/assets/web-panel/assets/{createContext-4MppZl7X.js → createContext-vlR43pHn.js} +1 -1
  95. package/src/assets/web-panel/assets/devWarning-DxwmsL4j.js +1 -0
  96. package/src/assets/web-panel/assets/{echarts-jxgIOFUZ.js → echarts-CL0F2SnX.js} +1 -1
  97. package/src/assets/web-panel/assets/{hasIn-D9q3CJ-u.js → hasIn-D04tHYFd.js} +1 -1
  98. package/src/assets/web-panel/assets/{icons-DP3uiYxy.js → icons-BsDmGpcT.js} +1 -1
  99. package/src/assets/web-panel/assets/{index-C9I5MuJ0.js → index-0DnaZGkC.js} +1 -1
  100. package/src/assets/web-panel/assets/{index-Caqtu6Et.js → index-430S68MN.js} +1 -1
  101. package/src/assets/web-panel/assets/{index-eOQO6KnV.js → index-B78xL3s2.js} +1 -1
  102. package/src/assets/web-panel/assets/{index-Ci6adKh8.js → index-BTPEZTk1.js} +1 -1
  103. package/src/assets/web-panel/assets/{index-CifKUNtV.js → index-BXRg8GFQ.js} +1 -1
  104. package/src/assets/web-panel/assets/{index-D7TDMMfu.js → index-BasvsWDM.js} +1 -1
  105. package/src/assets/web-panel/assets/{index-DNYqw0MO.js → index-BeGDEXFs.js} +1 -1
  106. package/src/assets/web-panel/assets/{index-m0b6Fj9q.js → index-BqhASEL4.js} +1 -1
  107. package/src/assets/web-panel/assets/{index-BF2JsbiX.js → index-BudvKQfG.js} +1 -1
  108. package/src/assets/web-panel/assets/{index-DFqvWeGc.js → index-C-6NO5il.js} +1 -1
  109. package/src/assets/web-panel/assets/{index-SDblbKj6.js → index-C5Sxb1sE.js} +1 -1
  110. package/src/assets/web-panel/assets/{index-UUMCA2Sq.js → index-CP9m9Ggr.js} +4 -4
  111. package/src/assets/web-panel/assets/{index--Bm6OqmU.js → index-CTOCnIQ7.js} +1 -1
  112. package/src/assets/web-panel/assets/index-Cg2ldRfU.js +1 -0
  113. package/src/assets/web-panel/assets/{index-Dv7ffI2g.js → index-ClhAHDK3.js} +1 -1
  114. package/src/assets/web-panel/assets/{index-BcunsBIx.js → index-CnXebZLL.js} +1 -1
  115. package/src/assets/web-panel/assets/{index-CvAqCAo9.js → index-CngCC8hC.js} +1 -1
  116. package/src/assets/web-panel/assets/{index-DcMkjb92.js → index-Cr-A0FYJ.js} +1 -1
  117. package/src/assets/web-panel/assets/{index-BFGfC5RS.js → index-CsAsCPJ6.js} +1 -1
  118. package/src/assets/web-panel/assets/{index-DDZ6fP5Z.js → index-D28DeAAB.js} +1 -1
  119. package/src/assets/web-panel/assets/{index-CgIfXOD9.js → index-D5LZVZ0L.js} +1 -1
  120. package/src/assets/web-panel/assets/{index-DmZ6-suL.js → index-D65_XseV.js} +1 -1
  121. package/src/assets/web-panel/assets/{index-Cs-RKRUM.js → index-D8vwp4qp.js} +1 -1
  122. package/src/assets/web-panel/assets/{index-B994UQfE.js → index-DDwLgQY9.js} +1 -1
  123. package/src/assets/web-panel/assets/{index-Btz8pU68.js → index-DIpY0qM5.js} +1 -1
  124. package/src/assets/web-panel/assets/{index-B5E4DhVc.js → index-DTWg-18U.js} +1 -1
  125. package/src/assets/web-panel/assets/{index-D2jrnaq3.js → index-DTtRscUa.js} +1 -1
  126. package/src/assets/web-panel/assets/{index-BmCo2Xdp.js → index-DYAtmqiv.js} +1 -1
  127. package/src/assets/web-panel/assets/{index-Zvtru2oE.js → index-D_n8_vfI.js} +1 -1
  128. package/src/assets/web-panel/assets/{index-CLAZs1Vd.js → index-DbADHwhr.js} +1 -1
  129. package/src/assets/web-panel/assets/{index-CucRo4Vz.js → index-DbVsQBOH.js} +1 -1
  130. package/src/assets/web-panel/assets/index-Dwzo-dtJ.js +1 -0
  131. package/src/assets/web-panel/assets/{index-C0DiL97c.js → index-HhNjnCfe.js} +1 -1
  132. package/src/assets/web-panel/assets/{index-Bl-E4W4q.js → index-ToUh2b1-.js} +1 -1
  133. package/src/assets/web-panel/assets/{index-ryFLxB1p.js → index-TslMTwNy.js} +1 -1
  134. package/src/assets/web-panel/assets/{index-BGQtFso0.js → index-_FIkN3jd.js} +1 -1
  135. package/src/assets/web-panel/assets/{index-zLwYpvX0.js → index-hpvvtAZ3.js} +1 -1
  136. package/src/assets/web-panel/assets/{index-Dvg5xYuP.js → index-jzR7Ujuw.js} +1 -1
  137. package/src/assets/web-panel/assets/{index-xvUVuFnA.js → index-ljuBiQW9.js} +1 -1
  138. package/src/assets/web-panel/assets/{initDefaultProps-CC--PMsC.js → initDefaultProps-C3wUb4je.js} +1 -1
  139. package/src/assets/web-panel/assets/{motion-DdrBjRF1.js → motion-D-jYFUNA.js} +1 -1
  140. package/src/assets/web-panel/assets/{move-D712Gwl2.js → move-tqb8nwJ2.js} +1 -1
  141. package/src/assets/web-panel/assets/{mtc-parser-39y-keKO.js → mtc-parser-DSOjMJMz.js} +1 -1
  142. package/src/assets/web-panel/assets/{omit-6Y51gDB9.js → omit-CJ7VimIW.js} +1 -1
  143. package/src/assets/web-panel/assets/{pickAttrs-Cy6EHbq9.js → pickAttrs-qXiG1iT3.js} +1 -1
  144. package/src/assets/web-panel/assets/{placementArrow-BYxdAm0p.js → placementArrow-CkGBcy1Z.js} +1 -1
  145. package/src/assets/web-panel/assets/{responsiveObserve-C9R6q_cr.js → responsiveObserve-D3WvTlLO.js} +1 -1
  146. package/src/assets/web-panel/assets/{slide-CXUJlilB.js → slide-BEE2ftge.js} +1 -1
  147. package/src/assets/web-panel/assets/{statusUtils-DOtrOeql.js → statusUtils-CsfBpxiG.js} +1 -1
  148. package/src/assets/web-panel/assets/{styleChecker-D5r39o92.js → styleChecker-xPrIiJPI.js} +1 -1
  149. package/src/assets/web-panel/assets/useFlexGapSupport-C5Yd-SCR.js +1 -0
  150. package/src/assets/web-panel/assets/{useFs-BkrT-Zbc.js → useFs-D_MDS8HI.js} +1 -1
  151. package/src/assets/web-panel/assets/{useMergedState-Cl2q1fes.js → useMergedState-Dc9sO2d7.js} +1 -1
  152. package/src/assets/web-panel/assets/{usePersonalDataHub-BwnnnZjU.js → usePersonalDataHub-BqJh-usA.js} +1 -1
  153. package/src/assets/web-panel/assets/{useRefs-DD9q4mOT.js → useRefs-CAeFRzPf.js} +1 -1
  154. package/src/assets/web-panel/assets/{useState-BK4hy8Ma.js → useState-LwExUYDO.js} +1 -1
  155. package/src/assets/web-panel/assets/{vendor-BvqAck49.js → vendor-BMxUs6UX.js} +16 -16
  156. package/src/assets/web-panel/assets/{vnode-SU-N4pum.js → vnode-chm_p-gz.js} +1 -1
  157. package/src/assets/web-panel/assets/{zoom-DHScfpTP.js → zoom-3-YDNz0Z.js} +1 -1
  158. package/src/assets/web-panel/index.html +3 -3
  159. package/src/assets/web-panel/remote-session-sw.js +43 -0
  160. package/src/command-manifest.json +22 -1
  161. package/src/commands/agent.js +44 -5
  162. package/src/commands/codeintel.js +252 -0
  163. package/src/commands/eval.js +248 -0
  164. package/src/commands/plugin.js +354 -0
  165. package/src/commands/serve.js +10 -0
  166. package/src/commands/team.js +456 -0
  167. package/src/gateways/remote-session-relay.js +160 -0
  168. package/src/gateways/ws/message-dispatcher.js +77 -2
  169. package/src/gateways/ws/remote-session-protocol.js +466 -0
  170. package/src/gateways/ws/ws-server.js +299 -0
  171. package/src/harness/golden-transcript.js +65 -0
  172. package/src/harness/mcp-client.js +6 -2
  173. package/src/harness/prompt-compressor.js +27 -1
  174. package/src/harness/remote-command-ledger.js +158 -0
  175. package/src/harness/remote-session-audit-sink.js +132 -0
  176. package/src/harness/remote-session-audit.js +110 -0
  177. package/src/harness/remote-session-crypto.js +217 -0
  178. package/src/harness/remote-session-push-apns.js +246 -0
  179. package/src/harness/remote-session-push-errors.js +15 -0
  180. package/src/harness/remote-session-push-fcm.js +238 -0
  181. package/src/harness/remote-session-push-huawei.js +174 -0
  182. package/src/harness/remote-session-push-oppo.js +171 -0
  183. package/src/harness/remote-session-push-senders.js +42 -0
  184. package/src/harness/remote-session-push-vivo.js +179 -0
  185. package/src/harness/remote-session-push-web.js +299 -0
  186. package/src/harness/remote-session-push-xiaomi.js +99 -0
  187. package/src/harness/remote-session-push.js +104 -0
  188. package/src/harness/remote-session-registry.js +420 -0
  189. package/src/index.js +6 -0
  190. package/src/lib/agent-core.js +2 -0
  191. package/src/lib/agent-sandbox.js +161 -5
  192. package/src/lib/agent-team/task-lease.js +434 -0
  193. package/src/lib/agent-team/team-budget.js +165 -0
  194. package/src/lib/agent-team/team-mailbox.js +106 -0
  195. package/src/lib/agent-team/team-runner.js +266 -0
  196. package/src/lib/agent-team/team-worktree.js +204 -0
  197. package/src/lib/agents.js +18 -0
  198. package/src/lib/async-hook-supervisor.cjs +305 -0
  199. package/src/lib/did-manager.js +6 -4
  200. package/src/lib/eval/runner.js +163 -0
  201. package/src/lib/eval/tasks.js +456 -0
  202. package/src/lib/eval/trend.js +185 -0
  203. package/src/lib/lsp/__tests__/code-intelligence.integration.test.js +129 -0
  204. package/src/lib/lsp/__tests__/code-intelligence.test.js +228 -0
  205. package/src/lib/lsp/__tests__/jsonrpc-stream.test.js +104 -0
  206. package/src/lib/lsp/__tests__/lsp-client.test.js +258 -0
  207. package/src/lib/lsp/__tests__/lsp-manager.test.js +264 -0
  208. package/src/lib/lsp/__tests__/lsp-server-registry.test.js +128 -0
  209. package/src/lib/lsp/code-intelligence.js +356 -0
  210. package/src/lib/lsp/jsonrpc-stream.js +139 -0
  211. package/src/lib/lsp/lsp-client.js +318 -0
  212. package/src/lib/lsp/lsp-manager.js +323 -0
  213. package/src/lib/lsp/lsp-server-registry.js +196 -0
  214. package/src/lib/mcp-oauth.js +23 -6
  215. package/src/lib/plugin-monitor-supervisor.js +238 -0
  216. package/src/lib/plugin-runtime/agents.js +51 -0
  217. package/src/lib/plugin-runtime/bin.js +100 -0
  218. package/src/lib/plugin-runtime/hooks.js +100 -0
  219. package/src/lib/plugin-runtime/install.js +388 -0
  220. package/src/lib/plugin-runtime/lsp.js +75 -0
  221. package/src/lib/plugin-runtime/manifest.js +458 -0
  222. package/src/lib/plugin-runtime/mcp.js +89 -0
  223. package/src/lib/plugin-runtime/monitors.js +100 -0
  224. package/src/lib/plugin-runtime/policy.js +144 -0
  225. package/src/lib/plugin-runtime/reload.js +79 -0
  226. package/src/lib/plugin-runtime/scopes.js +197 -0
  227. package/src/lib/plugin-runtime/settings.js +119 -0
  228. package/src/lib/plugin-runtime/signature.js +107 -0
  229. package/src/lib/plugin-runtime/skills.js +43 -0
  230. package/src/lib/plugin-runtime/trust.js +140 -0
  231. package/src/lib/sandbox-egress-proxy.js +162 -0
  232. package/src/lib/sandbox-network-policy.js +134 -0
  233. package/src/lib/sandbox-v2.js +10 -4
  234. package/src/lib/session-manager.js +7 -3
  235. package/src/lib/settings-hook-events.cjs +78 -6
  236. package/src/lib/settings-hooks.cjs +29 -3
  237. package/src/lib/settings-loader.cjs +35 -1
  238. package/src/lib/skill-loader.js +18 -0
  239. package/src/lib/telemetry/span-recorder.js +237 -0
  240. package/src/repl/agent-repl.js +400 -4
  241. package/src/runtime/agent-core.js +546 -52
  242. package/src/runtime/agent-runtime.js +8 -13
  243. package/src/runtime/coding-agent-contract-shared.cjs +82 -8
  244. package/src/runtime/coding-agent-policy.cjs +32 -7
  245. package/src/runtime/fallback-model.js +134 -7
  246. package/src/runtime/headless-runner.js +353 -108
  247. package/src/runtime/mcp-config.js +46 -0
  248. package/src/runtime/policies/agent-policy.js +2 -0
  249. package/src/assets/web-panel/assets/Compliance-T8EtTecW.js +0 -1
  250. package/src/assets/web-panel/assets/MobileBridge-CYaITZ7w.js +0 -1
  251. package/src/assets/web-panel/assets/OrderTableRenderer-CmtqIdwr.js +0 -1
  252. package/src/assets/web-panel/assets/Projects-DPd5-lNS.js +0 -1
  253. package/src/assets/web-panel/assets/Terminal-BzOHpq-B.js +0 -3
  254. package/src/assets/web-panel/assets/devWarning-6YJJMjSH.js +0 -1
  255. package/src/assets/web-panel/assets/index-D_oeGLr6.js +0 -1
  256. package/src/assets/web-panel/assets/index-Qa57YG19.js +0 -1
  257. package/src/assets/web-panel/assets/useFlexGapSupport-DfAD5U4Z.js +0 -1
@@ -0,0 +1,266 @@
1
+ /**
2
+ * TeamRunner (Phase 4 — Agent Team) — drives a TaskLeaseRegistry with N
3
+ * concurrent teammates, each looping: pick a claimable task → acquire its
4
+ * EXCLUSIVE lease → run it → complete (or fail → retry/cancel). The registry's
5
+ * lease + dependency DAG guarantees the two things a plain worker pool can't:
6
+ * - a task is run by AT MOST ONE teammate at a time (exclusive lease), so no
7
+ * duplicate work even with M teammates racing for the same task;
8
+ * - a task only starts once its dependencies are COMPLETED (DAG gating), and a
9
+ * task whose dependency was CANCELLED never runs (stays blocked).
10
+ *
11
+ * `runTask` is injected so the whole orchestration is unit-testable offline; in
12
+ * production it's wired to a real agent turn (SubAgentContext.run in a
13
+ * per-teammate worktree). Events are emitted for a machine-readable stream /
14
+ * status panel. A total-time / total-task budget bounds a runaway graph.
15
+ */
16
+
17
+ export class TeamRunner {
18
+ /**
19
+ * @param {TaskLeaseRegistry} registry
20
+ * @param {object} opts
21
+ * runTask async ({key, task, holder, renew}) => any (throw = task failed)
22
+ * teammates number of concurrent workers (default 2)
23
+ * ttlMs lease TTL per acquisition
24
+ * onEvent (evt) => void {type, ...}
25
+ * maxTasks safety cap on total task executions (default 1000)
26
+ * now () => ms (for deadline math; defaults to registry clock)
27
+ */
28
+ constructor(registry, opts = {}) {
29
+ this.registry = registry;
30
+ this.runTask = opts.runTask;
31
+ this.teammates = opts.teammates > 0 ? Math.floor(opts.teammates) : 2;
32
+ this.ttlMs = opts.ttlMs;
33
+ this.onEvent = typeof opts.onEvent === "function" ? opts.onEvent : () => {};
34
+ this.maxTasks = opts.maxTasks > 0 ? opts.maxTasks : 1000;
35
+ this._now = opts.now || registry._now || (() => Date.now());
36
+ // Team-wide token/USD/time/task budget (null → unbounded). Consulted before
37
+ // every claim; folded after every settled task.
38
+ this.budget = opts.budget || null;
39
+ // Directed/broadcast messaging between teammates (null → disabled).
40
+ this.mailbox = opts.mailbox || null;
41
+ this._executions = 0;
42
+ this._inFlight = 0;
43
+ this._maxInFlight = 0;
44
+ this._members = new Map(); // holder → lifecycle record
45
+ this._budgetStopped = false;
46
+ }
47
+
48
+ _emit(type, extra) {
49
+ try {
50
+ this.onEvent({ type, ts: this._now(), ...extra });
51
+ } catch {
52
+ /* event sink is best-effort */
53
+ }
54
+ }
55
+
56
+ /**
57
+ * Track a teammate's lifecycle state (idle / running / failed / shutdown) and
58
+ * emit a `teammate:state` event on every transition. `lost` is set on resume
59
+ * by the caller for a teammate whose lease was reclaimed after a crash.
60
+ */
61
+ _setState(holder, state, extra = {}) {
62
+ let m = this._members.get(holder);
63
+ if (!m) {
64
+ m = { holder, state: null, completed: 0, failed: 0, lastError: null };
65
+ this._members.set(holder, m);
66
+ }
67
+ if (state === "completed-task") {
68
+ m.completed += 1;
69
+ return m;
70
+ }
71
+ if (state === "failed-task") {
72
+ m.failed += 1;
73
+ m.lastError = extra.error || null;
74
+ return m;
75
+ }
76
+ if (m.state === state) return m; // no transition
77
+ m.state = state;
78
+ this._emit("teammate:state", { holder, state, ...extra });
79
+ return m;
80
+ }
81
+
82
+ /** Snapshot of every teammate's lifecycle (for a status panel / resume). */
83
+ members() {
84
+ return Array.from(this._members.values()).map((m) => ({ ...m }));
85
+ }
86
+
87
+ /** Restore prior-run member records (e.g. before a --resume run). */
88
+ seedMembers(records = []) {
89
+ for (const r of records) {
90
+ if (r && r.holder) this._members.set(r.holder, { ...r });
91
+ }
92
+ }
93
+
94
+ /**
95
+ * Run the graph to completion (all tasks terminal) or until no teammate can
96
+ * make progress (everything remaining is blocked/leased). Returns a summary.
97
+ */
98
+ async run() {
99
+ if (typeof this.runTask !== "function") {
100
+ throw new Error("TeamRunner: opts.runTask is required");
101
+ }
102
+ this._emit("run:start", {
103
+ teammates: this.teammates,
104
+ tasks: this.registry.list().length,
105
+ });
106
+ if (this.budget) this.budget.start();
107
+ const workers = [];
108
+ for (let i = 0; i < this.teammates; i++) {
109
+ const holder = `teammate-${i + 1}`;
110
+ this._setState(holder, "idle");
111
+ workers.push(this._worker(holder));
112
+ }
113
+ await Promise.all(workers);
114
+ const stats = this.registry.stats();
115
+ const summary = {
116
+ done: this.registry.allDone(),
117
+ executions: this._executions,
118
+ maxConcurrent: this._maxInFlight,
119
+ budgetStopped: this._budgetStopped,
120
+ budgetReason: this.budget ? this.budget.reason() : null,
121
+ members: this.members(),
122
+ messages: this.mailbox ? this.mailbox.size() : 0,
123
+ stats,
124
+ };
125
+ this._emit("run:end", summary);
126
+ return summary;
127
+ }
128
+
129
+ async _worker(holder) {
130
+ // Each teammate keeps taking claimable work until none is left FOR IT. A
131
+ // task blocked only by a peer's in-flight lease will free up (complete) or
132
+ // its dep will finish — so a worker that finds nothing claimable yields and
133
+ // re-checks while any work is still in flight.
134
+ for (;;) {
135
+ if (this._executions >= this.maxTasks) {
136
+ this._emit("run:budget-exhausted", { maxTasks: this.maxTasks });
137
+ this._setState(holder, "shutdown", { reason: "max-tasks" });
138
+ return;
139
+ }
140
+ // Team budget (token/USD/time/task) — stop CLAIMING once any cap is hit so
141
+ // the team overshoots by at most the tasks already in flight.
142
+ if (this.budget && this.budget.shouldStop()) {
143
+ const reason = this.budget.reason();
144
+ if (!this._budgetStopped) {
145
+ this._budgetStopped = true;
146
+ this._emit("run:budget-exhausted", { reason });
147
+ }
148
+ this._setState(holder, "shutdown", { reason });
149
+ return;
150
+ }
151
+ const key = this._nextFor(holder);
152
+ if (!key) {
153
+ // Nothing to claim right now. If peers are still working, wait and
154
+ // retry (their completions may unblock a dependent). Otherwise we're done.
155
+ if (this._inFlight > 0) {
156
+ this._setState(holder, "idle");
157
+ await this._tick();
158
+ continue;
159
+ }
160
+ this._setState(holder, "shutdown", { reason: "no-more-work" });
161
+ return; // no claimable + nothing in flight → this worker is finished
162
+ }
163
+ const acq = this.registry.acquire(key, { holder, ttlMs: this.ttlMs });
164
+ if (!acq.ok) {
165
+ // Lost the race to a peer (or it just got blocked) — try another.
166
+ this._setState(holder, "idle");
167
+ await this._tick();
168
+ continue;
169
+ }
170
+ await this._execute(holder, key, acq.lease);
171
+ }
172
+ }
173
+
174
+ /** Pick a claimable task key for this holder (highest priority first). */
175
+ _nextFor() {
176
+ const claimable = this.registry.claimable();
177
+ if (claimable.length === 0) return null;
178
+ // Stable: prefer higher priority, else insertion order (claimable order).
179
+ const rank = { high: 0, normal: 1, low: 2 };
180
+ let best = null;
181
+ let bestScore = Infinity;
182
+ for (const key of claimable) {
183
+ const t = this.registry.getTask(key);
184
+ const score = rank[t?.priority] ?? 1;
185
+ if (score < bestScore) {
186
+ bestScore = score;
187
+ best = key;
188
+ }
189
+ }
190
+ return best;
191
+ }
192
+
193
+ async _execute(holder, key, lease) {
194
+ const task = this.registry.getTask(key);
195
+ this._executions++;
196
+ this._inFlight++;
197
+ this._maxInFlight = Math.max(this._maxInFlight, this._inFlight);
198
+ this._setState(holder, "running", { key });
199
+ this._emit("task:claimed", { key, holder, attempts: task.attempts });
200
+ const renew = () => this.registry.renew(key, { holder, ttlMs: this.ttlMs });
201
+ // A teammate-scoped messaging handle: post to a peer / broadcast, and read
202
+ // its own inbox (direct messages + unseen broadcasts).
203
+ const inbox = this.mailbox ? this.mailbox.drain(holder) : [];
204
+ const sendMessage = (to, body, subject = null) =>
205
+ this.mailbox
206
+ ? this.mailbox.send({ from: holder, to, subject, body })
207
+ : null;
208
+ const startedAt = this._now();
209
+ try {
210
+ const result = await this.runTask({
211
+ key,
212
+ task,
213
+ holder,
214
+ renew,
215
+ inbox,
216
+ sendMessage,
217
+ mailbox: this.mailbox,
218
+ budget: this.budget,
219
+ });
220
+ this.registry.complete(key, { holder, result });
221
+ // Fold usage/cost into the team budget. `--exec` shell tasks carry no
222
+ // usage → only the task-count / wall-clock dimensions move.
223
+ if (this.budget) {
224
+ this.budget.record(
225
+ {
226
+ usage: result?.usage || null,
227
+ provider: result?.provider,
228
+ model: result?.model,
229
+ },
230
+ this._now(),
231
+ );
232
+ }
233
+ this._setState(holder, "completed-task");
234
+ this._emit("task:completed", {
235
+ key,
236
+ holder,
237
+ ms: this._now() - startedAt,
238
+ });
239
+ } catch (err) {
240
+ // A failed task still consumed a task-count slot (and any wall-clock) — fold
241
+ // it so a doomed retry loop can't dodge the budget.
242
+ if (this.budget) this.budget.record({ usage: null }, this._now());
243
+ const outcome = this.registry.fail(key, {
244
+ holder,
245
+ error: err?.message || String(err),
246
+ });
247
+ this._setState(holder, "failed-task", {
248
+ error: err?.message || String(err),
249
+ });
250
+ this._emit("task:failed", {
251
+ key,
252
+ holder,
253
+ error: err?.message || String(err),
254
+ retry: outcome?.retry === true,
255
+ attempts: outcome?.attempts,
256
+ });
257
+ } finally {
258
+ this._inFlight--;
259
+ }
260
+ }
261
+
262
+ /** Yield to the event loop so peer completions land before re-checking. */
263
+ _tick() {
264
+ return new Promise((resolve) => setTimeout(resolve, 0));
265
+ }
266
+ }
@@ -0,0 +1,204 @@
1
+ /**
2
+ * TeamWorktreeCoordinator (Phase 4) — give each teammate its OWN git worktree so
3
+ * parallel task execution never fights over the working tree, then integrate the
4
+ * results by SEQUENTIALLY previewing + merging each branch back to base. Two
5
+ * tasks that touch different files both merge clean; two that touch the same
6
+ * file surface a conflict on the second merge (the first having moved base) —
7
+ * the Phase 4 acceptance "并行 Worktree 修改可预览冲突并安全合并".
8
+ *
9
+ * Unlike `isolateTask` (which removes the worktree as soon as its fn returns),
10
+ * the coordinator KEEPS every worktree until integration is done — merge preview
11
+ * needs the branch's worktree present — then cleans them all up.
12
+ *
13
+ * The git surface (`worktree-isolator`) is injected via `_deps` so the
14
+ * coordinator's orchestration is unit-testable without a real repo; a real-git
15
+ * integration test exercises the actual worktree/commit/merge path.
16
+ */
17
+
18
+ import {
19
+ createWorktree as _createWorktree,
20
+ removeWorktree as _removeWorktree,
21
+ previewWorktreeMerge as _previewWorktreeMerge,
22
+ mergeWorktree as _mergeWorktree,
23
+ } from "../../harness/worktree-isolator.js";
24
+ import { isGitRepo as _isGitRepo } from "../../lib/git-integration.js";
25
+ import { execFileSync, spawn } from "node:child_process";
26
+
27
+ function defaultRunShell(command, cwd) {
28
+ return new Promise((resolve, reject) => {
29
+ const child = spawn(command, { cwd, shell: true, env: process.env });
30
+ let err = "";
31
+ child.stderr?.on("data", (d) => (err += d.toString("utf8")));
32
+ child.on("error", (e) => reject(new Error(e.message)));
33
+ child.on("close", (code) =>
34
+ code === 0
35
+ ? resolve({ code })
36
+ : reject(new Error(err.trim() || `command exited ${code}`)),
37
+ );
38
+ });
39
+ }
40
+
41
+ /** Stage + commit everything in a worktree. Returns true if a commit was made. */
42
+ function defaultCommit(worktreePath, message) {
43
+ execFileSync("git", ["add", "-A"], { cwd: worktreePath, stdio: "ignore" });
44
+ try {
45
+ execFileSync(
46
+ "git",
47
+ [
48
+ "-c",
49
+ "user.email=team@chainlesschain.local",
50
+ "-c",
51
+ "user.name=cc team",
52
+ "commit",
53
+ "-m",
54
+ message,
55
+ ],
56
+ { cwd: worktreePath, stdio: "ignore" },
57
+ );
58
+ return true;
59
+ } catch {
60
+ return false; // nothing to commit (no changes)
61
+ }
62
+ }
63
+
64
+ export const _deps = {
65
+ createWorktree: _createWorktree,
66
+ removeWorktree: _removeWorktree,
67
+ previewWorktreeMerge: _previewWorktreeMerge,
68
+ mergeWorktree: _mergeWorktree,
69
+ isGitRepo: _isGitRepo,
70
+ runShell: defaultRunShell,
71
+ commit: defaultCommit,
72
+ };
73
+
74
+ export class TeamWorktreeCoordinator {
75
+ constructor(repoDir) {
76
+ this.repoDir = repoDir;
77
+ this._created = new Map(); // key → { branch, path, committed }
78
+ }
79
+
80
+ isGitRepo() {
81
+ return _deps.isGitRepo(this.repoDir);
82
+ }
83
+
84
+ branchFor(key) {
85
+ return `team/${key}`;
86
+ }
87
+
88
+ /**
89
+ * A TeamRunner `runTask` that runs a task inside a fresh per-task worktree and
90
+ * commits the result. By default it runs the task's shell `command`; pass
91
+ * `runInWorktree({ key, task, holder, cwd })` to instead drive an agent turn
92
+ * (its `prompt`) with cwd set to the worktree, so `--agent --worktree` gets the
93
+ * same parallel isolation as `--exec --worktree`. Throws (→ task failure) on a
94
+ * non-zero command / agent exit so retry/cancel still work.
95
+ */
96
+ makeRunTask({ runInWorktree = null } = {}) {
97
+ return async ({ key, task, holder }) => {
98
+ const branch = this.branchFor(key);
99
+ const { path: worktreePath } = _deps.createWorktree(this.repoDir, branch);
100
+ this._created.set(key, { branch, path: worktreePath, committed: false });
101
+ if (typeof runInWorktree === "function") {
102
+ await runInWorktree({ key, task, holder, cwd: worktreePath });
103
+ } else {
104
+ const command = task.metadata?.command || task?.command;
105
+ if (!command) {
106
+ throw new Error(
107
+ `task "${key}" has no \`command\` to run in a worktree`,
108
+ );
109
+ }
110
+ await _deps.runShell(command, worktreePath);
111
+ }
112
+ const committed = _deps.commit(worktreePath, `team task ${key}`);
113
+ this._created.get(key).committed = committed;
114
+ return { branch, committed };
115
+ };
116
+ }
117
+
118
+ /**
119
+ * Sequentially preview (and optionally merge) each committed branch back to
120
+ * base. Merging is in-order, so a later branch that conflicts with an
121
+ * already-merged one is reported as a conflict rather than silently clobbering.
122
+ *
123
+ * @param {object} [opts] { merge:boolean } actually merge clean branches
124
+ * @returns {Array<{key,branch,committed,clean,merged,conflicts,error?}>}
125
+ */
126
+ integrate({ merge = false } = {}) {
127
+ const results = [];
128
+ for (const [key, info] of this._created) {
129
+ if (!info.committed) {
130
+ results.push({
131
+ key,
132
+ branch: info.branch,
133
+ committed: false,
134
+ clean: true,
135
+ merged: false,
136
+ conflicts: [],
137
+ note: "no changes to merge",
138
+ });
139
+ continue;
140
+ }
141
+ let preview;
142
+ try {
143
+ preview = _deps.previewWorktreeMerge(this.repoDir, info.branch);
144
+ } catch (err) {
145
+ results.push({
146
+ key,
147
+ branch: info.branch,
148
+ committed: true,
149
+ clean: false,
150
+ merged: false,
151
+ conflicts: [],
152
+ error: err.message,
153
+ });
154
+ continue;
155
+ }
156
+ const clean = preview?.success === true;
157
+ const conflicts = preview?.conflicts || [];
158
+ let merged = false;
159
+ if (clean && merge) {
160
+ try {
161
+ _deps.mergeWorktree(this.repoDir, info.branch, {
162
+ message: `Merge team task ${key}`,
163
+ });
164
+ merged = true;
165
+ } catch (err) {
166
+ results.push({
167
+ key,
168
+ branch: info.branch,
169
+ committed: true,
170
+ clean: false,
171
+ merged: false,
172
+ conflicts,
173
+ error: `merge failed: ${err.message}`,
174
+ });
175
+ continue;
176
+ }
177
+ }
178
+ results.push({
179
+ key,
180
+ branch: info.branch,
181
+ committed: true,
182
+ clean,
183
+ merged,
184
+ conflicts,
185
+ });
186
+ }
187
+ return results;
188
+ }
189
+
190
+ /** Remove every worktree created for this run (branches left intact). */
191
+ cleanupAll({ deleteBranch = false } = {}) {
192
+ for (const [, info] of this._created) {
193
+ try {
194
+ _deps.removeWorktree(this.repoDir, info.path, { deleteBranch });
195
+ } catch {
196
+ /* best-effort */
197
+ }
198
+ }
199
+ }
200
+
201
+ branches() {
202
+ return Array.from(this._created.values()).map((i) => i.branch);
203
+ }
204
+ }
package/src/lib/agents.js CHANGED
@@ -22,6 +22,7 @@ import pathDefault from "node:path";
22
22
  import { homedir } from "node:os";
23
23
  import yaml from "js-yaml";
24
24
  import { projectRootBase } from "./project-root.cjs";
25
+ import { discoverPluginAgentLayers } from "./plugin-runtime/agents.js";
25
26
 
26
27
  const _deps = { fs: fsDefault, path: pathDefault };
27
28
 
@@ -76,6 +77,23 @@ export function agentDirs(cwd = process.cwd(), opts = {}) {
76
77
  dirs.push({ dir: path.join(root, ".claude", "agents"), scope: "project" });
77
78
  }
78
79
  dirs.push({ dir: path.join(home, ".claude", "agents"), scope: "personal" });
80
+ // Installed-plugin agents (Phase 3.3h) — LOWEST precedence: appended last so
81
+ // that after discoverAgents' reverse() they are scanned FIRST and a user's own
82
+ // project/personal agent of the same name shadows them. Declarative (system
83
+ // prompt only), so not trust-gated. Best-effort: a discovery failure just
84
+ // contributes no plugin dirs.
85
+ if (opts.includePlugins !== false) {
86
+ try {
87
+ for (const layer of discoverPluginAgentLayers({
88
+ cwd,
89
+ scopes: opts.scopes,
90
+ })) {
91
+ dirs.push({ dir: layer.dir, scope: "plugin" });
92
+ }
93
+ } catch {
94
+ /* best-effort — plugin discovery never breaks core agent loading */
95
+ }
96
+ }
79
97
  return dirs;
80
98
  }
81
99