@p4code/cli 0.8.24 → 0.8.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 (215) hide show
  1. package/dist/bin.mjs +1 -1
  2. package/dist/{binCli-DNod5652.mjs → binCli-DxnOvHXE.mjs} +610 -480
  3. package/dist/client/.vite/manifest.json +1316 -1316
  4. package/dist/client/assets/{AuthSurfaceShell-Wwq6fM9A.js → AuthSurfaceShell-CDrUzEa3.js} +2 -2
  5. package/dist/client/assets/{ChatGptUsageButton-8lmdyDiG.js → ChatGptUsageButton-DkUVOC7j.js} +2 -2
  6. package/dist/client/assets/{ChatMarkdown-Cd3yE4VU.js → ChatMarkdown-1bLgD-eb.js} +4 -4
  7. package/dist/client/assets/{CodexSetupSection.logic-oYzzgIWo.js → CodexSetupSection.logic-BGYo_Oa-.js} +2 -2
  8. package/dist/client/assets/{CommandBlock-ByCjpPww.js → CommandBlock-C1v99dbA.js} +2 -2
  9. package/dist/client/assets/{ComposerPromptEditor-4EkkS1N5.js → ComposerPromptEditor-C462LHSn.js} +4 -4
  10. package/dist/client/assets/{DevicePanel-DWlHQcLW.js → DevicePanel-DoPmTqL7.js} +2 -2
  11. package/dist/client/assets/{DeviceSetup-Dm9ZbkMC.js → DeviceSetup-D1v4OInd.js} +2 -2
  12. package/dist/client/assets/{DiffCommentAnnotation-Dx-VhoLU.js → DiffCommentAnnotation-ByLSJGCC.js} +2 -2
  13. package/dist/client/assets/{DiffFileTree-BgjyfH71.js → DiffFileTree-DmXODV6-.js} +2 -2
  14. package/dist/client/assets/{DiffPanel-tZN29mdM.js → DiffPanel-DKvM9n17.js} +2 -2
  15. package/dist/client/assets/{DiffWorkerPoolProvider-C_yNvh6o.js → DiffWorkerPoolProvider-31z0fGQ6.js} +2 -2
  16. package/dist/client/assets/{EmbeddedDesign-DDApp-WI.js → EmbeddedDesign-CJh4mXjr.js} +2 -2
  17. package/dist/client/assets/{FileDiff-B_422yEN.js → FileDiff-Cb7Q8DoF.js} +2 -2
  18. package/dist/client/assets/{FilePreviewPanel-B26lXYsA.js → FilePreviewPanel-CN68pCae.js} +2 -2
  19. package/dist/client/assets/{FoldedSettingsSection-TLqDB_1b.js → FoldedSettingsSection-TSMWCMo5.js} +2 -2
  20. package/dist/client/assets/{NoProjectsHero-Bx1X9Us-.js → NoProjectsHero-B5wdlXLT.js} +2 -2
  21. package/dist/client/assets/{P4ConnectAccountPages-BWvaLOY-.js → P4ConnectAccountPages-BNv1XOMs.js} +2 -2
  22. package/dist/client/assets/{P4ConnectSidebarSignIn-C8z-Gfq5.js → P4ConnectSidebarSignIn-BqW3vURC.js} +2 -2
  23. package/dist/client/assets/{PanelLayoutControls-C2deQDB2.js → PanelLayoutControls-CJ69MZ4v.js} +4 -4
  24. package/dist/client/assets/{PierreEntryIcon-Ddl-VPd4.js → PierreEntryIcon-BS77_eRn.js} +2 -2
  25. package/dist/client/assets/{PreviewPanel-8NDLwOfI.js → PreviewPanel-pImDpkWH.js} +2 -2
  26. package/dist/client/assets/{ProjectDefaultsSettings-DN1GxlYC.js → ProjectDefaultsSettings-DY_6-1vn.js} +2 -2
  27. package/dist/client/assets/{ProjectFavicon-BDaMxno-.js → ProjectFavicon-Bhsql8UU.js} +3 -3
  28. package/dist/client/assets/{ProjectIconPickerDialog-Be5IQyyr.js → ProjectIconPickerDialog-D1bu7Uyx.js} +2 -2
  29. package/dist/client/assets/{ProviderAuthTerminal-BFGd236-.js → ProviderAuthTerminal-BRbiaLWc.js} +2 -2
  30. package/dist/client/assets/{ProviderModelPicker-DMtMvBKn.js → ProviderModelPicker-DqLbhWdo.js} +2 -2
  31. package/dist/client/assets/{ProviderSettingsForm-D6u9dY73.js → ProviderSettingsForm-DLBbky90.js} +2 -2
  32. package/dist/client/assets/{PullRequestCodeTab-hXtKZAP9.js → PullRequestCodeTab-CKppy0OY.js} +2 -2
  33. package/dist/client/assets/{ReadOnlySourcePreview-CDLZaWo2.js → ReadOnlySourcePreview-BJ6Yf9Nm.js} +2 -2
  34. package/dist/client/assets/{RenderErrorBoundary-BkcvpgEh.js → RenderErrorBoundary-DQlXjNRV.js} +2 -2
  35. package/dist/client/assets/{ScheduledTasksSettings-BJyFxVyR.js → ScheduledTasksSettings-DY0ICix9.js} +2 -2
  36. package/dist/client/assets/{ScopedSwitch-yznbaSh9.js → ScopedSwitch-Ciu5HpYa.js} +2 -2
  37. package/dist/client/assets/{SettingsPanels-DdhZ2nXb.js → SettingsPanels-D8LJq_2u.js} +2 -2
  38. package/dist/client/assets/{SettingsPanels.logic-DIuWE5Xf.js → SettingsPanels.logic-Dn4swS42.js} +2 -2
  39. package/dist/client/assets/{SettingsScopeNotice-D8K81IzP.js → SettingsScopeNotice-FZ1p4m0I.js} +2 -2
  40. package/dist/client/assets/{ThemeEditorPanel-ePX4nwaV.js → ThemeEditorPanel-CyGAzSmS.js} +2 -2
  41. package/dist/client/assets/{ThreadTerminalDrawer-5z4y3z0y.js → ThreadTerminalDrawer-COPVkKqd.js} +2 -2
  42. package/dist/client/assets/{Virtualizer-DEM6HN7-.js → Virtualizer-Cy8TBFLE.js} +2 -2
  43. package/dist/client/assets/{_chat-C0vR23gu.js → _chat-CWIHenSN.js} +6 -6
  44. package/dist/client/assets/{_chat.design-CQ52N70I.js → _chat.design-CmJbkQbO.js} +2 -2
  45. package/dist/client/assets/{_chat.index-SFAYIX_P.js → _chat.index-6PXQMCFp.js} +2 -2
  46. package/dist/client/assets/{_chat.new-BO6oEisx.js → _chat.new-DlduiMxM.js} +2 -2
  47. package/dist/client/assets/{_chat.pull-requests-BfyCJw7Q.js → _chat.pull-requests-BVZO85Vs.js} +2 -2
  48. package/dist/client/assets/{abnfDiagram-VCTEODGH-DhiN6SMz.js → abnfDiagram-VCTEODGH-DoT8_FXH.js} +2 -2
  49. package/dist/client/assets/architecture-7GRP2DOG-ZioZXeD8.js +1 -0
  50. package/dist/client/assets/{architectureDiagram-5GKGNRK7-bs37U5FM.js → architectureDiagram-5GKGNRK7-HFFuwzkK.js} +2 -2
  51. package/dist/client/assets/{assets-BU-ex_t8.js → assets-v9gHTSJ2.js} +2 -2
  52. package/dist/client/assets/{blockDiagram-I7D4REHJ-Bz9mN89n.js → blockDiagram-I7D4REHJ-Df3TzjDM.js} +2 -2
  53. package/dist/client/assets/{browserHistoryStore-KDG9Uz1t.js → browserHistoryStore-DY3kofkL.js} +2 -2
  54. package/dist/client/assets/{browserLinkTarget-DmKK3HY0.js → browserLinkTarget-BHJMZNAn.js} +2 -2
  55. package/dist/client/assets/{c4Diagram-7LVT6UL2-CtkHQd_E.js → c4Diagram-7LVT6UL2-Bx6hu1pT.js} +2 -2
  56. package/dist/client/assets/channel-BY4Mhil-.js +2 -0
  57. package/dist/client/assets/{chunk-4HAMMTFA-BtUnQAH6.js → chunk-4HAMMTFA-DztP-PZY.js} +2 -2
  58. package/dist/client/assets/{chunk-75Z2AOVW-CwSe19lZ.js → chunk-75Z2AOVW-uoFI_96z.js} +2 -2
  59. package/dist/client/assets/{chunk-DU6HZSFF-Bwy7A0TF.js → chunk-DU6HZSFF-D_0nd_m5.js} +2 -2
  60. package/dist/client/assets/{chunk-F27PBJKO-CVsi2uk3.js → chunk-F27PBJKO-CVo5wWUL.js} +2 -2
  61. package/dist/client/assets/{chunk-GMAD6QVW-CVzXn5Hv.js → chunk-GMAD6QVW-DVJraU0z.js} +2 -2
  62. package/dist/client/assets/{chunk-GVQU2GXP-7pPJVhuz.js → chunk-GVQU2GXP-D1KDAS1u.js} +2 -2
  63. package/dist/client/assets/{chunk-IMKFNOWR-D-dmx49n.js → chunk-IMKFNOWR-B4iQ5Hh8.js} +2 -2
  64. package/dist/client/assets/{chunk-L3NEJ4N5-DEJnMXSk.js → chunk-L3NEJ4N5-Cg0GbrIO.js} +2 -2
  65. package/dist/client/assets/{chunk-OSK3NFVY-CBtNmbZ8.js → chunk-OSK3NFVY-B4_CzVzL.js} +2 -2
  66. package/dist/client/assets/{chunk-P2QGCYS3-TNHN3Sve.js → chunk-P2QGCYS3-DZOYqNgv.js} +2 -2
  67. package/dist/client/assets/{chunk-POPQ4Y6H-1cq1nl-Z.js → chunk-POPQ4Y6H-4nivFn8h.js} +2 -2
  68. package/dist/client/assets/{chunk-PWAF6VOD-B85KpsBk.js → chunk-PWAF6VOD-HbLsvJ11.js} +2 -2
  69. package/dist/client/assets/{chunk-SHT3W25Y-3tA2UDk1.js → chunk-SHT3W25Y-DFCZ-Krf.js} +2 -2
  70. package/dist/client/assets/{chunk-SVP7TREG-CHzBNDDY.js → chunk-SVP7TREG-BvQW-XJf.js} +2 -2
  71. package/dist/client/assets/{chunk-TICWLB2K-MeLbkhnz.js → chunk-TICWLB2K-BkfJ58tX.js} +2 -2
  72. package/dist/client/assets/classDiagram-ZZMXUADV-VEcRygcq.js +2 -0
  73. package/dist/client/assets/classDiagram-v2-VYDZK3BY-VEcRygcq.js +2 -0
  74. package/dist/client/assets/{composer-logic-DyIi6K9e.js → composer-logic-CwhwgR76.js} +2 -2
  75. package/dist/client/assets/{composerDraftUploads-BEFyD-t4.js → composerDraftUploads-DmqvTkwP.js} +2 -2
  76. package/dist/client/assets/{connect-BUAMGrjt.js → connect-DwVFJmN3.js} +2 -2
  77. package/dist/client/assets/{connect-agent-BNwEsc4t.js → connect-agent-DEQZN1JX.js} +2 -2
  78. package/dist/client/assets/{cynefin-OW5HDTMX-DTUXnTov.js → cynefin-OW5HDTMX-4JOEXKIi.js} +1 -1
  79. package/dist/client/assets/{cynefinDiagram-5FMLGOSQ-Cd9_EwZX.js → cynefinDiagram-5FMLGOSQ-Drs4oZCg.js} +2 -2
  80. package/dist/client/assets/{dagre-GXQ25YYZ-D0hUgab8.js → dagre-GXQ25YYZ-DKMbY0zs.js} +2 -2
  81. package/dist/client/assets/{design-DaqMSnWJ.js → design-CNu64Zbr.js} +2 -2
  82. package/dist/client/assets/{device-DnfWBPpo.js → device-BLFqXUPD.js} +2 -2
  83. package/dist/client/assets/{diagram-S7CK7UJ4-DY-wIVhL.js → diagram-S7CK7UJ4-BadxuMFL.js} +2 -2
  84. package/dist/client/assets/{diagram-UQ7AKVKN-CmWAx8wR.js → diagram-UQ7AKVKN-PnCAv0MQ.js} +2 -2
  85. package/dist/client/assets/{diagram-VSXAHHWV-DvIYORJP.js → diagram-VSXAHHWV-Cny8HiZ9.js} +2 -2
  86. package/dist/client/assets/{diagram-VX7I27RA-Dj3l0KCm.js → diagram-VX7I27RA-CRUGb_uz.js} +2 -2
  87. package/dist/client/assets/{diagram-Z3DM3KII-ClP8dtWB.js → diagram-Z3DM3KII-3me_mb7C.js} +2 -2
  88. package/dist/client/assets/{diffRendering-BWY0g219.js → diffRendering-D5-wCc8J.js} +2 -2
  89. package/dist/client/assets/{dist-C5JAYxip.js → dist-DJO3gX7B.js} +2 -2
  90. package/dist/client/assets/{duoViewer-fztyITHM.js → duoViewer-DLfl5Kz-.js} +2 -2
  91. package/dist/client/assets/{dynamic-CnYAeR9T.js → dynamic-BtC962Ss.js} +2 -2
  92. package/dist/client/assets/{ebnfDiagram-PWID7BFC-DtbBVfJO.js → ebnfDiagram-PWID7BFC-CihgSPXH.js} +2 -2
  93. package/dist/client/assets/{embeddedScripts-Bf2j7tmA.js → embeddedScripts-BYDwhk1c.js} +2 -2
  94. package/dist/client/assets/{entities-BJgMc8pv.js → entities-BmcX1OB3.js} +2 -2
  95. package/dist/client/assets/{erDiagram-RLTQ6QDP-Dm2mBAGp.js → erDiagram-RLTQ6QDP-F6qh1mx2.js} +2 -2
  96. package/dist/client/assets/eventmodeling-NTZA5JFV-CFX4D-ej.js +1 -0
  97. package/dist/client/assets/{fileLinks-C9oYzhXv.js → fileLinks-D6tZCcrX.js} +2 -2
  98. package/dist/client/assets/{fileTreeExpansion-CpkONCrM.js → fileTreeExpansion-XMXwSF13.js} +2 -2
  99. package/dist/client/assets/flowDiagram-HODETNUW-fTwgLjbL.js +1 -0
  100. package/dist/client/assets/{ganttDiagram-EL5Y4UJY-D4UHegQH.js → ganttDiagram-EL5Y4UJY-YGfup7SG.js} +2 -2
  101. package/dist/client/assets/{getDiffFileInput-BKRfCrth.js → getDiffFileInput-CaAoEF2q.js} +2 -2
  102. package/dist/client/assets/{gitGraph-4MIJSDKK-BUhEDO22.js → gitGraph-4MIJSDKK-lmNva9e6.js} +1 -1
  103. package/dist/client/assets/{gitGraphDiagram-WWUBYQGX-BwJT0OjN.js → gitGraphDiagram-WWUBYQGX-doYkHAhC.js} +2 -2
  104. package/dist/client/assets/{guideRunStore-DkBR0CPU.js → guideRunStore-DgsITXCn.js} +2 -2
  105. package/dist/client/assets/{index-BYQ1ybfT.js → index-CfFLhAIJ.js} +3 -3
  106. package/dist/client/assets/{info-A6RAGUB7-scwAD75p.js → info-A6RAGUB7-D_A6DQid.js} +1 -1
  107. package/dist/client/assets/{infoDiagram-27XIBGKW-BgR5Wn6l.js → infoDiagram-27XIBGKW-BRwXCKSf.js} +2 -2
  108. package/dist/client/assets/{ishikawaDiagram-5VMMS53U-BOnOvOet.js → ishikawaDiagram-5VMMS53U-C7LnJqXH.js} +2 -2
  109. package/dist/client/assets/{journeyDiagram-3NMN7TZE-B1wXWe62.js → journeyDiagram-3NMN7TZE-BzOGENTa.js} +2 -2
  110. package/dist/client/assets/{kanban-definition-UXKFOSKX-DI-FwQ_D.js → kanban-definition-UXKFOSKX-COHFjuBb.js} +2 -2
  111. package/dist/client/assets/{line-c6BqGnEH.js → line-CrPHt5m8.js} +2 -2
  112. package/dist/client/assets/{linkedPrompt-DjSidfRe.js → linkedPrompt-DcngDDYL.js} +2 -2
  113. package/dist/client/assets/{main-4dRVuXx2.js → main-DTxzRLjF.js} +7 -7
  114. package/dist/client/assets/{mediaReference-CWzBBNFa.js → mediaReference-DZXLlXcJ.js} +2 -2
  115. package/dist/client/assets/{mediaSource-CHfRwmOf.js → mediaSource-gPZdDlVt.js} +2 -2
  116. package/dist/client/assets/{mermaid-parser.core-DOOH_cP_.js → mermaid-parser.core-DWtiDQYU.js} +4 -4
  117. package/dist/client/assets/{mermaid.core-9Tao6ZdD.js → mermaid.core-BFUbfTlG.js} +5 -5
  118. package/dist/client/assets/{mindmap-definition-YA3MSWOX-CqmRXnVH.js → mindmap-definition-YA3MSWOX-DBtRzghf.js} +2 -2
  119. package/dist/client/assets/{onboarding-BmDFkmWD.js → onboarding-DrdqSiQH.js} +2 -2
  120. package/dist/client/assets/{openFileInPreview-DF_vZEIK.js → openFileInPreview-weURIMTS.js} +2 -2
  121. package/dist/client/assets/{p4ProjectFile-YfIRB1xP.js → p4ProjectFile-B8OhdeMF.js} +2 -2
  122. package/dist/client/assets/{packet-AYTQ26CC-B8LkZ5j3.js → packet-AYTQ26CC-DJZVK2K9.js} +1 -1
  123. package/dist/client/assets/{pair-DSE8uuft.js → pair-gR_rTadh.js} +2 -2
  124. package/dist/client/assets/{pegDiagram-XKGWAZYB-CS17GwTP.js → pegDiagram-XKGWAZYB-DDF_R7aG.js} +2 -2
  125. package/dist/client/assets/{phoneViewer-CYzqv5af.js → phoneViewer-DxQG2wwP.js} +2 -2
  126. package/dist/client/assets/{pie-WAS4IAKB-B0WBcNHW.js → pie-WAS4IAKB-DdceO1sC.js} +1 -1
  127. package/dist/client/assets/{pieDiagram-E7YTZNPT-Bk2IwUHp.js → pieDiagram-E7YTZNPT-BW2s3CyE.js} +2 -2
  128. package/dist/client/assets/{pierre-icons-CY4HbMoq.js → pierre-icons-CFlecESq.js} +2 -2
  129. package/dist/client/assets/{preview-B5v36DP8.js → preview-Dz5JGjMV.js} +2 -2
  130. package/dist/client/assets/{primary-BKQnuXrW.js → primary-CREvWUGh.js} +2 -2
  131. package/dist/client/assets/{primaryCloudLinkState-CJSCsrUH.js → primaryCloudLinkState-C-mUT5JX.js} +2 -2
  132. package/dist/client/assets/{projectFilesQueryState-DltGYM_H.js → projectFilesQueryState-Au75qUTL.js} +2 -2
  133. package/dist/client/assets/{projectScriptEditor-CZb_iNq3.js → projectScriptEditor-4NhfCuq1.js} +2 -2
  134. package/dist/client/assets/{providerSkills-Ct4SZ-mY.js → providerSkills-BmzuNl-9.js} +2 -2
  135. package/dist/client/assets/{pullRequestDetail.logic-COstpMB1.js → pullRequestDetail.logic-yPUei2ak.js} +2 -2
  136. package/dist/client/assets/{pullRequests-ClG7PJe0.js → pullRequests-BBLgbQTu.js} +2 -2
  137. package/dist/client/assets/{quadrantDiagram-AXDQQJYC-B0vWHjBG.js → quadrantDiagram-AXDQQJYC-Bf2672qf.js} +2 -2
  138. package/dist/client/assets/{queries-BWcz-n4a.js → queries-BJzayyNh.js} +2 -2
  139. package/dist/client/assets/{radar-RG4KPBEZ-DmYBXYPt.js → radar-RG4KPBEZ-BiG5ioV7.js} +1 -1
  140. package/dist/client/assets/{railroad-74A4TZTK-D-4grcyc.js → railroad-74A4TZTK-DiRzkVRF.js} +1 -1
  141. package/dist/client/assets/railroad-abnf-HS5TGJTU-CyBZRJjf.js +1 -0
  142. package/dist/client/assets/railroad-ebnf-LZEXJU2U-7jpgdtqn.js +1 -0
  143. package/dist/client/assets/railroad-peg-WCYAUIDC-Bhvv4cdb.js +1 -0
  144. package/dist/client/assets/{railroadDiagram-O6MQD6OU-C7n4Qist.js → railroadDiagram-O6MQD6OU-BschbLXV.js} +2 -2
  145. package/dist/client/assets/{renderScheduler-DrstEe4y.js → renderScheduler-BgjQdysj.js} +2 -2
  146. package/dist/client/assets/{requirementDiagram-BXWQKSXE-BYX3uen6.js → requirementDiagram-BXWQKSXE-DIHx2XKp.js} +2 -2
  147. package/dist/client/assets/{runtime-Cj24N7je.js → runtime-DPOrcghx.js} +3 -3
  148. package/dist/client/assets/{runtime-CArTL2GH.js → runtime-SBjACoAG.js} +2 -2
  149. package/dist/client/assets/{sankeyDiagram-P5KCCOFB-tAgp-_Ny.js → sankeyDiagram-P5KCCOFB-B37UMb9Z.js} +2 -2
  150. package/dist/client/assets/{scheduledTasksSettings.logic-zleH3iJ_.js → scheduledTasksSettings.logic-l7uZVAyW.js} +2 -2
  151. package/dist/client/assets/{sequenceDiagram-WJ2MYXX4-DlvnWAh_.js → sequenceDiagram-WJ2MYXX4-BWWC8joI.js} +2 -2
  152. package/dist/client/assets/{server-Vynm5NwP.js → server-BNs54wEo.js} +2 -2
  153. package/dist/client/assets/{session-DyiiEN5g.js → session-CFXzhAhI.js} +2 -2
  154. package/dist/client/assets/{session-logic-B8t9Dfk3.js → session-logic-Zk8ix8K9.js} +2 -2
  155. package/dist/client/assets/{settings-CjeBlT1I.js → settings-D8GZZ79P.js} +2 -2
  156. package/dist/client/assets/{settings.appearance-DUvYlE0y.js → settings.appearance-BGApKe_v.js} +2 -2
  157. package/dist/client/assets/settings.archived-QGKwBjUx.js +2 -0
  158. package/dist/client/assets/{settings.computer-use-S7DPGiAx.js → settings.computer-use-CeLystec.js} +2 -2
  159. package/dist/client/assets/{settings.connections-DJEqNVad.js → settings.connections-56mhuPd9.js} +2 -2
  160. package/dist/client/assets/{settings.data-controls-Bj1pQ5cL.js → settings.data-controls-D607JRzk.js} +2 -2
  161. package/dist/client/assets/{settings.decisions-BufUBcem.js → settings.decisions-C0aFb-Kn.js} +2 -2
  162. package/dist/client/assets/{settings.designs-bWCNQca4.js → settings.designs-DLcNkfmF.js} +2 -2
  163. package/dist/client/assets/{settings.diagnostics-Dx_NdxOm.js → settings.diagnostics-Bk9ZlqSV.js} +2 -2
  164. package/dist/client/assets/{settings.general-BQ6775Hi.js → settings.general-D8pNduE9.js} +2 -2
  165. package/dist/client/assets/{settings.integrations-CgxBXw6p.js → settings.integrations-CyPCeqvd.js} +2 -2
  166. package/dist/client/assets/{settings.keybindings-DrBH8mlK.js → settings.keybindings-B6cKpR8G.js} +2 -2
  167. package/dist/client/assets/{settings.open-source-licenses-B3CGE-JI.js → settings.open-source-licenses-Cdo94wbK.js} +2 -2
  168. package/dist/client/assets/{settings.plugins-BGUgmDOY.js → settings.plugins-B1SQQuJ1.js} +2 -2
  169. package/dist/client/assets/{settings.projects-BJ1cpGGM.js → settings.projects-HuCRzR1Z.js} +3 -3
  170. package/dist/client/assets/{settings.providers-D2I5mNzk.js → settings.providers-BsfVxPA5.js} +3 -3
  171. package/dist/client/assets/{settings.scheduled-tasks-D8hRaqp8.js → settings.scheduled-tasks-Chug6jlO.js} +2 -2
  172. package/dist/client/assets/{settings.snap-shot-C2X5_E0H.js → settings.snap-shot-Dvf_zwkG.js} +2 -2
  173. package/dist/client/assets/{settings.source-control-Dvac_5mZ.js → settings.source-control-twI2L8vl.js} +2 -2
  174. package/dist/client/assets/{settings.storage-1JdpL3lo.js → settings.storage-af4E8nEQ.js} +2 -2
  175. package/dist/client/assets/{settingsLayout-CuUCC6iL.js → settingsLayout-BloLque1.js} +2 -2
  176. package/dist/client/assets/{sidebarProjectGrouping-r5ezKRMx.js → sidebarProjectGrouping-DwnHgZqz.js} +2 -2
  177. package/dist/client/assets/{sourceControl-b1QZpCro.js → sourceControl-wI790oDs.js} +2 -2
  178. package/dist/client/assets/{sourceControlClients-DUvOeR-2.js → sourceControlClients-CKlG76Mu.js} +2 -2
  179. package/dist/client/assets/{stateDiagram-D77RDMKH-BOgNCEU1.js → stateDiagram-D77RDMKH-D8v7Nh9y.js} +2 -2
  180. package/dist/client/assets/stateDiagram-v2-MP3YSRHH-DymT6Xtk.js +2 -0
  181. package/dist/client/assets/{swimlanes-42K2YHIH-BZG7hJb7.js → swimlanes-42K2YHIH-8aPT3vMS.js} +2 -2
  182. package/dist/client/assets/swimlanesDiagram-VR7AAH4N-CjvsefHc.js +9 -0
  183. package/dist/client/assets/{terminalSessions-BHzkH7av.js → terminalSessions-BVJWTQ-r.js} +2 -2
  184. package/dist/client/assets/{timeline-definition-24CTP7MA-B5YiUA25.js → timeline-definition-24CTP7MA-qKze8CmD.js} +2 -2
  185. package/dist/client/assets/{toast-B3hjhWRf.js → toast-CfeQA1vM.js} +2 -2
  186. package/dist/client/assets/{treeView-Q6P3EWNA-Cb4H3xoG.js → treeView-Q6P3EWNA-DHv3H0LY.js} +1 -1
  187. package/dist/client/assets/{treemap-WGGIJYW6-BdpTgSX1.js → treemap-WGGIJYW6-B3OEzWME.js} +1 -1
  188. package/dist/client/assets/{uiStateStore-DoJ0IbwQ.js → uiStateStore-DBCETYy3.js} +2 -2
  189. package/dist/client/assets/{usage-C2lJ6qWL.js → usage-C4KIRe38.js} +2 -2
  190. package/dist/client/assets/{use-atom-command-D34CFqu3.js → use-atom-command-BCNOgemk.js} +2 -2
  191. package/dist/client/assets/{useHandleNewThread-DtUtwJAY.js → useHandleNewThread-B116cHue.js} +2 -2
  192. package/dist/client/assets/{useP4ConnectAuthPrompt-D4kHnZ3Q.js → useP4ConnectAuthPrompt-qVqxcT08.js} +2 -2
  193. package/dist/client/assets/{usePullRequestActions-BypvA9CK.js → usePullRequestActions-CdOseawP.js} +2 -2
  194. package/dist/client/assets/{useScopedModelAvailability-YXOv7_8D.js → useScopedModelAvailability-DL2tq_KI.js} +2 -2
  195. package/dist/client/assets/{useSettings-BcmuuiTp.js → useSettings-DkjziVJm.js} +2 -2
  196. package/dist/client/assets/{vcsRefInvalidation-hPKz3TmL.js → vcsRefInvalidation-BPBh7p3I.js} +2 -2
  197. package/dist/client/assets/{vennDiagram-4TSXK5OY-D4zvlwrY.js → vennDiagram-4TSXK5OY-Yh5vCDok.js} +2 -2
  198. package/dist/client/assets/{wardley-WFR3VGLG-Cscy0eBS.js → wardley-WFR3VGLG-BeDK7hdA.js} +1 -1
  199. package/dist/client/assets/{wardleyDiagram-VM6X3IG4-od5X9Ppf.js → wardleyDiagram-VM6X3IG4-BXdOv1zU.js} +2 -2
  200. package/dist/client/assets/{welcome-7UQgfS5x.js → welcome-wbx9XdLq.js} +2 -2
  201. package/dist/client/assets/{xychartDiagram-S5SC5T6Z-KWfWaW4I.js → xychartDiagram-S5SC5T6Z-mciO_D_V.js} +2 -2
  202. package/dist/client/index.html +1 -1
  203. package/package.json +1 -1
  204. package/dist/client/assets/architecture-7GRP2DOG-Yd6b7qRF.js +0 -1
  205. package/dist/client/assets/channel-DrCQqhMU.js +0 -2
  206. package/dist/client/assets/classDiagram-ZZMXUADV-MCjIu9oU.js +0 -2
  207. package/dist/client/assets/classDiagram-v2-VYDZK3BY-MCjIu9oU.js +0 -2
  208. package/dist/client/assets/eventmodeling-NTZA5JFV-rDo_pcJr.js +0 -1
  209. package/dist/client/assets/flowDiagram-HODETNUW-C55XBPww.js +0 -1
  210. package/dist/client/assets/railroad-abnf-HS5TGJTU-6H_zYY6R.js +0 -1
  211. package/dist/client/assets/railroad-ebnf-LZEXJU2U-DYahAqN_.js +0 -1
  212. package/dist/client/assets/railroad-peg-WCYAUIDC-CdcgHAXA.js +0 -1
  213. package/dist/client/assets/settings.archived-B5WGVqfk.js +0 -2
  214. package/dist/client/assets/stateDiagram-v2-MP3YSRHH-D00LPIWv.js +0 -2
  215. package/dist/client/assets/swimlanesDiagram-VR7AAH4N-vkEAWikD.js +0 -9
@@ -71186,7 +71186,7 @@ const writeFileStringAtomically = (input) => scoped(gen$1(function* () {
71186
71186
  }));
71187
71187
  //#endregion
71188
71188
  //#region package.json
71189
- var version$1 = "0.8.24";
71189
+ var version$1 = "0.8.25";
71190
71190
  //#endregion
71191
71191
  //#region ../../packages/shared/src/qrCode.ts
71192
71192
  var QrCode = class QrCode {
@@ -96922,6 +96922,8 @@ const makeGitVcsDriverCore = fn("makeGitVcsDriverCore")(function* () {
96922
96922
  ], { env });
96923
96923
  yield* executeGit("GitVcsDriver.readUnifiedWorkingTreeReviewDiff.addUntracked", cwd, [
96924
96924
  ...tempIndexConfig,
96925
+ "-c",
96926
+ "core.preloadIndex=false",
96925
96927
  "--literal-pathspecs",
96926
96928
  "add",
96927
96929
  "--intent-to-add",
@@ -97532,7 +97534,7 @@ const makeGitVcsDriverCore = fn("makeGitVcsDriverCore")(function* () {
97532
97534
  "config",
97533
97535
  `branch.${input.newRefName}.gh-merge-base`,
97534
97536
  baseBranch
97535
- ]);
97537
+ ]).pipe(catchTags({ GitCommandError: () => logWarning$1("worktree base-ref configuration failed; using base-branch fallback") }));
97536
97538
  }
97537
97539
  return { worktree: {
97538
97540
  path: worktreePath,
@@ -97922,10 +97924,47 @@ const classifyNonZeroExit = (command, stderr) => {
97922
97924
  return "command-failed";
97923
97925
  };
97924
97926
  const isTransientGitExit = (stderr) => /unable to create [^\n]*\.lock['"]?: file exists/i.test(stderr) || /(?:unable to stat|lstat\(|error: open\()[^\n]+: no such file or directory/i.test(stderr);
97927
+ const FULL_FSYNC_ARG = "core.fsyncMethod=fsync";
97928
+ const WRITEOUT_ONLY_FSYNC_ARG = "core.fsyncMethod=writeout-only";
97929
+ const canRetryFullFsync = (stderr) => /fsync error on [^\r\n]+: operation not supported\r?$/im.test(stderr) || /cannot update ref [^\r\n]+: couldn't write '[^\r\n]+\.lock'\r?$/im.test(stderr);
97925
97930
  const make$163 = gen$1(function* () {
97926
97931
  const processRunner = yield* ProcessRunner;
97932
+ const hostPlatform = yield* Platform;
97927
97933
  const vcsProcesses = yield* make$255(VCS_PROCESS_CONCURRENCY);
97928
97934
  const githubProcesses = yield* make$255(GITHUB_PROCESS_CONCURRENCY);
97935
+ const spawn = (input, baseError) => processRunner.run({
97936
+ command: input.command,
97937
+ args: input.args,
97938
+ cwd: input.cwd,
97939
+ ...input.spawnCwd !== void 0 ? { spawnCwd: input.spawnCwd } : {},
97940
+ ...input.stdin !== void 0 ? { stdin: input.stdin } : {},
97941
+ ...input.onStdoutChunk !== void 0 ? { onStdoutChunk: input.onStdoutChunk } : {},
97942
+ ...input.env !== void 0 ? { env: input.env } : {},
97943
+ timeout: input.timeoutMs ?? DEFAULT_TIMEOUT_MS$3,
97944
+ maxOutputBytes: input.maxOutputBytes ?? DEFAULT_MAX_OUTPUT_BYTES,
97945
+ outputMode: input.outputMode ?? "truncate",
97946
+ truncatedMarker: input.appendTruncationMarker ? OUTPUT_TRUNCATED_MARKER : "",
97947
+ timeoutBehavior: "error"
97948
+ }).pipe(mapError(valueTags({
97949
+ ProcessSpawnError: (error) => VcsProcessSpawnError.fromProcessSpawnError(baseError, error),
97950
+ ProcessOutputLimitError: (error) => new VcsProcessOutputLimitError({
97951
+ ...baseError,
97952
+ stream: error.stream,
97953
+ maxBytes: error.maxBytes,
97954
+ observedBytes: error.observedBytes
97955
+ }),
97956
+ ProcessTimeoutError: (error) => VcsProcessTimeoutError.fromProcessTimeoutError(baseError, error),
97957
+ ProcessStdinError: (error) => new VcsProcessStdinWriteError({
97958
+ ...baseError,
97959
+ stdinBytes: error.stdinBytes,
97960
+ cause: error.cause
97961
+ }),
97962
+ ProcessReadError: (error) => new VcsProcessOutputReadError({
97963
+ ...baseError,
97964
+ stream: error.stream,
97965
+ cause: error.cause
97966
+ })
97967
+ })));
97929
97968
  const runUnbounded = fn("VcsProcess.runUnbounded")(function* (input) {
97930
97969
  const baseError = {
97931
97970
  operation: input.operation,
@@ -97933,39 +97972,11 @@ const make$163 = gen$1(function* () {
97933
97972
  cwd: input.cwd,
97934
97973
  argumentCount: input.args.length
97935
97974
  };
97936
- const result = yield* processRunner.run({
97937
- command: input.command,
97938
- args: input.args,
97939
- cwd: input.cwd,
97940
- ...input.spawnCwd !== void 0 ? { spawnCwd: input.spawnCwd } : {},
97941
- ...input.stdin !== void 0 ? { stdin: input.stdin } : {},
97942
- ...input.onStdoutChunk !== void 0 ? { onStdoutChunk: input.onStdoutChunk } : {},
97943
- ...input.env !== void 0 ? { env: input.env } : {},
97944
- timeout: input.timeoutMs ?? DEFAULT_TIMEOUT_MS$3,
97945
- maxOutputBytes: input.maxOutputBytes ?? DEFAULT_MAX_OUTPUT_BYTES,
97946
- outputMode: input.outputMode ?? "truncate",
97947
- truncatedMarker: input.appendTruncationMarker ? OUTPUT_TRUNCATED_MARKER : "",
97948
- timeoutBehavior: "error"
97949
- }).pipe(mapError(valueTags({
97950
- ProcessSpawnError: (error) => VcsProcessSpawnError.fromProcessSpawnError(baseError, error),
97951
- ProcessOutputLimitError: (error) => new VcsProcessOutputLimitError({
97952
- ...baseError,
97953
- stream: error.stream,
97954
- maxBytes: error.maxBytes,
97955
- observedBytes: error.observedBytes
97956
- }),
97957
- ProcessTimeoutError: (error) => VcsProcessTimeoutError.fromProcessTimeoutError(baseError, error),
97958
- ProcessStdinError: (error) => new VcsProcessStdinWriteError({
97959
- ...baseError,
97960
- stdinBytes: error.stdinBytes,
97961
- cause: error.cause
97962
- }),
97963
- ProcessReadError: (error) => new VcsProcessOutputReadError({
97964
- ...baseError,
97965
- stream: error.stream,
97966
- cause: error.cause
97967
- })
97968
- })));
97975
+ let result = yield* spawn(input, baseError);
97976
+ if (hostPlatform === "darwin" && input.operation === "GitVcsDriver.checkpoints.captureCheckpoint" && !input.allowNonZeroExit && result.code !== null && result.code !== 0 && input.command === "git" && input.args.includes(FULL_FSYNC_ARG) && canRetryFullFsync(result.stderr)) result = yield* spawn({
97977
+ ...input,
97978
+ args: input.args.map((arg) => arg === FULL_FSYNC_ARG ? WRITEOUT_ONLY_FSYNC_ARG : arg)
97979
+ }, baseError);
97969
97980
  if (result.code === null) return yield* new VcsProcessMissingExitCodeError(baseError);
97970
97981
  if (!input.allowNonZeroExit && result.code !== 0) {
97971
97982
  const failureKind = classifyNonZeroExit(input.command, result.stderr);
@@ -134486,23 +134497,45 @@ function decodeTerminalOutputChunk(pending, encoded) {
134486
134497
  pendingOutputBytes: Uint8Array.from(bytes.subarray(completeEnd))
134487
134498
  };
134488
134499
  }
134489
- function truncateTerminalOutput(output) {
134490
- const bytes = Buffer.from(output, "utf8");
134491
- if (bytes.length <= MAX_ACP_TERMINAL_OUTPUT_BYTES) return output;
134492
- let start = bytes.length - MAX_ACP_TERMINAL_OUTPUT_BYTES;
134493
- while (start < bytes.length && (bytes[start] & 192) === 128) start += 1;
134494
- return bytes.subarray(start).toString("utf8");
134500
+ /**
134501
+ * Appends decoded text to terminal output and keeps the newest
134502
+ * `MAX_ACP_TERMINAL_OUTPUT_BYTES`, dropping whole leading characters. Only the
134503
+ * appended text and the dropped prefix are measured, so per-chunk cost does not
134504
+ * grow with the retained output.
134505
+ */
134506
+ function appendTerminalOutput(output, outputBytes, text) {
134507
+ const combined = `${output}${text}`;
134508
+ const combinedBytes = outputBytes + Buffer.byteLength(text, "utf8");
134509
+ const excess = combinedBytes - MAX_ACP_TERMINAL_OUTPUT_BYTES;
134510
+ if (excess <= 0) return {
134511
+ output: combined,
134512
+ outputBytes: combinedBytes
134513
+ };
134514
+ let start = 0;
134515
+ let dropped = 0;
134516
+ while (dropped < excess) {
134517
+ const codePoint = combined.codePointAt(start);
134518
+ dropped += codePoint < 128 ? 1 : codePoint < 2048 ? 2 : codePoint < 65536 ? 3 : 4;
134519
+ start += codePoint < 65536 ? 1 : 2;
134520
+ }
134521
+ return {
134522
+ output: combined.slice(start),
134523
+ outputBytes: combinedBytes - dropped
134524
+ };
134495
134525
  }
134496
134526
  /** Applies an ACP v2 agent-owned terminal snapshot or chunk to display state. */
134497
134527
  function applyAcpAgentTerminalUpdate(previous, update) {
134498
- const current = previous ?? { output: "" };
134528
+ const current = previous ?? {
134529
+ output: "",
134530
+ outputBytes: 0
134531
+ };
134499
134532
  if (update.sessionUpdate === "terminal_output_chunk") {
134500
134533
  const decoded = decodeTerminalOutputChunk(current.pendingOutputBytes, update.data);
134501
134534
  if (decoded === void 0) return current;
134502
134535
  const { pendingOutputBytes: _pendingOutputBytes, ...withoutPendingOutputBytes } = current;
134503
134536
  return {
134504
134537
  ...withoutPendingOutputBytes,
134505
- output: truncateTerminalOutput(`${current.output}${decoded.text}`),
134538
+ ...appendTerminalOutput(current.output, current.outputBytes, decoded.text),
134506
134539
  ...decoded.pendingOutputBytes === void 0 ? {} : { pendingOutputBytes: decoded.pendingOutputBytes }
134507
134540
  };
134508
134541
  }
@@ -134527,7 +134560,7 @@ function applyAcpAgentTerminalUpdate(previous, update) {
134527
134560
  const { pendingOutputBytes: _pendingOutputBytes, ...withoutPendingOutputBytes } = next;
134528
134561
  next = {
134529
134562
  ...withoutPendingOutputBytes,
134530
- output: truncateTerminalOutput(decoded.text),
134563
+ ...appendTerminalOutput("", 0, decoded.text),
134531
134564
  ...decoded.pendingOutputBytes === void 0 ? {} : { pendingOutputBytes: decoded.pendingOutputBytes }
134532
134565
  };
134533
134566
  }
@@ -134540,7 +134573,7 @@ function applyAcpAgentTerminalUpdate(previous, update) {
134540
134573
  const { pendingOutputBytes: _pendingOutputBytes, ...withoutPendingOutputBytes } = next;
134541
134574
  next = {
134542
134575
  ...withoutPendingOutputBytes,
134543
- output: truncateTerminalOutput(`${next.output}${pendingText}`),
134576
+ ...appendTerminalOutput(next.output, next.outputBytes, pendingText),
134544
134577
  exitStatus: update.exitStatus
134545
134578
  };
134546
134579
  }
@@ -141950,6 +141983,14 @@ const ACP_PROTOCOL = "acp.ndjson-jsonrpc";
141950
141983
  * wake. Longer floors (4–20s) only prolonged Working. No per-model carveouts.
141951
141984
  */
141952
141985
  const ACP_DEFERRED_FINALIZE_DEBOUNCE = "3000 millis";
141986
+ /**
141987
+ * Coalescing window for streamed text. A text segment's first chunk and its
141988
+ * close emit at once; a later chunk schedules one full-text snapshot this long
141989
+ * after it, and the chunks inside the window share it instead of each emitting
141990
+ * the whole reply, which grew with the square of the reply length. The flush
141991
+ * is scheduled, not a hard deadline, so it can land later under host load.
141992
+ */
141993
+ const ACP_TEXT_FLUSH_INTERVAL = "50 millis";
141953
141994
  /** Whether image attachment blocks may be included in session/prompt. */
141954
141995
  function acpSupportsImagePrompts(input) {
141955
141996
  return input.flavorSupportsImagePrompts === true || input.negotiatedImage === true;
@@ -143034,7 +143075,7 @@ const makeAcpAdapterV2 = fn("makeAcpAdapterV2")(function* (options) {
143034
143075
  markdown,
143035
143076
  planId
143036
143077
  });
143037
- const now$135 = yield* now;
143078
+ const now$138 = yield* now;
143038
143079
  const nodeId = idAllocator.derive.nodeFromProviderItem({
143039
143080
  driver,
143040
143081
  nativeItemId
@@ -143067,7 +143108,7 @@ const makeAcpAdapterV2 = fn("makeAcpAdapterV2")(function* (options) {
143067
143108
  runtimeRequestId: null,
143068
143109
  checkpointScopeId: null,
143069
143110
  startedAt: context.startedAt,
143070
- completedAt: now$135
143111
+ completedAt: now$138
143071
143112
  }
143072
143113
  });
143073
143114
  yield* emitProviderEvent({
@@ -143099,8 +143140,8 @@ const makeAcpAdapterV2 = fn("makeAcpAdapterV2")(function* (options) {
143099
143140
  status: "completed",
143100
143141
  title: null,
143101
143142
  startedAt: context.startedAt,
143102
- completedAt: now$135,
143103
- updatedAt: now$135,
143143
+ completedAt: now$138,
143144
+ updatedAt: now$138,
143104
143145
  type: "proposed_plan",
143105
143146
  planId,
143106
143147
  markdown,
@@ -143125,10 +143166,22 @@ const makeAcpAdapterV2 = fn("makeAcpAdapterV2")(function* (options) {
143125
143166
  };
143126
143167
  });
143127
143168
  const textStreamFor = (context, kind) => kind === "user" ? context.user : kind === "assistant" ? context.assistant : context.reasoning;
143128
- const emitTextSegment = fnUntraced(function* (context, kind, completed) {
143169
+ const textEmissionPermit = yield* make$255(1);
143170
+ /**
143171
+ * Emits the stream's current segment. A `flushOf` call is a delayed
143172
+ * flush: it emits only while that segment is still current and has
143173
+ * unsent text. The permit keeps a flush from landing after the
143174
+ * segment's completed snapshot.
143175
+ */
143176
+ const emitTextSegment = fnUntraced(function* (context, kind, completed, flushOf) {
143129
143177
  const segment = textStreamFor(context, kind).current;
143130
143178
  if (segment === null) return;
143131
- const now$123 = yield* now;
143179
+ if (flushOf !== void 0 && (segment !== flushOf || !segment.dirty)) return;
143180
+ const emitsNode = completed || !segment.emitted;
143181
+ segment.emitted = true;
143182
+ segment.dirty = false;
143183
+ const text = segment.text;
143184
+ const now$132 = yield* now;
143132
143185
  const ordinal = yield* resolveItemOrdinal(context, segment.nativeItemId);
143133
143186
  const nodeId = providerNodeId(segment.nativeItemId);
143134
143187
  const turnItemId = providerTurnItemId(segment.nativeItemId);
@@ -143137,7 +143190,7 @@ const makeAcpAdapterV2 = fn("makeAcpAdapterV2")(function* (options) {
143137
143190
  nativeId: segment.nativeItemId,
143138
143191
  strength: "weak"
143139
143192
  };
143140
- if (kind !== "user") yield* emitProviderEvent({
143193
+ if (kind !== "user" && emitsNode) yield* emitProviderEvent({
143141
143194
  type: "node.updated",
143142
143195
  driver,
143143
143196
  node: {
@@ -143155,7 +143208,7 @@ const makeAcpAdapterV2 = fn("makeAcpAdapterV2")(function* (options) {
143155
143208
  runtimeRequestId: null,
143156
143209
  checkpointScopeId: null,
143157
143210
  startedAt: segment.startedAt,
143158
- completedAt: completed ? now$123 : null
143211
+ completedAt: completed ? now$132 : null
143159
143212
  }
143160
143213
  });
143161
143214
  if (kind !== "reasoning") {
@@ -143169,11 +143222,11 @@ const makeAcpAdapterV2 = fn("makeAcpAdapterV2")(function* (options) {
143169
143222
  runId: context.input.runId,
143170
143223
  nodeId: messageNodeId,
143171
143224
  role: kind,
143172
- text: segment.text,
143225
+ text,
143173
143226
  attachments: [],
143174
143227
  streaming: !completed,
143175
143228
  createdAt: segment.startedAt,
143176
- updatedAt: now$123
143229
+ updatedAt: now$132
143177
143230
  };
143178
143231
  yield* emitProviderEvent({
143179
143232
  type: "message.updated",
@@ -143198,12 +143251,12 @@ const makeAcpAdapterV2 = fn("makeAcpAdapterV2")(function* (options) {
143198
143251
  status: completed ? "completed" : "running",
143199
143252
  title: null,
143200
143253
  startedAt: segment.startedAt,
143201
- completedAt: completed ? now$123 : null,
143202
- updatedAt: now$123,
143254
+ completedAt: completed ? now$132 : null,
143255
+ updatedAt: now$132,
143203
143256
  type: "user_message",
143204
143257
  messageId,
143205
143258
  inputIntent: "turn_start",
143206
- text: segment.text,
143259
+ text,
143207
143260
  attachments: []
143208
143261
  }
143209
143262
  } : {
@@ -143222,11 +143275,11 @@ const makeAcpAdapterV2 = fn("makeAcpAdapterV2")(function* (options) {
143222
143275
  status: completed ? "completed" : "running",
143223
143276
  title: null,
143224
143277
  startedAt: segment.startedAt,
143225
- completedAt: completed ? now$123 : null,
143226
- updatedAt: now$123,
143278
+ completedAt: completed ? now$132 : null,
143279
+ updatedAt: now$132,
143227
143280
  type: "assistant_message",
143228
143281
  messageId,
143229
- text: segment.text,
143282
+ text,
143230
143283
  streaming: !completed
143231
143284
  }
143232
143285
  });
@@ -143249,13 +143302,27 @@ const makeAcpAdapterV2 = fn("makeAcpAdapterV2")(function* (options) {
143249
143302
  status: completed ? "completed" : "running",
143250
143303
  title: null,
143251
143304
  startedAt: segment.startedAt,
143252
- completedAt: completed ? now$123 : null,
143253
- updatedAt: now$123,
143305
+ completedAt: completed ? now$132 : null,
143306
+ updatedAt: now$132,
143254
143307
  type: "reasoning",
143255
- text: segment.text,
143308
+ text,
143256
143309
  streaming: !completed
143257
143310
  }
143258
143311
  });
143312
+ }, textEmissionPermit.withPermit);
143313
+ /**
143314
+ * Publishes a text change. A segment's first text emits at once so
143315
+ * live output starts immediately; later changes coalesce into one
143316
+ * snapshot per ACP_TEXT_FLUSH_INTERVAL. Closing the segment emits its
143317
+ * final text and makes a pending flush a no-op.
143318
+ */
143319
+ const publishTextSegment = fnUntraced(function* (context, kind) {
143320
+ const segment = textStreamFor(context, kind).current;
143321
+ if (segment === null) return;
143322
+ if (!segment.emitted) return yield* emitTextSegment(context, kind, false);
143323
+ if (segment.dirty) return;
143324
+ segment.dirty = true;
143325
+ yield* emitTextSegment(context, kind, false, segment).pipe(delay(ACP_TEXT_FLUSH_INTERVAL), forkIn(sessionScope));
143259
143326
  });
143260
143327
  const closeTextStream = fnUntraced(function* (context, kind) {
143261
143328
  const stream = textStreamFor(context, kind);
@@ -143279,17 +143346,19 @@ const makeAcpAdapterV2 = fn("makeAcpAdapterV2")(function* (options) {
143279
143346
  const sourceMessageId = messageId?.trim() || null;
143280
143347
  if (stream.current !== null && sourceMessageId !== null && stream.current.sourceMessageId !== null && stream.current.sourceMessageId !== sourceMessageId) yield* closeTextStream(context, kind);
143281
143348
  if (stream.current === null) {
143282
- const now$127 = yield* now;
143349
+ const now$135 = yield* now;
143283
143350
  stream.current = {
143284
143351
  nativeItemId: sourceMessageId === null ? `${context.nativeTurnId}:${kind}:${stream.nextSegment}` : `${context.nativeTurnId}:${kind}:message:${sourceMessageId}`,
143285
- startedAt: now$127,
143352
+ startedAt: now$135,
143286
143353
  sourceMessageId,
143287
- text: ""
143354
+ text: "",
143355
+ emitted: false,
143356
+ dirty: false
143288
143357
  };
143289
143358
  stream.nextSegment += 1;
143290
143359
  } else if (stream.current.sourceMessageId === null && sourceMessageId !== null) stream.current.sourceMessageId = sourceMessageId;
143291
143360
  stream.current.text += text;
143292
- yield* emitTextSegment(context, kind, false);
143361
+ yield* publishTextSegment(context, kind);
143293
143362
  });
143294
143363
  const replaceText = fnUntraced(function* (context, kind, text, messageId) {
143295
143364
  for (const other of [
@@ -143300,16 +143369,18 @@ const makeAcpAdapterV2 = fn("makeAcpAdapterV2")(function* (options) {
143300
143369
  const stream = textStreamFor(context, kind);
143301
143370
  if (stream.current?.sourceMessageId !== messageId) {
143302
143371
  yield* closeTextStream(context, kind);
143303
- const now$125 = yield* now;
143372
+ const now$126 = yield* now;
143304
143373
  stream.current = {
143305
143374
  nativeItemId: `${context.nativeTurnId}:${kind}:message:${messageId}`,
143306
- startedAt: now$125,
143375
+ startedAt: now$126,
143307
143376
  sourceMessageId: messageId,
143308
- text
143377
+ text,
143378
+ emitted: false,
143379
+ dirty: false
143309
143380
  };
143310
143381
  stream.nextSegment += 1;
143311
143382
  } else stream.current.text = text;
143312
- yield* emitTextSegment(context, kind, false);
143383
+ yield* publishTextSegment(context, kind);
143313
143384
  });
143314
143385
  const emitSubagentAssistant = fnUntraced(function* (subagent, text, mode = "append", messageId) {
143315
143386
  if (text.length === 0 && mode === "append") return;
@@ -143318,7 +143389,7 @@ const makeAcpAdapterV2 = fn("makeAcpAdapterV2")(function* (options) {
143318
143389
  const messageText = mode === "replace" ? text : `${previous}${text}`;
143319
143390
  subagent.assistantMessages.set(nativeItemId, messageText);
143320
143391
  subagent.assistantText = messageText;
143321
- const now$124 = yield* now;
143392
+ const now$118 = yield* now;
143322
143393
  const ordinal = resolveSubagentChildOrdinal(subagent, nativeItemId);
143323
143394
  const artifacts = makeSubagentConversationArtifacts({
143324
143395
  messageId: providerMessageId(nativeItemId),
@@ -143335,7 +143406,7 @@ const makeAcpAdapterV2 = fn("makeAcpAdapterV2")(function* (options) {
143335
143406
  role: "assistant",
143336
143407
  text: subagent.assistantText,
143337
143408
  ordinal,
143338
- now: now$124
143409
+ now: now$118
143339
143410
  });
143340
143411
  yield* emitProviderEvent({
143341
143412
  type: "message.updated",
@@ -143370,7 +143441,7 @@ const makeAcpAdapterV2 = fn("makeAcpAdapterV2")(function* (options) {
143370
143441
  if (existing === void 0) {
143371
143442
  if (update.prompt === "" && update.title === null || update.suppressNormalTool === false) return;
143372
143443
  }
143373
- const now$128 = yield* now;
143444
+ const now$120 = yield* now;
143374
143445
  const nativeTaskId = existing?.task.nativeTaskRef?.nativeId ?? update.nativeTaskId;
143375
143446
  const nativeItemRef = {
143376
143447
  driver,
@@ -143403,13 +143474,13 @@ const makeAcpAdapterV2 = fn("makeAcpAdapterV2")(function* (options) {
143403
143474
  prompt: update.prompt,
143404
143475
  title: update.title,
143405
143476
  result: null,
143406
- startedAt: now$128
143477
+ startedAt: now$120
143407
143478
  },
143408
143479
  model: update.model?.trim() || existing?.task.model || null,
143409
143480
  status: taskStatus,
143410
143481
  result: update.result ?? existing?.task.result ?? null,
143411
- completedAt: acpSubagentStatusIsTerminal(taskStatus) ? now$128 : null,
143412
- updatedAt: now$128
143482
+ completedAt: acpSubagentStatusIsTerminal(taskStatus) ? now$120 : null,
143483
+ updatedAt: now$120
143413
143484
  };
143414
143485
  const subagent = existing ?? {
143415
143486
  task,
@@ -143448,7 +143519,7 @@ const makeAcpAdapterV2 = fn("makeAcpAdapterV2")(function* (options) {
143448
143519
  prompt: update.prompt,
143449
143520
  ordinal: context.subagents.size
143450
143521
  }),
143451
- now: now$128,
143522
+ now: now$120,
143452
143523
  createdBy: "agent",
143453
143524
  creationSource: "provider"
143454
143525
  })
@@ -143470,7 +143541,7 @@ const makeAcpAdapterV2 = fn("makeAcpAdapterV2")(function* (options) {
143470
143541
  role: "user",
143471
143542
  text: update.prompt,
143472
143543
  ordinal: 100,
143473
- now: now$128
143544
+ now: now$120
143474
143545
  });
143475
143546
  yield* emitProviderEvent({
143476
143547
  type: "message.updated",
@@ -143499,7 +143570,7 @@ const makeAcpAdapterV2 = fn("makeAcpAdapterV2")(function* (options) {
143499
143570
  providerThreadId: context.input.providerThread.id,
143500
143571
  providerTurnId: context.providerTurnId
143501
143572
  },
143502
- now: now$128
143573
+ now: now$120
143503
143574
  });
143504
143575
  subagent.task = {
143505
143576
  ...subagent.task,
@@ -143527,8 +143598,8 @@ const makeAcpAdapterV2 = fn("makeAcpAdapterV2")(function* (options) {
143527
143598
  ...subagent.task,
143528
143599
  status: taskStatus,
143529
143600
  result,
143530
- completedAt: acpSubagentStatusIsTerminal(taskStatus) ? now$128 : null,
143531
- updatedAt: now$128
143601
+ completedAt: acpSubagentStatusIsTerminal(taskStatus) ? now$120 : null,
143602
+ updatedAt: now$120
143532
143603
  };
143533
143604
  const providerThreadId = subagent.task.providerThreadId;
143534
143605
  yield* emitProviderEvent({
@@ -143595,7 +143666,7 @@ const makeAcpAdapterV2 = fn("makeAcpAdapterV2")(function* (options) {
143595
143666
  title: subagent.task.title,
143596
143667
  startedAt: subagent.task.startedAt,
143597
143668
  completedAt: subagent.task.completedAt,
143598
- updatedAt: now$128,
143669
+ updatedAt: now$120,
143599
143670
  type: "subagent",
143600
143671
  subagentId: subagent.task.id,
143601
143672
  origin: "provider_native",
@@ -143756,7 +143827,7 @@ const makeAcpAdapterV2 = fn("makeAcpAdapterV2")(function* (options) {
143756
143827
  return;
143757
143828
  }
143758
143829
  const status = projectedStatus ?? toolStatus$1(toolCall.status);
143759
- const now$134 = yield* now;
143830
+ const now$127 = yield* now;
143760
143831
  const nativeItemId = `${context.nativeThreadId}:tool:${toolCall.toolCallId}`;
143761
143832
  const ordinal = yield* resolveItemOrdinal(context, nativeItemId);
143762
143833
  const nodeId = providerNodeId(nativeItemId);
@@ -143766,9 +143837,9 @@ const makeAcpAdapterV2 = fn("makeAcpAdapterV2")(function* (options) {
143766
143837
  nativeId: toolCall.toolCallId,
143767
143838
  strength: "strong"
143768
143839
  };
143769
- const startedAt = context.toolStartedAt.get(toolCall.toolCallId) ?? now$134;
143840
+ const startedAt = context.toolStartedAt.get(toolCall.toolCallId) ?? now$127;
143770
143841
  context.toolStartedAt.set(toolCall.toolCallId, startedAt);
143771
- const completedAt = completedAtForStatus(status, now$134);
143842
+ const completedAt = completedAtForStatus(status, now$127);
143772
143843
  const title = toolCall.title ?? null;
143773
143844
  yield* emitProviderEvent({
143774
143845
  type: "node.updated",
@@ -143805,7 +143876,7 @@ const makeAcpAdapterV2 = fn("makeAcpAdapterV2")(function* (options) {
143805
143876
  title,
143806
143877
  startedAt,
143807
143878
  completedAt,
143808
- updatedAt: now$134
143879
+ updatedAt: now$127
143809
143880
  };
143810
143881
  const rawInput = toolCall.data.rawInput;
143811
143882
  const rawOutput = toolCall.data.rawOutput ?? toolCall.data.content;
@@ -143977,7 +144048,7 @@ const makeAcpAdapterV2 = fn("makeAcpAdapterV2")(function* (options) {
143977
144048
  if (update.kind === "removed" && existing === void 0) return;
143978
144049
  const nativeItemId = `${context.nativeTurnId}:plan:${encodeURIComponent(update.nativePlanId)}`;
143979
144050
  const ordinal = yield* resolveItemOrdinal(context, nativeItemId);
143980
- const now$133 = yield* now;
144051
+ const now$125 = yield* now;
143981
144052
  const nodeId = providerNodeId(nativeItemId);
143982
144053
  const turnItemId = providerTurnItemId(nativeItemId);
143983
144054
  const planState = existing ?? {
@@ -143986,7 +144057,7 @@ const makeAcpAdapterV2 = fn("makeAcpAdapterV2")(function* (options) {
143986
144057
  runId: context.input.runId,
143987
144058
  driver
143988
144059
  }),
143989
- startedAt: now$133,
144060
+ startedAt: now$125,
143990
144061
  latest: null
143991
144062
  };
143992
144063
  const planId = planState.id;
@@ -144053,7 +144124,7 @@ const makeAcpAdapterV2 = fn("makeAcpAdapterV2")(function* (options) {
144053
144124
  runtimeRequestId: null,
144054
144125
  checkpointScopeId: null,
144055
144126
  startedAt: planState.startedAt,
144056
- completedAt: completed ? now$133 : null
144127
+ completedAt: completed ? now$125 : null
144057
144128
  }
144058
144129
  });
144059
144130
  yield* emitProviderEvent({
@@ -144077,8 +144148,8 @@ const makeAcpAdapterV2 = fn("makeAcpAdapterV2")(function* (options) {
144077
144148
  status: completed ? "completed" : "running",
144078
144149
  title: null,
144079
144150
  startedAt: planState.startedAt,
144080
- completedAt: completed ? now$133 : null,
144081
- updatedAt: now$133,
144151
+ completedAt: completed ? now$125 : null,
144152
+ updatedAt: now$125,
144082
144153
  ...plan.kind === "todo_list" ? {
144083
144154
  type: "todo_list",
144084
144155
  planId,
@@ -144095,7 +144166,7 @@ const makeAcpAdapterV2 = fn("makeAcpAdapterV2")(function* (options) {
144095
144166
  });
144096
144167
  const appendLoadedHistory = (notification, role, text, replace = false) => gen$1(function* () {
144097
144168
  if (text.length === 0 && !replace) return;
144098
- const now$130 = yield* now;
144169
+ const now$123 = yield* now;
144099
144170
  yield* update$4(snapshot, (current) => {
144100
144171
  const update = notification.update;
144101
144172
  const sourceMessageId = (update.sessionUpdate === "user_message_chunk" || update.sessionUpdate === "agent_message_chunk" || update.sessionUpdate === "agent_thought_chunk" || update.sessionUpdate === "user_message" || update.sessionUpdate === "agent_message" || update.sessionUpdate === "agent_thought") && update.messageId ? update.messageId : null;
@@ -144117,8 +144188,8 @@ const makeAcpAdapterV2 = fn("makeAcpAdapterV2")(function* (options) {
144117
144188
  text: replace ? text : `${previous?.text ?? ""}${text}`,
144118
144189
  attachments: [],
144119
144190
  streaming: false,
144120
- createdAt: previous?.createdAt ?? now$130,
144121
- updatedAt: now$130
144191
+ createdAt: previous?.createdAt ?? now$123,
144192
+ updatedAt: now$123
144122
144193
  });
144123
144194
  return {
144124
144195
  order: current.order.includes(key) ? current.order : [...current.order, key],
@@ -144344,12 +144415,12 @@ const makeAcpAdapterV2 = fn("makeAcpAdapterV2")(function* (options) {
144344
144415
  }
144345
144416
  const knownProviderThread = (yield* get$6(providerThreadByNativeSessionId)).get(notification.sessionId);
144346
144417
  if (knownProviderThread !== void 0) {
144347
- const now$126 = yield* now;
144418
+ const now$119 = yield* now;
144348
144419
  const providerThread = {
144349
144420
  ...knownProviderThread,
144350
144421
  contextUsage: (yield* get$6(contextUsageBySessionId)).get(notification.sessionId) ?? knownProviderThread.contextUsage ?? null,
144351
144422
  nativeMetadata: (yield* get$6(nativeMetadataBySessionId)).get(notification.sessionId) ?? knownProviderThread.nativeMetadata ?? null,
144352
- updatedAt: now$126
144423
+ updatedAt: now$119
144353
144424
  };
144354
144425
  yield* update$4(providerThreadByNativeSessionId, (current) => new Map(current).set(notification.sessionId, providerThread));
144355
144426
  yield* emitProviderEvent({
@@ -144447,9 +144518,9 @@ const makeAcpAdapterV2 = fn("makeAcpAdapterV2")(function* (options) {
144447
144518
  context.tools.set(key, merged);
144448
144519
  if (!shouldPersistToolUpdate(context, key, previous, merged, merged.status)) continue;
144449
144520
  const mcpIdentity = extractMcpToolCallIdentity(merged, { embeddedTerminalCommands: [...embeddedTerminalCommands(notification.sessionId, toolCall.toolCallId), ...rootSessionId === null ? [] : embeddedTerminalCommands(rootSessionId, toolCall.toolCallId)] });
144450
- const now$136 = yield* now;
144521
+ const now$128 = yield* now;
144451
144522
  const status = toolStatus$1(merged.status);
144452
- const startedAt = context.toolStartedAt.get(key) ?? now$136;
144523
+ const startedAt = context.toolStartedAt.get(key) ?? now$128;
144453
144524
  context.toolStartedAt.set(key, startedAt);
144454
144525
  const ordinal = resolveSubagentChildOrdinal(subagent, key);
144455
144526
  yield* emitProviderEvent({
@@ -144472,8 +144543,8 @@ const makeAcpAdapterV2 = fn("makeAcpAdapterV2")(function* (options) {
144472
144543
  status,
144473
144544
  title: merged.title ?? merged.kind ?? "Tool",
144474
144545
  startedAt,
144475
- completedAt: completedAtForStatus(status, now$136),
144476
- updatedAt: now$136,
144546
+ completedAt: completedAtForStatus(status, now$128),
144547
+ updatedAt: now$128,
144477
144548
  type: "dynamic_tool",
144478
144549
  ...mcpIdentity === void 0 ? {} : mcpToolPresentation$1({
144479
144550
  serverName: mcpIdentity.server,
@@ -144664,7 +144735,7 @@ const makeAcpAdapterV2 = fn("makeAcpAdapterV2")(function* (options) {
144664
144735
  const decision = yield* make$236();
144665
144736
  const nativeResponseAcknowledgement = yield* make$236();
144666
144737
  yield* registerNativeResponseAcknowledgement(generation, transportRequestId, nativeResponseAcknowledgement);
144667
- const now$122 = yield* now;
144738
+ const now$137 = yield* now;
144668
144739
  const nodeId = idAllocator.derive.approvalNode({ requestId });
144669
144740
  const requestKind = providerRequestKind(parsed.kind);
144670
144741
  const nativeItemRef = {
@@ -144684,7 +144755,7 @@ const makeAcpAdapterV2 = fn("makeAcpAdapterV2")(function* (options) {
144684
144755
  type: "live",
144685
144756
  providerSessionId: input.providerSessionId
144686
144757
  },
144687
- createdAt: now$122,
144758
+ createdAt: now$137,
144688
144759
  resolvedAt: null
144689
144760
  };
144690
144761
  const node = {
@@ -144701,7 +144772,7 @@ const makeAcpAdapterV2 = fn("makeAcpAdapterV2")(function* (options) {
144701
144772
  nativeItemRef,
144702
144773
  runtimeRequestId: requestId,
144703
144774
  checkpointScopeId: null,
144704
- startedAt: now$122,
144775
+ startedAt: now$137,
144705
144776
  completedAt: null
144706
144777
  };
144707
144778
  const turnItem = {
@@ -144716,9 +144787,9 @@ const makeAcpAdapterV2 = fn("makeAcpAdapterV2")(function* (options) {
144716
144787
  ordinal,
144717
144788
  status: "waiting",
144718
144789
  title: null,
144719
- startedAt: now$122,
144790
+ startedAt: now$137,
144720
144791
  completedAt: null,
144721
- updatedAt: now$122,
144792
+ updatedAt: now$137,
144722
144793
  type: "approval_request",
144723
144794
  requestId,
144724
144795
  requestKind,
@@ -144775,7 +144846,7 @@ const makeAcpAdapterV2 = fn("makeAcpAdapterV2")(function* (options) {
144775
144846
  const answers = yield* make$236();
144776
144847
  const nativeResponseAcknowledgement = yield* make$236();
144777
144848
  yield* registerNativeResponseAcknowledgement(generation, transportRequestId, nativeResponseAcknowledgement);
144778
- const now$118 = yield* now;
144849
+ const now$131 = yield* now;
144779
144850
  const nodeId = providerNodeId(request.nativeItemId);
144780
144851
  const turnItemId = providerTurnItemId(request.nativeItemId);
144781
144852
  const nativeItemRef = {
@@ -144799,7 +144870,7 @@ const makeAcpAdapterV2 = fn("makeAcpAdapterV2")(function* (options) {
144799
144870
  type: "live",
144800
144871
  providerSessionId: input.providerSessionId
144801
144872
  },
144802
- createdAt: now$118,
144873
+ createdAt: now$131,
144803
144874
  resolvedAt: null
144804
144875
  };
144805
144876
  const node = {
@@ -144816,7 +144887,7 @@ const makeAcpAdapterV2 = fn("makeAcpAdapterV2")(function* (options) {
144816
144887
  nativeItemRef,
144817
144888
  runtimeRequestId: requestId,
144818
144889
  checkpointScopeId: null,
144819
- startedAt: now$118,
144890
+ startedAt: now$131,
144820
144891
  completedAt: null
144821
144892
  };
144822
144893
  const turnItem = {
@@ -144831,9 +144902,9 @@ const makeAcpAdapterV2 = fn("makeAcpAdapterV2")(function* (options) {
144831
144902
  ordinal,
144832
144903
  status: "waiting",
144833
144904
  title: null,
144834
- startedAt: now$118,
144905
+ startedAt: now$131,
144835
144906
  completedAt: null,
144836
- updatedAt: now$118,
144907
+ updatedAt: now$131,
144837
144908
  type: "user_input_request",
144838
144909
  requestId,
144839
144910
  questions: [...request.questions]
@@ -144897,7 +144968,7 @@ const makeAcpAdapterV2 = fn("makeAcpAdapterV2")(function* (options) {
144897
144968
  const cancelPendingRuntimeRequests = fnUntraced(function* () {
144898
144969
  const requests = yield* modify$3(pendingRuntimeRequests, (current) => [[...current.values()], /* @__PURE__ */ new Map()]);
144899
144970
  if (requests.length === 0) return;
144900
- const now$129 = yield* now;
144971
+ const now$121 = yield* now;
144901
144972
  yield* forEach(requests, (request) => gen$1(function* () {
144902
144973
  if (!(yield* request.type === "approval" ? succeed$5(request.decision, "cancel") : succeed$5(request.answers, null))) return;
144903
144974
  yield* emitProviderEvent({
@@ -144907,7 +144978,7 @@ const makeAcpAdapterV2 = fn("makeAcpAdapterV2")(function* (options) {
144907
144978
  runtimeRequest: {
144908
144979
  ...request.runtimeRequest,
144909
144980
  status: "cancelled",
144910
- resolvedAt: now$129
144981
+ resolvedAt: now$121
144911
144982
  }
144912
144983
  });
144913
144984
  yield* emitProviderEvent({
@@ -144916,7 +144987,7 @@ const makeAcpAdapterV2 = fn("makeAcpAdapterV2")(function* (options) {
144916
144987
  node: {
144917
144988
  ...request.node,
144918
144989
  status: "cancelled",
144919
- completedAt: now$129
144990
+ completedAt: now$121
144920
144991
  }
144921
144992
  });
144922
144993
  yield* emitProviderEvent({
@@ -144925,8 +144996,8 @@ const makeAcpAdapterV2 = fn("makeAcpAdapterV2")(function* (options) {
144925
144996
  turnItem: {
144926
144997
  ...request.turnItem,
144927
144998
  status: "cancelled",
144928
- completedAt: now$129,
144929
- updatedAt: now$129
144999
+ completedAt: now$121,
145000
+ updatedAt: now$121
144930
145001
  }
144931
145002
  });
144932
145003
  }), {
@@ -144940,15 +145011,15 @@ const makeAcpAdapterV2 = fn("makeAcpAdapterV2")(function* (options) {
144940
145011
  * longer guaranteed to ingest the terminal event.
144941
145012
  */
144942
145013
  const mutateCarryoverSubagentStatus = fnUntraced(function* (subagent, status, resultOverride) {
144943
- const now$132 = yield* now;
145014
+ const now$124 = yield* now;
144944
145015
  const result = resultOverride !== void 0 && resultOverride !== null && resultOverride.length > 0 ? resultOverride : subagent.task.result ?? (subagent.assistantText || null);
144945
- const completedAt = acpSubagentStatusIsTerminal(status) ? now$132 : null;
145016
+ const completedAt = acpSubagentStatusIsTerminal(status) ? now$124 : null;
144946
145017
  subagent.task = {
144947
145018
  ...subagent.task,
144948
145019
  status,
144949
145020
  result,
144950
145021
  completedAt,
144951
- updatedAt: now$132
145022
+ updatedAt: now$124
144952
145023
  };
144953
145024
  });
144954
145025
  /**
@@ -145728,7 +145799,7 @@ const makeAcpAdapterV2 = fn("makeAcpAdapterV2")(function* (options) {
145728
145799
  else if (settledStatus === "interrupted") yield* terminalizeOpenRunOwnedItems(context, { terminalizeSubagents: directStopQuarantine });
145729
145800
  yield* closeTextStreams(context);
145730
145801
  if (settledStatus !== "failed") yield* emitProviderRetry(context, settledStatus);
145731
- const now$119 = yield* now;
145802
+ const now$133 = yield* now;
145732
145803
  if (flavor.supportsCompaction === true && context.input.message.text.trim() === "/compact" && context.input.message.attachments.length === 0 && settledStatus === "completed") {
145733
145804
  const nativeItemId = `${context.nativeTurnId}:compaction`;
145734
145805
  yield* emitProviderEvent({
@@ -145756,12 +145827,12 @@ const makeAcpAdapterV2 = fn("makeAcpAdapterV2")(function* (options) {
145756
145827
  status: "completed",
145757
145828
  title: "Context compacted",
145758
145829
  startedAt: context.startedAt,
145759
- completedAt: now$119,
145760
- updatedAt: now$119
145830
+ completedAt: now$133,
145831
+ updatedAt: now$133
145761
145832
  }
145762
145833
  });
145763
145834
  }
145764
- const turn = providerTurnPayload(context, settledStatus, now$119);
145835
+ const turn = providerTurnPayload(context, settledStatus, now$133);
145765
145836
  yield* update$4(providerTurns, (current) => {
145766
145837
  const updated = new Map(current);
145767
145838
  updated.set(String(turn.id), turn);
@@ -145781,7 +145852,7 @@ const makeAcpAdapterV2 = fn("makeAcpAdapterV2")(function* (options) {
145781
145852
  firstRunOrdinal: context.input.providerThread.firstRunOrdinal ?? context.input.runOrdinal,
145782
145853
  contextUsage: context.contextUsage,
145783
145854
  nativeMetadata: context.nativeMetadata,
145784
- updatedAt: now$119
145855
+ updatedAt: now$133
145785
145856
  };
145786
145857
  yield* update$4(providerThreadByNativeSessionId, (current) => new Map(current).set(context.nativeThreadId, updatedProviderThread));
145787
145858
  yield* emitProviderEvent({
@@ -146194,7 +146265,7 @@ const makeAcpAdapterV2 = fn("makeAcpAdapterV2")(function* (options) {
146194
146265
  return false;
146195
146266
  }) } : {},
146196
146267
  ensureThread: fn("AcpAdapterV2.ensureThread")(function* (threadInput) {
146197
- const now$120 = yield* now;
146268
+ const now$134 = yield* now;
146198
146269
  const sessionId = yield* get$6(activeSessionId);
146199
146270
  if (sessionId === null) return yield* new ProviderAdapterProtocolError({
146200
146271
  driver,
@@ -146208,7 +146279,7 @@ const makeAcpAdapterV2 = fn("makeAcpAdapterV2")(function* (options) {
146208
146279
  providerSessionId: input.providerSessionId,
146209
146280
  nativeThreadId: sessionId,
146210
146281
  ...itemIdentityVersion === void 0 ? {} : { itemIdentityVersion },
146211
- now: now$120
146282
+ now: now$134
146212
146283
  });
146213
146284
  yield* update$4(providerThreadByNativeSessionId, (current) => new Map(current).set(sessionId, providerThread));
146214
146285
  return providerThread;
@@ -146244,12 +146315,12 @@ const makeAcpAdapterV2 = fn("makeAcpAdapterV2")(function* (options) {
146244
146315
  yield* set$5(activeSelection, nextSelection);
146245
146316
  yield* set$5(activeInteractionMode, nextRuntimePolicy.interactionMode);
146246
146317
  }
146247
- const now$137 = yield* now;
146318
+ const now$129 = yield* now;
146248
146319
  return {
146249
146320
  ...threadInput.providerThread,
146250
146321
  providerSessionId: input.providerSessionId,
146251
146322
  status: "idle",
146252
- updatedAt: now$137
146323
+ updatedAt: now$129
146253
146324
  };
146254
146325
  }));
146255
146326
  }, (effect, threadInput) => effect.pipe(mapError((cause) => new ProviderAdapterResumeThreadError({
@@ -146482,13 +146553,13 @@ const makeAcpAdapterV2 = fn("makeAcpAdapterV2")(function* (options) {
146482
146553
  yield* set$5(activeInteractionMode, null);
146483
146554
  }
146484
146555
  const state = yield* get$6(snapshot);
146485
- const now$131 = yield* now;
146556
+ const now$122 = yield* now;
146486
146557
  return {
146487
146558
  providerThread: {
146488
146559
  ...snapshotInput.providerThread,
146489
146560
  providerSessionId: input.providerSessionId,
146490
146561
  status: "idle",
146491
- updatedAt: now$131
146562
+ updatedAt: now$122
146492
146563
  },
146493
146564
  providerTurns: [...(yield* get$6(providerTurns)).values()],
146494
146565
  messages: state.order.flatMap((key) => {
@@ -146547,7 +146618,7 @@ const makeAcpAdapterV2 = fn("makeAcpAdapterV2")(function* (options) {
146547
146618
  yield* set$5(lastTurnRoute, null);
146548
146619
  }));
146549
146620
  })).pipe(retry$1({ times: 1 }));
146550
- const now$138 = yield* now;
146621
+ const now$130 = yield* now;
146551
146622
  return {
146552
146623
  providerThread: {
146553
146624
  ...rollbackInput.providerThread,
@@ -146562,7 +146633,7 @@ const makeAcpAdapterV2 = fn("makeAcpAdapterV2")(function* (options) {
146562
146633
  itemIdentityVersion: 2
146563
146634
  },
146564
146635
  status: "idle",
146565
- updatedAt: now$138
146636
+ updatedAt: now$130
146566
146637
  },
146567
146638
  providerTurns: [],
146568
146639
  messages: [],
@@ -146597,7 +146668,7 @@ const makeAcpAdapterV2 = fn("makeAcpAdapterV2")(function* (options) {
146597
146668
  yield* set$5(activeSelection, null);
146598
146669
  yield* set$5(activeInteractionMode, null);
146599
146670
  itemIdentityVersion = 2;
146600
- const now$121 = yield* now;
146671
+ const now$136 = yield* now;
146601
146672
  const providerThread = makeProviderThread$3({
146602
146673
  driver,
146603
146674
  providerInstanceId: options.instanceId,
@@ -146611,7 +146682,7 @@ const makeAcpAdapterV2 = fn("makeAcpAdapterV2")(function* (options) {
146611
146682
  providerThreadId: forkInput.sourceProviderThread.id,
146612
146683
  ...forkInput.providerTurnId === void 0 ? {} : { providerTurnId: forkInput.providerTurnId }
146613
146684
  },
146614
- now: now$121
146685
+ now: now$136
146615
146686
  });
146616
146687
  yield* update$4(providerThreadByNativeSessionId, (current) => new Map(current).set(forked.sessionId, providerThread));
146617
146688
  return providerThread;
@@ -147017,7 +147088,9 @@ const makeManagedServerProvider = fn("makeManagedServerProvider")(function* (inp
147017
147088
  return yield* applySnapshot(nextSettings, { forceRefresh: true });
147018
147089
  });
147019
147090
  const hasProviderStatusDemand = gen$1(function* () {
147020
- const instanceId = (yield* get$6(snapshotStateRef)).snapshot.instanceId;
147091
+ const state = yield* get$6(snapshotStateRef);
147092
+ if (!state.snapshot.enabled) return false;
147093
+ const instanceId = state.snapshot.instanceId;
147021
147094
  const [genericDemand, instanceDemand] = yield* all$5([host.shouldRunBackgroundWork({ type: "provider-status" }), host.shouldRunBackgroundWork({
147022
147095
  type: "provider-status",
147023
147096
  instanceId
@@ -164583,16 +164656,22 @@ function permissionModeForClaudeRuntimePolicy(runtimePolicy) {
164583
164656
  case "full-access": return "bypassPermissions";
164584
164657
  }
164585
164658
  }
164586
- function claudeRuntimeQueryPolicyForRuntimePolicy(runtimePolicy) {
164587
- const permissionMode = permissionModeForClaudeRuntimePolicy(runtimePolicy);
164659
+ const CLAUDE_BYPASS_FULLY_AVAILABLE = {
164660
+ bypassDisabled: false,
164661
+ autoDisabled: false
164662
+ };
164663
+ function claudeRuntimeQueryPolicyForRuntimePolicy(runtimePolicy, availability = CLAUDE_BYPASS_FULLY_AVAILABLE) {
164664
+ const requestedMode = permissionModeForClaudeRuntimePolicy(runtimePolicy);
164665
+ const downgraded = requestedMode === "bypassPermissions" && availability.bypassDisabled;
164666
+ const permissionMode = downgraded ? availability.autoDisabled ? "default" : "auto" : requestedMode;
164588
164667
  const readOnlyTools = sandboxPolicyKindForClaudeRuntimePolicy(runtimePolicy) === "readOnly" ? CLAUDE_READ_ONLY_ALLOWED_TOOLS : void 0;
164589
164668
  const allowedTools = readOnlyTools !== void 0 && readOnlyPolicyAllowsGlobalReads(runtimePolicy) ? readOnlyTools : void 0;
164590
- const installPermissionCallback = runtimePolicy.approvalPolicy === void 0 ? runtimePolicy.runtimeMode === "approval-required" || runtimePolicy.runtimeMode === "auto-accept-edits" : runtimePolicy.approvalPolicy !== "never";
164669
+ const installPermissionCallback = downgraded || (runtimePolicy.approvalPolicy === void 0 ? runtimePolicy.runtimeMode === "approval-required" || runtimePolicy.runtimeMode === "auto-accept-edits" : runtimePolicy.approvalPolicy !== "never");
164591
164670
  if (permissionMode === "plan") return {
164592
164671
  permissionMode,
164593
164672
  ...readOnlyTools === void 0 ? {} : { tools: readOnlyTools },
164594
164673
  ...allowedTools === void 0 ? {} : { allowedTools },
164595
- installPermissionCallback
164674
+ installPermissionCallback: true
164596
164675
  };
164597
164676
  return {
164598
164677
  permissionMode,
@@ -165389,7 +165468,7 @@ function claudeUserInputQuestions(input) {
165389
165468
  if (label.length === 0) return [];
165390
165469
  return [{
165391
165470
  label,
165392
- description: typeof optionRecord.description === "string" ? optionRecord.description.trim() : ""
165471
+ description: (typeof optionRecord.description === "string" ? optionRecord.description.trim() : "") || label
165393
165472
  }];
165394
165473
  }) : [],
165395
165474
  multiSelect: record.multiSelect === true
@@ -165747,14 +165826,14 @@ const makeClaudeAdapterV2 = fn("makeClaudeAdapterV2")(function* (adapterOptions)
165747
165826
  const clearOpaqueBackgroundTaskReplayTombstone = (nativeThreadId, taskId) => clearTaskIdFromNativeThreadSet(opaqueBackgroundTaskReplayTombstonesByNativeThread, nativeThreadId, taskId);
165748
165827
  const emitProviderThreadRoster = fnUntraced(function* (input) {
165749
165828
  const roster = rosterForNativeThread(yield* get$6(pendingBackgroundTasksByNativeThread), input.nativeThreadId);
165750
- const now$114 = yield* now;
165829
+ const now$103 = yield* now;
165751
165830
  const providerThread = {
165752
165831
  ...input.providerThread,
165753
165832
  providerSessionId: session.id,
165754
165833
  ...input.status === void 0 ? {} : { status: input.status },
165755
165834
  pendingBackgroundTasks: claudePendingBackgroundTasksFromRoster(roster),
165756
165835
  ...goalsByNativeThread.has(input.nativeThreadId) ? { goal: goalsByNativeThread.get(input.nativeThreadId) ?? null } : {},
165757
- updatedAt: now$114
165836
+ updatedAt: now$103
165758
165837
  };
165759
165838
  yield* rememberProviderThread(providerThread);
165760
165839
  yield* emitProviderEvent({
@@ -166032,7 +166111,7 @@ const makeClaudeAdapterV2 = fn("makeClaudeAdapterV2")(function* (adapterOptions)
166032
166111
  }).pipe(catch_(() => logWarning$1("orchestration-v2.claude-subagent-launch-lookup-failed", { taskId: resume.taskId }).pipe(as(null))));
166033
166112
  if (launchToolUseId === null || launchToolUseId === resume.toolUseId) return;
166034
166113
  const ids = claudeSubagentIds(resume.context, resume.taskId);
166035
- const now$103 = yield* now;
166114
+ const now$109 = yield* now;
166036
166115
  const subagent = {
166037
166116
  confirmedOutcome: void 0,
166038
166117
  childThread: null,
@@ -166057,9 +166136,9 @@ const makeClaudeAdapterV2 = fn("makeClaudeAdapterV2")(function* (adapterOptions)
166057
166136
  model: null,
166058
166137
  result: null,
166059
166138
  status: "completed",
166060
- startedAt: now$103,
166061
- completedAt: now$103,
166062
- updatedAt: now$103
166139
+ startedAt: now$109,
166140
+ completedAt: now$109,
166141
+ updatedAt: now$109
166063
166142
  },
166064
166143
  rootNodeId: resume.context.input.rootNodeId,
166065
166144
  childThreadId: ids.childThreadId,
@@ -166144,7 +166223,7 @@ const makeClaudeAdapterV2 = fn("makeClaudeAdapterV2")(function* (adapterOptions)
166144
166223
  const parentThread = input.coordinator.childThread;
166145
166224
  const taskId = input.coordinator.task.nativeTaskRef?.nativeId;
166146
166225
  if (parentThread === null || taskId === void 0 || taskId === null) return;
166147
- const now$112 = yield* now;
166226
+ const now$101 = yield* now;
166148
166227
  const seen = yield* get$6(workflowMemberStates);
166149
166228
  const transcriptDir = input.workflow.runHandles?.transcriptDir;
166150
166229
  for (const member of input.workflow.agents) {
@@ -166157,9 +166236,9 @@ const makeClaudeAdapterV2 = fn("makeClaudeAdapterV2")(function* (adapterOptions)
166157
166236
  const model = member.model ?? parentThread.modelSelection.model;
166158
166237
  const attempt = member.attempt ?? previous?.attempt ?? 1;
166159
166238
  const restarted = previous !== void 0 && attempt > previous.attempt;
166160
- const createdAt = previous?.createdAt ?? now$112;
166161
- const startedAt = status === "pending" ? null : member.startedAt !== void 0 ? makeUnsafe$11(member.startedAt) : (restarted ? null : previous?.startedAt) ?? (status === "running" ? now$112 : null);
166162
- const completedAt = settled ? (restarted ? null : previous?.completedAt) ?? now$112 : null;
166239
+ const createdAt = previous?.createdAt ?? now$101;
166240
+ const startedAt = status === "pending" ? null : member.startedAt !== void 0 ? makeUnsafe$11(member.startedAt) : (restarted ? null : previous?.startedAt) ?? (status === "running" ? now$101 : null);
166241
+ const completedAt = settled ? (restarted ? null : previous?.completedAt) ?? now$101 : null;
166163
166242
  const changed = restarted || previous?.status !== status || !equals(previous?.startedAt, startedAt) || previous?.result !== member.result || previous?.label !== member.label || previous?.prompt !== prompt || previous?.model !== model;
166164
166243
  const agentId = member.agentId;
166165
166244
  const readTranscript = settled && transcriptDir !== void 0 && agentId !== void 0 && (input.coordinator.task.status === "running" ? (restarted ? 0 : previous?.transcriptReadAttempts ?? 0) < 3 : restarted || previous?.finalTranscriptRead !== true);
@@ -166200,7 +166279,7 @@ const makeClaudeAdapterV2 = fn("makeClaudeAdapterV2")(function* (adapterOptions)
166200
166279
  role: "user",
166201
166280
  text: prompt,
166202
166281
  ordinal: 100,
166203
- now: now$112
166282
+ now: now$101
166204
166283
  });
166205
166284
  if (restarted && !settled) yield* emitSubagentConversationMessage({
166206
166285
  nativeItemId: `${memberKey}:answer:200`,
@@ -166209,7 +166288,7 @@ const makeClaudeAdapterV2 = fn("makeClaudeAdapterV2")(function* (adapterOptions)
166209
166288
  role: "assistant",
166210
166289
  text: "Retry in progress.",
166211
166290
  ordinal: 200,
166212
- now: now$112
166291
+ now: now$101
166213
166292
  });
166214
166293
  const task = {
166215
166294
  id: nodeId,
@@ -166234,7 +166313,7 @@ const makeClaudeAdapterV2 = fn("makeClaudeAdapterV2")(function* (adapterOptions)
166234
166313
  result: member.result ?? null,
166235
166314
  startedAt,
166236
166315
  completedAt,
166237
- updatedAt: now$112
166316
+ updatedAt: now$101
166238
166317
  };
166239
166318
  const nodeBase = {
166240
166319
  runId: null,
@@ -166295,7 +166374,7 @@ const makeClaudeAdapterV2 = fn("makeClaudeAdapterV2")(function* (adapterOptions)
166295
166374
  role: "assistant",
166296
166375
  text: answer,
166297
166376
  ordinal: 200,
166298
- now: now$112
166377
+ now: now$101
166299
166378
  });
166300
166379
  }
166301
166380
  yield* update$4(workflowMemberStates, (current) => new Map(current).set(memberKey, {
@@ -166341,7 +166420,7 @@ const makeClaudeAdapterV2 = fn("makeClaudeAdapterV2")(function* (adapterOptions)
166341
166420
  if (existingSubagent !== void 0 && existingSubagent.task.status !== "running" && input.status === "running" && !isReopen) return;
166342
166421
  const resumeToolUseId = input.reopen === true && existingSubagent !== void 0 && input.toolUseId !== void 0 && input.toolUseId !== existingSubagent.runToolUseId && input.prompt !== void 0 ? input.toolUseId : null;
166343
166422
  const lifecycleChanged = existingSubagent === void 0 || existingSubagent.task.status !== input.status || input.reopen === true && input.status === "running";
166344
- const now$113 = yield* now;
166423
+ const now$102 = yield* now;
166345
166424
  const nativeItemId = `task:${input.taskId}`;
166346
166425
  const derivedIds = claudeSubagentIds(input.context, input.taskId);
166347
166426
  const nodeId = existingSubagent?.task.id ?? derivedIds.nodeId;
@@ -166383,7 +166462,7 @@ const makeClaudeAdapterV2 = fn("makeClaudeAdapterV2")(function* (adapterOptions)
166383
166462
  title: input.title ?? null,
166384
166463
  model: input.model ?? null,
166385
166464
  result: null,
166386
- startedAt: now$113
166465
+ startedAt: now$102
166387
166466
  },
166388
166467
  status: input.status,
166389
166468
  ...input.reopen === true && input.status === "running" && existingSubagent !== void 0 ? { runId: input.context.input.runId } : {},
@@ -166394,9 +166473,9 @@ const makeClaudeAdapterV2 = fn("makeClaudeAdapterV2")(function* (adapterOptions)
166394
166473
  ...input.progress === void 0 ? {} : { progress: input.progress },
166395
166474
  ...workflowWithThreads === void 0 ? {} : { workflow: workflowWithThreads },
166396
166475
  ...input.result === void 0 ? {} : { result: input.result },
166397
- ...isReopen ? { startedAt: now$113 } : {},
166398
- completedAt: input.status === "running" ? null : priorTask?.completedAt ?? now$113,
166399
- updatedAt: now$113
166476
+ ...isReopen ? { startedAt: now$102 } : {},
166477
+ completedAt: input.status === "running" ? null : priorTask?.completedAt ?? now$102,
166478
+ updatedAt: now$102
166400
166479
  };
166401
166480
  const subagent = {
166402
166481
  task,
@@ -166450,7 +166529,7 @@ const makeClaudeAdapterV2 = fn("makeClaudeAdapterV2")(function* (adapterOptions)
166450
166529
  title: workflowWithThreads === void 0 ? task.title : `Workflow · ${workflowWithThreads.name ?? task.title ?? "Untitled"}`,
166451
166530
  ordinal: input.context.subagentsByTaskId.size
166452
166531
  }),
166453
- now: now$113,
166532
+ now: now$102,
166454
166533
  createdBy: "agent",
166455
166534
  creationSource: "provider"
166456
166535
  });
@@ -166521,7 +166600,7 @@ const makeClaudeAdapterV2 = fn("makeClaudeAdapterV2")(function* (adapterOptions)
166521
166600
  role: "user",
166522
166601
  text: task.prompt,
166523
166602
  ordinal: existingSubagent === void 0 ? 100 : ++subagent.nextChildItemOrdinal,
166524
- now: now$113
166603
+ now: now$102
166525
166604
  });
166526
166605
  if (workflowWithThreads !== void 0) {
166527
166606
  yield* projectClaudeWorkflowMembers({
@@ -166575,7 +166654,7 @@ const makeClaudeAdapterV2 = fn("makeClaudeAdapterV2")(function* (adapterOptions)
166575
166654
  role: "assistant",
166576
166655
  text: input.result,
166577
166656
  ordinal: resultItemOrdinal,
166578
- now: now$113
166657
+ now: now$102
166579
166658
  });
166580
166659
  }
166581
166660
  });
@@ -166881,7 +166960,7 @@ const makeClaudeAdapterV2 = fn("makeClaudeAdapterV2")(function* (adapterOptions)
166881
166960
  const block = context.reasoning.blocks.get(update.itemId);
166882
166961
  if (block === void 0 || update.text.length === 0) return;
166883
166962
  block.text = update.text;
166884
- const now$110 = yield* now;
166963
+ const now$116 = yield* now;
166885
166964
  yield* emitProviderEvent({
166886
166965
  type: "turn_item.updated",
166887
166966
  driver: CLAUDE_PROVIDER,
@@ -166908,8 +166987,8 @@ const makeClaudeAdapterV2 = fn("makeClaudeAdapterV2")(function* (adapterOptions)
166908
166987
  streaming: !update.completed,
166909
166988
  status: update.completed ? "completed" : "running",
166910
166989
  startedAt: block.startedAt,
166911
- completedAt: update.completed ? now$110 : null,
166912
- updatedAt: now$110
166990
+ completedAt: update.completed ? now$116 : null,
166991
+ updatedAt: now$116
166913
166992
  }
166914
166993
  });
166915
166994
  })
@@ -167114,7 +167193,7 @@ const makeClaudeAdapterV2 = fn("makeClaudeAdapterV2")(function* (adapterOptions)
167114
167193
  const emitAssistantTextArtifacts = fnUntraced(function* (input) {
167115
167194
  if (input.context.assistant.emittedNativeItemIds.has(input.nativeItemId)) return;
167116
167195
  input.context.assistant.emittedNativeItemIds.add(input.nativeItemId);
167117
- const now$108 = yield* now;
167196
+ const now$114 = yield* now;
167118
167197
  const ordinal = yield* resolveItemOrdinal(input.context, input.nativeItemId);
167119
167198
  const artifacts = buildAssistantArtifacts({
167120
167199
  idAllocator,
@@ -167123,8 +167202,8 @@ const makeClaudeAdapterV2 = fn("makeClaudeAdapterV2")(function* (adapterOptions)
167123
167202
  nativeItemId: input.nativeItemId,
167124
167203
  text: input.text,
167125
167204
  ordinal,
167126
- startedAt: now$108,
167127
- completedAt: now$108
167205
+ startedAt: now$114,
167206
+ completedAt: now$114
167128
167207
  });
167129
167208
  yield* all$5([
167130
167209
  emitProviderEvent({
@@ -167209,14 +167288,14 @@ const makeClaudeAdapterV2 = fn("makeClaudeAdapterV2")(function* (adapterOptions)
167209
167288
  message
167210
167289
  });
167211
167290
  if (workflow === void 0) return;
167212
- const now$116 = yield* now;
167291
+ const now$106 = yield* now;
167213
167292
  const progress = text$3(message.description);
167214
167293
  const workflowWithThreads = withWorkflowMemberThreadIds(workflow, registered.childThreadId);
167215
167294
  const task = {
167216
167295
  ...registered.task,
167217
167296
  ...progress === void 0 ? {} : { progress },
167218
167297
  workflow: workflowWithThreads,
167219
- updatedAt: now$116
167298
+ updatedAt: now$106
167220
167299
  };
167221
167300
  const coordinator = {
167222
167301
  ...registered,
@@ -167247,7 +167326,7 @@ const makeClaudeAdapterV2 = fn("makeClaudeAdapterV2")(function* (adapterOptions)
167247
167326
  const isNewSubagentTaskStarted = message.type === "system" && message.subtype === "task_started" && !isClaudeNonSubagentTask(message);
167248
167327
  const isKnownSubagentTaskStarted = message.type === "system" && message.subtype === "task_started" && (yield* get$6(sessionSubagentsByTaskId)).has(message.task_id);
167249
167328
  if (isKnownSubagentTaskStarted && message.type === "system" && message.subtype === "task_started") {
167250
- const now$101 = yield* now;
167329
+ const now$107 = yield* now;
167251
167330
  yield* update$4(sessionSubagentsByTaskId, (current) => {
167252
167331
  const registered = current.get(message.task_id);
167253
167332
  if (registered === void 0 || registered.task.status === "running") return current;
@@ -167259,9 +167338,9 @@ const makeClaudeAdapterV2 = fn("makeClaudeAdapterV2")(function* (adapterOptions)
167259
167338
  ...priorTask,
167260
167339
  status: "running",
167261
167340
  result: null,
167262
- startedAt: now$101,
167341
+ startedAt: now$107,
167263
167342
  completedAt: null,
167264
- updatedAt: now$101
167343
+ updatedAt: now$107
167265
167344
  }
167266
167345
  });
167267
167346
  });
@@ -167395,10 +167474,10 @@ const makeClaudeAdapterV2 = fn("makeClaudeAdapterV2")(function* (adapterOptions)
167395
167474
  if (!rateLimitInfo) return;
167396
167475
  const names = adapterOptions.scopedLimitNames ? yield* get$6(adapterOptions.scopedLimitNames) : { overageIncluded: void 0 };
167397
167476
  const update = claudeRateLimitEventToUpdate(rateLimitInfo, names);
167398
- const now$102 = yield* now;
167477
+ const now$108 = yield* now;
167399
167478
  if (update && adapterOptions.onUsageLimits) yield* adapterOptions.onUsageLimits({
167400
167479
  ...update,
167401
- checkedAt: formatIso(now$102)
167480
+ checkedAt: formatIso(now$108)
167402
167481
  });
167403
167482
  const context = yield* get$6(activeTurn);
167404
167483
  if (context === null) {
@@ -167424,7 +167503,7 @@ const makeClaudeAdapterV2 = fn("makeClaudeAdapterV2")(function* (adapterOptions)
167424
167503
  if (!context.announcedUsageLimits.has(limitKey)) {
167425
167504
  context.announcedUsageLimits.add(limitKey);
167426
167505
  const nativeItemId = `usage-limit:${context.providerTurnId}:${limitKey}`;
167427
- const notice = describeClaudeUsageLimit(rateLimitInfo, toEpochMillis(now$102), names);
167506
+ const notice = describeClaudeUsageLimit(rateLimitInfo, toEpochMillis(now$108), names);
167428
167507
  yield* emitProviderEvent({
167429
167508
  type: "turn_item.updated",
167430
167509
  driver: CLAUDE_PROVIDER,
@@ -167449,9 +167528,9 @@ const makeClaudeAdapterV2 = fn("makeClaudeAdapterV2")(function* (adapterOptions)
167449
167528
  status: "completed",
167450
167529
  title: notice,
167451
167530
  message: notice,
167452
- startedAt: now$102,
167453
- completedAt: now$102,
167454
- updatedAt: now$102
167531
+ startedAt: now$108,
167532
+ completedAt: now$108,
167533
+ updatedAt: now$108
167455
167534
  }
167456
167535
  });
167457
167536
  }
@@ -167587,7 +167666,7 @@ const makeClaudeAdapterV2 = fn("makeClaudeAdapterV2")(function* (adapterOptions)
167587
167666
  }
167588
167667
  }
167589
167668
  if (message.type === "system" && message.subtype === "compact_boundary") {
167590
- const now$107 = yield* now;
167669
+ const now$113 = yield* now;
167591
167670
  const nativeItemId = message.uuid;
167592
167671
  const postTokens = message.compact_metadata.post_tokens;
167593
167672
  const afterTokenCount = typeof postTokens === "number" && Number.isFinite(postTokens) && postTokens > 0 ? Math.round(postTokens) : void 0;
@@ -167612,7 +167691,7 @@ const makeClaudeAdapterV2 = fn("makeClaudeAdapterV2")(function* (adapterOptions)
167612
167691
  tokenUsage: {
167613
167692
  usedTokens: afterTokenCount,
167614
167693
  maxTokens: claudeContextWindow(context.input.modelSelection),
167615
- updatedAt: formatIso(now$107)
167694
+ updatedAt: formatIso(now$113)
167616
167695
  }
167617
167696
  }
167618
167697
  });
@@ -167640,9 +167719,9 @@ const makeClaudeAdapterV2 = fn("makeClaudeAdapterV2")(function* (adapterOptions)
167640
167719
  driver: CLAUDE_PROVIDER,
167641
167720
  status: "completed",
167642
167721
  title: "Context compacted",
167643
- startedAt: now$107,
167644
- completedAt: now$107,
167645
- updatedAt: now$107,
167722
+ startedAt: now$113,
167723
+ completedAt: now$113,
167724
+ updatedAt: now$113,
167646
167725
  ...message.compact_metadata.pre_tokens === void 0 ? {} : { beforeTokenCount: message.compact_metadata.pre_tokens },
167647
167726
  ...afterTokenCount === void 0 ? {} : { afterTokenCount }
167648
167727
  }
@@ -167650,7 +167729,7 @@ const makeClaudeAdapterV2 = fn("makeClaudeAdapterV2")(function* (adapterOptions)
167650
167729
  return;
167651
167730
  }
167652
167731
  if (message.type === "system" && message.subtype === "model_refusal_fallback") {
167653
- const now$115 = yield* now;
167732
+ const now$104 = yield* now;
167654
167733
  const nativeItemId = message.uuid;
167655
167734
  yield* emitProviderEvent({
167656
167735
  type: "turn_item.updated",
@@ -167676,9 +167755,9 @@ const makeClaudeAdapterV2 = fn("makeClaudeAdapterV2")(function* (adapterOptions)
167676
167755
  status: "completed",
167677
167756
  title: message.content,
167678
167757
  message: message.content,
167679
- startedAt: now$115,
167680
- completedAt: now$115,
167681
- updatedAt: now$115
167758
+ startedAt: now$104,
167759
+ completedAt: now$104,
167760
+ updatedAt: now$104
167682
167761
  }
167683
167762
  });
167684
167763
  return;
@@ -167725,8 +167804,8 @@ const makeClaudeAdapterV2 = fn("makeClaudeAdapterV2")(function* (adapterOptions)
167725
167804
  return;
167726
167805
  }
167727
167806
  if (message.type === "assistant" && input.replayed !== true) {
167728
- const now$105 = yield* now;
167729
- yield* completeProviderRetry(context, now$105);
167807
+ const now$110 = yield* now;
167808
+ yield* completeProviderRetry(context, now$110);
167730
167809
  if (message.parent_tool_use_id === null && message.message.usage !== void 0 && message.message.model !== "<synthetic>") yield* emitProviderEvent({
167731
167810
  type: "provider_turn.updated",
167732
167811
  driver: CLAUDE_PROVIDER,
@@ -167745,7 +167824,7 @@ const makeClaudeAdapterV2 = fn("makeClaudeAdapterV2")(function* (adapterOptions)
167745
167824
  status: "running",
167746
167825
  startedAt: context.startedAt,
167747
167826
  completedAt: null,
167748
- tokenUsage: claudeProviderTurnTokenUsage(message.message.usage, context.input.modelSelection, formatIso(now$105))
167827
+ tokenUsage: claudeProviderTurnTokenUsage(message.message.usage, context.input.modelSelection, formatIso(now$110))
167749
167828
  }
167750
167829
  });
167751
167830
  const parentToolUseId = message.parent_tool_use_id;
@@ -167995,7 +168074,7 @@ const makeClaudeAdapterV2 = fn("makeClaudeAdapterV2")(function* (adapterOptions)
167995
168074
  const thinking = message.message.content.flatMap((block) => block.type === "thinking" && block.thinking.trim().length > 0 ? [block.thinking] : []);
167996
168075
  const subagent = thinking.length === 0 ? void 0 : yield* resolveSubagentByToolUseId(context, assistantParentToolUseId);
167997
168076
  if (subagent !== void 0) {
167998
- const now$109 = yield* now;
168077
+ const now$115 = yield* now;
167999
168078
  for (const [index, text] of thinking.entries()) {
168000
168079
  const nativeItemId = `${message.uuid}:thinking:${index}`;
168001
168080
  yield* emitProviderEvent({
@@ -168023,9 +168102,9 @@ const makeClaudeAdapterV2 = fn("makeClaudeAdapterV2")(function* (adapterOptions)
168023
168102
  text,
168024
168103
  streaming: false,
168025
168104
  status: "completed",
168026
- startedAt: now$109,
168027
- completedAt: now$109,
168028
- updatedAt: now$109
168105
+ startedAt: now$115,
168106
+ completedAt: now$115,
168107
+ updatedAt: now$115
168029
168108
  }
168030
168109
  });
168031
168110
  }
@@ -168035,7 +168114,7 @@ const makeClaudeAdapterV2 = fn("makeClaudeAdapterV2")(function* (adapterOptions)
168035
168114
  if (assistantText !== null && assistantText.text.length > 0 && assistantParentToolUseId !== null) {
168036
168115
  const subagent = yield* resolveSubagentByToolUseId(context, assistantParentToolUseId);
168037
168116
  if (subagent === void 0) return;
168038
- const now$106 = yield* now;
168117
+ const now$112 = yield* now;
168039
168118
  const nativeMessageId = message.type === "assistant" && typeof message.message.id === "string" ? message.message.id : null;
168040
168119
  subagent.lastAssistantText = nativeMessageId !== null && nativeMessageId === subagent.lastAssistantMessageId ? `${subagent.lastAssistantText ?? ""}\n${assistantText.text}` : assistantText.text;
168041
168120
  subagent.lastAssistantMessageId = nativeMessageId;
@@ -168046,7 +168125,7 @@ const makeClaudeAdapterV2 = fn("makeClaudeAdapterV2")(function* (adapterOptions)
168046
168125
  role: "assistant",
168047
168126
  text: assistantText.text,
168048
168127
  ordinal: ++subagent.nextChildItemOrdinal,
168049
- now: now$106
168128
+ now: now$112
168050
168129
  });
168051
168130
  return;
168052
168131
  }
@@ -168345,6 +168424,11 @@ const makeClaudeAdapterV2 = fn("makeClaudeAdapterV2")(function* (adapterOptions)
168345
168424
  toolUseID: callbackOptions.toolUseID
168346
168425
  };
168347
168426
  }
168427
+ if (context.input.runtimePolicy.interactionMode === "plan" && context.input.runtimePolicy.approvalPolicy === "never") return {
168428
+ behavior: "deny",
168429
+ message: "This tool requires approval in Plan mode, but approvals are disabled for this thread.",
168430
+ toolUseID: callbackOptions.toolUseID
168431
+ };
168348
168432
  if (!requiresClaudeApproval(context)) return {
168349
168433
  behavior: "allow",
168350
168434
  updatedInput: toolInput,
@@ -168980,7 +169064,7 @@ const makeClaudeAdapterV2 = fn("makeClaudeAdapterV2")(function* (adapterOptions)
168980
169064
  });
168981
169065
  const nativeThreadId = yield* getNativeThreadId$1(rollbackInput.providerThread);
168982
169066
  yield* closeLiveQueryForNativeThread(nativeThreadId);
168983
- const now$111 = yield* now;
169067
+ const now$105 = yield* now;
168984
169068
  if (rollbackInput.target.type === "thread_start") {
168985
169069
  const resetNativeThreadId = yield* queryRunner.allocateSessionId;
168986
169070
  return {
@@ -168993,7 +169077,7 @@ const makeClaudeAdapterV2 = fn("makeClaudeAdapterV2")(function* (adapterOptions)
168993
169077
  providerSessionId: input.providerSessionId,
168994
169078
  nativeThreadId: resetNativeThreadId,
168995
169079
  ...rollbackInput.providerThread.forkedFrom === null ? {} : { forkedFrom: rollbackInput.providerThread.forkedFrom },
168996
- now: now$111
169080
+ now: now$105
168997
169081
  }),
168998
169082
  handoffIds: rollbackInput.providerThread.handoffIds
168999
169083
  },
@@ -169014,7 +169098,7 @@ const makeClaudeAdapterV2 = fn("makeClaudeAdapterV2")(function* (adapterOptions)
169014
169098
  },
169015
169099
  status: "idle",
169016
169100
  lastRunOrdinal: rollbackInput.target.appRunOrdinal,
169017
- updatedAt: now$111
169101
+ updatedAt: now$105
169018
169102
  },
169019
169103
  providerTurns: [],
169020
169104
  messages: [],
@@ -169049,7 +169133,7 @@ const makeClaudeAdapterV2 = fn("makeClaudeAdapterV2")(function* (adapterOptions)
169049
169133
  updated.add(forked.sessionId);
169050
169134
  return updated;
169051
169135
  });
169052
- const now$104 = yield* now;
169136
+ const now$111 = yield* now;
169053
169137
  return makeProviderThread$2({
169054
169138
  idAllocator,
169055
169139
  providerInstanceId: adapterOptions.instanceId,
@@ -169061,7 +169145,7 @@ const makeClaudeAdapterV2 = fn("makeClaudeAdapterV2")(function* (adapterOptions)
169061
169145
  providerThreadId: forkInput.sourceProviderThread.id,
169062
169146
  ...forkInput.providerTurnId === void 0 ? {} : { providerTurnId: forkInput.providerTurnId }
169063
169147
  },
169064
- now: now$104
169148
+ now: now$111
169065
169149
  });
169066
169150
  }, (effect, forkInput) => effect.pipe(mapError((cause) => new ProviderAdapterForkThreadError({
169067
169151
  driver: CLAUDE_PROVIDER,
@@ -169518,6 +169602,7 @@ function claudeAuthStatus(capabilities) {
169518
169602
  return Boolean(capabilities.apiKeySource) && capabilities.apiKeySource !== "none" || capabilities.email || capabilities.subscriptionType ? "authenticated" : "unauthenticated";
169519
169603
  }
169520
169604
  const CAPABILITIES_PROBE_TIMEOUT_MS = 25e3;
169605
+ const CLAUDE_VERSION_CHECK_TIMEOUT_MS = 2e4;
169521
169606
  /**
169522
169607
  * Keep workspace-scoped command discovery intact while isolating the periodic
169523
169608
  * health check from configured MCP servers.
@@ -169690,7 +169775,7 @@ const checkClaudeProviderStatus = fn("checkClaudeProviderStatus")(function* (cla
169690
169775
  message: "Claude is disabled in P4 Code settings."
169691
169776
  }
169692
169777
  });
169693
- const versionProbe = yield* runClaudeCommand(claudeSettings, ["--version"], resolvedEnvironment, cwd).pipe(timeoutOption(DEFAULT_TIMEOUT_MS$5), result$1);
169778
+ const versionProbe = yield* runClaudeCommand(claudeSettings, ["--version"], resolvedEnvironment, cwd).pipe(timeoutOption(CLAUDE_VERSION_CHECK_TIMEOUT_MS), result$1);
169694
169779
  if (isFailure$1(versionProbe)) {
169695
169780
  const error = versionProbe.failure;
169696
169781
  yield* logWarning$1("Claude Agent CLI health check failed.", { errorTag: error._tag });
@@ -192468,6 +192553,7 @@ const isJsonRpcId = is$2(JsonRpcId);
192468
192553
  const isJsonRpcResponseEnvelope = is$2(JsonRpcResponseEnvelope);
192469
192554
  const isCodexAppServerError = is$2(CodexAppServerError);
192470
192555
  const MAX_BUFFERED_RAW_MESSAGES = 32;
192556
+ const MAX_INCOMING_MESSAGE_BYTES = 134217728;
192471
192557
  function isObject$2(value) {
192472
192558
  return typeof value === "object" && value !== null;
192473
192559
  }
@@ -192509,7 +192595,9 @@ const makeCodexAppServerPatchedProtocol = fn("makeCodexAppServerPatchedProtocol"
192509
192595
  const incomingRequests = yield* sliding(MAX_BUFFERED_RAW_MESSAGES);
192510
192596
  const pending = yield* make$226(/* @__PURE__ */ new Map());
192511
192597
  const nextRequestId = yield* make$226(1);
192598
+ const maxIncomingMessageBytes = options.maxIncomingMessageBytes ?? MAX_INCOMING_MESSAGE_BYTES;
192512
192599
  const remainder = [];
192600
+ let remainderBytes = 0;
192513
192601
  const terminationHandled = yield* make$226(false);
192514
192602
  const terminationFailure = yield* make$226(none$2());
192515
192603
  const terminationSignal = yield* make$236();
@@ -192614,18 +192702,28 @@ const makeCodexAppServerPatchedProtocol = fn("makeCodexAppServerPatchedProtocol"
192614
192702
  }
192615
192703
  })), flatMap$1(routeMessage));
192616
192704
  };
192617
- yield* options.stdio.stdin.pipe(interruptWhen(_await(terminationSignal)), decodeText$1(), runForEach((chunk) => sync$1(() => {
192618
- const lines = [];
192705
+ yield* options.stdio.stdin.pipe(interruptWhen(_await(terminationSignal)), decodeText$1(), runForEach(fnUntraced(function* (chunk) {
192619
192706
  let start = 0;
192620
- for (let newline = chunk.indexOf("\n"); newline !== -1; newline = chunk.indexOf("\n", start)) {
192621
- remainder.push(chunk.slice(start, newline));
192622
- lines.push(remainder.join("").replace(/\r$/, ""));
192707
+ while (start < chunk.length) {
192708
+ const newline = chunk.indexOf("\n", start);
192709
+ const fragment = chunk.slice(start, newline === -1 ? chunk.length : newline);
192710
+ remainderBytes += Buffer.byteLength(fragment, "utf8");
192711
+ if (remainderBytes > maxIncomingMessageBytes) {
192712
+ remainder.length = 0;
192713
+ return yield* new CodexAppServerTransportError({
192714
+ operation: "read-input-stream",
192715
+ cause: /* @__PURE__ */ new Error(`Incoming message exceeded ${maxIncomingMessageBytes} bytes.`)
192716
+ });
192717
+ }
192718
+ remainder.push(fragment);
192719
+ if (newline === -1) break;
192720
+ const line = remainder.join("").replace(/\r$/, "");
192623
192721
  remainder.length = 0;
192722
+ remainderBytes = 0;
192723
+ yield* handleLine(line);
192624
192724
  start = newline + 1;
192625
192725
  }
192626
- if (start < chunk.length) remainder.push(chunk.slice(start));
192627
- return lines;
192628
- }).pipe(flatMap$1((lines) => forEach(lines, handleLine, { discard: true })))), matchEffect({
192726
+ })), matchEffect({
192629
192727
  onFailure: (error) => handleTermination(() => succeed$1(normalizeIncomingError(error, "read-input-stream"))),
192630
192728
  onSuccess: () => sync$1(() => {
192631
192729
  const line = remainder.join("");
@@ -194367,6 +194465,17 @@ function codexErrorInfoCode(value) {
194367
194465
  if (typeof value !== "object" || value === null) return null;
194368
194466
  return Object.keys(value)[0] ?? null;
194369
194467
  }
194468
+ /**
194469
+ * Retry exhaustion only says why it failed through the last attempt's HTTP
194470
+ * status. Exhaustion on 429 is a usage or rate limit, so it keeps the Limited
194471
+ * state and resume controls; other statuses stay provider or transport errors.
194472
+ */
194473
+ function codexExhaustionHttpStatus(errorInfo) {
194474
+ return typeof errorInfo === "object" && errorInfo !== null && "responseTooManyFailedAttempts" in errorInfo ? errorInfo.responseTooManyFailedAttempts.httpStatusCode ?? null : null;
194475
+ }
194476
+ function codexUsageLimitError(code, errorInfo) {
194477
+ return code === "usageLimitExceeded" || code === "rateLimitExceeded" || codexExhaustionHttpStatus(errorInfo) === 429;
194478
+ }
194370
194479
  function isPersistentCodexDynamicTool(item) {
194371
194480
  const input = item.arguments;
194372
194481
  if (input === null || typeof input !== "object" || Array.isArray(input)) return false;
@@ -195135,12 +195244,12 @@ const makeCodexAdapterV2 = fn("makeCodexAdapterV2")(function* (adapterOptions) {
195135
195244
  return [next, updated];
195136
195245
  });
195137
195246
  const emitSubagentTaskUpdate = (input) => gen$1(function* () {
195138
- const now$95 = yield* now;
195247
+ const now$96 = yield* now;
195139
195248
  const prior = input.subagent.task;
195140
195249
  const settled = !isOrchestrationV2WorkActive(prior.status);
195141
195250
  if (settled && isOrchestrationV2WorkActive(input.status) && !input.reopen) return;
195142
195251
  const status = settled && !input.reopen ? prior.status : input.status;
195143
- const completedAt = isOrchestrationV2WorkActive(status) ? null : prior.completedAt ?? input.completedAt ?? now$95;
195252
+ const completedAt = isOrchestrationV2WorkActive(status) ? null : prior.completedAt ?? input.completedAt ?? now$96;
195144
195253
  const task = {
195145
195254
  ...prior,
195146
195255
  status,
@@ -195151,7 +195260,7 @@ const makeCodexAdapterV2 = fn("makeCodexAdapterV2")(function* (adapterOptions) {
195151
195260
  startedAt: input.startedAt ?? prior.startedAt,
195152
195261
  result: input.result === void 0 ? input.subagent.task.result : input.result,
195153
195262
  completedAt,
195154
- updatedAt: now$95
195263
+ updatedAt: now$96
195155
195264
  };
195156
195265
  input.subagent.task = task;
195157
195266
  if (input.startedAt !== void 0) input.subagent.startedAt = input.startedAt;
@@ -195259,14 +195368,14 @@ const makeCodexAdapterV2 = fn("makeCodexAdapterV2")(function* (adapterOptions) {
195259
195368
  result: null
195260
195369
  } : {}
195261
195370
  });
195262
- const now$94 = yield* now;
195371
+ const now$95 = yield* now;
195263
195372
  yield* emitProviderEvent({
195264
195373
  type: "provider_thread.updated",
195265
195374
  driver: CODEX_PROVIDER,
195266
195375
  providerThread: {
195267
195376
  ...subagent.providerThread,
195268
195377
  status: "active",
195269
- updatedAt: now$94
195378
+ updatedAt: now$95
195270
195379
  }
195271
195380
  });
195272
195381
  yield* emitProviderEvent({
@@ -196739,7 +196848,7 @@ const makeCodexAdapterV2 = fn("makeCodexAdapterV2")(function* (adapterOptions) {
196739
196848
  failure: makeProviderFailure({
196740
196849
  message: payload.error.additionalDetails?.trim() || payload.error.message,
196741
196850
  code: notificationCode,
196742
- class: notificationCode === "usageLimitExceeded" || notificationCode === "rateLimitExceeded" ? "usage_limit" : "provider_error"
196851
+ class: codexUsageLimitError(notificationCode, payload.error.codexErrorInfo) ? "usage_limit" : "provider_error"
196743
196852
  })
196744
196853
  };
196745
196854
  return;
@@ -196757,7 +196866,7 @@ const makeCodexAdapterV2 = fn("makeCodexAdapterV2")(function* (adapterOptions) {
196757
196866
  const failure = makeProviderFailure({
196758
196867
  message: additionalDetails === void 0 || additionalDetails.length === 0 ? payload.error.message : additionalDetails,
196759
196868
  code,
196760
- class: code === "usageLimitExceeded" || code === "rateLimitExceeded" ? "usage_limit" : code?.startsWith("http") === true || code?.startsWith("responseStream") === true ? "transport_error" : "provider_error",
196869
+ class: codexUsageLimitError(code, payload.error.codexErrorInfo) ? "usage_limit" : code?.startsWith("http") === true || code?.startsWith("responseStream") === true ? "transport_error" : "provider_error",
196761
196870
  retryable: true
196762
196871
  });
196763
196872
  const itemOrdinal = previous?.itemOrdinal ?? (yield* resolveItemOrdinal(context, `terminal-failure:${context.providerTurnId}`));
@@ -197465,10 +197574,13 @@ const makeCodexAdapterV2 = fn("makeCodexAdapterV2")(function* (adapterOptions) {
197465
197574
  const terminalStatus = providerTurnStatusToTerminal(input.status);
197466
197575
  if (terminalStatus === "failed") {
197467
197576
  const previousFailure = input.context.latestProviderFailure ?? input.providerRetry;
197468
- const failure = previousFailure !== void 0 && (input.failureMessage === void 0 || input.failureMessage === previousFailure.nativeMessage) && (input.failureCode === void 0 || input.failureCode === previousFailure.failure.code) ? previousFailure.failure : makeProviderFailure({
197577
+ const failureCode = input.failureErrorInfo === void 0 ? void 0 : codexErrorInfoCode(input.failureErrorInfo);
197578
+ const failureClass = codexUsageLimitError(failureCode ?? null, input.failureErrorInfo) ? "usage_limit" : "provider_error";
197579
+ const exhaustionStatus = codexExhaustionHttpStatus(input.failureErrorInfo);
197580
+ const failure = previousFailure !== void 0 && (input.failureMessage === void 0 || input.failureMessage === previousFailure.nativeMessage) && (failureCode === void 0 || failureCode === previousFailure.failure.code) && (exhaustionStatus === null || previousFailure.failure.class === failureClass) ? previousFailure.failure : makeProviderFailure({
197469
197581
  message: input.failureMessage,
197470
- code: input.failureCode,
197471
- class: input.failureCode === "usageLimitExceeded" || input.failureCode === "rateLimitExceeded" ? "usage_limit" : "provider_error"
197582
+ code: failureCode,
197583
+ class: failureClass
197472
197584
  });
197473
197585
  return {
197474
197586
  type: "turn.terminal",
@@ -197794,7 +197906,7 @@ const makeCodexAdapterV2 = fn("makeCodexAdapterV2")(function* (adapterOptions) {
197794
197906
  completedAt: codexTimestamp(payload.turn.completedAt),
197795
197907
  ...payload.turn.error?.message === void 0 ? {} : {
197796
197908
  failureMessage: payload.turn.error.message,
197797
- ...payload.turn.error.codexErrorInfo == null ? {} : { failureCode: codexErrorInfoCode(payload.turn.error.codexErrorInfo) }
197909
+ ...payload.turn.error.codexErrorInfo == null ? {} : { failureErrorInfo: payload.turn.error.codexErrorInfo }
197798
197910
  }
197799
197911
  });
197800
197912
  }));
@@ -197803,7 +197915,7 @@ const makeCodexAdapterV2 = fn("makeCodexAdapterV2")(function* (adapterOptions) {
197803
197915
  * assistant text, as Claude's own `/goal` output is.
197804
197916
  */
197805
197917
  const completeGoalCommandTurn = fnUntraced(function* (turnInput, reply) {
197806
- const now$96 = yield* now;
197918
+ const now$94 = yield* now;
197807
197919
  const nativeId = `goal-command:${turnInput.attemptId}`;
197808
197920
  const context = {
197809
197921
  input: turnInput,
@@ -197819,11 +197931,11 @@ const makeCodexAdapterV2 = fn("makeCodexAdapterV2")(function* (adapterOptions) {
197819
197931
  providerTurnOrdinal: turnInput.providerTurnOrdinal,
197820
197932
  providerNodeId: turnInput.rootNodeId,
197821
197933
  providerNodeKind: "root_turn",
197822
- providerNodeStartedAt: now$96,
197934
+ providerNodeStartedAt: now$94,
197823
197935
  itemParentNodeId: turnInput.rootNodeId,
197824
197936
  rootNodeId: turnInput.rootNodeId,
197825
197937
  subagent: null,
197826
- startedAt: now$96,
197938
+ startedAt: now$94,
197827
197939
  itemPositions: /* @__PURE__ */ new Map()
197828
197940
  };
197829
197941
  const providerTurn = {
@@ -197834,7 +197946,7 @@ const makeCodexAdapterV2 = fn("makeCodexAdapterV2")(function* (adapterOptions) {
197834
197946
  nativeTurnRef: null,
197835
197947
  ordinal: turnInput.providerTurnOrdinal,
197836
197948
  status: "running",
197837
- startedAt: now$96,
197949
+ startedAt: now$94,
197838
197950
  completedAt: null
197839
197951
  };
197840
197952
  yield* emitProviderEvent({
@@ -197870,7 +197982,7 @@ const makeCodexAdapterV2 = fn("makeCodexAdapterV2")(function* (adapterOptions) {
197870
197982
  providerTurn: {
197871
197983
  ...providerTurn,
197872
197984
  status: "completed",
197873
- completedAt: now$96
197985
+ completedAt: now$94
197874
197986
  }
197875
197987
  });
197876
197988
  yield* emitRootTerminal(context, {
@@ -238208,7 +238320,7 @@ function piThreadSnapshot(providerThread) {
238208
238320
  function piQuestion(questionId, method, title, event) {
238209
238321
  const options = method === "select" && Array.isArray(event["options"]) ? event["options"].filter((option) => typeof option === "string").map((option) => ({
238210
238322
  label: option || "Empty value",
238211
- description: option,
238323
+ description: option || "Empty value",
238212
238324
  value: option
238213
238325
  })) : method === "editor" ? [] : [{
238214
238326
  label: "Submit empty value",
@@ -240208,7 +240320,14 @@ const DEFAULT_OPEN_ROWS = 30;
240208
240320
  const TERMINAL_ENV_BLOCKLIST = /* @__PURE__ */ new Set([
240209
240321
  "PORT",
240210
240322
  "ELECTRON_RENDERER_PORT",
240211
- "ELECTRON_RUN_AS_NODE"
240323
+ "ELECTRON_RUN_AS_NODE",
240324
+ "TMUX",
240325
+ "TMUX_PANE",
240326
+ "STY",
240327
+ "WINDOW",
240328
+ "ZELLIJ",
240329
+ "ZELLIJ_SESSION_NAME",
240330
+ "ZELLIJ_PANE_ID"
240212
240331
  ]);
240213
240332
  const nowIso$4 = map$9(now, formatIso);
240214
240333
  const MAX_TERMINAL_LABEL_LENGTH = 128;
@@ -240934,6 +241053,9 @@ function createTerminalSpawnEnv(baseEnv, runtimeEnv, platform, home) {
240934
241053
  spawnEnv[existingKey ?? key] = key === "CODEX_HOME" || key === "CLAUDE_CONFIG_DIR" ? expandHomePath(value, home) : value;
240935
241054
  }
240936
241055
  if (!spawnEnv.COLORTERM && runtimeEnv?.COLORTERM === void 0) spawnEnv.COLORTERM = "truecolor";
241056
+ const fishFeaturesKey = platform === "win32" ? Object.keys(spawnEnv).find((candidate) => candidate.toLowerCase() === "fish_features") ?? "fish_features" : "fish_features";
241057
+ const fishFeatures = spawnEnv[fishFeaturesKey];
241058
+ if (!fishFeatures?.includes("query-term")) spawnEnv[fishFeaturesKey] = fishFeatures ? `${fishFeatures},no-query-term` : "no-query-term";
240937
241059
  return stripAppImageRuntimeEnv(spawnEnv);
240938
241060
  }
240939
241061
  function normalizedRuntimeEnv(env) {
@@ -261735,7 +261857,7 @@ const makeOrchestrator = fn("orchestrationV2.Orchestrator.layer")(function* () {
261735
261857
  cause: `Queued run ${queuedRun.id} is missing projection state.`
261736
261858
  });
261737
261859
  const commandId = CommandId.make(`command:system:start-queued:${queuedRun.id}`);
261738
- const now$22 = yield* now;
261860
+ const now$21 = yield* now;
261739
261861
  const selectionChanged = !modelSelectionsEqual(projection.thread.modelSelection, queuedRun.modelSelection);
261740
261862
  const switchPlan = selectionChanged ? yield* providerSwitchService.plan({
261741
261863
  projection,
@@ -261800,7 +261922,7 @@ const makeOrchestrator = fn("orchestrationV2.Orchestrator.layer")(function* () {
261800
261922
  runs: projection.runs,
261801
261923
  strategy: handoffStrategy,
261802
261924
  items: [...needsFullContext && latestCompletedRun !== void 0 ? legacyImportItems : [], ...yield* readHandoffItems(threadId, coveredRuns.map((run) => run.id))],
261803
- createdAt: now$22
261925
+ createdAt: now$21
261804
261926
  }).pipe(mapError((cause) => new OrchestratorDispatchError({
261805
261927
  commandId,
261806
261928
  commandType: "message.dispatch",
@@ -261812,7 +261934,7 @@ const makeOrchestrator = fn("orchestrationV2.Orchestrator.layer")(function* () {
261812
261934
  toProviderThreadId: queuedProviderThread.id,
261813
261935
  toProviderInstanceId: queuedRun.providerInstanceId,
261814
261936
  items: legacyImportItems,
261815
- createdAt: now$22
261937
+ createdAt: now$21
261816
261938
  }).pipe(mapError((cause) => new OrchestratorDispatchError({
261817
261939
  commandId,
261818
261940
  commandType: "message.dispatch",
@@ -261828,7 +261950,7 @@ const makeOrchestrator = fn("orchestrationV2.Orchestrator.layer")(function* () {
261828
261950
  rootNodeId: rootNode.id,
261829
261951
  providerThreadId: queuedProviderThread.id,
261830
261952
  cwd: resolvedRuntimePolicy.cwd ?? projection.thread.worktreePath ?? process.cwd(),
261831
- createdAt: now$22
261953
+ createdAt: now$21
261832
261954
  })), mapError((cause) => new OrchestratorDispatchError({
261833
261955
  commandId,
261834
261956
  commandType: "message.dispatch",
@@ -261850,7 +261972,7 @@ const makeOrchestrator = fn("orchestrationV2.Orchestrator.layer")(function* () {
261850
261972
  firstRunOrdinal: queuedProviderThread.firstRunOrdinal ?? queuedRun.ordinal,
261851
261973
  lastRunOrdinal: queuedRun.ordinal,
261852
261974
  handoffIds: appendContextHandoffId(appendContextHandoffId(queuedProviderThread.handoffIds, handoff?.id ?? null), legacyImportRecoveryHandoff?.id ?? null),
261853
- updatedAt: now$22
261975
+ updatedAt: now$21
261854
261976
  };
261855
261977
  const startingRun = {
261856
261978
  ...queuedRun,
@@ -261888,9 +262010,9 @@ const makeOrchestrator = fn("orchestrationV2.Orchestrator.layer")(function* () {
261888
262010
  ...queuedMessage.senderThreadId === void 0 ? {} : { senderThreadId: queuedMessage.senderThreadId }
261889
262011
  },
261890
262012
  inputIntent: "queued_turn",
261891
- startedAt: now$22,
261892
- completedAt: now$22,
261893
- updatedAt: now$22
262013
+ startedAt: now$21,
262014
+ completedAt: now$21,
262015
+ updatedAt: now$21
261894
262016
  };
261895
262017
  const handoffTurnItem = activeHandoff === null ? null : {
261896
262018
  id: idAllocator.derive.runSignalTurnItem({
@@ -261907,9 +262029,9 @@ const makeOrchestrator = fn("orchestrationV2.Orchestrator.layer")(function* () {
261907
262029
  ordinal: queuedRun.ordinal * 100 - 1,
261908
262030
  status: "completed",
261909
262031
  title: handoff === null ? "Imported context" : "Provider handoff",
261910
- startedAt: now$22,
261911
- completedAt: now$22,
261912
- updatedAt: now$22,
262032
+ startedAt: now$21,
262033
+ completedAt: now$21,
262034
+ updatedAt: now$21,
261913
262035
  type: "handoff",
261914
262036
  contextHandoffId: activeHandoff.id,
261915
262037
  fromProviderThreadIds: activeHandoff.fromProviderThreadIds,
@@ -261927,7 +262049,7 @@ const makeOrchestrator = fn("orchestrationV2.Orchestrator.layer")(function* () {
261927
262049
  runId: queuedRun.id,
261928
262050
  nodeId: rootNode.id,
261929
262051
  providerInstanceId: queuedRun.providerInstanceId,
261930
- occurredAt: now$22,
262052
+ occurredAt: now$21,
261931
262053
  payload: checkpointScope
261932
262054
  }, {
261933
262055
  type: "node.updated",
@@ -261935,7 +262057,7 @@ const makeOrchestrator = fn("orchestrationV2.Orchestrator.layer")(function* () {
261935
262057
  runId: queuedRun.id,
261936
262058
  nodeId: rootNode.id,
261937
262059
  providerInstanceId: queuedRun.providerInstanceId,
261938
- occurredAt: now$22,
262060
+ occurredAt: now$21,
261939
262061
  payload: {
261940
262062
  ...rootNode,
261941
262063
  checkpointScopeId: checkpointScope.id
@@ -261947,12 +262069,12 @@ const makeOrchestrator = fn("orchestrationV2.Orchestrator.layer")(function* () {
261947
262069
  type: queuedRun.providerInstanceId === projection.thread.providerInstanceId ? "thread.model-selection-updated" : "thread.provider-switched",
261948
262070
  threadId,
261949
262071
  providerInstanceId: queuedRun.providerInstanceId,
261950
- occurredAt: now$22,
262072
+ occurredAt: now$21,
261951
262073
  payload: {
261952
262074
  ...projection.thread,
261953
262075
  providerInstanceId: queuedRun.providerInstanceId,
261954
262076
  modelSelection: queuedRun.modelSelection,
261955
- updatedAt: now$22
262077
+ updatedAt: now$21
261956
262078
  }
261957
262079
  }] : [],
261958
262080
  ...handoff === null || transferId === null || latestHandoffRun === void 0 ? [] : [{
@@ -261960,7 +262082,7 @@ const makeOrchestrator = fn("orchestrationV2.Orchestrator.layer")(function* () {
261960
262082
  threadId,
261961
262083
  runId: queuedRun.id,
261962
262084
  providerInstanceId: queuedRun.providerInstanceId,
261963
- occurredAt: now$22,
262085
+ occurredAt: now$21,
261964
262086
  payload: {
261965
262087
  id: transferId,
261966
262088
  type: "provider_handoff",
@@ -261978,16 +262100,16 @@ const makeOrchestrator = fn("orchestrationV2.Orchestrator.layer")(function* () {
261978
262100
  },
261979
262101
  createdBy: queuedMessage.createdBy,
261980
262102
  error: null,
261981
- createdAt: now$22,
261982
- updatedAt: now$22,
261983
- consumedAt: now$22
262103
+ createdAt: now$21,
262104
+ updatedAt: now$21,
262105
+ consumedAt: now$21
261984
262106
  }
261985
262107
  }, {
261986
262108
  type: "context-handoff.updated",
261987
262109
  threadId,
261988
262110
  runId: queuedRun.id,
261989
262111
  providerInstanceId: queuedRun.providerInstanceId,
261990
- occurredAt: now$22,
262112
+ occurredAt: now$21,
261991
262113
  payload: handoff
261992
262114
  }],
261993
262115
  ...legacyImportRecoveryHandoff === null ? [] : [{
@@ -261995,7 +262117,7 @@ const makeOrchestrator = fn("orchestrationV2.Orchestrator.layer")(function* () {
261995
262117
  threadId,
261996
262118
  runId: queuedRun.id,
261997
262119
  providerInstanceId: queuedRun.providerInstanceId,
261998
- occurredAt: now$22,
262120
+ occurredAt: now$21,
261999
262121
  payload: legacyImportRecoveryHandoff
262000
262122
  }],
262001
262123
  ...handoffTurnItem === null ? [] : [{
@@ -262004,7 +262126,7 @@ const makeOrchestrator = fn("orchestrationV2.Orchestrator.layer")(function* () {
262004
262126
  runId: queuedRun.id,
262005
262127
  nodeId: rootNodeId,
262006
262128
  providerInstanceId: queuedRun.providerInstanceId,
262007
- occurredAt: now$22,
262129
+ occurredAt: now$21,
262008
262130
  payload: handoffTurnItem
262009
262131
  }],
262010
262132
  ...sessionsToDetach.map((session) => ({
@@ -262012,10 +262134,10 @@ const makeOrchestrator = fn("orchestrationV2.Orchestrator.layer")(function* () {
262012
262134
  threadId,
262013
262135
  driver: session.driver,
262014
262136
  providerInstanceId: session.providerInstanceId,
262015
- occurredAt: now$22,
262137
+ occurredAt: now$21,
262016
262138
  payload: {
262017
262139
  providerSessionId: session.id,
262018
- detachedAt: now$22,
262140
+ detachedAt: now$21,
262019
262141
  reason: "Provider or model selection changed."
262020
262142
  }
262021
262143
  })),
@@ -262024,7 +262146,7 @@ const makeOrchestrator = fn("orchestrationV2.Orchestrator.layer")(function* () {
262024
262146
  type: "provider-thread.updated",
262025
262147
  threadId,
262026
262148
  providerInstanceId: queuedRun.providerInstanceId,
262027
- occurredAt: now$22,
262149
+ occurredAt: now$21,
262028
262150
  payload: providerThread
262029
262151
  },
262030
262152
  {
@@ -262033,7 +262155,7 @@ const makeOrchestrator = fn("orchestrationV2.Orchestrator.layer")(function* () {
262033
262155
  runId: queuedRun.id,
262034
262156
  nodeId: rootNodeId,
262035
262157
  providerInstanceId: queuedRun.providerInstanceId,
262036
- occurredAt: now$22,
262158
+ occurredAt: now$21,
262037
262159
  payload: notificationTurnItem(userTurnItem, queuedMessage, projection.subagents)
262038
262160
  },
262039
262161
  {
@@ -262042,7 +262164,7 @@ const makeOrchestrator = fn("orchestrationV2.Orchestrator.layer")(function* () {
262042
262164
  runId: queuedRun.id,
262043
262165
  nodeId: rootNodeId,
262044
262166
  providerInstanceId: queuedRun.providerInstanceId,
262045
- occurredAt: now$22,
262167
+ occurredAt: now$21,
262046
262168
  payload: startingRun
262047
262169
  }
262048
262170
  ], [...sessionsToDetach.map((session) => ({
@@ -262103,7 +262225,7 @@ const makeOrchestrator = fn("orchestrationV2.Orchestrator.layer")(function* () {
262103
262225
  cause: `Delegated task ${command.taskId} is not an app-owned task of thread ${command.parentThreadId}.`
262104
262226
  });
262105
262227
  const state = command.type === "delegated_task.completion-delivery.acknowledge" ? "acknowledged" : "disposed";
262106
- const now$36 = yield* now;
262228
+ const now$33 = yield* now;
262107
262229
  const emitEvent = emit(events, command);
262108
262230
  if (task.completionDelivery?.state === state || command.type === "delegated_task.completion-delivery.acknowledge" && task.completionDelivery?.state === "disposed") {
262109
262231
  yield* emitEvent({
@@ -262113,7 +262235,7 @@ const makeOrchestrator = fn("orchestrationV2.Orchestrator.layer")(function* () {
262113
262235
  nodeId: task.id,
262114
262236
  driver: task.driver,
262115
262237
  providerInstanceId: task.providerInstanceId,
262116
- occurredAt: now$36,
262238
+ occurredAt: now$33,
262117
262239
  payload: task
262118
262240
  });
262119
262241
  return;
@@ -262124,7 +262246,7 @@ const makeOrchestrator = fn("orchestrationV2.Orchestrator.layer")(function* () {
262124
262246
  state,
262125
262247
  observedByRunId: command.type === "delegated_task.completion-delivery.acknowledge" ? command.observedByRunId : null
262126
262248
  },
262127
- updatedAt: now$36
262249
+ updatedAt: now$33
262128
262250
  };
262129
262251
  yield* emitEvent({
262130
262252
  type: "subagent.updated",
@@ -262133,7 +262255,7 @@ const makeOrchestrator = fn("orchestrationV2.Orchestrator.layer")(function* () {
262133
262255
  nodeId: task.id,
262134
262256
  driver: task.driver,
262135
262257
  providerInstanceId: task.providerInstanceId,
262136
- occurredAt: now$36,
262258
+ occurredAt: now$33,
262137
262259
  payload: updatedTask
262138
262260
  });
262139
262261
  const parentRun = task.runId === null ? void 0 : projection.runs.find((candidate) => candidate.id === task.runId);
@@ -262157,7 +262279,7 @@ const makeOrchestrator = fn("orchestrationV2.Orchestrator.layer")(function* () {
262157
262279
  runId: parentRun.id,
262158
262280
  ...parentRun.rootNodeId === null ? {} : { nodeId: parentRun.rootNodeId },
262159
262281
  providerInstanceId: parentRun.providerInstanceId,
262160
- occurredAt: now$36,
262282
+ occurredAt: now$33,
262161
262283
  payload: {
262162
262284
  ...parentRun,
262163
262285
  delegatedCompletion: updatedCohort
@@ -262170,7 +262292,7 @@ const makeOrchestrator = fn("orchestrationV2.Orchestrator.layer")(function* () {
262170
262292
  events,
262171
262293
  projection,
262172
262294
  run: deliveryRun,
262173
- now: now$36
262295
+ now: now$33
262174
262296
  });
262175
262297
  return;
262176
262298
  }
@@ -262181,7 +262303,7 @@ const makeOrchestrator = fn("orchestrationV2.Orchestrator.layer")(function* () {
262181
262303
  runId: deliveryRun.id,
262182
262304
  ...deliveryRun.rootNodeId === null ? {} : { nodeId: deliveryRun.rootNodeId },
262183
262305
  providerInstanceId: deliveryRun.providerInstanceId,
262184
- occurredAt: now$36,
262306
+ occurredAt: now$33,
262185
262307
  payload: {
262186
262308
  ...message,
262187
262309
  text: delegatedCompletionWakeDetail(remainingTaskIds),
@@ -262190,7 +262312,7 @@ const makeOrchestrator = fn("orchestrationV2.Orchestrator.layer")(function* () {
262190
262312
  generation: delivery.generation,
262191
262313
  taskIds: remainingTaskIds
262192
262314
  },
262193
- updatedAt: now$36
262315
+ updatedAt: now$33
262194
262316
  }
262195
262317
  });
262196
262318
  }
@@ -262557,7 +262679,7 @@ const makeOrchestrator = fn("orchestrationV2.Orchestrator.layer")(function* () {
262557
262679
  targetModelSelection: command.modelSelection
262558
262680
  }).pipe(mapDispatchError(command));
262559
262681
  }) : null;
262560
- const now$50 = yield* now;
262682
+ const now$51 = yield* now;
262561
262683
  if (command.type === "thread.metadata.update" && command.limitRecovery != null) {
262562
262684
  const projection = yield* loadProjectionForCommand(command, [
262563
262685
  "runs",
@@ -262567,7 +262689,7 @@ const makeOrchestrator = fn("orchestrationV2.Orchestrator.layer")(function* () {
262567
262689
  const run = usageLimitBlockedRun(projection.runs, projection.turnItems, null);
262568
262690
  const failure = latestRootProviderFailure(run, projection.turnItems);
262569
262691
  const resetMs = Date.parse(command.limitRecovery.resetAt);
262570
- if (command.limitRecovery.snooze === true && resetMs <= toEpochMillis(now$50)) return yield* new OrchestratorDispatchError({
262692
+ if (command.limitRecovery.snooze === true && resetMs <= toEpochMillis(now$51)) return yield* new OrchestratorDispatchError({
262571
262693
  commandId: command.commandId,
262572
262694
  commandType: command.type,
262573
262695
  cause: "The reset time has passed. Retry the thread manually."
@@ -262582,7 +262704,7 @@ const makeOrchestrator = fn("orchestrationV2.Orchestrator.layer")(function* () {
262582
262704
  if (command.type === "thread.snooze") {
262583
262705
  const projection = yield* loadProjectionForCommand(command, ["runs", "runtimeRequests"], { turnItemTypes: [] });
262584
262706
  const parsedSnoozedUntil = make$240(command.snoozedUntil);
262585
- if (isNone(parsedSnoozedUntil) || toEpochMillis(parsedSnoozedUntil.value) <= toEpochMillis(now$50)) return yield* new OrchestratorDispatchError({
262707
+ if (isNone(parsedSnoozedUntil) || toEpochMillis(parsedSnoozedUntil.value) <= toEpochMillis(now$51)) return yield* new OrchestratorDispatchError({
262586
262708
  commandId: command.commandId,
262587
262709
  commandType: command.type,
262588
262710
  cause: `Thread ${command.threadId} snooze wake time ${command.snoozedUntil} is not in the future.`
@@ -262616,15 +262738,15 @@ const makeOrchestrator = fn("orchestrationV2.Orchestrator.layer")(function* () {
262616
262738
  switch (command.type) {
262617
262739
  case "thread.archive": return {
262618
262740
  ...thread,
262619
- archivedAt: now$50,
262741
+ archivedAt: now$51,
262620
262742
  titleRegeneration: null,
262621
262743
  pullRequests: thread.pullRequests?.map((link) => withPullRequestWatch(link, void 0)),
262622
- updatedAt: now$50
262744
+ updatedAt: now$51
262623
262745
  };
262624
262746
  case "thread.unarchive": return {
262625
262747
  ...thread,
262626
262748
  archivedAt: null,
262627
- updatedAt: now$50
262749
+ updatedAt: now$51
262628
262750
  };
262629
262751
  case "thread.settle": {
262630
262752
  const wasPinned = thread.pinnedAt != null;
@@ -262632,13 +262754,13 @@ const makeOrchestrator = fn("orchestrationV2.Orchestrator.layer")(function* () {
262632
262754
  return {
262633
262755
  ...thread,
262634
262756
  settledOverride: "settled",
262635
- settledAt: alreadySettled ? thread.settledAt : command.settledAt ?? now$50,
262757
+ settledAt: alreadySettled ? thread.settledAt : command.settledAt ?? now$51,
262636
262758
  pullRequests: thread.pullRequests?.map((link) => withPullRequestWatch(link, void 0)),
262637
262759
  unsettledAt: null,
262638
262760
  pinnedAt: null,
262639
262761
  pinOrderKey: null,
262640
262762
  activeOrderKey: null,
262641
- updatedAt: alreadySettled ? thread.updatedAt : now$50
262763
+ updatedAt: alreadySettled ? thread.updatedAt : now$51
262642
262764
  };
262643
262765
  }
262644
262766
  case "thread.unsettle": {
@@ -262647,8 +262769,8 @@ const makeOrchestrator = fn("orchestrationV2.Orchestrator.layer")(function* () {
262647
262769
  ...thread,
262648
262770
  settledOverride: "active",
262649
262771
  settledAt: null,
262650
- unsettledAt: alreadyPinnedActive ? thread.unsettledAt ?? null : now$50,
262651
- updatedAt: alreadyPinnedActive ? thread.updatedAt : now$50
262772
+ unsettledAt: alreadyPinnedActive ? thread.unsettledAt ?? null : now$51,
262773
+ updatedAt: alreadyPinnedActive ? thread.updatedAt : now$51
262652
262774
  };
262653
262775
  }
262654
262776
  case "thread.snooze": {
@@ -262660,8 +262782,8 @@ const makeOrchestrator = fn("orchestrationV2.Orchestrator.layer")(function* () {
262660
262782
  ...thread.limitRecovery,
262661
262783
  snooze: false
262662
262784
  } : null,
262663
- snoozedAt: existingSnoozedAt ?? now$50,
262664
- updatedAt: existingSnoozedAt === null ? now$50 : thread.updatedAt
262785
+ snoozedAt: existingSnoozedAt ?? now$51,
262786
+ updatedAt: existingSnoozedAt === null ? now$51 : thread.updatedAt
262665
262787
  };
262666
262788
  }
262667
262789
  case "thread.unsnooze": {
@@ -262670,16 +262792,16 @@ const makeOrchestrator = fn("orchestrationV2.Orchestrator.layer")(function* () {
262670
262792
  ...thread,
262671
262793
  snoozedUntil: null,
262672
262794
  snoozedAt: null,
262673
- lastSnoozeWakeAt: alreadyAwake ? thread.lastSnoozeWakeAt : now$50,
262674
- updatedAt: alreadyAwake ? thread.updatedAt : now$50
262795
+ lastSnoozeWakeAt: alreadyAwake ? thread.lastSnoozeWakeAt : now$51,
262796
+ updatedAt: alreadyAwake ? thread.updatedAt : now$51
262675
262797
  };
262676
262798
  }
262677
262799
  case "thread.auto-settle.set": {
262678
262800
  const unchanged = command.enabled === (thread.autoSettleDisabledAt == null);
262679
262801
  return {
262680
262802
  ...thread,
262681
- autoSettleDisabledAt: command.enabled ? null : thread.autoSettleDisabledAt ?? now$50,
262682
- updatedAt: unchanged ? thread.updatedAt : now$50
262803
+ autoSettleDisabledAt: command.enabled ? null : thread.autoSettleDisabledAt ?? now$51,
262804
+ updatedAt: unchanged ? thread.updatedAt : now$51
262683
262805
  };
262684
262806
  }
262685
262807
  case "thread.pin": {
@@ -262687,14 +262809,14 @@ const makeOrchestrator = fn("orchestrationV2.Orchestrator.layer")(function* () {
262687
262809
  const promotes = thread.settledOverride === "settled" || thread.snoozedUntil != null;
262688
262810
  return {
262689
262811
  ...thread,
262690
- pinnedAt: alreadyPinned ? thread.pinnedAt : now$50,
262812
+ pinnedAt: alreadyPinned ? thread.pinnedAt : now$51,
262691
262813
  ...alreadyPinned || command.orderKey === void 0 ? {} : { pinOrderKey: command.orderKey },
262692
262814
  settledOverride: thread.settledOverride === "settled" ? "active" : thread.settledOverride,
262693
262815
  settledAt: thread.settledOverride === "settled" ? null : thread.settledAt,
262694
262816
  snoozedUntil: null,
262695
262817
  snoozedAt: null,
262696
- lastSnoozeWakeAt: thread.snoozedUntil == null ? thread.lastSnoozeWakeAt : now$50,
262697
- updatedAt: alreadyPinned && !promotes ? thread.updatedAt : now$50
262818
+ lastSnoozeWakeAt: thread.snoozedUntil == null ? thread.lastSnoozeWakeAt : now$51,
262819
+ updatedAt: alreadyPinned && !promotes ? thread.updatedAt : now$51
262698
262820
  };
262699
262821
  }
262700
262822
  case "thread.unpin": {
@@ -262703,7 +262825,7 @@ const makeOrchestrator = fn("orchestrationV2.Orchestrator.layer")(function* () {
262703
262825
  ...thread,
262704
262826
  pinnedAt: null,
262705
262827
  pinOrderKey: null,
262706
- updatedAt: alreadyUnpinned ? thread.updatedAt : now$50
262828
+ updatedAt: alreadyUnpinned ? thread.updatedAt : now$51
262707
262829
  };
262708
262830
  }
262709
262831
  case "thread.pin.reorder": {
@@ -262711,7 +262833,7 @@ const makeOrchestrator = fn("orchestrationV2.Orchestrator.layer")(function* () {
262711
262833
  return {
262712
262834
  ...thread,
262713
262835
  pinOrderKey: command.orderKey,
262714
- updatedAt: keyUnchanged ? thread.updatedAt : now$50
262836
+ updatedAt: keyUnchanged ? thread.updatedAt : now$51
262715
262837
  };
262716
262838
  }
262717
262839
  case "thread.active.reorder": return {
@@ -262736,23 +262858,23 @@ const makeOrchestrator = fn("orchestrationV2.Orchestrator.layer")(function* () {
262736
262858
  ...command.title === void 0 ? {} : { title: command.title },
262737
262859
  ...command.sideChat === void 0 ? {} : { sideChat: command.sideChat },
262738
262860
  ...command.limitRecovery === void 0 ? {} : { limitRecovery },
262739
- ...command.limitRecovery !== void 0 && limitRecovery?.snooze === true && Date.parse(limitRecovery.resetAt) > toEpochMillis(now$50) ? {
262861
+ ...command.limitRecovery !== void 0 && limitRecovery?.snooze === true && Date.parse(limitRecovery.resetAt) > toEpochMillis(now$51) ? {
262740
262862
  snoozedUntil: makeUnsafe$11(limitRecovery.resetAt),
262741
- snoozedAt: now$50
262863
+ snoozedAt: now$51
262742
262864
  } : command.limitRecovery !== void 0 && thread.limitRecovery?.snooze && thread.snoozedUntil != null && toEpochMillis(thread.snoozedUntil) === Date.parse(thread.limitRecovery.resetAt) ? {
262743
262865
  snoozedUntil: null,
262744
262866
  snoozedAt: null,
262745
- lastSnoozeWakeAt: now$50
262867
+ lastSnoozeWakeAt: now$51
262746
262868
  } : {},
262747
262869
  ...command.branch === void 0 ? {} : { branch: command.branch },
262748
262870
  ...command.worktreePath === void 0 ? {} : { worktreePath: command.worktreePath },
262749
262871
  ...command.linkedPullRequest === void 0 ? {} : {
262750
262872
  linkedPullRequest: command.linkedPullRequest,
262751
- pullRequests: [...threadPullRequestsOf(thread).filter((link) => !(thread.linkedPullRequest && threadPullRequestKeysEqual(link, legacyThreadPullRequestKey(thread.linkedPullRequest))) && !(command.linkedPullRequest && threadPullRequestKeysEqual(link, legacyThreadPullRequestKey(command.linkedPullRequest)))), ...command.linkedPullRequest ? [legacyPullRequestLink(thread, command.linkedPullRequest, now$50)] : []]
262873
+ pullRequests: [...threadPullRequestsOf(thread).filter((link) => !(thread.linkedPullRequest && threadPullRequestKeysEqual(link, legacyThreadPullRequestKey(thread.linkedPullRequest))) && !(command.linkedPullRequest && threadPullRequestKeysEqual(link, legacyThreadPullRequestKey(command.linkedPullRequest)))), ...command.linkedPullRequest ? [legacyPullRequestLink(thread, command.linkedPullRequest, now$51)] : []]
262752
262874
  },
262753
262875
  ...command.regenerateTitle === true ? { titleRegeneration: {
262754
262876
  requestId: command.commandId,
262755
- startedAt: now$50
262877
+ startedAt: now$51
262756
262878
  } } : command.regenerateTitle === false || command.title !== void 0 ? { titleRegeneration: null } : {},
262757
262879
  ...movingProject ? {
262758
262880
  projectId: command.projectId,
@@ -262764,7 +262886,7 @@ const makeOrchestrator = fn("orchestrationV2.Orchestrator.layer")(function* () {
262764
262886
  pullRequests: [],
262765
262887
  limitRecovery: null
262766
262888
  } : {},
262767
- updatedAt: now$50
262889
+ updatedAt: now$51
262768
262890
  };
262769
262891
  }
262770
262892
  case "thread.design.link":
@@ -262776,7 +262898,7 @@ const makeOrchestrator = fn("orchestrationV2.Orchestrator.layer")(function* () {
262776
262898
  return {
262777
262899
  ...thread,
262778
262900
  designs: links.filter((link) => link !== existing),
262779
- updatedAt: now$50
262901
+ updatedAt: now$51
262780
262902
  };
262781
262903
  }
262782
262904
  if (existing && (existing.source === "manual" || command.source === "agent")) return thread;
@@ -262788,9 +262910,9 @@ const makeOrchestrator = fn("orchestrationV2.Orchestrator.layer")(function* () {
262788
262910
  } : link) : [...links, {
262789
262911
  path: command.path,
262790
262912
  source: command.source,
262791
- linkedAt: formatIso(now$50)
262913
+ linkedAt: formatIso(now$51)
262792
262914
  }],
262793
- updatedAt: now$50
262915
+ updatedAt: now$51
262794
262916
  };
262795
262917
  }
262796
262918
  case "thread.pull-request.link":
@@ -262811,7 +262933,7 @@ const makeOrchestrator = fn("orchestrationV2.Orchestrator.layer")(function* () {
262811
262933
  ...key,
262812
262934
  url: command.url,
262813
262935
  source: command.source,
262814
- linkedAt: formatIso(now$50),
262936
+ linkedAt: formatIso(now$51),
262815
262937
  snapshot: null,
262816
262938
  stack: null
262817
262939
  };
@@ -262822,7 +262944,7 @@ const makeOrchestrator = fn("orchestrationV2.Orchestrator.layer")(function* () {
262822
262944
  ...branchKey,
262823
262945
  url: branch.url,
262824
262946
  source: "manual",
262825
- linkedAt: formatIso(now$50),
262947
+ linkedAt: formatIso(now$51),
262826
262948
  snapshot: null,
262827
262949
  stack: null
262828
262950
  }] : [],
@@ -262847,13 +262969,13 @@ const makeOrchestrator = fn("orchestrationV2.Orchestrator.layer")(function* () {
262847
262969
  ...thread,
262848
262970
  pullRequests,
262849
262971
  linkedPullRequest: thread.linkedPullRequest && pullRequests.some((link) => link.source !== "stack-dismissed" && threadPullRequestKeysEqual(link, legacyThreadPullRequestKey(thread.linkedPullRequest))) ? thread.linkedPullRequest : null,
262850
- updatedAt: command.type === "thread.pull-request-link.sync" ? thread.updatedAt : now$50
262972
+ updatedAt: command.type === "thread.pull-request-link.sync" ? thread.updatedAt : now$51
262851
262973
  };
262852
262974
  }
262853
262975
  case "thread.pull-request.watch":
262854
262976
  case "thread.pull-request-watch.sync": {
262855
262977
  const key = normalizeThreadPullRequestKey(command);
262856
- const startedAt = formatIso(now$50);
262978
+ const startedAt = formatIso(now$51);
262857
262979
  const linked = threadPullRequestsOf(thread);
262858
262980
  const visible = (link) => link.source !== "stack-dismissed" && threadPullRequestKeysEqual(link, key);
262859
262981
  const links = command.type === "thread.pull-request.watch" && command.watching && command.link !== void 0 && !linked.some(visible) ? [...linked.filter((link) => !threadPullRequestKeysEqual(link, key)), {
@@ -262881,7 +263003,7 @@ const makeOrchestrator = fn("orchestrationV2.Orchestrator.layer")(function* () {
262881
263003
  return {
262882
263004
  ...thread,
262883
263005
  pullRequests: links.map((link) => link === existing ? withPullRequestWatch(link, watch) : link),
262884
- updatedAt: command.type === "thread.pull-request.watch" ? now$50 : thread.updatedAt
263006
+ updatedAt: command.type === "thread.pull-request.watch" ? now$51 : thread.updatedAt
262885
263007
  };
262886
263008
  }
262887
263009
  case "thread.pull-request.sync": return {
@@ -262889,7 +263011,7 @@ const makeOrchestrator = fn("orchestrationV2.Orchestrator.layer")(function* () {
262889
263011
  branchPullRequest: command.branchPullRequest,
262890
263012
  ...command.linkedPullRequest === void 0 ? {} : {
262891
263013
  linkedPullRequest: command.linkedPullRequest,
262892
- pullRequests: [...threadPullRequestsOf(thread).filter((link) => !(thread.linkedPullRequest && threadPullRequestKeysEqual(link, legacyThreadPullRequestKey(thread.linkedPullRequest))) && !(command.linkedPullRequest && threadPullRequestKeysEqual(link, legacyThreadPullRequestKey(command.linkedPullRequest)))), ...command.linkedPullRequest ? [legacyPullRequestLink(thread, command.linkedPullRequest, now$50)] : []]
263014
+ pullRequests: [...threadPullRequestsOf(thread).filter((link) => !(thread.linkedPullRequest && threadPullRequestKeysEqual(link, legacyThreadPullRequestKey(thread.linkedPullRequest))) && !(command.linkedPullRequest && threadPullRequestKeysEqual(link, legacyThreadPullRequestKey(command.linkedPullRequest)))), ...command.linkedPullRequest ? [legacyPullRequestLink(thread, command.linkedPullRequest, now$51)] : []]
262893
263015
  },
262894
263016
  updatedAt: thread.updatedAt
262895
263017
  };
@@ -262897,24 +263019,24 @@ const makeOrchestrator = fn("orchestrationV2.Orchestrator.layer")(function* () {
262897
263019
  ...thread,
262898
263020
  ...command.title === void 0 ? {} : { title: command.title },
262899
263021
  titleRegeneration: null,
262900
- updatedAt: now$50
263022
+ updatedAt: now$51
262901
263023
  } : thread;
262902
263024
  case "thread.runtime-mode.set": return {
262903
263025
  ...thread,
262904
263026
  runtimeMode: command.runtimeMode,
262905
- updatedAt: now$50
263027
+ updatedAt: now$51
262906
263028
  };
262907
263029
  case "thread.interaction-mode.set": return {
262908
263030
  ...thread,
262909
263031
  interactionMode: command.interactionMode,
262910
- updatedAt: now$50
263032
+ updatedAt: now$51
262911
263033
  };
262912
263034
  case "thread.model-selection.set":
262913
263035
  case "provider.switch": return {
262914
263036
  ...thread,
262915
263037
  providerInstanceId: command.modelSelection.instanceId,
262916
263038
  modelSelection: command.modelSelection,
262917
- updatedAt: now$50
263039
+ updatedAt: now$51
262918
263040
  };
262919
263041
  }
262920
263042
  })();
@@ -262926,7 +263048,7 @@ const makeOrchestrator = fn("orchestrationV2.Orchestrator.layer")(function* () {
262926
263048
  type: "thread.pull-request-link-updated",
262927
263049
  threadId: command.threadId,
262928
263050
  providerInstanceId: updatedThread.providerInstanceId,
262929
- occurredAt: now$50,
263051
+ occurredAt: now$51,
262930
263052
  payload: link
262931
263053
  });
262932
263054
  return;
@@ -262964,7 +263086,7 @@ const makeOrchestrator = fn("orchestrationV2.Orchestrator.layer")(function* () {
262964
263086
  type: eventType,
262965
263087
  threadId: command.threadId,
262966
263088
  providerInstanceId: updatedThread.providerInstanceId,
262967
- occurredAt: now$50,
263089
+ occurredAt: now$51,
262968
263090
  payload: updatedThread
262969
263091
  });
262970
263092
  if (command.type === "thread.metadata.update" && command.regenerateTitle === true) yield* update$4(effects, (existing) => [...existing, pendingThreadTitleGenerationEffect(command.commandId, command.threadId, { type: "regenerate" })]);
@@ -262991,12 +263113,12 @@ const makeOrchestrator = fn("orchestrationV2.Orchestrator.layer")(function* () {
262991
263113
  threadId: command.threadId,
262992
263114
  runId: run.id,
262993
263115
  providerInstanceId: run.providerInstanceId,
262994
- occurredAt: now$50,
263116
+ occurredAt: now$51,
262995
263117
  payload: {
262996
263118
  ...run,
262997
263119
  status: "cancelled",
262998
263120
  queuePosition: null,
262999
- completedAt: now$50
263121
+ completedAt: now$51
263000
263122
  }
263001
263123
  });
263002
263124
  for (const run of preparingRuns) {
@@ -263008,13 +263130,13 @@ const makeOrchestrator = fn("orchestrationV2.Orchestrator.layer")(function* () {
263008
263130
  runId: run.id,
263009
263131
  nodeId: preparationItem.nodeId ?? void 0,
263010
263132
  providerInstanceId: run.providerInstanceId,
263011
- occurredAt: now$50,
263133
+ occurredAt: now$51,
263012
263134
  payload: {
263013
263135
  ...preparationItem,
263014
263136
  status: "cancelled",
263015
263137
  title: "Workspace preparation cancelled",
263016
- completedAt: now$50,
263017
- updatedAt: now$50
263138
+ completedAt: now$51,
263139
+ updatedAt: now$51
263018
263140
  }
263019
263141
  });
263020
263142
  }
@@ -263026,11 +263148,11 @@ const makeOrchestrator = fn("orchestrationV2.Orchestrator.layer")(function* () {
263026
263148
  runId: attempt.runId,
263027
263149
  nodeId: attempt.rootNodeId,
263028
263150
  providerInstanceId: run.providerInstanceId,
263029
- occurredAt: now$50,
263151
+ occurredAt: now$51,
263030
263152
  payload: {
263031
263153
  ...attempt,
263032
263154
  status: "cancelled",
263033
- completedAt: now$50
263155
+ completedAt: now$51
263034
263156
  }
263035
263157
  });
263036
263158
  }
@@ -263046,11 +263168,11 @@ const makeOrchestrator = fn("orchestrationV2.Orchestrator.layer")(function* () {
263046
263168
  runId: run.id,
263047
263169
  nodeId: node.id,
263048
263170
  providerInstanceId: run.providerInstanceId,
263049
- occurredAt: now$50,
263171
+ occurredAt: now$51,
263050
263172
  payload: {
263051
263173
  ...node,
263052
263174
  status: "cancelled",
263053
- completedAt: now$50
263175
+ completedAt: now$51
263054
263176
  }
263055
263177
  });
263056
263178
  }
@@ -263058,7 +263180,7 @@ const makeOrchestrator = fn("orchestrationV2.Orchestrator.layer")(function* () {
263058
263180
  command,
263059
263181
  events,
263060
263182
  projection: yield* getProjectionWithPendingEvents(command.threadId, events),
263061
- now: now$50,
263183
+ now: now$51,
263062
263184
  cancelQueuedDelivery: false
263063
263185
  });
263064
263186
  }
@@ -263071,10 +263193,10 @@ const makeOrchestrator = fn("orchestrationV2.Orchestrator.layer")(function* () {
263071
263193
  threadId: command.threadId,
263072
263194
  driver: session.driver,
263073
263195
  providerInstanceId: session.providerInstanceId,
263074
- occurredAt: now$50,
263196
+ occurredAt: now$51,
263075
263197
  payload: {
263076
263198
  providerSessionId: session.id,
263077
- detachedAt: now$50,
263199
+ detachedAt: now$51,
263078
263200
  reason: command.type === "thread.archive" ? "Thread archived." : command.type === "thread.settle" ? "Thread settled." : command.type === "thread.metadata.update" ? "Workspace changed." : command.type === "thread.runtime-mode.set" ? "Runtime mode changed." : "Provider or model selection changed."
263079
263201
  }
263080
263202
  });
@@ -263186,7 +263308,7 @@ const makeOrchestrator = fn("orchestrationV2.Orchestrator.layer")(function* () {
263186
263308
  cause: forkableSourceRunStatusError(sourceRun)
263187
263309
  });
263188
263310
  const sourceProviderThread = providerThreadForRun(sourceProjection, sourceRun);
263189
- const now$48 = command.createdAt ?? (yield* now);
263311
+ const now$47 = command.createdAt ?? (yield* now);
263190
263312
  const emitEvent = emit(events, command);
263191
263313
  const transferId = yield* mapDispatchError(command)(idAllocator.allocate.contextTransfer({
263192
263314
  sourceThreadId: sourceProjection.thread.id,
@@ -263205,20 +263327,20 @@ const makeOrchestrator = fn("orchestrationV2.Orchestrator.layer")(function* () {
263205
263327
  ...command.runtimeMode === void 0 ? {} : { runtimeMode: command.runtimeMode },
263206
263328
  createdBy: command.createdBy,
263207
263329
  creationSource: command.creationSource,
263208
- createdAt: now$48
263330
+ createdAt: now$47
263209
263331
  }).pipe(mapDispatchError(command));
263210
263332
  yield* emitEvent({
263211
263333
  type: "thread.created",
263212
263334
  threadId: command.targetThreadId,
263213
263335
  providerInstanceId: targetThread.providerInstanceId,
263214
- occurredAt: now$48,
263336
+ occurredAt: now$47,
263215
263337
  payload: targetThread
263216
263338
  });
263217
263339
  yield* emitEvent({
263218
263340
  type: "context-transfer.created",
263219
263341
  threadId: command.targetThreadId,
263220
263342
  providerInstanceId: sourceRun.providerInstanceId,
263221
- occurredAt: now$48,
263343
+ occurredAt: now$47,
263222
263344
  payload: transfer
263223
263345
  });
263224
263346
  });
@@ -263914,21 +264036,21 @@ const makeOrchestrator = fn("orchestrationV2.Orchestrator.layer")(function* () {
263914
264036
  const userMessages = projection.messages.filter((message) => message.role === "user");
263915
264037
  const onlyMaintenanceHistory = userMessages.length > 0 && userMessages.every(isNativeMaintenanceCommand);
263916
264038
  if (!isNativeMaintenanceCommand(command) && (command.titleSeed !== void 0 && (yield* projectionStore.getMessageCount(command.threadId).pipe(mapDispatchError(command))) === 0 || command.createdBy === "user" && onlyMaintenanceHistory)) {
263917
- const now$47 = yield* now;
264039
+ const now$46 = yield* now;
263918
264040
  const thread = {
263919
264041
  ...projection.thread,
263920
264042
  title: command.titleSeed ?? projection.thread.title,
263921
264043
  titleRegeneration: {
263922
264044
  requestId: command.commandId,
263923
- startedAt: now$47
264045
+ startedAt: now$46
263924
264046
  },
263925
- updatedAt: now$47
264047
+ updatedAt: now$46
263926
264048
  };
263927
264049
  yield* emit(events, command)({
263928
264050
  type: "thread.metadata-updated",
263929
264051
  threadId: command.threadId,
263930
264052
  providerInstanceId: thread.providerInstanceId,
263931
- occurredAt: now$47,
264053
+ occurredAt: now$46,
263932
264054
  payload: thread
263933
264055
  });
263934
264056
  yield* update$4(effects, (existing) => [...existing, pendingThreadTitleGenerationEffect(command.commandId, command.threadId, {
@@ -264053,7 +264175,7 @@ const makeOrchestrator = fn("orchestrationV2.Orchestrator.layer")(function* () {
264053
264175
  commandType: command.type,
264054
264176
  cause: `Active run ${queueBehindRun.id} has no provider thread for queued dispatch.`
264055
264177
  });
264056
- const now$21 = yield* now;
264178
+ const now$20 = yield* now;
264057
264179
  const ordinal = nextRunOrdinal(projection);
264058
264180
  const runId = idAllocator.derive.run({
264059
264181
  threadId: command.threadId,
@@ -264086,8 +264208,8 @@ const makeOrchestrator = fn("orchestrationV2.Orchestrator.layer")(function* () {
264086
264208
  lastRunOrdinal: null,
264087
264209
  handoffIds: [],
264088
264210
  forkedFrom: null,
264089
- createdAt: now$21,
264090
- updatedAt: now$21
264211
+ createdAt: now$20,
264212
+ updatedAt: now$20
264091
264213
  };
264092
264214
  const attemptId = idAllocator.derive.runAttempt({
264093
264215
  runId,
@@ -264103,7 +264225,7 @@ const makeOrchestrator = fn("orchestrationV2.Orchestrator.layer")(function* () {
264103
264225
  rootNodeId,
264104
264226
  providerThreadId: queuedProviderThread.id,
264105
264227
  cwd: resolvedRuntimePolicy.cwd ?? selectedProviderSession?.cwd ?? projection.thread.worktreePath ?? process.cwd(),
264106
- createdAt: now$21
264228
+ createdAt: now$20
264107
264229
  })), mapError((cause) => new OrchestratorDispatchError({
264108
264230
  commandId: command.commandId,
264109
264231
  commandType: command.type,
@@ -264122,7 +264244,7 @@ const makeOrchestrator = fn("orchestrationV2.Orchestrator.layer")(function* () {
264122
264244
  status: "queued",
264123
264245
  ...worktreeMissingRun !== void 0 || projection.runs.some((candidate) => candidate.status === "queued" && candidate.queueHeld === true) ? { queueHeld: true } : {},
264124
264246
  queuePosition: Math.max(0, ...projection.runs.filter((candidate) => candidate.status === "queued").map((candidate) => candidate.queuePosition ?? candidate.ordinal)) + 1,
264125
- requestedAt: now$21,
264247
+ requestedAt: now$20,
264126
264248
  startedAt: null,
264127
264249
  completedAt: null,
264128
264250
  checkpointId: null,
@@ -264175,8 +264297,8 @@ const makeOrchestrator = fn("orchestrationV2.Orchestrator.layer")(function* () {
264175
264297
  ...command.context ? { context: command.context } : {},
264176
264298
  attachments: command.attachments,
264177
264299
  streaming: false,
264178
- createdAt: now$21,
264179
- updatedAt: now$21,
264300
+ createdAt: now$20,
264301
+ updatedAt: now$20,
264180
264302
  ...delegatedCompletion === void 0 ? {} : { delegatedCompletion },
264181
264303
  ...command.notification === void 0 ? {} : { notification: command.notification }
264182
264304
  };
@@ -264185,7 +264307,7 @@ const makeOrchestrator = fn("orchestrationV2.Orchestrator.layer")(function* () {
264185
264307
  type: "provider-thread.updated",
264186
264308
  threadId: command.threadId,
264187
264309
  providerInstanceId: modelSelection.instanceId,
264188
- occurredAt: now$21,
264310
+ occurredAt: now$20,
264189
264311
  payload: queuedProviderThread
264190
264312
  });
264191
264313
  yield* emitEvent({
@@ -264194,17 +264316,17 @@ const makeOrchestrator = fn("orchestrationV2.Orchestrator.layer")(function* () {
264194
264316
  runId,
264195
264317
  nodeId: rootNodeId,
264196
264318
  providerInstanceId: modelSelection.instanceId,
264197
- occurredAt: now$21,
264319
+ occurredAt: now$20,
264198
264320
  payload: run
264199
264321
  });
264200
- yield* completeSourcePlan(now$21);
264322
+ yield* completeSourcePlan(now$20);
264201
264323
  yield* emitEvent({
264202
264324
  type: "run-attempt.created",
264203
264325
  threadId: command.threadId,
264204
264326
  runId,
264205
264327
  nodeId: rootNodeId,
264206
264328
  providerInstanceId: modelSelection.instanceId,
264207
- occurredAt: now$21,
264329
+ occurredAt: now$20,
264208
264330
  payload: attempt
264209
264331
  });
264210
264332
  yield* emitEvent({
@@ -264213,7 +264335,7 @@ const makeOrchestrator = fn("orchestrationV2.Orchestrator.layer")(function* () {
264213
264335
  runId,
264214
264336
  nodeId: rootNodeId,
264215
264337
  providerInstanceId: modelSelection.instanceId,
264216
- occurredAt: now$21,
264338
+ occurredAt: now$20,
264217
264339
  payload: rootNode
264218
264340
  });
264219
264341
  if (checkpointScope !== null) yield* emitEvent({
@@ -264222,7 +264344,7 @@ const makeOrchestrator = fn("orchestrationV2.Orchestrator.layer")(function* () {
264222
264344
  runId,
264223
264345
  nodeId: rootNodeId,
264224
264346
  providerInstanceId: modelSelection.instanceId,
264225
- occurredAt: now$21,
264347
+ occurredAt: now$20,
264226
264348
  payload: yield* checkpointService.ensureScope(checkpointScope).pipe(mapError((cause) => new OrchestratorDispatchError({
264227
264349
  commandId: command.commandId,
264228
264350
  commandType: command.type,
@@ -264235,7 +264357,7 @@ const makeOrchestrator = fn("orchestrationV2.Orchestrator.layer")(function* () {
264235
264357
  runId,
264236
264358
  nodeId: rootNodeId,
264237
264359
  providerInstanceId: modelSelection.instanceId,
264238
- occurredAt: now$21,
264360
+ occurredAt: now$20,
264239
264361
  payload: message
264240
264362
  });
264241
264363
  const existingItem = projection.turnItems.find((item) => item.type === "user_message" && item.messageId === command.messageId);
@@ -264245,7 +264367,7 @@ const makeOrchestrator = fn("orchestrationV2.Orchestrator.layer")(function* () {
264245
264367
  runId,
264246
264368
  nodeId: rootNodeId,
264247
264369
  providerInstanceId: modelSelection.instanceId,
264248
- occurredAt: now$21,
264370
+ occurredAt: now$20,
264249
264371
  payload: {
264250
264372
  ...existingItem,
264251
264373
  runId,
@@ -264253,7 +264375,7 @@ const makeOrchestrator = fn("orchestrationV2.Orchestrator.layer")(function* () {
264253
264375
  providerThreadId: queuedProviderThread.id,
264254
264376
  providerTurnId: null,
264255
264377
  inputIntent: "queued_turn",
264256
- updatedAt: now$21
264378
+ updatedAt: now$20
264257
264379
  }
264258
264380
  });
264259
264381
  return;
@@ -265275,7 +265397,7 @@ const makeOrchestrator = fn("orchestrationV2.Orchestrator.layer")(function* () {
265275
265397
  providerInstanceId: command.modelSelection.instanceId,
265276
265398
  cause
265277
265399
  })));
265278
- const now$46 = command.createdAt ?? (yield* now);
265400
+ const now$45 = command.createdAt ?? (yield* now);
265279
265401
  const taskNodeId = idAllocator.derive.delegatedTaskNode({ commandId: command.commandId });
265280
265402
  const childThreadId = idAllocator.derive.delegatedTaskThread({ commandId: command.commandId });
265281
265403
  const childMessageId = idAllocator.derive.delegatedTaskMessage({ commandId: command.commandId });
@@ -265295,7 +265417,7 @@ const makeOrchestrator = fn("orchestrationV2.Orchestrator.layer")(function* () {
265295
265417
  providerInstanceId: command.modelSelection.instanceId,
265296
265418
  modelSelection: command.modelSelection,
265297
265419
  title: taskTitle,
265298
- now: now$46,
265420
+ now: now$45,
265299
265421
  createdBy: command.createdBy,
265300
265422
  creationSource: command.creationSource
265301
265423
  }),
@@ -265324,9 +265446,9 @@ const makeOrchestrator = fn("orchestrationV2.Orchestrator.layer")(function* () {
265324
265446
  ...command.completionWake === void 0 ? {} : { completionWake: command.completionWake },
265325
265447
  status: "running",
265326
265448
  result: null,
265327
- startedAt: now$46,
265449
+ startedAt: now$45,
265328
265450
  completedAt: null,
265329
- updatedAt: now$46
265451
+ updatedAt: now$45
265330
265452
  };
265331
265453
  const taskNode = {
265332
265454
  id: taskNodeId,
@@ -265342,7 +265464,7 @@ const makeOrchestrator = fn("orchestrationV2.Orchestrator.layer")(function* () {
265342
265464
  nativeItemRef: null,
265343
265465
  runtimeRequestId: null,
265344
265466
  checkpointScopeId: null,
265345
- startedAt: now$46,
265467
+ startedAt: now$45,
265346
265468
  completedAt: null
265347
265469
  };
265348
265470
  const parentProviderTurn = providerTurnForRun(parentProjection, parentRun);
@@ -265358,9 +265480,9 @@ const makeOrchestrator = fn("orchestrationV2.Orchestrator.layer")(function* () {
265358
265480
  ordinal: yield* nextTurnItemOrdinal(parentProjection),
265359
265481
  status: "running",
265360
265482
  title: command.title ?? taskTitle,
265361
- startedAt: now$46,
265483
+ startedAt: now$45,
265362
265484
  completedAt: null,
265363
- updatedAt: now$46,
265485
+ updatedAt: now$45,
265364
265486
  type: "subagent",
265365
265487
  subagentId: taskNodeId,
265366
265488
  origin: "app_owned",
@@ -265376,7 +265498,7 @@ const makeOrchestrator = fn("orchestrationV2.Orchestrator.layer")(function* () {
265376
265498
  threadId: childThreadId,
265377
265499
  driver: targetAdapter.driver,
265378
265500
  providerInstanceId: command.modelSelection.instanceId,
265379
- occurredAt: now$46,
265501
+ occurredAt: now$45,
265380
265502
  payload: childThread
265381
265503
  });
265382
265504
  yield* emitEvent({
@@ -265386,7 +265508,7 @@ const makeOrchestrator = fn("orchestrationV2.Orchestrator.layer")(function* () {
265386
265508
  nodeId: taskNodeId,
265387
265509
  driver: targetAdapter.driver,
265388
265510
  providerInstanceId: command.modelSelection.instanceId,
265389
- occurredAt: now$46,
265511
+ occurredAt: now$45,
265390
265512
  payload: taskNode
265391
265513
  });
265392
265514
  yield* emitEvent({
@@ -265396,7 +265518,7 @@ const makeOrchestrator = fn("orchestrationV2.Orchestrator.layer")(function* () {
265396
265518
  nodeId: taskNodeId,
265397
265519
  driver: targetAdapter.driver,
265398
265520
  providerInstanceId: command.modelSelection.instanceId,
265399
- occurredAt: now$46,
265521
+ occurredAt: now$45,
265400
265522
  payload: task
265401
265523
  });
265402
265524
  yield* emitEvent({
@@ -265406,7 +265528,7 @@ const makeOrchestrator = fn("orchestrationV2.Orchestrator.layer")(function* () {
265406
265528
  nodeId: taskNodeId,
265407
265529
  driver: targetAdapter.driver,
265408
265530
  providerInstanceId: command.modelSelection.instanceId,
265409
- occurredAt: now$46,
265531
+ occurredAt: now$45,
265410
265532
  payload: taskTurnItem
265411
265533
  });
265412
265534
  const childMessageCommand = {
@@ -265453,16 +265575,16 @@ const makeOrchestrator = fn("orchestrationV2.Orchestrator.layer")(function* () {
265453
265575
  resolution: null,
265454
265576
  createdBy: command.createdBy,
265455
265577
  error: null,
265456
- createdAt: now$46,
265457
- updatedAt: now$46,
265458
- consumedAt: now$46
265578
+ createdAt: now$45,
265579
+ updatedAt: now$45,
265580
+ consumedAt: now$45
265459
265581
  };
265460
265582
  yield* emitEvent({
265461
265583
  type: "context-transfer.created",
265462
265584
  threadId: childThreadId,
265463
265585
  runId: childRun.id,
265464
265586
  providerInstanceId: command.modelSelection.instanceId,
265465
- occurredAt: now$46,
265587
+ occurredAt: now$45,
265466
265588
  payload: spawnTransfer
265467
265589
  });
265468
265590
  });
@@ -265701,7 +265823,7 @@ const makeOrchestrator = fn("orchestrationV2.Orchestrator.layer")(function* () {
265701
265823
  commandType: command.type,
265702
265824
  cause: `Target run ${command.targetRunId} does not belong to thread ${command.targetThreadId}.`
265703
265825
  });
265704
- const now$42 = yield* now;
265826
+ const now$41 = yield* now;
265705
265827
  const parentProviderTurn = providerTurnForRun(parentProjection, parentRun);
265706
265828
  const turnItem = {
265707
265829
  id: idAllocator.derive.createdThreadTurnItem({ commandId: command.commandId }),
@@ -265715,9 +265837,9 @@ const makeOrchestrator = fn("orchestrationV2.Orchestrator.layer")(function* () {
265715
265837
  ordinal: yield* nextTurnItemOrdinal(parentProjection),
265716
265838
  status: "completed",
265717
265839
  title: targetProjection.thread.title,
265718
- startedAt: now$42,
265719
- completedAt: now$42,
265720
- updatedAt: now$42,
265840
+ startedAt: now$41,
265841
+ completedAt: now$41,
265842
+ updatedAt: now$41,
265721
265843
  type: "thread_created",
265722
265844
  targetThreadId: command.targetThreadId,
265723
265845
  targetRunId: command.targetRunId,
@@ -265730,7 +265852,7 @@ const makeOrchestrator = fn("orchestrationV2.Orchestrator.layer")(function* () {
265730
265852
  runId: command.parentRunId,
265731
265853
  nodeId: command.parentNodeId,
265732
265854
  providerInstanceId: parentRun.providerInstanceId,
265733
- occurredAt: now$42,
265855
+ occurredAt: now$41,
265734
265856
  payload: turnItem
265735
265857
  });
265736
265858
  });
@@ -265770,7 +265892,7 @@ const makeOrchestrator = fn("orchestrationV2.Orchestrator.layer")(function* () {
265770
265892
  commandType: command.type,
265771
265893
  cause: `Secret request ${command.turnItemId} belongs to another run.`
265772
265894
  });
265773
- const now$23 = yield* now;
265895
+ const now$22 = yield* now;
265774
265896
  const unchanged = existing !== void 0 && (existing.secretStatus !== "pending" || command.secretStatus === "pending");
265775
265897
  const pending = command.secretStatus === "pending";
265776
265898
  const turnItem = unchanged ? existing : {
@@ -265785,9 +265907,9 @@ const makeOrchestrator = fn("orchestrationV2.Orchestrator.layer")(function* () {
265785
265907
  ordinal: existing?.ordinal ?? (yield* nextTurnItemOrdinal(projection)),
265786
265908
  status: pending ? "waiting" : command.secretStatus === "saved" ? "completed" : "cancelled",
265787
265909
  title: command.label,
265788
- startedAt: existing?.startedAt ?? now$23,
265789
- completedAt: pending ? null : now$23,
265790
- updatedAt: now$23,
265910
+ startedAt: existing?.startedAt ?? now$22,
265911
+ completedAt: pending ? null : now$22,
265912
+ updatedAt: now$22,
265791
265913
  type: "secret_request",
265792
265914
  label: command.label,
265793
265915
  reason: command.reason,
@@ -265800,7 +265922,7 @@ const makeOrchestrator = fn("orchestrationV2.Orchestrator.layer")(function* () {
265800
265922
  runId: command.runId,
265801
265923
  nodeId: command.nodeId,
265802
265924
  providerInstanceId: run.providerInstanceId,
265803
- occurredAt: now$23,
265925
+ occurredAt: now$22,
265804
265926
  payload: turnItem
265805
265927
  });
265806
265928
  });
@@ -266016,7 +266138,7 @@ const makeOrchestrator = fn("orchestrationV2.Orchestrator.layer")(function* () {
266016
266138
  commandType: command.type,
266017
266139
  cause: "Automatic completion deliveries cannot be promoted to Steer."
266018
266140
  });
266019
- const now$20 = yield* now;
266141
+ const now$19 = yield* now;
266020
266142
  const emitEvent = emit(events, command);
266021
266143
  yield* emitEvent({
266022
266144
  type: "run.updated",
@@ -266024,12 +266146,12 @@ const makeOrchestrator = fn("orchestrationV2.Orchestrator.layer")(function* () {
266024
266146
  runId: queuedRun.id,
266025
266147
  nodeId: queuedRootNode.id,
266026
266148
  providerInstanceId: queuedRun.providerInstanceId,
266027
- occurredAt: now$20,
266149
+ occurredAt: now$19,
266028
266150
  payload: {
266029
266151
  ...queuedRun,
266030
266152
  status: "cancelled",
266031
266153
  queuePosition: null,
266032
- completedAt: now$20
266154
+ completedAt: now$19
266033
266155
  }
266034
266156
  });
266035
266157
  yield* emitEvent({
@@ -266038,11 +266160,11 @@ const makeOrchestrator = fn("orchestrationV2.Orchestrator.layer")(function* () {
266038
266160
  runId: queuedRun.id,
266039
266161
  nodeId: queuedRootNode.id,
266040
266162
  providerInstanceId: queuedRun.providerInstanceId,
266041
- occurredAt: now$20,
266163
+ occurredAt: now$19,
266042
266164
  payload: {
266043
266165
  ...queuedAttempt,
266044
266166
  status: "cancelled",
266045
- completedAt: now$20
266167
+ completedAt: now$19
266046
266168
  }
266047
266169
  });
266048
266170
  yield* emitEvent({
@@ -266051,11 +266173,11 @@ const makeOrchestrator = fn("orchestrationV2.Orchestrator.layer")(function* () {
266051
266173
  runId: queuedRun.id,
266052
266174
  nodeId: queuedRootNode.id,
266053
266175
  providerInstanceId: queuedRun.providerInstanceId,
266054
- occurredAt: now$20,
266176
+ occurredAt: now$19,
266055
266177
  payload: {
266056
266178
  ...queuedRootNode,
266057
266179
  status: "cancelled",
266058
- completedAt: now$20
266180
+ completedAt: now$19
266059
266181
  }
266060
266182
  });
266061
266183
  yield* dispatchSteerIntoRun({
@@ -266110,7 +266232,7 @@ const makeOrchestrator = fn("orchestrationV2.Orchestrator.layer")(function* () {
266110
266232
  moving,
266111
266233
  ...withoutMoving.slice(beforeIndex)
266112
266234
  ];
266113
- const now$41 = yield* now;
266235
+ const now$39 = yield* now;
266114
266236
  const emitEvent = emit(events, command);
266115
266237
  yield* forEach(reordered, (run, index) => gen$1(function* () {
266116
266238
  const queuePosition = index + 1;
@@ -266121,7 +266243,7 @@ const makeOrchestrator = fn("orchestrationV2.Orchestrator.layer")(function* () {
266121
266243
  runId: run.id,
266122
266244
  ...run.rootNodeId === null ? {} : { nodeId: run.rootNodeId },
266123
266245
  providerInstanceId: run.providerInstanceId,
266124
- occurredAt: now$41,
266246
+ occurredAt: now$39,
266125
266247
  payload: {
266126
266248
  ...run,
266127
266249
  queuePosition
@@ -266149,14 +266271,14 @@ const makeOrchestrator = fn("orchestrationV2.Orchestrator.layer")(function* () {
266149
266271
  });
266150
266272
  const queuedMessage = projection.messages.find((candidate) => candidate.id === queuedRun.userMessageId);
266151
266273
  if (queuedMessage?.delegatedCompletion !== void 0) {
266152
- const now$51 = yield* now;
266274
+ const now$52 = yield* now;
266153
266275
  yield* disposeDelegatedCompletionCohort({
266154
266276
  command,
266155
266277
  events,
266156
266278
  projection,
266157
266279
  parentRunId: queuedMessage.delegatedCompletion.parentRunId,
266158
266280
  disposition: "disposed",
266159
- now: now$51
266281
+ now: now$52
266160
266282
  });
266161
266283
  return;
266162
266284
  }
@@ -266237,7 +266359,7 @@ const makeOrchestrator = fn("orchestrationV2.Orchestrator.layer")(function* () {
266237
266359
  cause: "Automatic completion deliveries cannot be edited."
266238
266360
  });
266239
266361
  const queuedTurnItem = projection.turnItems.find((candidate) => candidate.type === "user_message" && candidate.messageId === queuedMessage.id);
266240
- const now$38 = yield* now;
266362
+ const now$36 = yield* now;
266241
266363
  const emitEvent = emit(events, command);
266242
266364
  const editedAttachments = command.attachments === void 0 ? {} : { attachments: command.attachments };
266243
266365
  yield* emitEvent({
@@ -266246,13 +266368,13 @@ const makeOrchestrator = fn("orchestrationV2.Orchestrator.layer")(function* () {
266246
266368
  runId: queuedRun.id,
266247
266369
  ...queuedRun.rootNodeId === null ? {} : { nodeId: queuedRun.rootNodeId },
266248
266370
  providerInstanceId: queuedRun.providerInstanceId,
266249
- occurredAt: now$38,
266371
+ occurredAt: now$36,
266250
266372
  payload: {
266251
266373
  ...queuedMessage,
266252
266374
  text: command.text,
266253
266375
  ...editedAttachments,
266254
266376
  ...command.context ? { context: command.context } : {},
266255
- updatedAt: now$38
266377
+ updatedAt: now$36
266256
266378
  }
266257
266379
  });
266258
266380
  if (queuedTurnItem !== void 0 && queuedTurnItem.type === "user_message") yield* emitEvent({
@@ -266261,13 +266383,13 @@ const makeOrchestrator = fn("orchestrationV2.Orchestrator.layer")(function* () {
266261
266383
  runId: queuedRun.id,
266262
266384
  ...queuedRun.rootNodeId === null ? {} : { nodeId: queuedRun.rootNodeId },
266263
266385
  providerInstanceId: queuedRun.providerInstanceId,
266264
- occurredAt: now$38,
266386
+ occurredAt: now$36,
266265
266387
  payload: {
266266
266388
  ...queuedTurnItem,
266267
266389
  text: command.text,
266268
266390
  ...editedAttachments,
266269
266391
  ...command.context ? { context: command.context } : {},
266270
- updatedAt: now$38
266392
+ updatedAt: now$36
266271
266393
  }
266272
266394
  });
266273
266395
  });
@@ -266336,7 +266458,7 @@ const makeOrchestrator = fn("orchestrationV2.Orchestrator.layer")(function* () {
266336
266458
  commandType: command.type,
266337
266459
  cause: `Run ${command.runId} is not awaiting workspace preparation.`
266338
266460
  });
266339
- const now$40 = yield* now;
266461
+ const now$38 = yield* now;
266340
266462
  const resolvedRuntimePolicy = yield* runtimePolicy.resolve({
266341
266463
  thread: projection.thread,
266342
266464
  modelSelection: state.run.modelSelection
@@ -266347,7 +266469,7 @@ const makeOrchestrator = fn("orchestrationV2.Orchestrator.layer")(function* () {
266347
266469
  rootNodeId: state.rootNode.id,
266348
266470
  providerThreadId: state.providerThread.id,
266349
266471
  cwd: resolvedRuntimePolicy.cwd ?? projection.thread.worktreePath ?? process.cwd(),
266350
- createdAt: now$40
266472
+ createdAt: now$38
266351
266473
  }).pipe(mapDispatchError(command));
266352
266474
  const emitEvent = emit(events, command);
266353
266475
  yield* emitEvent({
@@ -266356,7 +266478,7 @@ const makeOrchestrator = fn("orchestrationV2.Orchestrator.layer")(function* () {
266356
266478
  runId: state.run.id,
266357
266479
  nodeId: state.rootNode.id,
266358
266480
  providerInstanceId: state.run.providerInstanceId,
266359
- occurredAt: now$40,
266481
+ occurredAt: now$38,
266360
266482
  payload: checkpointScope
266361
266483
  });
266362
266484
  yield* emitEvent({
@@ -266365,7 +266487,7 @@ const makeOrchestrator = fn("orchestrationV2.Orchestrator.layer")(function* () {
266365
266487
  runId: state.run.id,
266366
266488
  nodeId: state.rootNode.id,
266367
266489
  providerInstanceId: state.run.providerInstanceId,
266368
- occurredAt: now$40,
266490
+ occurredAt: now$38,
266369
266491
  payload: {
266370
266492
  ...state.rootNode,
266371
266493
  checkpointScopeId: checkpointScope.id
@@ -266377,15 +266499,15 @@ const makeOrchestrator = fn("orchestrationV2.Orchestrator.layer")(function* () {
266377
266499
  runId: state.run.id,
266378
266500
  nodeId: state.rootNode.id,
266379
266501
  providerInstanceId: state.run.providerInstanceId,
266380
- occurredAt: now$40,
266502
+ occurredAt: now$38,
266381
266503
  payload: {
266382
266504
  ...state.preparationItem,
266383
266505
  status: "completed",
266384
266506
  title: "Workspace ready",
266385
266507
  output: "Workspace preparation completed.",
266386
266508
  exitCode: 0,
266387
- completedAt: now$40,
266388
- updatedAt: now$40
266509
+ completedAt: now$38,
266510
+ updatedAt: now$38
266389
266511
  }
266390
266512
  });
266391
266513
  yield* emitEvent({
@@ -266394,7 +266516,7 @@ const makeOrchestrator = fn("orchestrationV2.Orchestrator.layer")(function* () {
266394
266516
  runId: state.run.id,
266395
266517
  nodeId: state.rootNode.id,
266396
266518
  providerInstanceId: state.run.providerInstanceId,
266397
- occurredAt: now$40,
266519
+ occurredAt: now$38,
266398
266520
  payload: {
266399
266521
  ...state.run,
266400
266522
  status: "starting"
@@ -267016,7 +267138,7 @@ const makeOrchestrator = fn("orchestrationV2.Orchestrator.layer")(function* () {
267016
267138
  "running",
267017
267139
  "waiting"
267018
267140
  ].includes(subagent.status) || subagent.startedAt !== null && toEpochMillis(subagent.startedAt) > toEpochMillis(command.subagent.stoppedAt)) return;
267019
- const now$34 = yield* now;
267141
+ const now$31 = yield* now;
267020
267142
  const allocateEventId = () => idAllocator.allocate.event({
267021
267143
  threadId: command.threadId,
267022
267144
  commandId: command.commandId
@@ -267027,7 +267149,7 @@ const makeOrchestrator = fn("orchestrationV2.Orchestrator.layer")(function* () {
267027
267149
  result: outcome.result,
267028
267150
  status: outcome.status,
267029
267151
  completedAt: outcome.completedAt,
267030
- now: now$34,
267152
+ now: now$31,
267031
267153
  emitted: yield* get$6(events),
267032
267154
  allocateEventId
267033
267155
  }).pipe(mapDispatchError(command));
@@ -267048,7 +267170,7 @@ const makeOrchestrator = fn("orchestrationV2.Orchestrator.layer")(function* () {
267048
267170
  projection: child,
267049
267171
  status: outcome.status,
267050
267172
  completedAt: outcome.completedAt,
267051
- now: now$34,
267173
+ now: now$31,
267052
267174
  emitted: yield* get$6(events),
267053
267175
  allocateEventId
267054
267176
  }).pipe(mapDispatchError(command));
@@ -267064,7 +267186,7 @@ const makeOrchestrator = fn("orchestrationV2.Orchestrator.layer")(function* () {
267064
267186
  "starting",
267065
267187
  "running"
267066
267188
  ].includes(stoppedRun.status) && stoppedRun.activeAttemptId !== stopped.providerTurn?.runAttemptId) return;
267067
- const now$35 = yield* now;
267189
+ const now$32 = yield* now;
267068
267190
  if (stopped.providerTurn !== void 0 && stoppedRun.status === "running") {
267069
267191
  const output = yield* projectionStore.getThreadRecords(command.threadId, ["messages"], {
267070
267192
  messageRunIds: [stoppedRun.id],
@@ -267079,7 +267201,7 @@ const makeOrchestrator = fn("orchestrationV2.Orchestrator.layer")(function* () {
267079
267201
  providerTurn: stopped.providerTurn,
267080
267202
  events,
267081
267203
  effects,
267082
- now: now$35
267204
+ now: now$32
267083
267205
  });
267084
267206
  }
267085
267207
  if (projection.runs.some((run) => run.id !== stoppedRun.id && (run.status === "preparing" || run.status === "starting" || run.status === "running"))) return;
@@ -267089,7 +267211,7 @@ const makeOrchestrator = fn("orchestrationV2.Orchestrator.layer")(function* () {
267089
267211
  projection,
267090
267212
  stoppedProviderThreadId: command.providerThreadId,
267091
267213
  throughRunOrdinal: stoppedRun.ordinal,
267092
- now: now$35
267214
+ now: now$32
267093
267215
  });
267094
267216
  });
267095
267217
  const dispatchSubagentStop = (command, events, effects) => gen$1(function* () {
@@ -267120,17 +267242,17 @@ const makeOrchestrator = fn("orchestrationV2.Orchestrator.layer")(function* () {
267120
267242
  });
267121
267243
  const providerSessionId = providerThread.providerSessionId;
267122
267244
  const nativeTaskId = subagent.nativeTaskRef.nativeId;
267123
- const now$39 = yield* now;
267245
+ const now$37 = yield* now;
267124
267246
  yield* emit(events, command)({
267125
267247
  type: "subagent.updated",
267126
267248
  threadId: command.threadId,
267127
267249
  runId: command.runId,
267128
267250
  nodeId: subagent.id,
267129
267251
  providerInstanceId: subagent.providerInstanceId,
267130
- occurredAt: now$39,
267252
+ occurredAt: now$37,
267131
267253
  payload: {
267132
267254
  ...subagent,
267133
- updatedAt: now$39
267255
+ updatedAt: now$37
267134
267256
  }
267135
267257
  });
267136
267258
  yield* update$4(effects, (existing) => [...existing, {
@@ -267190,22 +267312,22 @@ const makeOrchestrator = fn("orchestrationV2.Orchestrator.layer")(function* () {
267190
267312
  commandType: command.type,
267191
267313
  cause: `Run ${command.runId} is not interruptible.`
267192
267314
  });
267193
- const now$37 = yield* now;
267315
+ const now$35 = yield* now;
267194
267316
  const completionCohortRunId = projection.messages.find((candidate) => candidate.id === run.userMessageId)?.delegatedCompletion?.parentRunId ?? run.id;
267195
267317
  const stopRemainingWork = () => command.holdQueue === true ? holdStoppedThread({
267196
267318
  command,
267197
267319
  events,
267198
267320
  projection,
267199
267321
  cohortRunIds: [completionCohortRunId],
267200
- now: now$37
267322
+ now: now$35
267201
267323
  }) : gen$1(function* () {
267202
- yield* disposeDelegatedCompletionCohort({
267324
+ for (const parentRunId of /* @__PURE__ */ new Set([completionCohortRunId, run.id])) yield* disposeDelegatedCompletionCohort({
267203
267325
  command,
267204
267326
  events,
267205
267327
  projection: yield* getProjectionWithPendingEvents(command.threadId, events),
267206
- parentRunId: completionCohortRunId,
267328
+ parentRunId,
267207
267329
  disposition: "stopped",
267208
- now: now$37
267330
+ now: now$35
267209
267331
  });
267210
267332
  });
267211
267333
  const emitEvent = emit(events, command);
@@ -267224,9 +267346,9 @@ const makeOrchestrator = fn("orchestrationV2.Orchestrator.layer")(function* () {
267224
267346
  ordinal: yield* nextTurnItemOrdinal(projection),
267225
267347
  status: "completed",
267226
267348
  title: "Interrupt requested",
267227
- startedAt: now$37,
267228
- completedAt: now$37,
267229
- updatedAt: now$37,
267349
+ startedAt: now$35,
267350
+ completedAt: now$35,
267351
+ updatedAt: now$35,
267230
267352
  type: "run_interrupt_request",
267231
267353
  message: command.reason ?? "Interrupt requested"
267232
267354
  };
@@ -267288,9 +267410,9 @@ const makeOrchestrator = fn("orchestrationV2.Orchestrator.layer")(function* () {
267288
267410
  ordinal: interruptRequestItem.ordinal + 1,
267289
267411
  status: "interrupted",
267290
267412
  title: "Interrupted",
267291
- startedAt: now$37,
267292
- completedAt: now$37,
267293
- updatedAt: now$37,
267413
+ startedAt: now$35,
267414
+ completedAt: now$35,
267415
+ updatedAt: now$35,
267294
267416
  type: "run_interrupt_result",
267295
267417
  message: "Run interrupted before provider start"
267296
267418
  };
@@ -267300,7 +267422,7 @@ const makeOrchestrator = fn("orchestrationV2.Orchestrator.layer")(function* () {
267300
267422
  runId: run.id,
267301
267423
  nodeId: rootNode.id,
267302
267424
  providerInstanceId: run.providerInstanceId,
267303
- occurredAt: now$37,
267425
+ occurredAt: now$35,
267304
267426
  payload: interruptRequestItem
267305
267427
  });
267306
267428
  yield* emitEvent({
@@ -267309,7 +267431,7 @@ const makeOrchestrator = fn("orchestrationV2.Orchestrator.layer")(function* () {
267309
267431
  runId: run.id,
267310
267432
  nodeId: rootNode.id,
267311
267433
  providerInstanceId: run.providerInstanceId,
267312
- occurredAt: now$37,
267434
+ occurredAt: now$35,
267313
267435
  payload: interruptResultItem
267314
267436
  });
267315
267437
  const preparationItem = projection.turnItems.find((candidate) => candidate.runId === run.id && candidate.type === "command_execution" && candidate.input === WORKSPACE_PREPARATION_INPUT && candidate.status === "running");
@@ -267319,14 +267441,14 @@ const makeOrchestrator = fn("orchestrationV2.Orchestrator.layer")(function* () {
267319
267441
  runId: run.id,
267320
267442
  nodeId: rootNode.id,
267321
267443
  providerInstanceId: run.providerInstanceId,
267322
- occurredAt: now$37,
267444
+ occurredAt: now$35,
267323
267445
  payload: {
267324
267446
  ...preparationItem,
267325
267447
  status: "interrupted",
267326
267448
  title: "Workspace preparation interrupted",
267327
267449
  output: command.reason ?? "Interrupted before provider start",
267328
- completedAt: now$37,
267329
- updatedAt: now$37
267450
+ completedAt: now$35,
267451
+ updatedAt: now$35
267330
267452
  }
267331
267453
  });
267332
267454
  yield* emitEvent({
@@ -267335,11 +267457,11 @@ const makeOrchestrator = fn("orchestrationV2.Orchestrator.layer")(function* () {
267335
267457
  runId: run.id,
267336
267458
  nodeId: rootNode.id,
267337
267459
  providerInstanceId: run.providerInstanceId,
267338
- occurredAt: now$37,
267460
+ occurredAt: now$35,
267339
267461
  payload: {
267340
267462
  ...attempt,
267341
267463
  status: "interrupted",
267342
- completedAt: now$37
267464
+ completedAt: now$35
267343
267465
  }
267344
267466
  });
267345
267467
  yield* emitEvent({
@@ -267348,11 +267470,11 @@ const makeOrchestrator = fn("orchestrationV2.Orchestrator.layer")(function* () {
267348
267470
  runId: run.id,
267349
267471
  nodeId: rootNode.id,
267350
267472
  providerInstanceId: run.providerInstanceId,
267351
- occurredAt: now$37,
267473
+ occurredAt: now$35,
267352
267474
  payload: {
267353
267475
  ...rootNode,
267354
267476
  status: "interrupted",
267355
- completedAt: now$37
267477
+ completedAt: now$35
267356
267478
  }
267357
267479
  });
267358
267480
  yield* emitEvent({
@@ -267361,11 +267483,11 @@ const makeOrchestrator = fn("orchestrationV2.Orchestrator.layer")(function* () {
267361
267483
  runId: run.id,
267362
267484
  nodeId: rootNode.id,
267363
267485
  providerInstanceId: run.providerInstanceId,
267364
- occurredAt: now$37,
267486
+ occurredAt: now$35,
267365
267487
  payload: {
267366
267488
  ...run,
267367
267489
  status: "interrupted",
267368
- completedAt: now$37
267490
+ completedAt: now$35
267369
267491
  }
267370
267492
  });
267371
267493
  yield* stopRemainingWork();
@@ -267392,7 +267514,7 @@ const makeOrchestrator = fn("orchestrationV2.Orchestrator.layer")(function* () {
267392
267514
  runId: run.id,
267393
267515
  nodeId: rootNode.id,
267394
267516
  providerInstanceId: run.providerInstanceId,
267395
- occurredAt: now$37,
267517
+ occurredAt: now$35,
267396
267518
  payload: interruptRequestItem
267397
267519
  });
267398
267520
  yield* stopRemainingWork();
@@ -267402,7 +267524,7 @@ const makeOrchestrator = fn("orchestrationV2.Orchestrator.layer")(function* () {
267402
267524
  providerTurn,
267403
267525
  events,
267404
267526
  effects,
267405
- now: now$37
267527
+ now: now$35
267406
267528
  });
267407
267529
  yield* settleBackgroundWork({
267408
267530
  command,
@@ -267410,7 +267532,7 @@ const makeOrchestrator = fn("orchestrationV2.Orchestrator.layer")(function* () {
267410
267532
  projection,
267411
267533
  stoppedProviderThreadId: providerThread.id,
267412
267534
  throughRunOrdinal: run.ordinal,
267413
- now: now$37
267535
+ now: now$35
267414
267536
  });
267415
267537
  yield* update$4(effects, (existing) => [...existing, ...otherProviderInterrupts]);
267416
267538
  return;
@@ -267433,7 +267555,7 @@ const makeOrchestrator = fn("orchestrationV2.Orchestrator.layer")(function* () {
267433
267555
  runId: run.id,
267434
267556
  nodeId: rootNode.id,
267435
267557
  providerInstanceId: run.providerInstanceId,
267436
- occurredAt: now$37,
267558
+ occurredAt: now$35,
267437
267559
  payload: interruptRequestItem
267438
267560
  });
267439
267561
  yield* stopRemainingWork();
@@ -267517,18 +267639,18 @@ const makeOrchestrator = fn("orchestrationV2.Orchestrator.layer")(function* () {
267517
267639
  const idle = idleChildren.get(task.childThreadId) ?? (!child.runs.some((run) => run.status === "queued" || isBlockingRun(run)) && !child.providerThreads.some((thread) => thread.status === "active" || (thread.pendingBackgroundTasks?.length ?? 0) > 0) && !child.runtimeRequests.some((request) => request.status === "pending") && child.turnItems.length === 0 && isNone(yield* findFirst$1(child.runs, awaitsRestartContinuation)));
267518
267640
  idleChildren.set(task.childThreadId, idle);
267519
267641
  if (!idle) continue;
267520
- const now$32 = yield* now;
267642
+ const now$24 = yield* now;
267521
267643
  const emitEvent = emit(events, command);
267522
267644
  yield* emitEvent({
267523
267645
  type: "subagent.updated",
267524
267646
  threadId: command.threadId,
267525
267647
  nodeId: task.id,
267526
- occurredAt: now$32,
267648
+ occurredAt: now$24,
267527
267649
  payload: {
267528
267650
  ...task,
267529
267651
  status: "cancelled",
267530
- completedAt: now$32,
267531
- updatedAt: now$32,
267652
+ completedAt: now$24,
267653
+ updatedAt: now$24,
267532
267654
  completionDelivery: {
267533
267655
  state: "disposed",
267534
267656
  observedByRunId: null
@@ -267541,11 +267663,11 @@ const makeOrchestrator = fn("orchestrationV2.Orchestrator.layer")(function* () {
267541
267663
  type: "node.updated",
267542
267664
  threadId: command.threadId,
267543
267665
  nodeId: node.id,
267544
- occurredAt: now$32,
267666
+ occurredAt: now$24,
267545
267667
  payload: {
267546
267668
  ...node,
267547
267669
  status: "cancelled",
267548
- completedAt: now$32
267670
+ completedAt: now$24
267549
267671
  }
267550
267672
  });
267551
267673
  for (const item of projection.turnItems) {
@@ -267554,12 +267676,12 @@ const makeOrchestrator = fn("orchestrationV2.Orchestrator.layer")(function* () {
267554
267676
  type: "turn-item.updated",
267555
267677
  threadId: command.threadId,
267556
267678
  nodeId: task.id,
267557
- occurredAt: now$32,
267679
+ occurredAt: now$24,
267558
267680
  payload: {
267559
267681
  ...item,
267560
267682
  status: "cancelled",
267561
- completedAt: now$32,
267562
- updatedAt: now$32
267683
+ completedAt: now$24,
267684
+ updatedAt: now$24
267563
267685
  }
267564
267686
  });
267565
267687
  }
@@ -267601,7 +267723,7 @@ const makeOrchestrator = fn("orchestrationV2.Orchestrator.layer")(function* () {
267601
267723
  cause: interrupted.cause
267602
267724
  });
267603
267725
  }
267604
- const now$33 = yield* now;
267726
+ const now$25 = yield* now;
267605
267727
  const executed = latestExecutedRun(projection.runs);
267606
267728
  const reached = /* @__PURE__ */ new Map();
267607
267729
  if (target !== void 0) reached.set(target.id, target);
@@ -267611,14 +267733,14 @@ const makeOrchestrator = fn("orchestrationV2.Orchestrator.layer")(function* () {
267611
267733
  events,
267612
267734
  thread: projection.thread,
267613
267735
  run,
267614
- now: now$33
267736
+ now: now$25
267615
267737
  });
267616
267738
  yield* holdStoppedThread({
267617
267739
  command,
267618
267740
  events,
267619
267741
  projection,
267620
267742
  cohortRunIds: [],
267621
- now: now$33
267743
+ now: now$25
267622
267744
  });
267623
267745
  yield* cancelIdleOrphans;
267624
267746
  });
@@ -267710,28 +267832,28 @@ const makeOrchestrator = fn("orchestrationV2.Orchestrator.layer")(function* () {
267710
267832
  cause: `Cannot roll back provider thread ${providerThread.id} to checkpoint ${targetCheckpoint.id}: target provider turn ${targetProviderTurn.id} belongs to provider thread ${targetProviderTurn.providerThreadId}.`
267711
267833
  });
267712
267834
  }
267713
- const now$52 = yield* now;
267835
+ const now$40 = yield* now;
267714
267836
  yield* emit(events, command)({
267715
267837
  type: "thread.metadata-updated",
267716
267838
  threadId: command.threadId,
267717
267839
  providerInstanceId: projection.thread.providerInstanceId,
267718
- occurredAt: now$52,
267840
+ occurredAt: now$40,
267719
267841
  payload: {
267720
267842
  ...projection.thread,
267721
267843
  rollbackRequestId: command.commandId,
267722
267844
  rollbackFailure: null,
267723
- updatedAt: now$52
267845
+ updatedAt: now$40
267724
267846
  }
267725
267847
  });
267726
267848
  yield* emit(events, command)({
267727
267849
  type: "checkpoint.rollback-requested",
267728
267850
  threadId: command.threadId,
267729
267851
  providerInstanceId: modelSelection.instanceId,
267730
- occurredAt: now$52,
267852
+ occurredAt: now$40,
267731
267853
  payload: {
267732
267854
  scopeId: targetScope.id,
267733
267855
  checkpointId: targetCheckpoint.id,
267734
- requestedAt: now$52
267856
+ requestedAt: now$40
267735
267857
  }
267736
267858
  });
267737
267859
  yield* update$4(effects, (existing) => [...existing, {
@@ -267760,19 +267882,19 @@ const makeOrchestrator = fn("orchestrationV2.Orchestrator.layer")(function* () {
267760
267882
  commandType: command.type,
267761
267883
  cause: `Rollback ${command.requestId} is no longer the thread's current rollback.`
267762
267884
  });
267763
- const now$24 = yield* now;
267885
+ const now$48 = yield* now;
267764
267886
  yield* emit(events, command)({
267765
267887
  type: "thread.metadata-updated",
267766
267888
  threadId: command.threadId,
267767
267889
  providerInstanceId: thread.providerInstanceId,
267768
- occurredAt: now$24,
267890
+ occurredAt: now$48,
267769
267891
  payload: {
267770
267892
  ...thread,
267771
267893
  rollbackFailure: {
267772
267894
  requestId: command.requestId,
267773
267895
  message: command.message
267774
267896
  },
267775
- updatedAt: now$24
267897
+ updatedAt: now$48
267776
267898
  }
267777
267899
  });
267778
267900
  });
@@ -267990,7 +268112,7 @@ const makeOrchestrator = fn("orchestrationV2.Orchestrator.layer")(function* () {
267990
268112
  const task = parentProjection.subagents.find((candidate) => candidate.id === options.taskId && candidate.origin === "app_owned" && candidate.childThreadId === childThreadId);
267991
268113
  if (task === void 0) return;
267992
268114
  if (parentProjection.contextTransfers.find((transfer) => transfer.type === "subagent_result" && transfer.sourceThreadId === childThreadId && transfer.targetThreadId === parentThreadId && (transfer.sourcePoint.runId === childRun.id || options.taskId === forkedFrom.nodeId && transfer.sourcePoint.runId === void 0)) !== void 0) return;
267993
- const now$25 = yield* now;
268115
+ const now$50 = yield* now;
267994
268116
  const result = subagentResultForRun(childProjection, {
267995
268117
  ...childRun,
267996
268118
  status: outcome
@@ -268003,15 +268125,15 @@ const makeOrchestrator = fn("orchestrationV2.Orchestrator.layer")(function* () {
268003
268125
  providerThreadId: childRun.providerThreadId,
268004
268126
  status: terminalStatus,
268005
268127
  result: result.text,
268006
- completedAt: now$25,
268007
- updatedAt: now$25
268128
+ completedAt: now$50,
268129
+ updatedAt: now$50
268008
268130
  };
268009
268131
  const completionPlan = yield* planDelegatedCompletionDelivery({
268010
268132
  parentProjection,
268011
268133
  parentRun,
268012
268134
  task,
268013
268135
  updatedTask,
268014
- now: now$25
268136
+ now: now$50
268015
268137
  });
268016
268138
  const resultTransferId = yield* idAllocator.allocate.contextTransfer({
268017
268139
  sourceThreadId: childThreadId,
@@ -268040,8 +268162,8 @@ const makeOrchestrator = fn("orchestrationV2.Orchestrator.layer")(function* () {
268040
268162
  summaryMessageId: result.messageId,
268041
268163
  summaryText: result.text,
268042
268164
  createdByProviderInstanceId: childRun.providerInstanceId,
268043
- createdAt: now$25,
268044
- updatedAt: now$25
268165
+ createdAt: now$50,
268166
+ updatedAt: now$50
268045
268167
  };
268046
268168
  const resultTransfer = {
268047
268169
  id: resultTransferId,
@@ -268063,9 +268185,9 @@ const makeOrchestrator = fn("orchestrationV2.Orchestrator.layer")(function* () {
268063
268185
  },
268064
268186
  createdBy: "system",
268065
268187
  error: null,
268066
- createdAt: now$25,
268067
- updatedAt: now$25,
268068
- consumedAt: now$25
268188
+ createdAt: now$50,
268189
+ updatedAt: now$50,
268190
+ consumedAt: now$50
268069
268191
  };
268070
268192
  yield* writeSystemEvents([
268071
268193
  {
@@ -268074,7 +268196,7 @@ const makeOrchestrator = fn("orchestrationV2.Orchestrator.layer")(function* () {
268074
268196
  ...task.runId === null ? {} : { runId: task.runId },
268075
268197
  nodeId: task.id,
268076
268198
  driver: task.driver,
268077
- occurredAt: now$25,
268199
+ occurredAt: now$50,
268078
268200
  payload: completionPlan.task
268079
268201
  },
268080
268202
  ...completionPlan.parentRun === void 0 ? [] : [{
@@ -268083,7 +268205,7 @@ const makeOrchestrator = fn("orchestrationV2.Orchestrator.layer")(function* () {
268083
268205
  runId: completionPlan.parentRun.id,
268084
268206
  ...completionPlan.parentRun.rootNodeId === null ? {} : { nodeId: completionPlan.parentRun.rootNodeId },
268085
268207
  providerInstanceId: completionPlan.parentRun.providerInstanceId,
268086
- occurredAt: now$25,
268208
+ occurredAt: now$50,
268087
268209
  payload: completionPlan.parentRun
268088
268210
  }],
268089
268211
  ...completionPlan.message === void 0 ? [] : [{
@@ -268092,7 +268214,7 @@ const makeOrchestrator = fn("orchestrationV2.Orchestrator.layer")(function* () {
268092
268214
  ...completionPlan.message.runId === null ? {} : { runId: completionPlan.message.runId },
268093
268215
  ...completionPlan.message.nodeId === null ? {} : { nodeId: completionPlan.message.nodeId },
268094
268216
  providerInstanceId: completionPlan.parentRun?.providerInstanceId ?? parentProjection.thread.providerInstanceId,
268095
- occurredAt: now$25,
268217
+ occurredAt: now$50,
268096
268218
  payload: completionPlan.message
268097
268219
  }],
268098
268220
  ...parentNode === void 0 ? [] : [{
@@ -268101,12 +268223,12 @@ const makeOrchestrator = fn("orchestrationV2.Orchestrator.layer")(function* () {
268101
268223
  ...parentNode.runId === null ? {} : { runId: parentNode.runId },
268102
268224
  nodeId: parentNode.id,
268103
268225
  driver: task.driver,
268104
- occurredAt: now$25,
268226
+ occurredAt: now$50,
268105
268227
  payload: {
268106
268228
  ...parentNode,
268107
268229
  status: terminalStatus,
268108
268230
  providerThreadId: childRun.providerThreadId,
268109
- completedAt: now$25
268231
+ completedAt: now$50
268110
268232
  }
268111
268233
  }],
268112
268234
  ...parentTurnItem === void 0 ? [] : [{
@@ -268115,13 +268237,13 @@ const makeOrchestrator = fn("orchestrationV2.Orchestrator.layer")(function* () {
268115
268237
  ...parentTurnItem.runId === null ? {} : { runId: parentTurnItem.runId },
268116
268238
  ...parentTurnItem.nodeId === null ? {} : { nodeId: parentTurnItem.nodeId },
268117
268239
  driver: task.driver,
268118
- occurredAt: now$25,
268240
+ occurredAt: now$50,
268119
268241
  payload: {
268120
268242
  ...parentTurnItem,
268121
268243
  status: terminalStatus,
268122
268244
  result: result.text,
268123
- completedAt: now$25,
268124
- updatedAt: now$25
268245
+ completedAt: now$50,
268246
+ updatedAt: now$50
268125
268247
  }
268126
268248
  }],
268127
268249
  ...resultHandoff === null ? [] : [{
@@ -268129,7 +268251,7 @@ const makeOrchestrator = fn("orchestrationV2.Orchestrator.layer")(function* () {
268129
268251
  threadId: parentThreadId,
268130
268252
  ...parentRun === void 0 ? {} : { runId: parentRun.id },
268131
268253
  providerInstanceId: childRun.providerInstanceId,
268132
- occurredAt: now$25,
268254
+ occurredAt: now$50,
268133
268255
  payload: resultHandoff
268134
268256
  }],
268135
268257
  {
@@ -268137,7 +268259,7 @@ const makeOrchestrator = fn("orchestrationV2.Orchestrator.layer")(function* () {
268137
268259
  threadId: parentThreadId,
268138
268260
  ...parentRun === void 0 ? {} : { runId: parentRun.id },
268139
268261
  providerInstanceId: childRun.providerInstanceId,
268140
- occurredAt: now$25,
268262
+ occurredAt: now$50,
268141
268263
  payload: resultTransfer
268142
268264
  }
268143
268265
  ]);
@@ -268179,7 +268301,7 @@ const makeOrchestrator = fn("orchestrationV2.Orchestrator.layer")(function* () {
268179
268301
  const cohort = parentRun?.delegatedCompletion;
268180
268302
  const delivery = cohort?.delivery;
268181
268303
  if (parentRun === void 0 || cohort === void 0 || delivery === null || delivery === void 0 || delivery.messageId !== deliveryRun.userMessageId || delivery.generation !== messageOwnership.generation) return;
268182
- const now$45 = yield* now;
268304
+ const now$34 = yield* now;
268183
268305
  const nextTaskStates = /* @__PURE__ */ new Map();
268184
268306
  for (const task of projection.subagents) {
268185
268307
  if (task.origin !== "app_owned" || task.runId !== parentRun.id || !delivery.taskIds.includes(task.id) || task.completionDelivery?.state !== "claimed") continue;
@@ -268219,11 +268341,11 @@ const makeOrchestrator = fn("orchestrationV2.Orchestrator.layer")(function* () {
268219
268341
  nodeId: task.id,
268220
268342
  driver: task.driver,
268221
268343
  providerInstanceId: task.providerInstanceId,
268222
- occurredAt: now$45,
268344
+ occurredAt: now$34,
268223
268345
  payload: {
268224
268346
  ...task,
268225
268347
  completionDelivery,
268226
- updatedAt: now$45
268348
+ updatedAt: now$34
268227
268349
  }
268228
268350
  }];
268229
268351
  });
@@ -268233,7 +268355,7 @@ const makeOrchestrator = fn("orchestrationV2.Orchestrator.layer")(function* () {
268233
268355
  runId: updatedParentRun.id,
268234
268356
  ...updatedParentRun.rootNodeId === null ? {} : { nodeId: updatedParentRun.rootNodeId },
268235
268357
  providerInstanceId: updatedParentRun.providerInstanceId,
268236
- occurredAt: now$45,
268358
+ occurredAt: now$34,
268237
268359
  payload: updatedParentRun
268238
268360
  }]);
268239
268361
  if (nextDelivery !== null) yield* offerDelegatedCompletionDelivery(threadId, parentRun.id);
@@ -268244,13 +268366,13 @@ const makeOrchestrator = fn("orchestrationV2.Orchestrator.layer")(function* () {
268244
268366
  const parentRun = projection.runs.find((run) => run.id === ownership?.parentRunId);
268245
268367
  const cohort = parentRun?.delegatedCompletion;
268246
268368
  const delivery = cohort?.delivery;
268247
- const now$31 = yield* now;
268369
+ const now$23 = yield* now;
268248
268370
  const emitEvent = emit(events, command);
268249
268371
  if (parentRun === void 0 || cohort === void 0 || cohort.disposition !== "open" || delivery == null || delivery.messageId !== command.messageId || delivery.generation !== ownership?.generation) {
268250
268372
  yield* emitEvent({
268251
268373
  type: "thread.metadata-updated",
268252
268374
  threadId: command.threadId,
268253
- occurredAt: now$31,
268375
+ occurredAt: now$23,
268254
268376
  payload: projection.thread
268255
268377
  });
268256
268378
  return;
@@ -268277,14 +268399,14 @@ const makeOrchestrator = fn("orchestrationV2.Orchestrator.layer")(function* () {
268277
268399
  nodeId: task.id,
268278
268400
  driver: task.driver,
268279
268401
  providerInstanceId: task.providerInstanceId,
268280
- occurredAt: now$31,
268402
+ occurredAt: now$23,
268281
268403
  payload: {
268282
268404
  ...task,
268283
268405
  completionDelivery: {
268284
268406
  state,
268285
268407
  observedByRunId: null
268286
268408
  },
268287
- updatedAt: now$31
268409
+ updatedAt: now$23
268288
268410
  }
268289
268411
  });
268290
268412
  }
@@ -268293,7 +268415,7 @@ const makeOrchestrator = fn("orchestrationV2.Orchestrator.layer")(function* () {
268293
268415
  threadId: command.threadId,
268294
268416
  runId: parentRun.id,
268295
268417
  providerInstanceId: parentRun.providerInstanceId,
268296
- occurredAt: now$31,
268418
+ occurredAt: now$23,
268297
268419
  payload: {
268298
268420
  ...parentRun,
268299
268421
  delegatedCompletion: {
@@ -268519,14 +268641,14 @@ const makeOrchestrator = fn("orchestrationV2.Orchestrator.layer")(function* () {
268519
268641
  commandType: command.type,
268520
268642
  cause: "Continue the limited thread before resuming its queue."
268521
268643
  });
268522
- const now$19 = yield* now;
268644
+ const now$42 = yield* now;
268523
268645
  const queued = projection.runs.filter((run) => run.status === "queued");
268524
268646
  for (const run of queued) yield* emit(events, command)({
268525
268647
  type: "run.updated",
268526
268648
  threadId: command.threadId,
268527
268649
  runId: run.id,
268528
268650
  providerInstanceId: run.providerInstanceId,
268529
- occurredAt: now$19,
268651
+ occurredAt: now$42,
268530
268652
  payload: {
268531
268653
  ...run,
268532
268654
  queueHeld: false
@@ -268535,7 +268657,7 @@ const makeOrchestrator = fn("orchestrationV2.Orchestrator.layer")(function* () {
268535
268657
  if (queued.length === 0) yield* emit(events, command)({
268536
268658
  type: "thread.metadata-updated",
268537
268659
  threadId: command.threadId,
268538
- occurredAt: now$19,
268660
+ occurredAt: now$42,
268539
268661
  payload: projection.thread
268540
268662
  });
268541
268663
  break;
@@ -269388,9 +269510,12 @@ const make$78 = gen$1(function* () {
269388
269510
  const stopDelegatedTasks = (input) => gen$1(function* () {
269389
269511
  const { subagents } = yield* orchestrator.getThreadRecords(input.threadId, ["subagents"]);
269390
269512
  const failures = [];
269513
+ const stoppedChildThreadIds = /* @__PURE__ */ new Set();
269391
269514
  for (const task of subagents) {
269392
269515
  if (task.origin !== "app_owned" || task.childThreadId === null) continue;
269393
269516
  const threadId = task.childThreadId;
269517
+ if (stoppedChildThreadIds.has(threadId)) continue;
269518
+ stoppedChildThreadIds.add(threadId);
269394
269519
  yield* dispatch({
269395
269520
  type: "thread.stop",
269396
269521
  commandId: CommandId.make(`${input.commandId}:stop:${threadId}`),
@@ -274783,6 +274908,7 @@ const layer$100 = effect(ThreadTitleRegenerationService, make$71);
274783
274908
  const CONTINUE_PROMPT = "Continue where you left off.";
274784
274909
  /** Consecutive automatic continuations allowed before a person has to step in. */
274785
274910
  const MAX_CONTINUATION_CHAIN = 3;
274911
+ const CONTINUATION_LOOP_WINDOW_MS = 3e5;
274786
274912
  /**
274787
274913
  * Whether a restart must leave this run for the user: the thread is put away,
274788
274914
  * the provider turn already ended, or the user owes an answer. Checked when
@@ -274856,7 +274982,11 @@ const continueRestartedRun = fn("RestartContinuation.continueRestartedRun")(func
274856
274982
  if (projection.runs.some((run) => run.id !== source.id && run.status !== "queued" && !cancelledBeforeStart(run) && runRanAfter(run, source))) return;
274857
274983
  if (projection.thread.providerInstanceId !== source.providerInstanceId) return;
274858
274984
  let chainLength = 0;
274859
- for (let run = source; run?.restartContinuationOfRunId !== void 0 && chainLength < MAX_CONTINUATION_CHAIN; run = projection.runs.find((candidate) => candidate.id === run?.restartContinuationOfRunId)) chainLength += 1;
274985
+ const loopWindowStart = toEpochMillis(source.completedAt ?? source.requestedAt) - CONTINUATION_LOOP_WINDOW_MS;
274986
+ for (let run = source; run?.restartContinuationOfRunId !== void 0 && chainLength < MAX_CONTINUATION_CHAIN; run = projection.runs.find((candidate) => candidate.id === run?.restartContinuationOfRunId)) {
274987
+ if (toEpochMillis(run.requestedAt) < loopWindowStart) break;
274988
+ chainLength += 1;
274989
+ }
274860
274990
  if (chainLength >= MAX_CONTINUATION_CHAIN) {
274861
274991
  yield* logWarning$1("Not continuing a run restarted too many times in a row", {
274862
274992
  threadId: input.threadId,
@@ -332221,4 +332351,4 @@ function runCli() {
332221
332351
  //#endregion
332222
332352
  export { runCli };
332223
332353
 
332224
- //# sourceMappingURL=binCli-DNod5652.mjs.map
332354
+ //# sourceMappingURL=binCli-DxnOvHXE.mjs.map