@yusukeshib/pi-babysit 0.2.1 → 0.2.2
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/index.ts +19 -0
- package/package.json +1 -1
package/index.ts
CHANGED
|
@@ -1197,6 +1197,8 @@ export default function (pi: ExtensionAPI) {
|
|
|
1197
1197
|
label: "Babysit: run",
|
|
1198
1198
|
description:
|
|
1199
1199
|
"Start a supervised background session under babysit (NON-BLOCKING; returns a session id). " +
|
|
1200
|
+
"In non-interactive mode (`pi -p`, no UI) process mode instead BLOCKS until the command " +
|
|
1201
|
+
"exits and returns its output inline — there is no notification loop to resume a parked turn. " +
|
|
1200
1202
|
"Two modes: (1) `command` — run any long-lived or slow command (build, tests, dev server, " +
|
|
1201
1203
|
"watcher, interactive TUI) in a PTY; you get an AUTOMATIC notification when it exits, and " +
|
|
1202
1204
|
"you can type into it with babysit_send and read its screen with babysit_check. " +
|
|
@@ -1311,6 +1313,23 @@ export default function (pi: ExtensionAPI) {
|
|
|
1311
1313
|
};
|
|
1312
1314
|
}
|
|
1313
1315
|
await refreshWidget(ctx);
|
|
1316
|
+
|
|
1317
|
+
// One-shot / non-interactive mode (e.g. `pi -p`): there is no live
|
|
1318
|
+
// event loop to deliver the exit notification, and ending the turn
|
|
1319
|
+
// would exit pi entirely — orphaning the babysat process and losing
|
|
1320
|
+
// the session (the agent "settles" the moment it is told the turn will
|
|
1321
|
+
// stop). So block inline like a normal command and return the full
|
|
1322
|
+
// outcome in THIS turn. The process still runs under babysit (logged,
|
|
1323
|
+
// killable), we just wait for it here instead of fire-and-forget.
|
|
1324
|
+
if (!ctx.hasUI) {
|
|
1325
|
+
const outcome = await waitForExit(res.id, parseDurMs(params.timeout), _signal);
|
|
1326
|
+
return {
|
|
1327
|
+
content: [{ type: "text", text: outcome.text }],
|
|
1328
|
+
isError: !outcome.ok,
|
|
1329
|
+
details: { id: res.id, kind: "process", command: params.command },
|
|
1330
|
+
};
|
|
1331
|
+
}
|
|
1332
|
+
|
|
1314
1333
|
const continueAfter = params.continueAfterStart === true;
|
|
1315
1334
|
const nextStep = continueAfter
|
|
1316
1335
|
? "Continue with specific non-polling work now; the exit notification will arrive on its own."
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@yusukeshib/pi-babysit",
|
|
3
|
-
"version": "0.2.
|
|
3
|
+
"version": "0.2.2",
|
|
4
4
|
"description": "Run anything long-lived under babysit — one supervision substrate for processes and pi subagents, surfaced to the agent as babysit_run/check/send/wait/kill.",
|
|
5
5
|
"keywords": [
|
|
6
6
|
"pi-package",
|