@agimon-ai/po-runner 0.0.0-alpha.21 → 0.0.0-alpha.210
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/LICENSE +21 -149
- package/README.md +34 -206
- package/dist/apiContracts.cjs +45 -2
- package/dist/apiContracts.cjs.map +1 -1
- package/dist/apiContracts.d.mts +2 -2
- package/dist/apiContracts.d.mts.map +1 -1
- package/dist/apiContracts.mjs +45 -2
- package/dist/apiContracts.mjs.map +1 -1
- package/dist/{bashResult-BqDa7sbC.mjs → bashResult-BLCLerXE.mjs} +57 -7
- package/dist/bashResult-BLCLerXE.mjs.map +1 -0
- package/dist/{bashResult-C2iKhHpD.cjs → bashResult-CZYiyl4p.cjs} +74 -6
- package/dist/bashResult-CZYiyl4p.cjs.map +1 -0
- package/dist/{bashResult-DcrRaBLv.d.mts → bashResult-CgVS_JpL.d.mts} +8 -3
- package/dist/{bashResult-DcrRaBLv.d.mts.map → bashResult-CgVS_JpL.d.mts.map} +1 -1
- package/dist/{bashRunService-DjOH5kye.cjs → bashRunService-DmuA1mKL.cjs} +52 -31
- package/dist/bashRunService-DmuA1mKL.cjs.map +1 -0
- package/dist/{bashRunService-Ci0cGdYO.d.mts → bashRunService-Iotfc_nV.d.mts} +21 -2
- package/dist/bashRunService-Iotfc_nV.d.mts.map +1 -0
- package/dist/{bashRunService-Cl3pYccr.mjs → bashRunService-Luy2hPMS.mjs} +52 -31
- package/dist/bashRunService-Luy2hPMS.mjs.map +1 -0
- package/dist/bashRunService.cjs +1 -1
- package/dist/bashRunService.d.mts +4 -4
- package/dist/bashRunService.d.mts.map +1 -1
- package/dist/bashRunService.mjs +1 -1
- package/dist/bashSchema.cjs +1 -1
- package/dist/bashSchema.d.mts +1 -1
- package/dist/bashSchema.mjs +1 -1
- package/dist/bashTool-D2ECDAhc.cjs +43 -0
- package/dist/bashTool-D2ECDAhc.cjs.map +1 -0
- package/dist/{bashTool-B1EwZLo_.d.mts → bashTool-Dc1ld2E3.d.mts} +3 -9
- package/dist/bashTool-Dc1ld2E3.d.mts.map +1 -0
- package/dist/bashTool-vg8uhbkj.mjs +26 -0
- package/dist/bashTool-vg8uhbkj.mjs.map +1 -0
- package/dist/bashTool.cjs +3 -3
- package/dist/bashTool.cjs.map +1 -1
- package/dist/bashTool.d.mts +4 -4
- package/dist/bashTool.d.mts.map +1 -1
- package/dist/bashTool.mjs +3 -3
- package/dist/bashTool.mjs.map +1 -1
- package/dist/bin/cli.cjs +372 -9
- package/dist/bin/cli.cjs.map +1 -1
- package/dist/bin/cli.d.mts.map +1 -1
- package/dist/bin/cli.mjs +369 -8
- package/dist/bin/cli.mjs.map +1 -1
- package/dist/bin/logSink.cjs +27 -24
- package/dist/bin/logSink.cjs.map +1 -1
- package/dist/bin/logSink.mjs +24 -21
- package/dist/bin/logSink.mjs.map +1 -1
- package/dist/bin/runnerHost.cjs +141 -53
- package/dist/bin/runnerHost.cjs.map +1 -1
- package/dist/bin/runnerHost.d.mts.map +1 -1
- package/dist/bin/runnerHost.mjs +141 -53
- package/dist/bin/runnerHost.mjs.map +1 -1
- package/dist/cliApp-7iTUx5KZ.cjs +351 -0
- package/dist/cliApp-7iTUx5KZ.cjs.map +1 -0
- package/dist/cliApp-S4iEO-fi.mjs +338 -0
- package/dist/cliApp-S4iEO-fi.mjs.map +1 -0
- package/dist/cliApp.cjs +2 -1
- package/dist/cliApp.d.mts +9 -4
- package/dist/cliApp.d.mts.map +1 -1
- package/dist/cliApp.mjs +1 -1
- package/dist/compaction.d.mts +1 -1
- package/dist/extensions/mcp-ui.mjs +7 -6
- package/dist/extensions/mcp-ui.mjs.map +1 -1
- package/dist/extensions/mcp.cjs +37 -17
- package/dist/extensions/mcp.cjs.map +1 -1
- package/dist/extensions/mcp.d.mts.map +1 -1
- package/dist/extensions/mcp.mjs +37 -17
- package/dist/extensions/mcp.mjs.map +1 -1
- package/dist/extensions/native.mjs +1225 -374
- package/dist/extensions/native.mjs.map +1 -1
- package/dist/extensions/server.cjs +900 -221
- package/dist/extensions/server.cjs.map +1 -1
- package/dist/extensions/server.d.mts.map +1 -1
- package/dist/extensions/server.mjs +908 -227
- package/dist/extensions/server.mjs.map +1 -1
- package/dist/extensions/web.mjs +924 -766
- package/dist/extensions/web.mjs.map +1 -1
- package/dist/headless-CMj9hunm.cjs +237 -0
- package/dist/headless-CMj9hunm.cjs.map +1 -0
- package/dist/headless-CUJt5Ihx.mjs +226 -0
- package/dist/headless-CUJt5Ihx.mjs.map +1 -0
- package/dist/{index-DM7yJpMs.d.mts → index-7_nuKoVm.d.mts} +6 -6
- package/dist/index-7_nuKoVm.d.mts.map +1 -0
- package/dist/index-BCCF1sGD.d.mts.map +1 -1
- package/dist/{index-CzCF_OP9.d.mts → index-CH-z0BX3.d.mts} +11 -4
- package/dist/index-CH-z0BX3.d.mts.map +1 -0
- package/dist/{index-C-IC35d9.d.mts → index-CJNsR-Ir.d.mts} +10 -7
- package/dist/index-CJNsR-Ir.d.mts.map +1 -0
- package/dist/{index--xF7DvsE.d.mts → index-CNCb1usM.d.mts} +8 -2
- package/dist/index-CNCb1usM.d.mts.map +1 -0
- package/dist/index-EMbmq9gu.d.mts +45 -0
- package/dist/index-EMbmq9gu.d.mts.map +1 -0
- package/dist/index-QlfncPRs.d.mts +58 -0
- package/dist/index-QlfncPRs.d.mts.map +1 -0
- package/dist/index-qSi4-EJW.d.mts +49 -0
- package/dist/index-qSi4-EJW.d.mts.map +1 -0
- package/dist/index.cjs +4 -4
- package/dist/index.d.mts +4 -4
- package/dist/index.mjs +4 -4
- package/dist/launch.cjs +4 -0
- package/dist/launch.d.mts +55 -0
- package/dist/launch.d.mts.map +1 -0
- package/dist/launch.mjs +1 -0
- package/dist/{launcher-CCYsFBM9.mjs → launcher-3xMxw72I.mjs} +45 -31
- package/dist/launcher-3xMxw72I.mjs.map +1 -0
- package/dist/{launcher-BG5t9nvG.d.mts → launcher-CDDBTvZq.d.mts} +4 -3
- package/dist/launcher-CDDBTvZq.d.mts.map +1 -0
- package/dist/{launcher-ZgDdyXpq.cjs → launcher-D7qAhSRL.cjs} +47 -33
- package/dist/launcher-D7qAhSRL.cjs.map +1 -0
- package/dist/launcher.cjs +1 -1
- package/dist/launcher.d.mts +5 -5
- package/dist/launcher.d.mts.map +1 -1
- package/dist/launcher.mjs +1 -1
- package/dist/lifeline-26IaW5w7.d.mts +34 -0
- package/dist/lifeline-26IaW5w7.d.mts.map +1 -0
- package/dist/lifeline-B4cjtrBe.cjs +27 -0
- package/dist/lifeline-B4cjtrBe.cjs.map +1 -0
- package/dist/lifeline-C1v2ItCY.mjs +214 -0
- package/dist/lifeline-C1v2ItCY.mjs.map +1 -0
- package/dist/lifeline-D4_ZRAhO.cjs +229 -0
- package/dist/lifeline-D4_ZRAhO.cjs.map +1 -0
- package/dist/lifeline-nPh3cx5A.mjs +10 -0
- package/dist/lifeline-nPh3cx5A.mjs.map +1 -0
- package/dist/lifeline.cjs +4 -1
- package/dist/lifeline.d.mts +4 -21
- package/dist/lifeline.mjs +3 -3
- package/dist/logFile-B9FSwmE0.cjs +44 -0
- package/dist/logFile-B9FSwmE0.cjs.map +1 -0
- package/dist/{logFile-C7oQ_v-g.d.mts → logFile-BirfZtS1.d.mts} +4 -4
- package/dist/logFile-BirfZtS1.d.mts.map +1 -0
- package/dist/logFile-D1EOKqmL.mjs +39 -0
- package/dist/logFile-D1EOKqmL.mjs.map +1 -0
- package/dist/logFile.cjs +1 -1
- package/dist/logFile.d.mts +3 -3
- package/dist/logFile.d.mts.map +1 -1
- package/dist/logFile.mjs +1 -1
- package/dist/{logReader-mq9uVurh.mjs → logReader-BYKii_s_.mjs} +99 -52
- package/dist/logReader-BYKii_s_.mjs.map +1 -0
- package/dist/{logReader-MdW9ffvV.d.mts → logReader-Bn3WEdjg.d.mts} +4 -2
- package/dist/{logReader-MdW9ffvV.d.mts.map → logReader-Bn3WEdjg.d.mts.map} +1 -1
- package/dist/{logReader-DHCK2BEr.cjs → logReader-DpMjBqfn.cjs} +101 -54
- package/dist/logReader-DpMjBqfn.cjs.map +1 -0
- package/dist/logReader.cjs +1 -1
- package/dist/logReader.d.mts +2 -2
- package/dist/logReader.mjs +1 -1
- package/dist/po-runtime-identity.json +1 -0
- package/dist/{ptyHost-D35hNmtd.cjs → ptyHost-C-oWV455.cjs} +20 -14
- package/dist/ptyHost-C-oWV455.cjs.map +1 -0
- package/dist/{ptyHost-CwbLLr90.mjs → ptyHost-C2zu-ZfO.mjs} +19 -13
- package/dist/ptyHost-C2zu-ZfO.mjs.map +1 -0
- package/dist/{ptyHost-DWWtRrGn.d.mts → ptyHost-C_6x2xuJ.d.mts} +2 -2
- package/dist/{ptyHost-DWWtRrGn.d.mts.map → ptyHost-C_6x2xuJ.d.mts.map} +1 -1
- package/dist/ptyHost.cjs +1 -1
- package/dist/ptyHost.d.mts +2 -2
- package/dist/ptyHost.d.mts.map +1 -1
- package/dist/ptyHost.mjs +1 -1
- package/dist/{reconcile-wNYQJZF-.mjs → reconcile-DUaX_vKZ.mjs} +2 -2
- package/dist/reconcile-DUaX_vKZ.mjs.map +1 -0
- package/dist/{reconcile-5cZ11jSD.cjs → reconcile-DjF9T1hN.cjs} +2 -2
- package/dist/reconcile-DjF9T1hN.cjs.map +1 -0
- package/dist/reconcile.cjs +1 -1
- package/dist/reconcile.d.mts +3 -3
- package/dist/reconcile.mjs +1 -1
- package/dist/responseEnvelope.cjs +5 -2
- package/dist/responseEnvelope.d.mts +15 -6
- package/dist/responseEnvelope.d.mts.map +1 -1
- package/dist/responseEnvelope.mjs +3 -3
- package/dist/{rmuxBackend-Dh0CYVAL.cjs → rmuxBackend-9tHTx1vf.cjs} +82 -48
- package/dist/rmuxBackend-9tHTx1vf.cjs.map +1 -0
- package/dist/{rmuxBackend-rjrVTG6K.mjs → rmuxBackend-BaK-R35I.mjs} +79 -45
- package/dist/rmuxBackend-BaK-R35I.mjs.map +1 -0
- package/dist/{rmuxBackend-CaEWooWn.d.mts → rmuxBackend-xFzlANM9.d.mts} +4 -4
- package/dist/rmuxBackend-xFzlANM9.d.mts.map +1 -0
- package/dist/rmuxBackend.cjs +1 -1
- package/dist/rmuxBackend.d.mts +2 -2
- package/dist/rmuxBackend.mjs +1 -1
- package/dist/rolldown-runtime-8H4AJuhK.mjs +14 -0
- package/dist/{rolldown-runtime-VH7oDXx4.cjs → rolldown-runtime-C0BPl7ul.cjs} +15 -0
- package/dist/{rtkProcessor-Iw9gP5Xp.mjs → rtkProcessor-DOXcp51z.mjs} +6 -5
- package/dist/rtkProcessor-DOXcp51z.mjs.map +1 -0
- package/dist/{rtkProcessor-DSGbM-Cm.cjs → rtkProcessor-J2gLQvM4.cjs} +8 -6
- package/dist/rtkProcessor-J2gLQvM4.cjs.map +1 -0
- package/dist/rtkProcessor.cjs +1 -1
- package/dist/rtkProcessor.mjs +1 -1
- package/dist/{runnerDependencies-DSun3xO-.cjs → runnerDependencies-CABYjW7H.cjs} +97 -64
- package/dist/runnerDependencies-CABYjW7H.cjs.map +1 -0
- package/dist/{runnerDependencies-7h_cxOva.mjs → runnerDependencies-DmvIcpZi.mjs} +95 -62
- package/dist/runnerDependencies-DmvIcpZi.mjs.map +1 -0
- package/dist/runnerDependencies.cjs +1 -1
- package/dist/runnerDependencies.d.mts +1 -1
- package/dist/runnerDependencies.mjs +1 -1
- package/dist/runnerHost-BvNYPMeh.mjs +165 -0
- package/dist/runnerHost-BvNYPMeh.mjs.map +1 -0
- package/dist/runnerHost-C2F5oxzn.cjs +184 -0
- package/dist/runnerHost-C2F5oxzn.cjs.map +1 -0
- package/dist/runnerLaunch-BAf7hXMr.cjs +192 -0
- package/dist/runnerLaunch-BAf7hXMr.cjs.map +1 -0
- package/dist/runnerLaunch-Bimgdh4h.mjs +175 -0
- package/dist/runnerLaunch-Bimgdh4h.mjs.map +1 -0
- package/dist/runnerNamer.d.mts +1 -1
- package/dist/{runnerPaths-B41rMOY6.cjs → runnerPaths-CSkswyjR.cjs} +97 -179
- package/dist/runnerPaths-CSkswyjR.cjs.map +1 -0
- package/dist/{runnerPaths-Dibbvyx_.mjs → runnerPaths-D3P7_EhW.mjs} +91 -179
- package/dist/runnerPaths-D3P7_EhW.mjs.map +1 -0
- package/dist/runnerPaths.cjs +1 -1
- package/dist/runnerPaths.d.mts +7 -9
- package/dist/runnerPaths.d.mts.map +1 -1
- package/dist/runnerPaths.mjs +1 -1
- package/dist/{runnerRegistry-dQYlMSpQ.cjs → runnerRegistry-B8K1L3lq.cjs} +68 -45
- package/dist/runnerRegistry-B8K1L3lq.cjs.map +1 -0
- package/dist/{runnerRegistry-V-Ocaf4N.d.mts → runnerRegistry-BlZhS9yL.d.mts} +2 -2
- package/dist/{runnerRegistry-V-Ocaf4N.d.mts.map → runnerRegistry-BlZhS9yL.d.mts.map} +1 -1
- package/dist/{runnerRegistry-BgaR5O86.mjs → runnerRegistry-Dqca6SD3.mjs} +53 -29
- package/dist/runnerRegistry-Dqca6SD3.mjs.map +1 -0
- package/dist/runnerRegistry-NW6oAJ71.cjs +60 -0
- package/dist/runnerRegistry-NW6oAJ71.cjs.map +1 -0
- package/dist/runnerRegistry-l0C_55oO.mjs +13 -0
- package/dist/runnerRegistry-l0C_55oO.mjs.map +1 -0
- package/dist/runnerRegistry.cjs +1 -1
- package/dist/runnerRegistry.d.mts +2 -2
- package/dist/runnerRegistry.mjs +1 -1
- package/dist/runnerSequence-ZTYgZ_2W.cjs +32 -0
- package/dist/runnerSequence-ZTYgZ_2W.cjs.map +1 -0
- package/dist/runnerSequence-k-_Fd77y.mjs +9 -0
- package/dist/runnerSequence-k-_Fd77y.mjs.map +1 -0
- package/dist/runnerSequenceStore-CaY7S_Sd.mjs +76 -0
- package/dist/runnerSequenceStore-CaY7S_Sd.mjs.map +1 -0
- package/dist/runnerSequenceStore-Ck6M-8r_.cjs +89 -0
- package/dist/runnerSequenceStore-Ck6M-8r_.cjs.map +1 -0
- package/dist/services/lifeline/client.cjs +88 -4
- package/dist/services/lifeline/client.cjs.map +1 -1
- package/dist/services/lifeline/client.d.mts +16 -0
- package/dist/services/lifeline/client.d.mts.map +1 -1
- package/dist/services/lifeline/client.mjs +83 -2
- package/dist/services/lifeline/client.mjs.map +1 -1
- package/dist/services/runnerSupervisor/index.cjs +36 -22
- package/dist/services/runnerSupervisor/index.cjs.map +1 -1
- package/dist/services/runnerSupervisor/index.d.mts +7 -5
- package/dist/services/runnerSupervisor/index.d.mts.map +1 -1
- package/dist/services/runnerSupervisor/index.mjs +35 -21
- package/dist/services/runnerSupervisor/index.mjs.map +1 -1
- package/dist/session-CdVeSD7F.mjs +8 -0
- package/dist/session-CdVeSD7F.mjs.map +1 -0
- package/dist/session-DnUj8Q71.cjs +25 -0
- package/dist/session-DnUj8Q71.cjs.map +1 -0
- package/dist/session-ISEGK4z9.mjs +26 -0
- package/dist/session-ISEGK4z9.mjs.map +1 -0
- package/dist/session-PQd3azWf.cjs +43 -0
- package/dist/session-PQd3azWf.cjs.map +1 -0
- package/dist/session.cjs +4 -3
- package/dist/session.d.mts +3 -1
- package/dist/session.d.mts.map +1 -1
- package/dist/session.mjs +3 -3
- package/dist/{type-DwMZoINK.d.mts → type-BWY9vvSq.d.mts} +6 -4
- package/dist/type-BWY9vvSq.d.mts.map +1 -0
- package/dist/{type-Do0YxwVQ.d.mts → type-bZgYQ7hv.d.mts} +11 -11
- package/dist/{type-Do0YxwVQ.d.mts.map → type-bZgYQ7hv.d.mts.map} +1 -1
- package/dist/types.d.mts +1 -1
- package/llms.txt +2 -1
- package/locales/vi.json +169 -0
- package/locales/zh-CN.json +169 -0
- package/package.json +95 -30
- package/skills/po-runner/SKILL.md +32 -14
- package/src/prompts/codemode-how-to-runner/SKILL.md +85 -0
- package/src/prompts/help-how-to-runner/SKILL.md +51 -0
- package/dist/bashResult-BqDa7sbC.mjs.map +0 -1
- package/dist/bashResult-C2iKhHpD.cjs.map +0 -1
- package/dist/bashRunService-Ci0cGdYO.d.mts.map +0 -1
- package/dist/bashRunService-Cl3pYccr.mjs.map +0 -1
- package/dist/bashRunService-DjOH5kye.cjs.map +0 -1
- package/dist/bashTool-B1EwZLo_.d.mts.map +0 -1
- package/dist/bashTool-BvC3YOgG.mjs +0 -24
- package/dist/bashTool-BvC3YOgG.mjs.map +0 -1
- package/dist/bashTool-euL6zMDl.cjs +0 -41
- package/dist/bashTool-euL6zMDl.cjs.map +0 -1
- package/dist/cliApp-T8Fx_-1j.cjs +0 -244
- package/dist/cliApp-T8Fx_-1j.cjs.map +0 -1
- package/dist/cliApp-q97eVh4E.mjs +0 -237
- package/dist/cliApp-q97eVh4E.mjs.map +0 -1
- package/dist/headless-DOlCixyf.mjs +0 -169
- package/dist/headless-DOlCixyf.mjs.map +0 -1
- package/dist/headless-Dko_yBiy.cjs +0 -180
- package/dist/headless-Dko_yBiy.cjs.map +0 -1
- package/dist/index--xF7DvsE.d.mts.map +0 -1
- package/dist/index-BzeXJk6V.d.mts +0 -12
- package/dist/index-BzeXJk6V.d.mts.map +0 -1
- package/dist/index-C-IC35d9.d.mts.map +0 -1
- package/dist/index-CzCF_OP9.d.mts.map +0 -1
- package/dist/index-DM7yJpMs.d.mts.map +0 -1
- package/dist/launcher-BG5t9nvG.d.mts.map +0 -1
- package/dist/launcher-CCYsFBM9.mjs.map +0 -1
- package/dist/launcher-ZgDdyXpq.cjs.map +0 -1
- package/dist/lifeline-Bm-bHIjS.mjs +0 -88
- package/dist/lifeline-Bm-bHIjS.mjs.map +0 -1
- package/dist/lifeline-eJdZV0nN.d.mts +0 -19
- package/dist/lifeline-eJdZV0nN.d.mts.map +0 -1
- package/dist/lifeline-m7laIzIP.cjs +0 -98
- package/dist/lifeline-m7laIzIP.cjs.map +0 -1
- package/dist/lifeline.d.mts.map +0 -1
- package/dist/logFile-C7oQ_v-g.d.mts.map +0 -1
- package/dist/logFile-CnPKtxPy.cjs +0 -67
- package/dist/logFile-CnPKtxPy.cjs.map +0 -1
- package/dist/logFile-XcDHBwu1.mjs +0 -60
- package/dist/logFile-XcDHBwu1.mjs.map +0 -1
- package/dist/logReader-DHCK2BEr.cjs.map +0 -1
- package/dist/logReader-mq9uVurh.mjs.map +0 -1
- package/dist/ptyHost-CwbLLr90.mjs.map +0 -1
- package/dist/ptyHost-D35hNmtd.cjs.map +0 -1
- package/dist/reconcile-5cZ11jSD.cjs.map +0 -1
- package/dist/reconcile-wNYQJZF-.mjs.map +0 -1
- package/dist/rmuxBackend-CaEWooWn.d.mts.map +0 -1
- package/dist/rmuxBackend-Dh0CYVAL.cjs.map +0 -1
- package/dist/rmuxBackend-rjrVTG6K.mjs.map +0 -1
- package/dist/rtkProcessor-DSGbM-Cm.cjs.map +0 -1
- package/dist/rtkProcessor-Iw9gP5Xp.mjs.map +0 -1
- package/dist/runnerDependencies-7h_cxOva.mjs.map +0 -1
- package/dist/runnerDependencies-DSun3xO-.cjs.map +0 -1
- package/dist/runnerPaths-B41rMOY6.cjs.map +0 -1
- package/dist/runnerPaths-Dibbvyx_.mjs.map +0 -1
- package/dist/runnerRegistry-BgaR5O86.mjs.map +0 -1
- package/dist/runnerRegistry-dQYlMSpQ.cjs.map +0 -1
- package/dist/session-BKYnH4R6.mjs +0 -18
- package/dist/session-BKYnH4R6.mjs.map +0 -1
- package/dist/session-BvqzhXZY.cjs +0 -29
- package/dist/session-BvqzhXZY.cjs.map +0 -1
- package/dist/session-DE2Acesp.mjs +0 -6
- package/dist/session-DE2Acesp.mjs.map +0 -1
- package/dist/session-SfIPtdZO.cjs +0 -11
- package/dist/session-SfIPtdZO.cjs.map +0 -1
- package/dist/type-DwMZoINK.d.mts.map +0 -1
- package/src/prompts/po-use-runner/SKILL.md +0 -47
|
@@ -1,9 +1,12 @@
|
|
|
1
|
-
import {
|
|
2
|
-
import {
|
|
3
|
-
import
|
|
1
|
+
import { t as __exportAll } from "./rolldown-runtime-8H4AJuhK.mjs";
|
|
2
|
+
import { l as getMaxCompletedRunners } from "./runnerConfig-XXMq4VQA.mjs";
|
|
3
|
+
import { n as PO_SESSION_TEMP_DIR_ENV } from "./session-CdVeSD7F.mjs";
|
|
4
|
+
import { t as inheritedSessionId } from "./session-ISEGK4z9.mjs";
|
|
5
|
+
import fs from "node:fs/promises";
|
|
4
6
|
import path from "node:path";
|
|
5
|
-
import
|
|
6
|
-
import {
|
|
7
|
+
import fs$1 from "node:fs";
|
|
8
|
+
import { execFile } from "node:child_process";
|
|
9
|
+
import { promisify } from "node:util";
|
|
7
10
|
//#region src/constants/runnerPaths.ts
|
|
8
11
|
const STORE_DIR_NAME = "po-runner";
|
|
9
12
|
const LOG_DIR_NAME = "logs";
|
|
@@ -14,6 +17,11 @@ const RAW_SUFFIX = ".raw";
|
|
|
14
17
|
const FILE_ENCODING = "utf8";
|
|
15
18
|
//#endregion
|
|
16
19
|
//#region src/services/runnerPaths/index.ts
|
|
20
|
+
var runnerPaths_exports = /* @__PURE__ */ __exportAll({
|
|
21
|
+
RunnerPaths: () => RunnerPaths,
|
|
22
|
+
resolveRunnerStoreDirectory: () => resolveRunnerStoreDirectory,
|
|
23
|
+
runnerStateDirFor: () => runnerStateDirFor
|
|
24
|
+
});
|
|
17
25
|
/** Unscrubbed pane bytes, kept beside the log so an attached terminal can replay them. */
|
|
18
26
|
/**
|
|
19
27
|
* How long an entirely empty session directory is left alone before it counts
|
|
@@ -21,25 +29,22 @@ const FILE_ENCODING = "utf8";
|
|
|
21
29
|
* directory for a moment, and reclaiming it out from under that session would
|
|
22
30
|
* be churn for no gain.
|
|
23
31
|
*/
|
|
24
|
-
|
|
32
|
+
const runCommand = promisify(execFile);
|
|
33
|
+
async function git(args, cwd) {
|
|
25
34
|
try {
|
|
26
|
-
const
|
|
35
|
+
const { stdout } = await runCommand("git", args, {
|
|
27
36
|
cwd,
|
|
28
|
-
encoding: FILE_ENCODING
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
"pipe",
|
|
32
|
-
"ignore"
|
|
33
|
-
]
|
|
34
|
-
}).trim();
|
|
37
|
+
encoding: FILE_ENCODING
|
|
38
|
+
});
|
|
39
|
+
const trimmed = stdout.trim();
|
|
35
40
|
return trimmed.length > 0 ? trimmed : void 0;
|
|
36
41
|
} catch {
|
|
37
42
|
return;
|
|
38
43
|
}
|
|
39
44
|
}
|
|
40
|
-
function realPath(target) {
|
|
45
|
+
async function realPath(target) {
|
|
41
46
|
try {
|
|
42
|
-
return fs.
|
|
47
|
+
return await fs.realpath(target);
|
|
43
48
|
} catch {
|
|
44
49
|
return target;
|
|
45
50
|
}
|
|
@@ -49,23 +54,13 @@ function realPath(target) {
|
|
|
49
54
|
* directory itself. A session still being written to therefore always looks
|
|
50
55
|
* recent, whatever state its individual records are in.
|
|
51
56
|
*/
|
|
52
|
-
function newestEntryTime(directory) {
|
|
53
|
-
let newest = fs.statSync(directory).mtimeMs;
|
|
54
|
-
for (const entry of fs.readdirSync(directory, { withFileTypes: true })) {
|
|
55
|
-
const target = path.join(directory, entry.name);
|
|
56
|
-
newest = Math.max(newest, fs.statSync(target).mtimeMs);
|
|
57
|
-
if (!entry.isDirectory()) continue;
|
|
58
|
-
for (const child of fs.readdirSync(target)) newest = Math.max(newest, fs.statSync(path.join(target, child)).mtimeMs);
|
|
59
|
-
}
|
|
60
|
-
return newest;
|
|
61
|
-
}
|
|
62
57
|
async function newestEntryTimeAsync(directory) {
|
|
63
|
-
let newest = (await fs.
|
|
64
|
-
for (const entry of await fs.
|
|
58
|
+
let newest = (await fs.stat(directory)).mtimeMs;
|
|
59
|
+
for (const entry of await fs.readdir(directory, { withFileTypes: true })) {
|
|
65
60
|
const target = path.join(directory, entry.name);
|
|
66
|
-
newest = Math.max(newest, (await fs.
|
|
61
|
+
newest = Math.max(newest, (await fs.stat(target)).mtimeMs);
|
|
67
62
|
if (!entry.isDirectory()) continue;
|
|
68
|
-
for (const child of await fs.
|
|
63
|
+
for (const child of await fs.readdir(target)) newest = Math.max(newest, (await fs.stat(path.join(target, child))).mtimeMs);
|
|
69
64
|
}
|
|
70
65
|
return newest;
|
|
71
66
|
}
|
|
@@ -75,35 +70,17 @@ async function newestEntryTimeAsync(directory) {
|
|
|
75
70
|
* One live record is enough: records are only ever written by their owner, so a
|
|
76
71
|
* live host pid means the session is still in use however old its files look.
|
|
77
72
|
*/
|
|
78
|
-
function ownerAlive(stateDirectory) {
|
|
79
|
-
let entries;
|
|
80
|
-
try {
|
|
81
|
-
entries = fs.readdirSync(stateDirectory);
|
|
82
|
-
} catch {
|
|
83
|
-
return false;
|
|
84
|
-
}
|
|
85
|
-
for (const entry of entries) {
|
|
86
|
-
if (!entry.endsWith(".json")) continue;
|
|
87
|
-
try {
|
|
88
|
-
const hostPid = JSON.parse(fs.readFileSync(path.join(stateDirectory, entry), FILE_ENCODING)).hostPid;
|
|
89
|
-
if (typeof hostPid !== "number") continue;
|
|
90
|
-
process.kill(hostPid, 0);
|
|
91
|
-
return true;
|
|
92
|
-
} catch {}
|
|
93
|
-
}
|
|
94
|
-
return false;
|
|
95
|
-
}
|
|
96
73
|
async function ownerAliveAsync(stateDirectory) {
|
|
97
74
|
let entries;
|
|
98
75
|
try {
|
|
99
|
-
entries = await fs.
|
|
76
|
+
entries = await fs.readdir(stateDirectory);
|
|
100
77
|
} catch {
|
|
101
78
|
return false;
|
|
102
79
|
}
|
|
103
80
|
for (const entry of entries) {
|
|
104
81
|
if (!entry.endsWith(".json")) continue;
|
|
105
82
|
try {
|
|
106
|
-
const hostPid = JSON.parse(await fs.
|
|
83
|
+
const hostPid = JSON.parse(await fs.readFile(path.join(stateDirectory, entry), FILE_ENCODING)).hostPid;
|
|
107
84
|
if (typeof hostPid !== "number") continue;
|
|
108
85
|
process.kill(hostPid, 0);
|
|
109
86
|
return true;
|
|
@@ -137,34 +114,28 @@ function expiredCompletedRecords(records, ttlMs, now, keep) {
|
|
|
137
114
|
* its lifeline socket in the state directory, so an entirely empty tree names
|
|
138
115
|
* no owner and no history.
|
|
139
116
|
*/
|
|
140
|
-
function isEmptySession(directory) {
|
|
141
|
-
for (const entry of fs.readdirSync(directory, { withFileTypes: true })) {
|
|
142
|
-
if (!entry.isDirectory()) return false;
|
|
143
|
-
if (fs.readdirSync(path.join(directory, entry.name)).length > 0) return false;
|
|
144
|
-
}
|
|
145
|
-
return true;
|
|
146
|
-
}
|
|
147
117
|
async function isEmptySessionAsync(directory) {
|
|
148
|
-
for (const entry of await fs.
|
|
118
|
+
for (const entry of await fs.readdir(directory, { withFileTypes: true })) {
|
|
149
119
|
if (!entry.isDirectory()) return false;
|
|
150
|
-
if ((await fs.
|
|
120
|
+
if ((await fs.readdir(path.join(directory, entry.name))).length > 0) return false;
|
|
151
121
|
}
|
|
152
122
|
return true;
|
|
153
123
|
}
|
|
154
124
|
/**
|
|
155
|
-
* The root
|
|
156
|
-
* override: `<agent dir>/po-runner/<session id>/{runs,logs}`. A reader in
|
|
125
|
+
* The root this session's runner state lives under: `<PO_SESSION_TEMP_DIR>/po-runner/<session id>/{runs,logs}`. A reader in
|
|
157
126
|
* another process, such as the cockpit hub, resolves the same root from its
|
|
158
|
-
* own environment.
|
|
127
|
+
* own environment. There is no durable or global temporary directory fallback.
|
|
159
128
|
*/
|
|
160
129
|
function resolveRunnerStoreDirectory(env) {
|
|
161
|
-
|
|
130
|
+
const temporaryDirectory = env[PO_SESSION_TEMP_DIR_ENV];
|
|
131
|
+
if (!temporaryDirectory || !path.isAbsolute(temporaryDirectory)) throw new Error("A host-admitted PO_SESSION_TEMP_DIR is required for po-runner storage");
|
|
132
|
+
return path.join(temporaryDirectory, STORE_DIR_NAME);
|
|
162
133
|
}
|
|
163
|
-
/**
|
|
134
|
+
/** Temporary metadata directory for one session. Used by APIs and history reads, not live transport. */
|
|
164
135
|
function runnerStateDirFor(storeDir, sessionId) {
|
|
165
136
|
return path.join(storeDir, sessionId, STATE_DIR_NAME);
|
|
166
137
|
}
|
|
167
|
-
/**
|
|
138
|
+
/** Runner storage inside the host-admitted session temporary directory. */
|
|
168
139
|
var RunnerPaths = class {
|
|
169
140
|
cwd;
|
|
170
141
|
env;
|
|
@@ -175,22 +146,19 @@ var RunnerPaths = class {
|
|
|
175
146
|
this.env = env;
|
|
176
147
|
}
|
|
177
148
|
repositoryPath() {
|
|
178
|
-
this.repository ??=
|
|
149
|
+
this.repository ??= git(["rev-parse", "--show-toplevel"], this.cwd).then((root) => realPath(root ?? this.cwd));
|
|
179
150
|
return this.repository;
|
|
180
151
|
}
|
|
181
152
|
setSessionId(sessionId) {
|
|
182
153
|
const trimmed = sessionId.trim();
|
|
183
154
|
if (!trimmed) throw new Error("po-runner session id cannot be blank");
|
|
155
|
+
if (!/^[a-zA-Z0-9_-]+$/u.test(trimmed)) throw new Error("Invalid runner session identity");
|
|
184
156
|
this.adoptedSessionId = trimmed;
|
|
185
157
|
}
|
|
186
158
|
logDirectory(sessionId) {
|
|
187
|
-
const override = this.env[LOG_DIR_ENV]?.trim();
|
|
188
|
-
if (override) return path.resolve(this.cwd, override);
|
|
189
159
|
return path.join(this.sessionDirectory(sessionId), LOG_DIR_NAME);
|
|
190
160
|
}
|
|
191
161
|
stateDirectory(sessionId) {
|
|
192
|
-
const override = this.env[LOG_DIR_ENV]?.trim();
|
|
193
|
-
if (override) return path.join(path.resolve(this.cwd, override), "..", STATE_DIR_NAME);
|
|
194
162
|
return path.join(this.sessionDirectory(sessionId), STATE_DIR_NAME);
|
|
195
163
|
}
|
|
196
164
|
logPathFor(id, sessionId) {
|
|
@@ -205,52 +173,25 @@ var RunnerPaths = class {
|
|
|
205
173
|
statePathFor(id, sessionId) {
|
|
206
174
|
return path.join(this.stateDirectory(sessionId), `${id}${STATE_EXTENSION}`);
|
|
207
175
|
}
|
|
208
|
-
ensureDirectories(sessionId) {
|
|
209
|
-
fs.
|
|
210
|
-
|
|
211
|
-
|
|
212
|
-
|
|
176
|
+
async ensureDirectories(sessionId) {
|
|
177
|
+
await fs.mkdir(this.logDirectory(sessionId), {
|
|
178
|
+
recursive: true,
|
|
179
|
+
mode: 448
|
|
180
|
+
});
|
|
181
|
+
await fs.mkdir(this.stateDirectory(sessionId), {
|
|
182
|
+
recursive: true,
|
|
183
|
+
mode: 448
|
|
184
|
+
});
|
|
185
|
+
}
|
|
186
|
+
async sweepHistory(ttlMs, now = Date.now(), live = this.liveSessions()) {
|
|
213
187
|
const result = {
|
|
214
188
|
removed: [],
|
|
215
189
|
errors: []
|
|
216
190
|
};
|
|
217
|
-
if (this.env["PO_RUNNER_LOG_DIR"]?.trim()) {
|
|
218
|
-
const owner = [...live][0] ?? this.sessionId();
|
|
219
|
-
this.sweepStateDirectory(this.stateDirectory(owner), owner, ttlMs, now, result);
|
|
220
|
-
return result;
|
|
221
|
-
}
|
|
222
191
|
const root = this.storeDirectory();
|
|
223
192
|
let sessions;
|
|
224
193
|
try {
|
|
225
|
-
sessions = fs.
|
|
226
|
-
} catch (error) {
|
|
227
|
-
if (error.code === "ENOENT") return result;
|
|
228
|
-
result.errors.push(`Could not read runner history directory ${root}: ${String(error)}`);
|
|
229
|
-
return result;
|
|
230
|
-
}
|
|
231
|
-
for (const sessionId of sessions) {
|
|
232
|
-
if (live.has(sessionId)) {
|
|
233
|
-
this.sweepActiveSession(sessionId, ttlMs, now, result);
|
|
234
|
-
continue;
|
|
235
|
-
}
|
|
236
|
-
this.sweepSessionDirectory(path.join(root, sessionId), ttlMs, now, result);
|
|
237
|
-
}
|
|
238
|
-
return result;
|
|
239
|
-
}
|
|
240
|
-
async sweepHistoryAsync(ttlMs, now = Date.now(), live = this.liveSessions()) {
|
|
241
|
-
const result = {
|
|
242
|
-
removed: [],
|
|
243
|
-
errors: []
|
|
244
|
-
};
|
|
245
|
-
if (this.env["PO_RUNNER_LOG_DIR"]?.trim()) {
|
|
246
|
-
const owner = [...live][0] ?? this.sessionId();
|
|
247
|
-
await this.sweepStateDirectoryAsync(this.stateDirectory(owner), owner, ttlMs, now, result);
|
|
248
|
-
return result;
|
|
249
|
-
}
|
|
250
|
-
const root = this.storeDirectory();
|
|
251
|
-
let sessions;
|
|
252
|
-
try {
|
|
253
|
-
sessions = await fs.promises.readdir(root);
|
|
194
|
+
sessions = await fs.readdir(root);
|
|
254
195
|
} catch (error) {
|
|
255
196
|
if (error.code === "ENOENT") return result;
|
|
256
197
|
result.errors.push(`Could not read runner history directory ${root}: ${String(error)}`);
|
|
@@ -265,6 +206,9 @@ var RunnerPaths = class {
|
|
|
265
206
|
}
|
|
266
207
|
return result;
|
|
267
208
|
}
|
|
209
|
+
sweepHistoryAsync(ttlMs, now, live) {
|
|
210
|
+
return this.sweepHistory(ttlMs, now, live);
|
|
211
|
+
}
|
|
268
212
|
/** The live session, if one is known, so a sweep never deletes underneath itself. */
|
|
269
213
|
liveSessions() {
|
|
270
214
|
try {
|
|
@@ -283,40 +227,15 @@ var RunnerPaths = class {
|
|
|
283
227
|
* files that record names, and never the directory itself. A running record
|
|
284
228
|
* has no `exit.finishedAt`, so it is not a candidate at any age.
|
|
285
229
|
*/
|
|
286
|
-
sweepActiveSession(sessionId, ttlMs, now, result) {
|
|
287
|
-
this.sweepStateDirectory(this.stateDirectory(sessionId), sessionId, ttlMs, now, result);
|
|
288
|
-
}
|
|
289
230
|
async sweepActiveSessionAsync(sessionId, ttlMs, now, result) {
|
|
290
231
|
await this.sweepStateDirectoryAsync(this.stateDirectory(sessionId), sessionId, ttlMs, now, result);
|
|
291
232
|
}
|
|
292
233
|
/** Removes a session's whole directory once its newest entry is past the TTL. */
|
|
293
|
-
sweepSessionDirectory(directory, ttlMs, now, result) {
|
|
294
|
-
try {
|
|
295
|
-
const newest = newestEntryTime(directory);
|
|
296
|
-
if (now - newest > 3e5 && isEmptySession(directory)) {
|
|
297
|
-
fs.rmSync(directory, {
|
|
298
|
-
recursive: true,
|
|
299
|
-
force: true
|
|
300
|
-
});
|
|
301
|
-
result.removed.push(directory);
|
|
302
|
-
return;
|
|
303
|
-
}
|
|
304
|
-
if (now - newest <= ttlMs) return;
|
|
305
|
-
if (ownerAlive(path.join(directory, "runs"))) return;
|
|
306
|
-
fs.rmSync(directory, {
|
|
307
|
-
recursive: true,
|
|
308
|
-
force: true
|
|
309
|
-
});
|
|
310
|
-
result.removed.push(directory);
|
|
311
|
-
} catch (error) {
|
|
312
|
-
if (error.code !== "ENOENT") result.errors.push(`Could not sweep runner session ${directory}: ${String(error)}`);
|
|
313
|
-
}
|
|
314
|
-
}
|
|
315
234
|
async sweepSessionDirectoryAsync(directory, ttlMs, now, result) {
|
|
316
235
|
try {
|
|
317
236
|
const newest = await newestEntryTimeAsync(directory);
|
|
318
237
|
if (now - newest > 3e5 && await isEmptySessionAsync(directory)) {
|
|
319
|
-
await fs.
|
|
238
|
+
await fs.rm(directory, {
|
|
320
239
|
recursive: true,
|
|
321
240
|
force: true
|
|
322
241
|
});
|
|
@@ -325,7 +244,7 @@ var RunnerPaths = class {
|
|
|
325
244
|
}
|
|
326
245
|
if (now - newest <= ttlMs) return;
|
|
327
246
|
if (await ownerAliveAsync(path.join(directory, "runs"))) return;
|
|
328
|
-
await fs.
|
|
247
|
+
await fs.rm(directory, {
|
|
329
248
|
recursive: true,
|
|
330
249
|
force: true
|
|
331
250
|
});
|
|
@@ -336,47 +255,53 @@ var RunnerPaths = class {
|
|
|
336
255
|
}
|
|
337
256
|
sessionId(explicit) {
|
|
338
257
|
const sessionId = explicit?.trim() || this.adoptedSessionId || inheritedSessionId(this.env);
|
|
339
|
-
if (!sessionId) throw new Error("
|
|
258
|
+
if (!sessionId) throw new Error("PO_SESSION_ID is required for po-runner storage");
|
|
259
|
+
if (!/^[a-zA-Z0-9_-]+$/u.test(sessionId)) throw new Error("Invalid runner session identity");
|
|
340
260
|
return sessionId;
|
|
341
261
|
}
|
|
342
262
|
storeDirectory() {
|
|
343
|
-
const override = this.env[LOG_DIR_ENV]?.trim();
|
|
344
|
-
if (override) return path.dirname(path.resolve(this.cwd, override));
|
|
345
263
|
return resolveRunnerStoreDirectory(this.env);
|
|
346
264
|
}
|
|
347
|
-
|
|
348
|
-
|
|
349
|
-
|
|
350
|
-
sweepStateDirectory(directory, sessionId, ttlMs, now, result) {
|
|
351
|
-
let entries;
|
|
265
|
+
/** Delete only this session's runner subtree, never its other temporary output. */
|
|
266
|
+
async removeSessionFiles(sessionId, generation) {
|
|
267
|
+
let directory = this.sessionDirectory(sessionId);
|
|
352
268
|
try {
|
|
353
|
-
|
|
269
|
+
const root = fs$1.lstatSync(this.storeDirectory());
|
|
270
|
+
if (root.isSymbolicLink() || !root.isDirectory()) throw new Error("Unsafe runner cleanup root");
|
|
354
271
|
} catch (error) {
|
|
355
|
-
if (error.code
|
|
356
|
-
|
|
272
|
+
if (error.code === "ENOENT") return;
|
|
273
|
+
throw error;
|
|
357
274
|
}
|
|
358
|
-
|
|
359
|
-
|
|
360
|
-
if (!entry.endsWith(".json")) continue;
|
|
361
|
-
const statePath = path.join(directory, entry);
|
|
275
|
+
if (generation !== void 0) {
|
|
276
|
+
if (!/^[a-zA-Z0-9_-]+$/u.test(generation)) throw new Error("Invalid runner cleanup generation");
|
|
362
277
|
try {
|
|
363
|
-
|
|
364
|
-
|
|
365
|
-
|
|
366
|
-
|
|
367
|
-
statePath,
|
|
368
|
-
finishedAt
|
|
369
|
-
});
|
|
278
|
+
if (fs$1.readFileSync(path.join(directory, "runs", ".owner"), "utf8") !== generation) return;
|
|
279
|
+
const detached = `${directory}.removing-${generation}`;
|
|
280
|
+
fs$1.renameSync(directory, detached);
|
|
281
|
+
directory = detached;
|
|
370
282
|
} catch (error) {
|
|
371
|
-
|
|
283
|
+
if (error.code === "ENOENT") return;
|
|
284
|
+
throw error;
|
|
372
285
|
}
|
|
373
286
|
}
|
|
374
|
-
|
|
287
|
+
await fs.rm(directory, {
|
|
288
|
+
recursive: true,
|
|
289
|
+
force: true
|
|
290
|
+
});
|
|
291
|
+
try {
|
|
292
|
+
await fs.rmdir(this.storeDirectory());
|
|
293
|
+
} catch (error) {
|
|
294
|
+
const code = error.code;
|
|
295
|
+
if (code !== "ENOENT" && code !== "ENOTEMPTY" && code !== "EEXIST") throw error;
|
|
296
|
+
}
|
|
297
|
+
}
|
|
298
|
+
sessionDirectory(sessionId) {
|
|
299
|
+
return path.join(this.storeDirectory(), this.sessionId(sessionId));
|
|
375
300
|
}
|
|
376
301
|
async sweepStateDirectoryAsync(directory, sessionId, ttlMs, now, result) {
|
|
377
302
|
let entries;
|
|
378
303
|
try {
|
|
379
|
-
entries = await fs.
|
|
304
|
+
entries = await fs.readdir(directory);
|
|
380
305
|
} catch (error) {
|
|
381
306
|
if (error.code !== "ENOENT") result.errors.push(`Could not read runner state directory ${directory}: ${String(error)}`);
|
|
382
307
|
return;
|
|
@@ -386,7 +311,7 @@ var RunnerPaths = class {
|
|
|
386
311
|
if (!entry.endsWith(".json")) continue;
|
|
387
312
|
const statePath = path.join(directory, entry);
|
|
388
313
|
try {
|
|
389
|
-
const finishedAt = completedAt(JSON.parse(await fs.
|
|
314
|
+
const finishedAt = completedAt(JSON.parse(await fs.readFile(statePath, FILE_ENCODING)));
|
|
390
315
|
if (finishedAt === void 0) continue;
|
|
391
316
|
completed.push({
|
|
392
317
|
id: entry.slice(0, -5),
|
|
@@ -399,7 +324,7 @@ var RunnerPaths = class {
|
|
|
399
324
|
}
|
|
400
325
|
for (const record of expiredCompletedRecords(completed, ttlMs, now, getMaxCompletedRunners(this.env))) await this.removeHistoryFilesAsync(sessionId, record.id, record.statePath, result);
|
|
401
326
|
}
|
|
402
|
-
|
|
327
|
+
async removeHistoryFilesAsync(sessionId, id, statePath, result) {
|
|
403
328
|
const candidates = [
|
|
404
329
|
statePath,
|
|
405
330
|
this.logPathFor(id, sessionId),
|
|
@@ -407,20 +332,7 @@ var RunnerPaths = class {
|
|
|
407
332
|
this.rawLogPathFor(id, sessionId)
|
|
408
333
|
];
|
|
409
334
|
for (const candidate of candidates) try {
|
|
410
|
-
fs.
|
|
411
|
-
result.removed.push(candidate);
|
|
412
|
-
} catch (error) {
|
|
413
|
-
if (error.code !== "ENOENT") result.errors.push(`Could not remove runner history ${candidate}: ${String(error)}`);
|
|
414
|
-
}
|
|
415
|
-
}
|
|
416
|
-
async removeHistoryFilesAsync(sessionId, id, statePath, result) {
|
|
417
|
-
const candidates = [
|
|
418
|
-
statePath,
|
|
419
|
-
this.logPathFor(id, sessionId),
|
|
420
|
-
this.rotatedLogPathFor(id, sessionId)
|
|
421
|
-
];
|
|
422
|
-
for (const candidate of candidates) try {
|
|
423
|
-
await fs.promises.unlink(candidate);
|
|
335
|
+
await fs.unlink(candidate);
|
|
424
336
|
result.removed.push(candidate);
|
|
425
337
|
} catch (error) {
|
|
426
338
|
if (error.code !== "ENOENT") result.errors.push(`Could not remove runner history ${candidate}: ${String(error)}`);
|
|
@@ -428,6 +340,6 @@ var RunnerPaths = class {
|
|
|
428
340
|
}
|
|
429
341
|
};
|
|
430
342
|
//#endregion
|
|
431
|
-
export { resolveRunnerStoreDirectory as n,
|
|
343
|
+
export { runnerStateDirFor as i, resolveRunnerStoreDirectory as n, runnerPaths_exports as r, RunnerPaths as t };
|
|
432
344
|
|
|
433
|
-
//# sourceMappingURL=runnerPaths-
|
|
345
|
+
//# sourceMappingURL=runnerPaths-D3P7_EhW.mjs.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"runnerPaths-D3P7_EhW.mjs","names":["files","fs"],"sources":["../src/constants/runnerPaths.ts","../src/services/runnerPaths/index.ts"],"sourcesContent":["export const STORE_DIR_NAME = 'po-runner';\nexport const LOG_DIR_NAME = 'logs';\nexport const STATE_DIR_NAME = 'runs';\nexport const LOG_EXTENSION = '.log';\nexport const STATE_EXTENSION = '.json';\nexport const ROTATED_SUFFIX = '.1';\nexport const RAW_SUFFIX = '.raw';\nexport const PI_CODING_AGENT_DIR_ENV = 'PI_CODING_AGENT_DIR';\nexport const FILE_ENCODING = 'utf8';\nexport const NOT_FOUND_ERROR_CODE = 'ENOENT';\nexport const EMPTY_SESSION_GRACE_MS = 300_000;\n","import { execFile } from 'node:child_process';\nimport fs from 'node:fs';\nimport files from 'node:fs/promises';\nimport path from 'node:path';\nimport { promisify } from 'node:util';\n\nimport {\n EMPTY_SESSION_GRACE_MS,\n FILE_ENCODING,\n LOG_DIR_NAME,\n LOG_EXTENSION,\n NOT_FOUND_ERROR_CODE,\n RAW_SUFFIX,\n ROTATED_SUFFIX,\n STATE_DIR_NAME,\n STATE_EXTENSION,\n STORE_DIR_NAME,\n} from '../../constants/runnerPaths';\nimport { PO_SESSION_TEMP_DIR_ENV } from '../../constants/session';\nimport { getMaxCompletedRunners } from '../runnerConfig';\nimport { inheritedSessionId } from '../session';\nimport type { IRunnerPaths, LogSweepResult } from './type';\n\n/** Unscrubbed pane bytes, kept beside the log so an attached terminal can replay them. */\n/**\n * How long an entirely empty session directory is left alone before it counts\n * as an orphan. A session that has started but not yet run anything owns such a\n * directory for a moment, and reclaiming it out from under that session would\n * be churn for no gain.\n */\n\nconst runCommand = promisify(execFile);\n\n// Asynchronous: the server hosts every session, and a git call blocks its event loop for tens of ms.\nasync function git(args: string[], cwd: string): Promise<string | undefined> {\n try {\n const { stdout } = await runCommand('git', args, { cwd, encoding: FILE_ENCODING });\n const trimmed = stdout.trim();\n return trimmed.length > 0 ? trimmed : undefined;\n } catch {\n return undefined;\n }\n}\n\nasync function realPath(target: string): Promise<string> {\n try {\n return await files.realpath(target);\n } catch {\n return target;\n }\n}\n\n/**\n * Newest mtime anywhere one level inside the session, falling back to the\n * directory itself. A session still being written to therefore always looks\n * recent, whatever state its individual records are in.\n */\nasync function newestEntryTimeAsync(directory: string): Promise<number> {\n let newest = (await files.stat(directory)).mtimeMs;\n for (const entry of await files.readdir(directory, { withFileTypes: true })) {\n const target = path.join(directory, entry.name);\n newest = Math.max(newest, (await files.stat(target)).mtimeMs);\n if (!entry.isDirectory()) continue;\n for (const child of await files.readdir(target)) {\n newest = Math.max(newest, (await files.stat(path.join(target, child))).mtimeMs);\n }\n }\n return newest;\n}\n\n/**\n * Whether any run in this session names a pi process that is still running.\n *\n * One live record is enough: records are only ever written by their owner, so a\n * live host pid means the session is still in use however old its files look.\n */\nasync function ownerAliveAsync(stateDirectory: string): Promise<boolean> {\n let entries: string[];\n try {\n entries = await files.readdir(stateDirectory);\n } catch {\n return false;\n }\n\n for (const entry of entries) {\n if (!entry.endsWith(STATE_EXTENSION)) continue;\n try {\n const value: unknown = JSON.parse(await files.readFile(path.join(stateDirectory, entry), FILE_ENCODING));\n const hostPid = (value as { hostPid?: unknown }).hostPid;\n if (typeof hostPid !== 'number') continue;\n process.kill(hostPid, 0);\n return true;\n } catch {\n // An unreadable record and a dead pid mean the same thing here: no claim.\n }\n }\n return false;\n}\n\nfunction completedAt(value: unknown): number | undefined {\n if (typeof value !== 'object' || value === null) return undefined;\n const record = value as { state?: unknown; exit?: { finishedAt?: unknown } };\n if (record.state !== 'completed' || typeof record.exit?.finishedAt !== 'string') return undefined;\n const timestamp = Date.parse(record.exit.finishedAt);\n return Number.isFinite(timestamp) ? timestamp : undefined;\n}\n\ninterface CompletedRecord {\n readonly id: string;\n readonly statePath: string;\n readonly finishedAt: number;\n}\n\n/**\n * Completed records a sweep may delete: everything past the TTL, and everything\n * beyond the newest `keep`.\n *\n * The count bound is what keeps a live session from growing without limit. Its\n * records only reach a multi-day TTL long after the session that is still\n * writing them would have filled its directory, so age alone bounds nothing\n * while the session lasts.\n */\nfunction expiredCompletedRecords(\n records: readonly CompletedRecord[],\n ttlMs: number,\n now: number,\n keep: number,\n): CompletedRecord[] {\n return [...records]\n .sort((left, right) => right.finishedAt - left.finishedAt)\n .filter((record, index) => index >= keep || now - record.finishedAt > ttlMs);\n}\n\n/**\n * Whether the directory holds no files at all, only empty subdirectories.\n *\n * A session that ran something leaves metadata behind, and a live session keeps\n * its lifeline socket in the state directory, so an entirely empty tree names\n * no owner and no history.\n */\nasync function isEmptySessionAsync(directory: string): Promise<boolean> {\n for (const entry of await files.readdir(directory, { withFileTypes: true })) {\n if (!entry.isDirectory()) return false;\n if ((await files.readdir(path.join(directory, entry.name))).length > 0) return false;\n }\n return true;\n}\n\n/**\n * The root this session's runner state lives under: `<PO_SESSION_TEMP_DIR>/po-runner/<session id>/{runs,logs}`. A reader in\n * another process, such as the cockpit hub, resolves the same root from its\n * own environment. There is no durable or global temporary directory fallback.\n */\nexport function resolveRunnerStoreDirectory(env: Readonly<Record<string, string | undefined>>): string {\n const temporaryDirectory = env[PO_SESSION_TEMP_DIR_ENV];\n if (!temporaryDirectory || !path.isAbsolute(temporaryDirectory)) {\n throw new Error('A host-admitted PO_SESSION_TEMP_DIR is required for po-runner storage');\n }\n return path.join(temporaryDirectory, STORE_DIR_NAME);\n}\n\n/** Temporary metadata directory for one session. Used by APIs and history reads, not live transport. */\nexport function runnerStateDirFor(storeDir: string, sessionId: string): string {\n return path.join(storeDir, sessionId, STATE_DIR_NAME);\n}\n\n/** Runner storage inside the host-admitted session temporary directory. */\nexport class RunnerPaths implements IRunnerPaths {\n private adoptedSessionId: string | undefined;\n private repository: Promise<string> | undefined;\n\n constructor(\n private readonly cwd: string = process.cwd(),\n private readonly env: Readonly<Record<string, string | undefined>> = { ...process.env },\n ) {}\n\n repositoryPath(): Promise<string> {\n this.repository ??= git(['rev-parse', '--show-toplevel'], this.cwd).then((root) => realPath(root ?? this.cwd));\n return this.repository;\n }\n\n setSessionId(sessionId: string): void {\n const trimmed = sessionId.trim();\n if (!trimmed) throw new Error('po-runner session id cannot be blank');\n if (!/^[a-zA-Z0-9_-]+$/u.test(trimmed)) throw new Error('Invalid runner session identity');\n this.adoptedSessionId = trimmed;\n }\n\n logDirectory(sessionId?: string): string {\n return path.join(this.sessionDirectory(sessionId), LOG_DIR_NAME);\n }\n\n stateDirectory(sessionId?: string): string {\n return path.join(this.sessionDirectory(sessionId), STATE_DIR_NAME);\n }\n\n logPathFor(id: string, sessionId?: string): string {\n return path.join(this.logDirectory(sessionId), `${id}${LOG_EXTENSION}`);\n }\n\n rotatedLogPathFor(id: string, sessionId?: string): string {\n return `${this.logPathFor(id, sessionId)}${ROTATED_SUFFIX}`;\n }\n\n rawLogPathFor(id: string, sessionId?: string): string {\n return `${this.logPathFor(id, sessionId)}${RAW_SUFFIX}`;\n }\n\n statePathFor(id: string, sessionId?: string): string {\n return path.join(this.stateDirectory(sessionId), `${id}${STATE_EXTENSION}`);\n }\n\n async ensureDirectories(sessionId?: string): Promise<void> {\n // Owner-only, as po-core requires of the session temp tree; a wider parent it created would make session removal refuse it.\n await files.mkdir(this.logDirectory(sessionId), { recursive: true, mode: 0o700 });\n await files.mkdir(this.stateDirectory(sessionId), { recursive: true, mode: 0o700 });\n }\n\n async sweepHistory(\n ttlMs: number,\n now: number = Date.now(),\n live: ReadonlySet<string> = this.liveSessions(),\n ): Promise<LogSweepResult> {\n const result: LogSweepResult = { removed: [], errors: [] };\n const root = this.storeDirectory();\n let sessions: string[];\n try {\n sessions = await files.readdir(root);\n } catch (error) {\n if ((error as NodeJS.ErrnoException).code === NOT_FOUND_ERROR_CODE) return result;\n result.errors.push(`Could not read runner history directory ${root}: ${String(error)}`);\n return result;\n }\n\n for (const sessionId of sessions) {\n if (live.has(sessionId)) {\n await this.sweepActiveSessionAsync(sessionId, ttlMs, now, result);\n continue;\n }\n await this.sweepSessionDirectoryAsync(path.join(root, sessionId), ttlMs, now, result);\n }\n return result;\n }\n\n sweepHistoryAsync(ttlMs: number, now?: number, live?: ReadonlySet<string>): Promise<LogSweepResult> {\n return this.sweepHistory(ttlMs, now, live);\n }\n\n /** The live session, if one is known, so a sweep never deletes underneath itself. */\n private liveSessions(): ReadonlySet<string> {\n try {\n return new Set([this.sessionId()]);\n } catch {\n // A CLI invocation outside a session still sweeps; it just has nothing to spare.\n return new Set();\n }\n }\n\n /**\n * Retention inside the session that is still running.\n *\n * The whole-directory sweep cannot be pointed at the live session: it would\n * take the lifeline socket, the supervisor sidecars and the running runners'\n * own metadata with it. Per-record retention is safe there because it only\n * ever removes a record whose state is `completed` together with the two log\n * files that record names, and never the directory itself. A running record\n * has no `exit.finishedAt`, so it is not a candidate at any age.\n */\n private async sweepActiveSessionAsync(\n sessionId: string,\n ttlMs: number,\n now: number,\n result: LogSweepResult,\n ): Promise<void> {\n await this.sweepStateDirectoryAsync(this.stateDirectory(sessionId), sessionId, ttlMs, now, result);\n }\n\n /** Removes a session's whole directory once its newest entry is past the TTL. */\n private async sweepSessionDirectoryAsync(\n directory: string,\n ttlMs: number,\n now: number,\n result: LogSweepResult,\n ): Promise<void> {\n try {\n const newest = await newestEntryTimeAsync(directory);\n if (now - newest > EMPTY_SESSION_GRACE_MS && (await isEmptySessionAsync(directory))) {\n await files.rm(directory, { recursive: true, force: true });\n result.removed.push(directory);\n return;\n }\n if (now - newest <= ttlMs) return;\n if (await ownerAliveAsync(path.join(directory, STATE_DIR_NAME))) return;\n await files.rm(directory, { recursive: true, force: true });\n result.removed.push(directory);\n } catch (error) {\n if ((error as NodeJS.ErrnoException).code !== NOT_FOUND_ERROR_CODE) {\n result.errors.push(`Could not sweep runner session ${directory}: ${String(error)}`);\n }\n }\n }\n\n private sessionId(explicit?: string): string {\n const sessionId = explicit?.trim() || this.adoptedSessionId || inheritedSessionId(this.env);\n if (!sessionId) throw new Error('PO_SESSION_ID is required for po-runner storage');\n if (!/^[a-zA-Z0-9_-]+$/u.test(sessionId)) throw new Error('Invalid runner session identity');\n return sessionId;\n }\n\n storeDirectory(): string {\n return resolveRunnerStoreDirectory(this.env);\n }\n\n /** Delete only this session's runner subtree, never its other temporary output. */\n async removeSessionFiles(sessionId?: string, generation?: string): Promise<void> {\n let directory = this.sessionDirectory(sessionId);\n try {\n // sync: cleanup validates and detaches the owned generation before a replacement can create files.\n const root = fs.lstatSync(this.storeDirectory());\n if (root.isSymbolicLink() || !root.isDirectory()) throw new Error('Unsafe runner cleanup root');\n } catch (error) {\n if ((error as NodeJS.ErrnoException).code === NOT_FOUND_ERROR_CODE) return;\n throw error;\n }\n if (generation !== undefined) {\n if (!/^[a-zA-Z0-9_-]+$/u.test(generation)) throw new Error('Invalid runner cleanup generation');\n try {\n // sync: cleanup fences ownership and detaches the old tree without yielding to a replacement.\n if (fs.readFileSync(path.join(directory, STATE_DIR_NAME, '.owner'), FILE_ENCODING) !== generation) return;\n // No await between checking ownership and detaching the old tree. A replacement\n // can now recreate its original path without racing the asynchronous removal.\n const detached = `${directory}.removing-${generation}`;\n // sync: the ownership check and cleanup rename must run in one turn.\n fs.renameSync(directory, detached);\n directory = detached;\n } catch (error) {\n if ((error as NodeJS.ErrnoException).code === NOT_FOUND_ERROR_CODE) return;\n throw error;\n }\n }\n await files.rm(directory, { recursive: true, force: true });\n try {\n await files.rmdir(this.storeDirectory());\n } catch (error) {\n const code = (error as NodeJS.ErrnoException).code;\n if (code !== NOT_FOUND_ERROR_CODE && code !== 'ENOTEMPTY' && code !== 'EEXIST') throw error;\n }\n }\n\n private sessionDirectory(sessionId?: string): string {\n return path.join(this.storeDirectory(), this.sessionId(sessionId));\n }\n\n private async sweepStateDirectoryAsync(\n directory: string,\n sessionId: string,\n ttlMs: number,\n now: number,\n result: LogSweepResult,\n ): Promise<void> {\n let entries: string[];\n try {\n entries = await files.readdir(directory);\n } catch (error) {\n if ((error as NodeJS.ErrnoException).code !== NOT_FOUND_ERROR_CODE) {\n result.errors.push(`Could not read runner state directory ${directory}: ${String(error)}`);\n }\n return;\n }\n\n const completed: CompletedRecord[] = [];\n for (const entry of entries) {\n if (!entry.endsWith(STATE_EXTENSION)) continue;\n const statePath = path.join(directory, entry);\n try {\n const value: unknown = JSON.parse(await files.readFile(statePath, FILE_ENCODING));\n const finishedAt = completedAt(value);\n if (finishedAt === undefined) continue;\n completed.push({ id: entry.slice(0, -STATE_EXTENSION.length), statePath, finishedAt });\n } catch (error) {\n result.errors.push(`Could not sweep runner metadata ${statePath}: ${String(error)}`);\n }\n }\n\n for (const record of expiredCompletedRecords(completed, ttlMs, now, getMaxCompletedRunners(this.env))) {\n await this.removeHistoryFilesAsync(sessionId, record.id, record.statePath, result);\n }\n }\n\n private async removeHistoryFilesAsync(\n sessionId: string,\n id: string,\n statePath: string,\n result: LogSweepResult,\n ): Promise<void> {\n const candidates = [\n statePath,\n this.logPathFor(id, sessionId),\n this.rotatedLogPathFor(id, sessionId),\n this.rawLogPathFor(id, sessionId),\n ];\n for (const candidate of candidates) {\n try {\n await files.unlink(candidate);\n result.removed.push(candidate);\n } catch (error) {\n if ((error as NodeJS.ErrnoException).code !== NOT_FOUND_ERROR_CODE) {\n result.errors.push(`Could not remove runner history ${candidate}: ${String(error)}`);\n }\n }\n }\n }\n}\n"],"mappings":";;;;;;;;;;AAAA,MAAa,iBAAiB;AAC9B,MAAa,eAAe;AAC5B,MAAa,iBAAiB;AAC9B,MAAa,gBAAgB;AAC7B,MAAa,kBAAkB;AAE/B,MAAa,aAAa;AAE1B,MAAa,gBAAgB;;;;;;;;;;;;;;;ACuB7B,MAAM,aAAa,UAAU,QAAQ;AAGrC,eAAe,IAAI,MAAgB,KAA0C;CAC3E,IAAI;EACF,MAAM,EAAE,WAAW,MAAM,WAAW,OAAO,MAAM;GAAE;GAAK,UAAU;EAAc,CAAC;EACjF,MAAM,UAAU,OAAO,KAAK;EAC5B,OAAO,QAAQ,SAAS,IAAI,UAAU,KAAA;CACxC,QAAQ;EACN;CACF;AACF;AAEA,eAAe,SAAS,QAAiC;CACvD,IAAI;EACF,OAAO,MAAMA,GAAM,SAAS,MAAM;CACpC,QAAQ;EACN,OAAO;CACT;AACF;;;;;;AAOA,eAAe,qBAAqB,WAAoC;CACtE,IAAI,UAAU,MAAMA,GAAM,KAAK,SAAS,EAAA,CAAG;CAC3C,KAAK,MAAM,SAAS,MAAMA,GAAM,QAAQ,WAAW,EAAE,eAAe,KAAK,CAAC,GAAG;EAC3E,MAAM,SAAS,KAAK,KAAK,WAAW,MAAM,IAAI;EAC9C,SAAS,KAAK,IAAI,SAAS,MAAMA,GAAM,KAAK,MAAM,EAAA,CAAG,OAAO;EAC5D,IAAI,CAAC,MAAM,YAAY,GAAG;EAC1B,KAAK,MAAM,SAAS,MAAMA,GAAM,QAAQ,MAAM,GAC5C,SAAS,KAAK,IAAI,SAAS,MAAMA,GAAM,KAAK,KAAK,KAAK,QAAQ,KAAK,CAAC,EAAA,CAAG,OAAO;CAElF;CACA,OAAO;AACT;;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AW,OAAO,KAAK,uBAAuB,KAAK,GAAG,CAAC,GAClG,MAAM,KAAK,wBAAwB,WAAW,OAAO,IAAI,OAAO,WAAW,MAAM;CAErF;CAEA,MAAc,wBACZ,WACA,IACA,WACA,QACe;EACf,MAAM,aAAa;GACjB;GACA,KAAK,WAAW,IAAI,SAAS;GAC7B,KAAK,kBAAkB,IAAI,SAAS;GACpC,KAAK,cAAc,IAAI,SAAS;EAClC;EACA,KAAK,MAAM,aAAa,YACtB,IAAI;GACF,MAAMA,GAAM,OAAO,SAAS;GAC5B,OAAO,QAAQ,KAAK,SAAS;EAC/B,SAAS,OAAO;GACd,IAAK,MAAgC,SAAA,UACnC,OAAO,OAAO,KAAK,mCAAmC,UAAU,IAAI,OAAO,KAAK,GAAG;EAEvF;CAEJ;AACF"}
|
package/dist/runnerPaths.cjs
CHANGED
package/dist/runnerPaths.d.mts
CHANGED
|
@@ -1,13 +1,13 @@
|
|
|
1
|
-
import { n as LogSweepResult, t as IRunnerPaths } from "./type-
|
|
1
|
+
import { n as LogSweepResult, t as IRunnerPaths } from "./type-BWY9vvSq.mjs";
|
|
2
2
|
//#region src/services/runnerPaths/index.d.ts
|
|
3
|
-
/**
|
|
3
|
+
/** Runner storage inside the host-admitted session temporary directory. */
|
|
4
4
|
export declare class RunnerPaths implements IRunnerPaths {
|
|
5
5
|
private readonly cwd;
|
|
6
6
|
private readonly env;
|
|
7
7
|
private adoptedSessionId;
|
|
8
8
|
private repository;
|
|
9
9
|
constructor(cwd?: string, env?: Readonly<Record<string, string | undefined>>);
|
|
10
|
-
repositoryPath(): string
|
|
10
|
+
repositoryPath(): Promise<string>;
|
|
11
11
|
setSessionId(sessionId: string): void;
|
|
12
12
|
logDirectory(sessionId?: string): string;
|
|
13
13
|
stateDirectory(sessionId?: string): string;
|
|
@@ -15,8 +15,8 @@ export declare class RunnerPaths implements IRunnerPaths {
|
|
|
15
15
|
rotatedLogPathFor(id: string, sessionId?: string): string;
|
|
16
16
|
rawLogPathFor(id: string, sessionId?: string): string;
|
|
17
17
|
statePathFor(id: string, sessionId?: string): string;
|
|
18
|
-
ensureDirectories(sessionId?: string): void
|
|
19
|
-
sweepHistory(ttlMs: number, now?: number, live?: ReadonlySet<string>): LogSweepResult
|
|
18
|
+
ensureDirectories(sessionId?: string): Promise<void>;
|
|
19
|
+
sweepHistory(ttlMs: number, now?: number, live?: ReadonlySet<string>): Promise<LogSweepResult>;
|
|
20
20
|
sweepHistoryAsync(ttlMs: number, now?: number, live?: ReadonlySet<string>): Promise<LogSweepResult>;
|
|
21
21
|
/** The live session, if one is known, so a sweep never deletes underneath itself. */
|
|
22
22
|
private liveSessions;
|
|
@@ -30,17 +30,15 @@ export declare class RunnerPaths implements IRunnerPaths {
|
|
|
30
30
|
* files that record names, and never the directory itself. A running record
|
|
31
31
|
* has no `exit.finishedAt`, so it is not a candidate at any age.
|
|
32
32
|
*/
|
|
33
|
-
private sweepActiveSession;
|
|
34
33
|
private sweepActiveSessionAsync;
|
|
35
34
|
/** Removes a session's whole directory once its newest entry is past the TTL. */
|
|
36
|
-
private sweepSessionDirectory;
|
|
37
35
|
private sweepSessionDirectoryAsync;
|
|
38
36
|
private sessionId;
|
|
39
37
|
storeDirectory(): string;
|
|
38
|
+
/** Delete only this session's runner subtree, never its other temporary output. */
|
|
39
|
+
removeSessionFiles(sessionId?: string, generation?: string): Promise<void>;
|
|
40
40
|
private sessionDirectory;
|
|
41
|
-
private sweepStateDirectory;
|
|
42
41
|
private sweepStateDirectoryAsync;
|
|
43
|
-
private removeHistoryFiles;
|
|
44
42
|
private removeHistoryFilesAsync;
|
|
45
43
|
}
|
|
46
44
|
//#endregion
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"runnerPaths.d.mts","names":[],"sources":["../src/services/runnerPaths/index.ts"],"mappings":";;;
|
|
1
|
+
{"version":3,"file":"runnerPaths.d.mts","names":[],"sources":["../src/services/runnerPaths/index.ts"],"mappings":";;;qBAuKa,uBAAuB;mBAKf;mBACA;UALX;UACA;EAER,YACmB,cACA,MAAK,SAAS;EAGjC,kBAAkB;EAKlB,aAAa;EAOb,aAAa;EAIb,eAAe;EAIf,WAAW,YAAY;EAIvB,kBAAkB,YAAY;EAI9B,cAAc,YAAY;EAI1B,aAAa,YAAY;EAInB,kBAAkB,qBAAqB;EAMvC,aACJ,eACA,cACA,OAAM,sBACL,QAAQ;EAsBX,kBAAkB,eAAe,cAAc,OAAO,sBAAsB,QAAQ;;UAK5E;;;;;;;;;;;UAmBM;;UAUA;UAwBN;EAOR;;EAKM,mBAAmB,oBAAoB,sBAAsB;UAmC3D;UAIM;UAoCA"}
|
package/dist/runnerPaths.mjs
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
export { t as RunnerPaths } from "./runnerPaths-
|
|
1
|
+
export { t as RunnerPaths } from "./runnerPaths-D3P7_EhW.mjs";
|