@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/bin.cjs CHANGED
@@ -2548,7 +2548,7 @@ function parseCalendarStatus(raw, env) {
2548
2548
  throw new Error("calendar status returned unsupported access");
2549
2549
  }
2550
2550
  const errorValue = record(value2.error) ?? record(connection.error);
2551
- const errorCode = textField(value2.lastErrorCode, 128);
2551
+ const errorCode2 = textField(value2.lastErrorCode, 128);
2552
2552
  const bookingPageValue = Object.hasOwn(value2, "bookingPageUrl") ? value2.bookingPageUrl : Object.hasOwn(config, "bookingPageUrl") ? config.bookingPageUrl : googleConfig.bookingPageUrl;
2553
2553
  const connected = typeof (value2.connected ?? connection.connected) === "boolean" ? Boolean(value2.connected ?? connection.connected) : ["healthy", "degraded"].includes(stateValue);
2554
2554
  const bookingCalendarId = textField(value2.bookingCalendarId ?? config.bookingCalendarId, 1024);
@@ -2567,10 +2567,10 @@ function parseCalendarStatus(raw, env) {
2567
2567
  ...optionalNullableUrl("bookingPageUrl", bookingPageValue),
2568
2568
  grantedScopes: stringList(value2.grantedScopes ?? connection.grantedScopes ?? connection.scopes),
2569
2569
  ...optionalText("attemptId", value2.attemptId ?? connection.attemptId, 180),
2570
- ...errorValue || errorCode ? { error: {
2570
+ ...errorValue || errorCode2 ? { error: {
2571
2571
  ...textField(errorValue?.code, 128) ? { code: textField(errorValue?.code, 128) } : {},
2572
2572
  ...textField(errorValue?.message, 500) ? { message: textField(errorValue?.message, 500) } : {},
2573
- ...!errorValue && errorCode ? { code: errorCode } : {}
2573
+ ...!errorValue && errorCode2 ? { code: errorCode2 } : {}
2574
2574
  } } : {}
2575
2575
  };
2576
2576
  }
@@ -3116,12 +3116,26 @@ async function assertTenantAdminAccess(doFetch, cfg, env, token) {
3116
3116
  });
3117
3117
  if (res.ok || res.status === 404) return;
3118
3118
  if (res.status === 403) {
3119
+ const detail = await safeText4(res);
3120
+ if (errorCode(detail) === "human_session_required") {
3121
+ throw new Error(
3122
+ `${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`
3123
+ );
3124
+ }
3119
3125
  throw new Error(
3120
3126
  `${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`
3121
3127
  );
3122
3128
  }
3123
3129
  throw new Error(`${env}: tenant access preflight (${tenantId}) failed: ${res.status} ${await safeText4(res)}`);
3124
3130
  }
3131
+ function errorCode(text2) {
3132
+ try {
3133
+ const body = JSON.parse(text2);
3134
+ return typeof body.error?.code === "string" ? body.error.code : null;
3135
+ } catch {
3136
+ return null;
3137
+ }
3138
+ }
3125
3139
  async function postJson(doFetch, url, bearer, body) {
3126
3140
  const res = await doFetch(url, {
3127
3141
  method: "POST",