pi-straw-boss 0.80.15 → 0.80.16
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.
|
@@ -2576,8 +2576,8 @@ function listenControl({ endpoint, secret, hello, handle, refused: refused3, idl
|
|
|
2576
2576
|
conn.on("close", () => sockets.delete(conn));
|
|
2577
2577
|
conn.on("error", () => {
|
|
2578
2578
|
});
|
|
2579
|
-
|
|
2580
|
-
|
|
2579
|
+
let buffer = "", state = "new", clientNonce = "", work = Promise.resolve(), inFlight = 0;
|
|
2580
|
+
conn.setEncoding("utf8").setTimeout(idleMs, () => inFlight === 0 && conn.destroy());
|
|
2581
2581
|
const serverNonce = randomBytes7(16).toString("hex");
|
|
2582
2582
|
const wait = setTimeout(() => state !== "authed" && refuse3(conn, "no proof"), HELLO_MS);
|
|
2583
2583
|
wait.unref();
|
|
@@ -2620,6 +2620,7 @@ function listenControl({ endpoint, secret, hello, handle, refused: refused3, idl
|
|
|
2620
2620
|
`);
|
|
2621
2621
|
continue;
|
|
2622
2622
|
}
|
|
2623
|
+
inFlight++;
|
|
2623
2624
|
work = work.then(async () => {
|
|
2624
2625
|
let reply;
|
|
2625
2626
|
try {
|
|
@@ -2627,6 +2628,7 @@ function listenControl({ endpoint, secret, hello, handle, refused: refused3, idl
|
|
|
2627
2628
|
} catch (error) {
|
|
2628
2629
|
reply = { ok: false, error: error.message };
|
|
2629
2630
|
}
|
|
2631
|
+
inFlight--;
|
|
2630
2632
|
if (!conn.destroyed) conn.write(`${JSON.stringify(reply)}
|
|
2631
2633
|
`, () => reply[AFTER]?.());
|
|
2632
2634
|
else reply[AFTER]?.();
|
package/dist/server/cli.mjs
CHANGED
package/dist/server/main.mjs
CHANGED
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "pi-straw-boss",
|
|
3
|
-
"version": "0.80.
|
|
3
|
+
"version": "0.80.16",
|
|
4
4
|
"description": "Straw Boss coordination for pi in Herdr: sessions join a tab's net by choice, the first joiner is its main agent, a workspace tower opens on demand with a live monitoring dashboard, and boss_broadcast reaches the rest",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"license": "MIT",
|
package/src/server/socket.ts
CHANGED
|
@@ -86,8 +86,9 @@ export function listenControl({ endpoint, secret, hello, handle, refused, idleMs
|
|
|
86
86
|
sockets.add(conn);
|
|
87
87
|
conn.on("close", () => sockets.delete(conn));
|
|
88
88
|
conn.on("error", () => {});
|
|
89
|
-
|
|
90
|
-
let buffer = "", state: "new" | "challenged" | "authed" | "closed" = "new", clientNonce = "", work: Promise<void> = Promise.resolve();
|
|
89
|
+
// Idle means no request in flight: a `landed` or `received` check may fetch a base for minutes, and closing its connection loses the answer while the check goes on (0.80.15 FE2).
|
|
90
|
+
let buffer = "", state: "new" | "challenged" | "authed" | "closed" = "new", clientNonce = "", work: Promise<void> = Promise.resolve(), inFlight = 0;
|
|
91
|
+
conn.setEncoding("utf8").setTimeout(idleMs, () => inFlight === 0 && conn.destroy());
|
|
91
92
|
const serverNonce = randomBytes(16).toString("hex");
|
|
92
93
|
const wait = setTimeout(() => state !== "authed" && refuse(conn, "no proof"), HELLO_MS);
|
|
93
94
|
wait.unref();
|
|
@@ -129,6 +130,7 @@ export function listenControl({ endpoint, secret, hello, handle, refused, idleMs
|
|
|
129
130
|
continue;
|
|
130
131
|
}
|
|
131
132
|
// Requests on one connection are answered in order, each with one line.
|
|
133
|
+
inFlight++;
|
|
132
134
|
work = work.then(async () => {
|
|
133
135
|
let reply: Reply;
|
|
134
136
|
try {
|
|
@@ -136,6 +138,7 @@ export function listenControl({ endpoint, secret, hello, handle, refused, idleMs
|
|
|
136
138
|
} catch (error) {
|
|
137
139
|
reply = { ok: false, error: (error as Error).message };
|
|
138
140
|
}
|
|
141
|
+
inFlight--;
|
|
139
142
|
if (!conn.destroyed) conn.write(`${JSON.stringify(reply)}\n`, () => reply[AFTER]?.());
|
|
140
143
|
else reply[AFTER]?.();
|
|
141
144
|
});
|
package/src/server/watchread.ts
CHANGED
|
@@ -7,7 +7,7 @@ import type { YardTrainRow } from "../train/yardview.ts";
|
|
|
7
7
|
import type { Reply } from "./socket.ts";
|
|
8
8
|
|
|
9
9
|
// The sb server's `watch-read` route (docs/specs/2026-11-09-agent-kinds.md §10): a watchdog child's long poll on one unit of this computer's net. A request is held until a reading of the net gives a verdict other than `unchanged`, until its
|
|
10
|
-
// deadline, or until the hold's own timer (45 s
|
|
10
|
+
// deadline, or until the hold's own timer (45 s; the control socket's idle close skips a connection with a request in flight since 0.80.16), which answers with the last reading and waits for no further one. A hold costs one compare per reading.
|
|
11
11
|
//
|
|
12
12
|
// What wakes a hold is state only: the unit's mark, each monitor's status and exit, todo progress, a train's steps and waits, the subagents' marks, and the unit leaving the net. Output lines, a monitor's last line, notes, ticks, and load
|
|
13
13
|
// readings wake nothing; they move the quiet clock, which gives `stalled` once per quiet spell when the request names `quietMs`. A monitor whose newest progress line carries a load over the limit gives `load` once per crossing.
|