@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.cjs CHANGED
@@ -682,13 +682,12 @@ function createDoctorCommand(deps = {}) {
682
682
  remedy: tokenStoreRemedy(pairing)
683
683
  }
684
684
  );
685
- const reach = (0, import_agent_core4.describeReachability)(
686
- await (0, import_agent_core4.fetchPushReachability)({
687
- baseUrl: apiUrl,
688
- ...deps.tokenOptions ? { tokenOptions: deps.tokenOptions } : {},
689
- ...deps.fetchImpl ? { fetchImpl: deps.fetchImpl } : {}
690
- })
691
- );
685
+ const reachability = await (0, import_agent_core4.fetchPushReachability)({
686
+ baseUrl: apiUrl,
687
+ ...deps.tokenOptions ? { tokenOptions: deps.tokenOptions } : {},
688
+ ...deps.fetchImpl ? { fetchImpl: deps.fetchImpl } : {}
689
+ });
690
+ const reach = (0, import_agent_core4.describeReachability)(reachability);
692
691
  if (reach !== null) {
693
692
  checks.push({
694
693
  name: "Push reachability",
@@ -697,6 +696,19 @@ function createDoctorCommand(deps = {}) {
697
696
  ...reach.remedy !== void 0 ? { remedy: reach.remedy } : {}
698
697
  });
699
698
  }
699
+ const checkIn = (0, import_agent_core4.describeCheckIn)(reachability);
700
+ if (checkIn !== null) {
701
+ checks.push({ name: "Device check-in", ok: checkIn.ok, detail: checkIn.detail });
702
+ }
703
+ const quota = (0, import_agent_core4.describeQuota)(reachability);
704
+ if (quota !== null) {
705
+ checks.push({
706
+ name: "Beep quota",
707
+ ok: quota.ok,
708
+ detail: quota.detail,
709
+ ...quota.remedy !== void 0 ? { remedy: quota.remedy } : {}
710
+ });
711
+ }
700
712
  const unpaired = unpairedActivity();
701
713
  if (unpaired !== null) {
702
714
  checks.push({
@@ -770,6 +782,14 @@ function createDoctorCommand(deps = {}) {
770
782
  checks,
771
783
  pairing,
772
784
  // gcgp.23: paired | unpaired | unknown — never a bare boolean
785
+ // The backend's own quota numbers, unrendered (58l) — a script (or a bug report) gets
786
+ // the window and the counts, not just the sentence built from them.
787
+ ...reachability.state === "ok" && reachability.data.quota !== void 0 ? { quota: reachability.data.quota } : {},
788
+ // The raw check-in (2x9s), unrendered. Present ONLY when the server reported the field
789
+ // at all, so a script can still tell "this backend predates check-ins" (key absent)
790
+ // from "no device has ever checked in" (key present, null) — the same distinction the
791
+ // rendered row is careful about.
792
+ ...reachability.state === "ok" && reachability.data.most_recent_check_in_at !== void 0 ? { mostRecentCheckInAt: reachability.data.most_recent_check_in_at } : {},
773
793
  surfaces: surfaceGroups,
774
794
  queue: { depthBefore, delivered: drain.delivered, depthAfter, overflowDropped },
775
795
  ...unpaired !== null ? { unpairedActivity: unpaired } : {},
@@ -1162,7 +1182,7 @@ async function pairTokenPoll(apiUrl, deviceCode, fetchImpl, machineFingerprint,
1162
1182
  }
1163
1183
 
1164
1184
  // src/version.ts
1165
- var CLI_VERSION = "0.7.0".length > 0 ? "0.7.0" : "0.0.0";
1185
+ var CLI_VERSION = "0.8.0".length > 0 ? "0.8.0" : "0.0.0";
1166
1186
 
1167
1187
  // src/commands/setup.ts
1168
1188
  var import_claude_code5 = require("@birdybeep/claude-code");
@@ -1211,6 +1231,7 @@ function createTestCommand(deps = {}) {
1211
1231
  outcome: result.outcome,
1212
1232
  ...result.status ? { status: result.status } : {},
1213
1233
  ...result.decision ? { decision: result.decision } : {},
1234
+ ...result.queueCause ? { queueCause: result.queueCause } : {},
1214
1235
  ...result.tokenStoreUnavailable !== void 0 ? { tokenStore: "unavailable", tokenStoreReason: result.tokenStoreUnavailable.reason } : {}
1215
1236
  });
1216
1237
  } else if (result.outcome === "delivered") {
@@ -1252,8 +1273,28 @@ function createTestCommand(deps = {}) {
1252
1273
  ctx.io.line(
1253
1274
  `\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.`
1254
1275
  );
1276
+ } else if (result.outcome === "queued" && result.queueCause === "backend") {
1277
+ const status = result.status !== void 0 ? ` (HTTP ${String(result.status)})` : "";
1278
+ ctx.io.line(
1279
+ 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.`
1280
+ );
1255
1281
  } else if (result.outcome === "queued") {
1256
1282
  ctx.io.line("\u2022 Offline \u2014 test event queued; it will deliver when you reconnect.");
1283
+ } else if (result.code === "quota_exceeded") {
1284
+ const reach = await (0, import_agent_core8.fetchPushReachability)({
1285
+ baseUrl,
1286
+ ...deps.tokenOptions ? { tokenOptions: deps.tokenOptions } : {},
1287
+ ...deps.fetchImpl ? { fetchImpl: deps.fetchImpl } : {}
1288
+ });
1289
+ const quota = reach.state === "ok" ? reach.data.quota : void 0;
1290
+ const exhausted = quota ? (0, import_agent_core8.describeExhaustedQuota)(quota) : void 0;
1291
+ ctx.io.line(
1292
+ 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}` : (
1293
+ // An older backend reports no quota, so there is no period and no reset date to
1294
+ // give — and `doctor` cannot supply them either, since it reads this same response.
1295
+ "\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."
1296
+ )
1297
+ );
1257
1298
  } else {
1258
1299
  ctx.io.line("\u2717 Test event was rejected by the backend. Run `birdybeep doctor`.");
1259
1300
  }