@usebitl/cli 0.1.12 → 0.1.13

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.
@@ -467,7 +467,7 @@ function readCloudConfig(home = bitlHome()) {
467
467
  }
468
468
  }
469
469
  function clientVersionHeader() {
470
- const v = "0.1.12";
470
+ const v = "0.1.13";
471
471
  return v ? { "x-bitl-client": v } : {};
472
472
  }
473
473
  function resolveTarget(home = bitlHome()) {
@@ -20061,7 +20061,7 @@ function removeCloudLogin(home = bitlHome()) {
20061
20061
  rmSync(cloudKeyPath(home), { force: true });
20062
20062
  }
20063
20063
  function clientVersionHeader() {
20064
- const v = "0.1.12";
20064
+ const v = "0.1.13";
20065
20065
  return v ? { "x-bitl-client": v } : {};
20066
20066
  }
20067
20067
  function resolveTarget(home = bitlHome()) {
@@ -20118,7 +20118,7 @@ async function latestVersion(home, now) {
20118
20118
  return latest;
20119
20119
  }
20120
20120
  var updateCommand = (install = process.env.BITL_INSTALL) => install === "npx" ? "npx @usebitl/cli@latest start" : "npm i -g @usebitl/cli";
20121
- async function checkCliUpdate(current = "0.1.12", opts = {}) {
20121
+ async function checkCliUpdate(current = "0.1.13", opts = {}) {
20122
20122
  if (!current || process.env.BITL_NO_UPDATE_CHECK === "1") return void 0;
20123
20123
  const latest = await latestVersion(opts.home ?? bitlHome(), opts.now ?? Date.now());
20124
20124
  if (!latest || compareVersions(latest, current) <= 0) return void 0;
@@ -11,7 +11,7 @@ import {
11
11
  isEmptySession,
12
12
  parseWireRecord,
13
13
  sessionKey
14
- } from "./chunk-ERXNJMQT.mjs";
14
+ } from "./chunk-VVNOFPMO.mjs";
15
15
 
16
16
  // ../../../node_modules/.pnpm/bn.js@4.12.5/node_modules/bn.js/lib/bn.js
17
17
  var require_bn = __commonJS({
@@ -9004,6 +9004,7 @@ var PushStore = class {
9004
9004
  // ../../server/src/state.ts
9005
9005
  var STALE_AFTER_MS = 10 * 60 * 1e3;
9006
9006
  var PERMISSION_RACE_MS = 2e3;
9007
+ var QUIET_EVENTS = /* @__PURE__ */ new Set(["session_start", "session_end", "notice"]);
9007
9008
  function newSession(e) {
9008
9009
  return {
9009
9010
  key: sessionKey(e.source, e.sessionId),
@@ -9037,6 +9038,7 @@ function applyEvent(prev, e, c = {}) {
9037
9038
  else s.enc[field] = value;
9038
9039
  };
9039
9040
  if (e.at > s.lastEventAt) s.lastEventAt = e.at;
9041
+ if (s.cleared && !late && !QUIET_EVENTS.has(e.type) && e.waitingReason !== "idle") delete s.cleared;
9040
9042
  for (const field of ["cwd", "project", "gitBranch", "aiTitle", "model"]) if (c[field]) put(field, c[field]);
9041
9043
  const fromSubagent = Boolean(e.agentId) && e.type !== "subagent_start" && e.type !== "subagent_end";
9042
9044
  if (e.requestTag && e.type !== "prompt" && e.requestTag !== s.lastPromptTag) {
@@ -9326,6 +9328,19 @@ var SqlStore = class _SqlStore {
9326
9328
  }
9327
9329
  return n;
9328
9330
  }
9331
+ async clearBoard(accountId) {
9332
+ const deleted = await this.deleteEnded(accountId);
9333
+ const { rows } = await this.db.query(`SELECT key FROM sessions WHERE account_id = ? AND status != 'ended' AND archived = 0`, [accountId]);
9334
+ let cleared = 0;
9335
+ for (const r of rows) {
9336
+ await this.update(accountId, r.key, (cur) => {
9337
+ if (cur.cleared || cur.archived) return null;
9338
+ cleared++;
9339
+ return { ...cur, cleared: true };
9340
+ });
9341
+ }
9342
+ return { deleted, cleared };
9343
+ }
9329
9344
  async sweepStale(now3 = /* @__PURE__ */ new Date()) {
9330
9345
  const { rows } = await this.db.query(`SELECT account_id, key FROM sessions WHERE status = 'running'`);
9331
9346
  let n = 0;
@@ -12188,6 +12203,15 @@ function createApp({ store, webDist, account, push, approvals, goals, access = a
12188
12203
  const keys = Array.isArray(body?.keys) ? body.keys.filter((k) => typeof k === "string").slice(0, 5e3) : void 0;
12189
12204
  return c.json({ deleted: await store.deleteEnded(c.var.accountId, keys) });
12190
12205
  });
12206
+ app.post("/api/board/clear", async (c) => {
12207
+ const body = await c.req.json().catch(() => ({}));
12208
+ const result = await store.clearBoard(c.var.accountId);
12209
+ let goalsDeleted = 0;
12210
+ if (body?.goals === true && goals) {
12211
+ for (const g of await goals.list(c.var.accountId, true)) if (await goals.delete(c.var.accountId, g.id)) goalsDeleted++;
12212
+ }
12213
+ return c.json({ ...result, goals: goalsDeleted });
12214
+ });
12191
12215
  app.post("/api/sessions/:key/ack", async (c) => found(c, await store.acknowledge(c.var.accountId, c.req.param("key"))));
12192
12216
  app.post(
12193
12217
  "/api/sessions/:key/archive",
@@ -12356,13 +12380,13 @@ function startPushNotifier(opts) {
12356
12380
  };
12357
12381
  const notify = async (accountId, s) => {
12358
12382
  if (!(await push.list(accountId)).length) return;
12359
- const attention = (await store.listSessions(accountId)).filter((x) => ALERT.has(x.status) && !isEmptySession(x)).length;
12383
+ const attention = (await store.listSessions(accountId)).filter((x) => ALERT.has(x.status) && !isEmptySession(x) && !x.cleared).length;
12360
12384
  await sendAll(accountId, buildPayload(s, attention), topicOf(s.key));
12361
12385
  };
12362
12386
  const off = store.subscribe((change) => {
12363
12387
  if (change.type !== "session") return;
12364
12388
  const s = change.session;
12365
- if (!ALERT.has(s.status) || change.prevStatus === s.status || isEmptySession(s)) return;
12389
+ if (!ALERT.has(s.status) || change.prevStatus === s.status || isEmptySession(s) || s.cleared) return;
12366
12390
  const id = `${change.accountId}
12367
12391
  ${s.key}`;
12368
12392
  const t = Date.now();
package/dist/cli.mjs CHANGED
@@ -21,7 +21,7 @@ import {
21
21
  unwrapMasterKey,
22
22
  verifyPublicKey,
23
23
  wrapMasterKey
24
- } from "./chunks/chunk-ERXNJMQT.mjs";
24
+ } from "./chunks/chunk-VVNOFPMO.mjs";
25
25
 
26
26
  // ../src/index.ts
27
27
  import { homedir as homedir2 } from "node:os";
@@ -453,7 +453,7 @@ async function logout() {
453
453
  }
454
454
 
455
455
  // ../src/update.ts
456
- async function updateNotice(current = "0.1.12") {
456
+ async function updateNotice(current = "0.1.13") {
457
457
  const u = await checkCliUpdate(current);
458
458
  return u && `${t("update.available", { ...u })}
459
459
  ${t("update.changelog")}`;
@@ -609,7 +609,7 @@ async function main(argv) {
609
609
  if (String(typeof warning === "string" ? warning : warning.message).startsWith("SQLite is an experimental feature")) return;
610
610
  emitWarning(warning, ...rest2);
611
611
  });
612
- const { startServer } = await import("./chunks/src-4IUSQVOL.mjs");
612
+ const { startServer } = await import("./chunks/src-MWG3MA6Y.mjs");
613
613
  await startServer();
614
614
  console.log(t("start.pair", { url: localPairUrl() }));
615
615
  return;
@@ -631,7 +631,7 @@ async function main(argv) {
631
631
  case "--version":
632
632
  case "-v":
633
633
  case "version":
634
- console.log("0.1.12");
634
+ console.log("0.1.13");
635
635
  return;
636
636
  case "remote":
637
637
  case "away":
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@usebitl/cli",
3
- "version": "0.1.12",
3
+ "version": "0.1.13",
4
4
  "description": "BITL — see which of your AI coding agents (Claude Code, Codex, Antigravity) are waiting for you. Local board or usebitl.com",
5
5
  "type": "module",
6
6
  "bin": {