@odla-ai/chapter 0.40.1 → 0.40.2

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
@@ -2142,7 +2142,14 @@ function createChapterIntegration(chapter, options = {}) {
2142
2142
  },
2143
2143
  rules: { ...crmDesc.rules, ...chapter.rules },
2144
2144
  seeds,
2145
- secrets: [],
2145
+ secrets: chapter.account === "none" ? [] : [{
2146
+ // Released Chapter workers request this effective name. odla-db maps
2147
+ // it to the canonical reserved `$clerk_secret` value written by
2148
+ // `odla-ai secrets set-clerk-key`.
2149
+ name: "clerk_secret_key",
2150
+ description: "Clerk backend key (set with odla-ai secrets set-clerk-key) required by the configured Chapter account model.",
2151
+ required: true
2152
+ }],
2146
2153
  probes: [
2147
2154
  ...crmDesc.probes ?? [],
2148
2155
  // The snapshot route is deliberately private. A credential-free smoke
@@ -3647,7 +3654,14 @@ async function createClerkUser(secretKey, input, fetchImpl = fetch) {
3647
3654
  headers: { authorization: `Bearer ${secretKey}`, "content-type": "application/json" },
3648
3655
  body: JSON.stringify(body)
3649
3656
  });
3650
- if (res.ok) return { ok: true, status: res.status };
3657
+ if (res.ok) {
3658
+ const body2 = typeof res.json === "function" ? await res.json().catch(() => null) : null;
3659
+ return {
3660
+ ok: true,
3661
+ status: res.status,
3662
+ ...typeof body2?.id === "string" && body2.id ? { userId: body2.id } : {}
3663
+ };
3664
+ }
3651
3665
  const healed = heal(res.status);
3652
3666
  const repair = input.repairMetadata ?? {
3653
3667
  ...input.publicMetadata !== void 0 ? { publicMetadata: input.publicMetadata } : {},
@@ -3749,7 +3763,7 @@ var clerkIntegration = {
3749
3763
  },
3750
3764
  {
3751
3765
  name: "clerk_secret_key",
3752
- description: "Clerk backend key (sk_*) \u2014 powers account creation, the public role claim, and backend-only private profile signals; it also lets odla-db resolve user email/name via the Clerk API.",
3766
+ description: "Effective Clerk backend key (sk_*), stored canonically by set-clerk-key in reserved $clerk_secret \u2014 powers account creation, the public role claim, backend-only private profile signals, and odla-db user resolution.",
3753
3767
  pattern: "sk_",
3754
3768
  mode: "full",
3755
3769
  required: false
@@ -3782,15 +3796,16 @@ var clerkIntegration = {
3782
3796
  provision: {
3783
3797
  human: [
3784
3798
  "Run `npx clerk auth login` \u2014 the one interactive step; the agent then creates + configures the Clerk app with the Clerk CLI (no pk_ to hand-paste).",
3785
- 'For auth mode "full": create the Clerk user-sync webhook and store its whsec_, plus the sk_ as clerk_secret_key, in the tenant vault (Studio, write-only).'
3799
+ 'For auth mode "full": create the Clerk user-sync webhook, store its whsec_, and transfer the sk_ with `odla-ai secrets set-clerk-key --env <env> --stdin` (write-only).'
3786
3800
  ],
3787
3801
  cli: [
3788
3802
  "Clerk CLI (`npx clerk apps create/link/config patch`) creates + configures the instance and pulls the pk_.",
3789
- "odla `provision` records it: setAuth(env, publishableKey) -> apps-registry (issuer/JWKS derived from the key)."
3803
+ "odla `provision` records it: setAuth(env, publishableKey) -> apps-registry (issuer/JWKS derived from the key).",
3804
+ "odla `secrets set-clerk-key` stores one environment-scoped reserved credential consumed by odla-db and Chapter."
3790
3805
  ],
3791
3806
  doctor: [
3792
3807
  "registry auth[env] present when the app mounts <SignIn>?",
3793
- 'auth mode "full" => whsec_ and clerk_secret_key present in the tenant vault?'
3808
+ 'auth mode "full" => whsec_ present and the effective clerk_secret_key reports set via the reserved Clerk credential status?'
3794
3809
  ]
3795
3810
  }
3796
3811
  };