vibebook.dev 1.6.15 → 1.6.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.
Files changed (2) hide show
  1. package/cli.mjs +25 -9
  2. package/package.json +1 -1
package/cli.mjs CHANGED
@@ -7,7 +7,7 @@ import { appendFileSync, chmodSync, closeSync, existsSync, fstatSync, mkdirSync,
7
7
  import { createServer } from "node:http";
8
8
  import { homedir, tmpdir } from "node:os";
9
9
  import { basename, dirname, join } from "node:path";
10
- var VERSION = "1.6.15";
10
+ var VERSION = "1.6.16";
11
11
  var HOME = process.env.VIBEBOOK_HOME || join(homedir(), ".vibebook");
12
12
  var SESSION = join(HOME, "session.json");
13
13
  var AGENTS = join(HOME, "agents.json");
@@ -533,7 +533,10 @@ function terminalApp() {
533
533
  }
534
534
  var flog = (m) => process.stdout.write(`${new Date().toLocaleTimeString()} ${m}
535
535
  `);
536
+ var fireGen = new Map;
536
537
  async function fireSwitch(room, on, agent, tools) {
538
+ const gen = (fireGen.get(room) ?? 0) + 1;
539
+ fireGen.set(room, gen);
537
540
  const report = (state, note = "") => callTool("fire_state", { room_id: room, state, note }, agent, tools).catch(() => {});
538
541
  const map = readJson(HERDR, {});
539
542
  const e = map[room];
@@ -552,16 +555,27 @@ async function fireSwitch(room, on, agent, tools) {
552
555
  }
553
556
  };
554
557
  if (!on) {
555
- if (alive)
556
- try {
557
- herdr("tab", "close", e.fire_tab);
558
- } catch {}
559
- save();
560
558
  flog(`fire off: ${room}`);
561
- return report("off");
559
+ await report("off");
560
+ if (!alive)
561
+ return save();
562
+ const tabId = e.fire_tab, until = Date.now() + 120000;
563
+ await new Promise((r) => setTimeout(r, 60000));
564
+ for (;; ) {
565
+ if (fireGen.get(room) !== gen)
566
+ return;
567
+ const p = herdr("pane", "list").panes.find((x) => x.tab_id === tabId);
568
+ if (!p || p.agent_status === "idle" || p.agent_status === "done" || Date.now() > until)
569
+ break;
570
+ await new Promise((r) => setTimeout(r, 3000));
571
+ }
572
+ try {
573
+ herdr("tab", "close", tabId);
574
+ } catch {}
575
+ return save();
562
576
  }
563
577
  if (alive)
564
- return report("switching", "Teu Haiku já está aberto; esperando ele ouvir.");
578
+ return report("ready", "Teu Haiku já estava aberto.");
565
579
  await report("switching", "Abrindo um Claude Haiku só pro Fire…");
566
580
  const tab = herdr("tab", "create", "--workspace", e.workspace, "--cwd", e.folder, "--label", "\uD83D\uDD25 fire", "--env", "VIBEBOOK_FIRE=1", ...process.env.VIBEBOOK_HOME ? ["--env", `VIBEBOOK_HOME=${process.env.VIBEBOOK_HOME}`] : [], "--no-focus");
567
581
  const tabId = tab.tab?.tab_id, pane = tab.root_pane?.pane_id;
@@ -1257,7 +1271,9 @@ ${(all.doc ?? "").slice(0, 2000)}
1257
1271
  for (const m of (all.messages ?? []).slice(-5))
1258
1272
  process.stdout.write(`#${m.id}${m.from_your_human ? " (teu humano)" : ""}: ${(m.text ?? "").replace(/\s+/g, " ").slice(0, 300)}
1259
1273
  `);
1260
- process.stdout.write(`---
1274
+ process.stdout.write(`--- ferramentas (vibebook call <nome> '{json}'; vibebook describe <nome> mostra os argumentos) ---
1275
+ ${tools.map((t) => t.name).join(", ")}
1276
+ ---
1261
1277
  `);
1262
1278
  try {
1263
1279
  writeFileSync(seen, "1");
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "vibebook.dev",
3
- "version": "1.6.15",
3
+ "version": "1.6.16",
4
4
  "description": "vibebook CLI: your vibebook rooms from the terminal, for you and your Claude. One login per machine; room tools discovered at run time.",
5
5
  "type": "module",
6
6
  "bin": { "vibebook": "cli.mjs" },