pi-straw-boss 0.88.0 → 0.88.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/dist/server/main.mjs +2 -1
- package/package.json +1 -1
- package/src/runmode.ts +10 -1
- package/src/server/runs.ts +1 -1
- package/src/server/towers.ts +1 -0
package/dist/server/main.mjs
CHANGED
|
@@ -26948,7 +26948,7 @@ Its .pi settings, extensions, skills, and prompts load only if you trust it. Yes
|
|
|
26948
26948
|
a.graceUntil = void 0;
|
|
26949
26949
|
markBossIn(a);
|
|
26950
26950
|
bossTurn2(a);
|
|
26951
|
-
return { ok: true };
|
|
26951
|
+
return { ok: true, idleMs: t.bossAway, capAt: a.bossSince + t.bossMax };
|
|
26952
26952
|
}
|
|
26953
26953
|
function bossOver(a) {
|
|
26954
26954
|
return a.terminating !== void 0 || a.bossSince !== void 0 && now() - a.bossSince >= t.bossMax;
|
|
@@ -28391,6 +28391,7 @@ function createTowers(o) {
|
|
|
28391
28391
|
const tab = await createTab(run3, ws, record2.cwd ?? slot.stateDir, [], TOWER_LABEL);
|
|
28392
28392
|
await report(run3, "pane", tab.paneId, { sb_role: "tower" }).catch(() => {
|
|
28393
28393
|
});
|
|
28394
|
+
await cfg.api("tab.move", { tab_id: tab.tabId, insert_index: 0 }).catch((cause) => error("tab-move", cause.message));
|
|
28394
28395
|
record2 = { ...record2, pane: tab.paneId, tab: tab.tabId };
|
|
28395
28396
|
}
|
|
28396
28397
|
writeService(slot, record2);
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "pi-straw-boss",
|
|
3
|
-
"version": "0.88.
|
|
3
|
+
"version": "0.88.2",
|
|
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/runmode.ts
CHANGED
|
@@ -490,7 +490,14 @@ export function createRunMode(kit: Kit, look: ServerLook | undefined, deps: RunS
|
|
|
490
490
|
bossSign = cfg.now();
|
|
491
491
|
// Not waited for: pi takes the boss's words only after this handler, and a round trip here would let the run's own event start a turn first and the words be refused as "already processing". The request goes out now;
|
|
492
492
|
// a tower_done waits for it (below), so it is heard before the model can end the run. A server that did not hear is asked again at their next words.
|
|
493
|
-
|
|
493
|
+
const mine = epoch, sign = bossSign;
|
|
494
|
+
signing = call({ cmd: "run-boss" }).then(({ idleMs }) => {
|
|
495
|
+
if (mine !== epoch || sign !== bossSign) return;
|
|
496
|
+
const minutes = typeof idleMs === "number" ? idleMs / 60_000 : undefined;
|
|
497
|
+
ctx?.ui.setStatus("tower-autoclose", minutes === undefined ? undefined : localeOf(env, guiDir) === "zh-TW"
|
|
498
|
+
? `塔台:你停止輸入 ${minutes} 分鐘後會自動收尾關閉;要立刻結束請打 /quit`
|
|
499
|
+
: `Tower: closes on its own ${minutes} min after you stop typing; /quit ends it now`);
|
|
500
|
+
}).catch(() => { if (mine === epoch && sign === bossSign) bossSign = undefined; });
|
|
494
501
|
});
|
|
495
502
|
pi.on("agent_start", () => void ((inTurn = true), (triggered = undefined), (turnStarter = startedBy), (startedBy = undefined), (turnTyped = startedTyped), (startedTyped = undefined)));
|
|
496
503
|
pi.on("agent_settled", () => void ((inTurn = false), (bossTurn = false), (turnStarter = undefined), (turnTyped = undefined), flushQuit()));
|
|
@@ -619,6 +626,8 @@ export function createRunMode(kit: Kit, look: ServerLook | undefined, deps: RunS
|
|
|
619
626
|
});
|
|
620
627
|
pi.on("session_shutdown", async (event) => {
|
|
621
628
|
epoch++;
|
|
629
|
+
if (bossTyped) ctx?.ui.setStatus("tower-autoclose", undefined);
|
|
630
|
+
bossSign = undefined;
|
|
622
631
|
deciding = undefined;
|
|
623
632
|
clearInterval(timer);
|
|
624
633
|
timer = undefined;
|
package/src/server/runs.ts
CHANGED
|
@@ -1530,7 +1530,7 @@ export function createRuns(o: RunsOptions) {
|
|
|
1530
1530
|
a.graceUntil = undefined;
|
|
1531
1531
|
markBossIn(a);
|
|
1532
1532
|
bossTurn(a);
|
|
1533
|
-
return { ok: true as const };
|
|
1533
|
+
return { ok: true as const, idleMs: t.bossAway, capAt: a.bossSince + t.bossMax };
|
|
1534
1534
|
}
|
|
1535
1535
|
/** The server is ending the run, or the boss's `bossMax` since their first word is spent: a sign of them changes nothing. */
|
|
1536
1536
|
function bossOver(a: Active) {
|
package/src/server/towers.ts
CHANGED
|
@@ -1111,6 +1111,7 @@ export function createTowers(o: TowersOptions): Towers {
|
|
|
1111
1111
|
if (view) {
|
|
1112
1112
|
const tab = await createTab(run, ws, record.cwd ?? slot.stateDir, [], TOWER_LABEL);
|
|
1113
1113
|
await report(run, "pane", tab.paneId, { sb_role: "tower" }).catch(() => {});
|
|
1114
|
+
await cfg.api("tab.move", { tab_id: tab.tabId, insert_index: 0 }).catch((cause: Error) => error("tab-move", cause.message));
|
|
1114
1115
|
record = { ...record, pane: tab.paneId, tab: tab.tabId };
|
|
1115
1116
|
}
|
|
1116
1117
|
writeService(slot, record);
|