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.
Files changed (322) hide show
  1. package/README.md +1 -1
  2. package/package.json +1 -1
  3. package/src/assets/web-panel/.build-hash +1 -1
  4. package/src/assets/web-panel/assets/{AIOps-DwpCCp64.js → AIOps-CBLvrjeG.js} +1 -1
  5. package/src/assets/web-panel/assets/{ActionButton-C9pBYocA.js → ActionButton-DYv2GtE0.js} +1 -1
  6. package/src/assets/web-panel/assets/{Analytics-BWAkeXxK.js → Analytics-CL6PZ-Ww.js} +3 -3
  7. package/src/assets/web-panel/assets/{AppLayout-CivFGH6B.js → AppLayout-xuyHt4uA.js} +3 -3
  8. package/src/assets/web-panel/assets/{Audit-Cm8hRpZm.js → Audit-DOvSVycq.js} +1 -1
  9. package/src/assets/web-panel/assets/{Backup-DXdFMsE8.js → Backup-DMhfTswr.js} +1 -1
  10. package/src/assets/web-panel/assets/{BaseInput-uAwSTeql.js → BaseInput-CQxDdm63.js} +1 -1
  11. package/src/assets/web-panel/assets/{Chat-KU8eeJJE.js → Chat-BEeNhK2a.js} +5 -5
  12. package/src/assets/web-panel/assets/ChatBubbleRenderer-8nul8eTq.js +1 -0
  13. package/src/assets/web-panel/assets/{Checkbox-C6AMDkjd.js → Checkbox-CL04O-ER.js} +1 -1
  14. package/src/assets/web-panel/assets/{Codegen-t2moDxcO.js → Codegen-C50o-n7x.js} +1 -1
  15. package/src/assets/web-panel/assets/{Col-DCcsRRhN.js → Col-CH-bDkzs.js} +1 -1
  16. package/src/assets/web-panel/assets/{Community-DtB-8SAC.js → Community-DqAIMvSe.js} +1 -1
  17. package/src/assets/web-panel/assets/{Compact-CZm8THYA.js → Compact-C43fo_my.js} +1 -1
  18. package/src/assets/web-panel/assets/{Compliance-LiQgC7g1.js → Compliance-BERnMrdP.js} +1 -1
  19. package/src/assets/web-panel/assets/{Cowork-CA8SAxht.js → Cowork-Baw3w1gp.js} +4 -4
  20. package/src/assets/web-panel/assets/{Cron-CtRaF1wD.js → Cron-BEqAHF1-.js} +2 -2
  21. package/src/assets/web-panel/assets/{Crosschain-6-br6Hub.js → Crosschain-CvnmKwK4.js} +1 -1
  22. package/src/assets/web-panel/assets/{DID-Do2EccrL.js → DID-iMPxgVdt.js} +2 -2
  23. package/src/assets/web-panel/assets/{Dashboard-wrXcbzGe.js → Dashboard--4SJX3YR.js} +2 -2
  24. package/src/assets/web-panel/assets/{Dropdown-p3FsT245.js → Dropdown-BgLV6xgz.js} +1 -1
  25. package/src/assets/web-panel/assets/{EmailListRenderer-D95A2L8q.js → EmailListRenderer-Bvb8oUD8.js} +1 -1
  26. package/src/assets/web-panel/assets/{FamilyGuardDashboard-cLuJW2zo.js → FamilyGuardDashboard-DpXPjJB5.js} +1 -1
  27. package/src/assets/web-panel/assets/{Federation-Brgq_cbN.js → Federation-BbFfJ1Xi.js} +1 -1
  28. package/src/assets/web-panel/assets/{FormItemContext-DWLCkNgh.js → FormItemContext-DeGq1B-q.js} +1 -1
  29. package/src/assets/web-panel/assets/{GenericCardRenderer-BBqUfQd6.js → GenericCardRenderer-CNW7s9zM.js} +1 -1
  30. package/src/assets/web-panel/assets/{Git-8F090w4I.js → Git-L1PjW-lT.js} +2 -2
  31. package/src/assets/web-panel/assets/{Governance-CCogEbxb.js → Governance-PK-X58to.js} +1 -1
  32. package/src/assets/web-panel/assets/{Inference-CfLD7v7C.js → Inference-BePWEH-d.js} +1 -1
  33. package/src/assets/web-panel/assets/{KnowledgeGraph-DDuHJewd.js → KnowledgeGraph-LF_sBvdL.js} +1 -1
  34. package/src/assets/web-panel/assets/{Logs-CE8KSEVC.js → Logs-BKkfk9hy.js} +2 -2
  35. package/src/assets/web-panel/assets/{Marketplace-DmwpZmhT.js → Marketplace-BNMqUDla.js} +1 -1
  36. package/src/assets/web-panel/assets/{McpTools-Bf7AazU8.js → McpTools-w4WPiyz2.js} +5 -5
  37. package/src/assets/web-panel/assets/{Memory-D0QU_00S.js → Memory-DUKMVGNi.js} +2 -2
  38. package/src/assets/web-panel/assets/{MobileBridge-yXS9xdhx.js → MobileBridge-BWhiEyTJ.js} +1 -1
  39. package/src/assets/web-panel/assets/{MobileProjects-BuDUoGUP.js → MobileProjects-Ocf5JEkX.js} +1 -1
  40. package/src/assets/web-panel/assets/{Mtc-BYyHy28p.js → Mtc-D2B6MMhU.js} +4 -4
  41. package/src/assets/web-panel/assets/{MtcAudit-CK0aqpiZ.js → MtcAudit-DdYjCq1O.js} +4 -4
  42. package/src/assets/web-panel/assets/{Multisig-mNimKYeb.js → Multisig-Cb1hfuUZ.js} +3 -3
  43. package/src/assets/web-panel/assets/{NLProgramming-AioAJ0YA.js → NLProgramming-CTeImGp7.js} +1 -1
  44. package/src/assets/web-panel/assets/{Notes-CVVNCLHE.js → Notes-BjYNc7eQ.js} +4 -4
  45. package/src/assets/web-panel/assets/{NotificationSettings-C4ABj-TK.js → NotificationSettings-Dn_NtRXQ.js} +1 -1
  46. package/src/assets/web-panel/assets/{OrderTableRenderer-DIp8Xcbd.js → OrderTableRenderer-DVYYIizh.js} +1 -1
  47. package/src/assets/web-panel/assets/{Organization-uozl_gWK.js → Organization-Be2Kmr5j.js} +4 -4
  48. package/src/assets/web-panel/assets/{Overflow-BCZOM2hK.js → Overflow-Cu_-qRlR.js} +1 -1
  49. package/src/assets/web-panel/assets/{P2P-CArcaiaj.js → P2P-DD2HoGzE.js} +2 -2
  50. package/src/assets/web-panel/assets/{PdhVaultBrowser-Sgq2Srr8.js → PdhVaultBrowser-BRI7DVth.js} +3 -3
  51. package/src/assets/web-panel/assets/{Permissions-BYrQrXnH.js → Permissions-C9Srcs2M.js} +4 -4
  52. package/src/assets/web-panel/assets/{PersonalDataHub-BzHStAbz.js → PersonalDataHub-CUqcMgo1.js} +3 -3
  53. package/src/assets/web-panel/assets/{Pipeline-k7KqxX1M.js → Pipeline-HBrQGLXt.js} +1 -1
  54. package/src/assets/web-panel/assets/{Privacy-IumTUWqx.js → Privacy-D-B0vjwh.js} +1 -1
  55. package/src/assets/web-panel/assets/{ProjectInit-BRyImYTf.js → ProjectInit-eTeLIu9e.js} +2 -2
  56. package/src/assets/web-panel/assets/{ProjectSettings-BFIqTBFk.js → ProjectSettings-DrRqCsC6.js} +2 -2
  57. package/src/assets/web-panel/assets/{Projects-Dpid9CDg.js → Projects-1G9DNOhI.js} +1 -1
  58. package/src/assets/web-panel/assets/{Providers-CyyFnUPs.js → Providers-RkTZzpxP.js} +1 -1
  59. package/src/assets/web-panel/assets/{QrScannerModal-C82cRx-X.js → QrScannerModal-BSCUgsgC.js} +1 -1
  60. package/src/assets/web-panel/assets/{QuickAsk-DGxDF521.js → QuickAsk-CHgyM3Bz.js} +1 -1
  61. package/src/assets/web-panel/assets/{Recommend-Cns-Am1y.js → Recommend-0lry4OZq.js} +1 -1
  62. package/src/assets/web-panel/assets/{RemoteSession-R7OqAIlg.js → RemoteSession-Cn45UroZ.js} +2 -2
  63. package/src/assets/web-panel/assets/{Reputation-D7mgPIYV.js → Reputation-Q-Zjb707.js} +1 -1
  64. package/src/assets/web-panel/assets/{Row-B3lEURyd.js → Row-BdM70oda.js} +1 -1
  65. package/src/assets/web-panel/assets/{RssFeed-9_UVrpBt.js → RssFeed-DmOAKKap.js} +2 -2
  66. package/src/assets/web-panel/assets/{Search-ClZeO80q.js → Search-Dwavbm07.js} +1 -1
  67. package/src/assets/web-panel/assets/{Security-BNNJczEp.js → Security-DukXFCnk.js} +3 -3
  68. package/src/assets/web-panel/assets/{Services-C5SjrWUj.js → Services-BIlRnITu.js} +2 -2
  69. package/src/assets/web-panel/assets/{Skeleton-Ci_obQ-g.js → Skeleton-YYVQdhhQ.js} +1 -1
  70. package/src/assets/web-panel/assets/{Skills-DdebN15P.js → Skills-B8_iYHz2.js} +1 -1
  71. package/src/assets/web-panel/assets/{Sla-OinZP2vi.js → Sla-BdVrhT31.js} +1 -1
  72. package/src/assets/web-panel/assets/{SpeechSettings-CxzbNF51.js → SpeechSettings-CD3ggRx7.js} +1 -1
  73. package/src/assets/web-panel/assets/{SyncSettings-D06N_66b.js → SyncSettings-Bp02VZFH.js} +2 -2
  74. package/src/assets/web-panel/assets/{Tasks-BdEdW0AZ.js → Tasks-DEVmCEsr.js} +1 -1
  75. package/src/assets/web-panel/assets/{Templates-F1ctKmPa.js → Templates-B6czWc4N.js} +1 -1
  76. package/src/assets/web-panel/assets/{Tenant-CVz1Urot.js → Tenant-BCJLv17r.js} +1 -1
  77. package/src/assets/web-panel/assets/Terminal-CD132d2Y.js +3 -0
  78. package/src/assets/web-panel/assets/{TimelineRenderer-Doitzjmf.js → TimelineRenderer-ZB-CvkZl.js} +1 -1
  79. package/src/assets/web-panel/assets/{Tokens-BpyVRpVA.js → Tokens-BnSY0S-s.js} +1 -1
  80. package/src/assets/web-panel/assets/{Trigger-nWhWYTbU.js → Trigger-VZw9Oy2w.js} +1 -1
  81. package/src/assets/web-panel/assets/{Trust-DK_G-wLx.js → Trust-pZq7Hjd2.js} +1 -1
  82. package/src/assets/web-panel/assets/{UkeySign-B5yBUojO.js → UkeySign-DnQaqk4q.js} +1 -1
  83. package/src/assets/web-panel/assets/{VideoEditing-C5D51qAe.js → VideoEditing-BEUfmvJV.js} +1 -1
  84. package/src/assets/web-panel/assets/{Wallet-CLbL9K7v.js → Wallet-CoZKMXJ2.js} +4 -4
  85. package/src/assets/web-panel/assets/{WebAuthn-DZUelI3V.js → WebAuthn-CBOGVx1I.js} +5 -5
  86. package/src/assets/web-panel/assets/{WorkflowEditor-8RPxt4KW.js → WorkflowEditor-huSKn7TT.js} +1 -1
  87. package/src/assets/web-panel/assets/{chat-4N4tOA3d.js → chat-A_3w6FBO.js} +1 -1
  88. package/src/assets/web-panel/assets/{colors-zbbGVrua.js → colors-D1Bem9Oy.js} +1 -1
  89. package/src/assets/web-panel/assets/{compact-item-D7iMkbnE.js → compact-item-CJYJj0oO.js} +1 -1
  90. package/src/assets/web-panel/assets/{createContext-CBzPJv-w.js → createContext-BkbFiKT4.js} +1 -1
  91. package/src/assets/web-panel/assets/devWarning-WDr3_M_N.js +1 -0
  92. package/src/assets/web-panel/assets/{hasIn-bHdrQSqZ.js → hasIn-CKvUafVY.js} +1 -1
  93. package/src/assets/web-panel/assets/{index-DbE5D0WL.js → index-AjrSPnvv.js} +1 -1
  94. package/src/assets/web-panel/assets/{index-BCr0geV9.js → index-B8i0lViZ.js} +1 -1
  95. package/src/assets/web-panel/assets/{index-CiG1IZao.js → index-B9Svn0zc.js} +1 -1
  96. package/src/assets/web-panel/assets/{index-B1s0Bz9O.js → index-BHdHSX06.js} +1 -1
  97. package/src/assets/web-panel/assets/{index-QFObYeo1.js → index-BHdailyo.js} +1 -1
  98. package/src/assets/web-panel/assets/{index-BnBOpqv3.js → index-BJwlEnYo.js} +1 -1
  99. package/src/assets/web-panel/assets/{index-CdmMoYN1.js → index-BOoAQjJz.js} +1 -1
  100. package/src/assets/web-panel/assets/{index-DUyjUkY7.js → index-BSgWxAOG.js} +1 -1
  101. package/src/assets/web-panel/assets/{index-CqdPyWm5.js → index-BdutMsne.js} +1 -1
  102. package/src/assets/web-panel/assets/{index-DmqlJed-.js → index-BiDWxzbn.js} +1 -1
  103. package/src/assets/web-panel/assets/{index-S74FpAIn.js → index-By5a0T_W.js} +1 -1
  104. package/src/assets/web-panel/assets/{index-kmh1TxRa.js → index-C-WIY-FQ.js} +1 -1
  105. package/src/assets/web-panel/assets/{index-BTIjjXry.js → index-C37f6iey.js} +1 -1
  106. package/src/assets/web-panel/assets/{index-BS4_Mwk6.js → index-C9bWmTcO.js} +1 -1
  107. package/src/assets/web-panel/assets/{index-BBNr77E1.js → index-CBaosWRO.js} +1 -1
  108. package/src/assets/web-panel/assets/{index-QNAG4JtR.js → index-CBlBVJ_m.js} +1 -1
  109. package/src/assets/web-panel/assets/{index-Bqmx24kh.js → index-CD62EEGo.js} +1 -1
  110. package/src/assets/web-panel/assets/{index-CQfu1U78.js → index-CUj-l7GM.js} +1 -1
  111. package/src/assets/web-panel/assets/{index-BJ4ZGyW0.js → index-CVS8Ymuq.js} +1 -1
  112. package/src/assets/web-panel/assets/{index-Ci009ijp.js → index-ChkXUj3f.js} +1 -1
  113. package/src/assets/web-panel/assets/{index-oDKNgCsP.js → index-Cj0OZ-37.js} +1 -1
  114. package/src/assets/web-panel/assets/{index-BZb8F8YG.js → index-Co3OFL0t.js} +1 -1
  115. package/src/assets/web-panel/assets/{index-308gCGh7.js → index-Crp8CbRg.js} +1 -1
  116. package/src/assets/web-panel/assets/{index-CPxkoKgA.js → index-D22zNXiS.js} +1 -1
  117. package/src/assets/web-panel/assets/{index-xYCm6W2h.js → index-DTs_D1OL.js} +1 -1
  118. package/src/assets/web-panel/assets/{index-BtbbdLnf.js → index-DfgCdFrN.js} +3 -3
  119. package/src/assets/web-panel/assets/{index-BsKehmmS.js → index-DjYrecNb.js} +1 -1
  120. package/src/assets/web-panel/assets/{index-CkxK86vf.js → index-DpW9cf3e.js} +1 -1
  121. package/src/assets/web-panel/assets/index-Dwix3p4g.js +1 -0
  122. package/src/assets/web-panel/assets/{index-CvRMA9uT.js → index-F--HuPG1.js} +1 -1
  123. package/src/assets/web-panel/assets/{index-DE9j5YgT.js → index-Fuk6t_3K.js} +1 -1
  124. package/src/assets/web-panel/assets/{index-B7b1hGry.js → index-JEAGMii9.js} +1 -1
  125. package/src/assets/web-panel/assets/{index-D1YDh7Wr.js → index-PF-mpv8K.js} +1 -1
  126. package/src/assets/web-panel/assets/index-SHaoZ0CA.js +1 -0
  127. package/src/assets/web-panel/assets/{index-CQ6NcfWz.js → index-b-sbVdjQ.js} +1 -1
  128. package/src/assets/web-panel/assets/{index-DyoNgbXl.js → index-pyvMVX8r.js} +1 -1
  129. package/src/assets/web-panel/assets/{index-DISWAYce.js → index-qNTtOVi_.js} +1 -1
  130. package/src/assets/web-panel/assets/{index-D4XKpj6c.js → index-tgO8iza6.js} +1 -1
  131. package/src/assets/web-panel/assets/{index-CahryTX0.js → index-ttDQVhZy.js} +1 -1
  132. package/src/assets/web-panel/assets/{initDefaultProps-BD55yNBt.js → initDefaultProps-DtrnfsZH.js} +1 -1
  133. package/src/assets/web-panel/assets/{motion-B5Bbe77U.js → motion-D4zqSaX3.js} +1 -1
  134. package/src/assets/web-panel/assets/{move-CTvIqHEH.js → move-CGFGOUQj.js} +1 -1
  135. package/src/assets/web-panel/assets/{mtc-parser-BkNyPQKB.js → mtc-parser-DH2HvkJl.js} +1 -1
  136. package/src/assets/web-panel/assets/{omit-BaXJXgHA.js → omit-jJ2at5HX.js} +1 -1
  137. package/src/assets/web-panel/assets/{pickAttrs-Bw6-YTxH.js → pickAttrs-CRyMT1Fv.js} +1 -1
  138. package/src/assets/web-panel/assets/{placementArrow-BLdbkLqJ.js → placementArrow-DZ_CX0Pt.js} +1 -1
  139. package/src/assets/web-panel/assets/{responsiveObserve-IVYkzntU.js → responsiveObserve-wruHk-h5.js} +1 -1
  140. package/src/assets/web-panel/assets/{slide-DFMFwwtY.js → slide-BGgx8q67.js} +1 -1
  141. package/src/assets/web-panel/assets/{statusUtils-CURYRtZ1.js → statusUtils-Do5M7gKm.js} +1 -1
  142. package/src/assets/web-panel/assets/{styleChecker-Cfz63s1r.js → styleChecker-CRa-GZpX.js} +1 -1
  143. package/src/assets/web-panel/assets/{useFlexGapSupport-COJL0KE3.js → useFlexGapSupport-BxPcq6pj.js} +1 -1
  144. package/src/assets/web-panel/assets/{useFs-YLLojQQf.js → useFs-v5O2ZcJm.js} +1 -1
  145. package/src/assets/web-panel/assets/{usePersonalDataHub-BF_21qUC.js → usePersonalDataHub--z2FU0Px.js} +1 -1
  146. package/src/assets/web-panel/assets/{vnode-9ZpkA7bb.js → vnode-1emidVKd.js} +1 -1
  147. package/src/assets/web-panel/assets/{zoom-DhtAfhl8.js → zoom-CcJaRyHs.js} +1 -1
  148. package/src/assets/web-panel/index.html +1 -1
  149. package/src/assets/web-panel/remote-session-sw.js +43 -0
  150. package/src/command-manifest.json +22 -1
  151. package/src/commands/a2a.js +19 -4
  152. package/src/commands/activitypub.js +20 -3
  153. package/src/commands/agent.js +71 -10
  154. package/src/commands/audit.js +40 -24
  155. package/src/commands/codeintel.js +320 -0
  156. package/src/commands/collab.js +15 -2
  157. package/src/commands/compliance.js +5 -0
  158. package/src/commands/config.js +4 -1
  159. package/src/commands/dao.js +86 -14
  160. package/src/commands/dev.js +2 -0
  161. package/src/commands/did.js +7 -1
  162. package/src/commands/dlp.js +23 -1
  163. package/src/commands/economy.js +29 -3
  164. package/src/commands/eval.js +255 -0
  165. package/src/commands/evomap.js +26 -0
  166. package/src/commands/governance.js +17 -3
  167. package/src/commands/hardening.js +18 -0
  168. package/src/commands/incentive.js +5 -0
  169. package/src/commands/init.js +46 -2
  170. package/src/commands/kg.js +4 -0
  171. package/src/commands/loop.js +6 -1
  172. package/src/commands/lowcode.js +15 -2
  173. package/src/commands/marketplace.js +40 -6
  174. package/src/commands/matrix.js +20 -1
  175. package/src/commands/memory.js +4 -1
  176. package/src/commands/mtc.js +7 -1
  177. package/src/commands/nostr.js +31 -4
  178. package/src/commands/note.js +7 -4
  179. package/src/commands/plugin.js +474 -0
  180. package/src/commands/pqc.js +5 -0
  181. package/src/commands/reputation.js +10 -1
  182. package/src/commands/scim.js +6 -0
  183. package/src/commands/session.js +32 -10
  184. package/src/commands/siem.js +11 -0
  185. package/src/commands/sla.js +18 -3
  186. package/src/commands/social.js +38 -5
  187. package/src/commands/sso.js +10 -2
  188. package/src/commands/stress.js +23 -4
  189. package/src/commands/team.js +463 -0
  190. package/src/commands/tech.js +2 -0
  191. package/src/commands/tenant.js +10 -1
  192. package/src/commands/terraform.js +6 -0
  193. package/src/commands/update.js +1 -1
  194. package/src/commands/zkp.js +20 -0
  195. package/src/gateways/ws/message-dispatcher.js +48 -2
  196. package/src/gateways/ws/remote-session-protocol.js +140 -42
  197. package/src/gateways/ws/ws-server.js +1 -1
  198. package/src/harness/jsonl-session-store.js +12 -5
  199. package/src/harness/plugin-manager.js +16 -4
  200. package/src/harness/prompt-compressor.js +27 -1
  201. package/src/harness/remote-command-ledger.js +189 -0
  202. package/src/harness/remote-session-push-apns.js +246 -0
  203. package/src/harness/remote-session-push-errors.js +15 -0
  204. package/src/harness/remote-session-push-fcm.js +9 -25
  205. package/src/harness/remote-session-push-huawei.js +174 -0
  206. package/src/harness/remote-session-push-oppo.js +171 -0
  207. package/src/harness/remote-session-push-senders.js +42 -0
  208. package/src/harness/remote-session-push-vivo.js +179 -0
  209. package/src/harness/remote-session-push-web.js +299 -0
  210. package/src/harness/remote-session-push-xiaomi.js +99 -0
  211. package/src/harness/worktree-isolator.js +16 -6
  212. package/src/index.js +6 -0
  213. package/src/lib/__tests__/logger.test.js +5 -2
  214. package/src/lib/a2a-protocol.js +25 -1
  215. package/src/lib/activitypub-bridge.js +61 -0
  216. package/src/lib/agent-core.js +4 -0
  217. package/src/lib/agent-economy.js +262 -29
  218. package/src/lib/agent-network.js +7 -1
  219. package/src/lib/agent-sandbox.js +161 -5
  220. package/src/lib/agent-team/task-lease.js +434 -0
  221. package/src/lib/agent-team/team-budget.js +165 -0
  222. package/src/lib/agent-team/team-mailbox.js +106 -0
  223. package/src/lib/agent-team/team-runner.js +282 -0
  224. package/src/lib/agent-team/team-worktree.js +236 -0
  225. package/src/lib/agents.js +18 -0
  226. package/src/lib/async-hook-supervisor.cjs +391 -0
  227. package/src/lib/audit-logger.js +7 -6
  228. package/src/lib/autonomous-developer.js +60 -0
  229. package/src/lib/chat-core.js +17 -4
  230. package/src/lib/collaboration-governance.js +56 -0
  231. package/src/lib/community-governance.js +68 -0
  232. package/src/lib/compliance-manager.js +63 -0
  233. package/src/lib/cross-chain.js +5 -0
  234. package/src/lib/dao-governance.js +151 -2
  235. package/src/lib/did-manager.js +23 -10
  236. package/src/lib/dlp-engine.js +70 -0
  237. package/src/lib/eval/runner.js +251 -0
  238. package/src/lib/eval/tasks.js +626 -0
  239. package/src/lib/eval/trend.js +200 -0
  240. package/src/lib/evolution-system.js +92 -0
  241. package/src/lib/evomap-federation.js +55 -0
  242. package/src/lib/evomap-governance.js +94 -0
  243. package/src/lib/fatal-handler.js +17 -1
  244. package/src/lib/hardening-manager.js +73 -0
  245. package/src/lib/hierarchical-memory.js +14 -8
  246. package/src/lib/knowledge-exporter.js +8 -2
  247. package/src/lib/knowledge-graph.js +79 -0
  248. package/src/lib/llm-providers.js +23 -14
  249. package/src/lib/logger.js +4 -1
  250. package/src/lib/lsp/__tests__/benchmark.test.js +88 -0
  251. package/src/lib/lsp/__tests__/code-intelligence.integration.test.js +129 -0
  252. package/src/lib/lsp/__tests__/code-intelligence.test.js +228 -0
  253. package/src/lib/lsp/__tests__/jsonrpc-stream.test.js +104 -0
  254. package/src/lib/lsp/__tests__/lsp-client.test.js +269 -0
  255. package/src/lib/lsp/__tests__/lsp-manager.test.js +333 -0
  256. package/src/lib/lsp/__tests__/lsp-server-registry.test.js +128 -0
  257. package/src/lib/lsp/benchmark.js +257 -0
  258. package/src/lib/lsp/code-intelligence.js +356 -0
  259. package/src/lib/lsp/jsonrpc-stream.js +139 -0
  260. package/src/lib/lsp/lsp-client.js +339 -0
  261. package/src/lib/lsp/lsp-manager.js +375 -0
  262. package/src/lib/lsp/lsp-server-registry.js +196 -0
  263. package/src/lib/matrix-bridge.js +84 -0
  264. package/src/lib/memory-manager.js +5 -3
  265. package/src/lib/nostr-bridge.js +53 -0
  266. package/src/lib/permission-engine.js +22 -4
  267. package/src/lib/plugin-monitor-supervisor.js +238 -0
  268. package/src/lib/plugin-runtime/__tests__/remote-source.test.js +256 -0
  269. package/src/lib/plugin-runtime/agents.js +51 -0
  270. package/src/lib/plugin-runtime/bin.js +100 -0
  271. package/src/lib/plugin-runtime/hooks.js +100 -0
  272. package/src/lib/plugin-runtime/install.js +396 -0
  273. package/src/lib/plugin-runtime/lsp.js +75 -0
  274. package/src/lib/plugin-runtime/manifest.js +458 -0
  275. package/src/lib/plugin-runtime/mcp.js +89 -0
  276. package/src/lib/plugin-runtime/monitors.js +100 -0
  277. package/src/lib/plugin-runtime/policy.js +152 -0
  278. package/src/lib/plugin-runtime/reload.js +79 -0
  279. package/src/lib/plugin-runtime/remote-source.js +240 -0
  280. package/src/lib/plugin-runtime/scopes.js +197 -0
  281. package/src/lib/plugin-runtime/settings.js +119 -0
  282. package/src/lib/plugin-runtime/signature.js +107 -0
  283. package/src/lib/plugin-runtime/skills.js +43 -0
  284. package/src/lib/plugin-runtime/trust.js +140 -0
  285. package/src/lib/pqc-manager.js +64 -0
  286. package/src/lib/reputation-optimizer.js +101 -0
  287. package/src/lib/sandbox-egress-proxy.js +262 -0
  288. package/src/lib/sandbox-fs-policy.js +112 -0
  289. package/src/lib/sandbox-network-policy.js +151 -0
  290. package/src/lib/sandbox-v2.js +24 -18
  291. package/src/lib/scim-manager.js +36 -0
  292. package/src/lib/session-manager.js +5 -2
  293. package/src/lib/settings-hook-events.cjs +78 -6
  294. package/src/lib/settings-hooks.cjs +30 -3
  295. package/src/lib/settings-loader.cjs +35 -1
  296. package/src/lib/siem-exporter.js +45 -0
  297. package/src/lib/skill-loader.js +38 -2
  298. package/src/lib/skill-marketplace.js +83 -0
  299. package/src/lib/sla-manager.js +88 -0
  300. package/src/lib/social-manager.js +74 -0
  301. package/src/lib/stress-tester.js +65 -0
  302. package/src/lib/tech-learning-engine.js +75 -0
  303. package/src/lib/telemetry/span-recorder.js +237 -0
  304. package/src/lib/tenant-saas.js +107 -0
  305. package/src/lib/terraform-manager.js +67 -0
  306. package/src/lib/token-incentive.js +180 -29
  307. package/src/lib/wallet-manager.js +81 -35
  308. package/src/lib/zkp-engine.js +87 -0
  309. package/src/repl/agent-repl.js +417 -6
  310. package/src/runtime/__tests__/auto-pin.test.js +104 -0
  311. package/src/runtime/agent-core.js +771 -104
  312. package/src/runtime/auto-pin.js +117 -0
  313. package/src/runtime/coding-agent-contract-shared.cjs +82 -8
  314. package/src/runtime/coding-agent-policy.cjs +32 -7
  315. package/src/runtime/fallback-model.js +134 -7
  316. package/src/runtime/headless-runner.js +388 -108
  317. package/src/runtime/mcp-config.js +46 -0
  318. package/src/assets/web-panel/assets/ChatBubbleRenderer-DCNfbdlx.js +0 -1
  319. package/src/assets/web-panel/assets/Terminal-BvAK_Zel.js +0 -3
  320. package/src/assets/web-panel/assets/devWarning-C2Z5LRgq.js +0 -1
  321. package/src/assets/web-panel/assets/index-BGp6Yr-Y.js +0 -1
  322. package/src/assets/web-panel/assets/index-BXiw9dQf.js +0 -1
@@ -0,0 +1,626 @@
1
+ /**
2
+ * Built-in eval task suite (Phase 7). Each task is a small, deterministic,
3
+ * self-checking coding problem: `setup` writes the starting files, `prompt` is
4
+ * handed to the agent, and `check` verifies the outcome with a real filesystem
5
+ * assertion (no LLM-graded fuzzy matching — pass/fail is objective).
6
+ *
7
+ * Kept intentionally small + provider-agnostic so `cc eval` can run against any
8
+ * configured model (including a local Ollama). Extend by adding entries here or
9
+ * loading an external suite file.
10
+ */
11
+
12
+ import fs from "fs";
13
+ import path from "path";
14
+ import { execFileSync } from "node:child_process";
15
+
16
+ function read(dir, rel) {
17
+ try {
18
+ return fs.readFileSync(path.join(dir, rel), "utf8");
19
+ } catch {
20
+ return null;
21
+ }
22
+ }
23
+
24
+ // The `stringutil` "dependency" at v2, used by BOTH the upgrade-dependency
25
+ // setup and its check so the task can verify the vendored dependency file was
26
+ // not edited (the agent must adapt the caller, not touch the dependency).
27
+ const STRINGUTIL_V2 =
28
+ "export function toTitle(s) {\n" +
29
+ " const str = String(s);\n" +
30
+ " return str.charAt(0).toUpperCase() + str.slice(1);\n" +
31
+ "}\n";
32
+
33
+ export const BUILTIN_TASKS = [
34
+ {
35
+ id: "create-file",
36
+ expectedFiles: ["greeting.txt"],
37
+ description: "Create a new file with exact content",
38
+ prompt:
39
+ 'Create a file named greeting.txt containing exactly the text "Hello, ChainlessChain!" (no trailing newline).',
40
+ setup: () => {},
41
+ check: (dir) => {
42
+ const got = read(dir, "greeting.txt");
43
+ if (got == null)
44
+ return { pass: false, detail: "greeting.txt not created" };
45
+ const trimmed = got.replace(/\n$/, "");
46
+ return trimmed === "Hello, ChainlessChain!"
47
+ ? { pass: true, detail: "content matches" }
48
+ : { pass: false, detail: `content was ${JSON.stringify(got)}` };
49
+ },
50
+ },
51
+ {
52
+ id: "fix-syntax-error",
53
+ expectedFiles: ["bug.js"],
54
+ description: "Fix a syntax error so the script runs",
55
+ prompt:
56
+ "The file bug.js has a syntax error. Fix it so that running `node bug.js` prints exactly OK.",
57
+ setup: (dir) => {
58
+ // Missing closing paren — a real, small bug to repair.
59
+ fs.writeFileSync(path.join(dir, "bug.js"), 'console.log("OK";\n', "utf8");
60
+ },
61
+ check: (dir) => {
62
+ const src = read(dir, "bug.js");
63
+ if (src == null) return { pass: false, detail: "bug.js missing" };
64
+ // Objective check: it must parse AND print OK. Re-run in a child so we
65
+ // score the actual behavior, not a heuristic on the source.
66
+ try {
67
+ const out = execFileSync(process.execPath, ["bug.js"], {
68
+ cwd: dir,
69
+ encoding: "utf8",
70
+ timeout: 10000,
71
+ stdio: ["ignore", "pipe", "pipe"], // capture stderr, don't inherit
72
+ });
73
+ return out.trim() === "OK"
74
+ ? { pass: true, detail: "node bug.js prints OK" }
75
+ : { pass: false, detail: `printed ${JSON.stringify(out.trim())}` };
76
+ } catch (err) {
77
+ // Concise detail — the first line of the failure, not the whole stack.
78
+ const first = String(err.message || "").split("\n")[0];
79
+ return { pass: false, detail: `still broken: ${first}` };
80
+ }
81
+ },
82
+ },
83
+ {
84
+ id: "add-function",
85
+ expectedFiles: ["math.js"],
86
+ description: "Add a function to an existing module",
87
+ prompt:
88
+ "In math.js, add a named export `add(a, b)` that returns a + b. Keep the existing `mul` export.",
89
+ setup: (dir) => {
90
+ fs.writeFileSync(
91
+ path.join(dir, "math.js"),
92
+ "export function mul(a, b) {\n return a * b;\n}\n",
93
+ "utf8",
94
+ );
95
+ },
96
+ check: async (dir) => {
97
+ const src = read(dir, "math.js");
98
+ if (src == null) return { pass: false, detail: "math.js missing" };
99
+ if (!/export\s+function\s+mul/.test(src)) {
100
+ return { pass: false, detail: "mul export was removed" };
101
+ }
102
+ // Import the module and exercise both exports — behavioral, not textual.
103
+ try {
104
+ const url = "file://" + path.join(dir, "math.js").replace(/\\/g, "/");
105
+ const mod = await import(url);
106
+ if (typeof mod.add !== "function") {
107
+ return { pass: false, detail: "add is not exported as a function" };
108
+ }
109
+ if (mod.add(2, 3) !== 5 || mod.mul(2, 3) !== 6) {
110
+ return { pass: false, detail: "add/mul returned wrong values" };
111
+ }
112
+ return { pass: true, detail: "add + mul both work" };
113
+ } catch (err) {
114
+ return { pass: false, detail: `import failed: ${err.message}` };
115
+ }
116
+ },
117
+ },
118
+ {
119
+ id: "fix-failing-test",
120
+ expectedFiles: ["calc.js"],
121
+ description:
122
+ "Fix a bug so an existing test suite passes (bug-fix category)",
123
+ prompt:
124
+ "calc.js has a bug — `sum` subtracts instead of adds. Fix calc.js so that " +
125
+ "running `node run-checks.mjs` passes (it exits 0 and prints ALL OK). Do " +
126
+ "not edit run-checks.mjs.",
127
+ setup: (dir) => {
128
+ // A buggy module + a real check harness that exercises it. The agent must
129
+ // repair the MODULE, not the checks — verified by actually running them.
130
+ fs.writeFileSync(
131
+ path.join(dir, "calc.js"),
132
+ "export function sum(a, b) {\n return a - b;\n}\n",
133
+ "utf8",
134
+ );
135
+ fs.writeFileSync(
136
+ path.join(dir, "run-checks.mjs"),
137
+ [
138
+ "import { sum } from './calc.js';",
139
+ "const cases = [[1,2,3],[10,5,15],[0,0,0]];",
140
+ "for (const [a,b,want] of cases) {",
141
+ " if (sum(a,b) !== want) {",
142
+ " console.error(`FAIL sum(${a},${b})=${sum(a,b)} want ${want}`);",
143
+ " process.exit(1);",
144
+ " }",
145
+ "}",
146
+ "console.log('ALL OK');",
147
+ "",
148
+ ].join("\n"),
149
+ "utf8",
150
+ );
151
+ },
152
+ check: (dir) => {
153
+ // Objective: the test harness must actually pass. Guard against the agent
154
+ // "fixing" it by neutering run-checks.mjs — require the assertions to
155
+ // still be present.
156
+ const checks = read(dir, "run-checks.mjs");
157
+ if (checks == null)
158
+ return { pass: false, detail: "run-checks.mjs missing" };
159
+ if (!/sum\(a,\s*b\)\s*!==\s*want/.test(checks)) {
160
+ return {
161
+ pass: false,
162
+ detail: "run-checks.mjs assertions were altered",
163
+ };
164
+ }
165
+ try {
166
+ const out = execFileSync(process.execPath, ["run-checks.mjs"], {
167
+ cwd: dir,
168
+ encoding: "utf8",
169
+ timeout: 10000,
170
+ stdio: ["ignore", "pipe", "pipe"],
171
+ });
172
+ return out.includes("ALL OK")
173
+ ? { pass: true, detail: "test suite passes" }
174
+ : {
175
+ pass: false,
176
+ detail: `unexpected output ${JSON.stringify(out.trim())}`,
177
+ };
178
+ } catch (err) {
179
+ const first = String(err.message || "").split("\n")[0];
180
+ return { pass: false, detail: `checks still failing: ${first}` };
181
+ }
182
+ },
183
+ },
184
+ {
185
+ id: "refactor-rename",
186
+ expectedFiles: ["util.js", "main.js"],
187
+ description:
188
+ "Rename a symbol across two files, keeping behavior (refactor)",
189
+ prompt:
190
+ "Rename the exported function `oldTotal` to `computeTotal` EVERYWHERE it " +
191
+ "appears (both util.js which defines it and main.js which imports and " +
192
+ "calls it). Behavior must be unchanged: `node main.js` must still print 6.",
193
+ setup: (dir) => {
194
+ fs.writeFileSync(
195
+ path.join(dir, "util.js"),
196
+ "export function oldTotal(nums) {\n return nums.reduce((a, b) => a + b, 0);\n}\n",
197
+ "utf8",
198
+ );
199
+ fs.writeFileSync(
200
+ path.join(dir, "main.js"),
201
+ "import { oldTotal } from './util.js';\nconsole.log(oldTotal([1, 2, 3]));\n",
202
+ "utf8",
203
+ );
204
+ },
205
+ check: (dir) => {
206
+ const util = read(dir, "util.js");
207
+ const main = read(dir, "main.js");
208
+ if (util == null || main == null) {
209
+ return { pass: false, detail: "util.js or main.js missing" };
210
+ }
211
+ // The old name must be gone from BOTH files (a real rename, not an alias).
212
+ if (/\boldTotal\b/.test(util) || /\boldTotal\b/.test(main)) {
213
+ return {
214
+ pass: false,
215
+ detail: "oldTotal still present (incomplete rename)",
216
+ };
217
+ }
218
+ if (!/\bcomputeTotal\b/.test(util) || !/\bcomputeTotal\b/.test(main)) {
219
+ return { pass: false, detail: "computeTotal not used in both files" };
220
+ }
221
+ // Behavior must be preserved: run main.js and check the output.
222
+ try {
223
+ const out = execFileSync(process.execPath, ["main.js"], {
224
+ cwd: dir,
225
+ encoding: "utf8",
226
+ timeout: 10000,
227
+ stdio: ["ignore", "pipe", "pipe"],
228
+ });
229
+ return out.trim() === "6"
230
+ ? { pass: true, detail: "renamed + behavior preserved" }
231
+ : {
232
+ pass: false,
233
+ detail: `main.js printed ${JSON.stringify(out.trim())}`,
234
+ };
235
+ } catch (err) {
236
+ const first = String(err.message || "").split("\n")[0];
237
+ return { pass: false, detail: `main.js broken after rename: ${first}` };
238
+ }
239
+ },
240
+ },
241
+ {
242
+ id: "write-test",
243
+ expectedFiles: ["verify.mjs"],
244
+ description:
245
+ "Write a meaningful verifier for a module (test-completion category)",
246
+ prompt:
247
+ "Write a Node script `verify.mjs` that imports `slugify` from `./slug.mjs` " +
248
+ "and checks it: exit 0 if slugify('Hello World') === 'hello-world' AND " +
249
+ "slugify(' A_B ') === 'a-b' (lowercase; runs of spaces/underscores become a " +
250
+ "single hyphen; trimmed), otherwise print what failed and exit 1. Do not " +
251
+ "modify slug.mjs.",
252
+ setup: (dir) => {
253
+ fs.writeFileSync(
254
+ path.join(dir, "slug.mjs"),
255
+ "export function slugify(s) {\n" +
256
+ " return String(s).trim().toLowerCase().replace(/[\\s_]+/g, '-');\n" +
257
+ "}\n",
258
+ "utf8",
259
+ );
260
+ },
261
+ check: (dir) => {
262
+ const slug = read(dir, "slug.mjs");
263
+ if (slug == null) return { pass: false, detail: "slug.mjs missing" };
264
+ if (!/export\s+function\s+slugify/.test(slug)) {
265
+ return { pass: false, detail: "slug.mjs export was changed" };
266
+ }
267
+ if (read(dir, "verify.mjs") == null) {
268
+ return { pass: false, detail: "verify.mjs not created" };
269
+ }
270
+ const run = () =>
271
+ execFileSync(process.execPath, ["verify.mjs"], {
272
+ cwd: dir,
273
+ timeout: 10000,
274
+ stdio: ["ignore", "pipe", "pipe"],
275
+ });
276
+ // 1) The verifier must PASS against the correct implementation.
277
+ try {
278
+ run();
279
+ } catch {
280
+ return {
281
+ pass: false,
282
+ detail: "verify.mjs failed against the correct implementation",
283
+ };
284
+ }
285
+ // 2) It must FAIL against a broken slugify — otherwise it's a no-op test
286
+ // that would rubber-stamp any implementation.
287
+ const good = slug;
288
+ try {
289
+ fs.writeFileSync(
290
+ path.join(dir, "slug.mjs"),
291
+ "export function slugify(s) {\n return String(s);\n}\n", // identity = wrong
292
+ "utf8",
293
+ );
294
+ let caughtFailure = false;
295
+ try {
296
+ run();
297
+ } catch {
298
+ caughtFailure = true;
299
+ }
300
+ if (!caughtFailure) {
301
+ return {
302
+ pass: false,
303
+ detail:
304
+ "verify.mjs passed even a broken slugify — the test is not meaningful",
305
+ };
306
+ }
307
+ } finally {
308
+ fs.writeFileSync(path.join(dir, "slug.mjs"), good, "utf8"); // restore
309
+ }
310
+ return {
311
+ pass: true,
312
+ detail: "verifier passes on the correct impl and catches a broken one",
313
+ };
314
+ },
315
+ },
316
+ {
317
+ id: "migrate-signature",
318
+ expectedFiles: ["greet.mjs", "app.mjs"],
319
+ description:
320
+ "Migrate a function's call convention and update all callers (api-upgrade category)",
321
+ prompt:
322
+ "In greet.mjs, change the exported `greet` to take a single options object " +
323
+ "`greet({ name, excited })`, returning `Hello, <name>!` normally or " +
324
+ "`Hello, <name>!!!` when `excited` is true. Update ALL callers in app.mjs to " +
325
+ "the new signature. Running `node app.mjs` must print exactly two lines:\n" +
326
+ "Hello, Ada!\nHello, Bob!!!",
327
+ setup: (dir) => {
328
+ fs.writeFileSync(
329
+ path.join(dir, "greet.mjs"),
330
+ "export function greet(name, excited) {\n" +
331
+ " return `Hello, ${name}!` + (excited ? '!!' : '');\n" +
332
+ "}\n",
333
+ "utf8",
334
+ );
335
+ fs.writeFileSync(
336
+ path.join(dir, "app.mjs"),
337
+ "import { greet } from './greet.mjs';\n" +
338
+ "console.log(greet('Ada', false));\n" +
339
+ "console.log(greet('Bob', true));\n",
340
+ "utf8",
341
+ );
342
+ },
343
+ check: (dir) => {
344
+ const g = read(dir, "greet.mjs");
345
+ const a = read(dir, "app.mjs");
346
+ if (g == null || a == null)
347
+ return { pass: false, detail: "greet.mjs / app.mjs missing" };
348
+ // New signature: greet must destructure an object parameter.
349
+ if (!/greet\s*\(\s*\{/.test(g)) {
350
+ return {
351
+ pass: false,
352
+ detail: "greet was not migrated to an options object",
353
+ };
354
+ }
355
+ // No caller may still pass the old positional (string-first) arguments.
356
+ if (/greet\(\s*['"`]/.test(a)) {
357
+ return {
358
+ pass: false,
359
+ detail: "a caller still uses the old positional signature",
360
+ };
361
+ }
362
+ try {
363
+ const out = execFileSync(process.execPath, ["app.mjs"], {
364
+ cwd: dir,
365
+ encoding: "utf8",
366
+ timeout: 10000,
367
+ stdio: ["ignore", "pipe", "pipe"],
368
+ }).trim();
369
+ return out === "Hello, Ada!\nHello, Bob!!!"
370
+ ? { pass: true, detail: "signature migrated + callers updated" }
371
+ : { pass: false, detail: `app.mjs printed ${JSON.stringify(out)}` };
372
+ } catch (err) {
373
+ const first = String(err.message || "").split("\n")[0];
374
+ return { pass: false, detail: `app.mjs failed: ${first}` };
375
+ }
376
+ },
377
+ },
378
+ {
379
+ id: "secure-path",
380
+ expectedFiles: ["notes.mjs"],
381
+ description:
382
+ "Fix a path-traversal vulnerability, verified by an exploit probe (security-fix category)",
383
+ prompt:
384
+ "notes.mjs's `readNote` is vulnerable to path traversal — a name like " +
385
+ "'../secret.txt' escapes the notes directory. Fix `readNote` so it can ONLY " +
386
+ "read files inside the notes directory (reject or neutralize both '../' and " +
387
+ "absolute paths), while `readNote('hello.txt')` still returns 'hi'. Keep the " +
388
+ "export name and signature.",
389
+ setup: (dir) => {
390
+ fs.mkdirSync(path.join(dir, "notes"), { recursive: true });
391
+ fs.writeFileSync(path.join(dir, "notes", "hello.txt"), "hi", "utf8");
392
+ // The secret lives OUTSIDE notes/ — a fixed readNote must never reach it.
393
+ fs.writeFileSync(path.join(dir, "secret.txt"), "TOP_SECRET", "utf8");
394
+ // BASE is anchored to the module's own dir (not process.cwd()) so the
395
+ // check can import it from anywhere.
396
+ fs.writeFileSync(
397
+ path.join(dir, "notes.mjs"),
398
+ "import fs from 'node:fs';\n" +
399
+ "import path from 'node:path';\n" +
400
+ "import { fileURLToPath } from 'node:url';\n" +
401
+ "const BASE = path.join(path.dirname(fileURLToPath(import.meta.url)), 'notes');\n" +
402
+ "// VULNERABLE: `name` can contain ../ (or be absolute) and escape BASE.\n" +
403
+ "export function readNote(name) {\n" +
404
+ " return fs.readFileSync(path.join(BASE, name), 'utf8');\n" +
405
+ "}\n",
406
+ "utf8",
407
+ );
408
+ },
409
+ check: async (dir) => {
410
+ const src = read(dir, "notes.mjs");
411
+ if (src == null) return { pass: false, detail: "notes.mjs missing" };
412
+ if (!/export\s+function\s+readNote/.test(src)) {
413
+ return { pass: false, detail: "readNote export was removed/renamed" };
414
+ }
415
+ let mod;
416
+ try {
417
+ const url = "file://" + path.join(dir, "notes.mjs").replace(/\\/g, "/");
418
+ mod = await import(url);
419
+ } catch (err) {
420
+ return { pass: false, detail: `import failed: ${err.message}` };
421
+ }
422
+ // 1) Behavior: a legitimate read still works.
423
+ let hi;
424
+ try {
425
+ hi = mod.readNote("hello.txt");
426
+ } catch (err) {
427
+ return {
428
+ pass: false,
429
+ detail: `readNote('hello.txt') threw: ${err.message}`,
430
+ };
431
+ }
432
+ if (String(hi).trim() !== "hi") {
433
+ return {
434
+ pass: false,
435
+ detail: `readNote('hello.txt') = ${JSON.stringify(hi)}`,
436
+ };
437
+ }
438
+ // 2) Exploit probe — relative traversal must NOT leak the secret.
439
+ let leaked = null;
440
+ try {
441
+ leaked = mod.readNote("../secret.txt");
442
+ } catch {
443
+ leaked = null; // throwing is a valid way to reject
444
+ }
445
+ if (leaked != null && String(leaked).includes("TOP_SECRET")) {
446
+ return {
447
+ pass: false,
448
+ detail: "relative traversal still reads files outside notes/",
449
+ };
450
+ }
451
+ // 3) Exploit probe — an absolute path must NOT escape either.
452
+ let leaked2 = null;
453
+ try {
454
+ leaked2 = mod.readNote(path.join(dir, "secret.txt"));
455
+ } catch {
456
+ leaked2 = null;
457
+ }
458
+ if (leaked2 != null && String(leaked2).includes("TOP_SECRET")) {
459
+ return { pass: false, detail: "absolute path escapes notes/" };
460
+ }
461
+ return {
462
+ pass: true,
463
+ detail: "traversal neutralized, legitimate read preserved",
464
+ };
465
+ },
466
+ },
467
+ {
468
+ id: "fix-build",
469
+ expectedFiles: ["config.mjs", "app.mjs"],
470
+ description:
471
+ "Fix a cross-module build/link failure so the build passes (build-failure category)",
472
+ prompt:
473
+ "The build is broken: `node build.mjs` fails to LINK because of an " +
474
+ "export/import name mismatch between app.mjs and config.mjs. Reconcile " +
475
+ "them so `node build.mjs` prints BUILD OK. Do not edit build.mjs.",
476
+ setup: (dir) => {
477
+ // config exports `version` (lowercase) but app imports `VERSION` — an ESM
478
+ // link error at build time, distinct from a single-file syntax typo.
479
+ fs.writeFileSync(
480
+ path.join(dir, "config.mjs"),
481
+ 'export const version = "1.0.0";\n',
482
+ "utf8",
483
+ );
484
+ fs.writeFileSync(
485
+ path.join(dir, "app.mjs"),
486
+ 'import { VERSION } from "./config.mjs";\n' +
487
+ 'export function banner() {\n return "v" + VERSION;\n}\n',
488
+ "utf8",
489
+ );
490
+ fs.writeFileSync(
491
+ path.join(dir, "build.mjs"),
492
+ 'import { banner } from "./app.mjs";\n' +
493
+ 'if (banner() !== "v1.0.0") {\n' +
494
+ ' console.error("BUILD FAIL: " + banner());\n' +
495
+ " process.exit(1);\n" +
496
+ "}\n" +
497
+ 'console.log("BUILD OK");\n',
498
+ "utf8",
499
+ );
500
+ },
501
+ check: (dir) => {
502
+ const build = read(dir, "build.mjs");
503
+ if (build == null) return { pass: false, detail: "build.mjs missing" };
504
+ // Guard: fix the modules, don't neuter the build harness.
505
+ if (!/banner\(\)\s*!==\s*"v1\.0\.0"/.test(build)) {
506
+ return { pass: false, detail: "build.mjs assertion was altered" };
507
+ }
508
+ try {
509
+ const out = execFileSync(process.execPath, ["build.mjs"], {
510
+ cwd: dir,
511
+ encoding: "utf8",
512
+ timeout: 10000,
513
+ stdio: ["ignore", "pipe", "pipe"],
514
+ });
515
+ return out.includes("BUILD OK")
516
+ ? { pass: true, detail: "build links + passes" }
517
+ : {
518
+ pass: false,
519
+ detail: `unexpected output ${JSON.stringify(out.trim())}`,
520
+ };
521
+ } catch (err) {
522
+ const first = String(err.message || "").split("\n")[0];
523
+ return { pass: false, detail: `build still failing: ${first}` };
524
+ }
525
+ },
526
+ },
527
+ {
528
+ id: "upgrade-dependency",
529
+ expectedFiles: ["package.json", "app.mjs"],
530
+ description:
531
+ "Adapt code to a dependency's breaking upgrade + bump the manifest (dependency-upgrade category)",
532
+ prompt:
533
+ "The `stringutil` dependency was upgraded to 2.0.0. Breaking change: its " +
534
+ "`capitalize` export was renamed to `toTitle` (same behavior). Do all of: " +
535
+ "(1) bump stringutil to ^2.0.0 in package.json; (2) update app.mjs to " +
536
+ "import and use `toTitle` instead of `capitalize`; (3) do NOT edit " +
537
+ "stringutil.mjs. Afterwards `node run.mjs` must print OK.",
538
+ setup: (dir) => {
539
+ fs.writeFileSync(
540
+ path.join(dir, "package.json"),
541
+ JSON.stringify(
542
+ {
543
+ name: "app",
544
+ type: "module",
545
+ dependencies: { stringutil: "1.0.0" },
546
+ },
547
+ null,
548
+ 2,
549
+ ) + "\n",
550
+ "utf8",
551
+ );
552
+ // The upgraded (v2) dependency — vendored, must not be edited.
553
+ fs.writeFileSync(path.join(dir, "stringutil.mjs"), STRINGUTIL_V2, "utf8");
554
+ // The caller still uses the removed v1 `capitalize` export (link error).
555
+ fs.writeFileSync(
556
+ path.join(dir, "app.mjs"),
557
+ 'import { capitalize } from "./stringutil.mjs";\n' +
558
+ "export function label(s) {\n return capitalize(s);\n}\n",
559
+ "utf8",
560
+ );
561
+ fs.writeFileSync(
562
+ path.join(dir, "run.mjs"),
563
+ 'import { label } from "./app.mjs";\n' +
564
+ 'if (label("hello") !== "Hello") {\n' +
565
+ ' console.error("FAIL: " + label("hello"));\n' +
566
+ " process.exit(1);\n" +
567
+ "}\n" +
568
+ 'console.log("OK");\n',
569
+ "utf8",
570
+ );
571
+ },
572
+ check: (dir) => {
573
+ // The dependency is vendored — the agent must adapt the caller, NOT edit
574
+ // the dependency to re-add the old export and dodge the upgrade.
575
+ const dep = read(dir, "stringutil.mjs");
576
+ if (dep == null) return { pass: false, detail: "stringutil.mjs missing" };
577
+ if (dep !== STRINGUTIL_V2) {
578
+ return {
579
+ pass: false,
580
+ detail: "the stringutil dependency was edited (adapt the caller)",
581
+ };
582
+ }
583
+ const pkg = read(dir, "package.json");
584
+ if (pkg == null || !/"stringutil"\s*:\s*"[\^~]?2\./.test(pkg)) {
585
+ return {
586
+ pass: false,
587
+ detail: "package.json not bumped to stringutil 2.x",
588
+ };
589
+ }
590
+ const app = read(dir, "app.mjs");
591
+ if (app == null) return { pass: false, detail: "app.mjs missing" };
592
+ if (/\bcapitalize\b/.test(app)) {
593
+ return {
594
+ pass: false,
595
+ detail: "app.mjs still references the removed capitalize export",
596
+ };
597
+ }
598
+ if (!/\btoTitle\b/.test(app)) {
599
+ return { pass: false, detail: "app.mjs does not use the new toTitle" };
600
+ }
601
+ try {
602
+ const out = execFileSync(process.execPath, ["run.mjs"], {
603
+ cwd: dir,
604
+ encoding: "utf8",
605
+ timeout: 10000,
606
+ stdio: ["ignore", "pipe", "pipe"],
607
+ });
608
+ return out.trim() === "OK"
609
+ ? { pass: true, detail: "adapted to new API + manifest bumped" }
610
+ : {
611
+ pass: false,
612
+ detail: `run.mjs printed ${JSON.stringify(out.trim())}`,
613
+ };
614
+ } catch (err) {
615
+ const first = String(err.message || "").split("\n")[0];
616
+ return { pass: false, detail: `run.mjs failed: ${first}` };
617
+ }
618
+ },
619
+ },
620
+ ];
621
+
622
+ /** Look up a suite by name (only "builtin" for now). */
623
+ export function getSuite(name = "builtin") {
624
+ if (name === "builtin" || !name) return BUILTIN_TASKS;
625
+ throw new Error(`unknown eval suite: "${name}" (available: builtin)`);
626
+ }