@birdybeep/cli 0.7.0 → 0.8.0

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/dist/bin.js CHANGED
@@ -1,7 +1,7 @@
1
1
  #!/usr/bin/env node
2
2
  import {
3
3
  runCli
4
- } from "./chunk-6RIMM4RO.js";
4
+ } from "./chunk-G72IJS7A.js";
5
5
 
6
6
  // src/node-check.ts
7
7
  var MIN_NODE_MAJOR = 20;
@@ -227,7 +227,7 @@ async function dispatch(argv, deps) {
227
227
  }
228
228
 
229
229
  // src/version.ts
230
- var CLI_VERSION = "0.7.0".length > 0 ? "0.7.0" : "0.0.0";
230
+ var CLI_VERSION = "0.8.0".length > 0 ? "0.8.0" : "0.0.0";
231
231
 
232
232
  // src/commands/agent.ts
233
233
  import { claudeCodeAdapter } from "@birdybeep/claude-code";
@@ -591,6 +591,8 @@ function createAgentCommand(deps = {}) {
591
591
  import {
592
592
  createSender as defaultCreateSender,
593
593
  DEFAULT_QUEUE_MAX_ENTRIES as QUEUE_CAP,
594
+ describeCheckIn,
595
+ describeQuota,
594
596
  describeReachability,
595
597
  fetchPushReachability
596
598
  } from "@birdybeep/agent-core";
@@ -687,13 +689,12 @@ function createDoctorCommand(deps = {}) {
687
689
  remedy: tokenStoreRemedy(pairing)
688
690
  }
689
691
  );
690
- const reach = describeReachability(
691
- await fetchPushReachability({
692
- baseUrl: apiUrl,
693
- ...deps.tokenOptions ? { tokenOptions: deps.tokenOptions } : {},
694
- ...deps.fetchImpl ? { fetchImpl: deps.fetchImpl } : {}
695
- })
696
- );
692
+ const reachability = await fetchPushReachability({
693
+ baseUrl: apiUrl,
694
+ ...deps.tokenOptions ? { tokenOptions: deps.tokenOptions } : {},
695
+ ...deps.fetchImpl ? { fetchImpl: deps.fetchImpl } : {}
696
+ });
697
+ const reach = describeReachability(reachability);
697
698
  if (reach !== null) {
698
699
  checks.push({
699
700
  name: "Push reachability",
@@ -702,6 +703,19 @@ function createDoctorCommand(deps = {}) {
702
703
  ...reach.remedy !== void 0 ? { remedy: reach.remedy } : {}
703
704
  });
704
705
  }
706
+ const checkIn = describeCheckIn(reachability);
707
+ if (checkIn !== null) {
708
+ checks.push({ name: "Device check-in", ok: checkIn.ok, detail: checkIn.detail });
709
+ }
710
+ const quota = describeQuota(reachability);
711
+ if (quota !== null) {
712
+ checks.push({
713
+ name: "Beep quota",
714
+ ok: quota.ok,
715
+ detail: quota.detail,
716
+ ...quota.remedy !== void 0 ? { remedy: quota.remedy } : {}
717
+ });
718
+ }
705
719
  const unpaired = unpairedActivity();
706
720
  if (unpaired !== null) {
707
721
  checks.push({
@@ -775,6 +789,14 @@ function createDoctorCommand(deps = {}) {
775
789
  checks,
776
790
  pairing,
777
791
  // gcgp.23: paired | unpaired | unknown — never a bare boolean
792
+ // The backend's own quota numbers, unrendered (58l) — a script (or a bug report) gets
793
+ // the window and the counts, not just the sentence built from them.
794
+ ...reachability.state === "ok" && reachability.data.quota !== void 0 ? { quota: reachability.data.quota } : {},
795
+ // The raw check-in (2x9s), unrendered. Present ONLY when the server reported the field
796
+ // at all, so a script can still tell "this backend predates check-ins" (key absent)
797
+ // from "no device has ever checked in" (key present, null) — the same distinction the
798
+ // rendered row is careful about.
799
+ ...reachability.state === "ok" && reachability.data.most_recent_check_in_at !== void 0 ? { mostRecentCheckInAt: reachability.data.most_recent_check_in_at } : {},
778
800
  surfaces: surfaceGroups,
779
801
  queue: { depthBefore, delivered: drain.delivered, depthAfter, overflowDropped },
780
802
  ...unpaired !== null ? { unpairedActivity: unpaired } : {},
@@ -1196,6 +1218,7 @@ import { opencodeAdapter as opencodeAdapter3 } from "@birdybeep/opencode";
1196
1218
  import { randomUUID } from "crypto";
1197
1219
  import {
1198
1220
  createSender as defaultCreateSender3,
1221
+ describeExhaustedQuota,
1199
1222
  fetchPushReachability as fetchPushReachability2,
1200
1223
  getMachineIdentity as getMachineIdentity2,
1201
1224
  normalizeEvent
@@ -1237,6 +1260,7 @@ function createTestCommand(deps = {}) {
1237
1260
  outcome: result.outcome,
1238
1261
  ...result.status ? { status: result.status } : {},
1239
1262
  ...result.decision ? { decision: result.decision } : {},
1263
+ ...result.queueCause ? { queueCause: result.queueCause } : {},
1240
1264
  ...result.tokenStoreUnavailable !== void 0 ? { tokenStore: "unavailable", tokenStoreReason: result.tokenStoreUnavailable.reason } : {}
1241
1265
  });
1242
1266
  } else if (result.outcome === "delivered") {
@@ -1278,8 +1302,28 @@ function createTestCommand(deps = {}) {
1278
1302
  ctx.io.line(
1279
1303
  `\u2022 Could not read the machine token (${result.tokenStoreUnavailable.reason}) \u2014 the test event was queued and delivers once the token store is readable. If your keychain is locked, unlock it and run \`birdybeep test\` again.`
1280
1304
  );
1305
+ } else if (result.outcome === "queued" && result.queueCause === "backend") {
1306
+ const status = result.status !== void 0 ? ` (HTTP ${String(result.status)})` : "";
1307
+ ctx.io.line(
1308
+ result.code === "rate_limited" || result.status === 429 ? `\u2022 Throttled by the backend${status} \u2014 test event queued; it retries on its own. Not your network: the request got through.` : `\u2022 The backend is having trouble${status} \u2014 test event queued; it retries on its own. Not your network: the request got through.`
1309
+ );
1281
1310
  } else if (result.outcome === "queued") {
1282
1311
  ctx.io.line("\u2022 Offline \u2014 test event queued; it will deliver when you reconnect.");
1312
+ } else if (result.code === "quota_exceeded") {
1313
+ const reach = await fetchPushReachability2({
1314
+ baseUrl,
1315
+ ...deps.tokenOptions ? { tokenOptions: deps.tokenOptions } : {},
1316
+ ...deps.fetchImpl ? { fetchImpl: deps.fetchImpl } : {}
1317
+ });
1318
+ const quota = reach.state === "ok" ? reach.data.quota : void 0;
1319
+ const exhausted = quota ? describeExhaustedQuota(quota) : void 0;
1320
+ ctx.io.line(
1321
+ quota && exhausted ? `\u2717 Test event REJECTED \u2014 this account's monthly beep quota is used up (${String(quota.beeps_accepted)}/${String(quota.beeps_limit)} beeps on the ${quota.plan} plan, period ${exhausted.window}). Every notifiable event is being rejected. ${exhausted.remedy}` : (
1322
+ // An older backend reports no quota, so there is no period and no reset date to
1323
+ // give — and `doctor` cannot supply them either, since it reads this same response.
1324
+ "\u2717 Test event REJECTED \u2014 this account's monthly beep quota is used up, so no beep can be sent. This server does not report the period or the reset date; check your usage in the BirdyBeep app."
1325
+ )
1326
+ );
1283
1327
  } else {
1284
1328
  ctx.io.line("\u2717 Test event was rejected by the backend. Run `birdybeep doctor`.");
1285
1329
  }
@@ -2212,4 +2256,4 @@ export {
2212
2256
  buildCommands,
2213
2257
  runCli
2214
2258
  };
2215
- //# sourceMappingURL=chunk-6RIMM4RO.js.map
2259
+ //# sourceMappingURL=chunk-G72IJS7A.js.map