chainlesschain 0.166.21 → 0.166.24

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 (301) hide show
  1. package/README.md +67 -9
  2. package/package.json +4 -3
  3. package/src/assets/web-panel/assets/{AIOps-BjMnsUci.js → AIOps-DR-MWcZc.js} +1 -1
  4. package/src/assets/web-panel/assets/{ActionButton-DdYFP03A.js → ActionButton-DT8B7sEb.js} +1 -1
  5. package/src/assets/web-panel/assets/{Analytics-Bb8TuuK_.js → Analytics-asjh3dQJ.js} +3 -3
  6. package/src/assets/web-panel/assets/{AppLayout-Kn3TIOtk.js → AppLayout-DivQ491i.js} +5 -5
  7. package/src/assets/web-panel/assets/{Artifacts-4IxpqI_b.js → Artifacts-DPH2uUmy.js} +1 -1
  8. package/src/assets/web-panel/assets/{Audit-BOV2caqU.js → Audit-Bp2nLyc-.js} +1 -1
  9. package/src/assets/web-panel/assets/{BackgroundAgents-B86k-ay4.js → BackgroundAgents-CHS28khl.js} +1 -1
  10. package/src/assets/web-panel/assets/{Backup-C5_ie1e3.js → Backup-CKeaFSfz.js} +1 -1
  11. package/src/assets/web-panel/assets/{BaseInput-xpwg6QCW.js → BaseInput-CxwM9BAH.js} +1 -1
  12. package/src/assets/web-panel/assets/{Chat-CVZOcZau.js → Chat-DYLDwaCv.js} +4 -4
  13. package/src/assets/web-panel/assets/{ChatBubbleRenderer-D8fPYhUu.js → ChatBubbleRenderer-DdBJDBP0.js} +1 -1
  14. package/src/assets/web-panel/assets/{Checkbox-MKTq3zdP.js → Checkbox-uYTWOB8j.js} +1 -1
  15. package/src/assets/web-panel/assets/{Codegen-JUk3wzep.js → Codegen-CvYa_dwT.js} +1 -1
  16. package/src/assets/web-panel/assets/{Col-JPvTA0kC.js → Col-CanMAX4m.js} +1 -1
  17. package/src/assets/web-panel/assets/{Community-Tqgl87NQ.js → Community-B4WaDtHw.js} +1 -1
  18. package/src/assets/web-panel/assets/{Compact-BuAFYBmN.js → Compact-K93Uof_3.js} +1 -1
  19. package/src/assets/web-panel/assets/{Compliance-CXS9WIPZ.js → Compliance-CKeDLgUW.js} +1 -1
  20. package/src/assets/web-panel/assets/{Cowork-Ds2bFHrr.js → Cowork-P93grAeB.js} +3 -3
  21. package/src/assets/web-panel/assets/{Cron-C_dV_OeW.js → Cron-BSHnMtDn.js} +2 -2
  22. package/src/assets/web-panel/assets/{Crosschain-BsO6tIRo.js → Crosschain-epAOpUVJ.js} +1 -1
  23. package/src/assets/web-panel/assets/{DID-rNOFqBac.js → DID-ByjXfP7t.js} +2 -2
  24. package/src/assets/web-panel/assets/{Dashboard-C2fcKKVY.js → Dashboard-QztTU8tb.js} +2 -2
  25. package/src/assets/web-panel/assets/{Dropdown-Y7Ndr0X_.js → Dropdown-DhUc9yhN.js} +1 -1
  26. package/src/assets/web-panel/assets/{EmailListRenderer-DcP_uPmL.js → EmailListRenderer-C2sLhJJN.js} +1 -1
  27. package/src/assets/web-panel/assets/{FamilyGuardDashboard-Cwn3gDzk.js → FamilyGuardDashboard-CdfbWNDn.js} +1 -1
  28. package/src/assets/web-panel/assets/{Federation-ClQuOsqb.js → Federation-CcF_R7NW.js} +1 -1
  29. package/src/assets/web-panel/assets/{FormItemContext-DfwtmlcK.js → FormItemContext-Cm_X2IBk.js} +1 -1
  30. package/src/assets/web-panel/assets/{GenericCardRenderer-zNZhtbC5.js → GenericCardRenderer-DUi4NWlb.js} +1 -1
  31. package/src/assets/web-panel/assets/{Git-BZmdW-G5.js → Git-4Sq5FjBt.js} +2 -2
  32. package/src/assets/web-panel/assets/{Governance-CqBk4lEn.js → Governance-Dx2_v4V6.js} +1 -1
  33. package/src/assets/web-panel/assets/{Inference-Dbmt3ZXk.js → Inference-7Vr1xekR.js} +1 -1
  34. package/src/assets/web-panel/assets/{KnowledgeGraph-hMTH6qf3.js → KnowledgeGraph-Cnd2XOzf.js} +1 -1
  35. package/src/assets/web-panel/assets/{Logs-CkiYgiW2.js → Logs-B66QPVf-.js} +2 -2
  36. package/src/assets/web-panel/assets/{MarkdownRenderer-BL1FElXg.js → MarkdownRenderer-PLsEvhly.js} +1 -1
  37. package/src/assets/web-panel/assets/{Marketplace-CbB6wfin.js → Marketplace-BMIK9BmC.js} +1 -1
  38. package/src/assets/web-panel/assets/{McpTools-BSwiFtte.js → McpTools-BDbyp3J_.js} +3 -3
  39. package/src/assets/web-panel/assets/{Memory-B03PeHrz.js → Memory-CJdzfZGi.js} +2 -2
  40. package/src/assets/web-panel/assets/{MobileBridge-CRGrnd-X.js → MobileBridge-C2TH5Y3-.js} +1 -1
  41. package/src/assets/web-panel/assets/{MobileProjects-CE_5v2kO.js → MobileProjects-D1dYXkvV.js} +1 -1
  42. package/src/assets/web-panel/assets/{Mtc-Dp11QVx1.js → Mtc-B-4A1I1j.js} +4 -4
  43. package/src/assets/web-panel/assets/{MtcAudit-CYu-3JBu.js → MtcAudit-Bgcc9UOl.js} +5 -5
  44. package/src/assets/web-panel/assets/{Multisig-CGyJ0Xl3.js → Multisig-DqOe-etP.js} +3 -3
  45. package/src/assets/web-panel/assets/{NLProgramming-CoWi_ov1.js → NLProgramming-7VnhzE_6.js} +1 -1
  46. package/src/assets/web-panel/assets/Notes-BxawpeUQ.js +7 -0
  47. package/src/assets/web-panel/assets/{NotificationSettings-DX4I2b4W.js → NotificationSettings-Cr08G2aE.js} +1 -1
  48. package/src/assets/web-panel/assets/OrderTableRenderer-Ce8bEGlK.js +1 -0
  49. package/src/assets/web-panel/assets/{Organization-oopLO_tk.js → Organization-BC7lveGv.js} +4 -4
  50. package/src/assets/web-panel/assets/{Overflow-BFVvjMyf.js → Overflow-CakOW-G0.js} +1 -1
  51. package/src/assets/web-panel/assets/{P2P-CBy5t-Tk.js → P2P-Cf8CaOBZ.js} +2 -2
  52. package/src/assets/web-panel/assets/{PdhVaultBrowser--YWJNsu6.js → PdhVaultBrowser-Dc7b98W9.js} +3 -3
  53. package/src/assets/web-panel/assets/{Permissions-C2dZ8scb.js → Permissions-DGJyMEfS.js} +4 -4
  54. package/src/assets/web-panel/assets/{PersonalDataHub-Bs3l7Hlx.js → PersonalDataHub-DNIwSdwu.js} +6 -6
  55. package/src/assets/web-panel/assets/{Pipeline-DEBWbZuD.js → Pipeline-5B1S12wa.js} +1 -1
  56. package/src/assets/web-panel/assets/{Privacy-CjHBb6NU.js → Privacy-CMB6Ke5t.js} +1 -1
  57. package/src/assets/web-panel/assets/{ProjectInit-D2WipUz5.js → ProjectInit-D5PqTFiT.js} +2 -2
  58. package/src/assets/web-panel/assets/{ProjectSettings-B6WfnrGB.js → ProjectSettings-CbKNdSjV.js} +2 -2
  59. package/src/assets/web-panel/assets/Projects-ccXaHzYL.js +1 -0
  60. package/src/assets/web-panel/assets/{Providers-CCv5M_Dv.js → Providers-CJF5_-Gs.js} +1 -1
  61. package/src/assets/web-panel/assets/{QrScannerModal-CGthxU54.js → QrScannerModal-CT6iEAdi.js} +1 -1
  62. package/src/assets/web-panel/assets/{QuickAsk-CnPmXPFb.js → QuickAsk-Ci0h9mJ_.js} +1 -1
  63. package/src/assets/web-panel/assets/{Recommend-Df_tGEa9.js → Recommend-Da5mobZu.js} +1 -1
  64. package/src/assets/web-panel/assets/{RemoteSession-Z58N0Loe.js → RemoteSession-BaCY8eey.js} +2 -2
  65. package/src/assets/web-panel/assets/{Reputation-CZTBQ2Vt.js → Reputation-CaITfTsI.js} +1 -1
  66. package/src/assets/web-panel/assets/{Row-CdK3YpCQ.js → Row-DtUDamyP.js} +1 -1
  67. package/src/assets/web-panel/assets/{RssFeed-CFMVT5sb.js → RssFeed-DX27gFpg.js} +3 -3
  68. package/src/assets/web-panel/assets/{Search-DrF8RIvD.js → Search-DFL69osN.js} +1 -1
  69. package/src/assets/web-panel/assets/{Security-Ddk2f2DM.js → Security-BqGeoWv-.js} +3 -3
  70. package/src/assets/web-panel/assets/{Services-CCuK-VOo.js → Services-3z1WnEAc.js} +2 -2
  71. package/src/assets/web-panel/assets/{Skeleton-DxCpHzeM.js → Skeleton-C_OJQQ9Z.js} +1 -1
  72. package/src/assets/web-panel/assets/{Skills-t2oTDgcv.js → Skills-BY7aT6Mo.js} +1 -1
  73. package/src/assets/web-panel/assets/{Sla-Df63M9_R.js → Sla-BZv7DSaD.js} +1 -1
  74. package/src/assets/web-panel/assets/SpeechSettings-6lJKLhCn.js +1 -0
  75. package/src/assets/web-panel/assets/{SyncSettings-COd_tgPp.js → SyncSettings-B6D7STlI.js} +2 -2
  76. package/src/assets/web-panel/assets/{Tasks-CzDCcrik.js → Tasks-Co_FCZAO.js} +1 -1
  77. package/src/assets/web-panel/assets/{Templates-D-vfxTGA.js → Templates-CnY-9fgz.js} +1 -1
  78. package/src/assets/web-panel/assets/{Tenant-BlpT_Gxc.js → Tenant-B71yXfZ8.js} +1 -1
  79. package/src/assets/web-panel/assets/{Terminal-D5rq52Hg.js → Terminal-Dd_P7awo.js} +2 -2
  80. package/src/assets/web-panel/assets/{TimelineRenderer-DdoMndkK.js → TimelineRenderer-CvIEMyli.js} +1 -1
  81. package/src/assets/web-panel/assets/{Tokens-BhgBsI6g.js → Tokens-DknFBGOi.js} +1 -1
  82. package/src/assets/web-panel/assets/{Trigger-DwwzoikZ.js → Trigger-D_4nJONB.js} +1 -1
  83. package/src/assets/web-panel/assets/{Trust-HkTpzXFb.js → Trust-BNl21fa7.js} +1 -1
  84. package/src/assets/web-panel/assets/{UkeySign-D9nk6Ehe.js → UkeySign-CFrCI7uK.js} +1 -1
  85. package/src/assets/web-panel/assets/{VideoEditing-BKk0rfoy.js → VideoEditing-BVfY6JLg.js} +1 -1
  86. package/src/assets/web-panel/assets/{Wallet-IVWIU_Lq.js → Wallet-Cj9CAK0J.js} +4 -4
  87. package/src/assets/web-panel/assets/{WebAuthn-CFTCpfsG.js → WebAuthn-DcqZlzA3.js} +4 -4
  88. package/src/assets/web-panel/assets/{WorkflowEditor-Dnf4Obif.js → WorkflowEditor-Dfr_dMld.js} +1 -1
  89. package/src/assets/web-panel/assets/{chat-D2snERdj.js → chat-Yv6UF0AD.js} +1 -1
  90. package/src/assets/web-panel/assets/{colors-DKEjK1N1.js → colors-CDW_-1fs.js} +1 -1
  91. package/src/assets/web-panel/assets/{compact-item-BEDLwQdt.js → compact-item-BYOQvd-6.js} +1 -1
  92. package/src/assets/web-panel/assets/{createContext-DA9iW1a0.js → createContext-BCGO0BiP.js} +1 -1
  93. package/src/assets/web-panel/assets/devWarning-H-kXSuf-.js +1 -0
  94. package/src/assets/web-panel/assets/{hasIn-5l2xEcY9.js → hasIn-DY-70cfQ.js} +1 -1
  95. package/src/assets/web-panel/assets/{index-B7_W_rYd.js → index-366wfQBU.js} +1 -1
  96. package/src/assets/web-panel/assets/index-B0o4MeNK.js +1 -0
  97. package/src/assets/web-panel/assets/{index-CxEtQYdi.js → index-B9ZogJJM.js} +1 -1
  98. package/src/assets/web-panel/assets/{index-B00GeekA.js → index-B9m5QAMg.js} +1 -1
  99. package/src/assets/web-panel/assets/{index-C7sKbM5s.js → index-BBs2mv5M.js} +1 -1
  100. package/src/assets/web-panel/assets/{index-CX1x4AFn.js → index-BFv1hzF6.js} +1 -1
  101. package/src/assets/web-panel/assets/index-BVafOL_I.js +1 -0
  102. package/src/assets/web-panel/assets/{index-DU2TXJu-.js → index-BXlEx4UH.js} +1 -1
  103. package/src/assets/web-panel/assets/{index-e-e40id6.js → index-BayRTE5w.js} +1 -1
  104. package/src/assets/web-panel/assets/{index-DXet1xol.js → index-Bb9nyts1.js} +1 -1
  105. package/src/assets/web-panel/assets/{index-D7z4zB_a.js → index-Bf_Va0S-.js} +1 -1
  106. package/src/assets/web-panel/assets/{index-fccZmC_h.js → index-Br3wQLVY.js} +1 -1
  107. package/src/assets/web-panel/assets/{index-Bqc8tdIF.js → index-BvK4fjkk.js} +1 -1
  108. package/src/assets/web-panel/assets/{index-BO9dQjpt.js → index-C40UdtlS.js} +1 -1
  109. package/src/assets/web-panel/assets/{index-Csfb-7hw.js → index-C4UJA2ju.js} +1 -1
  110. package/src/assets/web-panel/assets/{index-Td8ZwyoC.js → index-CB_Iw73G.js} +1 -1
  111. package/src/assets/web-panel/assets/{index-BZ5lY2zx.js → index-CCwWp3mT.js} +1 -1
  112. package/src/assets/web-panel/assets/{index-DpqtbXdE.js → index-CFa2fPCk.js} +1 -1
  113. package/src/assets/web-panel/assets/{index-NJieh3T1.js → index-CIyHxV4u.js} +1 -1
  114. package/src/assets/web-panel/assets/{index-Dbkghqn_.js → index-CUP-A2_h.js} +1 -1
  115. package/src/assets/web-panel/assets/{index-DqwPFbOb.js → index-CUo27q9J.js} +3 -3
  116. package/src/assets/web-panel/assets/{index-B4QYBliR.js → index-CaT8trvf.js} +1 -1
  117. package/src/assets/web-panel/assets/{index-BgfImyZI.js → index-CnZNbcux.js} +1 -1
  118. package/src/assets/web-panel/assets/{index-Dbd7eEex.js → index-Cy2NE6AO.js} +1 -1
  119. package/src/assets/web-panel/assets/{index-CbTPvp2_.js → index-CzeEEazr.js} +1 -1
  120. package/src/assets/web-panel/assets/{index-5pW4t1iD.js → index-D--TEyDj.js} +1 -1
  121. package/src/assets/web-panel/assets/{index-Dg2a9owQ.js → index-DCtsjhhT.js} +1 -1
  122. package/src/assets/web-panel/assets/{index-B_eCoZgW.js → index-DLOf7BSz.js} +1 -1
  123. package/src/assets/web-panel/assets/{index-7P1b8HZo.js → index-DM5c4pc-.js} +1 -1
  124. package/src/assets/web-panel/assets/{index-CRPrHE7h.js → index-DRFC2Qt0.js} +1 -1
  125. package/src/assets/web-panel/assets/{index-Bq5P3piS.js → index-DT_qVaaV.js} +1 -1
  126. package/src/assets/web-panel/assets/{index-CjWltbi_.js → index-DUDoRk9r.js} +1 -1
  127. package/src/assets/web-panel/assets/{index-CkMKuqUs.js → index-Dg-AQYDf.js} +1 -1
  128. package/src/assets/web-panel/assets/{index-DLoalqRX.js → index-DuIPq5MX.js} +1 -1
  129. package/src/assets/web-panel/assets/{index-CGlotREA.js → index-NYVBUAVN.js} +1 -1
  130. package/src/assets/web-panel/assets/{index-yYEQXYaU.js → index-NaCESahy.js} +1 -1
  131. package/src/assets/web-panel/assets/{index-CmruhzFi.js → index-RjIMPG0u.js} +1 -1
  132. package/src/assets/web-panel/assets/{index-fgYk0QXO.js → index-Y9akzgFO.js} +1 -1
  133. package/src/assets/web-panel/assets/{index-DvV03Ayk.js → index-hZ0Eyrrw.js} +1 -1
  134. package/src/assets/web-panel/assets/{initDefaultProps-CPrcB1TC.js → initDefaultProps-CG99CcR4.js} +1 -1
  135. package/src/assets/web-panel/assets/{motion-BQ7mWRh_.js → motion-Z7MH0_0G.js} +1 -1
  136. package/src/assets/web-panel/assets/{move-CzOEq99p.js → move-BX67lOdq.js} +1 -1
  137. package/src/assets/web-panel/assets/{mtc-parser-BlQI5jrw.js → mtc-parser-CmAbG1fE.js} +1 -1
  138. package/src/assets/web-panel/assets/{omit-DlW4gxmv.js → omit-DiU5tI1_.js} +1 -1
  139. package/src/assets/web-panel/assets/{pickAttrs-BBYms5nP.js → pickAttrs-BGfvLrYL.js} +1 -1
  140. package/src/assets/web-panel/assets/{placementArrow-az2MPJ_7.js → placementArrow-CggLEgaJ.js} +1 -1
  141. package/src/assets/web-panel/assets/{responsiveObserve-D1-ibEol.js → responsiveObserve-t3nlghPZ.js} +1 -1
  142. package/src/assets/web-panel/assets/{slide-DHGqa4GA.js → slide-BkV4dL9s.js} +1 -1
  143. package/src/assets/web-panel/assets/{statusUtils-CYGDo6lD.js → statusUtils-qec1PUoC.js} +1 -1
  144. package/src/assets/web-panel/assets/{styleChecker-Cl2EM9K6.js → styleChecker-ChjX6T8D.js} +1 -1
  145. package/src/assets/web-panel/assets/{useFlexGapSupport-DdYhzuv1.js → useFlexGapSupport-B1jLoZcM.js} +1 -1
  146. package/src/assets/web-panel/assets/{useFs-DWumPuBW.js → useFs-C3X53s4E.js} +1 -1
  147. package/src/assets/web-panel/assets/{usePersonalDataHub-DxAO-Aqi.js → usePersonalDataHub-DOvbbnkZ.js} +1 -1
  148. package/src/assets/web-panel/assets/{vnode-CplsQf_N.js → vnode-Ie0TEVFT.js} +1 -1
  149. package/src/assets/web-panel/assets/{zoom-Cw5HXNSG.js → zoom-CRUMVS8l.js} +1 -1
  150. package/src/assets/web-panel/index.html +1 -1
  151. package/src/command-help-index.json +3 -3
  152. package/src/commands/agent.js +18 -1
  153. package/src/commands/evolution-benchmark.js +72 -0
  154. package/src/commands/evolution.js +2 -0
  155. package/src/commands/governed-skill-marketplace.js +142 -0
  156. package/src/commands/marketplace.js +4 -1
  157. package/src/commands/serve.js +41 -0
  158. package/src/commands/skill.js +3 -0
  159. package/src/data/changelog.json +39 -0
  160. package/src/gateways/ws/ws-agent-handler.js +59 -2
  161. package/src/gateways/ws/ws-server.js +2 -0
  162. package/src/harness/golden-transcript.js +1 -0
  163. package/src/harness/prompt-compressor.js +51 -5
  164. package/src/harness/provider-backed-compaction.js +28 -1
  165. package/src/harness/remote-session-registry.js +15 -3
  166. package/src/index.js +30 -4
  167. package/src/lazy-dispatch.js +15 -1
  168. package/src/lib/advisor-runtime.js +55 -2
  169. package/src/lib/app-server/cli-agent-kernel-adapter.js +4 -0
  170. package/src/lib/app-server/graph-runtime.js +32 -0
  171. package/src/lib/app-server/server.js +45 -1
  172. package/src/lib/app-server/websocket-transport.js +23 -0
  173. package/src/lib/autonomous-agent.js +63 -13
  174. package/src/lib/cowork/ab-comparator-cli.js +4 -3
  175. package/src/lib/cowork/debate-review-cli.js +4 -3
  176. package/src/lib/cowork/decision-kb-cli.js +5 -0
  177. package/src/lib/cowork-adapter.js +38 -16
  178. package/src/lib/evolution/agent-evolution-ingress.js +95 -15
  179. package/src/lib/evolution/agent-evolution-runtime-composition.js +82 -0
  180. package/src/lib/evolution/agent-evolution-session-lifecycle.js +46 -0
  181. package/src/lib/evolution/agent-model-projection.js +217 -0
  182. package/src/lib/evolution/bounded-descriptor-read.js +29 -0
  183. package/src/lib/evolution/controlled-skill-pilot-ledger-adapter.js +551 -0
  184. package/src/lib/evolution/controlled-skill-production-pilot.js +308 -18
  185. package/src/lib/evolution/evidence-backed-wiki-maintainer.js +10 -1
  186. package/src/lib/evolution/evidence-json-text.js +236 -0
  187. package/src/lib/evolution/evolution-artifact-ports.js +202 -21
  188. package/src/lib/evolution/evolution-deployment-loader.js +369 -0
  189. package/src/lib/evolution/evolution-eval-child-evidence-ledger-adapter.js +373 -0
  190. package/src/lib/evolution/evolution-eval-gate.js +14 -1
  191. package/src/lib/evolution/evolution-eval-process-supervisor-worker.mjs +14 -0
  192. package/src/lib/evolution/evolution-eval-process-supervisor.js +607 -0
  193. package/src/lib/evolution/evolution-evidence-artifact-adapter.js +14 -1
  194. package/src/lib/evolution/evolution-evidence-projector.js +240 -37
  195. package/src/lib/evolution/evolution-file-witness.js +153 -30
  196. package/src/lib/evolution/evolution-ledger-ports.js +1027 -66
  197. package/src/lib/evolution/evolution-ledger.js +66 -2
  198. package/src/lib/evolution/evolution-raw-crypto-shred.js +29 -15
  199. package/src/lib/evolution/evolution-raw-deletion-ledger-adapter.js +865 -0
  200. package/src/lib/evolution/evolution-release-train-domain-stages.js +769 -0
  201. package/src/lib/evolution/evolution-release-train-ledger-adapter.js +335 -0
  202. package/src/lib/evolution/evolution-release-train-stage-output-ledger-adapter.js +333 -0
  203. package/src/lib/evolution/evolution-release-train.js +586 -0
  204. package/src/lib/evolution/evolution-workbench-batch-executor.js +101 -144
  205. package/src/lib/evolution/evolution-workbench-control-ports.js +203 -0
  206. package/src/lib/evolution/evolution-workbench-file-resources.js +403 -0
  207. package/src/lib/evolution/evolution-workbench-projection.js +152 -25
  208. package/src/lib/evolution/evolution-workbench-registry-source.js +482 -0
  209. package/src/lib/evolution/evolution-workbench-review-ledger-adapter.js +823 -0
  210. package/src/lib/evolution/evolution-workbench-review-protocol.js +157 -0
  211. package/src/lib/evolution/evolution-workbench-rollback-authorization.js +57 -0
  212. package/src/lib/evolution/evolution-workbench-rollback-ledger-adapter.js +1016 -0
  213. package/src/lib/evolution/evolution-workbench-runtime.js +133 -0
  214. package/src/lib/evolution/evolution-workbench-version-control.js +70 -36
  215. package/src/lib/evolution/evolvable-artifact-ledger-adapter.js +736 -0
  216. package/src/lib/evolution/governed-knowledge-artifact-lifecycle.js +364 -0
  217. package/src/lib/evolution/governed-knowledge-candidate-rejection.js +343 -0
  218. package/src/lib/evolution/governed-knowledge-dependency-authority.js +227 -44
  219. package/src/lib/evolution/governed-knowledge-dependency-ledger-executor.js +95 -83
  220. package/src/lib/evolution/governed-knowledge-merge-ledger-executor.js +29 -2
  221. package/src/lib/evolution/governed-knowledge-merge-publisher-authority.js +31 -3
  222. package/src/lib/evolution/governed-knowledge-record.js +148 -0
  223. package/src/lib/evolution/governed-knowledge-revocation-record.js +135 -0
  224. package/src/lib/evolution/governed-knowledge-skill-rollback.js +475 -0
  225. package/src/lib/evolution/governed-knowledge-sync-ledger-adapter.js +92 -6
  226. package/src/lib/evolution/governed-knowledge-sync-merge-publisher.js +57 -4
  227. package/src/lib/evolution/governed-knowledge-sync.js +332 -99
  228. package/src/lib/evolution/governed-knowledge-wiki-tombstone.js +462 -0
  229. package/src/lib/evolution/governed-skill-marketplace-badge.js +208 -0
  230. package/src/lib/evolution/governed-skill-marketplace-candidate.js +330 -0
  231. package/src/lib/evolution/governed-skill-marketplace-cli-host.js +308 -0
  232. package/src/lib/evolution/governed-skill-marketplace-ledger-adapter.js +420 -0
  233. package/src/lib/evolution/governed-skill-marketplace.js +288 -5
  234. package/src/lib/evolution/governed-wiki-pruning-journal.js +302 -0
  235. package/src/lib/evolution/governed-wiki-pruning-ledger-adapter.js +459 -0
  236. package/src/lib/evolution/governed-wiki-pruning-maintenance.js +576 -0
  237. package/src/lib/evolution/governed-wiki-pruning-plan-authority.js +169 -0
  238. package/src/lib/evolution/governed-wiki-pruning-raw-shred.js +207 -0
  239. package/src/lib/evolution/governed-wiki-pruning-retrieval.js +587 -0
  240. package/src/lib/evolution/governed-wiki-pruning-runtime.js +153 -0
  241. package/src/lib/evolution/governed-wiki-pruning-skill-rollback.js +360 -0
  242. package/src/lib/evolution/governed-wiki-pruning.js +322 -143
  243. package/src/lib/evolution/independent-skill-revocation-source.js +231 -0
  244. package/src/lib/evolution/knowledge-wiki-source-admission.js +124 -0
  245. package/src/lib/evolution/knowledge-wiki-source-provenance.js +359 -0
  246. package/src/lib/evolution/progressive-canary-external-watchdog.js +578 -0
  247. package/src/lib/evolution/progressive-canary-traffic-worker.js +628 -0
  248. package/src/lib/evolution/progressive-canary-watchdog-file-store.js +285 -0
  249. package/src/lib/evolution/progressive-canary-watchdog-node-pki.js +265 -0
  250. package/src/lib/evolution/skill-candidate-registry.js +22 -0
  251. package/src/lib/evolution/skill-promotion-controller.js +25 -0
  252. package/src/lib/evolution/skill-promotion-review-ledger-adapter.js +100 -0
  253. package/src/lib/evolution/skill-registry-transition-ledger-adapter.js +131 -2
  254. package/src/lib/evolution/skill-release-registry.js +25 -4
  255. package/src/lib/evolution/skill-retrieval-revocation-authority.js +361 -0
  256. package/src/lib/evolution/skill-retrieval-revocation-ledger-adapter.js +346 -0
  257. package/src/lib/evolution/skill-revocation-propagation.js +467 -0
  258. package/src/lib/evolution/skill-target-matrix-eval.js +162 -11
  259. package/src/lib/evolution/skill-wiki-reconciliation.js +985 -0
  260. package/src/lib/evolution/skill-writer-inventory-manifest.js +15 -12
  261. package/src/lib/evolution/statistical-progressive-canary.js +845 -0
  262. package/src/lib/evolution/structured-memory-agent-control-plane.js +120 -0
  263. package/src/lib/evolution/structured-memory-authority-ledger-adapter.js +5 -1
  264. package/src/lib/evolution/structured-memory-promotion-receipt-writer.js +126 -0
  265. package/src/lib/evolution/wiki-informed-skill-proposer.js +127 -21
  266. package/src/lib/evolution/wiki-maintainer-ledger-adapter.js +760 -100
  267. package/src/lib/evolution/wiki-revision-protocol.js +120 -0
  268. package/src/lib/evolution/wiki-skill-proposal-ledger-adapter.js +307 -0
  269. package/src/lib/evolution/wiki-target-tombstone-revision.js +101 -0
  270. package/src/lib/evolution/wikiskill-benchmark-cli-host.js +178 -0
  271. package/src/lib/evolution/wikiskill-benchmark-execution-host.js +702 -0
  272. package/src/lib/evolution/wikiskill-benchmark-ledger-adapter.js +613 -0
  273. package/src/lib/evolution/wikiskill-benchmark.js +574 -0
  274. package/src/lib/goal-assess.js +17 -10
  275. package/src/lib/interactive-planner.js +9 -1
  276. package/src/lib/iteration-budget.js +16 -2
  277. package/src/lib/micro-compact.js +4 -1
  278. package/src/lib/model-failure-policy.js +21 -0
  279. package/src/lib/process-execution-broker/index.js +1 -0
  280. package/src/lib/process-execution-broker/windows-sandbox-helper.dll +0 -0
  281. package/src/lib/process-execution-broker/windows-sandbox-helper.exe +0 -0
  282. package/src/lib/process-execution-broker/windows-sandbox.cs +33 -15
  283. package/src/lib/read-file-page.js +191 -0
  284. package/src/lib/runnable-provider.js +2 -1
  285. package/src/lib/session-host-lease.js +11 -16
  286. package/src/lib/skill-retrieval-router.js +22 -1
  287. package/src/repl/agent-repl.js +127 -33
  288. package/src/runtime/agent-core.js +224 -80
  289. package/src/runtime/agent-runtime.js +43 -0
  290. package/src/runtime/coding-agent-contract-shared.cjs +7 -1
  291. package/src/runtime/fallback-model.js +143 -62
  292. package/src/runtime/headless-runner.js +54 -10
  293. package/src/runtime/headless-stream.js +53 -6
  294. package/src/runtime/runtime-factory.js +41 -2
  295. package/src/assets/web-panel/assets/Notes-CgU9DDo9.js +0 -7
  296. package/src/assets/web-panel/assets/OrderTableRenderer-CwHc15Zs.js +0 -1
  297. package/src/assets/web-panel/assets/Projects-FF_thRi6.js +0 -1
  298. package/src/assets/web-panel/assets/SpeechSettings-l7ox6KuX.js +0 -1
  299. package/src/assets/web-panel/assets/devWarning-DyhgpXPf.js +0 -1
  300. package/src/assets/web-panel/assets/index-Ck1jhFE0.js +0 -1
  301. package/src/assets/web-panel/assets/index-c8jJEHVs.js +0 -1
@@ -16,11 +16,13 @@
16
16
 
17
17
  import fs from "fs";
18
18
  import path from "path";
19
+ import { buildReadFilePage } from "../lib/read-file-page.js";
19
20
  import broker from "../lib/process-execution-broker/index.js";
20
21
  import os from "os";
21
22
  import { createHash, randomUUID } from "node:crypto";
22
23
  import skillInvocationReceipt from "@chainlesschain/session-core/skill-invocation-receipt";
23
24
  import { isProxy } from "node:util/types";
25
+ import { captureAgentEvolutionIngress } from "../lib/evolution/agent-evolution-ingress.js";
24
26
 
25
27
  const { startSkillInvocation, settleSkillInvocation } = skillInvocationReceipt;
26
28
  import sharedCodingAgentPolicy from "./coding-agent-policy.cjs";
@@ -368,12 +370,12 @@ function resolveBackgroundShellWorkspacePaths(
368
370
 
369
371
  // ─── Background shell tasks ────────────────────────────────────────────────
370
372
  //
371
- // run_shell is synchronous (execSync) and capped at a foreground timeout, which
372
- // is the right default for quick commands but blocks the whole agent loop on
373
- // long-running ones (builds, full test suites, `npm run dev`). When the model
374
- // passes run_in_background:true the command is spawned instead, returns a
375
- // task_id immediately, and streams its output into this registry. The agent
376
- // then polls completion + incremental output via the check_shell tool — the
373
+ // run_shell remains synchronous by default for compatibility. Persistent
374
+ // stream hosts opt into an async foreground path so commands cannot block the
375
+ // session heartbeat or protocol pump. When the model passes
376
+ // run_in_background:true the command is spawned instead, returns a task_id
377
+ // immediately, and streams its output into this registry. The agent then polls
378
+ // completion + incremental output via the check_shell tool — the
377
379
  // run_in_background + BashOutput pattern from Claude Code.
378
380
  //
379
381
  // In-memory, process-lifetime: a task_id is only valid within the agent process
@@ -384,6 +386,22 @@ const MAX_BG_BUFFER = 1024 * 1024; // 1 MB retained tail per stream
384
386
  const _backgroundShellTasks = new Map();
385
387
  let _backgroundTaskSeq = 0;
386
388
 
389
+ function _runForegroundProcessAsync(file, args, options) {
390
+ return new Promise((resolve, reject) => {
391
+ try {
392
+ broker.execFile(file, args, options, (error, stdout, stderr) => {
393
+ if (error) {
394
+ reject(error);
395
+ return;
396
+ }
397
+ resolve({ stdout: stdout ?? "", stderr: stderr ?? "" });
398
+ });
399
+ } catch (error) {
400
+ reject(error);
401
+ }
402
+ });
403
+ }
404
+
387
405
  function _newBgStream() {
388
406
  return { buf: "", total: 0, dropped: 0, cursor: 0 };
389
407
  }
@@ -1068,7 +1086,7 @@ Key behaviors:
1068
1086
  - When asked to run/test something, use run_shell to execute it
1069
1087
  - For long-running commands (builds, full test suites, dev servers) set run_shell { run_in_background: true } to get a task_id back immediately, then poll output and completion with check_shell { task_id }. Kill a backgrounded server with check_shell { task_id, kill: true } when finished
1070
1088
  - When asked about git status, diff, log, or other repository operations, use the git tool instead of run_shell
1071
- - When asked about files or code, use read_file and search_files to find information
1089
+ - When asked about files or code, use search_files to locate relevant sections, then read_file with offset/limit. Follow nextRead for large files. Reuse unchanged content already in context instead of repeatedly reading the same page; re-read when the file changes or the earlier content is no longer available.
1072
1090
  - Before renaming or changing a symbol, use code_intelligence (action: references/definition) to find every real usage instead of guessing with text search. It degrades to "unavailable" when no language server is installed — fall back to search_files then.
1073
1091
  - After an edit, if the tool result includes a "newDiagnostics" array, you just introduced (or exposed) those errors/warnings — read them and fix before moving on. You can also run code_intelligence (action: diagnostics) on any file to check it on demand.
1074
1092
  - If a tool result includes a "subtreeInstructions" array, you just entered a subdirectory that carries its own cc.md/CLAUDE.md/AGENTS.md — treat that content as authoritative project rules for work in that subtree (it is injected once, the first time you touch the subtree).
@@ -3557,6 +3575,7 @@ export async function executeTool(name, args, context = {}) {
3557
3575
  skillAllowlist: context.skillAllowlist ?? null,
3558
3576
  skillOutcomeIndex: context.skillOutcomeIndex,
3559
3577
  skillVectorAuthority: context.skillVectorAuthority,
3578
+ skillRetrievalRevocationReader: context.skillRetrievalRevocationReader,
3560
3579
  cwd,
3561
3580
  parentMessages: context.parentMessages,
3562
3581
  interaction: context.interaction,
@@ -3600,6 +3619,7 @@ export async function executeTool(name, args, context = {}) {
3600
3619
  context.subtreeInstructionScope || context.sessionId || "__legacy__",
3601
3620
  shellPolicyOverrides: context.shellPolicyOverrides || null,
3602
3621
  classifyAllShell: context.classifyAllShell === true,
3622
+ nonBlockingShell: context.nonBlockingShell === true,
3603
3623
  approvalGate: context.approvalGate || null,
3604
3624
  shellConfirm: context.shellConfirm || null,
3605
3625
  additionalDirectories: context.additionalDirectories || null,
@@ -3611,6 +3631,7 @@ export async function executeTool(name, args, context = {}) {
3611
3631
  subAgentBudget: context.subAgentBudget || null,
3612
3632
  sessionBudget: context.sessionBudget || null,
3613
3633
  hostResourceBudget: context.hostResourceBudget || null,
3634
+ readFileCache: context.readFileCache || null,
3614
3635
  // Effective contract of THIS loop (parent ceiling for a nested spawn) +
3615
3636
  // the MCP tool definitions this loop exposes (inheritable by a spawn).
3616
3637
  subAgentContract: context.subAgentContract || null,
@@ -5101,6 +5122,7 @@ async function executeToolInner(
5101
5122
  skillAllowlist = null,
5102
5123
  skillOutcomeIndex,
5103
5124
  skillVectorAuthority,
5125
+ skillRetrievalRevocationReader,
5104
5126
  cwd,
5105
5127
  parentMessages,
5106
5128
  interaction,
@@ -5154,6 +5176,7 @@ async function executeToolInner(
5154
5176
  backgroundUsageFailureState = null,
5155
5177
  toolAdmission = null,
5156
5178
  hostResourceBudget = null,
5179
+ readFileCache = null,
5157
5180
  unattendedActionPolicy = null,
5158
5181
  managedCheckpoint = false,
5159
5182
  fileMutationScope = null,
@@ -5168,6 +5191,7 @@ async function executeToolInner(
5168
5191
  // (spawn_sub_agent / isolated run_skill) as their parent_id.
5169
5192
  hookTraceId = null,
5170
5193
  skillLifecycleMode = "active",
5194
+ nonBlockingShell = false,
5171
5195
  },
5172
5196
  ) {
5173
5197
  const localToolDescriptor =
@@ -5221,11 +5245,37 @@ async function executeToolInner(
5221
5245
  }
5222
5246
  // A clear, self-correcting error beats the cryptic "EISDIR: illegal
5223
5247
  // operation on a directory" that readFileSync throws on a directory.
5224
- if (fs.statSync(filePath).isDirectory()) {
5248
+ const fileStat = fs.statSync(filePath);
5249
+ if (fileStat.isDirectory()) {
5225
5250
  return attachDescriptor({
5226
5251
  error: `Path is a directory, not a file: ${filePath}. Use list_dir to see its contents.`,
5227
5252
  });
5228
5253
  }
5254
+ const fileVersion = `${fileStat.size}:${fileStat.mtimeMs}:${fileStat.ctimeMs}`;
5255
+ const cacheKey = JSON.stringify([
5256
+ filePath,
5257
+ args.offset ?? null,
5258
+ args.limit ?? null,
5259
+ args.column ?? null,
5260
+ args.hashed === true,
5261
+ args.raw === true,
5262
+ ]);
5263
+ const cached = readFileCache?.get(cacheKey);
5264
+ if (cached?.fileVersion === fileVersion) {
5265
+ // All permission checks ran before this point. A fresh stat still
5266
+ // invalidates changed/deleted files; cache only bounded pages per run.
5267
+ _recordFileObservation(filePath);
5268
+ readFileCache.delete(cacheKey);
5269
+ readFileCache.set(cacheKey, cached);
5270
+ return attachDescriptor(
5271
+ await _withSubtreeInstructions(
5272
+ structuredClone(cached.page),
5273
+ filePath,
5274
+ cwd,
5275
+ subtreeInstructionScope,
5276
+ ),
5277
+ );
5278
+ }
5229
5279
  const content = fs.readFileSync(filePath, "utf8");
5230
5280
  // Record the mtime so a later edit can detect an external change that
5231
5281
  // happened between this read and the edit (read-freshness guard).
@@ -5234,69 +5284,32 @@ async function executeToolInner(
5234
5284
  // outputs summarized) so the model can find cells for notebook_edit
5235
5285
  // without ingesting raw JSON / base64 output blobs. `raw:true` returns the
5236
5286
  // underlying JSON. Non-.ipynb reads are unchanged.
5237
- if (args.raw !== true && /\.ipynb$/i.test(filePath)) {
5238
- const nbView = renderNotebook(content);
5239
- if (nbView) {
5240
- return attachDescriptor(
5241
- nbView.length > 50000
5242
- ? {
5243
- content: nbView.substring(0, 50000) + "\n...(truncated)",
5244
- size: nbView.length,
5245
- notebook: true,
5246
- }
5247
- : { content: nbView, notebook: true },
5248
- );
5249
- }
5250
- }
5287
+ const nbView =
5288
+ args.raw !== true && /\.ipynb$/i.test(filePath)
5289
+ ? renderNotebook(content)
5290
+ : null;
5251
5291
  // Hashline mode: prefix each line with a 6-char content hash tag
5252
5292
  // so downstream edit_file_hashed calls can anchor by hash.
5253
- let rendered = args.hashed === true ? annotateLines(content) : content;
5254
-
5255
- // Line-range slice (Claude-Code Read offset/limit parity): `offset` is the
5256
- // 1-based first line, `limit` the max line count — so a file larger than
5257
- // the size cap can be paged through instead of being stuck at its head.
5258
- // Coerces numeric strings the model may emit ("10" → 10).
5259
- const toPos = (v) => {
5260
- const n = typeof v === "number" ? v : parseInt(v, 10);
5261
- return Number.isInteger(n) && n > 0 ? n : null;
5262
- };
5263
- const offset = toPos(args.offset);
5264
- const limit = toPos(args.limit);
5265
- let range = null;
5266
- if (offset || limit) {
5267
- const lines = rendered.split("\n");
5268
- const start = offset ? offset - 1 : 0;
5269
- const end = limit != null ? start + limit : lines.length;
5270
- rendered = lines.slice(start, end).join("\n");
5271
- range = {
5272
- startLine: Math.min(start + 1, lines.length),
5273
- endLine: Math.min(end, lines.length),
5274
- totalLines: lines.length,
5275
- };
5276
- }
5277
-
5278
- if (rendered.length > 50000) {
5279
- return attachDescriptor(
5280
- await _withSubtreeInstructions(
5281
- {
5282
- content: rendered.substring(0, 50000) + "\n...(truncated)",
5283
- size: rendered.length,
5284
- hashed: args.hashed === true,
5285
- ...(range ? { range } : {}),
5286
- },
5287
- filePath,
5288
- cwd,
5289
- subtreeInstructionScope,
5290
- ),
5291
- );
5293
+ const rendered =
5294
+ nbView || (args.hashed === true ? annotateLines(content) : content);
5295
+ const page = buildReadFilePage(rendered, args, {
5296
+ filePath,
5297
+ fileVersion,
5298
+ maxChars: MAX_TOOL_RESULT_CHARS,
5299
+ });
5300
+ if (nbView) page.notebook = true;
5301
+ if (readFileCache && !page.error) {
5302
+ readFileCache.delete(cacheKey);
5303
+ readFileCache.set(cacheKey, {
5304
+ fileVersion,
5305
+ page: structuredClone(page),
5306
+ });
5307
+ while (readFileCache.size > 8)
5308
+ readFileCache.delete(readFileCache.keys().next().value);
5292
5309
  }
5293
5310
  return attachDescriptor(
5294
5311
  await _withSubtreeInstructions(
5295
- {
5296
- content: rendered,
5297
- hashed: args.hashed === true,
5298
- ...(range ? { range } : {}),
5299
- },
5312
+ page,
5300
5313
  filePath,
5301
5314
  cwd,
5302
5315
  subtreeInstructionScope,
@@ -6637,7 +6650,23 @@ async function executeToolInner(
6637
6650
  auditContext: createShellProcessAuditContext(),
6638
6651
  ...processProvenance,
6639
6652
  };
6640
- if (pluginBinInvocation) {
6653
+ if (pluginBinInvocation && nonBlockingShell) {
6654
+ const res = await _runForegroundProcessAsync(
6655
+ executionPlugin.sandboxExecution?.kind === "strict-plugin-node-bin"
6656
+ ? executionPlugin.sandboxExecution.runtimePath
6657
+ : executionPlugin.command,
6658
+ executionPlugin.argv,
6659
+ {
6660
+ ...brokerExecOpts,
6661
+ cwd:
6662
+ executionPlugin.sandboxExecution?.workingDirectory ||
6663
+ brokerExecOpts.cwd,
6664
+ shell: false,
6665
+ windowsHide: true,
6666
+ },
6667
+ );
6668
+ output = res.stdout;
6669
+ } else if (pluginBinInvocation) {
6641
6670
  const res = broker.spawnSync(
6642
6671
  executionPlugin.sandboxExecution?.kind === "strict-plugin-node-bin"
6643
6672
  ? executionPlugin.sandboxExecution.runtimePath
@@ -6663,8 +6692,25 @@ async function executeToolInner(
6663
6692
  throw e;
6664
6693
  }
6665
6694
  output = res.stdout ?? "";
6695
+ } else if (shellInv.useDefaultShell && nonBlockingShell) {
6696
+ const res = await _runForegroundProcessAsync(args.command, [], {
6697
+ ...brokerExecOpts,
6698
+ shell: true,
6699
+ windowsHide: true,
6700
+ });
6701
+ output = res.stdout;
6666
6702
  } else if (shellInv.useDefaultShell) {
6667
6703
  output = broker.execSync(args.command, brokerExecOpts);
6704
+ } else if (nonBlockingShell) {
6705
+ const res = await _runForegroundProcessAsync(
6706
+ shellInv.file,
6707
+ shellInv.argv,
6708
+ {
6709
+ ...brokerExecOpts,
6710
+ windowsHide: true,
6711
+ },
6712
+ );
6713
+ output = res.stdout;
6668
6714
  } else {
6669
6715
  // PowerShell route: explicit argv, no intermediate default shell.
6670
6716
  // Reproduce execSync's contract so the shared catch shapes errors
@@ -8232,6 +8278,7 @@ async function executeToolInner(
8232
8278
  target: { os: process.platform },
8233
8279
  vectorScores: vector?.scores ?? null,
8234
8280
  outcomeMetrics: outcomeAuthority.metrics,
8281
+ revocationReader: skillRetrievalRevocationReader ?? null,
8235
8282
  topK: Math.min(64, Math.max(1, skills.length)),
8236
8283
  });
8237
8284
  const byDigest = new Map(
@@ -9275,6 +9322,46 @@ export function capToolResultString(serialized, max = MAX_TOOL_RESULT_CHARS) {
9275
9322
  );
9276
9323
  }
9277
9324
 
9325
+ /** Avoid injecting the same file page twice while its original is still visible. */
9326
+ export function toolResultForModel(tool, result, messages) {
9327
+ const serialized = capToolResultString(safeStringifyToolResult(result));
9328
+ if (
9329
+ tool !== "read_file" ||
9330
+ result?.error ||
9331
+ !result?.path ||
9332
+ !result.content ||
9333
+ result.subtreeInstructions?.length
9334
+ ) {
9335
+ return serialized;
9336
+ }
9337
+ const previous = messages.find((message) => {
9338
+ if (message.role !== "tool" || typeof message.content !== "string")
9339
+ return false;
9340
+ try {
9341
+ const prior = JSON.parse(message.content.split("\n\n[Budget ")[0]);
9342
+ return (
9343
+ prior.path === result.path &&
9344
+ prior.fileVersion === result.fileVersion &&
9345
+ prior.content === result.content &&
9346
+ prior.hashed === result.hashed &&
9347
+ JSON.stringify(prior.range) === JSON.stringify(result.range)
9348
+ );
9349
+ } catch {
9350
+ return false;
9351
+ }
9352
+ });
9353
+ if (!previous) return serialized;
9354
+ return JSON.stringify({
9355
+ path: result.path,
9356
+ alreadyRead: true,
9357
+ previousToolCallId: previous.tool_call_id,
9358
+ readAt: result.toolTelemetryRecord?.timestamp,
9359
+ ...(result.range ? { range: result.range } : {}),
9360
+ ...(result.nextRead ? { nextRead: result.nextRead } : {}),
9361
+ hint: "This unchanged file page is already present in the earlier tool result. Use that content to continue the task. For more content, use nextRead or search_files for a different section; do not repeat this same read.",
9362
+ });
9363
+ }
9364
+
9278
9365
  /**
9279
9366
  * Serialize a tool result for the transcript without ever throwing. A plain
9280
9367
  * `JSON.stringify` throws on a circular reference, a BigInt, or a value whose
@@ -10679,6 +10766,10 @@ function _openAIProviderRequestReceipt(response, data, clientRequestId) {
10679
10766
  * @returns {Promise<object>} response with .message
10680
10767
  */
10681
10768
  export async function chatWithTools(rawMessages, options) {
10769
+ const evolutionIngress =
10770
+ options.evolutionIngress == null
10771
+ ? null
10772
+ : captureAgentEvolutionIngress(options.evolutionIngress);
10682
10773
  const {
10683
10774
  provider,
10684
10775
  model,
@@ -10720,13 +10811,22 @@ export async function chatWithTools(rawMessages, options) {
10720
10811
  const lastUserMsg = [...providerMessages]
10721
10812
  .reverse()
10722
10813
  .find((m) => m.role === "user");
10723
- const messages =
10814
+ let messages =
10724
10815
  ce && !canonicalPlan
10725
10816
  ? ce.buildOptimizedMessages(providerMessages, {
10726
10817
  userQuery: lastUserMsg?.content,
10727
10818
  })
10728
10819
  : providerMessages;
10729
10820
 
10821
+ if (evolutionIngress !== null) {
10822
+ const projected = await evolutionIngress.prepareModelRequest({
10823
+ messages,
10824
+ tools,
10825
+ });
10826
+ messages = projected.messages;
10827
+ tools = projected.tools;
10828
+ }
10829
+
10730
10830
  throwIfAborted(signal);
10731
10831
 
10732
10832
  if (provider === "ollama") {
@@ -12838,7 +12938,26 @@ function _instrumentAutoCompactorUsage(compactor, options) {
12838
12938
  * loaded — callers treat that as "don't compact". Cached (including null) so we
12839
12939
  * import once per run, not once per iteration.
12840
12940
  */
12941
+ const evolutionAutoCompactors = new WeakMap();
12942
+
12841
12943
  async function _getAutoCompactor(options) {
12944
+ const evolutionIngress =
12945
+ options.evolutionIngress == null
12946
+ ? null
12947
+ : captureAgentEvolutionIngress(options.evolutionIngress);
12948
+ if (
12949
+ evolutionIngress !== null &&
12950
+ (typeof options.compactionLlmQuery === "function" ||
12951
+ (options._autoCompactor != null &&
12952
+ evolutionAutoCompactors.get(options._autoCompactor) !==
12953
+ evolutionIngress))
12954
+ ) {
12955
+ const error = new TypeError(
12956
+ "Evolution auto-compaction requires the canonical model transport and owned compressor",
12957
+ );
12958
+ error.code = "CC_AGENT_EVOLUTION_INGRESS_FAILED";
12959
+ throw error;
12960
+ }
12842
12961
  if (Object.prototype.hasOwnProperty.call(options, "_autoCompactor")) {
12843
12962
  return _instrumentAutoCompactorUsage(options._autoCompactor, options);
12844
12963
  }
@@ -12932,8 +13051,11 @@ async function _getAutoCompactor(options) {
12932
13051
  }
12933
13052
  } catch (error) {
12934
13053
  if (canonicalRequired) throw error;
13054
+ if (error?.code === "CC_AGENT_EVOLUTION_INGRESS_FAILED") throw error;
12935
13055
  compressor = null;
12936
13056
  }
13057
+ if (evolutionIngress !== null && compressor !== null)
13058
+ evolutionAutoCompactors.set(compressor, evolutionIngress);
12937
13059
  try {
12938
13060
  options._autoCompactor = compressor;
12939
13061
  } catch {
@@ -13156,6 +13278,20 @@ function permissionDecision(callId, tool, result) {
13156
13278
  }
13157
13279
 
13158
13280
  export async function* agentLoop(messages, options) {
13281
+ const configuredChatFn = options.chatFn;
13282
+ const evolutionIngress =
13283
+ options.evolutionIngress == null
13284
+ ? null
13285
+ : captureAgentEvolutionIngress(options.evolutionIngress);
13286
+ let llmCall = configuredChatFn || chatWithTools;
13287
+ if (evolutionIngress !== null && configuredChatFn) {
13288
+ const { captureCanonicalFallbackChatFn } =
13289
+ await import("./fallback-model.js");
13290
+ llmCall = captureCanonicalFallbackChatFn(
13291
+ configuredChatFn,
13292
+ evolutionIngress,
13293
+ );
13294
+ }
13159
13295
  // Shared iteration budget — replaces hardcoded MAX_ITERATIONS.
13160
13296
  // When options.iterationBudget is provided (e.g. from parent agent),
13161
13297
  // the same budget instance is shared, so parent+child consume from one pool.
@@ -13222,10 +13358,12 @@ export async function* agentLoop(messages, options) {
13222
13358
  options.mcpConflictScheduler || createMcpConflictScheduler();
13223
13359
 
13224
13360
  const toolContext = {
13361
+ readFileCache: new Map(),
13225
13362
  hookDb: hermeticExecution ? null : options.hookDb || null,
13226
13363
  skillLoader: options.skillLoader || _defaultSkillLoader,
13227
13364
  skillOutcomeIndex: options.skillOutcomeIndex,
13228
13365
  skillVectorAuthority: options.skillVectorAuthority,
13366
+ skillRetrievalRevocationReader: options.skillRetrievalRevocationReader,
13229
13367
  // Hook-envelope tracing (P2 unified event bus): every settings-hook payload
13230
13368
  // fired during this run carries trace_id = this run's id; a spawned child
13231
13369
  // loop carries parent_id = the spawning run's id (threaded by
@@ -13295,6 +13433,7 @@ export async function* agentLoop(messages, options) {
13295
13433
  // Parent LLM config — forwarded to spawn_sub_agent so a delegated subagent
13296
13434
  // inherits the provider/key and can override just the model (cc agents `model:`).
13297
13435
  llmOptions: {
13436
+ ...(evolutionIngress === null ? {} : { evolutionIngress }),
13298
13437
  provider: options.provider || null,
13299
13438
  model: options.model || null,
13300
13439
  baseUrl: options.baseUrl || null,
@@ -13334,6 +13473,9 @@ export async function* agentLoop(messages, options) {
13334
13473
  // verification allowlist (npm test / rg / …) is classified through the
13335
13474
  // ApprovalGate instead of fast-pathed, so no shell command auto-runs.
13336
13475
  classifyAllShell: options.classifyAllShell || false,
13476
+ // Persistent stream hosts must not block their own session-lease heartbeat
13477
+ // while a foreground shell command (notably a networked git push) runs.
13478
+ nonBlockingShell: options.nonBlockingShell === true,
13337
13479
  approvalGate: hermeticExecution ? null : options.approvalGate || null,
13338
13480
  shellConfirm: hermeticExecution ? null : options.shellConfirm || null,
13339
13481
  // Interactive sessions (the REPL) set this so run_code is gated through the
@@ -13467,11 +13609,8 @@ export async function* agentLoop(messages, options) {
13467
13609
  }
13468
13610
  }
13469
13611
 
13470
- // Phase 7 parity harness hook: tests can inject a mock LLM function via
13471
- // `options.chatFn` to drive the loop deterministically without hitting a
13472
- // real provider. Production code path is unchanged — the fallback is the
13473
- // real `chatWithTools`.
13474
- let llmCall = options.chatFn || chatWithTools;
13612
+ // llmCall was captured before startup awaits. With evolution ingress, only
13613
+ // a factory-owned canonical fallback bound to this Run may replace it.
13475
13614
 
13476
13615
  // Runnable-first auth recovery: if the resolved provider's key is missing /
13477
13616
  // wrong / expired, self-heal to a provider we can actually run (endpoint-
@@ -14012,6 +14151,7 @@ export async function* agentLoop(messages, options) {
14012
14151
  } catch (_e) {
14013
14152
  if (isAbortError(_e) || signal?.aborted) throw _e;
14014
14153
  if (_e?.runtimeLedgerPersistence === true) throw _e;
14154
+ if (_e?.code === "CC_AGENT_EVOLUTION_INGRESS_FAILED") throw _e;
14015
14155
  if (
14016
14156
  _e?.workflowEffectOutcomeUnknown === true &&
14017
14157
  _e?.compactionFailureReported === true
@@ -14196,9 +14336,13 @@ export async function* agentLoop(messages, options) {
14196
14336
  canonicalProviderContext.selectedToolNames,
14197
14337
  }
14198
14338
  : effectiveToolOptions;
14199
- const providerCallOptions = providerRequestId
14339
+ const requestOptions = providerRequestId
14200
14340
  ? { ...plannedProviderOptions, providerRequestId }
14201
14341
  : plannedProviderOptions;
14342
+ const providerCallOptions =
14343
+ evolutionIngress !== null
14344
+ ? { ...requestOptions, evolutionIngress }
14345
+ : requestOptions;
14202
14346
  const modelUsageCall = {
14203
14347
  type: "model-usage-started",
14204
14348
  callId: _newModelUsageCallId("model"),
@@ -14646,8 +14790,10 @@ export async function* agentLoop(messages, options) {
14646
14790
  failed,
14647
14791
  });
14648
14792
  const warningMsg = budget.toWarningMessage();
14649
- const resultStr = capToolResultString(
14650
- safeStringifyToolResult(toolResult),
14793
+ const resultStr = toolResultForModel(
14794
+ call.function.name,
14795
+ toolResult,
14796
+ messages,
14651
14797
  );
14652
14798
  const toolContent = warningMsg
14653
14799
  ? `${resultStr}\n\n${warningMsg}`
@@ -15096,9 +15242,7 @@ export async function* agentLoop(messages, options) {
15096
15242
  // Cap an individual tool result so one giant output can't blow the
15097
15243
  // context — but tell the model when we cut it (no more silent
15098
15244
  // mid-content slice). See MAX_TOOL_RESULT_CHARS / capToolResultString.
15099
- const resultStr = capToolResultString(
15100
- safeStringifyToolResult(toolResult),
15101
- );
15245
+ const resultStr = toolResultForModel(toolName, toolResult, messages);
15102
15246
  const toolContent = warningMsg
15103
15247
  ? `${resultStr}\n\n${warningMsg}`
15104
15248
  : resultStr;
@@ -15189,7 +15333,7 @@ export async function* agentLoop(messages, options) {
15189
15333
  backgroundUsageFailureState,
15190
15334
  );
15191
15335
  yield* _drainSubAgentUsage(subAgentUsageSink);
15192
- yield { type: "iteration-budget-exhausted", budget: budget.toSummary() };
15336
+ yield { type: "iteration-budget-exhausted", budget: budget.limit };
15193
15337
  yield {
15194
15338
  type: "response-complete",
15195
15339
  content: `(Iteration budget exhausted — ${budget.toSummary()})`,
@@ -34,8 +34,13 @@ import { registerHostHooksV2Workspace } from "../lib/hooks-v2-workspace-context.
34
34
  import { captureStructuredMemoryPolicyReceiptWriter } from "../lib/evolution/structured-memory-policy-receipt-writer.js";
35
35
  import { captureStructuredMemoryAgentControlPlane } from "../lib/evolution/structured-memory-agent-control-plane.js";
36
36
  import { captureAgentEvolutionIngress } from "../lib/evolution/agent-evolution-ingress.js";
37
+ import {
38
+ AGENT_EVOLUTION_SESSION_SCHEMA,
39
+ waitForAgentEvolutionSession,
40
+ } from "../lib/evolution/agent-evolution-session-lifecycle.js";
37
41
  import { captureAgentSkillOutcomeIndex } from "../lib/evolution/agent-evolution-runtime-composition-brand.js";
38
42
  import { captureSkillVectorAuthority } from "../lib/skill-vector-authority.js";
43
+ import { captureSkillRetrievalRevocationReader } from "../lib/evolution/skill-retrieval-revocation-authority.js";
39
44
 
40
45
  const {
41
46
  DEFAULT_ALLOWED_MCP_SERVER_NAMES,
@@ -79,6 +84,12 @@ export class AgentRuntime {
79
84
  deps.skillVectorAuthority == null
80
85
  ? null
81
86
  : captureSkillVectorAuthority(deps.skillVectorAuthority);
87
+ this.skillRetrievalRevocationReader =
88
+ deps.skillRetrievalRevocationReader == null
89
+ ? null
90
+ : captureSkillRetrievalRevocationReader(
91
+ deps.skillRetrievalRevocationReader,
92
+ );
82
93
  if (
83
94
  this.evolutionIngress !== null &&
84
95
  this.skillOutcomeIndex !== null &&
@@ -99,6 +110,21 @@ export class AgentRuntime {
99
110
  ) {
100
111
  throw new Error("Agent retrieval authorities must share one tenant");
101
112
  }
113
+ if (
114
+ this.skillVectorAuthority !== null &&
115
+ this.skillRetrievalRevocationReader !== null &&
116
+ this.skillVectorAuthority.tenantId !==
117
+ this.skillRetrievalRevocationReader.tenantId
118
+ ) {
119
+ throw new Error("Agent retrieval authorities must share one tenant");
120
+ }
121
+ if (
122
+ retrievalTenant !== null &&
123
+ this.skillRetrievalRevocationReader !== null &&
124
+ retrievalTenant !== this.skillRetrievalRevocationReader.tenantId
125
+ ) {
126
+ throw new Error("Agent retrieval authorities must share one tenant");
127
+ }
102
128
  this.structuredMemoryControlPlane =
103
129
  deps.structuredMemoryControlPlane == null
104
130
  ? null
@@ -333,8 +359,20 @@ export class AgentRuntime {
333
359
  ...(this.skillVectorAuthority === null
334
360
  ? {}
335
361
  : { skillVectorAuthority: this.skillVectorAuthority }),
362
+ ...(this.skillRetrievalRevocationReader === null
363
+ ? {}
364
+ : {
365
+ skillRetrievalRevocationReader: this.skillRetrievalRevocationReader,
366
+ }),
336
367
  });
337
368
  if (this.evolutionIngress !== null) {
369
+ if (result?.schema === AGENT_EVOLUTION_SESSION_SCHEMA) {
370
+ return await waitForAgentEvolutionSession(
371
+ result,
372
+ this.evolutionIngress,
373
+ );
374
+ }
375
+ if (result?.started === false) return result;
338
376
  await this.evolutionIngress.complete();
339
377
  }
340
378
  return result;
@@ -510,6 +548,11 @@ export class AgentRuntime {
510
548
  ...(this.skillVectorAuthority === null
511
549
  ? {}
512
550
  : { skillVectorAuthority: this.skillVectorAuthority }),
551
+ ...(this.skillRetrievalRevocationReader === null
552
+ ? {}
553
+ : {
554
+ skillRetrievalRevocationReader: this.skillRetrievalRevocationReader,
555
+ }),
513
556
  });
514
557
 
515
558
  server.on("connection", ({ clientId, ip }) => {
@@ -28,7 +28,7 @@ const CODING_AGENT_TOOL_CONTRACTS = Object.freeze([
28
28
  kind: "filesystem",
29
29
  tier: "mvp",
30
30
  description:
31
- "Read a file's content. For a large file, page through it with offset+limit (line range) instead of re-reading the head. Jupyter notebooks (.ipynb) are rendered as a compact cell listing (index/id/type/source, outputs hidden) for use with notebook_edit — pass raw:true for the underlying JSON.",
31
+ "Read a file's content. Use search_files to locate relevant sections and offset+limit to read them. For large files, follow the returned nextRead cursor; range describes only the lines actually returned. Reuse unchanged content already in context instead of re-reading the same page. Jupyter notebooks (.ipynb) are rendered as a compact cell listing for notebook_edit — pass raw:true for underlying JSON.",
32
32
  inputSchema: {
33
33
  type: "object",
34
34
  properties: {
@@ -43,6 +43,12 @@ const CODING_AGENT_TOOL_CONTRACTS = Object.freeze([
43
43
  description:
44
44
  "Maximum number of lines to return starting at offset (omit to read to end, subject to the size cap).",
45
45
  },
46
+ column: {
47
+ type: "integer",
48
+ minimum: 1,
49
+ description:
50
+ "1-based character position within the first rendered line. Use the column from nextRead to continue an oversized single line without repeating its beginning.",
51
+ },
46
52
  hashed: {
47
53
  type: "boolean",
48
54
  description: