chainlesschain 0.166.22 → 0.166.25

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 (298) hide show
  1. package/README.md +46 -3
  2. package/package.json +4 -3
  3. package/src/assets/web-panel/assets/{AIOps-oJ7USzMC.js → AIOps-RaxL_QQD.js} +1 -1
  4. package/src/assets/web-panel/assets/{ActionButton-BlgnZe_C.js → ActionButton-DD3ieFO-.js} +1 -1
  5. package/src/assets/web-panel/assets/{Analytics-D2rRbTLu.js → Analytics-CATDJukS.js} +3 -3
  6. package/src/assets/web-panel/assets/{AppLayout-FwS3f0B2.js → AppLayout-BHGsnRDS.js} +5 -5
  7. package/src/assets/web-panel/assets/{Artifacts-iF-_08Hi.js → Artifacts-BL6NunjN.js} +1 -1
  8. package/src/assets/web-panel/assets/{Audit-D24p0zQw.js → Audit-D0nEWfbA.js} +1 -1
  9. package/src/assets/web-panel/assets/{BackgroundAgents-Cg3mRVi9.js → BackgroundAgents-BAP1MUol.js} +1 -1
  10. package/src/assets/web-panel/assets/{Backup-EOqht3H-.js → Backup-R4y2OeSi.js} +1 -1
  11. package/src/assets/web-panel/assets/{BaseInput-9XWYq2hj.js → BaseInput-ByQZ2z6S.js} +1 -1
  12. package/src/assets/web-panel/assets/{Chat-Dq5yardA.js → Chat-32uV--xF.js} +4 -4
  13. package/src/assets/web-panel/assets/ChatBubbleRenderer-t1enanwz.js +1 -0
  14. package/src/assets/web-panel/assets/{Checkbox-CuyCBoBf.js → Checkbox-D1CB-7bq.js} +1 -1
  15. package/src/assets/web-panel/assets/{Codegen-DjWtYHNe.js → Codegen-BPx3dQ2q.js} +1 -1
  16. package/src/assets/web-panel/assets/{Col-CrVr_iuG.js → Col-DkPTQ2Gl.js} +1 -1
  17. package/src/assets/web-panel/assets/{Community-C6QxpfGc.js → Community-ZriaxRlr.js} +1 -1
  18. package/src/assets/web-panel/assets/{Compact-B-v5r6Pa.js → Compact-C_qJ0P7F.js} +1 -1
  19. package/src/assets/web-panel/assets/{Compliance-zNiLiFgD.js → Compliance-Bgoy-saS.js} +1 -1
  20. package/src/assets/web-panel/assets/{Cowork-D9K7lMOu.js → Cowork-B5i9y6XK.js} +2 -2
  21. package/src/assets/web-panel/assets/{Cron-DAjO36z4.js → Cron-D7vBJ5-J.js} +2 -2
  22. package/src/assets/web-panel/assets/{Crosschain-Bxqn0aqB.js → Crosschain-D4kvoGI_.js} +1 -1
  23. package/src/assets/web-panel/assets/{DID-DfRmLUe-.js → DID-BLOeBd-r.js} +2 -2
  24. package/src/assets/web-panel/assets/{Dashboard-Cz8KF3fr.js → Dashboard-mecJaonC.js} +2 -2
  25. package/src/assets/web-panel/assets/{Dropdown-C4oVfkP0.js → Dropdown-GPKwaFer.js} +1 -1
  26. package/src/assets/web-panel/assets/{EmailListRenderer-ivyZKN8k.js → EmailListRenderer-BML9m7Dd.js} +1 -1
  27. package/src/assets/web-panel/assets/{FamilyGuardDashboard-DoxY1CPW.js → FamilyGuardDashboard-DN5bAtJC.js} +1 -1
  28. package/src/assets/web-panel/assets/{Federation-C93gZxnb.js → Federation-DmD6Gecd.js} +1 -1
  29. package/src/assets/web-panel/assets/{FormItemContext-D_lEjYJE.js → FormItemContext-6wwplN_K.js} +1 -1
  30. package/src/assets/web-panel/assets/{GenericCardRenderer-BNFN9YjN.js → GenericCardRenderer-DUhpLkDL.js} +1 -1
  31. package/src/assets/web-panel/assets/{Git-mUu2HcLI.js → Git-eJfyXkwf.js} +2 -2
  32. package/src/assets/web-panel/assets/{Governance-CNuosrge.js → Governance-swAUW59x.js} +1 -1
  33. package/src/assets/web-panel/assets/{Inference-DwY5pbCB.js → Inference-CbdwJPDJ.js} +1 -1
  34. package/src/assets/web-panel/assets/{KnowledgeGraph-aRUxhACD.js → KnowledgeGraph-UuYpg1nm.js} +1 -1
  35. package/src/assets/web-panel/assets/{Logs-DFfsWYy_.js → Logs-CS0G057y.js} +2 -2
  36. package/src/assets/web-panel/assets/MarkdownRenderer-BxIIB4k3.js +1 -0
  37. package/src/assets/web-panel/assets/{Marketplace-COI-ciM-.js → Marketplace-CZRjuvvI.js} +1 -1
  38. package/src/assets/web-panel/assets/{McpTools-BJJwaIpe.js → McpTools-BOJ9A_Rf.js} +3 -3
  39. package/src/assets/web-panel/assets/{Memory-CDO6SGDZ.js → Memory-BnkrR-Ok.js} +2 -2
  40. package/src/assets/web-panel/assets/{MobileBridge-BlZ5tFf4.js → MobileBridge-Do4mPi13.js} +1 -1
  41. package/src/assets/web-panel/assets/{MobileProjects-DuoxbgWz.js → MobileProjects-2JxWa6-p.js} +1 -1
  42. package/src/assets/web-panel/assets/{Mtc-6ec9j70b.js → Mtc-CS_mnpGd.js} +2 -2
  43. package/src/assets/web-panel/assets/{MtcAudit-BuL7HkC7.js → MtcAudit-DZ4J_351.js} +5 -5
  44. package/src/assets/web-panel/assets/{Multisig-CJxR85lk.js → Multisig-Jh74zKXu.js} +3 -3
  45. package/src/assets/web-panel/assets/{NLProgramming-B71O1S4l.js → NLProgramming-_4n2BfnS.js} +1 -1
  46. package/src/assets/web-panel/assets/{Notes-Bsw5zbpV.js → Notes-CtENcKHv.js} +3 -3
  47. package/src/assets/web-panel/assets/{NotificationSettings-BnAhXuK_.js → NotificationSettings-dgDCvpK9.js} +1 -1
  48. package/src/assets/web-panel/assets/{OrderTableRenderer-BJ0R5GGz.js → OrderTableRenderer-D5VxCrmG.js} +1 -1
  49. package/src/assets/web-panel/assets/{Organization-B7wwNxoP.js → Organization-CpIF8Xkd.js} +2 -2
  50. package/src/assets/web-panel/assets/{Overflow-CfAGr0gM.js → Overflow-aHnBZaez.js} +1 -1
  51. package/src/assets/web-panel/assets/{P2P-KhMg22Fz.js → P2P-8ppzog2V.js} +2 -2
  52. package/src/assets/web-panel/assets/{PdhVaultBrowser-NdAXI9ft.js → PdhVaultBrowser-D3p1BXkp.js} +3 -3
  53. package/src/assets/web-panel/assets/{Permissions-CIYjqyT7.js → Permissions-D7vflD5q.js} +4 -4
  54. package/src/assets/web-panel/assets/{PersonalDataHub-D2ht3P_R.js → PersonalDataHub-D2hY-Ek2.js} +4 -4
  55. package/src/assets/web-panel/assets/{Pipeline-i6flZW1m.js → Pipeline-qK2VqhJC.js} +1 -1
  56. package/src/assets/web-panel/assets/{Privacy-DE0lhYVc.js → Privacy-DHJr4uu0.js} +1 -1
  57. package/src/assets/web-panel/assets/{ProjectInit-BL3YbyxS.js → ProjectInit-DMBS6trm.js} +2 -2
  58. package/src/assets/web-panel/assets/{ProjectSettings-CEtdg7ni.js → ProjectSettings-D3Ng74BT.js} +2 -2
  59. package/src/assets/web-panel/assets/{Projects-CvtU5peJ.js → Projects-BfJFZiIW.js} +1 -1
  60. package/src/assets/web-panel/assets/{Providers-DKt_Cg-j.js → Providers-DlNA95G0.js} +1 -1
  61. package/src/assets/web-panel/assets/{QrScannerModal-DA61jNSx.js → QrScannerModal-CMOIYxIm.js} +1 -1
  62. package/src/assets/web-panel/assets/{QuickAsk-fS9ryUmq.js → QuickAsk-D6MyGp5I.js} +1 -1
  63. package/src/assets/web-panel/assets/{Recommend-CR9dZU5Y.js → Recommend-W6WcShtf.js} +1 -1
  64. package/src/assets/web-panel/assets/{RemoteSession-BV0BR2Dz.js → RemoteSession-Dm_MjlV_.js} +2 -2
  65. package/src/assets/web-panel/assets/{Reputation-BIeGUvYD.js → Reputation-Ctvij6eX.js} +1 -1
  66. package/src/assets/web-panel/assets/{Row-DHDT1aro.js → Row-DivbeDE-.js} +1 -1
  67. package/src/assets/web-panel/assets/{RssFeed-Cq6YKb1h.js → RssFeed-D4famoAw.js} +3 -3
  68. package/src/assets/web-panel/assets/{Search-DEF6vsy6.js → Search-6gOAh3zG.js} +1 -1
  69. package/src/assets/web-panel/assets/{Security-CHtYiKY9.js → Security-DApb9kK8.js} +4 -4
  70. package/src/assets/web-panel/assets/{Services-u16lvBJN.js → Services-B8OomyE2.js} +2 -2
  71. package/src/assets/web-panel/assets/{Skeleton-CGbizyDj.js → Skeleton-BTJ2g2E3.js} +1 -1
  72. package/src/assets/web-panel/assets/{Skills-BZMQcAa7.js → Skills-NIRr4DD1.js} +1 -1
  73. package/src/assets/web-panel/assets/{Sla-Bm-CycVi.js → Sla-BQHP_6px.js} +1 -1
  74. package/src/assets/web-panel/assets/{SpeechSettings-BudpA5kr.js → SpeechSettings-BVQTDSVS.js} +1 -1
  75. package/src/assets/web-panel/assets/{SyncSettings-B8q1C1eC.js → SyncSettings-BOD4Mar6.js} +2 -2
  76. package/src/assets/web-panel/assets/{Tasks-SU1pBWc-.js → Tasks-Ciu7H2-y.js} +1 -1
  77. package/src/assets/web-panel/assets/{Templates-CyOfJzmt.js → Templates-CtlwavRU.js} +1 -1
  78. package/src/assets/web-panel/assets/{Tenant-xqWSm2GP.js → Tenant-QLWYJdL6.js} +1 -1
  79. package/src/assets/web-panel/assets/{Terminal-D1Ttgjsi.js → Terminal-B3q10mjm.js} +2 -2
  80. package/src/assets/web-panel/assets/{TimelineRenderer-Da2lYs5D.js → TimelineRenderer-CqltBA_8.js} +1 -1
  81. package/src/assets/web-panel/assets/{Tokens-B34-SduO.js → Tokens-CJOKrj4y.js} +1 -1
  82. package/src/assets/web-panel/assets/{Trigger-C8zyYm4R.js → Trigger-CPMGgfdM.js} +1 -1
  83. package/src/assets/web-panel/assets/{Trust-D1Pvqems.js → Trust-DiJms7Bl.js} +1 -1
  84. package/src/assets/web-panel/assets/{UkeySign-Do3VVnAy.js → UkeySign-rakR8eel.js} +1 -1
  85. package/src/assets/web-panel/assets/{VideoEditing-Dz7egVIA.js → VideoEditing-DAWZUM5o.js} +1 -1
  86. package/src/assets/web-panel/assets/{Wallet-Dcuw-OxR.js → Wallet-DqUPnl7K.js} +3 -3
  87. package/src/assets/web-panel/assets/{WebAuthn-DPlw-QsB.js → WebAuthn-BnVUwvMm.js} +3 -3
  88. package/src/assets/web-panel/assets/{WorkflowEditor-h4OsnU5q.js → WorkflowEditor-B1CAwxgs.js} +1 -1
  89. package/src/assets/web-panel/assets/{chat-eO9wEwrW.js → chat-k2-0Jzfy.js} +1 -1
  90. package/src/assets/web-panel/assets/{colors-34lSmOXw.js → colors-BAu8xBmW.js} +1 -1
  91. package/src/assets/web-panel/assets/{compact-item-CK4kEWJ4.js → compact-item-DMlqcdfI.js} +1 -1
  92. package/src/assets/web-panel/assets/{createContext-E0A57xed.js → createContext-BU9kfiSw.js} +1 -1
  93. package/src/assets/web-panel/assets/devWarning-DuGrUMAS.js +1 -0
  94. package/src/assets/web-panel/assets/{hasIn-BD9ZMGAl.js → hasIn-2vacgdcl.js} +1 -1
  95. package/src/assets/web-panel/assets/{index--N0u6kTG.js → index-B-C-Ruft.js} +1 -1
  96. package/src/assets/web-panel/assets/{index-DzXjP44T.js → index-B7wDjYUd.js} +1 -1
  97. package/src/assets/web-panel/assets/{index-CZBaqe3d.js → index-BMq0frKK.js} +1 -1
  98. package/src/assets/web-panel/assets/{index-DrOalGut.js → index-BUX4W-2v.js} +1 -1
  99. package/src/assets/web-panel/assets/{index-CT1_eRL-.js → index-BZz2eB33.js} +1 -1
  100. package/src/assets/web-panel/assets/{index-DrsDA_md.js → index-BblNQlaA.js} +1 -1
  101. package/src/assets/web-panel/assets/{index-DP-UZAQN.js → index-BdfKoqsK.js} +1 -1
  102. package/src/assets/web-panel/assets/{index-DiT_REby.js → index-Bf8YofPE.js} +1 -1
  103. package/src/assets/web-panel/assets/{index-Cx3Jn1r0.js → index-Bn8tARil.js} +1 -1
  104. package/src/assets/web-panel/assets/{index-B0rkHxKK.js → index-Bpe2CJd-.js} +1 -1
  105. package/src/assets/web-panel/assets/{index-B_G_ElKO.js → index-BxctzdYQ.js} +1 -1
  106. package/src/assets/web-panel/assets/{index-MIg5Z8qe.js → index-C24NoPpy.js} +1 -1
  107. package/src/assets/web-panel/assets/{index-BmNbU2Z6.js → index-C5C4kSi8.js} +1 -1
  108. package/src/assets/web-panel/assets/{index-BsGmo6v1.js → index-C6ICn9Y6.js} +1 -1
  109. package/src/assets/web-panel/assets/{index-CsrKJJcX.js → index-C8ldqZi6.js} +1 -1
  110. package/src/assets/web-panel/assets/{index-BbX_Dted.js → index-C9WsM29I.js} +1 -1
  111. package/src/assets/web-panel/assets/{index-Ch175NUw.js → index-CONPVaxw.js} +1 -1
  112. package/src/assets/web-panel/assets/{index-DONOUtlz.js → index-CPyYXKFB.js} +1 -1
  113. package/src/assets/web-panel/assets/{index-DFLE2qO9.js → index-CSvSf9px.js} +1 -1
  114. package/src/assets/web-panel/assets/{index-o8pYehRq.js → index-CXmpR6N3.js} +3 -3
  115. package/src/assets/web-panel/assets/{index-Cz3unNfL.js → index-Chybe7Ge.js} +1 -1
  116. package/src/assets/web-panel/assets/{index-yAGBu2E0.js → index-CyXmP3PW.js} +1 -1
  117. package/src/assets/web-panel/assets/{index-CuSau5ya.js → index-DCusBOqR.js} +1 -1
  118. package/src/assets/web-panel/assets/{index-DcE1BspQ.js → index-DH01oIaj.js} +1 -1
  119. package/src/assets/web-panel/assets/{index-DrSAAuJj.js → index-DHg3LMNP.js} +1 -1
  120. package/src/assets/web-panel/assets/{index-CZkFMeWL.js → index-DWLTSIka.js} +1 -1
  121. package/src/assets/web-panel/assets/{index-DvKcroix.js → index-DaUGdvtU.js} +1 -1
  122. package/src/assets/web-panel/assets/{index-Bjs90Eh9.js → index-DcA-tEQd.js} +1 -1
  123. package/src/assets/web-panel/assets/{index-DGRxt5wj.js → index-DfWvcu4p.js} +1 -1
  124. package/src/assets/web-panel/assets/{index-DCn-ECvK.js → index-DmZNnZz7.js} +1 -1
  125. package/src/assets/web-panel/assets/index-DvFfMAux.js +1 -0
  126. package/src/assets/web-panel/assets/{index-8qMA1DWQ.js → index-JsyGqKmD.js} +1 -1
  127. package/src/assets/web-panel/assets/{index-D4bB_x_v.js → index-TtrpHmYx.js} +1 -1
  128. package/src/assets/web-panel/assets/{index-Brqc9Emx.js → index-Ygh0wmKz.js} +1 -1
  129. package/src/assets/web-panel/assets/{index-Da5fmOHB.js → index-dIYqw3f0.js} +1 -1
  130. package/src/assets/web-panel/assets/{index-DpfisY1g.js → index-hDHHJYno.js} +1 -1
  131. package/src/assets/web-panel/assets/index-n6p-1A77.js +1 -0
  132. package/src/assets/web-panel/assets/{index-DeXNCyQJ.js → index-oElehY4F.js} +1 -1
  133. package/src/assets/web-panel/assets/{index-DcbgVLOH.js → index-z4_YwZDW.js} +1 -1
  134. package/src/assets/web-panel/assets/{initDefaultProps-DMTkAomF.js → initDefaultProps-B9OXWu2e.js} +1 -1
  135. package/src/assets/web-panel/assets/{motion-Cnti1F5g.js → motion-IQ47MCDQ.js} +1 -1
  136. package/src/assets/web-panel/assets/{move-CGxmHUga.js → move-CLCU4kjV.js} +1 -1
  137. package/src/assets/web-panel/assets/{mtc-parser-CuwwLoq7.js → mtc-parser-CXnVlSPq.js} +1 -1
  138. package/src/assets/web-panel/assets/{omit-BpdlTkPM.js → omit-BJjLXB0f.js} +1 -1
  139. package/src/assets/web-panel/assets/{pickAttrs-D7nWrThp.js → pickAttrs-BHdtvdy6.js} +1 -1
  140. package/src/assets/web-panel/assets/{placementArrow-Bhx0TV8F.js → placementArrow-oq8X_Bwc.js} +1 -1
  141. package/src/assets/web-panel/assets/{responsiveObserve-CZ1KesZh.js → responsiveObserve-DTD02LAO.js} +1 -1
  142. package/src/assets/web-panel/assets/{slide-CnldF8J6.js → slide-DbEeq8to.js} +1 -1
  143. package/src/assets/web-panel/assets/{statusUtils-CZfo_GOA.js → statusUtils-Do2fy1CJ.js} +1 -1
  144. package/src/assets/web-panel/assets/{styleChecker-B2QCcAv5.js → styleChecker-CFWD63T-.js} +1 -1
  145. package/src/assets/web-panel/assets/{useFlexGapSupport-DzzjIS4J.js → useFlexGapSupport-BeozAWOo.js} +1 -1
  146. package/src/assets/web-panel/assets/{useFs-B_atg9M0.js → useFs-0-rIgnBL.js} +1 -1
  147. package/src/assets/web-panel/assets/{usePersonalDataHub-DhZs3QYN.js → usePersonalDataHub-CeiNoI31.js} +1 -1
  148. package/src/assets/web-panel/assets/{vnode-DcePTYAm.js → vnode-Dj0ReRNg.js} +1 -1
  149. package/src/assets/web-panel/assets/{zoom-BYmlnjRk.js → zoom-DD7MC4Dy.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-knowledge.js +40 -1
  155. package/src/commands/evolution.js +2 -0
  156. package/src/commands/governed-skill-marketplace.js +142 -0
  157. package/src/commands/marketplace.js +4 -1
  158. package/src/commands/serve.js +21 -0
  159. package/src/commands/skill.js +3 -0
  160. package/src/data/changelog.json +39 -0
  161. package/src/gateways/ws/ws-agent-handler.js +59 -2
  162. package/src/gateways/ws/ws-server.js +2 -0
  163. package/src/generated/cc-agent-protocol.schema.json +3 -1
  164. package/src/harness/golden-transcript.js +1 -0
  165. package/src/harness/prompt-compressor.js +51 -5
  166. package/src/harness/provider-backed-compaction.js +28 -1
  167. package/src/harness/remote-session-registry.js +15 -3
  168. package/src/index.js +20 -2
  169. package/src/lazy-dispatch.js +6 -0
  170. package/src/lib/advisor-runtime.js +55 -2
  171. package/src/lib/app-server/cli-agent-kernel-adapter.js +4 -0
  172. package/src/lib/app-server/graph-runtime.js +32 -0
  173. package/src/lib/app-server/server.js +94 -1
  174. package/src/lib/app-server/websocket-transport.js +15 -0
  175. package/src/lib/autonomous-agent.js +63 -13
  176. package/src/lib/cowork/ab-comparator-cli.js +4 -3
  177. package/src/lib/cowork/debate-review-cli.js +4 -3
  178. package/src/lib/cowork/decision-kb-cli.js +5 -0
  179. package/src/lib/cowork-adapter.js +38 -16
  180. package/src/lib/evolution/agent-evolution-ingress.js +95 -15
  181. package/src/lib/evolution/agent-evolution-runtime-composition.js +82 -0
  182. package/src/lib/evolution/agent-evolution-session-lifecycle.js +46 -0
  183. package/src/lib/evolution/agent-model-projection.js +437 -0
  184. package/src/lib/evolution/bounded-descriptor-read.js +29 -0
  185. package/src/lib/evolution/controlled-skill-pilot-ledger-adapter.js +551 -0
  186. package/src/lib/evolution/controlled-skill-production-pilot.js +308 -18
  187. package/src/lib/evolution/evidence-backed-wiki-maintainer.js +32 -10
  188. package/src/lib/evolution/evidence-json-text.js +236 -0
  189. package/src/lib/evolution/evolution-artifact-ports.js +196 -21
  190. package/src/lib/evolution/evolution-deployment-loader.js +240 -2
  191. package/src/lib/evolution/evolution-eval-child-evidence-ledger-adapter.js +373 -0
  192. package/src/lib/evolution/evolution-eval-gate.js +14 -1
  193. package/src/lib/evolution/evolution-eval-process-supervisor-worker.mjs +14 -0
  194. package/src/lib/evolution/evolution-eval-process-supervisor.js +607 -0
  195. package/src/lib/evolution/evolution-evidence-artifact-adapter.js +14 -1
  196. package/src/lib/evolution/evolution-evidence-projector.js +271 -37
  197. package/src/lib/evolution/evolution-file-witness.js +153 -30
  198. package/src/lib/evolution/evolution-ledger-ports.js +1219 -66
  199. package/src/lib/evolution/evolution-ledger.js +66 -2
  200. package/src/lib/evolution/evolution-raw-crypto-shred.js +29 -15
  201. package/src/lib/evolution/evolution-raw-deletion-ledger-adapter.js +865 -0
  202. package/src/lib/evolution/evolution-release-train-domain-stages.js +769 -0
  203. package/src/lib/evolution/evolution-release-train-stage-output-ledger-adapter.js +333 -0
  204. package/src/lib/evolution/evolution-release-train.js +54 -6
  205. package/src/lib/evolution/evolution-workbench-batch-executor.js +101 -144
  206. package/src/lib/evolution/evolution-workbench-control-ports.js +203 -0
  207. package/src/lib/evolution/evolution-workbench-file-resources.js +403 -0
  208. package/src/lib/evolution/evolution-workbench-projection.js +134 -26
  209. package/src/lib/evolution/evolution-workbench-registry-source.js +482 -0
  210. package/src/lib/evolution/evolution-workbench-review-ledger-adapter.js +823 -0
  211. package/src/lib/evolution/evolution-workbench-review-protocol.js +157 -0
  212. package/src/lib/evolution/evolution-workbench-rollback-authorization.js +57 -0
  213. package/src/lib/evolution/evolution-workbench-rollback-ledger-adapter.js +1016 -0
  214. package/src/lib/evolution/evolution-workbench-runtime.js +133 -0
  215. package/src/lib/evolution/evolution-workbench-version-control.js +70 -36
  216. package/src/lib/evolution/evolvable-artifact-ledger-adapter.js +48 -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-inventory.js +392 -0
  220. package/src/lib/evolution/governed-knowledge-dependency-ledger-executor.js +217 -82
  221. package/src/lib/evolution/governed-knowledge-quarantine-release.js +1013 -0
  222. package/src/lib/evolution/governed-knowledge-record.js +148 -0
  223. package/src/lib/evolution/governed-knowledge-revocation-host.js +59 -0
  224. package/src/lib/evolution/governed-knowledge-revocation-record.js +135 -0
  225. package/src/lib/evolution/governed-knowledge-skill-rollback.js +510 -0
  226. package/src/lib/evolution/governed-knowledge-sync.js +181 -95
  227. package/src/lib/evolution/governed-knowledge-wiki-tombstone.js +516 -0
  228. package/src/lib/evolution/governed-skill-marketplace-badge.js +208 -0
  229. package/src/lib/evolution/governed-skill-marketplace-candidate.js +330 -0
  230. package/src/lib/evolution/governed-skill-marketplace-cli-host.js +308 -0
  231. package/src/lib/evolution/governed-skill-marketplace-ledger-adapter.js +420 -0
  232. package/src/lib/evolution/governed-skill-marketplace.js +288 -5
  233. package/src/lib/evolution/governed-wiki-pruning-journal.js +302 -0
  234. package/src/lib/evolution/governed-wiki-pruning-ledger-adapter.js +459 -0
  235. package/src/lib/evolution/governed-wiki-pruning-maintenance.js +576 -0
  236. package/src/lib/evolution/governed-wiki-pruning-plan-authority.js +169 -0
  237. package/src/lib/evolution/governed-wiki-pruning-raw-shred.js +207 -0
  238. package/src/lib/evolution/governed-wiki-pruning-retrieval.js +587 -0
  239. package/src/lib/evolution/governed-wiki-pruning-runtime.js +153 -0
  240. package/src/lib/evolution/governed-wiki-pruning-skill-rollback.js +360 -0
  241. package/src/lib/evolution/governed-wiki-pruning.js +322 -143
  242. package/src/lib/evolution/independent-skill-revocation-source.js +231 -0
  243. package/src/lib/evolution/knowledge-wiki-source-admission.js +283 -0
  244. package/src/lib/evolution/knowledge-wiki-source-provenance.js +360 -0
  245. package/src/lib/evolution/progressive-canary-external-watchdog.js +578 -0
  246. package/src/lib/evolution/progressive-canary-traffic-worker.js +628 -0
  247. package/src/lib/evolution/progressive-canary-watchdog-file-store.js +285 -0
  248. package/src/lib/evolution/progressive-canary-watchdog-node-pki.js +265 -0
  249. package/src/lib/evolution/skill-candidate-registry.js +43 -3
  250. package/src/lib/evolution/skill-promotion-controller.js +25 -0
  251. package/src/lib/evolution/skill-promotion-review-ledger-adapter.js +100 -0
  252. package/src/lib/evolution/skill-registry-transition-ledger-adapter.js +131 -2
  253. package/src/lib/evolution/skill-release-registry.js +168 -4
  254. package/src/lib/evolution/skill-retrieval-revocation-authority.js +361 -0
  255. package/src/lib/evolution/skill-retrieval-revocation-ledger-adapter.js +346 -0
  256. package/src/lib/evolution/skill-revocation-propagation.js +467 -0
  257. package/src/lib/evolution/skill-target-matrix-eval.js +162 -11
  258. package/src/lib/evolution/skill-wiki-reconciliation.js +985 -0
  259. package/src/lib/evolution/skill-writer-inventory-manifest.js +8 -6
  260. package/src/lib/evolution/statistical-progressive-canary.js +165 -3
  261. package/src/lib/evolution/structured-memory-agent-control-plane.js +120 -0
  262. package/src/lib/evolution/structured-memory-authority-ledger-adapter.js +5 -1
  263. package/src/lib/evolution/structured-memory-promotion-receipt-writer.js +126 -0
  264. package/src/lib/evolution/wiki-informed-skill-proposer.js +127 -21
  265. package/src/lib/evolution/wiki-maintainer-ledger-adapter.js +822 -101
  266. package/src/lib/evolution/wiki-revision-protocol.js +120 -0
  267. package/src/lib/evolution/wiki-skill-proposal-ledger-adapter.js +307 -0
  268. package/src/lib/evolution/wiki-target-tombstone-revision.js +109 -0
  269. package/src/lib/evolution/wikiskill-benchmark-cli-host.js +178 -0
  270. package/src/lib/evolution/wikiskill-benchmark-execution-host.js +702 -0
  271. package/src/lib/evolution/wikiskill-benchmark-ledger-adapter.js +613 -0
  272. package/src/lib/evolution/wikiskill-benchmark.js +80 -16
  273. package/src/lib/goal-assess.js +17 -10
  274. package/src/lib/interactive-planner.js +9 -1
  275. package/src/lib/iteration-budget.js +16 -2
  276. package/src/lib/micro-compact.js +4 -1
  277. package/src/lib/model-failure-policy.js +21 -0
  278. package/src/lib/process-execution-broker/index.js +1 -0
  279. package/src/lib/process-execution-broker/windows-sandbox-helper.dll +0 -0
  280. package/src/lib/process-execution-broker/windows-sandbox-helper.exe +0 -0
  281. package/src/lib/process-execution-broker/windows-sandbox.cs +33 -15
  282. package/src/lib/read-file-loop-guard.js +113 -0
  283. package/src/lib/read-file-page.js +191 -0
  284. package/src/lib/runnable-provider.js +2 -1
  285. package/src/lib/skill-retrieval-router.js +22 -1
  286. package/src/repl/agent-repl.js +133 -34
  287. package/src/runtime/agent-core.js +196 -74
  288. package/src/runtime/agent-runtime.js +43 -0
  289. package/src/runtime/coding-agent-contract-shared.cjs +7 -1
  290. package/src/runtime/fallback-model.js +143 -62
  291. package/src/runtime/headless-runner.js +54 -10
  292. package/src/runtime/headless-stream.js +50 -6
  293. package/src/runtime/runtime-factory.js +41 -2
  294. package/src/assets/web-panel/assets/ChatBubbleRenderer-Ds3pA-ET.js +0 -1
  295. package/src/assets/web-panel/assets/MarkdownRenderer-DqTx7_u1.js +0 -1
  296. package/src/assets/web-panel/assets/devWarning-CF3xafX2.js +0 -1
  297. package/src/assets/web-panel/assets/index-C907rPwd.js +0 -1
  298. package/src/assets/web-panel/assets/index-wueRSK2d.js +0 -1
@@ -16,11 +16,14 @@
16
16
 
17
17
  import fs from "fs";
18
18
  import path from "path";
19
+ import { buildReadFilePage } from "../lib/read-file-page.js";
20
+ import { ReadFileLoopGuard } from "../lib/read-file-loop-guard.js";
19
21
  import broker from "../lib/process-execution-broker/index.js";
20
22
  import os from "os";
21
23
  import { createHash, randomUUID } from "node:crypto";
22
24
  import skillInvocationReceipt from "@chainlesschain/session-core/skill-invocation-receipt";
23
25
  import { isProxy } from "node:util/types";
26
+ import { captureAgentEvolutionIngress } from "../lib/evolution/agent-evolution-ingress.js";
24
27
 
25
28
  const { startSkillInvocation, settleSkillInvocation } = skillInvocationReceipt;
26
29
  import sharedCodingAgentPolicy from "./coding-agent-policy.cjs";
@@ -1084,7 +1087,7 @@ Key behaviors:
1084
1087
  - When asked to run/test something, use run_shell to execute it
1085
1088
  - 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
1086
1089
  - When asked about git status, diff, log, or other repository operations, use the git tool instead of run_shell
1087
- - When asked about files or code, use read_file and search_files to find information
1090
+ - 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.
1088
1091
  - 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.
1089
1092
  - 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.
1090
1093
  - 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).
@@ -3573,6 +3576,7 @@ export async function executeTool(name, args, context = {}) {
3573
3576
  skillAllowlist: context.skillAllowlist ?? null,
3574
3577
  skillOutcomeIndex: context.skillOutcomeIndex,
3575
3578
  skillVectorAuthority: context.skillVectorAuthority,
3579
+ skillRetrievalRevocationReader: context.skillRetrievalRevocationReader,
3576
3580
  cwd,
3577
3581
  parentMessages: context.parentMessages,
3578
3582
  interaction: context.interaction,
@@ -3628,6 +3632,7 @@ export async function executeTool(name, args, context = {}) {
3628
3632
  subAgentBudget: context.subAgentBudget || null,
3629
3633
  sessionBudget: context.sessionBudget || null,
3630
3634
  hostResourceBudget: context.hostResourceBudget || null,
3635
+ readFileCache: context.readFileCache || null,
3631
3636
  // Effective contract of THIS loop (parent ceiling for a nested spawn) +
3632
3637
  // the MCP tool definitions this loop exposes (inheritable by a spawn).
3633
3638
  subAgentContract: context.subAgentContract || null,
@@ -5118,6 +5123,7 @@ async function executeToolInner(
5118
5123
  skillAllowlist = null,
5119
5124
  skillOutcomeIndex,
5120
5125
  skillVectorAuthority,
5126
+ skillRetrievalRevocationReader,
5121
5127
  cwd,
5122
5128
  parentMessages,
5123
5129
  interaction,
@@ -5171,6 +5177,7 @@ async function executeToolInner(
5171
5177
  backgroundUsageFailureState = null,
5172
5178
  toolAdmission = null,
5173
5179
  hostResourceBudget = null,
5180
+ readFileCache = null,
5174
5181
  unattendedActionPolicy = null,
5175
5182
  managedCheckpoint = false,
5176
5183
  fileMutationScope = null,
@@ -5239,11 +5246,37 @@ async function executeToolInner(
5239
5246
  }
5240
5247
  // A clear, self-correcting error beats the cryptic "EISDIR: illegal
5241
5248
  // operation on a directory" that readFileSync throws on a directory.
5242
- if (fs.statSync(filePath).isDirectory()) {
5249
+ const fileStat = fs.statSync(filePath);
5250
+ if (fileStat.isDirectory()) {
5243
5251
  return attachDescriptor({
5244
5252
  error: `Path is a directory, not a file: ${filePath}. Use list_dir to see its contents.`,
5245
5253
  });
5246
5254
  }
5255
+ const fileVersion = `${fileStat.size}:${fileStat.mtimeMs}:${fileStat.ctimeMs}`;
5256
+ const cacheKey = JSON.stringify([
5257
+ filePath,
5258
+ args.offset ?? null,
5259
+ args.limit ?? null,
5260
+ args.column ?? null,
5261
+ args.hashed === true,
5262
+ args.raw === true,
5263
+ ]);
5264
+ const cached = readFileCache?.get(cacheKey);
5265
+ if (cached?.fileVersion === fileVersion) {
5266
+ // All permission checks ran before this point. A fresh stat still
5267
+ // invalidates changed/deleted files; cache only bounded pages per run.
5268
+ _recordFileObservation(filePath);
5269
+ readFileCache.delete(cacheKey);
5270
+ readFileCache.set(cacheKey, cached);
5271
+ return attachDescriptor(
5272
+ await _withSubtreeInstructions(
5273
+ structuredClone(cached.page),
5274
+ filePath,
5275
+ cwd,
5276
+ subtreeInstructionScope,
5277
+ ),
5278
+ );
5279
+ }
5247
5280
  const content = fs.readFileSync(filePath, "utf8");
5248
5281
  // Record the mtime so a later edit can detect an external change that
5249
5282
  // happened between this read and the edit (read-freshness guard).
@@ -5252,69 +5285,32 @@ async function executeToolInner(
5252
5285
  // outputs summarized) so the model can find cells for notebook_edit
5253
5286
  // without ingesting raw JSON / base64 output blobs. `raw:true` returns the
5254
5287
  // underlying JSON. Non-.ipynb reads are unchanged.
5255
- if (args.raw !== true && /\.ipynb$/i.test(filePath)) {
5256
- const nbView = renderNotebook(content);
5257
- if (nbView) {
5258
- return attachDescriptor(
5259
- nbView.length > 50000
5260
- ? {
5261
- content: nbView.substring(0, 50000) + "\n...(truncated)",
5262
- size: nbView.length,
5263
- notebook: true,
5264
- }
5265
- : { content: nbView, notebook: true },
5266
- );
5267
- }
5268
- }
5288
+ const nbView =
5289
+ args.raw !== true && /\.ipynb$/i.test(filePath)
5290
+ ? renderNotebook(content)
5291
+ : null;
5269
5292
  // Hashline mode: prefix each line with a 6-char content hash tag
5270
5293
  // so downstream edit_file_hashed calls can anchor by hash.
5271
- let rendered = args.hashed === true ? annotateLines(content) : content;
5272
-
5273
- // Line-range slice (Claude-Code Read offset/limit parity): `offset` is the
5274
- // 1-based first line, `limit` the max line count — so a file larger than
5275
- // the size cap can be paged through instead of being stuck at its head.
5276
- // Coerces numeric strings the model may emit ("10" → 10).
5277
- const toPos = (v) => {
5278
- const n = typeof v === "number" ? v : parseInt(v, 10);
5279
- return Number.isInteger(n) && n > 0 ? n : null;
5280
- };
5281
- const offset = toPos(args.offset);
5282
- const limit = toPos(args.limit);
5283
- let range = null;
5284
- if (offset || limit) {
5285
- const lines = rendered.split("\n");
5286
- const start = offset ? offset - 1 : 0;
5287
- const end = limit != null ? start + limit : lines.length;
5288
- rendered = lines.slice(start, end).join("\n");
5289
- range = {
5290
- startLine: Math.min(start + 1, lines.length),
5291
- endLine: Math.min(end, lines.length),
5292
- totalLines: lines.length,
5293
- };
5294
- }
5295
-
5296
- if (rendered.length > 50000) {
5297
- return attachDescriptor(
5298
- await _withSubtreeInstructions(
5299
- {
5300
- content: rendered.substring(0, 50000) + "\n...(truncated)",
5301
- size: rendered.length,
5302
- hashed: args.hashed === true,
5303
- ...(range ? { range } : {}),
5304
- },
5305
- filePath,
5306
- cwd,
5307
- subtreeInstructionScope,
5308
- ),
5309
- );
5294
+ const rendered =
5295
+ nbView || (args.hashed === true ? annotateLines(content) : content);
5296
+ const page = buildReadFilePage(rendered, args, {
5297
+ filePath,
5298
+ fileVersion,
5299
+ maxChars: MAX_TOOL_RESULT_CHARS,
5300
+ });
5301
+ if (nbView) page.notebook = true;
5302
+ if (readFileCache && !page.error) {
5303
+ readFileCache.delete(cacheKey);
5304
+ readFileCache.set(cacheKey, {
5305
+ fileVersion,
5306
+ page: structuredClone(page),
5307
+ });
5308
+ while (readFileCache.size > 8)
5309
+ readFileCache.delete(readFileCache.keys().next().value);
5310
5310
  }
5311
5311
  return attachDescriptor(
5312
5312
  await _withSubtreeInstructions(
5313
- {
5314
- content: rendered,
5315
- hashed: args.hashed === true,
5316
- ...(range ? { range } : {}),
5317
- },
5313
+ page,
5318
5314
  filePath,
5319
5315
  cwd,
5320
5316
  subtreeInstructionScope,
@@ -8283,6 +8279,7 @@ async function executeToolInner(
8283
8279
  target: { os: process.platform },
8284
8280
  vectorScores: vector?.scores ?? null,
8285
8281
  outcomeMetrics: outcomeAuthority.metrics,
8282
+ revocationReader: skillRetrievalRevocationReader ?? null,
8286
8283
  topK: Math.min(64, Math.max(1, skills.length)),
8287
8284
  });
8288
8285
  const byDigest = new Map(
@@ -9326,6 +9323,46 @@ export function capToolResultString(serialized, max = MAX_TOOL_RESULT_CHARS) {
9326
9323
  );
9327
9324
  }
9328
9325
 
9326
+ /** Avoid injecting the same file page twice while its original is still visible. */
9327
+ export function toolResultForModel(tool, result, messages) {
9328
+ const serialized = capToolResultString(safeStringifyToolResult(result));
9329
+ if (
9330
+ tool !== "read_file" ||
9331
+ result?.error ||
9332
+ !result?.path ||
9333
+ !result.content ||
9334
+ result.subtreeInstructions?.length
9335
+ ) {
9336
+ return serialized;
9337
+ }
9338
+ const previous = messages.find((message) => {
9339
+ if (message.role !== "tool" || typeof message.content !== "string")
9340
+ return false;
9341
+ try {
9342
+ const prior = JSON.parse(message.content.split("\n\n[Budget ")[0]);
9343
+ return (
9344
+ prior.path === result.path &&
9345
+ prior.fileVersion === result.fileVersion &&
9346
+ prior.content === result.content &&
9347
+ prior.hashed === result.hashed &&
9348
+ JSON.stringify(prior.range) === JSON.stringify(result.range)
9349
+ );
9350
+ } catch {
9351
+ return false;
9352
+ }
9353
+ });
9354
+ if (!previous) return serialized;
9355
+ return JSON.stringify({
9356
+ path: result.path,
9357
+ alreadyRead: true,
9358
+ previousToolCallId: previous.tool_call_id,
9359
+ readAt: result.toolTelemetryRecord?.timestamp,
9360
+ ...(result.range ? { range: result.range } : {}),
9361
+ ...(result.nextRead ? { nextRead: result.nextRead } : {}),
9362
+ 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.",
9363
+ });
9364
+ }
9365
+
9329
9366
  /**
9330
9367
  * Serialize a tool result for the transcript without ever throwing. A plain
9331
9368
  * `JSON.stringify` throws on a circular reference, a BigInt, or a value whose
@@ -10730,6 +10767,10 @@ function _openAIProviderRequestReceipt(response, data, clientRequestId) {
10730
10767
  * @returns {Promise<object>} response with .message
10731
10768
  */
10732
10769
  export async function chatWithTools(rawMessages, options) {
10770
+ const evolutionIngress =
10771
+ options.evolutionIngress == null
10772
+ ? null
10773
+ : captureAgentEvolutionIngress(options.evolutionIngress);
10733
10774
  const {
10734
10775
  provider,
10735
10776
  model,
@@ -10771,13 +10812,22 @@ export async function chatWithTools(rawMessages, options) {
10771
10812
  const lastUserMsg = [...providerMessages]
10772
10813
  .reverse()
10773
10814
  .find((m) => m.role === "user");
10774
- const messages =
10815
+ let messages =
10775
10816
  ce && !canonicalPlan
10776
10817
  ? ce.buildOptimizedMessages(providerMessages, {
10777
10818
  userQuery: lastUserMsg?.content,
10778
10819
  })
10779
10820
  : providerMessages;
10780
10821
 
10822
+ if (evolutionIngress !== null) {
10823
+ const projected = await evolutionIngress.prepareModelRequest({
10824
+ messages,
10825
+ tools,
10826
+ });
10827
+ messages = projected.messages;
10828
+ tools = projected.tools;
10829
+ }
10830
+
10781
10831
  throwIfAborted(signal);
10782
10832
 
10783
10833
  if (provider === "ollama") {
@@ -12889,7 +12939,26 @@ function _instrumentAutoCompactorUsage(compactor, options) {
12889
12939
  * loaded — callers treat that as "don't compact". Cached (including null) so we
12890
12940
  * import once per run, not once per iteration.
12891
12941
  */
12942
+ const evolutionAutoCompactors = new WeakMap();
12943
+
12892
12944
  async function _getAutoCompactor(options) {
12945
+ const evolutionIngress =
12946
+ options.evolutionIngress == null
12947
+ ? null
12948
+ : captureAgentEvolutionIngress(options.evolutionIngress);
12949
+ if (
12950
+ evolutionIngress !== null &&
12951
+ (typeof options.compactionLlmQuery === "function" ||
12952
+ (options._autoCompactor != null &&
12953
+ evolutionAutoCompactors.get(options._autoCompactor) !==
12954
+ evolutionIngress))
12955
+ ) {
12956
+ const error = new TypeError(
12957
+ "Evolution auto-compaction requires the canonical model transport and owned compressor",
12958
+ );
12959
+ error.code = "CC_AGENT_EVOLUTION_INGRESS_FAILED";
12960
+ throw error;
12961
+ }
12893
12962
  if (Object.prototype.hasOwnProperty.call(options, "_autoCompactor")) {
12894
12963
  return _instrumentAutoCompactorUsage(options._autoCompactor, options);
12895
12964
  }
@@ -12983,8 +13052,11 @@ async function _getAutoCompactor(options) {
12983
13052
  }
12984
13053
  } catch (error) {
12985
13054
  if (canonicalRequired) throw error;
13055
+ if (error?.code === "CC_AGENT_EVOLUTION_INGRESS_FAILED") throw error;
12986
13056
  compressor = null;
12987
13057
  }
13058
+ if (evolutionIngress !== null && compressor !== null)
13059
+ evolutionAutoCompactors.set(compressor, evolutionIngress);
12988
13060
  try {
12989
13061
  options._autoCompactor = compressor;
12990
13062
  } catch {
@@ -13207,6 +13279,20 @@ function permissionDecision(callId, tool, result) {
13207
13279
  }
13208
13280
 
13209
13281
  export async function* agentLoop(messages, options) {
13282
+ const configuredChatFn = options.chatFn;
13283
+ const evolutionIngress =
13284
+ options.evolutionIngress == null
13285
+ ? null
13286
+ : captureAgentEvolutionIngress(options.evolutionIngress);
13287
+ let llmCall = configuredChatFn || chatWithTools;
13288
+ if (evolutionIngress !== null && configuredChatFn) {
13289
+ const { captureCanonicalFallbackChatFn } =
13290
+ await import("./fallback-model.js");
13291
+ llmCall = captureCanonicalFallbackChatFn(
13292
+ configuredChatFn,
13293
+ evolutionIngress,
13294
+ );
13295
+ }
13210
13296
  // Shared iteration budget — replaces hardcoded MAX_ITERATIONS.
13211
13297
  // When options.iterationBudget is provided (e.g. from parent agent),
13212
13298
  // the same budget instance is shared, so parent+child consume from one pool.
@@ -13273,10 +13359,12 @@ export async function* agentLoop(messages, options) {
13273
13359
  options.mcpConflictScheduler || createMcpConflictScheduler();
13274
13360
 
13275
13361
  const toolContext = {
13362
+ readFileCache: new Map(),
13276
13363
  hookDb: hermeticExecution ? null : options.hookDb || null,
13277
13364
  skillLoader: options.skillLoader || _defaultSkillLoader,
13278
13365
  skillOutcomeIndex: options.skillOutcomeIndex,
13279
13366
  skillVectorAuthority: options.skillVectorAuthority,
13367
+ skillRetrievalRevocationReader: options.skillRetrievalRevocationReader,
13280
13368
  // Hook-envelope tracing (P2 unified event bus): every settings-hook payload
13281
13369
  // fired during this run carries trace_id = this run's id; a spawned child
13282
13370
  // loop carries parent_id = the spawning run's id (threaded by
@@ -13346,6 +13434,7 @@ export async function* agentLoop(messages, options) {
13346
13434
  // Parent LLM config — forwarded to spawn_sub_agent so a delegated subagent
13347
13435
  // inherits the provider/key and can override just the model (cc agents `model:`).
13348
13436
  llmOptions: {
13437
+ ...(evolutionIngress === null ? {} : { evolutionIngress }),
13349
13438
  provider: options.provider || null,
13350
13439
  model: options.model || null,
13351
13440
  baseUrl: options.baseUrl || null,
@@ -13521,11 +13610,8 @@ export async function* agentLoop(messages, options) {
13521
13610
  }
13522
13611
  }
13523
13612
 
13524
- // Phase 7 parity harness hook: tests can inject a mock LLM function via
13525
- // `options.chatFn` to drive the loop deterministically without hitting a
13526
- // real provider. Production code path is unchanged — the fallback is the
13527
- // real `chatWithTools`.
13528
- let llmCall = options.chatFn || chatWithTools;
13613
+ // llmCall was captured before startup awaits. With evolution ingress, only
13614
+ // a factory-owned canonical fallback bound to this Run may replace it.
13529
13615
 
13530
13616
  // Runnable-first auth recovery: if the resolved provider's key is missing /
13531
13617
  // wrong / expired, self-heal to a provider we can actually run (endpoint-
@@ -13621,8 +13707,22 @@ export async function* agentLoop(messages, options) {
13621
13707
  // one-shot guard means a model that keeps returning empty turns completes
13622
13708
  // rather than looping forever (the iteration budget is the hard backstop).
13623
13709
  let emptyThinkingReprompted = false;
13710
+ const readFileLoopGuard = new ReadFileLoopGuard();
13624
13711
 
13625
13712
  while (budget.hasRemaining()) {
13713
+ readFileLoopGuard.finishBatch();
13714
+ if (readFileLoopGuard.stalled) {
13715
+ await _awaitBackgroundUsageSettlement(
13716
+ backgroundSubAgents,
13717
+ backgroundUsageFailureState,
13718
+ );
13719
+ yield* _drainSubAgentUsage(subAgentUsageSink);
13720
+ const error = new Error(
13721
+ "Repeated unchanged file reads: stopped after three tool batches made no new reading progress, including a recovery attempt. The task is not complete. Continue with a different file section or a targeted search.",
13722
+ );
13723
+ error.code = "CC_AGENT_REPEATED_FILE_READ";
13724
+ throw error;
13725
+ }
13626
13726
  if (typeof toolContext.sessionBudget?.consumeTurn === "function") {
13627
13727
  const turnBudgetId = `turn:${createHash("sha256")
13628
13728
  .update(`${runId}:t${budget.consumed + 1}`, "utf8")
@@ -14066,6 +14166,7 @@ export async function* agentLoop(messages, options) {
14066
14166
  } catch (_e) {
14067
14167
  if (isAbortError(_e) || signal?.aborted) throw _e;
14068
14168
  if (_e?.runtimeLedgerPersistence === true) throw _e;
14169
+ if (_e?.code === "CC_AGENT_EVOLUTION_INGRESS_FAILED") throw _e;
14069
14170
  if (
14070
14171
  _e?.workflowEffectOutcomeUnknown === true &&
14071
14172
  _e?.compactionFailureReported === true
@@ -14175,6 +14276,20 @@ export async function* agentLoop(messages, options) {
14175
14276
  // system-message supplement that is NOT persisted to messages history.
14176
14277
  let callMessages = messages;
14177
14278
  const contextMemoryTrustedSystemIndexes = [];
14279
+ if (readFileLoopGuard.progressHint) {
14280
+ callMessages = [
14281
+ ...callMessages,
14282
+ { role: "system", content: readFileLoopGuard.progressHint },
14283
+ ];
14284
+ contextMemoryTrustedSystemIndexes.push(callMessages.length - 1);
14285
+ }
14286
+ if (readFileLoopGuard.recoveryHint) {
14287
+ callMessages = [
14288
+ ...callMessages,
14289
+ { role: "system", content: readFileLoopGuard.recoveryHint },
14290
+ ];
14291
+ contextMemoryTrustedSystemIndexes.push(callMessages.length - 1);
14292
+ }
14178
14293
  if (!hermeticExecution && typeof options.prepareCall === "function") {
14179
14294
  try {
14180
14295
  const hook = await options.prepareCall({
@@ -14188,7 +14303,7 @@ export async function* agentLoop(messages, options) {
14188
14303
  hook.systemSuffix
14189
14304
  ) {
14190
14305
  callMessages = [
14191
- ...messages,
14306
+ ...callMessages,
14192
14307
  { role: "system", content: hook.systemSuffix },
14193
14308
  ];
14194
14309
  contextMemoryTrustedSystemIndexes.push(callMessages.length - 1);
@@ -14250,9 +14365,13 @@ export async function* agentLoop(messages, options) {
14250
14365
  canonicalProviderContext.selectedToolNames,
14251
14366
  }
14252
14367
  : effectiveToolOptions;
14253
- const providerCallOptions = providerRequestId
14368
+ const requestOptions = providerRequestId
14254
14369
  ? { ...plannedProviderOptions, providerRequestId }
14255
14370
  : plannedProviderOptions;
14371
+ const providerCallOptions =
14372
+ evolutionIngress !== null
14373
+ ? { ...requestOptions, evolutionIngress }
14374
+ : requestOptions;
14256
14375
  const modelUsageCall = {
14257
14376
  type: "model-usage-started",
14258
14377
  callId: _newModelUsageCallId("model"),
@@ -14575,6 +14694,7 @@ export async function* agentLoop(messages, options) {
14575
14694
 
14576
14695
  // Add assistant message with tool calls
14577
14696
  messages.push(msg);
14697
+ readFileLoopGuard.startBatch(toolCalls.length);
14578
14698
 
14579
14699
  // Concurrent READ-ONLY batch (latency optimization). When every call in the
14580
14700
  // turn is a well-formed read-only built-in (pure fs/DB reads — no mutation,
@@ -14683,6 +14803,7 @@ export async function* agentLoop(messages, options) {
14683
14803
  _throwBackgroundUsageFailureState(backgroundUsageFailureState);
14684
14804
  const { result: toolResult, error: toolError } = await promise;
14685
14805
  throwIfAborted(signal);
14806
+ readFileLoopGuard.record(call.function.name, toolResult);
14686
14807
  const failed = emitToolHookLifecycle({
14687
14808
  tool: call.function.name,
14688
14809
  args: toolArgs,
@@ -14700,8 +14821,10 @@ export async function* agentLoop(messages, options) {
14700
14821
  failed,
14701
14822
  });
14702
14823
  const warningMsg = budget.toWarningMessage();
14703
- const resultStr = capToolResultString(
14704
- safeStringifyToolResult(toolResult),
14824
+ const resultStr = toolResultForModel(
14825
+ call.function.name,
14826
+ toolResult,
14827
+ messages,
14705
14828
  );
14706
14829
  const toolContent = warningMsg
14707
14830
  ? `${resultStr}\n\n${warningMsg}`
@@ -15150,9 +15273,8 @@ export async function* agentLoop(messages, options) {
15150
15273
  // Cap an individual tool result so one giant output can't blow the
15151
15274
  // context — but tell the model when we cut it (no more silent
15152
15275
  // mid-content slice). See MAX_TOOL_RESULT_CHARS / capToolResultString.
15153
- const resultStr = capToolResultString(
15154
- safeStringifyToolResult(toolResult),
15155
- );
15276
+ const resultStr = toolResultForModel(toolName, toolResult, messages);
15277
+ readFileLoopGuard.record(toolName, toolResult);
15156
15278
  const toolContent = warningMsg
15157
15279
  ? `${resultStr}\n\n${warningMsg}`
15158
15280
  : resultStr;
@@ -15243,7 +15365,7 @@ export async function* agentLoop(messages, options) {
15243
15365
  backgroundUsageFailureState,
15244
15366
  );
15245
15367
  yield* _drainSubAgentUsage(subAgentUsageSink);
15246
- yield { type: "iteration-budget-exhausted", budget: budget.toSummary() };
15368
+ yield { type: "iteration-budget-exhausted", budget: budget.limit };
15247
15369
  yield {
15248
15370
  type: "response-complete",
15249
15371
  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: