@usebitl/cli 0.1.10 → 0.1.12

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.10";
470
+ const v = "0.1.12";
471
471
  return v ? { "x-bitl-client": v } : {};
472
472
  }
473
473
  function resolveTarget(home = bitlHome()) {
@@ -491,7 +491,8 @@ function resolveTarget(home = bitlHome()) {
491
491
  // ../../shared/src/node/enrich.ts
492
492
  import { execFile } from "node:child_process";
493
493
  import { readFile as readFile2, stat as stat2 } from "node:fs/promises";
494
- import { basename } from "node:path";
494
+ import { homedir as homedir2 } from "node:os";
495
+ import { basename, join as join3 } from "node:path";
495
496
  var BRANCH_TTL_MS = 6e4;
496
497
  var MAX_TRANSCRIPT_BYTES2 = 20 * 1024 * 1024;
497
498
  var branchCache = /* @__PURE__ */ new Map();
@@ -526,6 +527,51 @@ async function titleFromTranscript(path) {
526
527
  return void 0;
527
528
  }
528
529
  }
530
+ async function codexThreadName(threadId, codexHome = process.env.CODEX_HOME?.trim() || join3(homedir2(), ".codex")) {
531
+ try {
532
+ const file = join3(codexHome, "session_index.jsonl");
533
+ if ((await stat2(file)).size > MAX_TRANSCRIPT_BYTES2) return void 0;
534
+ let name;
535
+ for (const line of (await readFile2(file, "utf8")).split("\n")) {
536
+ if (!line.includes(threadId)) continue;
537
+ try {
538
+ const rec = JSON.parse(line);
539
+ if (rec.id === threadId && rec.thread_name?.trim()) name = rec.thread_name.trim();
540
+ } catch {
541
+ }
542
+ }
543
+ return name;
544
+ } catch {
545
+ return void 0;
546
+ }
547
+ }
548
+ async function importSqliteQuietly() {
549
+ const emitWarning = process.emitWarning;
550
+ process.emitWarning = ((warning, ...rest) => {
551
+ if (String(typeof warning === "string" ? warning : warning.message).startsWith("SQLite is an experimental feature")) return;
552
+ emitWarning.call(process, warning, ...rest);
553
+ });
554
+ try {
555
+ return await import("node:sqlite");
556
+ } finally {
557
+ process.emitWarning = emitWarning;
558
+ }
559
+ }
560
+ async function antigravityTitle(conversationId, dbPath = join3(homedir2(), ".gemini", "antigravity-cli", "conversation_summaries.db")) {
561
+ try {
562
+ await stat2(dbPath);
563
+ const { DatabaseSync } = await importSqliteQuietly();
564
+ const db = new DatabaseSync(dbPath, { readOnly: true });
565
+ try {
566
+ const row = db.prepare("SELECT title FROM conversation_summaries WHERE conversation_id = ?").get(conversationId);
567
+ return typeof row?.title === "string" && row.title.trim() ? row.title.trim() : void 0;
568
+ } finally {
569
+ db.close();
570
+ }
571
+ } catch {
572
+ return void 0;
573
+ }
574
+ }
529
575
  function gitRoot(cwd) {
530
576
  const hit = rootCache.get(cwd);
531
577
  if (hit && Date.now() - hit.at < BRANCH_TTL_MS) return Promise.resolve(hit.root);
@@ -555,12 +601,14 @@ async function enrichEvent(e) {
555
601
  })
556
602
  );
557
603
  }
558
- if (e.source === "claude-code" && e.transcriptPath && (e.type === "prompt" || e.type === "turn_end")) {
559
- tasks.push(
560
- titleFromTranscript(e.transcriptPath).then((title) => {
561
- if (title) extra.aiTitle = title;
562
- })
563
- );
604
+ if (e.type === "prompt" || e.type === "turn_end") {
605
+ const title = e.source === "claude-code" && e.transcriptPath ? titleFromTranscript(e.transcriptPath) : e.source === "codex" ? codexThreadName(e.sessionId) : e.source === "antigravity" ? antigravityTitle(e.sessionId) : void 0;
606
+ if (title)
607
+ tasks.push(
608
+ title.then((t) => {
609
+ if (t) extra.aiTitle = t;
610
+ })
611
+ );
564
612
  }
565
613
  await Promise.all(tasks.map((t) => t.catch(() => {
566
614
  })));
@@ -124,6 +124,7 @@ async function keysFromBase64Url(master) {
124
124
  }
125
125
 
126
126
  // ../../shared/src/session.ts
127
+ var isEmptySession = (s) => s.turnCount === 0 && s.toolCount === 0;
127
128
  var sessionKey = (source, sessionId) => `${source}:${sessionId}`;
128
129
  var TITLE_LABELS = { locked: "\u{1F512} Can't be opened with this device's key", untitled: "(untitled)" };
129
130
  var displayTitle = (s, labels = TITLE_LABELS) => s.aiTitle ?? s.title ?? s.project ?? (s.locked ? labels.locked : labels.untitled);
@@ -20060,7 +20061,7 @@ function removeCloudLogin(home = bitlHome()) {
20060
20061
  rmSync(cloudKeyPath(home), { force: true });
20061
20062
  }
20062
20063
  function clientVersionHeader() {
20063
- const v = "0.1.10";
20064
+ const v = "0.1.12";
20064
20065
  return v ? { "x-bitl-client": v } : {};
20065
20066
  }
20066
20067
  function resolveTarget(home = bitlHome()) {
@@ -20117,7 +20118,7 @@ async function latestVersion(home, now) {
20117
20118
  return latest;
20118
20119
  }
20119
20120
  var updateCommand = (install = process.env.BITL_INSTALL) => install === "npx" ? "npx @usebitl/cli@latest start" : "npm i -g @usebitl/cli";
20120
- async function checkCliUpdate(current = "0.1.10", opts = {}) {
20121
+ async function checkCliUpdate(current = "0.1.12", opts = {}) {
20121
20122
  if (!current || process.env.BITL_NO_UPDATE_CHECK === "1") return void 0;
20122
20123
  const latest = await latestVersion(opts.home ?? bitlHome(), opts.now ?? Date.now());
20123
20124
  if (!latest || compareVersions(latest, current) <= 0) return void 0;
@@ -20150,6 +20151,7 @@ export {
20150
20151
  verifyPublicKey,
20151
20152
  wrapMasterKey,
20152
20153
  unwrapMasterKey,
20154
+ isEmptySession,
20153
20155
  sessionKey,
20154
20156
  displayTitle,
20155
20157
  openSession,
@@ -8,9 +8,10 @@ import {
8
8
  __require,
9
9
  __toESM,
10
10
  checkCliUpdate,
11
+ isEmptySession,
11
12
  parseWireRecord,
12
13
  sessionKey
13
- } from "./chunk-FQXPEVHB.mjs";
14
+ } from "./chunk-ERXNJMQT.mjs";
14
15
 
15
16
  // ../../../node_modules/.pnpm/bn.js@4.12.5/node_modules/bn.js/lib/bn.js
16
17
  var require_bn = __commonJS({
@@ -12293,8 +12294,8 @@ function mountPush(app, push) {
12293
12294
  }
12294
12295
 
12295
12296
  // ../../server/src/push.ts
12296
- var import_web_push = __toESM(require_src2(), 1);
12297
12297
  import { createHash } from "node:crypto";
12298
+ var import_web_push = __toESM(require_src2(), 1);
12298
12299
  function buildApprovalPayload(a) {
12299
12300
  const payload = { v: 1, kind: "approval", id: a.id, key: a.sessionKey, expiresAt: a.expiresAt, request: a.request };
12300
12301
  const json2 = JSON.stringify(payload);
@@ -12355,13 +12356,13 @@ function startPushNotifier(opts) {
12355
12356
  };
12356
12357
  const notify = async (accountId, s) => {
12357
12358
  if (!(await push.list(accountId)).length) return;
12358
- const attention = (await store.listSessions(accountId)).filter((x) => ALERT.has(x.status)).length;
12359
+ const attention = (await store.listSessions(accountId)).filter((x) => ALERT.has(x.status) && !isEmptySession(x)).length;
12359
12360
  await sendAll(accountId, buildPayload(s, attention), topicOf(s.key));
12360
12361
  };
12361
12362
  const off = store.subscribe((change) => {
12362
12363
  if (change.type !== "session") return;
12363
12364
  const s = change.session;
12364
- if (!ALERT.has(s.status) || change.prevStatus === s.status) return;
12365
+ if (!ALERT.has(s.status) || change.prevStatus === s.status || isEmptySession(s)) return;
12365
12366
  const id = `${change.accountId}
12366
12367
  ${s.key}`;
12367
12368
  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-FQXPEVHB.mjs";
24
+ } from "./chunks/chunk-ERXNJMQT.mjs";
25
25
 
26
26
  // ../src/index.ts
27
27
  import { homedir as homedir2 } from "node:os";
@@ -48,6 +48,7 @@ var ko = {
48
48
  "usage.loginDefault": "\uC774 PC \uB97C \uACC4\uC815\uC5D0 \uC5F0\uACB0 (\uBE0C\uB77C\uC6B0\uC800\uC5D0\uC11C \uC2B9\uC778, \uAE30\uBCF8 {url})",
49
49
  "usage.login": "\uC774 PC \uB97C \uD074\uB77C\uC6B0\uB4DC \uACC4\uC815\uC5D0 \uC5F0\uACB0 (\uBE0C\uB77C\uC6B0\uC800\uC5D0\uC11C \uC2B9\uC778)",
50
50
  "usage.logout": "\uC5F0\uACB0 \uD574\uC81C \u2192 \uB2E4\uC2DC \uB85C\uCEEC \uC11C\uBC84\uB85C",
51
+ "usage.version": "\uC124\uCE58\uB41C bitl \uBC84\uC804",
51
52
  "usage.installClaude": "Claude Code hook \uB4F1\uB85D (\uAE30\uBCF8: ~/.claude/settings.json)",
52
53
  "usage.installCodex": "Codex hook \uB4F1\uB85D (~/.codex/config.toml)",
53
54
  "usage.installAgy": "Antigravity hook \uB4F1\uB85D (~/.gemini/config/hooks.json, CLI\xB7IDE \uACF5\uC6A9)",
@@ -120,6 +121,7 @@ var en = {
120
121
  "usage.loginDefault": "Connect this PC to your account (approve in the browser; default {url})",
121
122
  "usage.login": "Connect this PC to your cloud account (approve in the browser)",
122
123
  "usage.logout": "Disconnect \u2192 back to the local server",
124
+ "usage.version": "Installed bitl version",
123
125
  "usage.installClaude": "Add Claude Code hooks (default: ~/.claude/settings.json)",
124
126
  "usage.installCodex": "Add Codex hooks (~/.codex/config.toml)",
125
127
  "usage.installAgy": "Add Antigravity hooks (~/.gemini/config/hooks.json, shared by CLI and IDE)",
@@ -451,7 +453,7 @@ async function logout() {
451
453
  }
452
454
 
453
455
  // ../src/update.ts
454
- async function updateNotice(current = "0.1.10") {
456
+ async function updateNotice(current = "0.1.12") {
455
457
  const u = await checkCliUpdate(current);
456
458
  return u && `${t("update.available", { ...u })}
457
459
  ${t("update.changelog")}`;
@@ -481,7 +483,9 @@ var usage = () => [
481
483
  ` bitl uninstall <claude|codex|antigravity${NPM_BUILD ? "" : "|claude-desktop"}> [--project D]`,
482
484
  "",
483
485
  row("bitl remote [on|off]", t("usage.remote")),
484
- row("", t("usage.remote2"))
486
+ row("", t("usage.remote2")),
487
+ "",
488
+ row("bitl --version", t("usage.version"))
485
489
  ].join("\n");
486
490
  var serverUrl = () => process.env.BITL_URL ?? `http://127.0.0.1:${process.env.BITL_PORT ?? 7777}`;
487
491
  function option(args, name) {
@@ -605,7 +609,7 @@ async function main(argv) {
605
609
  if (String(typeof warning === "string" ? warning : warning.message).startsWith("SQLite is an experimental feature")) return;
606
610
  emitWarning(warning, ...rest2);
607
611
  });
608
- const { startServer } = await import("./chunks/src-NKVNQ2RI.mjs");
612
+ const { startServer } = await import("./chunks/src-4IUSQVOL.mjs");
609
613
  await startServer();
610
614
  console.log(t("start.pair", { url: localPairUrl() }));
611
615
  return;
@@ -624,6 +628,11 @@ async function main(argv) {
624
628
  }
625
629
  case "logout":
626
630
  return logout();
631
+ case "--version":
632
+ case "-v":
633
+ case "version":
634
+ console.log("0.1.12");
635
+ return;
627
636
  case "remote":
628
637
  case "away":
629
638
  return away(rest[0]);
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@usebitl/cli",
3
- "version": "0.1.10",
3
+ "version": "0.1.12",
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": {