@odla-ai/chapter 0.40.1 → 0.40.3
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/README.md +9 -4
- package/dist/{chunk-4K2Q5JBC.js → chunk-O22RRPBT.js} +232 -84
- package/dist/chunk-O22RRPBT.js.map +1 -0
- package/dist/index.cjs +24 -9
- package/dist/index.cjs.map +1 -1
- package/dist/index.d.cts +14 -6
- package/dist/index.d.ts +14 -6
- package/dist/index.js +24 -9
- package/dist/index.js.map +1 -1
- package/dist/ui/admin/index.d.ts +6 -2
- package/dist/ui/admin/index.js +1 -1
- package/dist/ui/index.js +1 -1
- package/dist/worker/index.cjs +73 -19
- package/dist/worker/index.cjs.map +1 -1
- package/dist/worker/index.js +73 -19
- package/dist/worker/index.js.map +1 -1
- package/package.json +1 -1
- package/dist/chunk-4K2Q5JBC.js.map +0 -1
package/dist/index.d.cts
CHANGED
|
@@ -1213,6 +1213,9 @@ interface BuilderLibraryValidationOptions {
|
|
|
1213
1213
|
sourceType?: BuilderLibrarySourceType;
|
|
1214
1214
|
sourceAppId?: string;
|
|
1215
1215
|
targetAppId?: string;
|
|
1216
|
+
/** Chapter IDs a Built Not Found document may address. An empty or omitted
|
|
1217
|
+
* allowlist keeps the historical global-or-private-only behavior. */
|
|
1218
|
+
allowedChapterIds?: readonly string[];
|
|
1216
1219
|
}
|
|
1217
1220
|
/** A validated document or actionable strict-contract errors. */
|
|
1218
1221
|
type BuilderLibraryValidationResult = {
|
|
@@ -1260,7 +1263,8 @@ interface BuilderLibraryReceipt {
|
|
|
1260
1263
|
declare function canViewBuilderLibraryResource(resource: BuilderLibraryResource, viewer: BuilderLibraryViewer): boolean;
|
|
1261
1264
|
/** Produce deterministic, published-only input for a site-building agent. */
|
|
1262
1265
|
declare function buildBuilderLibraryManifest(documents: readonly BuilderLibraryDocument[], viewer: BuilderLibraryViewer, generatedAt?: number, limit?: number): BuilderLibraryManifest;
|
|
1263
|
-
/** Build the exact signed layer for one peer;
|
|
1266
|
+
/** Build the exact signed layer for one peer; private and sibling material
|
|
1267
|
+
* never crosses to a Chapter. */
|
|
1264
1268
|
declare function projectBuilderLibraryDelivery(document: BuilderLibraryDocument, target: BuilderLibraryTarget): BuilderLibraryDocument;
|
|
1265
1269
|
/** Copy a Chapter item into global authority while preserving its exact origin. */
|
|
1266
1270
|
declare function promoteBuilderLibraryResource(input: {
|
|
@@ -2103,6 +2107,8 @@ declare function stripeCall(sk: string, method: "GET" | "POST" | "DELETE", path:
|
|
|
2103
2107
|
interface ClerkResult {
|
|
2104
2108
|
ok: boolean;
|
|
2105
2109
|
status: number;
|
|
2110
|
+
/** Stable Clerk user id returned by a successful fresh account create. */
|
|
2111
|
+
userId?: string;
|
|
2106
2112
|
existed?: boolean;
|
|
2107
2113
|
/** Set when an `existed` heal also refreshed the account's metadata. */
|
|
2108
2114
|
refreshed?: boolean;
|
|
@@ -2221,14 +2227,16 @@ interface IntegrationSetting {
|
|
|
2221
2227
|
/**
|
|
2222
2228
|
* A secret the capability needs, held in the tenant vault.
|
|
2223
2229
|
*
|
|
2224
|
-
* Structurally the odla CLI's `IntegrationSecret`: `name` is the
|
|
2225
|
-
*
|
|
2230
|
+
* Structurally the odla CLI's `IntegrationSecret`: `name` is the effective
|
|
2231
|
+
* runtime vault name, so `odla-ai doctor`, `odla-ai secrets status`, and the
|
|
2226
2232
|
* repo's `check:secrets` gate can hold this declaration against the name the
|
|
2227
|
-
*
|
|
2228
|
-
*
|
|
2233
|
+
* package requests. The Clerk backend key is stored once in the reserved
|
|
2234
|
+
* `$clerk_secret` slot and odla-db resolves its released `clerk_secret_key`
|
|
2235
|
+
* compatibility name. `mode` is chapter's own addition and the CLI ignores it.
|
|
2229
2236
|
*/
|
|
2230
2237
|
interface IntegrationSecret {
|
|
2231
|
-
/**
|
|
2238
|
+
/** Effective runtime vault name. Dedicated platform commands may keep the
|
|
2239
|
+
* canonical value in a reserved slot and resolve this compatibility name. */
|
|
2232
2240
|
name: string;
|
|
2233
2241
|
description: string;
|
|
2234
2242
|
pattern?: string;
|
package/dist/index.d.ts
CHANGED
|
@@ -1213,6 +1213,9 @@ interface BuilderLibraryValidationOptions {
|
|
|
1213
1213
|
sourceType?: BuilderLibrarySourceType;
|
|
1214
1214
|
sourceAppId?: string;
|
|
1215
1215
|
targetAppId?: string;
|
|
1216
|
+
/** Chapter IDs a Built Not Found document may address. An empty or omitted
|
|
1217
|
+
* allowlist keeps the historical global-or-private-only behavior. */
|
|
1218
|
+
allowedChapterIds?: readonly string[];
|
|
1216
1219
|
}
|
|
1217
1220
|
/** A validated document or actionable strict-contract errors. */
|
|
1218
1221
|
type BuilderLibraryValidationResult = {
|
|
@@ -1260,7 +1263,8 @@ interface BuilderLibraryReceipt {
|
|
|
1260
1263
|
declare function canViewBuilderLibraryResource(resource: BuilderLibraryResource, viewer: BuilderLibraryViewer): boolean;
|
|
1261
1264
|
/** Produce deterministic, published-only input for a site-building agent. */
|
|
1262
1265
|
declare function buildBuilderLibraryManifest(documents: readonly BuilderLibraryDocument[], viewer: BuilderLibraryViewer, generatedAt?: number, limit?: number): BuilderLibraryManifest;
|
|
1263
|
-
/** Build the exact signed layer for one peer;
|
|
1266
|
+
/** Build the exact signed layer for one peer; private and sibling material
|
|
1267
|
+
* never crosses to a Chapter. */
|
|
1264
1268
|
declare function projectBuilderLibraryDelivery(document: BuilderLibraryDocument, target: BuilderLibraryTarget): BuilderLibraryDocument;
|
|
1265
1269
|
/** Copy a Chapter item into global authority while preserving its exact origin. */
|
|
1266
1270
|
declare function promoteBuilderLibraryResource(input: {
|
|
@@ -2103,6 +2107,8 @@ declare function stripeCall(sk: string, method: "GET" | "POST" | "DELETE", path:
|
|
|
2103
2107
|
interface ClerkResult {
|
|
2104
2108
|
ok: boolean;
|
|
2105
2109
|
status: number;
|
|
2110
|
+
/** Stable Clerk user id returned by a successful fresh account create. */
|
|
2111
|
+
userId?: string;
|
|
2106
2112
|
existed?: boolean;
|
|
2107
2113
|
/** Set when an `existed` heal also refreshed the account's metadata. */
|
|
2108
2114
|
refreshed?: boolean;
|
|
@@ -2221,14 +2227,16 @@ interface IntegrationSetting {
|
|
|
2221
2227
|
/**
|
|
2222
2228
|
* A secret the capability needs, held in the tenant vault.
|
|
2223
2229
|
*
|
|
2224
|
-
* Structurally the odla CLI's `IntegrationSecret`: `name` is the
|
|
2225
|
-
*
|
|
2230
|
+
* Structurally the odla CLI's `IntegrationSecret`: `name` is the effective
|
|
2231
|
+
* runtime vault name, so `odla-ai doctor`, `odla-ai secrets status`, and the
|
|
2226
2232
|
* repo's `check:secrets` gate can hold this declaration against the name the
|
|
2227
|
-
*
|
|
2228
|
-
*
|
|
2233
|
+
* package requests. The Clerk backend key is stored once in the reserved
|
|
2234
|
+
* `$clerk_secret` slot and odla-db resolves its released `clerk_secret_key`
|
|
2235
|
+
* compatibility name. `mode` is chapter's own addition and the CLI ignores it.
|
|
2229
2236
|
*/
|
|
2230
2237
|
interface IntegrationSecret {
|
|
2231
|
-
/**
|
|
2238
|
+
/** Effective runtime vault name. Dedicated platform commands may keep the
|
|
2239
|
+
* canonical value in a reserved slot and resolve this compatibility name. */
|
|
2232
2240
|
name: string;
|
|
2233
2241
|
description: string;
|
|
2234
2242
|
pattern?: string;
|
package/dist/index.js
CHANGED
|
@@ -1955,7 +1955,14 @@ function createChapterIntegration(chapter, options = {}) {
|
|
|
1955
1955
|
},
|
|
1956
1956
|
rules: { ...crmDesc.rules, ...chapter.rules },
|
|
1957
1957
|
seeds,
|
|
1958
|
-
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
|
+
}],
|
|
1959
1966
|
probes: [
|
|
1960
1967
|
...crmDesc.probes ?? [],
|
|
1961
1968
|
// The snapshot route is deliberately private. A credential-free smoke
|
|
@@ -2455,8 +2462,8 @@ function validateBuilderLibraryDocument(value, options = {}) {
|
|
|
2455
2462
|
if (sourceType === "chapter" && (resource.scope.kind !== "chapter" || resource.scope.chapterId !== sourceAppId)) {
|
|
2456
2463
|
errors.push(`document.resources.${resource.id}: Chapter sources may author only their own chapter scope`);
|
|
2457
2464
|
}
|
|
2458
|
-
if (sourceType === "built_not_found" && resource.scope.kind === "chapter") {
|
|
2459
|
-
errors.push(`document.resources.${resource.id}: Built Not Found
|
|
2465
|
+
if (sourceType === "built_not_found" && resource.scope.kind === "chapter" && !(options.allowedChapterIds ?? []).includes(resource.scope.chapterId)) {
|
|
2466
|
+
errors.push(`document.resources.${resource.id}: Built Not Found may target only configured Chapters`);
|
|
2460
2467
|
}
|
|
2461
2468
|
}
|
|
2462
2469
|
if (errors.length) return { ok: false, errors };
|
|
@@ -2488,7 +2495,7 @@ function projectBuilderLibraryDelivery(document, target) {
|
|
|
2488
2495
|
return {
|
|
2489
2496
|
...document,
|
|
2490
2497
|
target,
|
|
2491
|
-
resources: document.source.type === "built_not_found" ? document.resources.filter((resource) => resource.scope.kind === "global") : document.resources
|
|
2498
|
+
resources: document.source.type === "built_not_found" ? document.resources.filter((resource) => resource.scope.kind === "global" || resource.scope.kind === "chapter" && resource.scope.chapterId === target.appId) : document.resources
|
|
2492
2499
|
};
|
|
2493
2500
|
}
|
|
2494
2501
|
function promoteBuilderLibraryResource(input) {
|
|
@@ -3465,7 +3472,14 @@ async function createClerkUser(secretKey, input, fetchImpl = fetch) {
|
|
|
3465
3472
|
headers: { authorization: `Bearer ${secretKey}`, "content-type": "application/json" },
|
|
3466
3473
|
body: JSON.stringify(body)
|
|
3467
3474
|
});
|
|
3468
|
-
if (res.ok)
|
|
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
|
+
}
|
|
3469
3483
|
const healed = heal(res.status);
|
|
3470
3484
|
const repair = input.repairMetadata ?? {
|
|
3471
3485
|
...input.publicMetadata !== void 0 ? { publicMetadata: input.publicMetadata } : {},
|
|
@@ -3567,7 +3581,7 @@ var clerkIntegration = {
|
|
|
3567
3581
|
},
|
|
3568
3582
|
{
|
|
3569
3583
|
name: "clerk_secret_key",
|
|
3570
|
-
description: "Clerk backend key (sk_*) \u2014 powers account creation, the public role claim,
|
|
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.",
|
|
3571
3585
|
pattern: "sk_",
|
|
3572
3586
|
mode: "full",
|
|
3573
3587
|
required: false
|
|
@@ -3600,15 +3614,16 @@ var clerkIntegration = {
|
|
|
3600
3614
|
provision: {
|
|
3601
3615
|
human: [
|
|
3602
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).",
|
|
3603
|
-
'For auth mode "full": create the Clerk user-sync webhook
|
|
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).'
|
|
3604
3618
|
],
|
|
3605
3619
|
cli: [
|
|
3606
3620
|
"Clerk CLI (`npx clerk apps create/link/config patch`) creates + configures the instance and pulls the pk_.",
|
|
3607
|
-
"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."
|
|
3608
3623
|
],
|
|
3609
3624
|
doctor: [
|
|
3610
3625
|
"registry auth[env] present when the app mounts <SignIn>?",
|
|
3611
|
-
'auth mode "full" => whsec_ and clerk_secret_key
|
|
3626
|
+
'auth mode "full" => whsec_ present and the effective clerk_secret_key reports set via the reserved Clerk credential status?'
|
|
3612
3627
|
]
|
|
3613
3628
|
}
|
|
3614
3629
|
};
|