@odla-ai/chapter 0.40.0 → 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.d.cts CHANGED
@@ -363,6 +363,8 @@ interface ChapterPrices {
363
363
  interface ChapterPolicy {
364
364
  disclaimerText?: string;
365
365
  refundPolicyText?: string;
366
+ /** Plain-language merchant identity shown immediately before payment consent. */
367
+ merchantDisclosureText?: string;
366
368
  trustCopy?: string;
367
369
  commitmentText?: string;
368
370
  normsText?: string;
@@ -1747,6 +1749,7 @@ interface JoinConfigGroup {
1747
1749
  foundingDiscountCents?: number;
1748
1750
  disclaimerText?: string;
1749
1751
  refundPolicyText?: string;
1752
+ merchantDisclosureText?: string;
1750
1753
  trustCopy?: string;
1751
1754
  commitmentText?: string;
1752
1755
  normsText?: string;
@@ -2100,6 +2103,8 @@ declare function stripeCall(sk: string, method: "GET" | "POST" | "DELETE", path:
2100
2103
  interface ClerkResult {
2101
2104
  ok: boolean;
2102
2105
  status: number;
2106
+ /** Stable Clerk user id returned by a successful fresh account create. */
2107
+ userId?: string;
2103
2108
  existed?: boolean;
2104
2109
  /** Set when an `existed` heal also refreshed the account's metadata. */
2105
2110
  refreshed?: boolean;
@@ -2218,14 +2223,16 @@ interface IntegrationSetting {
2218
2223
  /**
2219
2224
  * A secret the capability needs, held in the tenant vault.
2220
2225
  *
2221
- * Structurally the odla CLI's `IntegrationSecret`: `name` is the vault name
2222
- * byte-for-byte, so `odla-ai doctor`, `odla-ai secrets status`, and the
2226
+ * Structurally the odla CLI's `IntegrationSecret`: `name` is the effective
2227
+ * runtime vault name, so `odla-ai doctor`, `odla-ai secrets status`, and the
2223
2228
  * repo's `check:secrets` gate can hold this declaration against the name the
2224
- * platform actually reads. `mode` is chapter's own addition and the CLI
2225
- * ignores it.
2229
+ * package requests. The Clerk backend key is stored once in the reserved
2230
+ * `$clerk_secret` slot and odla-db resolves its released `clerk_secret_key`
2231
+ * compatibility name. `mode` is chapter's own addition and the CLI ignores it.
2226
2232
  */
2227
2233
  interface IntegrationSecret {
2228
- /** Vault name, exactly as `odla-ai secrets set <name>` writes it. */
2234
+ /** Effective runtime vault name. Dedicated platform commands may keep the
2235
+ * canonical value in a reserved slot and resolve this compatibility name. */
2229
2236
  name: string;
2230
2237
  description: string;
2231
2238
  pattern?: string;
@@ -2644,6 +2651,8 @@ interface SignupControlApplication {
2644
2651
  interface SignupControlPolicy {
2645
2652
  disclaimerText: string;
2646
2653
  refundPolicyText: string;
2654
+ /** Plain-language merchant identity displayed before payment consent. */
2655
+ merchantDisclosureText?: string;
2647
2656
  trustCopy?: string;
2648
2657
  commitmentText?: string;
2649
2658
  normsText?: string;
package/dist/index.d.ts CHANGED
@@ -363,6 +363,8 @@ interface ChapterPrices {
363
363
  interface ChapterPolicy {
364
364
  disclaimerText?: string;
365
365
  refundPolicyText?: string;
366
+ /** Plain-language merchant identity shown immediately before payment consent. */
367
+ merchantDisclosureText?: string;
366
368
  trustCopy?: string;
367
369
  commitmentText?: string;
368
370
  normsText?: string;
@@ -1747,6 +1749,7 @@ interface JoinConfigGroup {
1747
1749
  foundingDiscountCents?: number;
1748
1750
  disclaimerText?: string;
1749
1751
  refundPolicyText?: string;
1752
+ merchantDisclosureText?: string;
1750
1753
  trustCopy?: string;
1751
1754
  commitmentText?: string;
1752
1755
  normsText?: string;
@@ -2100,6 +2103,8 @@ declare function stripeCall(sk: string, method: "GET" | "POST" | "DELETE", path:
2100
2103
  interface ClerkResult {
2101
2104
  ok: boolean;
2102
2105
  status: number;
2106
+ /** Stable Clerk user id returned by a successful fresh account create. */
2107
+ userId?: string;
2103
2108
  existed?: boolean;
2104
2109
  /** Set when an `existed` heal also refreshed the account's metadata. */
2105
2110
  refreshed?: boolean;
@@ -2218,14 +2223,16 @@ interface IntegrationSetting {
2218
2223
  /**
2219
2224
  * A secret the capability needs, held in the tenant vault.
2220
2225
  *
2221
- * Structurally the odla CLI's `IntegrationSecret`: `name` is the vault name
2222
- * byte-for-byte, so `odla-ai doctor`, `odla-ai secrets status`, and the
2226
+ * Structurally the odla CLI's `IntegrationSecret`: `name` is the effective
2227
+ * runtime vault name, so `odla-ai doctor`, `odla-ai secrets status`, and the
2223
2228
  * repo's `check:secrets` gate can hold this declaration against the name the
2224
- * platform actually reads. `mode` is chapter's own addition and the CLI
2225
- * ignores it.
2229
+ * package requests. The Clerk backend key is stored once in the reserved
2230
+ * `$clerk_secret` slot and odla-db resolves its released `clerk_secret_key`
2231
+ * compatibility name. `mode` is chapter's own addition and the CLI ignores it.
2226
2232
  */
2227
2233
  interface IntegrationSecret {
2228
- /** Vault name, exactly as `odla-ai secrets set <name>` writes it. */
2234
+ /** Effective runtime vault name. Dedicated platform commands may keep the
2235
+ * canonical value in a reserved slot and resolve this compatibility name. */
2229
2236
  name: string;
2230
2237
  description: string;
2231
2238
  pattern?: string;
@@ -2644,6 +2651,8 @@ interface SignupControlApplication {
2644
2651
  interface SignupControlPolicy {
2645
2652
  disclaimerText: string;
2646
2653
  refundPolicyText: string;
2654
+ /** Plain-language merchant identity displayed before payment consent. */
2655
+ merchantDisclosureText?: string;
2647
2656
  trustCopy?: string;
2648
2657
  commitmentText?: string;
2649
2658
  normsText?: string;
package/dist/index.js CHANGED
@@ -165,6 +165,7 @@ function joinConfig(group, paymentsReady2, tiers2 = [], conditions = {}) {
165
165
  conditions,
166
166
  disclaimerText: group.disclaimerText ?? "",
167
167
  refundPolicyText: group.refundPolicyText ?? "",
168
+ merchantDisclosureText: group.merchantDisclosureText ?? "",
168
169
  trustCopy: group.trustCopy ?? "",
169
170
  commitmentText: group.commitmentText ?? "",
170
171
  normsText: group.normsText ?? "",
@@ -511,6 +512,7 @@ var groups = {
511
512
  calendarLink: attr4("string", { optional: true }),
512
513
  disclaimerText: attr4("string"),
513
514
  refundPolicyText: attr4("string"),
515
+ merchantDisclosureText: attr4("string", { optional: true }),
514
516
  trustCopy: attr4("string"),
515
517
  commitmentText: attr4("string", { optional: true }),
516
518
  normsText: attr4("string", { optional: true }),
@@ -736,6 +738,7 @@ function buildGroupSeed(config) {
736
738
  replyTo: emails?.replyTo ?? emails?.notificationEmail ?? "",
737
739
  disclaimerText: policy.disclaimerText ?? "",
738
740
  refundPolicyText: policy.refundPolicyText ?? "",
741
+ merchantDisclosureText: policy.merchantDisclosureText ?? "",
739
742
  trustCopy: policy.trustCopy ?? "",
740
743
  emailTemplates: emails?.templates ?? defaultEmailTemplates(config.name),
741
744
  schedulingJson: scheduling
@@ -1952,7 +1955,14 @@ function createChapterIntegration(chapter, options = {}) {
1952
1955
  },
1953
1956
  rules: { ...crmDesc.rules, ...chapter.rules },
1954
1957
  seeds,
1955
- secrets: [],
1958
+ secrets: chapter.account === "none" ? [] : [{
1959
+ // Released Chapter workers request this effective name. odla-db maps
1960
+ // it to the canonical reserved `$clerk_secret` value written by
1961
+ // `odla-ai secrets set-clerk-key`.
1962
+ name: "clerk_secret_key",
1963
+ description: "Clerk backend key (set with odla-ai secrets set-clerk-key) required by the configured Chapter account model.",
1964
+ required: true
1965
+ }],
1956
1966
  probes: [
1957
1967
  ...crmDesc.probes ?? [],
1958
1968
  // The snapshot route is deliberately private. A credential-free smoke
@@ -3462,7 +3472,14 @@ async function createClerkUser(secretKey, input, fetchImpl = fetch) {
3462
3472
  headers: { authorization: `Bearer ${secretKey}`, "content-type": "application/json" },
3463
3473
  body: JSON.stringify(body)
3464
3474
  });
3465
- if (res.ok) return { ok: true, status: res.status };
3475
+ if (res.ok) {
3476
+ const body2 = typeof res.json === "function" ? await res.json().catch(() => null) : null;
3477
+ return {
3478
+ ok: true,
3479
+ status: res.status,
3480
+ ...typeof body2?.id === "string" && body2.id ? { userId: body2.id } : {}
3481
+ };
3482
+ }
3466
3483
  const healed = heal(res.status);
3467
3484
  const repair = input.repairMetadata ?? {
3468
3485
  ...input.publicMetadata !== void 0 ? { publicMetadata: input.publicMetadata } : {},
@@ -3564,7 +3581,7 @@ var clerkIntegration = {
3564
3581
  },
3565
3582
  {
3566
3583
  name: "clerk_secret_key",
3567
- 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.",
3584
+ 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.",
3568
3585
  pattern: "sk_",
3569
3586
  mode: "full",
3570
3587
  required: false
@@ -3597,15 +3614,16 @@ var clerkIntegration = {
3597
3614
  provision: {
3598
3615
  human: [
3599
3616
  "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).",
3600
- '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).'
3617
+ '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).'
3601
3618
  ],
3602
3619
  cli: [
3603
3620
  "Clerk CLI (`npx clerk apps create/link/config patch`) creates + configures the instance and pulls the pk_.",
3604
- "odla `provision` records it: setAuth(env, publishableKey) -> apps-registry (issuer/JWKS derived from the key)."
3621
+ "odla `provision` records it: setAuth(env, publishableKey) -> apps-registry (issuer/JWKS derived from the key).",
3622
+ "odla `secrets set-clerk-key` stores one environment-scoped reserved credential consumed by odla-db and Chapter."
3605
3623
  ],
3606
3624
  doctor: [
3607
3625
  "registry auth[env] present when the app mounts <SignIn>?",
3608
- 'auth mode "full" => whsec_ and clerk_secret_key present in the tenant vault?'
3626
+ 'auth mode "full" => whsec_ present and the effective clerk_secret_key reports set via the reserved Clerk credential status?'
3609
3627
  ]
3610
3628
  }
3611
3629
  };
@@ -4198,7 +4216,14 @@ function policyOf(value, errors) {
4198
4216
  errors.push("document.policy must be an object");
4199
4217
  return void 0;
4200
4218
  }
4201
- const allowed2 = /* @__PURE__ */ new Set(["disclaimerText", "refundPolicyText", "trustCopy", "commitmentText", "normsText"]);
4219
+ const allowed2 = /* @__PURE__ */ new Set([
4220
+ "disclaimerText",
4221
+ "refundPolicyText",
4222
+ "merchantDisclosureText",
4223
+ "trustCopy",
4224
+ "commitmentText",
4225
+ "normsText"
4226
+ ]);
4202
4227
  unknownKeys3(input, allowed2, "document.policy", errors);
4203
4228
  const result = {};
4204
4229
  for (const key of allowed2) {