@agimon-ai/po-runner 0.0.0-alpha.2 → 0.0.0-alpha.21
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 +149 -21
- package/README.md +17 -17
- package/dist/ansiScrub.mjs +1 -2
- package/dist/apiContracts.cjs +1 -1
- package/dist/apiContracts.cjs.map +1 -1
- package/dist/apiContracts.mjs +1 -1
- package/dist/apiContracts.mjs.map +1 -1
- package/dist/{bashResult-bIVSzoj-.mjs → bashResult-BqDa7sbC.mjs} +10 -9
- package/dist/bashResult-BqDa7sbC.mjs.map +1 -0
- package/dist/{bashResult-DNgtahGR.cjs → bashResult-C2iKhHpD.cjs} +10 -9
- package/dist/bashResult-C2iKhHpD.cjs.map +1 -0
- package/dist/{bashRunService-CJ02XaAq.mjs → bashRunService-Cl3pYccr.mjs} +2 -2
- package/dist/bashRunService-Cl3pYccr.mjs.map +1 -0
- package/dist/{bashRunService-DyqxOSlx.cjs → bashRunService-DjOH5kye.cjs} +2 -2
- package/dist/bashRunService-DjOH5kye.cjs.map +1 -0
- package/dist/bashRunService.cjs +1 -1
- package/dist/bashRunService.d.mts +3 -3
- package/dist/bashRunService.mjs +1 -2
- package/dist/bashSchema.cjs +1 -1
- package/dist/bashSchema.mjs +1 -2
- package/dist/{bashTool-C-k7fmyh.mjs → bashTool-BvC3YOgG.mjs} +2 -2
- package/dist/{bashTool-C-k7fmyh.mjs.map → bashTool-BvC3YOgG.mjs.map} +1 -1
- package/dist/{bashTool-CdgtqVFD.cjs → bashTool-euL6zMDl.cjs} +2 -2
- package/dist/{bashTool-CdgtqVFD.cjs.map → bashTool-euL6zMDl.cjs.map} +1 -1
- package/dist/bashTool.cjs +3 -3
- package/dist/bashTool.d.mts +1 -1
- package/dist/bashTool.mjs +3 -3
- package/dist/bin/cli.cjs +6 -6
- package/dist/bin/cli.cjs.map +1 -1
- package/dist/bin/cli.mjs +7 -7
- package/dist/bin/cli.mjs.map +1 -1
- package/dist/bin/logSink.cjs +6 -6
- package/dist/bin/logSink.cjs.map +1 -1
- package/dist/bin/logSink.mjs +7 -7
- package/dist/bin/logSink.mjs.map +1 -1
- package/dist/bin/runnerHost.cjs +4 -4
- package/dist/bin/runnerHost.cjs.map +1 -1
- package/dist/bin/runnerHost.mjs +5 -5
- package/dist/bin/runnerHost.mjs.map +1 -1
- package/dist/{cliApp-Dj9nwaOv.cjs → cliApp-T8Fx_-1j.cjs} +6 -6
- package/dist/cliApp-T8Fx_-1j.cjs.map +1 -0
- package/dist/{cliApp-v8Z3rMCi.mjs → cliApp-q97eVh4E.mjs} +6 -6
- package/dist/cliApp-q97eVh4E.mjs.map +1 -0
- package/dist/cliApp.cjs +1 -1
- package/dist/cliApp.d.mts +1 -1
- package/dist/cliApp.mjs +1 -2
- package/dist/clock.mjs +1 -2
- package/dist/{compaction-4QSUsBxq.cjs → compaction-Cduebib_.cjs} +3 -3
- package/dist/compaction-Cduebib_.cjs.map +1 -0
- package/dist/{compaction-DCw80VZj.mjs → compaction-nNlE6e5I.mjs} +3 -3
- package/dist/compaction-nNlE6e5I.mjs.map +1 -0
- package/dist/compaction.cjs +1 -1
- package/dist/compaction.d.mts +1 -1
- package/dist/compaction.mjs +1 -2
- package/dist/config.cjs +1 -1
- package/dist/config.d.mts +1 -1
- package/dist/config.mjs +1 -2
- package/dist/extensions/mcp-ui.mjs.map +1 -1
- package/dist/extensions/mcp.cjs +8 -7
- package/dist/extensions/mcp.cjs.map +1 -1
- package/dist/extensions/mcp.d.mts +1 -1
- package/dist/extensions/mcp.mjs +7 -6
- package/dist/extensions/mcp.mjs.map +1 -1
- package/dist/extensions/native.mjs +1 -1
- package/dist/extensions/native.mjs.map +1 -1
- package/dist/extensions/server.cjs +233 -119
- package/dist/extensions/server.cjs.map +1 -1
- package/dist/extensions/server.d.mts +2 -2
- package/dist/extensions/server.d.mts.map +1 -1
- package/dist/extensions/server.mjs +233 -119
- package/dist/extensions/server.mjs.map +1 -1
- package/dist/extensions/web.mjs +88 -62
- package/dist/extensions/web.mjs.map +1 -1
- package/dist/{headless-BGYfIlNk.mjs → headless-DOlCixyf.mjs} +5 -5
- package/dist/headless-DOlCixyf.mjs.map +1 -0
- package/dist/{headless-CHUsBGhg.cjs → headless-Dko_yBiy.cjs} +5 -5
- package/dist/headless-Dko_yBiy.cjs.map +1 -0
- package/dist/{index-Dhi8asLH.d.mts → index--xF7DvsE.d.mts} +4 -4
- package/dist/{index-Dhi8asLH.d.mts.map → index--xF7DvsE.d.mts.map} +1 -1
- package/dist/{index-BZL7keVW.d.mts → index-BCCF1sGD.d.mts} +2 -2
- package/dist/{index-BZL7keVW.d.mts.map → index-BCCF1sGD.d.mts.map} +1 -1
- package/dist/{index-BwB_jTI9.d.mts → index-BzeXJk6V.d.mts} +5 -5
- package/dist/index-BzeXJk6V.d.mts.map +1 -0
- package/dist/{index-D9-IXax4.d.mts → index-C-IC35d9.d.mts} +2 -2
- package/dist/{index-D9-IXax4.d.mts.map → index-C-IC35d9.d.mts.map} +1 -1
- package/dist/{index-DBz0DxnL.d.mts → index-CzCF_OP9.d.mts} +3 -4
- package/dist/index-CzCF_OP9.d.mts.map +1 -0
- package/dist/index.cjs +5 -5
- package/dist/index.d.mts +5 -5
- package/dist/index.mjs +5 -5
- package/dist/{launcher-BDm6-DiQ.mjs → launcher-CCYsFBM9.mjs} +3 -3
- package/dist/{launcher-BDm6-DiQ.mjs.map → launcher-CCYsFBM9.mjs.map} +1 -1
- package/dist/{launcher-SlyE8R3b.cjs → launcher-ZgDdyXpq.cjs} +8 -2
- package/dist/{launcher-SlyE8R3b.cjs.map → launcher-ZgDdyXpq.cjs.map} +1 -1
- package/dist/launcher.cjs +1 -1
- package/dist/launcher.d.mts +1 -1
- package/dist/launcher.mjs +1 -2
- package/dist/{lifeline-BZaQA0rm.mjs → lifeline-Bm-bHIjS.mjs} +6 -6
- package/dist/lifeline-Bm-bHIjS.mjs.map +1 -0
- package/dist/{lifeline-BuV_erib.cjs → lifeline-m7laIzIP.cjs} +6 -6
- package/dist/lifeline-m7laIzIP.cjs.map +1 -0
- package/dist/lifeline.cjs +1 -1
- package/dist/lifeline.d.mts +1 -1
- package/dist/lifeline.mjs +1 -1
- package/dist/{logFile-CNvepZh0.cjs → logFile-CnPKtxPy.cjs} +2 -2
- package/dist/{logFile-CNvepZh0.cjs.map → logFile-CnPKtxPy.cjs.map} +1 -1
- package/dist/{logFile-KKPbkC-a.mjs → logFile-XcDHBwu1.mjs} +2 -2
- package/dist/{logFile-KKPbkC-a.mjs.map → logFile-XcDHBwu1.mjs.map} +1 -1
- package/dist/logFile.cjs +1 -1
- package/dist/logFile.d.mts +1 -1
- package/dist/logFile.mjs +1 -2
- package/dist/{logReader-B6J7L7Ua.cjs → logReader-DHCK2BEr.cjs} +4 -4
- package/dist/{logReader-B6J7L7Ua.cjs.map → logReader-DHCK2BEr.cjs.map} +1 -1
- package/dist/{logReader-UfbDbwQl.mjs → logReader-mq9uVurh.mjs} +4 -4
- package/dist/{logReader-UfbDbwQl.mjs.map → logReader-mq9uVurh.mjs.map} +1 -1
- package/dist/logReader.cjs +1 -1
- package/dist/logReader.mjs +1 -2
- package/dist/processControl.mjs +1 -2
- package/dist/{ptyHost-DlQtTB8F.mjs → ptyHost-CwbLLr90.mjs} +2 -2
- package/dist/{ptyHost-DlQtTB8F.mjs.map → ptyHost-CwbLLr90.mjs.map} +1 -1
- package/dist/{ptyHost-MI2Z6WTG.cjs → ptyHost-D35hNmtd.cjs} +2 -2
- package/dist/{ptyHost-MI2Z6WTG.cjs.map → ptyHost-D35hNmtd.cjs.map} +1 -1
- package/dist/ptyHost.cjs +1 -1
- package/dist/ptyHost.mjs +1 -2
- package/dist/{ptySpawner-DEi1KOnd.mjs → ptySpawner-C375NJnj.mjs} +2 -2
- package/dist/ptySpawner-C375NJnj.mjs.map +1 -0
- package/dist/{ptySpawner-ijw0g5_T.cjs → ptySpawner-C39IzbRo.cjs} +2 -2
- package/dist/ptySpawner-C39IzbRo.cjs.map +1 -0
- package/dist/ptySpawner.cjs +1 -1
- package/dist/ptySpawner.d.mts +1 -1
- package/dist/ptySpawner.mjs +1 -2
- package/dist/{reconcile-DMeNSxwn.mjs → reconcile-5cZ11jSD.cjs} +12 -42
- package/dist/reconcile-5cZ11jSD.cjs.map +1 -0
- package/dist/{reconcile-BugwYFbV.cjs → reconcile-wNYQJZF-.mjs} +2 -62
- package/dist/reconcile-wNYQJZF-.mjs.map +1 -0
- package/dist/reconcile.cjs +1 -2
- package/dist/reconcile.d.mts +2 -9
- package/dist/reconcile.d.mts.map +1 -1
- package/dist/reconcile.mjs +1 -2
- package/dist/responseEnvelope.cjs +2 -2
- package/dist/responseEnvelope.d.mts +3 -3
- package/dist/responseEnvelope.mjs +2 -2
- package/dist/{rmuxBackend-DlxgqRZ1.cjs → rmuxBackend-Dh0CYVAL.cjs} +5 -5
- package/dist/rmuxBackend-Dh0CYVAL.cjs.map +1 -0
- package/dist/{rmuxBackend-DfyQwJrc.mjs → rmuxBackend-rjrVTG6K.mjs} +4 -4
- package/dist/rmuxBackend-rjrVTG6K.mjs.map +1 -0
- package/dist/rmuxBackend.cjs +1 -1
- package/dist/rmuxBackend.d.mts +1 -1
- package/dist/rmuxBackend.mjs +1 -2
- package/dist/{rtkProcessor-Bc4L4o_8.cjs → rtkProcessor-DSGbM-Cm.cjs} +4 -4
- package/dist/rtkProcessor-DSGbM-Cm.cjs.map +1 -0
- package/dist/{rtkProcessor-B9KPdyzr.mjs → rtkProcessor-Iw9gP5Xp.mjs} +3 -3
- package/dist/rtkProcessor-Iw9gP5Xp.mjs.map +1 -0
- package/dist/rtkProcessor.cjs +1 -1
- package/dist/rtkProcessor.d.mts +1 -1
- package/dist/rtkProcessor.mjs +1 -1
- package/dist/{runnerConfig-D2tGq5ZM.cjs → runnerConfig-BoLMinlx.cjs} +11 -11
- package/dist/runnerConfig-BoLMinlx.cjs.map +1 -0
- package/dist/{runnerConfig-BjtulXBI.d.mts → runnerConfig-DuWL6TJx.d.mts} +10 -10
- package/dist/{runnerConfig-BjtulXBI.d.mts.map → runnerConfig-DuWL6TJx.d.mts.map} +1 -1
- package/dist/{runnerConfig-BQBlVAXn.mjs → runnerConfig-XXMq4VQA.mjs} +11 -11
- package/dist/runnerConfig-XXMq4VQA.mjs.map +1 -0
- package/dist/{runnerDependencies-DruByBGS.mjs → runnerDependencies-7h_cxOva.mjs} +17 -17
- package/dist/runnerDependencies-7h_cxOva.mjs.map +1 -0
- package/dist/{runnerDependencies-KMZigIxB.cjs → runnerDependencies-DSun3xO-.cjs} +17 -17
- package/dist/runnerDependencies-DSun3xO-.cjs.map +1 -0
- package/dist/runnerDependencies.cjs +1 -1
- package/dist/runnerDependencies.d.mts +1 -1
- package/dist/runnerDependencies.mjs +1 -2
- package/dist/runnerNamer.d.mts +1 -1
- package/dist/runnerNamer.mjs +1 -2
- package/dist/{runnerPaths-BTEuzxw0.cjs → runnerPaths-B41rMOY6.cjs} +20 -38
- package/dist/runnerPaths-B41rMOY6.cjs.map +1 -0
- package/dist/{runnerPaths-B_dAAeco.mjs → runnerPaths-Dibbvyx_.mjs} +20 -38
- package/dist/runnerPaths-Dibbvyx_.mjs.map +1 -0
- package/dist/runnerPaths.cjs +1 -1
- package/dist/runnerPaths.d.mts +5 -7
- package/dist/runnerPaths.d.mts.map +1 -1
- package/dist/runnerPaths.mjs +1 -2
- package/dist/{runnerRegistry-CeOHEjBv.mjs → runnerRegistry-BgaR5O86.mjs} +12 -11
- package/dist/runnerRegistry-BgaR5O86.mjs.map +1 -0
- package/dist/{runnerRegistry-CtJiD02R.d.mts → runnerRegistry-V-Ocaf4N.d.mts} +1 -3
- package/dist/{runnerRegistry-CtJiD02R.d.mts.map → runnerRegistry-V-Ocaf4N.d.mts.map} +1 -1
- package/dist/{runnerRegistry-BmkZTJHi.cjs → runnerRegistry-dQYlMSpQ.cjs} +23 -10
- package/dist/runnerRegistry-dQYlMSpQ.cjs.map +1 -0
- package/dist/runnerRegistry.cjs +1 -1
- package/dist/runnerRegistry.d.mts +2 -2
- package/dist/runnerRegistry.mjs +1 -2
- package/dist/services/lifeline/client.cjs +2 -2
- package/dist/services/lifeline/client.cjs.map +1 -1
- package/dist/services/lifeline/client.d.mts +1 -1
- package/dist/services/lifeline/client.mjs +2 -2
- package/dist/services/lifeline/client.mjs.map +1 -1
- package/dist/{session-Chsb_Nh2.mjs → session-BKYnH4R6.mjs} +2 -2
- package/dist/{session-Chsb_Nh2.mjs.map → session-BKYnH4R6.mjs.map} +1 -1
- package/dist/{session-BC43uEyG.cjs → session-BvqzhXZY.cjs} +2 -2
- package/dist/{session-BC43uEyG.cjs.map → session-BvqzhXZY.cjs.map} +1 -1
- package/dist/session.cjs +1 -1
- package/dist/session.mjs +1 -1
- package/dist/spawner.mjs +1 -2
- package/dist/{type-C31e1gla.d.mts → type-Do0YxwVQ.d.mts} +4 -4
- package/dist/{type-C31e1gla.d.mts.map → type-Do0YxwVQ.d.mts.map} +1 -1
- package/dist/{type-BXM03qSw.d.mts → type-DwMZoINK.d.mts} +8 -8
- package/dist/{type-BXM03qSw.d.mts.map → type-DwMZoINK.d.mts.map} +1 -1
- package/dist/types.d.mts +1 -1
- package/package.json +31 -34
- package/skills/{doom-runner → po-runner}/SKILL.md +15 -15
- package/src/prompts/po-use-runner/SKILL.md +11 -11
- package/dist/bashResult-DNgtahGR.cjs.map +0 -1
- package/dist/bashResult-bIVSzoj-.mjs.map +0 -1
- package/dist/bashRunService-CJ02XaAq.mjs.map +0 -1
- package/dist/bashRunService-DyqxOSlx.cjs.map +0 -1
- package/dist/cliApp-Dj9nwaOv.cjs.map +0 -1
- package/dist/cliApp-v8Z3rMCi.mjs.map +0 -1
- package/dist/compaction-4QSUsBxq.cjs.map +0 -1
- package/dist/compaction-DCw80VZj.mjs.map +0 -1
- package/dist/headless-BGYfIlNk.mjs.map +0 -1
- package/dist/headless-CHUsBGhg.cjs.map +0 -1
- package/dist/index-BwB_jTI9.d.mts.map +0 -1
- package/dist/index-DBz0DxnL.d.mts.map +0 -1
- package/dist/lifeline-BZaQA0rm.mjs.map +0 -1
- package/dist/lifeline-BuV_erib.cjs.map +0 -1
- package/dist/ptySpawner-DEi1KOnd.mjs.map +0 -1
- package/dist/ptySpawner-ijw0g5_T.cjs.map +0 -1
- package/dist/reconcile-BugwYFbV.cjs.map +0 -1
- package/dist/reconcile-DMeNSxwn.mjs.map +0 -1
- package/dist/rmuxBackend-DfyQwJrc.mjs.map +0 -1
- package/dist/rmuxBackend-DlxgqRZ1.cjs.map +0 -1
- package/dist/rtkProcessor-B9KPdyzr.mjs.map +0 -1
- package/dist/rtkProcessor-Bc4L4o_8.cjs.map +0 -1
- package/dist/runnerConfig-BQBlVAXn.mjs.map +0 -1
- package/dist/runnerConfig-D2tGq5ZM.cjs.map +0 -1
- package/dist/runnerDependencies-DruByBGS.mjs.map +0 -1
- package/dist/runnerDependencies-KMZigIxB.cjs.map +0 -1
- package/dist/runnerPaths-BTEuzxw0.cjs.map +0 -1
- package/dist/runnerPaths-B_dAAeco.mjs.map +0 -1
- package/dist/runnerRegistry-BmkZTJHi.cjs.map +0 -1
- package/dist/runnerRegistry-CeOHEjBv.mjs.map +0 -1
|
@@ -9,8 +9,8 @@ let _agimon_ai_foundation_process_registry = require("@agimon-ai/foundation-proc
|
|
|
9
9
|
let _agimon_ai_po_core_childProcess = require("@agimon-ai/po-core/childProcess");
|
|
10
10
|
//#region src/constants/runnerRegistry.ts
|
|
11
11
|
const SERVICE_TYPE = "tool";
|
|
12
|
-
const SERVICE_PREFIX = "
|
|
13
|
-
const RUNNER_TAG = "
|
|
12
|
+
const SERVICE_PREFIX = "po-runner:";
|
|
13
|
+
const RUNNER_TAG = "po-runner";
|
|
14
14
|
const REGISTRY_PATH_ENV = "PROCESS_REGISTRY_PATH";
|
|
15
15
|
//#endregion
|
|
16
16
|
//#region src/services/runnerRecord/index.ts
|
|
@@ -28,9 +28,16 @@ function formatRunnerFinished(record) {
|
|
|
28
28
|
`Background runner ${record.name} exited: ${outcome}${code}.`,
|
|
29
29
|
`Runner ID: ${record.id}`,
|
|
30
30
|
`Log: ${record.logPath}`,
|
|
31
|
-
`Inspect:
|
|
31
|
+
`Inspect: po-runner logs ${record.id}`
|
|
32
32
|
].join("\n");
|
|
33
33
|
}
|
|
34
|
+
/** The one line the person sees in the transcript for the same exit. */
|
|
35
|
+
function formatRunnerFinishedNotice(record) {
|
|
36
|
+
const reason = record.exit?.reason ?? record.state;
|
|
37
|
+
const code = record.exit?.code === null || record.exit?.code === void 0 ? "" : `exit ${record.exit.code}`;
|
|
38
|
+
const outcome = reason === "completed" ? code : [reason, code].filter(Boolean).join(", ");
|
|
39
|
+
return `Background runner ${record.name} finished${outcome ? ` · ${outcome}` : ""}`;
|
|
40
|
+
}
|
|
34
41
|
/** Compact footer text. An absent value removes the group entirely. */
|
|
35
42
|
function formatRunnerStatus(count) {
|
|
36
43
|
return count > 0 ? `Runners ${count} ●` : void 0;
|
|
@@ -153,12 +160,6 @@ var RunnerRegistry = class {
|
|
|
153
160
|
tags: (0, _agimon_ai_foundation_process_registry.resolveProcessTags)([RUNNER_TAG])
|
|
154
161
|
})).map(toRunnerRecord);
|
|
155
162
|
}
|
|
156
|
-
async listAcrossRepositories() {
|
|
157
|
-
return (await this.registry.listProcesses({
|
|
158
|
-
serviceType: SERVICE_TYPE,
|
|
159
|
-
tags: (0, _agimon_ai_foundation_process_registry.resolveProcessTags)([RUNNER_TAG])
|
|
160
|
-
})).map(toRunnerRecord);
|
|
161
|
-
}
|
|
162
163
|
async listBySession(sessionId) {
|
|
163
164
|
return (await this.list()).filter((record) => record.sessionId === sessionId);
|
|
164
165
|
}
|
|
@@ -337,6 +338,12 @@ function isPrimaryMetadataEntry(entry) {
|
|
|
337
338
|
return entry.endsWith(".json") && !entry.endsWith(".command.json") && !entry.endsWith(".exit.json");
|
|
338
339
|
}
|
|
339
340
|
//#endregion
|
|
341
|
+
Object.defineProperty(exports, "REGISTRY_PATH_ENV", {
|
|
342
|
+
enumerable: true,
|
|
343
|
+
get: function() {
|
|
344
|
+
return REGISTRY_PATH_ENV;
|
|
345
|
+
}
|
|
346
|
+
});
|
|
340
347
|
Object.defineProperty(exports, "RunnerRegistry", {
|
|
341
348
|
enumerable: true,
|
|
342
349
|
get: function() {
|
|
@@ -355,6 +362,12 @@ Object.defineProperty(exports, "formatRunnerFinished", {
|
|
|
355
362
|
return formatRunnerFinished;
|
|
356
363
|
}
|
|
357
364
|
});
|
|
365
|
+
Object.defineProperty(exports, "formatRunnerFinishedNotice", {
|
|
366
|
+
enumerable: true,
|
|
367
|
+
get: function() {
|
|
368
|
+
return formatRunnerFinishedNotice;
|
|
369
|
+
}
|
|
370
|
+
});
|
|
358
371
|
Object.defineProperty(exports, "formatRunnerStatus", {
|
|
359
372
|
enumerable: true,
|
|
360
373
|
get: function() {
|
|
@@ -368,4 +381,4 @@ Object.defineProperty(exports, "isRunnerRecord", {
|
|
|
368
381
|
}
|
|
369
382
|
});
|
|
370
383
|
|
|
371
|
-
//# sourceMappingURL=runnerRegistry-
|
|
384
|
+
//# sourceMappingURL=runnerRegistry-dQYlMSpQ.cjs.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"runnerRegistry-dQYlMSpQ.cjs","names":["createProcessRegistryService","promisify","execFile","resolveRootSessionId","resolveProcessTags","fs","path","normalizeRepositoryPath"],"sources":["../src/constants/runnerRegistry.ts","../src/services/runnerRecord/index.ts","../src/services/runnerRegistry/index.ts"],"sourcesContent":["export const SERVICE_TYPE = 'tool';\nexport const SERVICE_PREFIX = 'po-runner:';\nexport const RUNNER_TAG = 'po-runner';\nexport const REGISTRY_PATH_ENV = 'PROCESS_REGISTRY_PATH';\nexport const JSON_EXTENSION = '.json';\nexport const COMMAND_SIDECAR_SUFFIX = '.command.json';\nexport const EXIT_SIDECAR_SUFFIX = '.exit.json';\nexport const NOT_FOUND_ERROR_CODE = 'ENOENT';\n","import type { RunnerRecord } from '../../types/runnerRegistry';\n\n/** The disk record's shape guard, shared by the registry and every reader of its files. */\nexport function isRunnerRecord(value: unknown): value is RunnerRecord {\n if (typeof value !== 'object' || value === null) return false;\n const record = value as Partial<RunnerRecord>;\n return (\n typeof record.id === 'string' &&\n typeof record.name === 'string' &&\n typeof record.pid === 'number' &&\n typeof record.command === 'string' &&\n typeof record.cwd === 'string' &&\n typeof record.logPath === 'string' &&\n typeof record.sessionId === 'string' &&\n typeof record.startedAt === 'string' &&\n (record.state === 'running' || record.state === 'completed') &&\n typeof record.promoted === 'boolean' &&\n (record.backend === 'rmux' || record.backend === 'tmux' || record.backend === 'native')\n );\n}\n\n/** What the agent reads when a runner it sent to the background exits. Shared by the Pi and server hosts. */\nexport function formatRunnerFinished(record: RunnerRecord): string {\n const outcome = record.exit?.reason ?? record.state;\n const code = record.exit?.code === null || record.exit?.code === undefined ? '' : `, exit code ${record.exit.code}`;\n return [\n `Background runner ${record.name} exited: ${outcome}${code}.`,\n `Runner ID: ${record.id}`,\n `Log: ${record.logPath}`,\n `Inspect: po-runner logs ${record.id}`,\n ].join('\\n');\n}\n\n/** The one line the person sees in the transcript for the same exit. */\nexport function formatRunnerFinishedNotice(record: RunnerRecord): string {\n const reason = record.exit?.reason ?? record.state;\n const code = record.exit?.code === null || record.exit?.code === undefined ? '' : `exit ${record.exit.code}`;\n const outcome = reason === 'completed' ? code : [reason, code].filter(Boolean).join(', ');\n return `Background runner ${record.name} finished${outcome ? ` · ${outcome}` : ''}`;\n}\n/** Compact footer text. An absent value removes the group entirely. */\nexport function formatRunnerStatus(count: number): string | undefined {\n return count > 0 ? `Runners ${count} ●` : undefined;\n}\n\nexport function formatRunnerFooterContribution(count: number): { fullText: string; compactText: string } | undefined {\n return count > 0 ? { fullText: `Runner ${count}`, compactText: `R${count}` } : undefined;\n}\n","import { execFile } from 'node:child_process';\nimport fs from 'node:fs';\nimport path from 'node:path';\nimport { promisify } from 'node:util';\n\nimport {\n createProcessRegistryService,\n normalizeRepositoryPath,\n type ProcessRegistryRecord,\n type ProcessRegistryService,\n resolveProcessTags,\n} from '@agimon-ai/foundation-process-registry';\nimport { resolveRootSessionId } from '@agimon-ai/po-core/childProcess';\n\nimport {\n COMMAND_SIDECAR_SUFFIX,\n EXIT_SIDECAR_SUFFIX,\n JSON_EXTENSION,\n NOT_FOUND_ERROR_CODE,\n REGISTRY_PATH_ENV,\n RUNNER_TAG,\n SERVICE_PREFIX,\n SERVICE_TYPE,\n} from '../../constants/runnerRegistry';\nimport type { IProcessControl } from '../../types/processControl';\nimport type {\n CompleteRunnerInput,\n IRunnerRegistry,\n RegisterRunnerInput,\n RunnerRecord,\n RunnerTerminationIntent,\n} from '../../types/runnerRegistry';\nimport type { IRunnerPaths } from '../runnerPaths/type';\nimport { isRunnerRecord } from '../runnerRecord';\n\n/** The slice of the shared registry service this wrapper depends on. */\nexport type ProcessRegistryPort = Pick<\n ProcessRegistryService,\n 'registerProcess' | 'releaseProcess' | 'listProcesses' | 'close'\n>;\n\n/** Opens the SQLite-backed registry the rest of the monorepo already shares. */\nexport function createDefaultProcessRegistry(\n env: Readonly<Record<string, string | undefined>> = process.env,\n): ProcessRegistryPort {\n return createProcessRegistryService(env[REGISTRY_PATH_ENV]);\n}\n\nfunction sessionTag(sessionId: string): string {\n return `session:${sessionId}`;\n}\n\nfunction readString(record: ProcessRegistryRecord, key: string): string {\n const value = record.metadata?.[key];\n return typeof value === 'string' ? value : '';\n}\n\nfunction readNumber(record: ProcessRegistryRecord, key: string): number {\n const value = record.metadata?.[key];\n return typeof value === 'number' ? value : 0;\n}\n\nconst runCommand = promisify(execFile);\n\n/**\n * The process start time the registry stores to prove a pid is still the\n * process it registered.\n *\n * The registry resolves it itself when the caller omits it, and it does so with\n * `execFileSync`, which stops this process for the length of a `ps` on every\n * runner that starts. Reading it here costs the same subprocess and blocks\n * nothing: the command is already running by the time a runner is registered.\n *\n * The value has to match what the registry would have read, so the command and\n * the trimming are deliberately identical to its own.\n */\nasync function processStartedAt(pid: number): Promise<string | undefined> {\n if (process.platform === 'win32') return undefined;\n try {\n const { stdout } = await runCommand('ps', ['-o', 'lstart=', '-p', String(pid)], { encoding: 'utf8' });\n return stdout.trim() || undefined;\n } catch {\n return undefined;\n }\n}\n\ntype ListenerRegistration = Readonly<{ key: string; listener: () => void }>;\n\n// Server plugin replacement can leave an in-flight tool and its publisher on different registry instances.\nconst listenersBySession = new Map<string, Set<() => void>>();\n\nexport class RunnerRegistry implements IRunnerRegistry {\n private readonly subscriptions = new Set<ListenerRegistration>();\n\n constructor(\n private readonly paths: IRunnerPaths,\n private readonly processControl: IProcessControl,\n private readonly registry: ProcessRegistryPort,\n private readonly environment: Readonly<Record<string, string | undefined>>,\n ) {}\n\n async register(input: RegisterRunnerInput): Promise<RunnerRecord> {\n const startedAt = new Date().toISOString();\n const rootSessionId = resolveRootSessionId(input.sessionId, this.environment);\n const identity = await processStartedAt(input.pid);\n const response = await this.registry.registerProcess({\n repositoryPath: this.repositoryPath(),\n serviceName: `${SERVICE_PREFIX}${input.id}`,\n serviceType: SERVICE_TYPE,\n pid: input.pid,\n command: input.command,\n ...(identity === undefined ? {} : { processStartedAt: identity }),\n tags: resolveProcessTags([RUNNER_TAG, `runner:${input.id}`, sessionTag(input.sessionId)]),\n metadata: {\n id: input.id,\n name: input.name,\n command: input.command,\n cwd: input.cwd,\n logPath: input.logPath,\n interactive: input.interactive,\n sessionId: input.sessionId,\n rootSessionId,\n backend: input.backend,\n ...(input.backendTarget ? { backendTarget: input.backendTarget } : {}),\n startedAt,\n hostPid: process.pid,\n },\n // The caller has already resolved name collisions against live records,\n // so anything still holding this name is stale.\n force: true,\n });\n if (!response.success) throw new Error(response.error ?? `Failed to register runner ${input.name}`);\n const record: RunnerRecord = {\n id: input.id,\n name: input.name,\n pid: input.pid,\n command: input.command,\n cwd: input.cwd,\n logPath: input.logPath,\n interactive: input.interactive,\n sessionId: input.sessionId,\n rootSessionId,\n startedAt,\n state: 'running',\n promoted: false,\n backend: input.backend,\n ...(input.backendTarget ? { backendTarget: input.backendTarget } : {}),\n hostPid: process.pid,\n };\n this.writeRecord(record);\n this.notify(record.sessionId);\n return record;\n }\n\n async list(): Promise<RunnerRecord[]> {\n const records = await this.registry.listProcesses({\n repositoryPath: this.repositoryPath(),\n serviceType: SERVICE_TYPE,\n tags: resolveProcessTags([RUNNER_TAG]),\n });\n return records.map(toRunnerRecord);\n }\n\n async listBySession(sessionId: string): Promise<RunnerRecord[]> {\n const records = await this.list();\n return records.filter((record) => record.sessionId === sessionId);\n }\n\n async listByRootSession(rootSessionId: string): Promise<RunnerRecord[]> {\n const records = await this.list();\n return records.filter((record) => (record.rootSessionId ?? record.sessionId) === rootSessionId);\n }\n\n async listAll(sessionId?: string): Promise<RunnerRecord[]> {\n this.paths.ensureDirectories(sessionId);\n const records: RunnerRecord[] = [];\n const directory = this.paths.stateDirectory(sessionId);\n for (const entry of fs.readdirSync(directory)) {\n if (!isPrimaryMetadataEntry(entry)) continue;\n try {\n const parsed: unknown = JSON.parse(fs.readFileSync(`${directory}/${entry}`, 'utf8'));\n if (isRunnerRecord(parsed)) records.push(parsed);\n } catch (error) {\n process.emitWarning(`Could not read runner metadata ${entry}: ${String(error)}`);\n }\n }\n return records.sort((left, right) => right.startedAt.localeCompare(left.startedAt));\n }\n\n async get(id: string, sessionId?: string): Promise<RunnerRecord | undefined> {\n const target = this.paths.statePathFor(id, sessionId);\n try {\n const parsed: unknown = JSON.parse(fs.readFileSync(target, 'utf8'));\n if (!isRunnerRecord(parsed) || parsed.id !== id) {\n process.emitWarning(`Could not read runner metadata ${path.basename(target)}: invalid runner record`);\n return undefined;\n }\n return parsed;\n } catch (error) {\n if ((error as NodeJS.ErrnoException).code === NOT_FOUND_ERROR_CODE) return undefined;\n process.emitWarning(`Could not read runner metadata ${path.basename(target)}: ${String(error)}`);\n return undefined;\n }\n }\n\n async markPromoted(id: string): Promise<RunnerRecord | undefined> {\n const record = await this.get(id);\n if (!record) return undefined;\n const promoted = { ...record, promoted: true };\n this.writeRecord(promoted);\n this.notify(promoted.sessionId);\n return promoted;\n }\n\n async requestTermination(\n id: string,\n intent: RunnerTerminationIntent | undefined,\n sessionId?: string,\n ): Promise<RunnerRecord | undefined> {\n const record = await this.get(id, sessionId);\n if (!record) return undefined;\n if (record.state === 'completed') return record;\n if (intent !== undefined && record.terminationIntent !== undefined) return record;\n const { terminationIntent: _previous, ...rest } = record;\n const updated: RunnerRecord = { ...rest, ...(intent ? { terminationIntent: intent } : {}) };\n this.writeRecord(updated);\n return updated;\n }\n\n async complete(id: string, outcome: CompleteRunnerInput, sessionId?: string): Promise<RunnerRecord | undefined> {\n const persisted = await this.get(id, sessionId);\n if (persisted?.state === 'completed') {\n await this.release(id, persisted.sessionId);\n return persisted;\n }\n const active = await this.list();\n const record =\n persisted ??\n active.find((candidate) => candidate.id === id && (sessionId === undefined || candidate.sessionId === sessionId));\n if (!record) {\n const belongsToAnotherSession =\n sessionId !== undefined && active.some((candidate) => candidate.id === id && candidate.sessionId !== sessionId);\n if (!belongsToAnotherSession) await this.release(id, sessionId);\n return undefined;\n }\n const completed: RunnerRecord = {\n ...record,\n state: 'completed',\n exit: {\n ...outcome,\n ...(outcome.signal !== null && outcome.terminationReason === undefined && record.terminationIntent === undefined\n ? { terminationReason: 'external_signal' as const }\n : {}),\n ...record.terminationIntent,\n finishedAt: new Date().toISOString(),\n },\n };\n this.writeRecord(completed);\n await this.release(id, completed.sessionId);\n return completed;\n }\n\n async release(id: string, sessionId?: string): Promise<void> {\n const activeSessionId = sessionId ?? (await this.list()).find((record) => record.id === id)?.sessionId;\n const ownedSessionId = activeSessionId ?? (await this.get(id))?.sessionId;\n const response = await this.registry.releaseProcess({\n repositoryPath: this.repositoryPath(),\n serviceName: `${SERVICE_PREFIX}${id}`,\n serviceType: SERVICE_TYPE,\n kill: false,\n releasePort: false,\n force: true,\n });\n if (!response.success && !response.error?.includes('No matching process entry')) {\n throw new Error(response.error ?? `Failed to release runner ${id}`);\n }\n if (ownedSessionId !== undefined) this.notify(ownedSessionId);\n }\n\n async pruneDead(): Promise<string[]> {\n const dead = (await this.list()).filter((record) => !this.processControl.isAlive(record.pid));\n for (const record of dead) {\n await this.complete(record.id, { reason: 'backend_lost', code: null, signal: null }, record.sessionId);\n }\n return dead.map((record) => record.id);\n }\n\n subscribe(listener: () => void, sessionId: string): () => void {\n const subscribed = (): void => listener();\n const registration = { key: this.subscriptionKey(sessionId), listener: subscribed };\n const listeners = listenersBySession.get(registration.key) ?? new Set<() => void>();\n listeners.add(subscribed);\n listenersBySession.set(registration.key, listeners);\n this.subscriptions.add(registration);\n return () => this.removeSubscription(registration);\n }\n\n close(): void {\n for (const registration of this.subscriptions) this.removeSubscription(registration);\n this.registry.close();\n }\n\n private notify(sessionId: string): void {\n for (const listener of listenersBySession.get(this.subscriptionKey(sessionId)) ?? []) {\n try {\n listener();\n } catch (error) {\n process.emitWarning(`Runner registry listener failed: ${String(error)}`);\n }\n }\n }\n\n private removeSubscription(registration: ListenerRegistration): void {\n const listeners = listenersBySession.get(registration.key);\n listeners?.delete(registration.listener);\n if (listeners?.size === 0) listenersBySession.delete(registration.key);\n this.subscriptions.delete(registration);\n }\n\n private subscriptionKey(sessionId: string): string {\n return JSON.stringify([path.resolve(this.paths.stateDirectory(sessionId)), sessionId]);\n }\n\n private repositoryPath(): string {\n return normalizeRepositoryPath(this.paths.repositoryPath());\n }\n\n private writeRecord(record: RunnerRecord): void {\n this.paths.ensureDirectories(record.sessionId);\n const target = this.paths.statePathFor(record.id, record.sessionId);\n const temporary = `${target}.${process.pid}.tmp`;\n fs.writeFileSync(temporary, `${JSON.stringify(record, null, 2)}\\n`, 'utf8');\n fs.renameSync(temporary, target);\n }\n}\n\n/** Every field is read back from metadata this class wrote on registration. */\nfunction toRunnerRecord(record: ProcessRegistryRecord): RunnerRecord {\n return {\n id: readString(record, 'id'),\n name: readString(record, 'name'),\n pid: record.pid,\n command: readString(record, 'command'),\n cwd: readString(record, 'cwd'),\n logPath: readString(record, 'logPath'),\n interactive: record.metadata?.interactive === true,\n sessionId: readString(record, 'sessionId'),\n ...(readString(record, 'rootSessionId') ? { rootSessionId: readString(record, 'rootSessionId') } : {}),\n startedAt: readString(record, 'startedAt'),\n state: 'running',\n promoted: false,\n backend: readBackend(record.metadata?.backend),\n ...(readString(record, 'backendTarget') ? { backendTarget: readString(record, 'backendTarget') } : {}),\n hostPid: readNumber(record, 'hostPid'),\n };\n}\n\nfunction readBackend(value: unknown): RunnerRecord['backend'] {\n return value === 'rmux' || value === 'tmux' ? value : 'native';\n}\n\nfunction isPrimaryMetadataEntry(entry: string): boolean {\n return (\n entry.endsWith(JSON_EXTENSION) && !entry.endsWith(COMMAND_SIDECAR_SUFFIX) && !entry.endsWith(EXIT_SIDECAR_SUFFIX)\n );\n}\n"],"mappings":";;;;;;;;;;AAAA,MAAa,eAAe;AAC5B,MAAa,iBAAiB;AAC9B,MAAa,aAAa;AAC1B,MAAa,oBAAoB;;;;ACAjC,SAAgB,eAAe,OAAuC;CACpE,IAAI,OAAO,UAAU,YAAY,UAAU,MAAM,OAAO;CACxD,MAAM,SAAS;CACf,OACE,OAAO,OAAO,OAAO,YACrB,OAAO,OAAO,SAAS,YACvB,OAAO,OAAO,QAAQ,YACtB,OAAO,OAAO,YAAY,YAC1B,OAAO,OAAO,QAAQ,YACtB,OAAO,OAAO,YAAY,YAC1B,OAAO,OAAO,cAAc,YAC5B,OAAO,OAAO,cAAc,aAC3B,OAAO,UAAU,aAAa,OAAO,UAAU,gBAChD,OAAO,OAAO,aAAa,cAC1B,OAAO,YAAY,UAAU,OAAO,YAAY,UAAU,OAAO,YAAY;AAElF;;AAGA,SAAgB,qBAAqB,QAA8B;CACjE,MAAM,UAAU,OAAO,MAAM,UAAU,OAAO;CAC9C,MAAM,OAAO,OAAO,MAAM,SAAS,QAAQ,OAAO,MAAM,SAAS,KAAA,IAAY,KAAK,eAAe,OAAO,KAAK;CAC7G,OAAO;EACL,qBAAqB,OAAO,KAAK,WAAW,UAAU,KAAK;EAC3D,cAAc,OAAO;EACrB,QA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AC7C,MAAM,SAAS,KAAK,MAAM,aAAa,OAAO,IAAI,OAAO,SAAS;EAClE,MAAM,YAAY,GAAG,OAAO,GAAG,QAAQ,IAAI;EAC3C,QAAA,QAAG,cAAc,WAAW,GAAG,KAAK,UAAU,QAAQ,MAAM,CAAC,EAAE,KAAK,MAAM;EAC1E,QAAA,QAAG,WAAW,WAAW,MAAM;CACjC;AACF;;AAGA,SAAS,eAAe,QAA6C;CACnE,OAAO;EACL,IAAI,WAAW,QAAQ,IAAI;EAC3B,MAAM,WAAW,QAAQ,MAAM;EAC/B,KAAK,OAAO;EACZ,SAAS,WAAW,QAAQ,SAAS;EACrC,KAAK,WAAW,QAAQ,KAAK;EAC7B,SAAS,WAAW,QAAQ,SAAS;EACrC,aAAa,OAAO,UAAU,gBAAgB;EAC9C,WAAW,WAAW,QAAQ,WAAW;EACzC,GAAI,WAAW,QAAQ,eAAe,IAAI,EAAE,eAAe,WAAW,QAAQ,eAAe,EAAE,IAAI,CAAC;EACpG,WAAW,WAAW,QAAQ,WAAW;EACzC,OAAO;EACP,UAAU;EACV,SAAS,YAAY,OAAO,UAAU,OAAO;EAC7C,GAAI,WAAW,QAAQ,eAAe,IAAI,EAAE,eAAe,WAAW,QAAQ,eAAe,EAAE,IAAI,CAAC;EACpG,SAAS,WAAW,QAAQ,SAAS;CACvC;AACF;AAEA,SAAS,YAAY,OAAyC;CAC5D,OAAO,UAAU,UAAU,UAAU,SAAS,QAAQ;AACxD;AAEA,SAAS,uBAAuB,OAAwB;CACtD,OACE,MAAM,SAAA,OAAuB,KAAK,CAAC,MAAM,SAAA,eAA+B,KAAK,CAAC,MAAM,SAAA,YAA4B;AAEpH"}
|
package/dist/runnerRegistry.cjs
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
1
|
Object.defineProperty(exports, Symbol.toStringTag, { value: "Module" });
|
|
2
|
-
const require_runnerRegistry = require("./runnerRegistry-
|
|
2
|
+
const require_runnerRegistry = require("./runnerRegistry-dQYlMSpQ.cjs");
|
|
3
3
|
exports.RunnerRegistry = require_runnerRegistry.RunnerRegistry;
|
|
4
4
|
exports.createDefaultProcessRegistry = require_runnerRegistry.createDefaultProcessRegistry;
|
|
@@ -1,3 +1,3 @@
|
|
|
1
|
-
import { i as RunnerRecord, n as IRunnerRegistry, r as RegisterRunnerInput } from "./runnerRegistry-
|
|
2
|
-
import { n as RunnerRegistry, r as createDefaultProcessRegistry, t as ProcessRegistryPort } from "./index-
|
|
1
|
+
import { i as RunnerRecord, n as IRunnerRegistry, r as RegisterRunnerInput } from "./runnerRegistry-V-Ocaf4N.mjs";
|
|
2
|
+
import { n as RunnerRegistry, r as createDefaultProcessRegistry, t as ProcessRegistryPort } from "./index-CzCF_OP9.mjs";
|
|
3
3
|
export { type IRunnerRegistry, type ProcessRegistryPort, type RegisterRunnerInput, type RunnerRecord, RunnerRegistry, createDefaultProcessRegistry };
|
package/dist/runnerRegistry.mjs
CHANGED
|
@@ -1,2 +1 @@
|
|
|
1
|
-
|
|
2
|
-
export { RunnerRegistry, createDefaultProcessRegistry };
|
|
1
|
+
export { t as RunnerRegistry, n as createDefaultProcessRegistry } from "./runnerRegistry-BgaR5O86.mjs";
|
|
@@ -4,7 +4,7 @@ let node_net = require("node:net");
|
|
|
4
4
|
node_net = require_rolldown_runtime.__toESM(node_net, 1);
|
|
5
5
|
//#region src/services/lifeline/client.ts
|
|
6
6
|
/** Environment variable carrying the lifeline socket path to every runner supervisor. */
|
|
7
|
-
const LIFELINE_ENV = "
|
|
7
|
+
const LIFELINE_ENV = "PO_RUNNER_LIFELINE";
|
|
8
8
|
/**
|
|
9
9
|
* Reports the owning pi process dying to a runner's supervisor.
|
|
10
10
|
*
|
|
@@ -33,7 +33,7 @@ function watchOwner(onOwnerLost, target = process.env[LIFELINE_ENV]) {
|
|
|
33
33
|
try {
|
|
34
34
|
connection = node_net.default.connect(target);
|
|
35
35
|
} catch (error) {
|
|
36
|
-
process.emitWarning(`Could not watch the
|
|
36
|
+
process.emitWarning(`Could not watch the po-runner lifeline: ${String(error)}`);
|
|
37
37
|
return () => void 0;
|
|
38
38
|
}
|
|
39
39
|
connection.unref();
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"client.cjs","names":["net"],"sources":["../../../src/services/lifeline/client.ts"],"sourcesContent":["import net from 'node:net';\n\n/** Environment variable carrying the lifeline socket path to every runner supervisor. */\nexport const LIFELINE_ENV = '
|
|
1
|
+
{"version":3,"file":"client.cjs","names":["net"],"sources":["../../../src/services/lifeline/client.ts"],"sourcesContent":["import net from 'node:net';\n\n/** Environment variable carrying the lifeline socket path to every runner supervisor. */\nexport const LIFELINE_ENV = 'PO_RUNNER_LIFELINE';\n\n/**\n * Reports the owning pi process dying to a runner's supervisor.\n *\n * A connected Unix socket drops the moment the owner's descriptors close, which\n * happens on every exit path including SIGKILL, so it is the one death signal a\n * graceful shutdown handler cannot provide. Connecting never blocks, the close\n * edge arrives through the event loop rather than a poll, and an unref'd socket\n * can never keep the supervisor alive: the watcher is therefore incapable of\n * outliving the process that installed it.\n *\n * A refused or missing socket means the owner died before this runner started,\n * which is reported the same way as a later death rather than left to hang.\n *\n * Runners run unwatched when no lifeline is armed, so a missing environment\n * variable can never be mistaken for a dead owner.\n */\nexport function watchOwner(\n onOwnerLost: () => void,\n target: string | undefined = process.env[LIFELINE_ENV],\n): () => void {\n if (!target) return () => undefined;\n\n let settled = false;\n const settle = (): void => {\n if (settled) return;\n settled = true;\n onOwnerLost();\n };\n\n let connection: net.Socket;\n try {\n connection = net.connect(target);\n } catch (error) {\n process.emitWarning(`Could not watch the po-runner lifeline: ${String(error)}`);\n return () => undefined;\n }\n\n // The supervisor's own exit must never wait on this socket.\n connection.unref();\n // The owner never sends anything, so drain rather than accumulate.\n connection.on('connect', () => connection.resume());\n connection.on('error', settle);\n connection.on('close', settle);\n\n return () => {\n settled = true;\n connection.destroy();\n };\n}\n"],"mappings":";;;;;;AAGA,MAAa,eAAe;;;;;;;;;;;;;;;;;AAkB5B,SAAgB,WACd,aACA,SAA6B,QAAQ,IAAI,eAC7B;CACZ,IAAI,CAAC,QAAQ,aAAa,KAAA;CAE1B,IAAI,UAAU;CACd,MAAM,eAAqB;EACzB,IAAI,SAAS;EACb,UAAU;EACV,YAAY;CACd;CAEA,IAAI;CACJ,IAAI;EACF,aAAaA,SAAAA,QAAI,QAAQ,MAAM;CACjC,SAAS,OAAO;EACd,QAAQ,YAAY,2CAA2C,OAAO,KAAK,GAAG;EAC9E,aAAa,KAAA;CACf;CAGA,WAAW,MAAM;CAEjB,WAAW,GAAG,iBAAiB,WAAW,OAAO,CAAC;CAClD,WAAW,GAAG,SAAS,MAAM;CAC7B,WAAW,GAAG,SAAS,MAAM;CAE7B,aAAa;EACX,UAAU;EACV,WAAW,QAAQ;CACrB;AACF"}
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
//#region src/services/lifeline/client.d.ts
|
|
2
2
|
/** Environment variable carrying the lifeline socket path to every runner supervisor. */
|
|
3
|
-
export declare const LIFELINE_ENV = "
|
|
3
|
+
export declare const LIFELINE_ENV = "PO_RUNNER_LIFELINE";
|
|
4
4
|
/**
|
|
5
5
|
* Reports the owning pi process dying to a runner's supervisor.
|
|
6
6
|
*
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import net from "node:net";
|
|
2
2
|
//#region src/services/lifeline/client.ts
|
|
3
3
|
/** Environment variable carrying the lifeline socket path to every runner supervisor. */
|
|
4
|
-
const LIFELINE_ENV = "
|
|
4
|
+
const LIFELINE_ENV = "PO_RUNNER_LIFELINE";
|
|
5
5
|
/**
|
|
6
6
|
* Reports the owning pi process dying to a runner's supervisor.
|
|
7
7
|
*
|
|
@@ -30,7 +30,7 @@ function watchOwner(onOwnerLost, target = process.env[LIFELINE_ENV]) {
|
|
|
30
30
|
try {
|
|
31
31
|
connection = net.connect(target);
|
|
32
32
|
} catch (error) {
|
|
33
|
-
process.emitWarning(`Could not watch the
|
|
33
|
+
process.emitWarning(`Could not watch the po-runner lifeline: ${String(error)}`);
|
|
34
34
|
return () => void 0;
|
|
35
35
|
}
|
|
36
36
|
connection.unref();
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"client.mjs","names":[],"sources":["../../../src/services/lifeline/client.ts"],"sourcesContent":["import net from 'node:net';\n\n/** Environment variable carrying the lifeline socket path to every runner supervisor. */\nexport const LIFELINE_ENV = '
|
|
1
|
+
{"version":3,"file":"client.mjs","names":[],"sources":["../../../src/services/lifeline/client.ts"],"sourcesContent":["import net from 'node:net';\n\n/** Environment variable carrying the lifeline socket path to every runner supervisor. */\nexport const LIFELINE_ENV = 'PO_RUNNER_LIFELINE';\n\n/**\n * Reports the owning pi process dying to a runner's supervisor.\n *\n * A connected Unix socket drops the moment the owner's descriptors close, which\n * happens on every exit path including SIGKILL, so it is the one death signal a\n * graceful shutdown handler cannot provide. Connecting never blocks, the close\n * edge arrives through the event loop rather than a poll, and an unref'd socket\n * can never keep the supervisor alive: the watcher is therefore incapable of\n * outliving the process that installed it.\n *\n * A refused or missing socket means the owner died before this runner started,\n * which is reported the same way as a later death rather than left to hang.\n *\n * Runners run unwatched when no lifeline is armed, so a missing environment\n * variable can never be mistaken for a dead owner.\n */\nexport function watchOwner(\n onOwnerLost: () => void,\n target: string | undefined = process.env[LIFELINE_ENV],\n): () => void {\n if (!target) return () => undefined;\n\n let settled = false;\n const settle = (): void => {\n if (settled) return;\n settled = true;\n onOwnerLost();\n };\n\n let connection: net.Socket;\n try {\n connection = net.connect(target);\n } catch (error) {\n process.emitWarning(`Could not watch the po-runner lifeline: ${String(error)}`);\n return () => undefined;\n }\n\n // The supervisor's own exit must never wait on this socket.\n connection.unref();\n // The owner never sends anything, so drain rather than accumulate.\n connection.on('connect', () => connection.resume());\n connection.on('error', settle);\n connection.on('close', settle);\n\n return () => {\n settled = true;\n connection.destroy();\n };\n}\n"],"mappings":";;;AAGA,MAAa,eAAe;;;;;;;;;;;;;;;;;AAkB5B,SAAgB,WACd,aACA,SAA6B,QAAQ,IAAI,eAC7B;CACZ,IAAI,CAAC,QAAQ,aAAa,KAAA;CAE1B,IAAI,UAAU;CACd,MAAM,eAAqB;EACzB,IAAI,SAAS;EACb,UAAU;EACV,YAAY;CACd;CAEA,IAAI;CACJ,IAAI;EACF,aAAa,IAAI,QAAQ,MAAM;CACjC,SAAS,OAAO;EACd,QAAQ,YAAY,2CAA2C,OAAO,KAAK,GAAG;EAC9E,aAAa,KAAA;CACf;CAGA,WAAW,MAAM;CAEjB,WAAW,GAAG,iBAAiB,WAAW,OAAO,CAAC;CAClD,WAAW,GAAG,SAAS,MAAM;CAC7B,WAAW,GAAG,SAAS,MAAM;CAE7B,aAAa;EACX,UAAU;EACV,WAAW,QAAQ;CACrB;AACF"}
|
|
@@ -9,10 +9,10 @@ function inheritedSessionId(env = process.env) {
|
|
|
9
9
|
/** Returns the inherited Pi session id or fails closed outside a session. */
|
|
10
10
|
function requiredSessionId(env = process.env) {
|
|
11
11
|
const sessionId = inheritedSessionId(env);
|
|
12
|
-
if (!sessionId) throw new Error(`${PI_SESSION_ID_ENV} is required for
|
|
12
|
+
if (!sessionId) throw new Error(`${PI_SESSION_ID_ENV} is required for po-runner`);
|
|
13
13
|
return sessionId;
|
|
14
14
|
}
|
|
15
15
|
//#endregion
|
|
16
16
|
export { requiredSessionId as n, inheritedSessionId as t };
|
|
17
17
|
|
|
18
|
-
//# sourceMappingURL=session-
|
|
18
|
+
//# sourceMappingURL=session-BKYnH4R6.mjs.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"session-
|
|
1
|
+
{"version":3,"file":"session-BKYnH4R6.mjs","names":[],"sources":["../src/services/session/index.ts"],"sourcesContent":["import { PI_SESSION_ID_ENV } from '../../constants/session';\n/** Session identity inherited by commands launched from a Pi session. */\n\n/** Returns a usable inherited session id, failing closed on blank values. */\nexport function inheritedSessionId(env: NodeJS.ProcessEnv = process.env): string | undefined {\n const value = env[PI_SESSION_ID_ENV]?.trim();\n return value ? value : undefined;\n}\n\n/** Returns the inherited Pi session id or fails closed outside a session. */\nexport function requiredSessionId(env: NodeJS.ProcessEnv = process.env): string {\n const sessionId = inheritedSessionId(env);\n if (!sessionId) throw new Error(`${PI_SESSION_ID_ENV} is required for po-runner`);\n return sessionId;\n}\n"],"mappings":";;;;AAIA,SAAgB,mBAAmB,MAAyB,QAAQ,KAAyB;CAC3F,MAAM,QAAQ,IAAI,kBAAkB,EAAE,KAAK;CAC3C,OAAO,QAAQ,QAAQ,KAAA;AACzB;;AAGA,SAAgB,kBAAkB,MAAyB,QAAQ,KAAa;CAC9E,MAAM,YAAY,mBAAmB,GAAG;CACxC,IAAI,CAAC,WAAW,MAAM,IAAI,MAAM,GAAG,kBAAkB,2BAA2B;CAChF,OAAO;AACT"}
|
|
@@ -9,7 +9,7 @@ function inheritedSessionId(env = process.env) {
|
|
|
9
9
|
/** Returns the inherited Pi session id or fails closed outside a session. */
|
|
10
10
|
function requiredSessionId(env = process.env) {
|
|
11
11
|
const sessionId = inheritedSessionId(env);
|
|
12
|
-
if (!sessionId) throw new Error(`${require_session.PI_SESSION_ID_ENV} is required for
|
|
12
|
+
if (!sessionId) throw new Error(`${require_session.PI_SESSION_ID_ENV} is required for po-runner`);
|
|
13
13
|
return sessionId;
|
|
14
14
|
}
|
|
15
15
|
//#endregion
|
|
@@ -26,4 +26,4 @@ Object.defineProperty(exports, "requiredSessionId", {
|
|
|
26
26
|
}
|
|
27
27
|
});
|
|
28
28
|
|
|
29
|
-
//# sourceMappingURL=session-
|
|
29
|
+
//# sourceMappingURL=session-BvqzhXZY.cjs.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"session-
|
|
1
|
+
{"version":3,"file":"session-BvqzhXZY.cjs","names":["PI_SESSION_ID_ENV"],"sources":["../src/services/session/index.ts"],"sourcesContent":["import { PI_SESSION_ID_ENV } from '../../constants/session';\n/** Session identity inherited by commands launched from a Pi session. */\n\n/** Returns a usable inherited session id, failing closed on blank values. */\nexport function inheritedSessionId(env: NodeJS.ProcessEnv = process.env): string | undefined {\n const value = env[PI_SESSION_ID_ENV]?.trim();\n return value ? value : undefined;\n}\n\n/** Returns the inherited Pi session id or fails closed outside a session. */\nexport function requiredSessionId(env: NodeJS.ProcessEnv = process.env): string {\n const sessionId = inheritedSessionId(env);\n if (!sessionId) throw new Error(`${PI_SESSION_ID_ENV} is required for po-runner`);\n return sessionId;\n}\n"],"mappings":";;;;AAIA,SAAgB,mBAAmB,MAAyB,QAAQ,KAAyB;CAC3F,MAAM,QAAQ,IAAIA,gBAAAA,kBAAkB,EAAE,KAAK;CAC3C,OAAO,QAAQ,QAAQ,KAAA;AACzB;;AAGA,SAAgB,kBAAkB,MAAyB,QAAQ,KAAa;CAC9E,MAAM,YAAY,mBAAmB,GAAG;CACxC,IAAI,CAAC,WAAW,MAAM,IAAI,MAAM,GAAGA,gBAAAA,kBAAkB,2BAA2B;CAChF,OAAO;AACT"}
|
package/dist/session.cjs
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
Object.defineProperty(exports, Symbol.toStringTag, { value: "Module" });
|
|
2
2
|
const require_session = require("./session-SfIPtdZO.cjs");
|
|
3
|
-
const require_session$1 = require("./session-
|
|
3
|
+
const require_session$1 = require("./session-BvqzhXZY.cjs");
|
|
4
4
|
exports.PI_SESSION_ID_ENV = require_session.PI_SESSION_ID_ENV;
|
|
5
5
|
exports.inheritedSessionId = require_session$1.inheritedSessionId;
|
|
6
6
|
exports.requiredSessionId = require_session$1.requiredSessionId;
|
package/dist/session.mjs
CHANGED
|
@@ -1,3 +1,3 @@
|
|
|
1
1
|
import { t as PI_SESSION_ID_ENV } from "./session-DE2Acesp.mjs";
|
|
2
|
-
import { n as requiredSessionId, t as inheritedSessionId } from "./session-
|
|
2
|
+
import { n as requiredSessionId, t as inheritedSessionId } from "./session-BKYnH4R6.mjs";
|
|
3
3
|
export { PI_SESSION_ID_ENV, inheritedSessionId, requiredSessionId };
|
package/dist/spawner.mjs
CHANGED
|
@@ -1,2 +1 @@
|
|
|
1
|
-
|
|
2
|
-
export { NodeSpawner };
|
|
1
|
+
export { t as NodeSpawner } from "./spawner-LoVsn55-.mjs";
|
|
@@ -5,7 +5,7 @@ import { n as ISpawner } from "./spawner-CdrN_HNk.mjs";
|
|
|
5
5
|
import { t as ILauncher } from "./launcher-BG5t9nvG.mjs";
|
|
6
6
|
import { t as IPtyHost } from "./ptyHost-DWWtRrGn.mjs";
|
|
7
7
|
import { t as IRmuxBackend } from "./rmuxBackend-CaEWooWn.mjs";
|
|
8
|
-
import { n as IRunnerRegistry } from "./runnerRegistry-
|
|
8
|
+
import { n as IRunnerRegistry } from "./runnerRegistry-V-Ocaf4N.mjs";
|
|
9
9
|
import { t as IRunnerNamer } from "./type-vWQNTahw.mjs";
|
|
10
10
|
import { t as ILifeline } from "./lifeline-eJdZV0nN.mjs";
|
|
11
11
|
import { t as ILogFile } from "./logFile-C7oQ_v-g.mjs";
|
|
@@ -13,8 +13,8 @@ import { t as ILogReader } from "./logReader-MdW9ffvV.mjs";
|
|
|
13
13
|
import { t as IProcessControl } from "./processControl-BAOa3oo_.mjs";
|
|
14
14
|
import { t as IPtySpawner } from "./ptySpawner-B6GsueZd.mjs";
|
|
15
15
|
import { t as RunnerSettings } from "./runnerSettings-DiV1lvzx.mjs";
|
|
16
|
-
import { t as IRunnerPaths } from "./type-
|
|
17
|
-
import { t as ProcessRegistryPort } from "./index-
|
|
16
|
+
import { t as IRunnerPaths } from "./type-DwMZoINK.mjs";
|
|
17
|
+
import { t as ProcessRegistryPort } from "./index-CzCF_OP9.mjs";
|
|
18
18
|
//#region src/services/runnerDependencies/type.d.ts
|
|
19
19
|
/** Everything the runner runtime is assembled from. */
|
|
20
20
|
interface RunnerDependencies {
|
|
@@ -40,4 +40,4 @@ interface RunnerDependencies {
|
|
|
40
40
|
}
|
|
41
41
|
//#endregion
|
|
42
42
|
export { RunnerDependencies as t };
|
|
43
|
-
//# sourceMappingURL=type-
|
|
43
|
+
//# sourceMappingURL=type-Do0YxwVQ.d.mts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"type-
|
|
1
|
+
{"version":3,"file":"type-Do0YxwVQ.d.mts","names":[],"sources":["../src/services/runnerDependencies/type.ts"],"mappings":";;;;;;;;;;;;;;;;;;;UAmBiB;WACN,WAAW;WACX,aAAa,SAAS;WACtB,OAAO;WACP,SAAS;WACT,gBAAgB;WAChB,YAAY;WACZ,OAAO;WACP,UAAU;WACV,gBAAgB;WAChB,OAAO;WACP,SAAS;WACT,WAAW;WACX,UAAU;WACV,aAAa;WACb,cAAc;WACd,SAAS;WACT,gBAAgB;;WAEhB,iBAAiB"}
|
|
@@ -27,18 +27,18 @@ interface IRunnerPaths {
|
|
|
27
27
|
rawLogPathFor(id: string, sessionId?: string): string;
|
|
28
28
|
statePathFor(id: string, sessionId?: string): string;
|
|
29
29
|
ensureDirectories(sessionId?: string): void;
|
|
30
|
+
/** The directory every session's runner state lives under, or the pinned log directory's parent. */
|
|
31
|
+
storeDirectory(): string;
|
|
30
32
|
/**
|
|
31
33
|
* Deletes completed metadata and matching logs after the retention window.
|
|
32
|
-
* Running records are never removed.
|
|
34
|
+
* Running records are never removed. `live` names the sessions still running here, whose
|
|
35
|
+
* directories keep their lifeline and are only trimmed record by record; by default it is the
|
|
36
|
+
* one session this layout adopted.
|
|
33
37
|
*/
|
|
34
|
-
sweepHistory(ttlMs: number, now?: number): LogSweepResult;
|
|
38
|
+
sweepHistory(ttlMs: number, now?: number, live?: ReadonlySet<string>): LogSweepResult;
|
|
35
39
|
/** Async startup-safe form of history retention cleanup. */
|
|
36
|
-
sweepHistoryAsync?(ttlMs: number, now?: number): Promise<LogSweepResult>;
|
|
37
|
-
/** Exact legacy Git-directory store, if this repository has one. */
|
|
38
|
-
legacyDirectory(): string | undefined;
|
|
39
|
-
/** Removes only the validated legacy doom-runner directory. */
|
|
40
|
-
removeLegacyStore(): string | undefined;
|
|
40
|
+
sweepHistoryAsync?(ttlMs: number, now?: number, live?: ReadonlySet<string>): Promise<LogSweepResult>;
|
|
41
41
|
}
|
|
42
42
|
//#endregion
|
|
43
43
|
export { LogSweepResult as n, IRunnerPaths as t };
|
|
44
|
-
//# sourceMappingURL=type-
|
|
44
|
+
//# sourceMappingURL=type-DwMZoINK.d.mts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"type-
|
|
1
|
+
{"version":3,"file":"type-DwMZoINK.d.mts","names":[],"sources":["../src/services/runnerPaths/type.ts"],"mappings":";UAAiB;EACf;EACA;;;UAIe;;EAEf;;EAEA,aAAa;;EAEb,aAAa;;EAEb,eAAe;EACf,WAAW,YAAY;;EAEvB,kBAAkB,YAAY;;;;;;;;;EAS9B,cAAc,YAAY;EAC1B,aAAa,YAAY;EACzB,kBAAkB;;EAElB;;;;;;;EAOA,aAAa,eAAe,cAAc,OAAO,sBAAsB;;EAEvE,mBAAmB,eAAe,cAAc,OAAO,sBAAsB,QAAQ"}
|
package/dist/types.d.mts
CHANGED
|
@@ -1,3 +1,3 @@
|
|
|
1
1
|
import { c as RtkProcessResult, l as RtkProcessedOutput, o as RtkFilter, s as RtkProcessRequest, t as IRtkProcessor } from "./rtkProcessor-CVZvNhkJ.mjs";
|
|
2
|
-
import { t as RunnerDependencies } from "./type-
|
|
2
|
+
import { t as RunnerDependencies } from "./type-Do0YxwVQ.mjs";
|
|
3
3
|
export type { IRtkProcessor, RtkFilter, RtkProcessRequest, RtkProcessResult, RtkProcessedOutput, RunnerDependencies };
|
package/package.json
CHANGED
|
@@ -1,16 +1,16 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@agimon-ai/po-runner",
|
|
3
|
-
"version": "0.0.0-alpha.
|
|
3
|
+
"version": "0.0.0-alpha.21",
|
|
4
4
|
"description": "Supervised shell execution, background process control, and run logs for Pi coding agents.",
|
|
5
5
|
"keywords": [
|
|
6
6
|
"ai",
|
|
7
7
|
"background-process",
|
|
8
8
|
"coding-agent",
|
|
9
9
|
"developer-tools",
|
|
10
|
-
"doom-runner",
|
|
11
10
|
"pi-coding-agent",
|
|
12
11
|
"pi-package",
|
|
13
12
|
"po",
|
|
13
|
+
"po-runner",
|
|
14
14
|
"process-supervision",
|
|
15
15
|
"shell"
|
|
16
16
|
],
|
|
@@ -18,16 +18,13 @@
|
|
|
18
18
|
"bugs": {
|
|
19
19
|
"url": "https://github.com/AgiFlow/po/issues"
|
|
20
20
|
},
|
|
21
|
-
"license": "
|
|
21
|
+
"license": "BUSL-1.1",
|
|
22
22
|
"author": "Vuong Ngo",
|
|
23
23
|
"repository": {
|
|
24
24
|
"type": "git",
|
|
25
25
|
"url": "git+https://github.com/AgiFlow/po.git",
|
|
26
26
|
"directory": "packages/default/po-runner"
|
|
27
27
|
},
|
|
28
|
-
"bin": {
|
|
29
|
-
"po-runner": "./dist/bin/cli.mjs"
|
|
30
|
-
},
|
|
31
28
|
"files": [
|
|
32
29
|
"dist",
|
|
33
30
|
"skills",
|
|
@@ -211,40 +208,40 @@
|
|
|
211
208
|
"registry": "https://registry.npmjs.org/"
|
|
212
209
|
},
|
|
213
210
|
"dependencies": {
|
|
214
|
-
"@agimon-ai/foundation-process-registry": "0.30.
|
|
215
|
-
"@agimon-ai/po-core": "0.0.0-alpha.
|
|
216
|
-
"@agimon-ai/po-telemetry": "0.0.0-alpha.
|
|
217
|
-
"@agimon-ai/po-ui": "0.0.0-alpha.
|
|
218
|
-
"@agimon-ai/po-web-components": "0.0.0-alpha.
|
|
219
|
-
"@agimon-ai/po-web-security": "0.0.0-alpha.
|
|
220
|
-
"@deepseek-ai/cordis": "4.0.
|
|
211
|
+
"@agimon-ai/foundation-process-registry": "0.30.13",
|
|
212
|
+
"@agimon-ai/po-core": "0.0.0-alpha.21",
|
|
213
|
+
"@agimon-ai/po-telemetry": "0.0.0-alpha.21",
|
|
214
|
+
"@agimon-ai/po-ui": "0.0.0-alpha.21",
|
|
215
|
+
"@agimon-ai/po-web-components": "0.0.0-alpha.21",
|
|
216
|
+
"@agimon-ai/po-web-security": "0.0.0-alpha.21",
|
|
217
|
+
"@deepseek-ai/cordis": "4.0.5",
|
|
221
218
|
"@rmux/sdk": "0.6.5",
|
|
222
219
|
"@xterm/headless": "6.0.0",
|
|
223
|
-
"hono": "4.13.
|
|
224
|
-
"typebox": "1.3.
|
|
220
|
+
"hono": "4.13.13",
|
|
221
|
+
"typebox": "1.3.37"
|
|
225
222
|
},
|
|
226
223
|
"devDependencies": {
|
|
227
|
-
"@agimon-ai/po-build": "0.0.0-alpha.
|
|
228
|
-
"@agimon-ai/po-native-components": "0.0.0-alpha.
|
|
229
|
-
"@earendil-works/pi-coding-agent": "1.
|
|
224
|
+
"@agimon-ai/po-build": "0.0.0-alpha.21",
|
|
225
|
+
"@agimon-ai/po-native-components": "0.0.0-alpha.21",
|
|
226
|
+
"@earendil-works/pi-coding-agent": "1.3.0",
|
|
230
227
|
"@tanstack/react-store": "0.11.2",
|
|
231
228
|
"@tanstack/store": "0.11.2",
|
|
232
|
-
"@types/node": "26.6.
|
|
229
|
+
"@types/node": "26.6.5",
|
|
233
230
|
"@types/react": "19.3.0",
|
|
234
|
-
"@vitest/coverage-v8": "5.0.
|
|
231
|
+
"@vitest/coverage-v8": "5.0.4",
|
|
235
232
|
"react": "19.3.0",
|
|
236
233
|
"react-dom": "19.3.0",
|
|
237
234
|
"react-native": "0.86.3",
|
|
238
|
-
"react-native-unistyles": "3.5.
|
|
239
|
-
"tsdown": "0.23.
|
|
235
|
+
"react-native-unistyles": "3.5.3",
|
|
236
|
+
"tsdown": "0.23.1",
|
|
240
237
|
"typescript": "7.0.2",
|
|
241
|
-
"vitest": "5.0.
|
|
238
|
+
"vitest": "5.0.4"
|
|
242
239
|
},
|
|
243
240
|
"peerDependencies": {
|
|
244
|
-
"@agimon-ai/po-native-components": "0.0.0-alpha.
|
|
245
|
-
"@earendil-works/pi-coding-agent": "1.
|
|
241
|
+
"@agimon-ai/po-native-components": "0.0.0-alpha.21",
|
|
242
|
+
"@earendil-works/pi-coding-agent": "1.3.0",
|
|
246
243
|
"react-native": "0.86.3",
|
|
247
|
-
"react-native-unistyles": "3.5.
|
|
244
|
+
"react-native-unistyles": "^3.5.3"
|
|
248
245
|
},
|
|
249
246
|
"peerDependenciesMeta": {
|
|
250
247
|
"@earendil-works/pi-coding-agent": {
|
|
@@ -261,14 +258,14 @@
|
|
|
261
258
|
}
|
|
262
259
|
},
|
|
263
260
|
"optionalDependencies": {
|
|
264
|
-
"@agimon-ai/po-runner-rmux-darwin-arm64": "0.0.0-alpha.
|
|
265
|
-
"@agimon-ai/po-runner-rmux-darwin-x64": "0.0.0-alpha.
|
|
266
|
-
"@agimon-ai/po-runner-rmux-linux-arm64": "0.0.0-alpha.
|
|
267
|
-
"@agimon-ai/po-runner-rmux-linux-x64": "0.0.0-alpha.
|
|
268
|
-
"@agimon-ai/po-runner-rtk-darwin-arm64": "0.0.0-alpha.
|
|
269
|
-
"@agimon-ai/po-runner-rtk-darwin-x64": "0.0.0-alpha.
|
|
270
|
-
"@agimon-ai/po-runner-rtk-linux-arm64": "0.0.0-alpha.
|
|
271
|
-
"@agimon-ai/po-runner-rtk-linux-x64": "0.0.0-alpha.
|
|
261
|
+
"@agimon-ai/po-runner-rmux-darwin-arm64": "0.0.0-alpha.21",
|
|
262
|
+
"@agimon-ai/po-runner-rmux-darwin-x64": "0.0.0-alpha.21",
|
|
263
|
+
"@agimon-ai/po-runner-rmux-linux-arm64": "0.0.0-alpha.21",
|
|
264
|
+
"@agimon-ai/po-runner-rmux-linux-x64": "0.0.0-alpha.21",
|
|
265
|
+
"@agimon-ai/po-runner-rtk-darwin-arm64": "0.0.0-alpha.21",
|
|
266
|
+
"@agimon-ai/po-runner-rtk-darwin-x64": "0.0.0-alpha.21",
|
|
267
|
+
"@agimon-ai/po-runner-rtk-linux-arm64": "0.0.0-alpha.21",
|
|
268
|
+
"@agimon-ai/po-runner-rtk-linux-x64": "0.0.0-alpha.21"
|
|
272
269
|
},
|
|
273
270
|
"engines": {
|
|
274
271
|
"node": ">=24"
|
|
@@ -1,24 +1,24 @@
|
|
|
1
1
|
---
|
|
2
|
-
name:
|
|
2
|
+
name: po-runner
|
|
3
3
|
description: 'Manage long-running commands started by bash: dev servers, watchers, builds, tails, and anything that prompts for input. Trigger when a command needs to outlive the current turn, when bash output was truncated, or when a background process needs to be inspected, followed, given input, or stopped.'
|
|
4
4
|
---
|
|
5
5
|
|
|
6
|
-
#
|
|
6
|
+
# po-runner
|
|
7
7
|
|
|
8
8
|
`bash` supervises what it starts. A command that outlives the background
|
|
9
|
-
threshold keeps running instead of blocking the turn. Use the `
|
|
9
|
+
threshold keeps running instead of blocking the turn. Use the `po-runner`
|
|
10
10
|
CLI to manage it without adding another model tool.
|
|
11
11
|
|
|
12
12
|
## Backgrounding
|
|
13
13
|
|
|
14
|
-
- A command still running after 60 seconds (`
|
|
14
|
+
- A command still running after 60 seconds (`PO_RUNNER_BG_THRESHOLD_MS`) is
|
|
15
15
|
moved to the background automatically. You get its unique ID and streaming
|
|
16
16
|
log path.
|
|
17
17
|
- Pass `background: true` for commands you already know will not finish: dev
|
|
18
18
|
servers, watchers, `tail -f`. Waiting out the threshold first wastes a turn.
|
|
19
19
|
- Pass `interactive: true` when the command will prompt for confirmation or
|
|
20
20
|
input. It runs under a terminal and backgrounds immediately. Answer it with
|
|
21
|
-
`
|
|
21
|
+
`po-runner input <id> --text <text> --enter`, or use Runner Space.
|
|
22
22
|
- Pass `timeout` (seconds) when you want a command killed rather than
|
|
23
23
|
supervised. A timeout above the threshold has no effect: the command is
|
|
24
24
|
promoted first.
|
|
@@ -33,19 +33,19 @@ session's runners. A manual shell without `PI_SESSION_ID` fails closed.
|
|
|
33
33
|
|
|
34
34
|
Use the unique runner ID returned by `bash`:
|
|
35
35
|
|
|
36
|
-
| Command
|
|
37
|
-
|
|
|
38
|
-
| `
|
|
39
|
-
| `
|
|
40
|
-
| `
|
|
41
|
-
| `
|
|
42
|
-
| `
|
|
43
|
-
| `
|
|
36
|
+
| Command | Purpose |
|
|
37
|
+
| ------------------------------------------------ | ---------------------------------------------- |
|
|
38
|
+
| `po-runner list [--all]` | List active runners, or include completed ones |
|
|
39
|
+
| `po-runner status <id>` | Show command, state, backend, and log path |
|
|
40
|
+
| `po-runner logs <id> [--lines N] [--follow]` | Read or stream the saved log |
|
|
41
|
+
| `po-runner stop <id> [--reason <text>]` | Stop one runner and keep its log |
|
|
42
|
+
| `po-runner stop-all [--reason <text>]` | Stop active runners owned by this Pi session |
|
|
43
|
+
| `po-runner input <id> [--text <text>] [--enter]` | Send input to an interactive RMUX runner |
|
|
44
44
|
|
|
45
45
|
## Rules
|
|
46
46
|
|
|
47
47
|
- **Read the log, do not re-run the command.** When output is truncated, the
|
|
48
|
-
full text is already on disk. Use `
|
|
48
|
+
full text is already on disk. Use `po-runner logs <id>` or standard file
|
|
49
49
|
search tools against the reported path.
|
|
50
50
|
- **Read the truncation notice before reading the file.** It states the real
|
|
51
51
|
file size and line count, so you do not read past the end.
|
|
@@ -65,7 +65,7 @@ Use the unique runner ID returned by `bash`:
|
|
|
65
65
|
## Where things live
|
|
66
66
|
|
|
67
67
|
Run metadata and logs sit under
|
|
68
|
-
`$PI_CODING_AGENT_DIR/
|
|
68
|
+
`$PI_CODING_AGENT_DIR/po-runner/<session-id>/{runs,logs}`. Without an
|
|
69
69
|
override, `$PI_CODING_AGENT_DIR` defaults to `~/.po/agent`. Completed metadata
|
|
70
70
|
and complete raw logs remain readable for seven days.
|
|
71
71
|
|
|
@@ -1,9 +1,9 @@
|
|
|
1
1
|
---
|
|
2
2
|
name: po-use-runner
|
|
3
|
-
description: Use
|
|
3
|
+
description: Use Po Pi Runner to supervise shell commands, inspect durable logs, provide interactive input, and stop background runs.
|
|
4
4
|
---
|
|
5
5
|
|
|
6
|
-
# Use
|
|
6
|
+
# Use Po Pi Runner
|
|
7
7
|
|
|
8
8
|
Use Runner for shell work that may outlive one tool call, needs durable logs, or requires later inspection and control.
|
|
9
9
|
|
|
@@ -22,12 +22,12 @@ bound session; do not supply another session ID. `/runners` and `SPC r l` are
|
|
|
22
22
|
local TUI interfaces, not shell commands or remote tools. For direct control, use:
|
|
23
23
|
|
|
24
24
|
```bash
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
25
|
+
po-runner list
|
|
26
|
+
po-runner status <runner-id>
|
|
27
|
+
po-runner logs <runner-id> --lines 100
|
|
28
|
+
po-runner input <runner-id> --text "y" --enter
|
|
29
|
+
po-runner stop <runner-id>
|
|
30
|
+
po-runner stop-all
|
|
31
31
|
```
|
|
32
32
|
|
|
33
33
|
Input requires a running interactive process backed by RMUX. Preserve the returned runner identifier because it remains usable after transcript compaction.
|
|
@@ -36,12 +36,12 @@ Input requires a running interactive process backed by RMUX. Preserve the return
|
|
|
36
36
|
|
|
37
37
|
Remote MCP never receives runner completion notices, and a runner you start
|
|
38
38
|
does not resume your conversation when it ends. While a runner matters to your
|
|
39
|
-
task, check `
|
|
40
|
-
`
|
|
39
|
+
task, check `po-runner status <id>` between steps of your own work and read
|
|
40
|
+
`po-runner logs <id> --lines 100`. Stop checking when State is completed, and
|
|
41
41
|
report a runner that is still running with its identifier. Do not promise
|
|
42
42
|
automatic follow-up or relaunch uncertain work.
|
|
43
43
|
|
|
44
44
|
- Inspect logs instead of relaunching a command whose status is uncertain.
|
|
45
45
|
- Stop watchers, servers, and failed interactive processes when they are no longer needed.
|
|
46
|
-
- Treat commands as running with the
|
|
46
|
+
- Treat commands as running with the Po Pi process environment and the operating-system user's privileges.
|
|
47
47
|
- Treat logs as sensitive because they may contain prompts, source, output, or credentials.
|