pi-straw-boss 0.113.0 → 0.113.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.
Files changed (2) hide show
  1. package/package.json +1 -1
  2. package/src/balance.mjs +4 -4
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "pi-straw-boss",
3
- "version": "0.113.0",
3
+ "version": "0.113.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/balance.mjs CHANGED
@@ -169,12 +169,12 @@ const paneGone = (paneId, run) =>
169
169
  * @param {string | undefined} tabId
170
170
  * @param {{ run?: Run, lockRoot?: string, pollMs?: number, waitMs?: number }} [options]
171
171
  */
172
- export async function balanceAfterClose(paneId, tabId, { run = herdr, lockRoot = LOCK_ROOT, pollMs = POLL_MS, waitMs = CLOSE_WAIT_MS } = {}) {
172
+ export async function balanceAfterClose(paneId, tabId, { run = herdr, lockRoot = LOCK_ROOT, pollMs = POLL_MS, waitMs = CLOSE_WAIT_MS, now = Date.now, sleep: wait = sleep } = {}) {
173
173
  if (!tabId) return;
174
- const deadline = Date.now() + waitMs;
174
+ const deadline = now() + waitMs;
175
175
  while (!(await paneGone(paneId, run))) {
176
- if (Date.now() > deadline) return;
177
- await sleep(pollMs);
176
+ if (now() > deadline) return;
177
+ await wait(pollMs);
178
178
  }
179
179
  const panes = /** @type {{ pane_id: string, tab_id: string }[]} */ (JSON.parse(await run(["pane", "list"])).result.panes);
180
180
  const anchor = panes.find((pane) => pane.tab_id === tabId);