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.
- package/dist/cli.mjs +18 -18
- package/dist/{commands-mw8HFkt6.mjs → commands-1tmye7o_.mjs} +3 -2
- package/dist/{commands-D1brd9fB.mjs → commands-CI_BVphs.mjs} +7 -3
- package/dist/{commands-DHnFOhQC.mjs → commands-DcFOU9nW.mjs} +7 -3
- package/dist/commands-DwY2B7KW.mjs +562 -0
- package/dist/index.mjs +1 -1
- package/dist/{package-BLDik3NY.mjs → package-D7EUXtnk.mjs} +1 -1
- package/dist/{run-6dwQnoBL.mjs → run-BYJX5syg.mjs} +1 -1
- package/dist/{run-C0ecvcRP.mjs → run-BnnUavlu.mjs} +131 -44
- package/dist/{run-3Et1ISd5.mjs → run-Bw6aGHLA.mjs} +1 -1
- package/dist/{run-BE_AIJ7z.mjs → run-DOwarObi.mjs} +1 -1
- package/dist/{run-Bc83CRUn.mjs → run-DxISzP_V.mjs} +38 -7
- package/dist/{run-BdEHYoYE.mjs → run-eYBOEaWw.mjs} +20 -7
- package/dist/tunnel-C2_V6y3d.mjs +299 -0
- package/package.json +1 -1
- package/dist/commands-4_MiOQVp.mjs +0 -1217
- package/dist/commands-8UAWGJrC.mjs +0 -1208
- package/dist/commands-8Wmq0uak.mjs +0 -1407
- package/dist/commands-8Xn02pQg.mjs +0 -1217
- package/dist/commands-9DPsh6ku.mjs +0 -1217
- package/dist/commands-9rMB13FP.mjs +0 -1214
- package/dist/commands-B-XaqFDB.mjs +0 -1407
- package/dist/commands-B53zuBHB.mjs +0 -1217
- package/dist/commands-B7yLt11i.mjs +0 -1217
- package/dist/commands-BDVAO_N2.mjs +0 -1217
- package/dist/commands-BD_NjWJL.mjs +0 -1217
- package/dist/commands-BEhSQqTp.mjs +0 -507
- package/dist/commands-BIFQZZGw.mjs +0 -1375
- package/dist/commands-BImRR1Wr.mjs +0 -1217
- package/dist/commands-BLmRIMdf.mjs +0 -1217
- package/dist/commands-BOYo9cdy.mjs +0 -1741
- package/dist/commands-BQ_347V_.mjs +0 -1374
- package/dist/commands-BTEmyf2m.mjs +0 -1407
- package/dist/commands-BVjcCbWS.mjs +0 -1375
- package/dist/commands-BVsLRttq.mjs +0 -1217
- package/dist/commands-BVuE0VQU.mjs +0 -507
- package/dist/commands-BY09VTpk.mjs +0 -1375
- package/dist/commands-Bcdp0X-o.mjs +0 -1217
- package/dist/commands-BdnG1cqQ.mjs +0 -1217
- package/dist/commands-BdvvRQIo.mjs +0 -1415
- package/dist/commands-Bgg_dvDw.mjs +0 -1683
- package/dist/commands-Bi0zYJvj.mjs +0 -1407
- package/dist/commands-BmirUCVt.mjs +0 -1208
- package/dist/commands-BpSUbvmr.mjs +0 -1217
- package/dist/commands-BuJ6xTfc.mjs +0 -1217
- package/dist/commands-BzbYPx0f.mjs +0 -1208
- package/dist/commands-C-RtFjJl.mjs +0 -1217
- package/dist/commands-C20_f6oo.mjs +0 -1217
- package/dist/commands-C6KDr9Yp.mjs +0 -1407
- package/dist/commands-C9TOoTCv.mjs +0 -1395
- package/dist/commands-C9TdN_El.mjs +0 -1683
- package/dist/commands-CFv6lO0D.mjs +0 -1217
- package/dist/commands-CJ2n5jS2.mjs +0 -1375
- package/dist/commands-CKEKQ_5B.mjs +0 -1217
- package/dist/commands-CQz67Rm1.mjs +0 -1395
- package/dist/commands-CRZbJjqN.mjs +0 -1375
- package/dist/commands-CToIvBFX.mjs +0 -1375
- package/dist/commands-CWsfciHn.mjs +0 -1217
- package/dist/commands-CYMSyqYC.mjs +0 -1395
- package/dist/commands-CZ7KPLLJ.mjs +0 -1217
- package/dist/commands-Cc73uUnP.mjs +0 -1375
- package/dist/commands-CdMsAD1-.mjs +0 -1217
- package/dist/commands-CdyCWC3y.mjs +0 -1395
- package/dist/commands-ClVCprrK.mjs +0 -1217
- package/dist/commands-Cnmf8znA.mjs +0 -1196
- package/dist/commands-CorUNLRF.mjs +0 -1375
- package/dist/commands-Cq0oj5_v.mjs +0 -1217
- package/dist/commands-CrdvbXPI.mjs +0 -1395
- package/dist/commands-Cw2Od6mc.mjs +0 -1683
- package/dist/commands-CwC2aVzu.mjs +0 -1217
- package/dist/commands-CxSCUJCB.mjs +0 -1217
- package/dist/commands-D-PTwdZz.mjs +0 -1217
- package/dist/commands-D-nIO_Sf.mjs +0 -1741
- package/dist/commands-D7-NHH5q.mjs +0 -1407
- package/dist/commands-D7kH-7Vn.mjs +0 -1217
- package/dist/commands-DBv6A3aJ.mjs +0 -507
- package/dist/commands-DD3HXakm.mjs +0 -1217
- package/dist/commands-DLoe6FyK.mjs +0 -1375
- package/dist/commands-DPbH8KF0.mjs +0 -1217
- package/dist/commands-DUAQ9MZM.mjs +0 -1217
- package/dist/commands-DVw-P6-0.mjs +0 -1407
- package/dist/commands-DVygnMsh.mjs +0 -1217
- package/dist/commands-DWira-Cz.mjs +0 -1741
- package/dist/commands-DYTdUlul.mjs +0 -1217
- package/dist/commands-DZfaDmsk.mjs +0 -1374
- package/dist/commands-Dd8cn8mW.mjs +0 -1217
- package/dist/commands-DsIoygTL.mjs +0 -1395
- package/dist/commands-Du-fdLLu.mjs +0 -969
- package/dist/commands-DuJGOq1y.mjs +0 -1217
- package/dist/commands-DwBr3sBn.mjs +0 -1217
- package/dist/commands-DwveR96q.mjs +0 -1683
- package/dist/commands-DypTF36z.mjs +0 -506
- package/dist/commands-EUMJqBCs.mjs +0 -1407
- package/dist/commands-HLu7P96l.mjs +0 -1214
- package/dist/commands-HrBaGV-C.mjs +0 -1683
- package/dist/commands-Jk5no-DX.mjs +0 -1407
- package/dist/commands-KH5dj9dv.mjs +0 -1214
- package/dist/commands-LaNHVHjc.mjs +0 -1217
- package/dist/commands-O1Q9g00y.mjs +0 -1395
- package/dist/commands-OwMfbBrU.mjs +0 -1395
- package/dist/commands-SQ0Wp_kD.mjs +0 -1217
- package/dist/commands-S_MFQ9n1.mjs +0 -354
- package/dist/commands-T3q8VKCY.mjs +0 -1407
- package/dist/commands-Ugz9TtRu.mjs +0 -1420
- package/dist/commands-Wng0OuNY.mjs +0 -1683
- package/dist/commands-YBW5jFpy.mjs +0 -1217
- package/dist/commands-Z-CbuF8E.mjs +0 -1217
- package/dist/commands-fSZOP80Z.mjs +0 -1217
- package/dist/commands-fqBuJe1b.mjs +0 -1217
- package/dist/commands-g-1n3_Rp.mjs +0 -1395
- package/dist/commands-mC0oe0lj.mjs +0 -1217
- package/dist/commands-od2hOku5.mjs +0 -1217
- package/dist/commands-otgzprjb.mjs +0 -1375
- package/dist/commands-rhHI6Wb2.mjs +0 -1420
- package/dist/commands-zGHnUXh5.mjs +0 -1217
- package/dist/package-BMCjXPI9.mjs +0 -58
- package/dist/package-BPMWPlS0.mjs +0 -57
- package/dist/package-BYUO-39f.mjs +0 -60
- package/dist/package-BaGfG8vL.mjs +0 -58
- package/dist/package-BkBE6ZdN.mjs +0 -57
- package/dist/package-BufekbY1.mjs +0 -57
- package/dist/package-C1hpYMj4.mjs +0 -57
- package/dist/package-CmIBOZtY.mjs +0 -57
- package/dist/package-CmVt1kdw.mjs +0 -58
- package/dist/package-Cn6Ya4A0.mjs +0 -57
- package/dist/package-Csd530Ym.mjs +0 -57
- package/dist/package-D6mNQtUs.mjs +0 -57
- package/dist/package-DG0AkZdm.mjs +0 -58
- package/dist/package-DRO1LpXW.mjs +0 -58
- package/dist/package-Dav8qh6X.mjs +0 -57
- package/dist/package-DiA55dzE.mjs +0 -57
- package/dist/package-UwLIU765.mjs +0 -58
- package/dist/package-k3XsdP9k.mjs +0 -58
- package/dist/package-rasGC9_z.mjs +0 -58
- package/dist/run-4B1XZQB8.mjs +0 -5426
- package/dist/run-4eArMb_9.mjs +0 -1050
- package/dist/run-4li60ojK.mjs +0 -1051
- package/dist/run-67wfoMuo.mjs +0 -5383
- package/dist/run-6N2IdEX7.mjs +0 -5410
- package/dist/run-7iQKryzo.mjs +0 -5383
- package/dist/run-7s8lOXqB.mjs +0 -1050
- package/dist/run-8kKykzTs.mjs +0 -5367
- package/dist/run-8mLZV2lg.mjs +0 -1050
- package/dist/run-9x7I9Ck-.mjs +0 -5264
- package/dist/run-B-PWtXF-.mjs +0 -5894
- package/dist/run-B1ivovUl.mjs +0 -5964
- package/dist/run-B1l9Ed8k.mjs +0 -5403
- package/dist/run-B2zRMxE0.mjs +0 -5508
- package/dist/run-B31biy0V.mjs +0 -1050
- package/dist/run-B5o5fMMd.mjs +0 -5369
- package/dist/run-B7V-xXM7.mjs +0 -5775
- package/dist/run-B9ND6srh.mjs +0 -6154
- package/dist/run-BG3279Kg.mjs +0 -1051
- package/dist/run-BHZNzX1F.mjs +0 -5235
- package/dist/run-BKdOv7gX.mjs +0 -1050
- package/dist/run-BLySdZ1K.mjs +0 -5251
- package/dist/run-BOVkQfM-.mjs +0 -1050
- package/dist/run-BQ0lIare.mjs +0 -1050
- package/dist/run-BREPr7Yc.mjs +0 -5508
- package/dist/run-BTwshVk1.mjs +0 -5728
- package/dist/run-BUL3eAqT.mjs +0 -1050
- package/dist/run-BVcPemGr.mjs +0 -5947
- package/dist/run-BWqEmIiz.mjs +0 -5964
- package/dist/run-BWsDPiNe.mjs +0 -1050
- package/dist/run-BX4iy6k8.mjs +0 -1050
- package/dist/run-BXYfq8mK.mjs +0 -5836
- package/dist/run-BY12Ataq.mjs +0 -5732
- package/dist/run-BYDOX4yk.mjs +0 -5402
- package/dist/run-Bd-t6s63.mjs +0 -5373
- package/dist/run-BenYqfwQ.mjs +0 -5273
- package/dist/run-BfF4bgA3.mjs +0 -5403
- package/dist/run-Bhh05yic.mjs +0 -5369
- package/dist/run-BicITYWX.mjs +0 -6138
- package/dist/run-BieEN0Pg.mjs +0 -5761
- package/dist/run-BjEQi6PN.mjs +0 -1050
- package/dist/run-BjZ6SyFy.mjs +0 -1051
- package/dist/run-Bl8OkKyC.mjs +0 -5969
- package/dist/run-BlEFlhfn.mjs +0 -5510
- package/dist/run-BmL1m0Bk.mjs +0 -1050
- package/dist/run-Bmx5wEBF.mjs +0 -1051
- package/dist/run-BnX5Rw8x.mjs +0 -5403
- package/dist/run-BpjmHeht.mjs +0 -1050
- package/dist/run-BxTdRjCG.mjs +0 -1051
- package/dist/run-ByOVDgvx.mjs +0 -6115
- package/dist/run-BzRP6Q5t.mjs +0 -1051
- package/dist/run-C0dyMP62.mjs +0 -1051
- package/dist/run-C1lS3SwN.mjs +0 -5733
- package/dist/run-C3PAp02X.mjs +0 -5252
- package/dist/run-C3eaYQub.mjs +0 -1050
- package/dist/run-C4pdX4sY.mjs +0 -1051
- package/dist/run-C676pHe-.mjs +0 -5423
- package/dist/run-C8GkzcfP.mjs +0 -1050
- package/dist/run-C9Hrqjy_.mjs +0 -1050
- package/dist/run-CC2C8P-U.mjs +0 -6031
- package/dist/run-CCcW4asS.mjs +0 -1050
- package/dist/run-CDBKhQ1Z.mjs +0 -1051
- package/dist/run-CE4H8ZiN.mjs +0 -6273
- package/dist/run-CEB6sYzn.mjs +0 -5962
- package/dist/run-CF6aXLmA.mjs +0 -5445
- package/dist/run-CHyN5U0t.mjs +0 -1050
- package/dist/run-CIFezmkC.mjs +0 -5949
- package/dist/run-CLA9zw7J.mjs +0 -5907
- package/dist/run-COWb9ovq.mjs +0 -1050
- package/dist/run-CSUAy5T5.mjs +0 -1051
- package/dist/run-CSk7i0Hq.mjs +0 -1050
- package/dist/run-CUtqSGWJ.mjs +0 -1050
- package/dist/run-CXrEt0TM.mjs +0 -5008
- package/dist/run-CY8Y0JPW.mjs +0 -5287
- package/dist/run-CZCKBcQ-.mjs +0 -5244
- package/dist/run-CZj0sRCs.mjs +0 -1050
- package/dist/run-C_1x2cNU.mjs +0 -5381
- package/dist/run-C_8iOjO1.mjs +0 -5892
- package/dist/run-C_KIew8H.mjs +0 -1051
- package/dist/run-CajRcN3C.mjs +0 -1050
- package/dist/run-CbzXO7fw.mjs +0 -1050
- package/dist/run-CcSr4x2f.mjs +0 -1050
- package/dist/run-CcYaXgCy.mjs +0 -6091
- package/dist/run-CdihMx0V.mjs +0 -1051
- package/dist/run-Cf2Dl_ck.mjs +0 -1051
- package/dist/run-CjH1H4vq.mjs +0 -1050
- package/dist/run-CkbDK6jA.mjs +0 -1051
- package/dist/run-Ckh6JE9F.mjs +0 -1050
- package/dist/run-Ckyg9-fm.mjs +0 -6079
- package/dist/run-CqL3ZWdr.mjs +0 -5381
- package/dist/run-Csj7sJAh.mjs +0 -1050
- package/dist/run-Ct--DWF1.mjs +0 -1051
- package/dist/run-CtJRxaFC.mjs +0 -1051
- package/dist/run-CuIMdkKF.mjs +0 -6099
- package/dist/run-CuckJGM-.mjs +0 -1050
- package/dist/run-CxGAa9MH.mjs +0 -1050
- package/dist/run-CyU4-O-e.mjs +0 -5411
- package/dist/run-CymDyu2b.mjs +0 -5389
- package/dist/run-CzIY4_RE.mjs +0 -6093
- package/dist/run-D0Ha4aWt.mjs +0 -1050
- package/dist/run-D0ow-xms.mjs +0 -5905
- package/dist/run-D1PFrNZB.mjs +0 -6273
- package/dist/run-D2X3jEqg.mjs +0 -1051
- package/dist/run-D39C7Ta3.mjs +0 -1050
- package/dist/run-D3Lqxasl.mjs +0 -1051
- package/dist/run-D3bhRCCb.mjs +0 -1051
- package/dist/run-D5N42sVA.mjs +0 -1050
- package/dist/run-D691XPXy.mjs +0 -6031
- package/dist/run-D7dLDpq3.mjs +0 -5403
- package/dist/run-D8mQ_fL5.mjs +0 -1050
- package/dist/run-DA-YBjNw.mjs +0 -6018
- package/dist/run-DByI8mI0.mjs +0 -1051
- package/dist/run-DCINWip4.mjs +0 -1050
- package/dist/run-DCrZ3vke.mjs +0 -5406
- package/dist/run-DDF-tRbn.mjs +0 -5954
- package/dist/run-DGSgljJE.mjs +0 -5421
- package/dist/run-DGsXW19O.mjs +0 -5541
- package/dist/run-DHrF2xpW.mjs +0 -5776
- package/dist/run-DIB0W42M.mjs +0 -1050
- package/dist/run-DJ4k0WzZ.mjs +0 -1051
- package/dist/run-DMI83W7i.mjs +0 -5434
- package/dist/run-DNX3djCI.mjs +0 -1050
- package/dist/run-DOPaGRT2.mjs +0 -6027
- package/dist/run-DP7KSZqR.mjs +0 -1051
- package/dist/run-DQ0yljWr.mjs +0 -1050
- package/dist/run-DTkldU6a.mjs +0 -1050
- package/dist/run-DU10B3gK.mjs +0 -5728
- package/dist/run-DV86VJNG.mjs +0 -5386
- package/dist/run-DVZGKdKO.mjs +0 -1050
- package/dist/run-DWdtp6VD.mjs +0 -6136
- package/dist/run-DWzA1gZ-.mjs +0 -1050
- package/dist/run-DXJ2M19k.mjs +0 -1050
- package/dist/run-DZOeccNu.mjs +0 -5484
- package/dist/run-D_W5YF0D.mjs +0 -6046
- package/dist/run-DaReJPf8.mjs +0 -1051
- package/dist/run-DaYrEeQ9.mjs +0 -5400
- package/dist/run-DbC9-WM4.mjs +0 -1050
- package/dist/run-Dd9XkswU.mjs +0 -1051
- package/dist/run-De-wkVl3.mjs +0 -5487
- package/dist/run-DfU2luyX.mjs +0 -1050
- package/dist/run-Dfl3Ze2L.mjs +0 -5541
- package/dist/run-DfuHUDIJ.mjs +0 -1051
- package/dist/run-DfwfyFqj.mjs +0 -5975
- package/dist/run-DgUDGHZy.mjs +0 -1051
- package/dist/run-Dge2K7h1.mjs +0 -1050
- package/dist/run-Di3I0USw.mjs +0 -1050
- package/dist/run-Dm3U4FB5.mjs +0 -6018
- package/dist/run-Du0YOs48.mjs +0 -5446
- package/dist/run-DuaIQAE4.mjs +0 -5392
- package/dist/run-Dwm19YhI.mjs +0 -1050
- package/dist/run-DxM7xaBa.mjs +0 -1050
- package/dist/run-DysN-cGm.mjs +0 -1050
- package/dist/run-DzXohf8-.mjs +0 -1051
- package/dist/run-E_MwVOtN.mjs +0 -5272
- package/dist/run-FPoL2-FD.mjs +0 -5381
- package/dist/run-HU4XjZfs.mjs +0 -6023
- package/dist/run-HhiYlJuS.mjs +0 -5414
- package/dist/run-JXLlRLFb.mjs +0 -1050
- package/dist/run-K-_jahIg.mjs +0 -1051
- package/dist/run-K_S7pfZ-.mjs +0 -1050
- package/dist/run-LDiT4WF-.mjs +0 -1050
- package/dist/run-NToLJWx-.mjs +0 -5442
- package/dist/run-RBufRqbs.mjs +0 -1050
- package/dist/run-YFYpyThQ.mjs +0 -1051
- package/dist/run-YG1Pb9dY.mjs +0 -5385
- package/dist/run-ZDa17iLg.mjs +0 -6060
- package/dist/run-ZN0qMdS_.mjs +0 -1051
- package/dist/run-azpFWM6w.mjs +0 -1050
- package/dist/run-coIDvBK_.mjs +0 -6127
- package/dist/run-jLp4pbTE.mjs +0 -1050
- package/dist/run-m3oAuSg0.mjs +0 -1050
- package/dist/run-r9CAcL_U.mjs +0 -5403
- package/dist/run-v32uF2bP.mjs +0 -5378
- package/dist/run-vTsskoZc.mjs +0 -5340
- package/dist/run-vt26p5D7.mjs +0 -1050
- package/dist/run-vvQiCHpi.mjs +0 -5427
- package/dist/run-w-HVv5py.mjs +0 -5410
- package/dist/run-wpUutZ9C.mjs +0 -1051
- package/dist/run-yTjJ7noq.mjs +0 -1051
- 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:
|
|
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} |
|
|
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
|
-
|
|
4048
|
-
|
|
4049
|
-
|
|
4050
|
-
|
|
4051
|
-
|
|
4052
|
-
|
|
4053
|
-
|
|
4054
|
-
|
|
4055
|
-
|
|
4056
|
-
|
|
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
|
-
|
|
4068
|
-
|
|
4069
|
-
|
|
4070
|
-
|
|
4071
|
-
|
|
4072
|
-
|
|
4073
|
-
|
|
4074
|
-
|
|
4075
|
-
|
|
4076
|
-
|
|
4077
|
-
|
|
4078
|
-
|
|
4079
|
-
|
|
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
|
-
|
|
4089
|
-
|
|
4090
|
-
|
|
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
|
-
|
|
4832
|
-
|
|
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
|
-
|
|
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
|
-
|
|
5741
|
-
|
|
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-
|
|
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-
|
|
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
|
-
|
|
4089
|
-
|
|
4090
|
-
|
|
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
|
-
|
|
4091
|
-
|
|
4092
|
-
|
|
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);
|