@moberg_hr/work-tree 2.0.12 → 2.1.0

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 (170) hide show
  1. package/dist/{answer-IL5AQHRO.js → answer-EGNJ2KYK.js} +4 -4
  2. package/dist/{attach-M2UXWUMO.js → attach-64ILZMTD.js} +8 -8
  3. package/dist/bin.js +2 -2
  4. package/dist/{block-OXGEQ2PZ.js → block-H74FYSLK.js} +5 -5
  5. package/dist/{broadcast-UJURJNEK.js → broadcast-WRHZWOQN.js} +2 -2
  6. package/dist/{catchup-HN4VL5XK.js → catchup-7QBOC5JJ.js} +7 -7
  7. package/dist/{chunk-EU3BS5A6.js → chunk-2LIVAJLK.js} +3 -3
  8. package/dist/{chunk-HBCL77AR.js → chunk-2QZ3RZOY.js} +4 -4
  9. package/dist/{chunk-PUYXTZ32.js → chunk-37I2GFXK.js} +3 -3
  10. package/dist/{chunk-SH7NSDRW.js → chunk-3D7MELCW.js} +2 -2
  11. package/dist/{chunk-3XY76XBD.js → chunk-3NPEMTQT.js} +2 -2
  12. package/dist/{chunk-427RB7E4.js → chunk-4Y35ABCO.js} +2 -2
  13. package/dist/{chunk-GWJVU4AS.js → chunk-6DWPIK7D.js} +4 -4
  14. package/dist/{chunk-ZFPV46FA.js → chunk-6OG3W3PY.js} +21 -12
  15. package/dist/chunk-6OG3W3PY.js.map +1 -0
  16. package/dist/{chunk-OQAQMCHF.js → chunk-723C3D5X.js} +1 -1
  17. package/dist/chunk-723C3D5X.js.map +1 -0
  18. package/dist/{chunk-R7B46WXN.js → chunk-A3M5WTVC.js} +3 -3
  19. package/dist/{chunk-YZLNJQAV.js → chunk-ATBH7QW3.js} +2 -2
  20. package/dist/{chunk-YXQIGBL6.js → chunk-DXAIGNWF.js} +2 -2
  21. package/dist/{chunk-TZWXQ4YZ.js → chunk-DXHZWRVE.js} +10 -10
  22. package/dist/{chunk-5LZZ73MS.js → chunk-HY566NNR.js} +44 -43
  23. package/dist/chunk-HY566NNR.js.map +1 -0
  24. package/dist/{chunk-UAAH334K.js → chunk-KFSLF65S.js} +37 -6
  25. package/dist/chunk-KFSLF65S.js.map +1 -0
  26. package/dist/{chunk-PVN5IGDZ.js → chunk-LCSWFGIM.js} +2 -2
  27. package/dist/{chunk-ACXPSQJR.js → chunk-MI3PS2SH.js} +18 -1
  28. package/dist/{chunk-ACXPSQJR.js.map → chunk-MI3PS2SH.js.map} +1 -1
  29. package/dist/{chunk-MVU7JAKG.js → chunk-MLTMXVLD.js} +2 -2
  30. package/dist/{chunk-TVMZ4NYY.js → chunk-MXIFBNCV.js} +5 -5
  31. package/dist/{chunk-RLR66XLG.js → chunk-NPVMYGT7.js} +2 -2
  32. package/dist/{chunk-M7AUWYOP.js → chunk-OND6YRWZ.js} +4 -4
  33. package/dist/{chunk-HDO3PXCU.js → chunk-ONEXQW7Q.js} +3 -3
  34. package/dist/{chunk-6O6765M7.js → chunk-POTGMLPV.js} +2 -2
  35. package/dist/{chunk-OW46TR4G.js → chunk-PYOSW6X5.js} +3 -3
  36. package/dist/{chunk-YJVZ5H3I.js → chunk-QXDBVVSC.js} +2 -2
  37. package/dist/{chunk-7UU5LPDM.js → chunk-S45H7N6X.js} +5 -5
  38. package/dist/{chunk-B2RCWZUW.js → chunk-SSVVCHJB.js} +35 -7
  39. package/dist/chunk-SSVVCHJB.js.map +1 -0
  40. package/dist/chunk-TNJF7T33.js +17 -0
  41. package/dist/chunk-TNJF7T33.js.map +1 -0
  42. package/dist/{chunk-SRIYY5HL.js → chunk-U4UB4LG6.js} +2 -2
  43. package/dist/chunk-UIZEMKED.js +9 -0
  44. package/dist/{chunk-4U52S7AZ.js.map → chunk-UIZEMKED.js.map} +1 -1
  45. package/dist/{chunk-HBXDIRM4.js → chunk-XILMZRNS.js} +3 -3
  46. package/dist/{chunk-MIIJ2HQS.js → chunk-YEEDWV4H.js} +3 -3
  47. package/dist/{cleanup-MHPHSM5I.js → cleanup-YSVZAGJF.js} +15 -15
  48. package/dist/{cli-QF7GRSWT.js → cli-XT4AS3M2.js} +3 -3
  49. package/dist/{config-SSWYCX4C.js → config-GQRUETZ6.js} +2 -2
  50. package/dist/{diff-JBCBQM4I.js → diff-L3TWGBA4.js} +4 -4
  51. package/dist/{digest-WCZD6N7M.js → digest-R52JZ3AK.js} +4 -4
  52. package/dist/{fork-CISFOOAQ.js → fork-MCPMOGS5.js} +14 -14
  53. package/dist/{hook-CA5X3VKU.js → hook-S64C4G2C.js} +4 -4
  54. package/dist/{hydrate-Q4FWUQRC.js → hydrate-G5AMKHRD.js} +2 -2
  55. package/dist/{init-AT3BQLXM.js → init-PCZCSRZI.js} +3 -3
  56. package/dist/{move-CE5NIZKL.js → move-MMGOA7MV.js} +5 -5
  57. package/dist/{note-JOR53JP4.js → note-WVKK65IH.js} +4 -4
  58. package/dist/{overlaps-GXSEH2LG.js → overlaps-REVVBZCX.js} +4 -4
  59. package/dist/{pin-DAWKCVB2.js → pin-NRSD2ZT7.js} +4 -4
  60. package/dist/{pr-RKOVRSHC.js → pr-JYOI7LCK.js} +3 -3
  61. package/dist/{prune-DS73W7LT.js → prune-AGZ24MPD.js} +14 -14
  62. package/dist/{pty-host-5Z3GYXTW.js → pty-host-AZ2ORVV2.js} +116 -15
  63. package/dist/pty-host-AZ2ORVV2.js.map +1 -0
  64. package/dist/{read-IKDSIDJD.js → read-A7LFAPPZ.js} +4 -4
  65. package/dist/{recent-2LM44HN2.js → recent-H2LD5JOK.js} +2 -2
  66. package/dist/{remove-DEDH57GP.js → remove-3HQTJQWN.js} +13 -13
  67. package/dist/restart-BTUO4DTI.js +70 -0
  68. package/dist/restart-BTUO4DTI.js.map +1 -0
  69. package/dist/{resume-VA34T7ZR.js → resume-I7GXT2II.js} +2 -2
  70. package/dist/{run-E2WZPHHK.js → run-TE2AFYA6.js} +2 -2
  71. package/dist/{screen-KUXSDDLB.js → screen-XZPDSK65.js} +4 -4
  72. package/dist/{search-FJUZPI3P.js → search-MGTME3CE.js} +2 -2
  73. package/dist/{section-QLUIAYAV.js → section-YVBDU5MO.js} +4 -4
  74. package/dist/{send-V6LL6YR6.js → send-WKIX3AT5.js} +5 -5
  75. package/dist/{sessions-AGFO7W5U.js → sessions-2OWYXO55.js} +11 -11
  76. package/dist/{snooze-JXI7VZJ4.js → snooze-WKY2T4VZ.js} +4 -4
  77. package/dist/{start-5XFUYT6I.js → start-ZCQT7G4C.js} +4 -4
  78. package/dist/{status-U5HKQ7MY.js → status-INIBC7GA.js} +2 -2
  79. package/dist/{stop-PFI7J2CS.js → stop-H4PTRFNX.js} +4 -4
  80. package/dist/{sync-S4IJT2WR.js → sync-6SHCY6LZ.js} +14 -14
  81. package/dist/{time-VDRCEIYQ.js → time-XQ2R7Z33.js} +5 -5
  82. package/dist/{timesheet-LSRRWV7Z.js → timesheet-DX2TLHIB.js} +6 -6
  83. package/dist/{tree-7S4DUZRZ.js → tree-5AAHU4K5.js} +8 -8
  84. package/dist/{update-DXIY6BEX.js → update-6G2E5QXG.js} +6 -6
  85. package/dist/{wait-KPH5BQUD.js → wait-LFFXWBY7.js} +5 -5
  86. package/dist/wd-bin.js +2 -2
  87. package/dist/web/assets/{PtyView-CKEfBQ3-.js → PtyView-l4za-VIj.js} +2 -2
  88. package/dist/web/assets/{PtyView-CKEfBQ3-.js.map → PtyView-l4za-VIj.js.map} +1 -1
  89. package/dist/web/assets/{index-DJsnmqYW.css → index-B4wFhe7U.css} +1 -1
  90. package/dist/web/assets/index-DaCK_AAw.js +118 -0
  91. package/dist/web/assets/index-DaCK_AAw.js.map +1 -0
  92. package/dist/web/index.html +2 -2
  93. package/dist/{web-ISGYHCTC.js → web-MWSFIUIJ.js} +415 -87
  94. package/dist/web-MWSFIUIJ.js.map +1 -0
  95. package/npm-shrinkwrap.json +2 -2
  96. package/package.json +1 -1
  97. package/dist/chunk-4U52S7AZ.js +0 -9
  98. package/dist/chunk-5LZZ73MS.js.map +0 -1
  99. package/dist/chunk-B2RCWZUW.js.map +0 -1
  100. package/dist/chunk-OQAQMCHF.js.map +0 -1
  101. package/dist/chunk-UAAH334K.js.map +0 -1
  102. package/dist/chunk-ZFPV46FA.js.map +0 -1
  103. package/dist/pty-host-5Z3GYXTW.js.map +0 -1
  104. package/dist/web/assets/index-CHA-bad8.js +0 -118
  105. package/dist/web/assets/index-CHA-bad8.js.map +0 -1
  106. package/dist/web-ISGYHCTC.js.map +0 -1
  107. /package/dist/{answer-IL5AQHRO.js.map → answer-EGNJ2KYK.js.map} +0 -0
  108. /package/dist/{attach-M2UXWUMO.js.map → attach-64ILZMTD.js.map} +0 -0
  109. /package/dist/{block-OXGEQ2PZ.js.map → block-H74FYSLK.js.map} +0 -0
  110. /package/dist/{broadcast-UJURJNEK.js.map → broadcast-WRHZWOQN.js.map} +0 -0
  111. /package/dist/{catchup-HN4VL5XK.js.map → catchup-7QBOC5JJ.js.map} +0 -0
  112. /package/dist/{chunk-EU3BS5A6.js.map → chunk-2LIVAJLK.js.map} +0 -0
  113. /package/dist/{chunk-HBCL77AR.js.map → chunk-2QZ3RZOY.js.map} +0 -0
  114. /package/dist/{chunk-PUYXTZ32.js.map → chunk-37I2GFXK.js.map} +0 -0
  115. /package/dist/{chunk-SH7NSDRW.js.map → chunk-3D7MELCW.js.map} +0 -0
  116. /package/dist/{chunk-3XY76XBD.js.map → chunk-3NPEMTQT.js.map} +0 -0
  117. /package/dist/{chunk-427RB7E4.js.map → chunk-4Y35ABCO.js.map} +0 -0
  118. /package/dist/{chunk-GWJVU4AS.js.map → chunk-6DWPIK7D.js.map} +0 -0
  119. /package/dist/{chunk-R7B46WXN.js.map → chunk-A3M5WTVC.js.map} +0 -0
  120. /package/dist/{chunk-YZLNJQAV.js.map → chunk-ATBH7QW3.js.map} +0 -0
  121. /package/dist/{chunk-YXQIGBL6.js.map → chunk-DXAIGNWF.js.map} +0 -0
  122. /package/dist/{chunk-TZWXQ4YZ.js.map → chunk-DXHZWRVE.js.map} +0 -0
  123. /package/dist/{chunk-PVN5IGDZ.js.map → chunk-LCSWFGIM.js.map} +0 -0
  124. /package/dist/{chunk-MVU7JAKG.js.map → chunk-MLTMXVLD.js.map} +0 -0
  125. /package/dist/{chunk-TVMZ4NYY.js.map → chunk-MXIFBNCV.js.map} +0 -0
  126. /package/dist/{chunk-RLR66XLG.js.map → chunk-NPVMYGT7.js.map} +0 -0
  127. /package/dist/{chunk-M7AUWYOP.js.map → chunk-OND6YRWZ.js.map} +0 -0
  128. /package/dist/{chunk-HDO3PXCU.js.map → chunk-ONEXQW7Q.js.map} +0 -0
  129. /package/dist/{chunk-6O6765M7.js.map → chunk-POTGMLPV.js.map} +0 -0
  130. /package/dist/{chunk-OW46TR4G.js.map → chunk-PYOSW6X5.js.map} +0 -0
  131. /package/dist/{chunk-YJVZ5H3I.js.map → chunk-QXDBVVSC.js.map} +0 -0
  132. /package/dist/{chunk-7UU5LPDM.js.map → chunk-S45H7N6X.js.map} +0 -0
  133. /package/dist/{chunk-SRIYY5HL.js.map → chunk-U4UB4LG6.js.map} +0 -0
  134. /package/dist/{chunk-HBXDIRM4.js.map → chunk-XILMZRNS.js.map} +0 -0
  135. /package/dist/{chunk-MIIJ2HQS.js.map → chunk-YEEDWV4H.js.map} +0 -0
  136. /package/dist/{cleanup-MHPHSM5I.js.map → cleanup-YSVZAGJF.js.map} +0 -0
  137. /package/dist/{cli-QF7GRSWT.js.map → cli-XT4AS3M2.js.map} +0 -0
  138. /package/dist/{config-SSWYCX4C.js.map → config-GQRUETZ6.js.map} +0 -0
  139. /package/dist/{diff-JBCBQM4I.js.map → diff-L3TWGBA4.js.map} +0 -0
  140. /package/dist/{digest-WCZD6N7M.js.map → digest-R52JZ3AK.js.map} +0 -0
  141. /package/dist/{fork-CISFOOAQ.js.map → fork-MCPMOGS5.js.map} +0 -0
  142. /package/dist/{hook-CA5X3VKU.js.map → hook-S64C4G2C.js.map} +0 -0
  143. /package/dist/{hydrate-Q4FWUQRC.js.map → hydrate-G5AMKHRD.js.map} +0 -0
  144. /package/dist/{init-AT3BQLXM.js.map → init-PCZCSRZI.js.map} +0 -0
  145. /package/dist/{move-CE5NIZKL.js.map → move-MMGOA7MV.js.map} +0 -0
  146. /package/dist/{note-JOR53JP4.js.map → note-WVKK65IH.js.map} +0 -0
  147. /package/dist/{overlaps-GXSEH2LG.js.map → overlaps-REVVBZCX.js.map} +0 -0
  148. /package/dist/{pin-DAWKCVB2.js.map → pin-NRSD2ZT7.js.map} +0 -0
  149. /package/dist/{pr-RKOVRSHC.js.map → pr-JYOI7LCK.js.map} +0 -0
  150. /package/dist/{prune-DS73W7LT.js.map → prune-AGZ24MPD.js.map} +0 -0
  151. /package/dist/{read-IKDSIDJD.js.map → read-A7LFAPPZ.js.map} +0 -0
  152. /package/dist/{recent-2LM44HN2.js.map → recent-H2LD5JOK.js.map} +0 -0
  153. /package/dist/{remove-DEDH57GP.js.map → remove-3HQTJQWN.js.map} +0 -0
  154. /package/dist/{resume-VA34T7ZR.js.map → resume-I7GXT2II.js.map} +0 -0
  155. /package/dist/{run-E2WZPHHK.js.map → run-TE2AFYA6.js.map} +0 -0
  156. /package/dist/{screen-KUXSDDLB.js.map → screen-XZPDSK65.js.map} +0 -0
  157. /package/dist/{search-FJUZPI3P.js.map → search-MGTME3CE.js.map} +0 -0
  158. /package/dist/{section-QLUIAYAV.js.map → section-YVBDU5MO.js.map} +0 -0
  159. /package/dist/{send-V6LL6YR6.js.map → send-WKIX3AT5.js.map} +0 -0
  160. /package/dist/{sessions-AGFO7W5U.js.map → sessions-2OWYXO55.js.map} +0 -0
  161. /package/dist/{snooze-JXI7VZJ4.js.map → snooze-WKY2T4VZ.js.map} +0 -0
  162. /package/dist/{start-5XFUYT6I.js.map → start-ZCQT7G4C.js.map} +0 -0
  163. /package/dist/{status-U5HKQ7MY.js.map → status-INIBC7GA.js.map} +0 -0
  164. /package/dist/{stop-PFI7J2CS.js.map → stop-H4PTRFNX.js.map} +0 -0
  165. /package/dist/{sync-S4IJT2WR.js.map → sync-6SHCY6LZ.js.map} +0 -0
  166. /package/dist/{time-VDRCEIYQ.js.map → time-XQ2R7Z33.js.map} +0 -0
  167. /package/dist/{timesheet-LSRRWV7Z.js.map → timesheet-DX2TLHIB.js.map} +0 -0
  168. /package/dist/{tree-7S4DUZRZ.js.map → tree-5AAHU4K5.js.map} +0 -0
  169. /package/dist/{update-DXIY6BEX.js.map → update-6G2E5QXG.js.map} +0 -0
  170. /package/dist/{wait-KPH5BQUD.js.map → wait-LFFXWBY7.js.map} +0 -0
@@ -19,10 +19,24 @@ import {
19
19
  serveSpa,
20
20
  sessionBaseForPath,
21
21
  submitReviewSchema
22
- } from "./chunk-B2RCWZUW.js";
22
+ } from "./chunk-SSVVCHJB.js";
23
+ import {
24
+ announceChange,
25
+ createArchivedRows,
26
+ linkedComments,
27
+ linkedSession,
28
+ prStageWire,
29
+ readContextUsage,
30
+ reviewThreadsOf,
31
+ scopeLinkedStoreIds,
32
+ sessionLinkedStoreIds,
33
+ sessionWire,
34
+ stageSeenKey,
35
+ storeHolding
36
+ } from "./chunk-MXIFBNCV.js";
23
37
  import {
24
38
  createDigestSource
25
- } from "./chunk-PUYXTZ32.js";
39
+ } from "./chunk-37I2GFXK.js";
26
40
  import {
27
41
  agentsBySession,
28
42
  createBuildFoldersJob,
@@ -31,7 +45,12 @@ import {
31
45
  deleteMergedBranches,
32
46
  findMergedBranches,
33
47
  summarizeAgents
34
- } from "./chunk-HBCL77AR.js";
48
+ } from "./chunk-2QZ3RZOY.js";
49
+ import {
50
+ DiffStatCache,
51
+ findOverlaps,
52
+ wantsDiffStat
53
+ } from "./chunk-QXDBVVSC.js";
35
54
  import {
36
55
  defaultTimeDeps,
37
56
  fetchIssueDetail,
@@ -44,29 +63,14 @@ import {
44
63
  graphProblem,
45
64
  signOutGraph,
46
65
  startDeviceLogin
47
- } from "./chunk-M7AUWYOP.js";
66
+ } from "./chunk-OND6YRWZ.js";
48
67
  import {
49
68
  defaultCleanupDeps
50
- } from "./chunk-7UU5LPDM.js";
69
+ } from "./chunk-S45H7N6X.js";
51
70
  import {
52
- announceChange,
53
- createArchivedRows,
54
- linkedComments,
55
- linkedSession,
56
- prStageWire,
57
- readContextUsage,
58
- reviewThreadsOf,
59
- scopeLinkedStoreIds,
60
- sessionLinkedStoreIds,
61
- sessionWire,
62
- stageSeenKey,
63
- storeHolding
64
- } from "./chunk-TVMZ4NYY.js";
65
- import {
66
- DiffStatCache,
67
- findOverlaps,
68
- wantsDiffStat
69
- } from "./chunk-YJVZ5H3I.js";
71
+ LATER_TEXT,
72
+ restartCountsText
73
+ } from "./chunk-TNJF7T33.js";
70
74
  import {
71
75
  MAX_NOTE_CHARS,
72
76
  readNote,
@@ -83,7 +87,7 @@ import {
83
87
  removeBlocker,
84
88
  sweepBlocks,
85
89
  unblockedPrompt
86
- } from "./chunk-YZLNJQAV.js";
90
+ } from "./chunk-ATBH7QW3.js";
87
91
  import {
88
92
  jiraWorklogPoster,
89
93
  logWorkDay,
@@ -92,7 +96,7 @@ import {
92
96
  } from "./chunk-LPJEV4R2.js";
93
97
  import {
94
98
  sessionWorkTime
95
- } from "./chunk-YXQIGBL6.js";
99
+ } from "./chunk-DXAIGNWF.js";
96
100
  import {
97
101
  sendToSession
98
102
  } from "./chunk-RYNBBSLY.js";
@@ -118,7 +122,11 @@ import {
118
122
  archiveMergedSession,
119
123
  archiveWaiting,
120
124
  defaultArchiveDeps
121
- } from "./chunk-TZWXQ4YZ.js";
125
+ } from "./chunk-DXHZWRVE.js";
126
+ import {
127
+ cleanupVerdict,
128
+ createCleanupJob
129
+ } from "./chunk-AKMPF72Y.js";
122
130
  import {
123
131
  MAX_REPLY_CHARS,
124
132
  THREAD_ID,
@@ -130,20 +138,16 @@ import {
130
138
  rememberSent,
131
139
  saveDraft
132
140
  } from "./chunk-26IZBYVL.js";
133
- import {
134
- cleanupVerdict,
135
- createCleanupJob
136
- } from "./chunk-AKMPF72Y.js";
137
141
  import {
138
142
  defaultForkDeps,
139
143
  forkSession,
140
144
  startSessionWithPrompt
141
- } from "./chunk-GWJVU4AS.js";
145
+ } from "./chunk-6DWPIK7D.js";
142
146
  import {
143
147
  createInChild,
144
148
  createInProcess,
145
149
  oneAtATime
146
- } from "./chunk-OW46TR4G.js";
150
+ } from "./chunk-PYOSW6X5.js";
147
151
  import {
148
152
  resolveWorkBinPath
149
153
  } from "./chunk-AH5TM3NB.js";
@@ -151,7 +155,7 @@ import {
151
155
  teardownWorktree,
152
156
  toBaseSpec,
153
157
  wouldRefuseRemoval
154
- } from "./chunk-ZFPV46FA.js";
158
+ } from "./chunk-6OG3W3PY.js";
155
159
  import {
156
160
  isWorktreeFolder
157
161
  } from "./chunk-L6RUHCKB.js";
@@ -169,18 +173,21 @@ import {
169
173
  listHostPtys,
170
174
  outputStatus,
171
175
  peekPty,
176
+ ptyLastOutputMs,
177
+ ptyPid,
172
178
  ptyPids,
173
179
  readPtyScreen,
180
+ restartPty,
174
181
  resumePersistedSessions,
175
182
  spawnSpecFor,
176
183
  subscribeSession,
177
184
  syncPtyPool,
178
185
  writeToPty
179
- } from "./chunk-UAAH334K.js";
186
+ } from "./chunk-KFSLF65S.js";
180
187
  import {
181
188
  dbPtySessions
182
- } from "./chunk-SRIYY5HL.js";
183
- import "./chunk-ACXPSQJR.js";
189
+ } from "./chunk-U4UB4LG6.js";
190
+ import "./chunk-MI3PS2SH.js";
184
191
  import {
185
192
  BehindCache,
186
193
  behindMain,
@@ -196,28 +203,28 @@ import {
196
203
  stackedOn,
197
204
  updateFromBase,
198
205
  updateFromMain
199
- } from "./chunk-HDO3PXCU.js";
206
+ } from "./chunk-ONEXQW7Q.js";
200
207
  import {
201
208
  sessionStatusView,
202
209
  shownState
203
- } from "./chunk-427RB7E4.js";
210
+ } from "./chunk-4Y35ABCO.js";
204
211
  import {
205
212
  askCatchUp,
206
213
  cachedCatchUp,
207
214
  catchUp,
208
215
  catchUpFacts,
209
216
  forgetCatchUp
210
- } from "./chunk-MIIJ2HQS.js";
217
+ } from "./chunk-YEEDWV4H.js";
211
218
  import {
212
219
  runInternal,
213
220
  summarizeCheckpoint,
214
221
  throttleTrailing
215
- } from "./chunk-R7B46WXN.js";
222
+ } from "./chunk-A3M5WTVC.js";
216
223
  import {
217
224
  computeDiff,
218
225
  computeRangeDiff,
219
226
  parseGitDiff
220
- } from "./chunk-6O6765M7.js";
227
+ } from "./chunk-POTGMLPV.js";
221
228
  import {
222
229
  applyPlacePatch,
223
230
  applySectionOp,
@@ -232,7 +239,7 @@ import {
232
239
  } from "./chunk-LNHSBM4L.js";
233
240
  import {
234
241
  VERSION
235
- } from "./chunk-4U52S7AZ.js";
242
+ } from "./chunk-UIZEMKED.js";
236
243
  import {
237
244
  resolveProjectTarget
238
245
  } from "./chunk-JTHILJFB.js";
@@ -274,13 +281,13 @@ import {
274
281
  CONTEXT_WARN,
275
282
  describeView,
276
283
  writeAssistantContext
277
- } from "./chunk-3XY76XBD.js";
284
+ } from "./chunk-3NPEMTQT.js";
278
285
  import {
279
286
  NOTE_NUDGE,
280
287
  findSessionForCwd,
281
288
  readPendingForSession,
282
289
  readPendingForWorktree
283
- } from "./chunk-PVN5IGDZ.js";
290
+ } from "./chunk-LCSWFGIM.js";
284
291
  import "./chunk-ZSHWP2VS.js";
285
292
  import {
286
293
  getCommentFileStore
@@ -292,7 +299,7 @@ import {
292
299
  checkTools,
293
300
  saveFolders,
294
301
  setupState
295
- } from "./chunk-RLR66XLG.js";
302
+ } from "./chunk-NPVMYGT7.js";
296
303
  import {
297
304
  enrollProblem,
298
305
  groupProblem,
@@ -381,7 +388,7 @@ import {
381
388
  turnInProgress,
382
389
  updateCheckpoint,
383
390
  writeArchiveRecord
384
- } from "./chunk-OQAQMCHF.js";
391
+ } from "./chunk-723C3D5X.js";
385
392
  import {
386
393
  activityRoots,
387
394
  agentOf,
@@ -424,7 +431,7 @@ import {
424
431
  import chalk from "chalk";
425
432
 
426
433
  // src/server/web-server.ts
427
- import fs10 from "fs";
434
+ import fs12 from "fs";
428
435
 
429
436
  // src/server/routes/session-control-routes.ts
430
437
  function realDeps(app) {
@@ -808,22 +815,71 @@ function mountNoteRoutes(app, opts) {
808
815
  });
809
816
  }
810
817
 
811
- // src/core/diff/diff-seen.ts
812
- function isSeen(v) {
818
+ // src/core/diff/diff-looks.ts
819
+ var LOOK_JOIN_MS = 15 * 6e4;
820
+ var MAX_LOOKS = 20;
821
+ var isTime = (v) => typeof v === "string" && Number.isFinite(Date.parse(v));
822
+ var isTurn = (v) => typeof v === "number" && Number.isInteger(v) && v >= 0;
823
+ function isLook(v) {
824
+ const o = v;
825
+ return !!o && typeof o === "object" && isTurn(o.from) && isTurn(o.to) && o.to > o.from && isTime(o.startedAt) && isTime(o.at) && (o.fromTs === void 0 || isTime(o.fromTs)) && (o.toTs === void 0 || isTime(o.toTs));
826
+ }
827
+ function cleanSeen(v) {
813
828
  const o = v;
814
- return !!o && typeof o === "object" && typeof o.checkpointId === "number" && typeof o.at === "string";
829
+ if (!o || typeof o !== "object" || !isTurn(o.checkpointId) || !isTime(o.at)) return null;
830
+ const looks = Array.isArray(o.looks) ? o.looks.filter(isLook) : [];
831
+ return {
832
+ checkpointId: o.checkpointId,
833
+ at: o.at,
834
+ ...isTime(o.ts) ? { ts: o.ts } : {},
835
+ ...looks.length ? { looks } : {}
836
+ };
837
+ }
838
+ function rebaselined(old, checkpointId, ts, marked) {
839
+ if (marked && old.ts && marked.checkpointId === old.checkpointId && marked.ts !== old.ts) return true;
840
+ return checkpointId <= old.checkpointId && !!ts && !!old.ts && Date.parse(ts) > Date.parse(old.ts);
815
841
  }
842
+ function markedTurn(v) {
843
+ const o = v;
844
+ if (!o || typeof o !== "object" || !isTurn(o.checkpointId)) return void 0;
845
+ if (o.ts !== null && !isTime(o.ts)) return void 0;
846
+ return { checkpointId: o.checkpointId, ts: o.ts };
847
+ }
848
+ function nextSeen(old, checkpointId, now, ts, marked) {
849
+ const fresh = !!old && rebaselined(old, checkpointId, ts, marked);
850
+ if (old && old.checkpointId >= checkpointId && !fresh) return old;
851
+ if (old?.ts && ts && Date.parse(ts) < Date.parse(old.ts)) return old;
852
+ const at = now.toISOString();
853
+ const looks = (old?.looks ?? []).filter(isLook);
854
+ if (old && !fresh) {
855
+ const last = looks.at(-1);
856
+ if (last && last.to === old.checkpointId && last.toTs === old.ts && now.getTime() - Date.parse(last.at) < LOOK_JOIN_MS) {
857
+ looks[looks.length - 1] = { ...last, to: checkpointId, ...ts ? { toTs: ts } : {}, at };
858
+ } else {
859
+ looks.push({
860
+ from: old.checkpointId,
861
+ to: checkpointId,
862
+ ...old.ts ? { fromTs: old.ts } : {},
863
+ ...ts ? { toTs: ts } : {},
864
+ startedAt: at,
865
+ at
866
+ });
867
+ }
868
+ }
869
+ return { checkpointId, at, ...ts ? { ts } : {}, ...looks.length ? { looks: looks.slice(-MAX_LOOKS) } : {} };
870
+ }
871
+
872
+ // src/core/diff/diff-seen.ts
816
873
  function readDiffSeen(sessionId) {
817
874
  const row = withDb((d) => d.prepare("SELECT data FROM diff_seen WHERE session_id = ?").get(sessionId));
818
- const v = row ? json.parse(row.data) : null;
819
- return isSeen(v) ? v : null;
875
+ return row ? cleanSeen(json.parse(row.data)) : null;
820
876
  }
821
- function markDiffSeen(sessionId, checkpointId, now = /* @__PURE__ */ new Date()) {
877
+ function markDiffSeen(sessionId, checkpointId, now = /* @__PURE__ */ new Date(), ts, marked) {
822
878
  return tx((d) => {
823
879
  const row = d.prepare("SELECT data FROM diff_seen WHERE session_id = ?").get(sessionId);
824
- const old = row ? json.parse(row.data) : null;
825
- if (isSeen(old) && old.checkpointId >= checkpointId) return old;
826
- const seen = { checkpointId, at: now.toISOString() };
880
+ const old = row ? cleanSeen(json.parse(row.data)) : null;
881
+ const seen = nextSeen(old, checkpointId, now, ts, marked);
882
+ if (seen === old) return old;
827
883
  d.prepare("INSERT OR REPLACE INTO diff_seen (session_id, data) VALUES (?, ?)").run(sessionId, JSON.stringify(seen));
828
884
  return seen;
829
885
  });
@@ -842,7 +898,9 @@ function mountDiffSeenRoutes(app) {
842
898
  const body = await c.req.json().catch(() => null);
843
899
  const cp = body?.checkpointId;
844
900
  if (typeof cp !== "number" || !Number.isInteger(cp) || cp < 0) return c.json({ error: "expected {checkpointId}" }, 400);
845
- return c.json({ seen: markDiffSeen(id, cp) });
901
+ const ts = typeof body?.ts === "string" && Number.isFinite(Date.parse(body.ts)) ? body.ts : void 0;
902
+ const marked = markedTurn(body?.marked);
903
+ return c.json({ seen: markDiffSeen(id, cp, /* @__PURE__ */ new Date(), ts, marked) });
846
904
  });
847
905
  }
848
906
 
@@ -1714,7 +1772,7 @@ function describeStall(s) {
1714
1772
  }
1715
1773
 
1716
1774
  // src/server/web-server.ts
1717
- import path13 from "path";
1775
+ import path14 from "path";
1718
1776
  import { Hono } from "hono";
1719
1777
  import { streamSSE as streamSSE2 } from "hono/streaming";
1720
1778
 
@@ -3369,7 +3427,7 @@ function createActivityLog(opts = {}) {
3369
3427
  changed();
3370
3428
  return {
3371
3429
  next(atMs) {
3372
- s.nextAt = iso(atMs);
3430
+ s.nextAt = atMs === null ? null : iso(atMs);
3373
3431
  changed();
3374
3432
  },
3375
3433
  pause(untilMs, why) {
@@ -4746,6 +4804,220 @@ async function bridgeToHost(ws, sessionId, pending) {
4746
4804
  });
4747
4805
  }
4748
4806
 
4807
+ // src/core/pty/agent-restart.ts
4808
+ import fs11 from "fs";
4809
+
4810
+ // src/core/platform/find-on-path.ts
4811
+ import fs10 from "fs";
4812
+ import path13 from "path";
4813
+ function findOnPath(cmd, env = process.env, platform = process.platform) {
4814
+ const win = platform === "win32";
4815
+ const isFile = (p) => {
4816
+ try {
4817
+ const st = fs10.statSync(p);
4818
+ return st.isFile() && (win || (st.mode & 73) !== 0);
4819
+ } catch {
4820
+ return false;
4821
+ }
4822
+ };
4823
+ const pathExt = (env.PATHEXT ?? env.Pathext ?? ".COM;.EXE;.BAT;.CMD").split(";").filter(Boolean).map((e) => e.toLowerCase());
4824
+ const hasExt = pathExt.includes(path13.extname(cmd).toLowerCase());
4825
+ const candidates = (base) => !win || hasExt ? [base] : pathExt.map((e) => base + e);
4826
+ if (cmd.includes("/") || win && cmd.includes("\\")) return candidates(cmd).find(isFile) ?? null;
4827
+ const dirs = (env.PATH ?? env.Path ?? "").split(win ? ";" : path13.delimiter).filter(Boolean);
4828
+ for (const dir of dirs) {
4829
+ const hit = candidates(path13.join(dir, cmd)).find(isFile);
4830
+ if (hit) return hit;
4831
+ }
4832
+ return null;
4833
+ }
4834
+
4835
+ // src/core/pty/agent-restart.ts
4836
+ var PACKED_MTIME_BEFORE = Date.parse("1990-01-01T00:00:00Z");
4837
+ function installedAt(cmd, find = findOnPath) {
4838
+ const file = find(cmd);
4839
+ if (!file) return null;
4840
+ try {
4841
+ return installTime(fs11.statSync(fs11.realpathSync(file)));
4842
+ } catch {
4843
+ return null;
4844
+ }
4845
+ }
4846
+ function installTime(st) {
4847
+ const real = (ms) => ms >= PACKED_MTIME_BEFORE ? ms : null;
4848
+ const known = [real(st.mtimeMs), real(st.birthtimeMs)].filter((x) => x !== null);
4849
+ return known.length ? Math.max(...known) : st.ctimeMs;
4850
+ }
4851
+ function installedAtCache(ttlMs = 6e4, look = installedAt, now = Date.now) {
4852
+ const cache = /* @__PURE__ */ new Map();
4853
+ return (cmd) => {
4854
+ const hit = cache.get(cmd);
4855
+ if (hit && now() - hit.read < ttlMs) return hit.at;
4856
+ const at = look(cmd);
4857
+ cache.set(cmd, { at, read: now() });
4858
+ return at;
4859
+ };
4860
+ }
4861
+ function outdatedPtys(ptys, toolInstalledAt) {
4862
+ return ptys.filter((p) => {
4863
+ if (p.exited || !p.tool) return false;
4864
+ const at = toolInstalledAt(p.tool);
4865
+ const started = Date.parse(p.startedAt);
4866
+ return at !== null && Number.isFinite(started) && started < at;
4867
+ });
4868
+ }
4869
+ var PRINTING_MS = 1e4;
4870
+ function busyForRestart(state, lastOutputMs, now = Date.now(), live = null) {
4871
+ if (live === "busy" || live === "waiting") return true;
4872
+ if (state === "working" || state === "needs_input") return true;
4873
+ return lastOutputMs !== null && now - lastOutputMs < PRINTING_MS;
4874
+ }
4875
+ function restartPlan(ids, busy) {
4876
+ const now = [];
4877
+ const later = [];
4878
+ for (const id of new Set(ids)) (busy(id) ? later : now).push(id);
4879
+ return { now, later };
4880
+ }
4881
+ var RESTART_AT_ONCE = 3;
4882
+ function restartNotesSummary(notes) {
4883
+ const n = (level) => notes.filter((x) => x.level === level).length;
4884
+ return restartCountsText({ restarted: n("action"), later: n("info"), failed: n("warn") });
4885
+ }
4886
+ var QUEUE_RECHECK_MS = 15e3;
4887
+ var TURN_END_GRACE_MS = 1e4;
4888
+ function createRestarter(deps) {
4889
+ const queued = /* @__PURE__ */ new Set();
4890
+ const inFlight = /* @__PURE__ */ new Map();
4891
+ const later = deps.later ?? ((fn, ms) => void setTimeout(fn, ms).unref?.());
4892
+ const one = (id) => {
4893
+ const running = inFlight.get(id);
4894
+ if (running) return running;
4895
+ queued.delete(id);
4896
+ const p = deps.restart(id).then(
4897
+ (how) => ({ ok: true, how: how || "restarted its agent (its conversation goes on)" }),
4898
+ (err) => ({ ok: false, error: err.message })
4899
+ );
4900
+ inFlight.set(id, p);
4901
+ void p.finally(() => inFlight.delete(id));
4902
+ return p;
4903
+ };
4904
+ const run = async (ids, notes) => {
4905
+ const failed = [];
4906
+ const ok = /* @__PURE__ */ new Set();
4907
+ const queue = [...ids];
4908
+ const worker = async () => {
4909
+ for (let id = queue.shift(); id !== void 0; id = queue.shift()) {
4910
+ const r = await one(id);
4911
+ if (r.ok) {
4912
+ ok.add(id);
4913
+ notes.push({ id, text: r.how, level: "action" });
4914
+ } else {
4915
+ failed.push({ id, error: r.error });
4916
+ notes.push({ id, text: `couldn't restart its agent: ${r.error}`, level: "warn" });
4917
+ }
4918
+ }
4919
+ };
4920
+ await Promise.all(Array.from({ length: Math.min(RESTART_AT_ONCE, queue.length) }, worker));
4921
+ return { done: ids.filter((id) => ok.has(id)), failed };
4922
+ };
4923
+ const finish = (notes) => {
4924
+ if (!notes.length) return;
4925
+ deps.report?.(notes);
4926
+ deps.changed?.();
4927
+ };
4928
+ const request = async (ids) => {
4929
+ const plan = restartPlan(ids, (id) => deps.busy(id));
4930
+ const notes = [];
4931
+ for (const id of plan.later) {
4932
+ queued.add(id);
4933
+ notes.push({ id, text: `${LATER_TEXT} (it is working or waiting on you)`, level: "info" });
4934
+ }
4935
+ const { done, failed } = await run(plan.now, notes);
4936
+ finish(notes);
4937
+ tick();
4938
+ return { now: done, later: plan.later, failed };
4939
+ };
4940
+ let ticking = false;
4941
+ const tick = () => {
4942
+ if (ticking) return;
4943
+ if (queued.size === 0) {
4944
+ deps.scheduled?.(null);
4945
+ return;
4946
+ }
4947
+ ticking = true;
4948
+ deps.scheduled?.(Date.now() + QUEUE_RECHECK_MS);
4949
+ later(() => {
4950
+ ticking = false;
4951
+ void retry().catch(() => {
4952
+ }).finally(tick);
4953
+ }, QUEUE_RECHECK_MS);
4954
+ };
4955
+ const retry = async (only, opts) => {
4956
+ const notes = [];
4957
+ const ready = [];
4958
+ for (const id of [...queued]) {
4959
+ if (only !== void 0 && id !== only) continue;
4960
+ if (!deps.running(id)) {
4961
+ queued.delete(id);
4962
+ notes.push({ id, text: "no longer waits to restart: it was stopped meanwhile (it starts on the new version)", level: "info" });
4963
+ continue;
4964
+ }
4965
+ if (!deps.busy(id, opts)) ready.push(id);
4966
+ }
4967
+ await run(ready, notes);
4968
+ finish(notes);
4969
+ };
4970
+ return {
4971
+ request,
4972
+ retry: () => retry(),
4973
+ /** A session's turn ended: restart it if it was waiting for that — and if it still reads as busy, look again shortly. */
4974
+ turnEnded: (id) => {
4975
+ if (!queued.has(id)) return;
4976
+ later(() => void retry(id, { turnEnded: true }).catch(() => {
4977
+ }), TURN_END_GRACE_MS);
4978
+ },
4979
+ queued: () => [...queued],
4980
+ /** Being restarted now (the host lists them as exited meanwhile: still this session's). */
4981
+ restarting: () => [...inFlight.keys()]
4982
+ };
4983
+ }
4984
+
4985
+ // src/server/routes/agent-restart-routes.ts
4986
+ function agentsWire(ptys, deps) {
4987
+ const times = /* @__PURE__ */ new Map();
4988
+ const at = (tool) => {
4989
+ if (!times.has(tool)) times.set(tool, deps.installedAt(tool));
4990
+ return times.get(tool);
4991
+ };
4992
+ const outdated = outdatedPtys(ptys, at);
4993
+ const newest = Math.max(...[...new Set(ptys.map((p) => p.tool).filter((t) => !!t))].map((t) => at(t) ?? -Infinity));
4994
+ return {
4995
+ installedAt: Number.isFinite(newest) ? new Date(newest).toISOString() : null,
4996
+ outdated: outdated.map((p) => ({ id: p.id, tool: p.tool, startedAt: p.startedAt, busy: deps.busy(p.id) })),
4997
+ queued: deps.restarter.queued()
4998
+ };
4999
+ }
5000
+ function mountAgentRestartRoutes(app, opts) {
5001
+ const { deps } = opts;
5002
+ app.get("/api/agents", async (c) => c.json(agentsWire(await deps.list().catch(() => []), deps)));
5003
+ app.post("/api/agents/restart", async (c) => {
5004
+ if (opts.lookOnly) return c.json({ error: opts.lookOnly }, 409);
5005
+ const body = await c.req.json().catch(() => null) ?? {};
5006
+ const live = (await deps.list().catch(() => [])).filter((p) => !p.exited);
5007
+ let ids;
5008
+ if (body.all === true) ids = live.map((p) => p.id);
5009
+ else if (body.outdated === true) ids = outdatedPtys(live, deps.installedAt).map((p) => p.id);
5010
+ else if (Array.isArray(body.ids) && body.ids.length > 0 && body.ids.every((i) => typeof i === "string")) {
5011
+ ids = body.ids;
5012
+ const running = /* @__PURE__ */ new Set([...live.map((p) => p.id), ...deps.restarter.restarting()]);
5013
+ const notRunning = ids.filter((id) => !running.has(id));
5014
+ if (notRunning.length === ids.length) return c.json({ error: "its agent is not running in the PTY host" }, 409);
5015
+ ids = ids.filter((id) => running.has(id));
5016
+ } else return c.json({ error: "say which: ids, outdated or all" }, 400);
5017
+ return c.json(await deps.restarter.request(ids));
5018
+ });
5019
+ }
5020
+
4749
5021
  // src/core/pty/host-health.ts
4750
5022
  var UNRESPONSIVE_MS = 11e3;
4751
5023
  var SLOW_MS = 1500;
@@ -4776,7 +5048,7 @@ function sleepCandidates(ptys, now, afterMs, busy, keep = /* @__PURE__ */ new Se
4776
5048
  function computeSessionDiff(s, base) {
4777
5049
  const resolved = s.paths.map((p) => resolveRepoDiff(p, base, s.baseBranches?.[p] ?? s.baseBranch));
4778
5050
  const repos = s.paths.map((p, i) => ({
4779
- name: path13.basename(p),
5051
+ name: path14.basename(p),
4780
5052
  root: p,
4781
5053
  resolvedBase: resolved[i].resolvedBase,
4782
5054
  files: computeDiff({ root: p, diffArg: resolved[i].diffArg })
@@ -4827,7 +5099,7 @@ async function startWebServer(opts = {}) {
4827
5099
  let activityWatcher = null;
4828
5100
  if (!lean) {
4829
5101
  try {
4830
- const roots = activityRoots().filter((r) => fs10.existsSync(r));
5102
+ const roots = activityRoots().filter((r) => fs12.existsSync(r));
4831
5103
  if (roots.length > 0) {
4832
5104
  activityWatcher = createFsWatcher({
4833
5105
  roots,
@@ -4878,7 +5150,7 @@ async function startWebServer(opts = {}) {
4878
5150
  }, 500);
4879
5151
  }
4880
5152
  });
4881
- const repoNames = (s) => s.isGroup ? s.paths.map((p) => path13.basename(p)) : [s.target];
5153
+ const repoNames = (s) => s.isGroup ? s.paths.map((p) => path14.basename(p)) : [s.target];
4882
5154
  const diffStatFor = (id, s, hasStatus) => wantsDiffStat(s, hasStatus) ? diffStats.get(id, s.paths, repoNames(s)) : null;
4883
5155
  const archivedRow = createArchivedRows();
4884
5156
  app.get("/api/sessions", (c) => {
@@ -5025,18 +5297,50 @@ async function startWebServer(opts = {}) {
5025
5297
  const stopPrWatch = lean ? null : prWatch.start(dev ? 10 * 6e4 : 18e4);
5026
5298
  const SLEEP_EVERY_MS = 5 * 6e4;
5027
5299
  const sleepSchedule = !jobs ? null : activity.schedule("idle-sleep", "Idle Claude check", SLEEP_EVERY_MS);
5300
+ const agentBusy = (id) => {
5301
+ const st = readStatus(id)?.state;
5302
+ return st === "working" || st === "needs_input";
5303
+ };
5304
+ const restartBusy = (id, opts2) => {
5305
+ const session = findSession2(id);
5306
+ const pid = ptyPid(id);
5307
+ const live = pid === null ? null : liveAgents().find((a) => a.pid === pid)?.state ?? null;
5308
+ return busyForRestart(session ? shownState(session) : null, opts2?.turnEnded ? null : ptyLastOutputMs(id), Date.now(), live);
5309
+ };
5310
+ const restartSchedule = dev ? null : activity.schedule("agents", "Agents waiting to restart", QUEUE_RECHECK_MS);
5311
+ const restarter = createRestarter({
5312
+ restart: restartPty,
5313
+ busy: restartBusy,
5314
+ running: peekPty,
5315
+ report: (notes) => {
5316
+ const run = activity.start("agents", "Restarting agents");
5317
+ for (const { id, text, level } of notes) {
5318
+ const s = findSession2(id);
5319
+ run.note(`${s ? `${s.target} ${s.branch}` : id}: ${text}`, { level, sessionId: s ? id : void 0 });
5320
+ }
5321
+ run.done(restartNotesSummary(notes));
5322
+ },
5323
+ changed: () => {
5324
+ broadcast("agents-changed", { ts: Date.now() });
5325
+ broadcast("sessions-changed", { ts: Date.now() });
5326
+ },
5327
+ scheduled: (nextAt) => restartSchedule?.next(nextAt)
5328
+ });
5329
+ mountAgentRestartRoutes(app, {
5330
+ deps: { list: listHostPtys, installedAt: installedAtCache(), busy: restartBusy, restarter },
5331
+ // The dev server shares the real PTY host and acts on nothing: the real work web restarts.
5332
+ lookOnly: dev ? "the dev server restarts nothing: use the real work web (the app, or `work restart`)" : void 0
5333
+ });
5028
5334
  const sleepIdle = async () => {
5029
5335
  sleepSchedule?.next(Date.now() + SLEEP_EVERY_MS);
5336
+ await restarter.retry().catch(() => {
5337
+ });
5030
5338
  const minutes = loadConfig()?.sleepIdleAfterMinutes ?? DEFAULT_SLEEP_AFTER_MINUTES;
5031
5339
  if (sleepAfterMs(minutes) === 0)
5032
5340
  return activity.skip("idle-sleep", "Looking for idle Claudes", "turned off (sleepIdleAfterMinutes: 0)");
5033
5341
  const run = activity.start("idle-sleep", "Looking for idle Claudes");
5034
5342
  const ptys = await listHostPtys().catch(() => []);
5035
- const busy = (id) => {
5036
- const st = readStatus(id)?.state;
5037
- return st === "working" || st === "needs_input";
5038
- };
5039
- const ids = sleepCandidates(ptys, Date.now(), sleepAfterMs(minutes), busy);
5343
+ const ids = sleepCandidates(ptys, Date.now(), sleepAfterMs(minutes), agentBusy);
5040
5344
  for (const id of ids) {
5041
5345
  report("detail", `[sleep] ${id}: idle ${minutes} min with nothing attached; stopping its Claude (opening the session resumes it)`);
5042
5346
  const s = findSession2(id);
@@ -5272,6 +5576,7 @@ async function startWebServer(opts = {}) {
5272
5576
  } : {},
5273
5577
  onStatusChanged: (id) => {
5274
5578
  diffStats.invalidate(id);
5579
+ restarter.turnEnded(id);
5275
5580
  timeKeeper?.soon();
5276
5581
  if (jobs) void syncStacksAfter(id);
5277
5582
  const session = findSession2(id);
@@ -5314,7 +5619,7 @@ async function startWebServer(opts = {}) {
5314
5619
  updatesTimer?.unref?.();
5315
5620
  const desktopFile = desktopUpdatePath();
5316
5621
  const onDesktopUpdate = () => broadcast("updates-changed", { ts: Date.now() });
5317
- if (jobs) fs10.watchFile(desktopFile, { interval: 3e3 }, onDesktopUpdate);
5622
+ if (jobs) fs12.watchFile(desktopFile, { interval: 3e3 }, onDesktopUpdate);
5318
5623
  app.get("/api/pty-host/health", (c) => c.json(hostHealth(hostBeat())));
5319
5624
  let lastHostState = hostHealth(hostBeat()).state;
5320
5625
  const hostTick = lean ? null : setInterval(() => {
@@ -5379,7 +5684,7 @@ async function startWebServer(opts = {}) {
5379
5684
  if (timeFirst) clearTimeout(timeFirst);
5380
5685
  if (timeTimer) clearInterval(timeTimer);
5381
5686
  timeKeeper?.stop();
5382
- fs10.unwatchFile(desktopFile, onDesktopUpdate);
5687
+ fs12.unwatchFile(desktopFile, onDesktopUpdate);
5383
5688
  for (const t of conversationSyncs.values()) clearTimeout(t);
5384
5689
  clearTimeout(sweepTimer);
5385
5690
  activityWatcher?.stop();
@@ -5402,11 +5707,11 @@ async function startWebServer(opts = {}) {
5402
5707
  }
5403
5708
 
5404
5709
  // src/core/platform/autostart.ts
5405
- import fs11 from "fs";
5406
- import path14 from "path";
5710
+ import fs13 from "fs";
5711
+ import path15 from "path";
5407
5712
  function startupScriptPath() {
5408
5713
  if (process.platform !== "win32" || !process.env.APPDATA) return null;
5409
- return path14.join(process.env.APPDATA, "Microsoft", "Windows", "Start Menu", "Programs", "Startup", "work-web.vbs");
5714
+ return path15.join(process.env.APPDATA, "Microsoft", "Windows", "Start Menu", "Programs", "Startup", "work-web.vbs");
5410
5715
  }
5411
5716
  function vbsQuote(s) {
5412
5717
  return '"' + s.replace(/"/g, '""') + '"';
@@ -5424,11 +5729,11 @@ function setAutostart(enabled, workBin) {
5424
5729
  const file = startupScriptPath();
5425
5730
  if (!file) throw new Error("Autostart is only supported on Windows so far.");
5426
5731
  if (enabled) {
5427
- fs11.mkdirSync(path14.dirname(file), { recursive: true });
5428
- fs11.writeFileSync(file, buildStartupScript(process.execPath, workBin), "utf-8");
5732
+ fs13.mkdirSync(path15.dirname(file), { recursive: true });
5733
+ fs13.writeFileSync(file, buildStartupScript(process.execPath, workBin), "utf-8");
5429
5734
  } else {
5430
5735
  try {
5431
- fs11.unlinkSync(file);
5736
+ fs13.unlinkSync(file);
5432
5737
  } catch {
5433
5738
  }
5434
5739
  }
@@ -5472,7 +5777,7 @@ function createDemoRepos(liveTargets) {
5472
5777
  /** GET /api/projects: what New worktree offers, as the real one reads config. */
5473
5778
  projects() {
5474
5779
  return {
5475
- singles: Object.entries(repos).map(([name, path15]) => ({ name, kind: "single", path: path15 })),
5780
+ singles: Object.entries(repos).map(([name, path16]) => ({ name, kind: "single", path: path16 })),
5476
5781
  groups: Object.entries(groups).map(([name, members]) => ({ name, kind: "group", members }))
5477
5782
  };
5478
5783
  },
@@ -5514,12 +5819,12 @@ function createDemoRepos(liveTargets) {
5514
5819
  }));
5515
5820
  return { roots: [root], repos: rows, groups: groupRows };
5516
5821
  },
5517
- enroll(alias, path15) {
5518
- if (!found.some((f) => f.path === path15)) throw new DemoRepoError(`${path15} is not the top folder of a git repository`);
5519
- const problem = enrollProblem(alias, path15, config());
5822
+ enroll(alias, path16) {
5823
+ if (!found.some((f) => f.path === path16)) throw new DemoRepoError(`${path16} is not the top folder of a git repository`);
5824
+ const problem = enrollProblem(alias, path16, config());
5520
5825
  if (problem) throw new DemoRepoError(problem);
5521
- repos[alias] = path15;
5522
- ignored.delete(path15);
5826
+ repos[alias] = path16;
5827
+ ignored.delete(path16);
5523
5828
  },
5524
5829
  remove(alias, force) {
5525
5830
  if (!(alias in repos)) throw new DemoRepoError(`no repo \u201C${alias}\u201D`);
@@ -5528,9 +5833,9 @@ function createDemoRepos(liveTargets) {
5528
5833
  delete repos[alias];
5529
5834
  for (const g of Object.keys(groups)) groups[g] = groups[g].filter((m) => m !== alias);
5530
5835
  },
5531
- ignore(path15, on) {
5532
- if (on) ignored.add(path15);
5533
- else ignored.delete(path15);
5836
+ ignore(path16, on) {
5837
+ if (on) ignored.add(path16);
5838
+ else ignored.delete(path16);
5534
5839
  },
5535
5840
  saveGroup(name, members, creating) {
5536
5841
  const problem = groupProblem(name, members, config(), { creating });
@@ -7134,6 +7439,28 @@ async function startDemoServer(opts) {
7134
7439
  broadcast({ event: "sessions-changed", data: { ts: Date.now() } });
7135
7440
  return c.json({ ok: true });
7136
7441
  });
7442
+ const claudeUpdatedAt = new Date(Date.now() - 60 * 6e4).toISOString();
7443
+ const outdated = /* @__PURE__ */ new Set();
7444
+ app.get(
7445
+ "/api/agents",
7446
+ (c) => c.json({
7447
+ installedAt: claudeUpdatedAt,
7448
+ outdated: [...outdated].map((id) => ({
7449
+ id,
7450
+ tool: "claude",
7451
+ startedAt: new Date(Date.now() - 3 * 36e5).toISOString(),
7452
+ busy: false
7453
+ })),
7454
+ queued: []
7455
+ })
7456
+ );
7457
+ app.post("/api/agents/restart", async (c) => {
7458
+ const body = await c.req.json().catch(() => null) ?? {};
7459
+ const ids = Array.isArray(body.ids) ? body.ids.filter((i) => typeof i === "string") : [...outdated];
7460
+ for (const id of ids) outdated.delete(id);
7461
+ broadcast({ event: "agents-changed", data: { ts: Date.now() } });
7462
+ return c.json({ now: ids, later: [], failed: [] });
7463
+ });
7137
7464
  app.get("/api/pty-host/health", (c) => c.json({ state: "ok", latencyMs: 4, quietMs: 1e3, error: null }));
7138
7465
  const worklogs = /* @__PURE__ */ new Map();
7139
7466
  app.get("/api/sessions/:id/worklog", (c) => {
@@ -7260,8 +7587,9 @@ async function startDemoServer(opts) {
7260
7587
  const body = await c.req.json().catch(() => null);
7261
7588
  const cp = body?.checkpointId;
7262
7589
  if (typeof cp !== "number" || !Number.isInteger(cp) || cp < 0) return c.json({ error: "expected {checkpointId}" }, 400);
7263
- const old = diffSeen.get(id);
7264
- if (!old || old.checkpointId < cp) diffSeen.set(id, { checkpointId: cp, at: (/* @__PURE__ */ new Date()).toISOString() });
7590
+ const ts = typeof body?.ts === "string" && Number.isFinite(Date.parse(body.ts)) ? body.ts : void 0;
7591
+ const marked = markedTurn(body?.marked);
7592
+ diffSeen.set(id, nextSeen(diffSeen.get(id) ?? null, cp, /* @__PURE__ */ new Date(), ts, marked));
7265
7593
  return c.json({ seen: diffSeen.get(id) });
7266
7594
  });
7267
7595
  app.get("/api/sessions/:id/diff", (c) => {
@@ -8209,4 +8537,4 @@ export {
8209
8537
  stopExisting,
8210
8538
  webCommand
8211
8539
  };
8212
- //# sourceMappingURL=web-ISGYHCTC.js.map
8540
+ //# sourceMappingURL=web-MWSFIUIJ.js.map