@wayai/cli 0.3.139 → 0.3.140

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/index.js CHANGED
@@ -8111,8 +8111,9 @@ var init_contracts = __esm({
8111
8111
  seats_scaling: external_exports.enum(["fixed", "per_quantity"]).optional(),
8112
8112
  is_active: external_exports.boolean().optional(),
8113
8113
  // Rekor entitlement allowances (rekor-platform-contracts §2.2). Editable here for the
8114
- // same reason `messages_per_unit` is: otherwise the only way to change an allowance in
8115
- // production is a code deploy plus a seed-version bump.
8114
+ // same reason `messages_per_unit` is — and this route is now the only way to change an
8115
+ // allowance on a live plan at all: the seed establishes a plan row and never rewrites
8116
+ // one, so a seed-version bump no longer moves these values (see `seed.ts`).
8116
8117
  rekor_ops_tenths_included: external_exports.number().int().min(0).optional(),
8117
8118
  rekor_max_records: external_exports.number().int().min(0).optional(),
8118
8119
  rekor_import_rows_included: external_exports.number().int().min(0).optional(),
@@ -13554,8 +13555,9 @@ var init_dist = __esm({
13554
13555
  seats_scaling: external_exports.enum(["fixed", "per_quantity"]).optional(),
13555
13556
  is_active: external_exports.boolean().optional(),
13556
13557
  // Rekor entitlement allowances (rekor-platform-contracts §2.2). Editable here for the
13557
- // same reason `messages_per_unit` is: otherwise the only way to change an allowance in
13558
- // production is a code deploy plus a seed-version bump.
13558
+ // same reason `messages_per_unit` is — and this route is now the only way to change an
13559
+ // allowance on a live plan at all: the seed establishes a plan row and never rewrites
13560
+ // one, so a seed-version bump no longer moves these values (see `seed.ts`).
13559
13561
  rekor_ops_tenths_included: external_exports.number().int().min(0).optional(),
13560
13562
  rekor_max_records: external_exports.number().int().min(0).optional(),
13561
13563
  rekor_import_rows_included: external_exports.number().int().min(0).optional(),
@@ -15532,8 +15534,11 @@ async function migrateLegacyTokens() {
15532
15534
  }
15533
15535
  return null;
15534
15536
  }
15537
+ function envTokenOverride() {
15538
+ return process.env.WAYAI_TOKEN || void 0;
15539
+ }
15535
15540
  async function getToken() {
15536
- const envToken = process.env.WAYAI_TOKEN;
15541
+ const envToken = envTokenOverride();
15537
15542
  if (envToken) {
15538
15543
  if (identifyTokenType(envToken) === "way_token") {
15539
15544
  return { kind: "way", token: envToken };
@@ -16011,6 +16016,7 @@ var init_report_inbox = __esm({
16011
16016
  // src/commands/login.ts
16012
16017
  var login_exports = {};
16013
16018
  __export(login_exports, {
16019
+ envTokenOverrideWarning: () => envTokenOverrideWarning,
16014
16020
  loginCommand: () => loginCommand,
16015
16021
  missingRefreshTokenWarning: () => missingRefreshTokenWarning,
16016
16022
  parseApiUrl: () => parseApiUrl
@@ -16033,6 +16039,10 @@ function parseApiUrl(args2) {
16033
16039
  }
16034
16040
  return DEFAULT_API_URL;
16035
16041
  }
16042
+ function envTokenOverrideWarning(override2) {
16043
+ if (!override2) return null;
16044
+ return "Warning: WAYAI_TOKEN is set in this shell and takes precedence over the keyring, so commands will keep authenticating as that token \u2014 not the login you just completed. Run `unset WAYAI_TOKEN` to use it.";
16045
+ }
16036
16046
  function missingRefreshTokenWarning(refreshToken) {
16037
16047
  if (refreshToken) return null;
16038
16048
  return "Warning: no refresh token was issued \u2014 this session will expire when the access token does (~1h) and you will need to run `wayai login` again. This usually means the `offline_access` scope was not granted on the AuthKit application.";
@@ -16092,6 +16102,9 @@ Open this URL in your browser to log in:
16092
16102
  const refreshWarning = missingRefreshTokenWarning(tokens.refresh_token);
16093
16103
  if (refreshWarning) console.warn(`
16094
16104
  ${refreshWarning}`);
16105
+ const overrideWarning = envTokenOverrideWarning(envTokenOverride());
16106
+ if (overrideWarning) console.warn(`
16107
+ ${overrideWarning}`);
16095
16108
  await nudgeReportActions(apiUrl, tokens.access_token);
16096
16109
  } catch (err) {
16097
16110
  console.error(`
@@ -16119,6 +16132,9 @@ async function loginWithToken(apiUrl) {
16119
16132
  await setWayToken(token);
16120
16133
  writeConfig({ api_url: apiUrl });
16121
16134
  console.log("\nLogin successful! Token stored in OS keyring; metadata at ~/.wayai/config.json");
16135
+ const overrideWarning = envTokenOverrideWarning(envTokenOverride());
16136
+ if (overrideWarning) console.warn(`
16137
+ ${overrideWarning}`);
16122
16138
  await nudgeReportActions(apiUrl, token);
16123
16139
  }
16124
16140
  async function tryOpenBrowser(url) {
@@ -16170,7 +16186,7 @@ async function logoutCommand() {
16170
16186
  console.log("Not logged in.");
16171
16187
  return;
16172
16188
  }
16173
- const envOverrideActive = !!process.env.WAYAI_TOKEN;
16189
+ const envOverrideActive = !!envTokenOverride();
16174
16190
  await clearTokens();
16175
16191
  if (envOverrideActive) {
16176
16192
  console.log("Tokens cleared from keyring and file. Note: WAYAI_TOKEN env var is still set in this shell \u2014 unset it to fully log out.");