@girardmedia/bootspring 2.3.5 → 2.3.6

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.
@@ -3347,6 +3347,7 @@ __export(dist_exports, {
3347
3347
  saveProjectScopedSession: () => saveProjectScopedSession,
3348
3348
  saveSession: () => saveSession,
3349
3349
  session: () => session_exports,
3350
+ setAuthFailureHandler: () => setAuthFailureHandler,
3350
3351
  setCurrentProject: () => setCurrentProject,
3351
3352
  slugify: () => slugify,
3352
3353
  startDeviceFlow: () => startDeviceFlow,
@@ -3745,6 +3746,9 @@ function clearDeviceInfo() {
3745
3746
  } catch {
3746
3747
  }
3747
3748
  }
3749
+ function setAuthFailureHandler(handler) {
3750
+ _onAuthFailure = handler;
3751
+ }
3748
3752
  function formatHttpErrorBody(body, statusCode) {
3749
3753
  const raw = String(body || "").trim();
3750
3754
  if (!raw) return `API Error (${statusCode || "unknown"})`;
@@ -3776,7 +3780,7 @@ function appendQueryParams(url, data) {
3776
3780
  }
3777
3781
  return url;
3778
3782
  }
3779
- async function request(method, path310, data = null, options = {}) {
3783
+ async function rawRequest(method, path310, data, options) {
3780
3784
  const authHeaders = await resolveAuthHeaders();
3781
3785
  const url = appendQueryParams(new URL(`/api/${API_VERSION}${path310}`, API_BASE), method === "GET" ? data : null);
3782
3786
  const isHttps = url.protocol === "https:";
@@ -3838,6 +3842,19 @@ async function request(method, path310, data = null, options = {}) {
3838
3842
  req.end();
3839
3843
  });
3840
3844
  }
3845
+ async function request(method, path310, data = null, options = {}) {
3846
+ try {
3847
+ return await rawRequest(method, path310, data, options);
3848
+ } catch (err) {
3849
+ if (err.status === 401 && _onAuthFailure && !options._authRetried) {
3850
+ const reauthOk = await _onAuthFailure();
3851
+ if (reauthOk) {
3852
+ return rawRequest(method, path310, data, { ...options, _authRetried: true, noCache: true });
3853
+ }
3854
+ }
3855
+ throw err;
3856
+ }
3857
+ }
3841
3858
  async function healthCheck() {
3842
3859
  try {
3843
3860
  const url = new URL("/health", API_BASE);
@@ -4114,7 +4131,7 @@ function validateSlug(slug) {
4114
4131
  }
4115
4132
  return { valid: true, sanitized: slug };
4116
4133
  }
4117
- var import_fs2, import_path2, import_os, import_crypto, import_https, import_http, import_fs3, import_path3, __defProp2, __export2, auth_exports, BOOTSPRING_DIR, CREDENTIALS_FILE, CONFIG_FILE, DEVICE_FILE, _credentialCache, _credentialDecryptFailed, getEncryptionKey, api_client_exports, API_BASE, API_VERSION, cache, CACHE_TTL, session_exports, SESSION_FILE, LOCAL_CONFIG_NAME, PROJECT_SCOPE_MARKERS, LIMITS, PATTERNS, SHELL_DANGEROUS_CHARS;
4134
+ var import_fs2, import_path2, import_os, import_crypto, import_https, import_http, import_fs3, import_path3, __defProp2, __export2, auth_exports, BOOTSPRING_DIR, CREDENTIALS_FILE, CONFIG_FILE, DEVICE_FILE, _credentialCache, _credentialDecryptFailed, getEncryptionKey, api_client_exports, API_BASE, API_VERSION, _onAuthFailure, cache, CACHE_TTL, session_exports, SESSION_FILE, LOCAL_CONFIG_NAME, PROJECT_SCOPE_MARKERS, LIMITS, PATTERNS, SHELL_DANGEROUS_CHARS;
4118
4135
  var init_dist2 = __esm({
4119
4136
  "../../packages/core/dist/index.mjs"() {
4120
4137
  "use strict";
@@ -4196,10 +4213,12 @@ var init_dist2 = __esm({
4196
4213
  healthCheck: () => healthCheck,
4197
4214
  pollDeviceToken: () => pollDeviceToken,
4198
4215
  request: () => request,
4216
+ setAuthFailureHandler: () => setAuthFailureHandler,
4199
4217
  startDeviceFlow: () => startDeviceFlow
4200
4218
  });
4201
4219
  API_BASE = process.env["BOOTSPRING_API_URL"] || "https://api.bootspring.com";
4202
4220
  API_VERSION = "v1";
4221
+ _onAuthFailure = null;
4203
4222
  cache = /* @__PURE__ */ new Map();
4204
4223
  CACHE_TTL = 6e4;
4205
4224
  session_exports = {};
@@ -4269,6 +4288,9 @@ var {
4269
4288
  Help
4270
4289
  } = import_index.default;
4271
4290
 
4291
+ // src/index.ts
4292
+ init_dist2();
4293
+
4272
4294
  // src/commands/auth.ts
4273
4295
  init_cjs_shims();
4274
4296
  var import_child_process = require("child_process");
@@ -19464,4 +19486,22 @@ registerWatchCommand(program2);
19464
19486
  registerContextCommand(program2);
19465
19487
  registerManagerCommand(program2);
19466
19488
  registerSetupCommand(program2);
19489
+ api_client_exports.setAuthFailureHandler(async () => {
19490
+ const legacyKey = auth_exports.getLegacyProjectApiKey();
19491
+ if (legacyKey) {
19492
+ try {
19493
+ const response = await api_client_exports.request("POST", "/keys/validate", { apiKey: legacyKey }, { _authRetried: true });
19494
+ if (response.valid) {
19495
+ auth_exports.loginWithApiKey(legacyKey, response);
19496
+ return true;
19497
+ }
19498
+ } catch {
19499
+ }
19500
+ }
19501
+ console.error(`
19502
+ ${COLORS.yellow}\u26A0${COLORS.reset} Session expired or invalid.`);
19503
+ console.error(` Run ${COLORS.bold}bootspring auth login${COLORS.reset} to re-authenticate.
19504
+ `);
19505
+ return false;
19506
+ });
19467
19507
  program2.parse();
package/dist/core.js CHANGED
@@ -1600,7 +1600,7 @@ var require_package = __commonJS({
1600
1600
  "package.json"(exports2, module2) {
1601
1601
  module2.exports = {
1602
1602
  name: "@girardmedia/bootspring",
1603
- version: "2.3.5",
1603
+ version: "2.3.6",
1604
1604
  description: "Thin client for Bootspring cloud MCP, hosted agents, and paywalled workflow intelligence",
1605
1605
  keywords: [
1606
1606
  "ai",
@@ -45,7 +45,7 @@ var require_package = __commonJS({
45
45
  "package.json"(exports2, module2) {
46
46
  module2.exports = {
47
47
  name: "@girardmedia/bootspring",
48
- version: "2.3.5",
48
+ version: "2.3.6",
49
49
  description: "Thin client for Bootspring cloud MCP, hosted agents, and paywalled workflow intelligence",
50
50
  keywords: [
51
51
  "ai",
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@girardmedia/bootspring",
3
- "version": "2.3.5",
3
+ "version": "2.3.6",
4
4
  "description": "Thin client for Bootspring cloud MCP, hosted agents, and paywalled workflow intelligence",
5
5
  "keywords": [
6
6
  "ai",