pi-straw-boss 0.40.0 → 0.40.1
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/package.json +1 -1
- package/src/session.ts +2 -2
- package/src/state.ts +1 -1
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "pi-straw-boss",
|
|
3
|
-
"version": "0.40.
|
|
3
|
+
"version": "0.40.1",
|
|
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/session.ts
CHANGED
|
@@ -49,7 +49,7 @@ export function registerSession(kit: Kit, { briefing, presence, membership, guar
|
|
|
49
49
|
const mine = (await panes(run, s.at.workspaceId).catch(() => [])).find((p) => p.pane_id === s.at.paneId);
|
|
50
50
|
if (mine?.tokens?.sb_open_main !== "1") return false;
|
|
51
51
|
s.openedBy = mine.tokens.sb_opened_by;
|
|
52
|
-
pi.appendEntry(ENTRY, { openedBy: s.openedBy }); // a
|
|
52
|
+
pi.appendEntry(ENTRY, { openedBy: s.openedBy ?? null, openedPane: s.at.paneId }); // null, not undefined: a later claim (a pop) overrides an earlier opener
|
|
53
53
|
await report(run, "pane", s.at.paneId, { sb_open_main: null }).catch(() => {});
|
|
54
54
|
return true;
|
|
55
55
|
};
|
|
@@ -62,7 +62,6 @@ export function registerSession(kit: Kit, { briefing, presence, membership, guar
|
|
|
62
62
|
briefing.load();
|
|
63
63
|
s.saved = Object.assign({}, ...ctx.sessionManager.getBranch().flatMap((e) => (e.type === "custom" && e.customType === ENTRY ? [e.data] : [])));
|
|
64
64
|
s.isTower ||= Boolean(s.saved.tower);
|
|
65
|
-
s.openedBy ||= s.saved.openedBy;
|
|
66
65
|
const log = ctx.sessionManager;
|
|
67
66
|
stopWatching();
|
|
68
67
|
nudges = orphans({ run, file: () => log.getSessionFile(), entries: () => log.getEntries(), sessions: host.sessions, send: reach.send, type: ENTRY, remember: (key) => pi.appendEntry(ENTRY, { nudged: key }), me, tell });
|
|
@@ -83,6 +82,7 @@ export function registerSession(kit: Kit, { briefing, presence, membership, guar
|
|
|
83
82
|
starting = membership.joinNet().then(async () => {
|
|
84
83
|
note(`${who()} joined tab ${s.info.tab}`);
|
|
85
84
|
const claimed = await claimOpened();
|
|
85
|
+
if (!claimed && event.reason !== "startup" && s.saved.openedBy && s.saved.openedPane === s.at.paneId) s.openedBy = s.saved.openedBy; // only the same pi in the tower's pane (/reload, /fork): `pi --session` anywhere is the boss's main
|
|
86
86
|
if (s.openedBy) {
|
|
87
87
|
control.register(); // the tower that opened this main may ask it to close (closemain.ts), also after a reload
|
|
88
88
|
await presence.publish(); // sb_opened_by was cleared at shutdown
|
package/src/state.ts
CHANGED
|
@@ -24,7 +24,7 @@ export interface Channel {
|
|
|
24
24
|
listSessions(): Promise<Session[]>;
|
|
25
25
|
}
|
|
26
26
|
export interface SendResult { requestId?: string; status: string; code?: string; detail?: string }
|
|
27
|
-
export interface Saved { tower?: boolean; openedBy?: string }
|
|
27
|
+
export interface Saved { tower?: boolean; openedBy?: string | null; openedPane?: string }
|
|
28
28
|
export type Role = "tower" | "main" | "member";
|
|
29
29
|
export type Scope = "tab" | "workspace" | "towers" | "all";
|
|
30
30
|
/**
|