@odla-ai/cli 0.27.10 → 0.27.11

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
@@ -2765,7 +2765,7 @@ async function calendarCalendars(options) {
2765
2765
  return calendars;
2766
2766
  }
2767
2767
  async function calendarConnect(options) {
2768
- const { cfg, ctx, out } = await lifecycleContext(options);
2768
+ const { cfg, ctx, out } = await lifecycleContext(options, ["app.manage"]);
2769
2769
  productionConsent(ctx.env, options.yes, "connect calendar");
2770
2770
  const page2 = calendarBookingPageUrl(cfg, ctx.env);
2771
2771
  const applied = page2 === void 0 ? await readCalendarStatus(ctx) : await applyCalendarSettings(ctx, page2);
@@ -2791,7 +2791,7 @@ async function ensureCalendarConnected(ctx, options) {
2791
2791
  const connectOptions = connectionOptions(options, out);
2792
2792
  return await continueConnectedCalendar(ctx, current, connectOptions) ?? connectWithContext(ctx, connectOptions);
2793
2793
  }
2794
- async function lifecycleContext(options) {
2794
+ async function lifecycleContext(options, optionalProjectCapabilities = []) {
2795
2795
  const cfg = await loadProjectConfig(options.configPath);
2796
2796
  if (!cfg.services.includes("calendar")) throw new Error("calendar service is not enabled in config services");
2797
2797
  const env = options.env ?? (cfg.envs.includes("dev") ? "dev" : cfg.envs[0]);
@@ -2809,7 +2809,8 @@ async function lifecycleContext(options) {
2809
2809
  openApprovalUrl: options.openConsentUrl
2810
2810
  },
2811
2811
  doFetch,
2812
- out
2812
+ out,
2813
+ { optionalProjectCapabilities }
2813
2814
  );
2814
2815
  return { cfg, ctx: { platform: cfg.platformUrl, appId: cfg.app.id, env, token, fetch: doFetch }, out };
2815
2816
  }
@@ -3185,11 +3186,17 @@ async function assertTenantAdminAccess(doFetch, cfg, env, token) {
3185
3186
  if (res.ok || res.status === 404) return;
3186
3187
  if (res.status === 403) {
3187
3188
  const detail = await safeText4(res);
3188
- if (errorCode(detail) === "human_session_required") {
3189
+ const code = errorCode(detail);
3190
+ if (code === "human_session_required") {
3189
3191
  throw new Error(
3190
3192
  `${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
3193
  );
3192
3194
  }
3195
+ if (code === "provision_approval_required") {
3196
+ throw new Error(
3197
+ `${env}: the agent credential does not carry the owner-reviewed app.manage grant required to provision "${cfg.app.id}" (tenant ${tenantId}). The human owner id on the token is accountability, not agent authority. Discard the cached or supplied token and run this command with the current CLI to approve one fresh exact-project provisioning handshake`
3198
+ );
3199
+ }
3193
3200
  throw new Error(
3194
3201
  `${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`
3195
3202
  );
@@ -4554,7 +4561,9 @@ async function secretsSet(options) {
4554
4561
  throw new Error('"$"-prefixed vault names are platform-reserved; for the Clerk secret key use "odla-ai secrets set-clerk-key"');
4555
4562
  }
4556
4563
  const { cfg, tenantId, value: value2, doFetch, out } = await resolveVaultWrite(options);
4557
- const token = await getDeveloperToken(cfg, options, doFetch, out);
4564
+ const token = await getDeveloperToken(cfg, options, doFetch, out, {
4565
+ optionalProjectCapabilities: ["app.manage"]
4566
+ });
4558
4567
  try {
4559
4568
  await (0, import_ai2.putSecret)({ endpoint: cfg.dbEndpoint, token, fetch: doFetch }, tenantId, name, value2);
4560
4569
  } catch (err) {