@amaster.ai/runtime-cli 1.1.70 → 1.1.72

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.d.cts CHANGED
@@ -55,6 +55,8 @@ interface ResolvedRegistry {
55
55
  builtin: boolean;
56
56
  }
57
57
  interface AuthSession {
58
+ /** The execution host replaces this session; the CLI must not attempt cookie refresh. */
59
+ refreshManagedExternally?: boolean;
58
60
  accessToken: string;
59
61
  refreshToken?: string;
60
62
  expiresAt?: string;
package/dist/index.d.ts CHANGED
@@ -55,6 +55,8 @@ interface ResolvedRegistry {
55
55
  builtin: boolean;
56
56
  }
57
57
  interface AuthSession {
58
+ /** The execution host replaces this session; the CLI must not attempt cookie refresh. */
59
+ refreshManagedExternally?: boolean;
58
60
  accessToken: string;
59
61
  refreshToken?: string;
60
62
  expiresAt?: string;
package/dist/index.js CHANGED
@@ -3210,10 +3210,12 @@ function createAmasterClient(appCode) {
3210
3210
  process.exit(1);
3211
3211
  }
3212
3212
  const token = getAccessToken(appCode);
3213
- if (token && shouldRefreshToken(appCode)) {
3213
+ const refreshManagedExternally = getAuthSession(appCode)?.refreshManagedExternally === true;
3214
+ if (token && !refreshManagedExternally && shouldRefreshToken(appCode)) {
3214
3215
  console.error(chalk4.yellow("\u26A0\uFE0F Session expiring soon. Please login again."));
3215
3216
  }
3216
3217
  const client = createClient({
3218
+ autoRefresh: !refreshManagedExternally,
3217
3219
  baseURL: appConfig.baseURL,
3218
3220
  headers: {
3219
3221
  "x-app-code": appCode,
@@ -3222,6 +3224,10 @@ function createAmasterClient(appCode) {
3222
3224
  } : {}
3223
3225
  },
3224
3226
  onUnauthorized: () => {
3227
+ if (refreshManagedExternally) {
3228
+ console.error(chalk4.red("Application authorization expired or was denied. Renew through the execution host and retry."));
3229
+ process.exit(1);
3230
+ }
3225
3231
  if (token) {
3226
3232
  console.error(chalk4.red("\n\u274C Session expired. Please login again."));
3227
3233
  console.error(chalk4.yellow(`Run: amaster login --app ${appCode}`));