svamp-cli 0.1.51 → 0.1.52

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 (314) hide show
  1. package/dist/cli.mjs +18 -18
  2. package/dist/{commands-mw8HFkt6.mjs → commands-1tmye7o_.mjs} +3 -2
  3. package/dist/{commands-D1brd9fB.mjs → commands-CI_BVphs.mjs} +7 -3
  4. package/dist/{commands-DHnFOhQC.mjs → commands-DcFOU9nW.mjs} +7 -3
  5. package/dist/commands-DwY2B7KW.mjs +562 -0
  6. package/dist/index.mjs +1 -1
  7. package/dist/{package-BLDik3NY.mjs → package-D7EUXtnk.mjs} +1 -1
  8. package/dist/{run-6dwQnoBL.mjs → run-BYJX5syg.mjs} +1 -1
  9. package/dist/{run-C0ecvcRP.mjs → run-BnnUavlu.mjs} +131 -44
  10. package/dist/{run-3Et1ISd5.mjs → run-Bw6aGHLA.mjs} +1 -1
  11. package/dist/{run-BE_AIJ7z.mjs → run-DOwarObi.mjs} +1 -1
  12. package/dist/{run-Bc83CRUn.mjs → run-DxISzP_V.mjs} +38 -7
  13. package/dist/{run-BdEHYoYE.mjs → run-eYBOEaWw.mjs} +20 -7
  14. package/dist/tunnel-C2_V6y3d.mjs +299 -0
  15. package/package.json +1 -1
  16. package/dist/commands-4_MiOQVp.mjs +0 -1217
  17. package/dist/commands-8UAWGJrC.mjs +0 -1208
  18. package/dist/commands-8Wmq0uak.mjs +0 -1407
  19. package/dist/commands-8Xn02pQg.mjs +0 -1217
  20. package/dist/commands-9DPsh6ku.mjs +0 -1217
  21. package/dist/commands-9rMB13FP.mjs +0 -1214
  22. package/dist/commands-B-XaqFDB.mjs +0 -1407
  23. package/dist/commands-B53zuBHB.mjs +0 -1217
  24. package/dist/commands-B7yLt11i.mjs +0 -1217
  25. package/dist/commands-BDVAO_N2.mjs +0 -1217
  26. package/dist/commands-BD_NjWJL.mjs +0 -1217
  27. package/dist/commands-BEhSQqTp.mjs +0 -507
  28. package/dist/commands-BIFQZZGw.mjs +0 -1375
  29. package/dist/commands-BImRR1Wr.mjs +0 -1217
  30. package/dist/commands-BLmRIMdf.mjs +0 -1217
  31. package/dist/commands-BOYo9cdy.mjs +0 -1741
  32. package/dist/commands-BQ_347V_.mjs +0 -1374
  33. package/dist/commands-BTEmyf2m.mjs +0 -1407
  34. package/dist/commands-BVjcCbWS.mjs +0 -1375
  35. package/dist/commands-BVsLRttq.mjs +0 -1217
  36. package/dist/commands-BVuE0VQU.mjs +0 -507
  37. package/dist/commands-BY09VTpk.mjs +0 -1375
  38. package/dist/commands-Bcdp0X-o.mjs +0 -1217
  39. package/dist/commands-BdnG1cqQ.mjs +0 -1217
  40. package/dist/commands-BdvvRQIo.mjs +0 -1415
  41. package/dist/commands-Bgg_dvDw.mjs +0 -1683
  42. package/dist/commands-Bi0zYJvj.mjs +0 -1407
  43. package/dist/commands-BmirUCVt.mjs +0 -1208
  44. package/dist/commands-BpSUbvmr.mjs +0 -1217
  45. package/dist/commands-BuJ6xTfc.mjs +0 -1217
  46. package/dist/commands-BzbYPx0f.mjs +0 -1208
  47. package/dist/commands-C-RtFjJl.mjs +0 -1217
  48. package/dist/commands-C20_f6oo.mjs +0 -1217
  49. package/dist/commands-C6KDr9Yp.mjs +0 -1407
  50. package/dist/commands-C9TOoTCv.mjs +0 -1395
  51. package/dist/commands-C9TdN_El.mjs +0 -1683
  52. package/dist/commands-CFv6lO0D.mjs +0 -1217
  53. package/dist/commands-CJ2n5jS2.mjs +0 -1375
  54. package/dist/commands-CKEKQ_5B.mjs +0 -1217
  55. package/dist/commands-CQz67Rm1.mjs +0 -1395
  56. package/dist/commands-CRZbJjqN.mjs +0 -1375
  57. package/dist/commands-CToIvBFX.mjs +0 -1375
  58. package/dist/commands-CWsfciHn.mjs +0 -1217
  59. package/dist/commands-CYMSyqYC.mjs +0 -1395
  60. package/dist/commands-CZ7KPLLJ.mjs +0 -1217
  61. package/dist/commands-Cc73uUnP.mjs +0 -1375
  62. package/dist/commands-CdMsAD1-.mjs +0 -1217
  63. package/dist/commands-CdyCWC3y.mjs +0 -1395
  64. package/dist/commands-ClVCprrK.mjs +0 -1217
  65. package/dist/commands-Cnmf8znA.mjs +0 -1196
  66. package/dist/commands-CorUNLRF.mjs +0 -1375
  67. package/dist/commands-Cq0oj5_v.mjs +0 -1217
  68. package/dist/commands-CrdvbXPI.mjs +0 -1395
  69. package/dist/commands-Cw2Od6mc.mjs +0 -1683
  70. package/dist/commands-CwC2aVzu.mjs +0 -1217
  71. package/dist/commands-CxSCUJCB.mjs +0 -1217
  72. package/dist/commands-D-PTwdZz.mjs +0 -1217
  73. package/dist/commands-D-nIO_Sf.mjs +0 -1741
  74. package/dist/commands-D7-NHH5q.mjs +0 -1407
  75. package/dist/commands-D7kH-7Vn.mjs +0 -1217
  76. package/dist/commands-DBv6A3aJ.mjs +0 -507
  77. package/dist/commands-DD3HXakm.mjs +0 -1217
  78. package/dist/commands-DLoe6FyK.mjs +0 -1375
  79. package/dist/commands-DPbH8KF0.mjs +0 -1217
  80. package/dist/commands-DUAQ9MZM.mjs +0 -1217
  81. package/dist/commands-DVw-P6-0.mjs +0 -1407
  82. package/dist/commands-DVygnMsh.mjs +0 -1217
  83. package/dist/commands-DWira-Cz.mjs +0 -1741
  84. package/dist/commands-DYTdUlul.mjs +0 -1217
  85. package/dist/commands-DZfaDmsk.mjs +0 -1374
  86. package/dist/commands-Dd8cn8mW.mjs +0 -1217
  87. package/dist/commands-DsIoygTL.mjs +0 -1395
  88. package/dist/commands-Du-fdLLu.mjs +0 -969
  89. package/dist/commands-DuJGOq1y.mjs +0 -1217
  90. package/dist/commands-DwBr3sBn.mjs +0 -1217
  91. package/dist/commands-DwveR96q.mjs +0 -1683
  92. package/dist/commands-DypTF36z.mjs +0 -506
  93. package/dist/commands-EUMJqBCs.mjs +0 -1407
  94. package/dist/commands-HLu7P96l.mjs +0 -1214
  95. package/dist/commands-HrBaGV-C.mjs +0 -1683
  96. package/dist/commands-Jk5no-DX.mjs +0 -1407
  97. package/dist/commands-KH5dj9dv.mjs +0 -1214
  98. package/dist/commands-LaNHVHjc.mjs +0 -1217
  99. package/dist/commands-O1Q9g00y.mjs +0 -1395
  100. package/dist/commands-OwMfbBrU.mjs +0 -1395
  101. package/dist/commands-SQ0Wp_kD.mjs +0 -1217
  102. package/dist/commands-S_MFQ9n1.mjs +0 -354
  103. package/dist/commands-T3q8VKCY.mjs +0 -1407
  104. package/dist/commands-Ugz9TtRu.mjs +0 -1420
  105. package/dist/commands-Wng0OuNY.mjs +0 -1683
  106. package/dist/commands-YBW5jFpy.mjs +0 -1217
  107. package/dist/commands-Z-CbuF8E.mjs +0 -1217
  108. package/dist/commands-fSZOP80Z.mjs +0 -1217
  109. package/dist/commands-fqBuJe1b.mjs +0 -1217
  110. package/dist/commands-g-1n3_Rp.mjs +0 -1395
  111. package/dist/commands-mC0oe0lj.mjs +0 -1217
  112. package/dist/commands-od2hOku5.mjs +0 -1217
  113. package/dist/commands-otgzprjb.mjs +0 -1375
  114. package/dist/commands-rhHI6Wb2.mjs +0 -1420
  115. package/dist/commands-zGHnUXh5.mjs +0 -1217
  116. package/dist/package-BMCjXPI9.mjs +0 -58
  117. package/dist/package-BPMWPlS0.mjs +0 -57
  118. package/dist/package-BYUO-39f.mjs +0 -60
  119. package/dist/package-BaGfG8vL.mjs +0 -58
  120. package/dist/package-BkBE6ZdN.mjs +0 -57
  121. package/dist/package-BufekbY1.mjs +0 -57
  122. package/dist/package-C1hpYMj4.mjs +0 -57
  123. package/dist/package-CmIBOZtY.mjs +0 -57
  124. package/dist/package-CmVt1kdw.mjs +0 -58
  125. package/dist/package-Cn6Ya4A0.mjs +0 -57
  126. package/dist/package-Csd530Ym.mjs +0 -57
  127. package/dist/package-D6mNQtUs.mjs +0 -57
  128. package/dist/package-DG0AkZdm.mjs +0 -58
  129. package/dist/package-DRO1LpXW.mjs +0 -58
  130. package/dist/package-Dav8qh6X.mjs +0 -57
  131. package/dist/package-DiA55dzE.mjs +0 -57
  132. package/dist/package-UwLIU765.mjs +0 -58
  133. package/dist/package-k3XsdP9k.mjs +0 -58
  134. package/dist/package-rasGC9_z.mjs +0 -58
  135. package/dist/run-4B1XZQB8.mjs +0 -5426
  136. package/dist/run-4eArMb_9.mjs +0 -1050
  137. package/dist/run-4li60ojK.mjs +0 -1051
  138. package/dist/run-67wfoMuo.mjs +0 -5383
  139. package/dist/run-6N2IdEX7.mjs +0 -5410
  140. package/dist/run-7iQKryzo.mjs +0 -5383
  141. package/dist/run-7s8lOXqB.mjs +0 -1050
  142. package/dist/run-8kKykzTs.mjs +0 -5367
  143. package/dist/run-8mLZV2lg.mjs +0 -1050
  144. package/dist/run-9x7I9Ck-.mjs +0 -5264
  145. package/dist/run-B-PWtXF-.mjs +0 -5894
  146. package/dist/run-B1ivovUl.mjs +0 -5964
  147. package/dist/run-B1l9Ed8k.mjs +0 -5403
  148. package/dist/run-B2zRMxE0.mjs +0 -5508
  149. package/dist/run-B31biy0V.mjs +0 -1050
  150. package/dist/run-B5o5fMMd.mjs +0 -5369
  151. package/dist/run-B7V-xXM7.mjs +0 -5775
  152. package/dist/run-B9ND6srh.mjs +0 -6154
  153. package/dist/run-BG3279Kg.mjs +0 -1051
  154. package/dist/run-BHZNzX1F.mjs +0 -5235
  155. package/dist/run-BKdOv7gX.mjs +0 -1050
  156. package/dist/run-BLySdZ1K.mjs +0 -5251
  157. package/dist/run-BOVkQfM-.mjs +0 -1050
  158. package/dist/run-BQ0lIare.mjs +0 -1050
  159. package/dist/run-BREPr7Yc.mjs +0 -5508
  160. package/dist/run-BTwshVk1.mjs +0 -5728
  161. package/dist/run-BUL3eAqT.mjs +0 -1050
  162. package/dist/run-BVcPemGr.mjs +0 -5947
  163. package/dist/run-BWqEmIiz.mjs +0 -5964
  164. package/dist/run-BWsDPiNe.mjs +0 -1050
  165. package/dist/run-BX4iy6k8.mjs +0 -1050
  166. package/dist/run-BXYfq8mK.mjs +0 -5836
  167. package/dist/run-BY12Ataq.mjs +0 -5732
  168. package/dist/run-BYDOX4yk.mjs +0 -5402
  169. package/dist/run-Bd-t6s63.mjs +0 -5373
  170. package/dist/run-BenYqfwQ.mjs +0 -5273
  171. package/dist/run-BfF4bgA3.mjs +0 -5403
  172. package/dist/run-Bhh05yic.mjs +0 -5369
  173. package/dist/run-BicITYWX.mjs +0 -6138
  174. package/dist/run-BieEN0Pg.mjs +0 -5761
  175. package/dist/run-BjEQi6PN.mjs +0 -1050
  176. package/dist/run-BjZ6SyFy.mjs +0 -1051
  177. package/dist/run-Bl8OkKyC.mjs +0 -5969
  178. package/dist/run-BlEFlhfn.mjs +0 -5510
  179. package/dist/run-BmL1m0Bk.mjs +0 -1050
  180. package/dist/run-Bmx5wEBF.mjs +0 -1051
  181. package/dist/run-BnX5Rw8x.mjs +0 -5403
  182. package/dist/run-BpjmHeht.mjs +0 -1050
  183. package/dist/run-BxTdRjCG.mjs +0 -1051
  184. package/dist/run-ByOVDgvx.mjs +0 -6115
  185. package/dist/run-BzRP6Q5t.mjs +0 -1051
  186. package/dist/run-C0dyMP62.mjs +0 -1051
  187. package/dist/run-C1lS3SwN.mjs +0 -5733
  188. package/dist/run-C3PAp02X.mjs +0 -5252
  189. package/dist/run-C3eaYQub.mjs +0 -1050
  190. package/dist/run-C4pdX4sY.mjs +0 -1051
  191. package/dist/run-C676pHe-.mjs +0 -5423
  192. package/dist/run-C8GkzcfP.mjs +0 -1050
  193. package/dist/run-C9Hrqjy_.mjs +0 -1050
  194. package/dist/run-CC2C8P-U.mjs +0 -6031
  195. package/dist/run-CCcW4asS.mjs +0 -1050
  196. package/dist/run-CDBKhQ1Z.mjs +0 -1051
  197. package/dist/run-CE4H8ZiN.mjs +0 -6273
  198. package/dist/run-CEB6sYzn.mjs +0 -5962
  199. package/dist/run-CF6aXLmA.mjs +0 -5445
  200. package/dist/run-CHyN5U0t.mjs +0 -1050
  201. package/dist/run-CIFezmkC.mjs +0 -5949
  202. package/dist/run-CLA9zw7J.mjs +0 -5907
  203. package/dist/run-COWb9ovq.mjs +0 -1050
  204. package/dist/run-CSUAy5T5.mjs +0 -1051
  205. package/dist/run-CSk7i0Hq.mjs +0 -1050
  206. package/dist/run-CUtqSGWJ.mjs +0 -1050
  207. package/dist/run-CXrEt0TM.mjs +0 -5008
  208. package/dist/run-CY8Y0JPW.mjs +0 -5287
  209. package/dist/run-CZCKBcQ-.mjs +0 -5244
  210. package/dist/run-CZj0sRCs.mjs +0 -1050
  211. package/dist/run-C_1x2cNU.mjs +0 -5381
  212. package/dist/run-C_8iOjO1.mjs +0 -5892
  213. package/dist/run-C_KIew8H.mjs +0 -1051
  214. package/dist/run-CajRcN3C.mjs +0 -1050
  215. package/dist/run-CbzXO7fw.mjs +0 -1050
  216. package/dist/run-CcSr4x2f.mjs +0 -1050
  217. package/dist/run-CcYaXgCy.mjs +0 -6091
  218. package/dist/run-CdihMx0V.mjs +0 -1051
  219. package/dist/run-Cf2Dl_ck.mjs +0 -1051
  220. package/dist/run-CjH1H4vq.mjs +0 -1050
  221. package/dist/run-CkbDK6jA.mjs +0 -1051
  222. package/dist/run-Ckh6JE9F.mjs +0 -1050
  223. package/dist/run-Ckyg9-fm.mjs +0 -6079
  224. package/dist/run-CqL3ZWdr.mjs +0 -5381
  225. package/dist/run-Csj7sJAh.mjs +0 -1050
  226. package/dist/run-Ct--DWF1.mjs +0 -1051
  227. package/dist/run-CtJRxaFC.mjs +0 -1051
  228. package/dist/run-CuIMdkKF.mjs +0 -6099
  229. package/dist/run-CuckJGM-.mjs +0 -1050
  230. package/dist/run-CxGAa9MH.mjs +0 -1050
  231. package/dist/run-CyU4-O-e.mjs +0 -5411
  232. package/dist/run-CymDyu2b.mjs +0 -5389
  233. package/dist/run-CzIY4_RE.mjs +0 -6093
  234. package/dist/run-D0Ha4aWt.mjs +0 -1050
  235. package/dist/run-D0ow-xms.mjs +0 -5905
  236. package/dist/run-D1PFrNZB.mjs +0 -6273
  237. package/dist/run-D2X3jEqg.mjs +0 -1051
  238. package/dist/run-D39C7Ta3.mjs +0 -1050
  239. package/dist/run-D3Lqxasl.mjs +0 -1051
  240. package/dist/run-D3bhRCCb.mjs +0 -1051
  241. package/dist/run-D5N42sVA.mjs +0 -1050
  242. package/dist/run-D691XPXy.mjs +0 -6031
  243. package/dist/run-D7dLDpq3.mjs +0 -5403
  244. package/dist/run-D8mQ_fL5.mjs +0 -1050
  245. package/dist/run-DA-YBjNw.mjs +0 -6018
  246. package/dist/run-DByI8mI0.mjs +0 -1051
  247. package/dist/run-DCINWip4.mjs +0 -1050
  248. package/dist/run-DCrZ3vke.mjs +0 -5406
  249. package/dist/run-DDF-tRbn.mjs +0 -5954
  250. package/dist/run-DGSgljJE.mjs +0 -5421
  251. package/dist/run-DGsXW19O.mjs +0 -5541
  252. package/dist/run-DHrF2xpW.mjs +0 -5776
  253. package/dist/run-DIB0W42M.mjs +0 -1050
  254. package/dist/run-DJ4k0WzZ.mjs +0 -1051
  255. package/dist/run-DMI83W7i.mjs +0 -5434
  256. package/dist/run-DNX3djCI.mjs +0 -1050
  257. package/dist/run-DOPaGRT2.mjs +0 -6027
  258. package/dist/run-DP7KSZqR.mjs +0 -1051
  259. package/dist/run-DQ0yljWr.mjs +0 -1050
  260. package/dist/run-DTkldU6a.mjs +0 -1050
  261. package/dist/run-DU10B3gK.mjs +0 -5728
  262. package/dist/run-DV86VJNG.mjs +0 -5386
  263. package/dist/run-DVZGKdKO.mjs +0 -1050
  264. package/dist/run-DWdtp6VD.mjs +0 -6136
  265. package/dist/run-DWzA1gZ-.mjs +0 -1050
  266. package/dist/run-DXJ2M19k.mjs +0 -1050
  267. package/dist/run-DZOeccNu.mjs +0 -5484
  268. package/dist/run-D_W5YF0D.mjs +0 -6046
  269. package/dist/run-DaReJPf8.mjs +0 -1051
  270. package/dist/run-DaYrEeQ9.mjs +0 -5400
  271. package/dist/run-DbC9-WM4.mjs +0 -1050
  272. package/dist/run-Dd9XkswU.mjs +0 -1051
  273. package/dist/run-De-wkVl3.mjs +0 -5487
  274. package/dist/run-DfU2luyX.mjs +0 -1050
  275. package/dist/run-Dfl3Ze2L.mjs +0 -5541
  276. package/dist/run-DfuHUDIJ.mjs +0 -1051
  277. package/dist/run-DfwfyFqj.mjs +0 -5975
  278. package/dist/run-DgUDGHZy.mjs +0 -1051
  279. package/dist/run-Dge2K7h1.mjs +0 -1050
  280. package/dist/run-Di3I0USw.mjs +0 -1050
  281. package/dist/run-Dm3U4FB5.mjs +0 -6018
  282. package/dist/run-Du0YOs48.mjs +0 -5446
  283. package/dist/run-DuaIQAE4.mjs +0 -5392
  284. package/dist/run-Dwm19YhI.mjs +0 -1050
  285. package/dist/run-DxM7xaBa.mjs +0 -1050
  286. package/dist/run-DysN-cGm.mjs +0 -1050
  287. package/dist/run-DzXohf8-.mjs +0 -1051
  288. package/dist/run-E_MwVOtN.mjs +0 -5272
  289. package/dist/run-FPoL2-FD.mjs +0 -5381
  290. package/dist/run-HU4XjZfs.mjs +0 -6023
  291. package/dist/run-HhiYlJuS.mjs +0 -5414
  292. package/dist/run-JXLlRLFb.mjs +0 -1050
  293. package/dist/run-K-_jahIg.mjs +0 -1051
  294. package/dist/run-K_S7pfZ-.mjs +0 -1050
  295. package/dist/run-LDiT4WF-.mjs +0 -1050
  296. package/dist/run-NToLJWx-.mjs +0 -5442
  297. package/dist/run-RBufRqbs.mjs +0 -1050
  298. package/dist/run-YFYpyThQ.mjs +0 -1051
  299. package/dist/run-YG1Pb9dY.mjs +0 -5385
  300. package/dist/run-ZDa17iLg.mjs +0 -6060
  301. package/dist/run-ZN0qMdS_.mjs +0 -1051
  302. package/dist/run-azpFWM6w.mjs +0 -1050
  303. package/dist/run-coIDvBK_.mjs +0 -6127
  304. package/dist/run-jLp4pbTE.mjs +0 -1050
  305. package/dist/run-m3oAuSg0.mjs +0 -1050
  306. package/dist/run-r9CAcL_U.mjs +0 -5403
  307. package/dist/run-v32uF2bP.mjs +0 -5378
  308. package/dist/run-vTsskoZc.mjs +0 -5340
  309. package/dist/run-vt26p5D7.mjs +0 -1050
  310. package/dist/run-vvQiCHpi.mjs +0 -5427
  311. package/dist/run-w-HVv5py.mjs +0 -5410
  312. package/dist/run-wpUutZ9C.mjs +0 -1051
  313. package/dist/run-yTjJ7noq.mjs +0 -1051
  314. package/dist/run-zo5GSoVC.mjs +0 -1050
@@ -1058,6 +1058,14 @@ async function registerSessionService(server, sessionId, initialMetadata, initia
1058
1058
  });
1059
1059
  return await callbacks.onUpdateSecurityContext(newSecurityContext);
1060
1060
  },
1061
+ /** Apply a new system prompt and restart the agent process */
1062
+ applySystemPrompt: async (prompt, context) => {
1063
+ authorizeRequest(context, metadata.sharing, "admin");
1064
+ if (!callbacks.onApplySystemPrompt) {
1065
+ throw new Error("System prompt updates are not supported for this session");
1066
+ }
1067
+ return await callbacks.onApplySystemPrompt(prompt);
1068
+ },
1061
1069
  // ── Listener Registration ──
1062
1070
  registerListener: async (callback, context) => {
1063
1071
  authorizeRequest(context, metadata.sharing, "view");
@@ -3772,7 +3780,7 @@ function readRalphState(filePath) {
3772
3780
  return {
3773
3781
  iteration: parseInt(fields.iteration || "1", 10) || 1,
3774
3782
  max_iterations: parseInt(fields.max_iterations || "0", 10) || 0,
3775
- completion_promise: fields.completion_promise || "DONE",
3783
+ completion_promise: fields.completion_promise === "none" ? null : fields.completion_promise || "DONE",
3776
3784
  cooldown_seconds: parseInt(fields.cooldown_seconds || "1", 10) || 1,
3777
3785
  started_at: fields.started_at || (/* @__PURE__ */ new Date()).toISOString(),
3778
3786
  last_iteration_at: fields.last_iteration_at || void 0,
@@ -3786,7 +3794,7 @@ function readRalphState(filePath) {
3786
3794
  }
3787
3795
  function writeRalphState(filePath, state) {
3788
3796
  mkdirSync(dirname(filePath), { recursive: true });
3789
- const promiseYaml = state.completion_promise.includes(":") || state.completion_promise.includes('"') ? `"${state.completion_promise.replace(/"/g, '\\"')}"` : `"${state.completion_promise}"`;
3797
+ const promiseYaml = state.completion_promise === null ? "none" : state.completion_promise.includes(":") || state.completion_promise.includes('"') ? `"${state.completion_promise.replace(/"/g, '\\"')}"` : `"${state.completion_promise}"`;
3790
3798
  const lastIterLine = state.last_iteration_at ? `
3791
3799
  last_iteration_at: "${state.last_iteration_at}"` : "";
3792
3800
  const contextModeLine = state.context_mode ? `
@@ -3868,11 +3876,13 @@ function createSvampConfigChecker(directory, sessionId, getMetadata, setMetadata
3868
3876
  const ralphLoop = {
3869
3877
  active: true,
3870
3878
  task: state.task,
3871
- completionPromise: state.completion_promise,
3879
+ completionPromise: state.completion_promise ?? "none",
3872
3880
  maxIterations: state.max_iterations,
3873
3881
  currentIteration: state.iteration,
3874
3882
  startedAt: state.started_at,
3875
- cooldownSeconds: state.cooldown_seconds
3883
+ cooldownSeconds: state.cooldown_seconds,
3884
+ contextMode: state.context_mode || "fresh",
3885
+ lastIterationStartedAt: (/* @__PURE__ */ new Date()).toISOString()
3876
3886
  };
3877
3887
  if (!prevRalph?.active) {
3878
3888
  const progressRelPath = `.svamp/${sessionId}/ralph-progress.md`;
@@ -3897,7 +3907,7 @@ function createSvampConfigChecker(directory, sessionId, getMetadata, setMetadata
3897
3907
  );
3898
3908
  logger.log(`[svampConfig] Ralph loop started: "${state.task.slice(0, 50)}..."`);
3899
3909
  onRalphLoopActivated?.();
3900
- } else if (prevRalph.currentIteration !== ralphLoop.currentIteration) {
3910
+ } else if (prevRalph.currentIteration !== ralphLoop.currentIteration || prevRalph.task !== ralphLoop.task) {
3901
3911
  setMetadata((m) => ({ ...m, ralphLoop }));
3902
3912
  sessionService.updateMetadata(getMetadata());
3903
3913
  }
@@ -3947,12 +3957,18 @@ function createSvampConfigChecker(directory, sessionId, getMetadata, setMetadata
3947
3957
  if ("ralph_loop" in patch) {
3948
3958
  const rl = patch.ralph_loop;
3949
3959
  if (rl && typeof rl === "object" && typeof rl.task === "string") {
3960
+ const contextMode = rl.context_mode === "fresh" || rl.context_mode === "continue" ? rl.context_mode : void 0;
3950
3961
  writeRalphState(ralphStatePath, {
3951
3962
  iteration: rl.current_iteration || 1,
3952
3963
  max_iterations: typeof rl.max_iterations === "number" ? rl.max_iterations : 0,
3953
- completion_promise: rl.completion_promise || "DONE",
3954
- cooldown_seconds: typeof rl.cooldown_seconds === "number" ? rl.cooldown_seconds : 1,
3964
+ completion_promise: rl.completion_promise === "none" || rl.completion_promise === null ? null : rl.completion_promise || "DONE",
3965
+ cooldown_seconds: (() => {
3966
+ const cd = typeof rl.cooldown_seconds === "number" ? rl.cooldown_seconds : 1;
3967
+ const isInfinite = !rl.completion_promise || rl.completion_promise === "none";
3968
+ return isInfinite ? Math.max(1, cd) : cd;
3969
+ })(),
3955
3970
  started_at: rl.started_at || (/* @__PURE__ */ new Date()).toISOString(),
3971
+ context_mode: contextMode,
3956
3972
  task: rl.task.trim()
3957
3973
  });
3958
3974
  ralphChecker();
@@ -3999,7 +4015,7 @@ function buildIterationStatus(iteration, maxIterations, completionPromise) {
3999
4015
  if (completionPromise) {
4000
4016
  return `Ralph iteration ${iterStr} | To stop: output <promise>${completionPromise}</promise>`;
4001
4017
  }
4002
- return `Ralph iteration ${iterStr} | No completion promise set - loop runs until max iterations or manual cancel`;
4018
+ return `Ralph iteration ${iterStr} | Manual stop only`;
4003
4019
  }
4004
4020
  function buildRalphSystemPrompt(state, progressFilePath) {
4005
4021
  const isFresh = state.context_mode === "fresh" || !state.context_mode;
@@ -4043,17 +4059,26 @@ function buildRalphSystemPrompt(state, progressFilePath) {
4043
4059
  "- Do NOT commit broken code",
4044
4060
  "- Keep changes focused and minimal",
4045
4061
  "- Follow existing code patterns",
4046
- "",
4047
- "## Stop Condition",
4048
- "",
4049
- `To signal completion, output: <promise>${state.completion_promise}</promise>`,
4050
- "",
4051
- "ONLY output this when the task is FULLY and PERMANENTLY complete.",
4052
- "Do NOT output it if there is ANY remaining work.",
4053
- "When in doubt, do NOT output the promise \u2014 the loop will give you another turn.",
4054
- "",
4055
- "CRITICAL: Do NOT output a false promise to exit the loop.",
4056
- "The loop is designed to continue until genuine completion. Trust the process."
4062
+ ...state.completion_promise ? [
4063
+ "",
4064
+ "## Stop Condition",
4065
+ "",
4066
+ `To signal completion, output: <promise>${state.completion_promise}</promise>`,
4067
+ "",
4068
+ "ONLY output this when the task is FULLY and PERMANENTLY complete.",
4069
+ "Do NOT output it if there is ANY remaining work.",
4070
+ "When in doubt, do NOT output the promise \u2014 the loop will give you another turn.",
4071
+ "",
4072
+ "CRITICAL: Do NOT output a false promise to exit the loop.",
4073
+ "The loop is designed to continue until genuine completion. Trust the process."
4074
+ ] : [
4075
+ "",
4076
+ "## Continuous Mode",
4077
+ "",
4078
+ "This is a continuous/infinite loop with no completion signal.",
4079
+ "Just do meaningful work each iteration. The loop will continue until manually cancelled.",
4080
+ "Focus on making progress, documenting what you did, and setting up the next iteration."
4081
+ ]
4057
4082
  ].join("\n");
4058
4083
  }
4059
4084
  return [
@@ -4064,19 +4089,27 @@ function buildRalphSystemPrompt(state, progressFilePath) {
4064
4089
  "Your previous work persists in conversation history and files.",
4065
4090
  "Just do meaningful work this turn and let the loop continue.",
4066
4091
  "",
4067
- "## Stop Condition",
4068
- "",
4069
- `To signal completion, output: <promise>${state.completion_promise}</promise>`,
4070
- "",
4071
- "CRITICAL \u2014 Do NOT output the promise if:",
4072
- '- The task says "continuously", "forever", "keep running", or "until I stop you"',
4073
- "- There is ANY remaining work, follow-up, or next step you could do",
4074
- "- You just finished one pass/cycle of a recurring task (the loop handles repetition)",
4075
- "- You are uncertain whether the task is truly done",
4076
- "",
4077
- "CRITICAL: Do NOT output a false promise to exit the loop, even if you think you're",
4078
- "stuck or should exit for other reasons. The loop is designed to continue until genuine",
4079
- "completion. Trust the process."
4092
+ ...state.completion_promise ? [
4093
+ "## Stop Condition",
4094
+ "",
4095
+ `To signal completion, output: <promise>${state.completion_promise}</promise>`,
4096
+ "",
4097
+ "CRITICAL \u2014 Do NOT output the promise if:",
4098
+ '- The task says "continuously", "forever", "keep running", or "until I stop you"',
4099
+ "- There is ANY remaining work, follow-up, or next step you could do",
4100
+ "- You just finished one pass/cycle of a recurring task (the loop handles repetition)",
4101
+ "- You are uncertain whether the task is truly done",
4102
+ "",
4103
+ "CRITICAL: Do NOT output a false promise to exit the loop, even if you think you're",
4104
+ "stuck or should exit for other reasons. The loop is designed to continue until genuine",
4105
+ "completion. Trust the process."
4106
+ ] : [
4107
+ "## Continuous Mode",
4108
+ "",
4109
+ "This is a continuous/infinite loop with no completion signal.",
4110
+ "Just do meaningful work this turn and let the loop continue.",
4111
+ "The loop will run until manually cancelled."
4112
+ ]
4080
4113
  ].join("\n");
4081
4114
  }
4082
4115
  function buildRalphPrompt(task, state) {
@@ -4085,9 +4118,24 @@ function buildRalphPrompt(task, state) {
4085
4118
  return task;
4086
4119
  }
4087
4120
  const iterStr = state.max_iterations > 0 ? `${state.iteration}/${state.max_iterations}` : `${state.iteration}`;
4088
- return task + `
4089
-
4090
- [Ralph iteration ${iterStr} \u2014 to complete: output <promise>${state.completion_promise}</promise> ONLY when truly done]`;
4121
+ const reminderLines = [
4122
+ "<system-reminder>",
4123
+ `Ralph Loop \u2014 Iteration ${iterStr} (Continue Mode)`,
4124
+ "Your conversation history persists. Continue from where you left off."
4125
+ ];
4126
+ if (state.completion_promise) {
4127
+ reminderLines.push(`To signal completion, output EXACTLY: <promise>${state.completion_promise}</promise>`);
4128
+ reminderLines.push("Only output the promise when the task is FULLY and PERMANENTLY complete.");
4129
+ reminderLines.push("Do NOT output a false promise to exit the loop.");
4130
+ } else {
4131
+ reminderLines.push("This is a continuous loop \u2014 no completion signal needed. Just do meaningful work.");
4132
+ }
4133
+ reminderLines.push("</system-reminder>");
4134
+ const reminder = reminderLines.join("\n");
4135
+ return task + "\n\n" + reminder;
4136
+ }
4137
+ function getRalphProgressFilePath(directory, sessionId) {
4138
+ return join(getSessionDir(directory, sessionId), "ralph-progress.md");
4091
4139
  }
4092
4140
  function loadSessionIndex() {
4093
4141
  if (!existsSync$1(SESSION_INDEX_FILE)) return {};
@@ -4828,8 +4876,11 @@ async function startDaemon(options) {
4828
4876
  } else if (claudeResumeId) {
4829
4877
  const rlState = readRalphState(getRalphStateFilePath(directory, sessionId));
4830
4878
  if (rlState) {
4831
- const promiseMatch = lastAssistantText.match(/<promise>([\s\S]*?)<\/promise>/);
4832
- const promiseFulfilled = promiseMatch && promiseMatch[1].trim().replace(/\s+/g, " ") === rlState.completion_promise;
4879
+ let promiseFulfilled = false;
4880
+ if (rlState.completion_promise) {
4881
+ const promiseMatch = lastAssistantText.match(/<promise>([\s\S]*?)<\/promise>/);
4882
+ promiseFulfilled = !!(promiseMatch && promiseMatch[1].trim().replace(/\s+/g, " ") === rlState.completion_promise);
4883
+ }
4833
4884
  const maxReached = rlState.max_iterations > 0 && rlState.iteration >= rlState.max_iterations;
4834
4885
  if (promiseFulfilled || maxReached) {
4835
4886
  const isFreshMode = rlState.context_mode === "fresh" || !rlState.context_mode;
@@ -4852,7 +4903,28 @@ async function startDaemon(options) {
4852
4903
  isKillingClaude = false;
4853
4904
  }
4854
4905
  claudeResumeId = rlState.original_resume_id;
4855
- spawnClaude(void 0);
4906
+ const progressPath = getRalphProgressFilePath(directory, sessionId);
4907
+ let resumeMessage;
4908
+ try {
4909
+ if (existsSync$1(progressPath)) {
4910
+ const progressContent = readFileSync$1(progressPath, "utf-8").trim();
4911
+ if (progressContent) {
4912
+ resumeMessage = `<system-reminder>
4913
+ The Ralph Loop has completed (${reason}).
4914
+ Below is the progress log from all iterations:
4915
+
4916
+ ${progressContent}
4917
+ </system-reminder>
4918
+
4919
+ The automated loop has finished. Review the progress above and let me know if you need anything else.`;
4920
+ unlinkSync(progressPath);
4921
+ logger.log(`[Session ${sessionId}] Injected progress file content and deleted ${progressPath}`);
4922
+ }
4923
+ }
4924
+ } catch (progressErr) {
4925
+ logger.log(`[Session ${sessionId}] Could not read/delete progress file: ${progressErr.message}`);
4926
+ }
4927
+ spawnClaude(resumeMessage);
4856
4928
  logger.log(`[Session ${sessionId}] Resumed original session ${rlState.original_resume_id}`);
4857
4929
  } catch (err) {
4858
4930
  logger.log(`[Session ${sessionId}] Error resuming original session: ${err.message}`);
@@ -4874,11 +4946,13 @@ async function startDaemon(options) {
4874
4946
  const ralphLoop = {
4875
4947
  active: true,
4876
4948
  task: rlState.task,
4877
- completionPromise: rlState.completion_promise,
4949
+ completionPromise: rlState.completion_promise ?? "none",
4878
4950
  maxIterations: rlState.max_iterations,
4879
4951
  currentIteration: nextIteration,
4880
4952
  startedAt: rlState.started_at,
4881
- cooldownSeconds: rlState.cooldown_seconds
4953
+ cooldownSeconds: rlState.cooldown_seconds,
4954
+ contextMode: rlState.context_mode || "fresh",
4955
+ lastIterationStartedAt: (/* @__PURE__ */ new Date()).toISOString()
4882
4956
  };
4883
4957
  sessionMetadata = { ...sessionMetadata, ralphLoop };
4884
4958
  sessionService.updateMetadata(sessionMetadata);
@@ -5215,6 +5289,11 @@ async function startDaemon(options) {
5215
5289
  sessionMetadata = { ...sessionMetadata, securityContext: newSecurityContext };
5216
5290
  return await restartClaudeHandler();
5217
5291
  },
5292
+ onApplySystemPrompt: async (prompt) => {
5293
+ logger.log(`[Session ${sessionId}] System prompt update requested \u2014 restarting agent`);
5294
+ lastSpawnMeta = { ...lastSpawnMeta, appendSystemPrompt: prompt };
5295
+ return await restartClaudeHandler();
5296
+ },
5218
5297
  onKillSession: () => {
5219
5298
  logger.log(`[Session ${sessionId}] Kill session requested`);
5220
5299
  stopSession(sessionId);
@@ -5546,6 +5625,9 @@ async function startDaemon(options) {
5546
5625
  sessionMetadata = { ...sessionMetadata, securityContext: newSecurityContext };
5547
5626
  return { success: false, message: "Security context updates with restart are not yet supported for this agent type." };
5548
5627
  },
5628
+ onApplySystemPrompt: async () => {
5629
+ return { success: false, message: "System prompt updates with restart are not yet supported for this agent type." };
5630
+ },
5549
5631
  onKillSession: () => {
5550
5632
  logger.log(`[${agentName} Session ${sessionId}] Kill session requested`);
5551
5633
  stopSession(sessionId);
@@ -5737,8 +5819,11 @@ async function startDaemon(options) {
5737
5819
  checkSvampConfig?.();
5738
5820
  const rlState = readRalphState(getRalphStateFilePath(directory, sessionId));
5739
5821
  if (rlState) {
5740
- const promiseMatch = lastAssistantText.match(/<promise>([\s\S]*?)<\/promise>/);
5741
- const promiseFulfilled = promiseMatch && promiseMatch[1].trim().replace(/\s+/g, " ") === rlState.completion_promise;
5822
+ let promiseFulfilled = false;
5823
+ if (rlState.completion_promise) {
5824
+ const promiseMatch = lastAssistantText.match(/<promise>([\s\S]*?)<\/promise>/);
5825
+ promiseFulfilled = !!(promiseMatch && promiseMatch[1].trim().replace(/\s+/g, " ") === rlState.completion_promise);
5826
+ }
5742
5827
  const maxReached = rlState.max_iterations > 0 && rlState.iteration >= rlState.max_iterations;
5743
5828
  if (promiseFulfilled || maxReached) {
5744
5829
  removeRalphState(getRalphStateFilePath(directory, sessionId));
@@ -5754,11 +5839,13 @@ async function startDaemon(options) {
5754
5839
  const ralphLoop = {
5755
5840
  active: true,
5756
5841
  task: rlState.task,
5757
- completionPromise: rlState.completion_promise,
5842
+ completionPromise: rlState.completion_promise ?? "none",
5758
5843
  maxIterations: rlState.max_iterations,
5759
5844
  currentIteration: nextIteration,
5760
5845
  startedAt: rlState.started_at,
5761
- cooldownSeconds: rlState.cooldown_seconds
5846
+ cooldownSeconds: rlState.cooldown_seconds,
5847
+ contextMode: rlState.context_mode || "fresh",
5848
+ lastIterationStartedAt: (/* @__PURE__ */ new Date()).toISOString()
5762
5849
  };
5763
5850
  sessionMetadata = { ...sessionMetadata, ralphLoop };
5764
5851
  sessionService.updateMetadata(sessionMetadata);
@@ -2,7 +2,7 @@ import{createRequire as _pkgrollCR}from"node:module";const require=_pkgrollCR(im
2
2
  import os from 'node:os';
3
3
  import { join, resolve } from 'node:path';
4
4
  import { mkdirSync, writeFileSync, existsSync, unlinkSync, readFileSync, watch } from 'node:fs';
5
- import { c as connectToHypha, a as registerSessionService } from './run-BdEHYoYE.mjs';
5
+ import { c as connectToHypha, a as registerSessionService } from './run-BnnUavlu.mjs';
6
6
  import { createServer } from 'node:http';
7
7
  import { spawn } from 'node:child_process';
8
8
  import { createInterface } from 'node:readline';
@@ -2,7 +2,7 @@ import{createRequire as _pkgrollCR}from"node:module";const require=_pkgrollCR(im
2
2
  import os from 'node:os';
3
3
  import { join, resolve } from 'node:path';
4
4
  import { mkdirSync, writeFileSync, existsSync, unlinkSync, readFileSync, watch } from 'node:fs';
5
- import { c as connectToHypha, a as registerSessionService } from './run-Bl8OkKyC.mjs';
5
+ import { c as connectToHypha, a as registerSessionService } from './run-DxISzP_V.mjs';
6
6
  import { createServer } from 'node:http';
7
7
  import { spawn } from 'node:child_process';
8
8
  import { createInterface } from 'node:readline';
@@ -1058,6 +1058,14 @@ async function registerSessionService(server, sessionId, initialMetadata, initia
1058
1058
  });
1059
1059
  return await callbacks.onUpdateSecurityContext(newSecurityContext);
1060
1060
  },
1061
+ /** Apply a new system prompt and restart the agent process */
1062
+ applySystemPrompt: async (prompt, context) => {
1063
+ authorizeRequest(context, metadata.sharing, "admin");
1064
+ if (!callbacks.onApplySystemPrompt) {
1065
+ throw new Error("System prompt updates are not supported for this session");
1066
+ }
1067
+ return await callbacks.onApplySystemPrompt(prompt);
1068
+ },
1061
1069
  // ── Listener Registration ──
1062
1070
  registerListener: async (callback, context) => {
1063
1071
  authorizeRequest(context, metadata.sharing, "view");
@@ -3872,7 +3880,9 @@ function createSvampConfigChecker(directory, sessionId, getMetadata, setMetadata
3872
3880
  maxIterations: state.max_iterations,
3873
3881
  currentIteration: state.iteration,
3874
3882
  startedAt: state.started_at,
3875
- cooldownSeconds: state.cooldown_seconds
3883
+ cooldownSeconds: state.cooldown_seconds,
3884
+ contextMode: state.context_mode || "fresh",
3885
+ lastIterationStartedAt: (/* @__PURE__ */ new Date()).toISOString()
3876
3886
  };
3877
3887
  if (!prevRalph?.active) {
3878
3888
  const progressRelPath = `.svamp/${sessionId}/ralph-progress.md`;
@@ -3897,7 +3907,7 @@ function createSvampConfigChecker(directory, sessionId, getMetadata, setMetadata
3897
3907
  );
3898
3908
  logger.log(`[svampConfig] Ralph loop started: "${state.task.slice(0, 50)}..."`);
3899
3909
  onRalphLoopActivated?.();
3900
- } else if (prevRalph.currentIteration !== ralphLoop.currentIteration) {
3910
+ } else if (prevRalph.currentIteration !== ralphLoop.currentIteration || prevRalph.task !== ralphLoop.task) {
3901
3911
  setMetadata((m) => ({ ...m, ralphLoop }));
3902
3912
  sessionService.updateMetadata(getMetadata());
3903
3913
  }
@@ -3947,12 +3957,14 @@ function createSvampConfigChecker(directory, sessionId, getMetadata, setMetadata
3947
3957
  if ("ralph_loop" in patch) {
3948
3958
  const rl = patch.ralph_loop;
3949
3959
  if (rl && typeof rl === "object" && typeof rl.task === "string") {
3960
+ const contextMode = rl.context_mode === "fresh" || rl.context_mode === "continue" ? rl.context_mode : void 0;
3950
3961
  writeRalphState(ralphStatePath, {
3951
3962
  iteration: rl.current_iteration || 1,
3952
3963
  max_iterations: typeof rl.max_iterations === "number" ? rl.max_iterations : 0,
3953
3964
  completion_promise: rl.completion_promise || "DONE",
3954
3965
  cooldown_seconds: typeof rl.cooldown_seconds === "number" ? rl.cooldown_seconds : 1,
3955
3966
  started_at: rl.started_at || (/* @__PURE__ */ new Date()).toISOString(),
3967
+ context_mode: contextMode,
3956
3968
  task: rl.task.trim()
3957
3969
  });
3958
3970
  ralphChecker();
@@ -4085,9 +4097,16 @@ function buildRalphPrompt(task, state) {
4085
4097
  return task;
4086
4098
  }
4087
4099
  const iterStr = state.max_iterations > 0 ? `${state.iteration}/${state.max_iterations}` : `${state.iteration}`;
4088
- return task + `
4089
-
4090
- [Ralph iteration ${iterStr} \u2014 to complete: output <promise>${state.completion_promise}</promise> ONLY when truly done]`;
4100
+ const reminder = [
4101
+ "<system-reminder>",
4102
+ `Ralph Loop \u2014 Iteration ${iterStr} (Continue Mode)`,
4103
+ "Your conversation history persists. Continue from where you left off.",
4104
+ `To signal completion, output EXACTLY: <promise>${state.completion_promise}</promise>`,
4105
+ "Only output the promise when the task is FULLY and PERMANENTLY complete.",
4106
+ "Do NOT output a false promise to exit the loop.",
4107
+ "</system-reminder>"
4108
+ ].join("\n");
4109
+ return task + "\n\n" + reminder;
4091
4110
  }
4092
4111
  function getRalphProgressFilePath(directory, sessionId) {
4093
4112
  return join(getSessionDir(directory, sessionId), "ralph-progress.md");
@@ -4902,7 +4921,9 @@ The automated loop has finished. Review the progress above and let me know if yo
4902
4921
  maxIterations: rlState.max_iterations,
4903
4922
  currentIteration: nextIteration,
4904
4923
  startedAt: rlState.started_at,
4905
- cooldownSeconds: rlState.cooldown_seconds
4924
+ cooldownSeconds: rlState.cooldown_seconds,
4925
+ contextMode: rlState.context_mode || "fresh",
4926
+ lastIterationStartedAt: (/* @__PURE__ */ new Date()).toISOString()
4906
4927
  };
4907
4928
  sessionMetadata = { ...sessionMetadata, ralphLoop };
4908
4929
  sessionService.updateMetadata(sessionMetadata);
@@ -5239,6 +5260,11 @@ The automated loop has finished. Review the progress above and let me know if yo
5239
5260
  sessionMetadata = { ...sessionMetadata, securityContext: newSecurityContext };
5240
5261
  return await restartClaudeHandler();
5241
5262
  },
5263
+ onApplySystemPrompt: async (prompt) => {
5264
+ logger.log(`[Session ${sessionId}] System prompt update requested \u2014 restarting agent`);
5265
+ lastSpawnMeta = { ...lastSpawnMeta, appendSystemPrompt: prompt };
5266
+ return await restartClaudeHandler();
5267
+ },
5242
5268
  onKillSession: () => {
5243
5269
  logger.log(`[Session ${sessionId}] Kill session requested`);
5244
5270
  stopSession(sessionId);
@@ -5570,6 +5596,9 @@ The automated loop has finished. Review the progress above and let me know if yo
5570
5596
  sessionMetadata = { ...sessionMetadata, securityContext: newSecurityContext };
5571
5597
  return { success: false, message: "Security context updates with restart are not yet supported for this agent type." };
5572
5598
  },
5599
+ onApplySystemPrompt: async () => {
5600
+ return { success: false, message: "System prompt updates with restart are not yet supported for this agent type." };
5601
+ },
5573
5602
  onKillSession: () => {
5574
5603
  logger.log(`[${agentName} Session ${sessionId}] Kill session requested`);
5575
5604
  stopSession(sessionId);
@@ -5782,7 +5811,9 @@ The automated loop has finished. Review the progress above and let me know if yo
5782
5811
  maxIterations: rlState.max_iterations,
5783
5812
  currentIteration: nextIteration,
5784
5813
  startedAt: rlState.started_at,
5785
- cooldownSeconds: rlState.cooldown_seconds
5814
+ cooldownSeconds: rlState.cooldown_seconds,
5815
+ contextMode: rlState.context_mode || "fresh",
5816
+ lastIterationStartedAt: (/* @__PURE__ */ new Date()).toISOString()
5786
5817
  };
5787
5818
  sessionMetadata = { ...sessionMetadata, ralphLoop };
5788
5819
  sessionService.updateMetadata(sessionMetadata);
@@ -3872,7 +3872,9 @@ function createSvampConfigChecker(directory, sessionId, getMetadata, setMetadata
3872
3872
  maxIterations: state.max_iterations,
3873
3873
  currentIteration: state.iteration,
3874
3874
  startedAt: state.started_at,
3875
- cooldownSeconds: state.cooldown_seconds
3875
+ cooldownSeconds: state.cooldown_seconds,
3876
+ contextMode: state.context_mode || "fresh",
3877
+ lastIterationStartedAt: (/* @__PURE__ */ new Date()).toISOString()
3876
3878
  };
3877
3879
  if (!prevRalph?.active) {
3878
3880
  const progressRelPath = `.svamp/${sessionId}/ralph-progress.md`;
@@ -3897,7 +3899,7 @@ function createSvampConfigChecker(directory, sessionId, getMetadata, setMetadata
3897
3899
  );
3898
3900
  logger.log(`[svampConfig] Ralph loop started: "${state.task.slice(0, 50)}..."`);
3899
3901
  onRalphLoopActivated?.();
3900
- } else if (prevRalph.currentIteration !== ralphLoop.currentIteration) {
3902
+ } else if (prevRalph.currentIteration !== ralphLoop.currentIteration || prevRalph.task !== ralphLoop.task) {
3901
3903
  setMetadata((m) => ({ ...m, ralphLoop }));
3902
3904
  sessionService.updateMetadata(getMetadata());
3903
3905
  }
@@ -4087,9 +4089,16 @@ function buildRalphPrompt(task, state) {
4087
4089
  return task;
4088
4090
  }
4089
4091
  const iterStr = state.max_iterations > 0 ? `${state.iteration}/${state.max_iterations}` : `${state.iteration}`;
4090
- return task + `
4091
-
4092
- [Ralph iteration ${iterStr} \u2014 to complete: output <promise>${state.completion_promise}</promise> ONLY when truly done]`;
4092
+ const reminder = [
4093
+ "<system-reminder>",
4094
+ `Ralph Loop \u2014 Iteration ${iterStr} (Continue Mode)`,
4095
+ "Your conversation history persists. Continue from where you left off.",
4096
+ `To signal completion, output EXACTLY: <promise>${state.completion_promise}</promise>`,
4097
+ "Only output the promise when the task is FULLY and PERMANENTLY complete.",
4098
+ "Do NOT output a false promise to exit the loop.",
4099
+ "</system-reminder>"
4100
+ ].join("\n");
4101
+ return task + "\n\n" + reminder;
4093
4102
  }
4094
4103
  function getRalphProgressFilePath(directory, sessionId) {
4095
4104
  return join(getSessionDir(directory, sessionId), "ralph-progress.md");
@@ -4904,7 +4913,9 @@ The automated loop has finished. Review the progress above and let me know if yo
4904
4913
  maxIterations: rlState.max_iterations,
4905
4914
  currentIteration: nextIteration,
4906
4915
  startedAt: rlState.started_at,
4907
- cooldownSeconds: rlState.cooldown_seconds
4916
+ cooldownSeconds: rlState.cooldown_seconds,
4917
+ contextMode: rlState.context_mode || "fresh",
4918
+ lastIterationStartedAt: (/* @__PURE__ */ new Date()).toISOString()
4908
4919
  };
4909
4920
  sessionMetadata = { ...sessionMetadata, ralphLoop };
4910
4921
  sessionService.updateMetadata(sessionMetadata);
@@ -5784,7 +5795,9 @@ The automated loop has finished. Review the progress above and let me know if yo
5784
5795
  maxIterations: rlState.max_iterations,
5785
5796
  currentIteration: nextIteration,
5786
5797
  startedAt: rlState.started_at,
5787
- cooldownSeconds: rlState.cooldown_seconds
5798
+ cooldownSeconds: rlState.cooldown_seconds,
5799
+ contextMode: rlState.context_mode || "fresh",
5800
+ lastIterationStartedAt: (/* @__PURE__ */ new Date()).toISOString()
5788
5801
  };
5789
5802
  sessionMetadata = { ...sessionMetadata, ralphLoop };
5790
5803
  sessionService.updateMetadata(sessionMetadata);