bamboo-agents 0.1.5-dev.14 → 0.1.5-dev.15

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/VERSION CHANGED
@@ -1 +1 @@
1
- 0.1.5-dev.14
1
+ 0.1.5-dev.15
package/dist/index.js CHANGED
@@ -3037,7 +3037,7 @@ var VERSION;
3037
3037
  var init_version = __esm({
3038
3038
  "src/version.ts"() {
3039
3039
  "use strict";
3040
- VERSION = "0.1.5-dev.14";
3040
+ VERSION = "0.1.5-dev.15";
3041
3041
  }
3042
3042
  });
3043
3043
 
@@ -11406,6 +11406,24 @@ var init_auth_status = __esm({
11406
11406
  }
11407
11407
  });
11408
11408
 
11409
+ // ../../src/lib/api-contracts/cli/billing-status.ts
11410
+ var BillingStatusResponseSchema;
11411
+ var init_billing_status = __esm({
11412
+ "../../src/lib/api-contracts/cli/billing-status.ts"() {
11413
+ init_zod();
11414
+ BillingStatusResponseSchema = external_exports.object({
11415
+ /** Normalized billing state used by the CLI to decide write-block + copy. */
11416
+ state: external_exports.enum(["trialing", "active", "expired", "unknown"]),
11417
+ /** Whole days remaining on the trial. Only meaningful when state === 'trialing'. */
11418
+ trial_days_remaining: external_exports.number().int().nullable(),
11419
+ /** Best tier name we resolved for the org. Null when no subscription rows exist. */
11420
+ tier_name: external_exports.string().nullable(),
11421
+ /** Where to send the user to upgrade or recover from an expired sub. */
11422
+ billing_url: external_exports.string().url()
11423
+ });
11424
+ }
11425
+ });
11426
+
11409
11427
  // src/lib/api.ts
11410
11428
  import { platform as platform2 } from "node:os";
11411
11429
  function defaultApiBase(version) {
@@ -11454,6 +11472,14 @@ async function getCliAuthStatus(bambooSession) {
11454
11472
  const json = await res.json();
11455
11473
  return AuthStatusResponseSchema.parse(json);
11456
11474
  }
11475
+ async function getCliBillingStatus(bambooSession) {
11476
+ const res = await cliApiFetch(`${apiBase()}/api/cli/billing/status`, {
11477
+ headers: { Authorization: `Bearer ${bambooSession}` }
11478
+ });
11479
+ if (!res.ok) throw await parseError(res);
11480
+ const json = await res.json();
11481
+ return BillingStatusResponseSchema.parse(json);
11482
+ }
11457
11483
  async function startGithubOAuthRelink(bambooSession) {
11458
11484
  const res = await cliApiFetch(
11459
11485
  `${apiBase()}/api/auth/github/oauth-relink/start`,
@@ -11482,6 +11508,7 @@ var init_api = __esm({
11482
11508
  init_zod();
11483
11509
  init_auth_token();
11484
11510
  init_auth_status();
11511
+ init_billing_status();
11485
11512
  init_version();
11486
11513
  PROD_DEFAULT_BASE = "https://withbamboo.com";
11487
11514
  DEV_DEFAULT_BASE = "https://dev.withbamboo.com";
@@ -12244,6 +12271,22 @@ var status_exports = {};
12244
12271
  __export(status_exports, {
12245
12272
  runStatus: () => runStatus
12246
12273
  });
12274
+ function formatSubscriptionLine(billing) {
12275
+ switch (billing.state) {
12276
+ case "trialing": {
12277
+ const days = billing.trial_days_remaining;
12278
+ const suffix = days === null ? "" : days === 1 ? " (1 day left)" : ` (${days} days left)`;
12279
+ return `Subscription: TRIAL${suffix} \u2014 subscribe at ${billing.billing_url}`;
12280
+ }
12281
+ case "active":
12282
+ return `Subscription: ACTIVE${billing.tier_name ? ` (${billing.tier_name})` : ""}`;
12283
+ case "expired":
12284
+ return `Subscription: EXPIRED \u2014 subscribe at ${billing.billing_url}`;
12285
+ case "unknown":
12286
+ default:
12287
+ return `Subscription: not yet started \u2014 subscribe at ${billing.billing_url}`;
12288
+ }
12289
+ }
12247
12290
  async function runStatus() {
12248
12291
  const creds = await readCredentials();
12249
12292
  const cfg = await readConfig();
@@ -12269,6 +12312,13 @@ async function runStatus() {
12269
12312
  console.log(` Org: ${cfg.org_name}`);
12270
12313
  console.log(` Installed: ${cfg.installed_at}`);
12271
12314
  }
12315
+ if (creds?.bamboo_session) {
12316
+ try {
12317
+ const billing = await getCliBillingStatus(creds.bamboo_session);
12318
+ console.log(` ${formatSubscriptionLine(billing)}`);
12319
+ } catch {
12320
+ }
12321
+ }
12272
12322
  console.log("");
12273
12323
  }
12274
12324
  var init_status = __esm({
@@ -12276,6 +12326,7 @@ var init_status = __esm({
12276
12326
  "use strict";
12277
12327
  init_state();
12278
12328
  init_credentials();
12329
+ init_api();
12279
12330
  }
12280
12331
  });
12281
12332