mirror of
https://github.com/jparkerweb/plan2code.git
synced 2026-11-17 04:45:33 -08:00
Update the web console server, screens, help, prefs and loop setup, with matching page and logic suites
AI Assisted
This commit is contained in:
1 parent
2468027a5a
commit
8e34bf1005
119 files changed
+9957
-3728
No files matched your search
@@ -109,6 +109,28 @@ export function safeJson(s) {
|
||||
}
|
||||
}
|
||||
|
||||
// One wait slice of a session, parsed: { code, out } where out is the last
|
||||
// stdout line as JSON (null when it is not). Exit 10 and 20 are results here,
|
||||
// not failures.
|
||||
export function waitOnce(sid, seconds = 5, opts) {
|
||||
const res = cli(["wait", "--session", sid, "--seconds", String(seconds)], opts);
|
||||
return { code: res.status, out: res.json, stdout: res.stdout, stderr: res.stderr };
|
||||
}
|
||||
|
||||
// The last non-empty line of a command's stdout: `post --wait` prints the
|
||||
// post's line, then the wait's.
|
||||
export const lastLine = (stdout) => String(stdout).trim().split("\n").filter(Boolean).pop() ?? "";
|
||||
|
||||
// End one session the way an agent must: a finish first, then stop. A test
|
||||
// that only wants a session gone for cleanup may pass --force to stop instead.
|
||||
export function stopSession(sid, opts) {
|
||||
postFinish(sid, opts);
|
||||
return cli(["stop", "--session", sid], opts);
|
||||
}
|
||||
function postFinish(sid, opts) {
|
||||
cli(["post", "--session", sid, "--file", payload(`finish-${sid}.json`, { finish: { headline: "Test done" } })], opts);
|
||||
}
|
||||
|
||||
export function payload(file, obj) {
|
||||
const p = path.join(HOME, file);
|
||||
fs.writeFileSync(p, JSON.stringify(obj));
|
||||
|
||||
Reference in new issue
Block a user