@odla-ai/cli 0.27.9 → 0.27.10

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.cjs CHANGED
@@ -2616,7 +2616,7 @@ function parseCalendarStatus(raw, env) {
2616
2616
  throw new Error("calendar status returned unsupported access");
2617
2617
  }
2618
2618
  const errorValue = record(value2.error) ?? record(connection.error);
2619
- const errorCode = textField(value2.lastErrorCode, 128);
2619
+ const errorCode2 = textField(value2.lastErrorCode, 128);
2620
2620
  const bookingPageValue = Object.hasOwn(value2, "bookingPageUrl") ? value2.bookingPageUrl : Object.hasOwn(config, "bookingPageUrl") ? config.bookingPageUrl : googleConfig.bookingPageUrl;
2621
2621
  const connected = typeof (value2.connected ?? connection.connected) === "boolean" ? Boolean(value2.connected ?? connection.connected) : ["healthy", "degraded"].includes(stateValue);
2622
2622
  const bookingCalendarId = textField(value2.bookingCalendarId ?? config.bookingCalendarId, 1024);
@@ -2635,10 +2635,10 @@ function parseCalendarStatus(raw, env) {
2635
2635
  ...optionalNullableUrl("bookingPageUrl", bookingPageValue),
2636
2636
  grantedScopes: stringList(value2.grantedScopes ?? connection.grantedScopes ?? connection.scopes),
2637
2637
  ...optionalText("attemptId", value2.attemptId ?? connection.attemptId, 180),
2638
- ...errorValue || errorCode ? { error: {
2638
+ ...errorValue || errorCode2 ? { error: {
2639
2639
  ...textField(errorValue?.code, 128) ? { code: textField(errorValue?.code, 128) } : {},
2640
2640
  ...textField(errorValue?.message, 500) ? { message: textField(errorValue?.message, 500) } : {},
2641
- ...!errorValue && errorCode ? { code: errorCode } : {}
2641
+ ...!errorValue && errorCode2 ? { code: errorCode2 } : {}
2642
2642
  } } : {}
2643
2643
  };
2644
2644
  }
@@ -3184,12 +3184,26 @@ async function assertTenantAdminAccess(doFetch, cfg, env, token) {
3184
3184
  });
3185
3185
  if (res.ok || res.status === 404) return;
3186
3186
  if (res.status === 403) {
3187
+ const detail = await safeText4(res);
3188
+ if (errorCode(detail) === "human_session_required") {
3189
+ throw new Error(
3190
+ `${env}: odla-db rejected the provision credential before checking ownership for "${cfg.app.id}" (tenant ${tenantId}): human_session_required. Retrying or changing app owners will not help; the deployed odla-db must accept owner-approved app.manage credentials on provisioning routes`
3191
+ );
3192
+ }
3187
3193
  throw new Error(
3188
3194
  `${env}: this credential lacks live app.manage authority for "${cfg.app.id}" (tenant ${tenantId}) \u2014 nothing was minted or written; re-run provision with a fresh owner-approved provision handshake. If the human account is not an owner, an existing owner must add it in signed-in Studio; an agent token cannot repair ownership`
3189
3195
  );
3190
3196
  }
3191
3197
  throw new Error(`${env}: tenant access preflight (${tenantId}) failed: ${res.status} ${await safeText4(res)}`);
3192
3198
  }
3199
+ function errorCode(text2) {
3200
+ try {
3201
+ const body = JSON.parse(text2);
3202
+ return typeof body.error?.code === "string" ? body.error.code : null;
3203
+ } catch {
3204
+ return null;
3205
+ }
3206
+ }
3193
3207
  async function postJson(doFetch, url, bearer, body) {
3194
3208
  const res = await doFetch(url, {
3195
3209
  method: "POST",