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
@@ -23,10 +23,35 @@
23
23
  * would be the silent auth-substitution this project forbids). A cross-provider
24
24
  * entry whose key is missing is SKIPPED with a clear reason, not attempted with
25
25
  * the wrong credential.
26
+ *
27
+ * Evolution-enabled loops bind factory-owned canonical transports to their
28
+ * ingress before startup awaits; every attempted model enters chatWithTools
29
+ * again and obtains a fresh durable projection. Strict call-ledger sessions
30
+ * and workflow-bound requests still allow only the primary attempt: retries
31
+ * require separate durable accounting/effect boundaries, not this wrapper.
26
32
  */
27
33
 
28
34
  import { chatWithTools } from "./agent-core.js";
29
35
  import { BUILT_IN_PROVIDERS } from "../lib/llm-providers.js";
36
+ import { throwIfAborted } from "../lib/abort-utils.js";
37
+ import { isTerminalModelFailure } from "../lib/model-failure-policy.js";
38
+ import { captureAgentEvolutionIngress } from "../lib/evolution/agent-evolution-ingress.js";
39
+
40
+ // Only this module can register a canonical transport. Function properties,
41
+ // wrappers and proxies cannot confer this authority.
42
+ const CANONICAL_FALLBACKS = new WeakMap();
43
+
44
+ /** Bind a factory-owned canonical fallback to exactly one admitted Run. */
45
+ export function captureCanonicalFallbackChatFn(value, evolutionIngress) {
46
+ const ingress = captureAgentEvolutionIngress(evolutionIngress);
47
+ const owned = CANONICAL_FALLBACKS.get(value);
48
+ if (!owned || (owned.ingress !== null && owned.ingress !== ingress)) {
49
+ throw new TypeError(
50
+ "Evolution ingress requires the canonical chatWithTools transport bound to the same Run",
51
+ );
52
+ }
53
+ return owned.ingress === ingress ? value : owned.bind(ingress);
54
+ }
30
55
 
31
56
  // Claude Code caps the fallback chain at 3 backups; mirror that here so a
32
57
  // mis-configured comma list can't fan out into an unbounded retry storm.
@@ -77,7 +102,7 @@ const MODEL_NOT_FOUND_PATTERNS = [
77
102
  * @returns {boolean}
78
103
  */
79
104
  export function isRetryableModelError(err) {
80
- if (!err) return false;
105
+ if (!err || isTerminalModelFailure(err)) return false;
81
106
  const status =
82
107
  typeof err.status === "number"
83
108
  ? err.status
@@ -107,7 +132,7 @@ export function isRetryableModelError(err) {
107
132
  * @returns {boolean}
108
133
  */
109
134
  export function isModelNotFoundError(err) {
110
- if (!err) return false;
135
+ if (!err || isTerminalModelFailure(err)) return false;
111
136
  const status =
112
137
  typeof err.status === "number"
113
138
  ? err.status
@@ -245,6 +270,7 @@ export function resolveFallbackTarget(entry, opts = {}) {
245
270
  * @param {Function} [opts.isRetryable] transient-error predicate (seam)
246
271
  * @param {Function} [opts.isModelNotFound] missing-model predicate (seam)
247
272
  * @param {Function} [opts.onFallback] notified ({from,to,error}) per hop
273
+ * @param {object} [opts.evolutionIngress] optional fixed Run authority
248
274
  * @returns {Function} a (messages, options) => Promise<result> chatFn
249
275
  */
250
276
  export function makeFallbackChatFn(opts = {}) {
@@ -258,79 +284,134 @@ export function makeFallbackChatFn(opts = {}) {
258
284
 
259
285
  const env = opts.env || process.env;
260
286
  const providers = opts.providers || BUILT_IN_PROVIDERS || {};
287
+ const initialIngress =
288
+ opts.evolutionIngress == null
289
+ ? null
290
+ : captureAgentEvolutionIngress(opts.evolutionIngress);
291
+ const canonical = baseChatFn === chatWithTools;
292
+ if (initialIngress !== null && !canonical) {
293
+ throw new TypeError(
294
+ "Evolution ingress requires the canonical chatWithTools transport",
295
+ );
296
+ }
261
297
 
262
- return async function chatWithFallback(messages, options = {}) {
263
- try {
264
- return await baseChatFn(messages, options);
265
- } catch (firstErr) {
266
- // A strict call-ledger boundary identifies exactly one provider/model
267
- // transport. Retrying behind that boundary would either attribute the
268
- // fallback's usage to the primary identity or lose the failed attempt's
269
- // possible spend, so surface the primary error without another call.
270
- if (options.strictUsageTelemetry === true) throw firstErr;
271
- let err = firstErr;
272
- let lastTried = options.model;
273
- for (const candidate of models) {
274
- const target = resolveFallbackTarget(candidate, { env, providers });
275
- // A cross-provider hop whose key is absent (or an unknown provider) is
276
- // skipped — never attempted with the wrong credential. Surface why.
277
- if (target.unavailable) {
298
+ function createChatFn(boundIngress) {
299
+ const chatFn = async function chatWithFallback(messages, callOptions = {}) {
300
+ // Snapshot before any callback/await. Per-call overrides cannot remove a
301
+ // factory/loop-owned ingress, strict accounting or cancellation signal.
302
+ const options = { ...callOptions };
303
+ const requestedIngress =
304
+ options.evolutionIngress == null
305
+ ? null
306
+ : captureAgentEvolutionIngress(options.evolutionIngress);
307
+ if (
308
+ (requestedIngress !== null && !canonical) ||
309
+ (boundIngress !== null &&
310
+ requestedIngress !== null &&
311
+ requestedIngress !== boundIngress)
312
+ ) {
313
+ throw new TypeError(
314
+ "Evolution ingress requires the canonical chatWithTools transport bound to the same Run",
315
+ );
316
+ }
317
+ if (boundIngress !== null || requestedIngress !== null) {
318
+ options.evolutionIngress = boundIngress || requestedIngress;
319
+ }
320
+ const signal = options.signal;
321
+ throwIfAborted(signal);
322
+ try {
323
+ return await baseChatFn(messages, options);
324
+ } catch (firstErr) {
325
+ // A strict call-ledger boundary identifies exactly one provider/model
326
+ // transport. Retrying behind that boundary would either attribute the
327
+ // fallback's usage to the primary identity or lose the failed attempt's
328
+ // possible spend, so surface the primary error without another call.
329
+ if (
330
+ options.strictUsageTelemetry === true ||
331
+ options.workflowEffectId != null ||
332
+ options.providerRequestId != null
333
+ )
334
+ throw firstErr;
335
+ let err = firstErr;
336
+ let lastTried = options.model;
337
+ let lastProvider = options.provider;
338
+ for (const candidate of models) {
339
+ // Admission/ledger/cancellation failures are terminal even when a
340
+ // nested cause says "timeout", or an injected predicate says retry.
341
+ if (isTerminalModelFailure(err)) throw err;
342
+ throwIfAborted(signal);
343
+ if (!isRetryable(err) && !isModelNotFound(err)) throw err;
344
+ const target = resolveFallbackTarget(candidate, { env, providers });
345
+ // A cross-provider hop whose key is absent (or an unknown provider) is
346
+ // skipped — never attempted with the wrong credential. Surface why.
347
+ if (target.unavailable) {
348
+ if (typeof onFallback === "function") {
349
+ try {
350
+ onFallback({
351
+ from: lastTried,
352
+ to: candidate,
353
+ skipped: true,
354
+ reason: target.reason,
355
+ error: err?.message || String(err),
356
+ });
357
+ } catch {
358
+ /* best-effort */
359
+ }
360
+ }
361
+ continue;
362
+ }
363
+ // Skip a no-op hop (same provider + same model just attempted).
364
+ const sameModel = target.model === lastTried;
365
+ const sameProvider =
366
+ (target.crossProvider ? target.provider : options.provider) ===
367
+ lastProvider;
368
+ if (!target.model || (sameModel && sameProvider)) continue;
278
369
  if (typeof onFallback === "function") {
279
370
  try {
280
371
  onFallback({
281
372
  from: lastTried,
282
- to: candidate,
283
- skipped: true,
284
- reason: target.reason,
373
+ to: target.crossProvider
374
+ ? `${target.provider}:${target.model}`
375
+ : target.model,
376
+ crossProvider: target.crossProvider,
285
377
  error: err?.message || String(err),
286
378
  });
287
379
  } catch {
288
- /* best-effort */
380
+ // Notification is best-effort — never mask the retry.
289
381
  }
290
382
  }
291
- continue;
292
- }
293
- // Skip a no-op hop (same provider + same model just attempted).
294
- const sameModel = target.model === lastTried;
295
- const sameProvider =
296
- !target.crossProvider || target.provider === options.provider;
297
- if (!target.model || (sameModel && sameProvider)) continue;
298
- // Only advance the chain for transient failures or a missing primary;
299
- // a real bad-request / auth error is surfaced immediately.
300
- if (!isRetryable(err) && !isModelNotFound(err)) throw err;
301
- if (typeof onFallback === "function") {
383
+ lastTried = target.model;
384
+ lastProvider = target.crossProvider
385
+ ? target.provider
386
+ : options.provider;
387
+ // Build the per-hop options: same-provider swaps only the model; a
388
+ // cross-provider hop also swaps provider/baseUrl/apiKey.
389
+ const hopOptions = target.crossProvider
390
+ ? {
391
+ ...options,
392
+ model: target.model,
393
+ provider: target.provider,
394
+ baseUrl: target.baseUrl,
395
+ apiKey: target.apiKey,
396
+ }
397
+ : { ...options, model: target.model };
302
398
  try {
303
- onFallback({
304
- from: lastTried,
305
- to: target.crossProvider
306
- ? `${target.provider}:${target.model}`
307
- : target.model,
308
- crossProvider: target.crossProvider,
309
- error: err?.message || String(err),
310
- });
311
- } catch {
312
- // Notification is best-effort — never mask the retry.
399
+ throwIfAborted(signal);
400
+ return await baseChatFn(messages, hopOptions);
401
+ } catch (nextErr) {
402
+ err = nextErr;
313
403
  }
314
404
  }
315
- lastTried = target.model;
316
- // Build the per-hop options: same-provider swaps only the model; a
317
- // cross-provider hop also swaps provider/baseUrl/apiKey.
318
- const hopOptions = target.crossProvider
319
- ? {
320
- ...options,
321
- model: target.model,
322
- provider: target.provider,
323
- baseUrl: target.baseUrl,
324
- apiKey: target.apiKey,
325
- }
326
- : { ...options, model: target.model };
327
- try {
328
- return await baseChatFn(messages, hopOptions);
329
- } catch (nextErr) {
330
- err = nextErr;
331
- }
405
+ throw err;
332
406
  }
333
- throw err;
407
+ };
408
+ if (canonical) {
409
+ CANONICAL_FALLBACKS.set(chatFn, {
410
+ ingress: boundIngress,
411
+ bind: createChatFn,
412
+ });
334
413
  }
335
- };
414
+ return chatFn;
415
+ }
416
+ return createChatFn(initialIngress);
336
417
  }
@@ -123,6 +123,7 @@ import { withQuietStdout } from "./quiet-stdout.js";
123
123
  import { captureAgentEvolutionIngress } from "../lib/evolution/agent-evolution-ingress.js";
124
124
  import { captureAgentSkillOutcomeIndex } from "../lib/evolution/agent-evolution-runtime-composition-brand.js";
125
125
  import { captureSkillVectorAuthority } from "../lib/skill-vector-authority.js";
126
+ import { captureSkillRetrievalRevocationReader } from "../lib/evolution/skill-retrieval-revocation-authority.js";
126
127
  import { CostBudget } from "../lib/cost-budget.js";
127
128
  import { estimateTokens } from "../harness/prompt-compressor.js";
128
129
  import {
@@ -669,6 +670,12 @@ async function runAgentHeadlessInWorkspace(
669
670
  options.skillVectorAuthority == null
670
671
  ? null
671
672
  : captureSkillVectorAuthority(options.skillVectorAuthority);
673
+ const skillRetrievalRevocationReader =
674
+ options.skillRetrievalRevocationReader == null
675
+ ? null
676
+ : captureSkillRetrievalRevocationReader(
677
+ options.skillRetrievalRevocationReader,
678
+ );
672
679
  if (
673
680
  evolutionIngress !== null &&
674
681
  skillOutcomeIndex !== null &&
@@ -687,6 +694,20 @@ async function runAgentHeadlessInWorkspace(
687
694
  ) {
688
695
  throw new TypeError("Agent retrieval authorities must share one tenant");
689
696
  }
697
+ if (
698
+ skillVectorAuthority !== null &&
699
+ skillRetrievalRevocationReader !== null &&
700
+ skillVectorAuthority.tenantId !== skillRetrievalRevocationReader.tenantId
701
+ ) {
702
+ throw new TypeError("Agent retrieval authorities must share one tenant");
703
+ }
704
+ if (
705
+ retrievalTenant !== null &&
706
+ skillRetrievalRevocationReader !== null &&
707
+ retrievalTenant !== skillRetrievalRevocationReader.tenantId
708
+ ) {
709
+ throw new TypeError("Agent retrieval authorities must share one tenant");
710
+ }
690
711
  const prompt = (options.prompt || "").trim();
691
712
  if (!prompt) {
692
713
  throw new Error(
@@ -1686,11 +1707,7 @@ async function runAgentHeadlessInWorkspace(
1686
1707
  }
1687
1708
  }
1688
1709
 
1689
- const budget = Number.isFinite(options.maxTurns)
1690
- ? new IterationBudget({
1691
- limit: Math.max(1, Math.floor(options.maxTurns)),
1692
- })
1693
- : new IterationBudget();
1710
+ const budget = IterationBudget.forRun({ maxTurns: options.maxTurns });
1694
1711
 
1695
1712
  // Effective system prompt: built-in base, optionally replaced by
1696
1713
  // --system-prompt and/or extended by --append-system-prompt.
@@ -2460,6 +2477,7 @@ async function runAgentHeadlessInWorkspace(
2460
2477
 
2461
2478
  const childToolExecs = new Map();
2462
2479
  const loopOptions = {
2480
+ ...(evolutionIngress === null ? {} : { evolutionIngress }),
2463
2481
  model,
2464
2482
  provider,
2465
2483
  recorder: _otlpRecorder,
@@ -2479,6 +2497,9 @@ async function runAgentHeadlessInWorkspace(
2479
2497
  skillLoader: _runtimeSkillLoader,
2480
2498
  ...(skillOutcomeIndex === null ? {} : { skillOutcomeIndex }),
2481
2499
  ...(skillVectorAuthority === null ? {} : { skillVectorAuthority }),
2500
+ ...(skillRetrievalRevocationReader === null
2501
+ ? {}
2502
+ : { skillRetrievalRevocationReader }),
2482
2503
  additionalDirectories,
2483
2504
  sandbox: options.sandbox || null,
2484
2505
  sessionId,
@@ -2813,7 +2834,7 @@ async function runAgentHeadlessInWorkspace(
2813
2834
  // True isolation level for tool subprocesses: os-sandbox (bwrap) /
2814
2835
  // container (docker) / policy-only (no sandbox — rules are pre-execution).
2815
2836
  isolation_level: isolationLevel(options.sandbox),
2816
- max_turns: budget.limit,
2837
+ max_turns: Number.isFinite(budget.limit) ? budget.limit : null,
2817
2838
  resumed_from: resumeId,
2818
2839
  history_messages: history.length,
2819
2840
  additional_directories: additionalDirectories,
@@ -2891,7 +2912,8 @@ async function runAgentHeadlessInWorkspace(
2891
2912
  `You are judging whether a coding session met a completion condition.\n` +
2892
2913
  `Condition: ${cond.text || cond.source}\n\n` +
2893
2914
  `Latest assistant output:\n${String(transcript.finalText || "").slice(0, 2000)}\n\n` +
2894
- `Reply with STRICT JSON only: {"met": true|false, "reason": "<short>"}.`;
2915
+ `Reply with STRICT JSON only, for example: {"met": false, "reason": "<short>"}. ` +
2916
+ `Set met to true only when the condition is satisfied; otherwise false.`;
2895
2917
  const r = await runMeteredDirectModelCall({
2896
2918
  sessionId: resolveHeadlessMeteredSessionId(persist, sessionId),
2897
2919
  persist: persist
@@ -2903,6 +2925,7 @@ async function runAgentHeadlessInWorkspace(
2903
2925
  sessionBudget: options.sessionBudget || null,
2904
2926
  call: () =>
2905
2927
  chatWithTools([{ role: "user", content: judgePrompt }], {
2928
+ ...(evolutionIngress === null ? {} : { evolutionIngress }),
2906
2929
  model,
2907
2930
  provider,
2908
2931
  baseUrl,
@@ -3544,6 +3567,13 @@ async function runAgentHeadlessInWorkspace(
3544
3567
  lastOutput: finalText,
3545
3568
  });
3546
3569
  } else {
3570
+ if (evolutionIngress !== null && deps.goalConditionJudge) {
3571
+ const error = new TypeError(
3572
+ "Evolution goal judging requires the canonical model transport",
3573
+ );
3574
+ error.code = "CC_AGENT_EVOLUTION_INGRESS_FAILED";
3575
+ throw error;
3576
+ }
3547
3577
  const judge = deps.goalConditionJudge || _defaultGoalJudge;
3548
3578
  evaluation = await judge(cond, {
3549
3579
  prompt: options.prompt,
@@ -3553,6 +3583,7 @@ async function runAgentHeadlessInWorkspace(
3553
3583
  }
3554
3584
  } catch (err) {
3555
3585
  if (err?.runtimeLedgerPersistence === true) throw err;
3586
+ if (err?.code === "CC_AGENT_EVOLUTION_INGRESS_FAILED") throw err;
3556
3587
  evaluation = {
3557
3588
  met: false,
3558
3589
  reason: `goal check failed: ${err.message}`,
@@ -3810,15 +3841,13 @@ async function runAgentHeadlessInWorkspace(
3810
3841
  // remains observable through onCleanupReport but must not replace it.
3811
3842
  if (loopFailureOutcome) return loopFailureOutcome;
3812
3843
  if (cleanupFailure) throw cleanupFailure;
3813
- if (evolutionIngress !== null) {
3814
- await evolutionIngress.complete();
3815
- }
3816
3844
 
3817
3845
  // A downstream consumer closed stdout/stderr. The abort above unwound the
3818
3846
  // model loop through the same `finally` as every other termination, so MCP,
3819
3847
  // background tasks, approval bridges, and hooks are settled. Do not attempt
3820
3848
  // more writes to the closed pipe or persist a partial assistant answer.
3821
3849
  if (pipeState.closed) {
3850
+ if (evolutionIngress !== null) await evolutionIngress.complete();
3822
3851
  return { exitCode: 0, result: finalText, isError: false };
3823
3852
  }
3824
3853
 
@@ -3878,6 +3907,16 @@ async function runAgentHeadlessInWorkspace(
3878
3907
  // terminal because reporting the extra paid call as successful is unsafe.
3879
3908
  if (options.goalAssess && boundGoalId && !isError) {
3880
3909
  try {
3910
+ if (
3911
+ evolutionIngress !== null &&
3912
+ (deps.assessChat || deps.assessGoalProgress)
3913
+ ) {
3914
+ const error = new TypeError(
3915
+ "Evolution goal assessment requires the canonical model transport and assessor",
3916
+ );
3917
+ error.code = "CC_AGENT_EVOLUTION_INGRESS_FAILED";
3918
+ throw error;
3919
+ }
3881
3920
  const { getGoal } = await import("../lib/goal-store.js");
3882
3921
  const goal = (deps.getGoal || getGoal)(boundGoalId);
3883
3922
  if (goal) {
@@ -3898,6 +3937,7 @@ async function runAgentHeadlessInWorkspace(
3898
3937
  sessionBudget: options.sessionBudget || null,
3899
3938
  call: () =>
3900
3939
  chatWithTools([{ role: "user", content: assessPrompt }], {
3940
+ ...(evolutionIngress === null ? {} : { evolutionIngress }),
3901
3941
  model,
3902
3942
  provider,
3903
3943
  baseUrl,
@@ -3940,10 +3980,14 @@ async function runAgentHeadlessInWorkspace(
3940
3980
  writeErr(`${RUNTIME_LEDGER_PERSISTENCE_FAILURE_MESSAGE}\n`);
3941
3981
  }
3942
3982
  }
3983
+ if (error?.code === "CC_AGENT_EVOLUTION_INGRESS_FAILED") throw error;
3943
3984
  // Non-ledger assessment failures remain best-effort.
3944
3985
  }
3945
3986
  }
3946
3987
 
3988
+ // The Run includes the final auxiliary assessment, not just the main loop.
3989
+ if (evolutionIngress !== null && !isError) await evolutionIngress.complete();
3990
+
3947
3991
  // End-of-run policy-denial summary so a non-interactive run surfaces what was
3948
3992
  // blocked (mirrors the REPL's `/permissions denials`). Text → stderr lines;
3949
3993
  // stream → a `denials_summary` event before the final result.
@@ -82,6 +82,7 @@ import {
82
82
  } from "../lib/evolution/agent-evolution-ingress.js";
83
83
  import { captureAgentSkillOutcomeIndex } from "../lib/evolution/agent-evolution-runtime-composition-brand.js";
84
84
  import { captureSkillVectorAuthority } from "../lib/skill-vector-authority.js";
85
+ import { captureSkillRetrievalRevocationReader } from "../lib/evolution/skill-retrieval-revocation-authority.js";
85
86
  import {
86
87
  resolveAgentMcp,
87
88
  resolvePermissionPromptTool,
@@ -1552,6 +1553,12 @@ async function runAgentHeadlessStreamInWorkspace(
1552
1553
  options.skillVectorAuthority == null
1553
1554
  ? null
1554
1555
  : captureSkillVectorAuthority(options.skillVectorAuthority);
1556
+ const skillRetrievalRevocationReader =
1557
+ options.skillRetrievalRevocationReader == null
1558
+ ? null
1559
+ : captureSkillRetrievalRevocationReader(
1560
+ options.skillRetrievalRevocationReader,
1561
+ );
1555
1562
  if (
1556
1563
  evolutionIngress !== null &&
1557
1564
  skillOutcomeIndex !== null &&
@@ -1570,6 +1577,20 @@ async function runAgentHeadlessStreamInWorkspace(
1570
1577
  ) {
1571
1578
  throw new TypeError("Agent retrieval authorities must share one tenant");
1572
1579
  }
1580
+ if (
1581
+ skillVectorAuthority !== null &&
1582
+ skillRetrievalRevocationReader !== null &&
1583
+ skillVectorAuthority.tenantId !== skillRetrievalRevocationReader.tenantId
1584
+ ) {
1585
+ throw new TypeError("Agent retrieval authorities must share one tenant");
1586
+ }
1587
+ if (
1588
+ retrievalTenant !== null &&
1589
+ skillRetrievalRevocationReader !== null &&
1590
+ retrievalTenant !== skillRetrievalRevocationReader.tenantId
1591
+ ) {
1592
+ throw new TypeError("Agent retrieval authorities must share one tenant");
1593
+ }
1573
1594
  const model = options.model || "qwen2.5:7b";
1574
1595
  const provider = options.provider || "ollama";
1575
1596
  const baseUrl = options.baseUrl || "http://localhost:11434";
@@ -3224,6 +3245,7 @@ async function runAgentHeadlessStreamInWorkspace(
3224
3245
  }
3225
3246
 
3226
3247
  const loopOptionsBase = {
3248
+ ...(evolutionIngress === null ? {} : { evolutionIngress }),
3227
3249
  model,
3228
3250
  provider,
3229
3251
  // Extended thinking (Anthropic; opt-in via --think/--ultrathink).
@@ -3236,6 +3258,9 @@ async function runAgentHeadlessStreamInWorkspace(
3236
3258
  additionalDirectories,
3237
3259
  ...(skillOutcomeIndex === null ? {} : { skillOutcomeIndex }),
3238
3260
  ...(skillVectorAuthority === null ? {} : { skillVectorAuthority }),
3261
+ ...(skillRetrievalRevocationReader === null
3262
+ ? {}
3263
+ : { skillRetrievalRevocationReader }),
3239
3264
  sessionId,
3240
3265
  sessionBudget: options.sessionBudget || null,
3241
3266
  hostResourceBudget,
@@ -3784,6 +3809,7 @@ async function runAgentHeadlessStreamInWorkspace(
3784
3809
  let compactionProviderStarted = false;
3785
3810
  try {
3786
3811
  const providerCompactionOptions = {
3812
+ ...(evolutionIngress === null ? {} : { evolutionIngress }),
3787
3813
  provider,
3788
3814
  model,
3789
3815
  baseUrl,
@@ -3898,6 +3924,10 @@ async function runAgentHeadlessStreamInWorkspace(
3898
3924
  } catch (error) {
3899
3925
  if (isAbortError(error) || options.signal?.aborted) throw error;
3900
3926
  if (error?.runtimeLedgerPersistence === true) throw error;
3927
+ if (error?.code === AGENT_EVOLUTION_INGRESS_FAILED_CODE) {
3928
+ evolutionIngressFailed = true;
3929
+ sawError = true;
3930
+ }
3901
3931
  if (compactionProviderStarted) {
3902
3932
  const event = {
3903
3933
  type: "model-usage-unknown",
@@ -3915,6 +3945,17 @@ async function runAgentHeadlessStreamInWorkspace(
3915
3945
  );
3916
3946
  }
3917
3947
  }
3948
+ if (error?.code === AGENT_EVOLUTION_INGRESS_FAILED_CODE) {
3949
+ emit({
3950
+ type: "result",
3951
+ subtype: "error_evolution_ingress",
3952
+ is_error: true,
3953
+ code: error.code,
3954
+ error: error.message,
3955
+ session_id: sessionId,
3956
+ });
3957
+ break;
3958
+ }
3918
3959
  emit({
3919
3960
  type: "compaction-degraded",
3920
3961
  reason: `compaction_failed:${String(error?.message || error).slice(0, 240)}`,
@@ -4284,12 +4325,15 @@ async function runAgentHeadlessStreamInWorkspace(
4284
4325
  });
4285
4326
  }
4286
4327
 
4287
- // Per-turn iteration budget so one turn can't starve the rest.
4288
- const budget = Number.isFinite(options.maxTurns)
4289
- ? new IterationBudget({
4290
- limit: Math.max(1, Math.floor(options.maxTurns)),
4291
- })
4292
- : new IterationBudget();
4328
+ // Interactive hosts support interruption and steering. Do not silently
4329
+ // stop long tasks at the unattended default of 50 model calls. Explicit
4330
+ // --max-turns / CC_ITERATION_BUDGET and cost/session caps still apply.
4331
+ const budget = IterationBudget.forRun({
4332
+ maxTurns: options.maxTurns,
4333
+ continuous:
4334
+ options.interactiveApprovals === true ||
4335
+ options.interactiveQuestions === true,
4336
+ });
4293
4337
 
4294
4338
  // Custom slash-command macro expansion per user event (Claude-Code parity:
4295
4339
  // a /name from .claude/commands runs in panel / stream mode too, not just
@@ -4580,6 +4624,9 @@ async function runAgentHeadlessStreamInWorkspace(
4580
4624
  onUsageSettlement: persistUsageEvent,
4581
4625
  onToolCallBoundary: persistChildToolBoundary,
4582
4626
  onToolCallSettlement: persistChildToolSettlement,
4627
+ // Keep the session heartbeat and protocol pumps live while a
4628
+ // foreground command such as a networked git push is still running.
4629
+ nonBlockingShell: true,
4583
4630
  // Resume-degenerate role merge for the first live model call only.
4584
4631
  mergeRoles: mergeRolesThisTurn,
4585
4632
  },
@@ -5,6 +5,7 @@ import {
5
5
  captureAgentSkillOutcomeIndex,
6
6
  } from "../lib/evolution/agent-evolution-runtime-composition-brand.js";
7
7
  import { captureSkillVectorAuthority } from "../lib/skill-vector-authority.js";
8
+ import { captureSkillRetrievalRevocationReader } from "../lib/evolution/skill-retrieval-revocation-authority.js";
8
9
  import {
9
10
  resolveAgentPolicy,
10
11
  resolveServerPolicy,
@@ -17,6 +18,7 @@ export function createAgentRuntimeFactory({
17
18
  evolutionComposition = null,
18
19
  skillOutcomeIndex = null,
19
20
  skillVectorAuthority = null,
21
+ skillRetrievalRevocationReader = null,
20
22
  } = {}) {
21
23
  const composition =
22
24
  evolutionComposition === null
@@ -35,6 +37,10 @@ export function createAgentRuntimeFactory({
35
37
  skillVectorAuthority === null
36
38
  ? null
37
39
  : captureSkillVectorAuthority(skillVectorAuthority);
40
+ const revocationReader =
41
+ skillRetrievalRevocationReader === null
42
+ ? null
43
+ : captureSkillRetrievalRevocationReader(skillRetrievalRevocationReader);
38
44
  if (
39
45
  composition !== null &&
40
46
  outcomeIndex !== null &&
@@ -58,13 +64,38 @@ export function createAgentRuntimeFactory({
58
64
  ) {
59
65
  throw new TypeError("Agent retrieval authorities must share one tenant");
60
66
  }
67
+ if (
68
+ vectorAuthority !== null &&
69
+ revocationReader !== null &&
70
+ vectorAuthority.tenantId !== revocationReader.tenantId
71
+ ) {
72
+ throw new TypeError("Agent retrieval authorities must share one tenant");
73
+ }
61
74
  if (vectorAuthority !== null && Object.hasOwn(deps, "skillVectorAuthority")) {
62
75
  throw new TypeError(
63
76
  "Skill vector authority must come from the production root only",
64
77
  );
65
78
  }
79
+ if (
80
+ retrievalTenant !== null &&
81
+ revocationReader !== null &&
82
+ retrievalTenant !== revocationReader.tenantId
83
+ ) {
84
+ throw new TypeError("Agent retrieval authorities must share one tenant");
85
+ }
86
+ if (
87
+ revocationReader !== null &&
88
+ Object.hasOwn(deps, "skillRetrievalRevocationReader")
89
+ ) {
90
+ throw new TypeError(
91
+ "Skill retrieval revocation reader must come from the production root only",
92
+ );
93
+ }
66
94
  const runtimeDeps =
67
- composition === null && outcomeIndex === null && vectorAuthority === null
95
+ composition === null &&
96
+ outcomeIndex === null &&
97
+ vectorAuthority === null &&
98
+ revocationReader === null
68
99
  ? deps
69
100
  : Object.freeze({
70
101
  ...deps,
@@ -75,9 +106,14 @@ export function createAgentRuntimeFactory({
75
106
  ...(vectorAuthority === null
76
107
  ? {}
77
108
  : { skillVectorAuthority: vectorAuthority }),
109
+ ...(revocationReader === null
110
+ ? {}
111
+ : { skillRetrievalRevocationReader: revocationReader }),
78
112
  });
79
113
  const serverDeps =
80
- outcomeIndex === null && vectorAuthority === null
114
+ outcomeIndex === null &&
115
+ vectorAuthority === null &&
116
+ revocationReader === null
81
117
  ? deps
82
118
  : Object.freeze({
83
119
  ...deps,
@@ -85,6 +121,9 @@ export function createAgentRuntimeFactory({
85
121
  ...(vectorAuthority === null
86
122
  ? {}
87
123
  : { skillVectorAuthority: vectorAuthority }),
124
+ ...(revocationReader === null
125
+ ? {}
126
+ : { skillRetrievalRevocationReader: revocationReader }),
88
127
  });
89
128
  return {
90
129
  createAgentRuntime(overrides = {}) {