@odla-ai/chapter 0.39.1 → 0.39.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
@@ -207,16 +207,14 @@ interface ResolvedMemberContent {
207
207
  interface ChapterBuilderLibrary {
208
208
  /** Keep local admin authoring enabled. Defaults to true. */
209
209
  localAuthoring?: boolean;
210
- /** Signed sources this app accepts. Hub sources are Chapters; Chapter sources are Built Not Found. */
210
+ /** Existing Chapter-network peers this app accepts. Hub sources must be
211
+ * configured network targets; a Chapter source must be a configured reader. */
211
212
  sources?: readonly {
212
213
  sourceId: string;
213
- /** Vault key holding the dedicated Builder Library edge secret. */
214
- secretName?: string;
215
214
  }[];
216
215
  }
217
216
  interface ResolvedBuilderLibrarySource {
218
217
  sourceId: string;
219
- secretName: string;
220
218
  }
221
219
  /** Validated Builder Library settings carried on a resolved Chapter. */
222
220
  interface ResolvedBuilderLibrary {
@@ -796,8 +794,9 @@ declare function resolveSignupControl(input: ChapterSignupControl | undefined):
796
794
  /** Validate the deliberately separate member-content authoring boundary. */
797
795
  declare function resolveMemberContent(input: ChapterMemberContent | undefined): ResolvedMemberContent | null;
798
796
 
799
- /** Validate the private Builder Library federation boundary. */
800
- declare function resolveBuilderLibrary(mode: ChapterMode, input: ChapterBuilderLibrary | undefined): ResolvedBuilderLibrary | null;
797
+ /** Validate the private Builder Library boundary against Chapter's existing
798
+ * network peers. Builder Library never introduces a second edge credential. */
799
+ declare function resolveBuilderLibrary(mode: ChapterMode, input: ChapterBuilderLibrary | undefined, network?: ResolvedNetwork): ResolvedBuilderLibrary | null;
801
800
 
802
801
  /** Options for {@link leaderCrmConfig}. */
803
802
  interface LeaderCrmOptions {
package/dist/index.d.ts CHANGED
@@ -207,16 +207,14 @@ interface ResolvedMemberContent {
207
207
  interface ChapterBuilderLibrary {
208
208
  /** Keep local admin authoring enabled. Defaults to true. */
209
209
  localAuthoring?: boolean;
210
- /** Signed sources this app accepts. Hub sources are Chapters; Chapter sources are Built Not Found. */
210
+ /** Existing Chapter-network peers this app accepts. Hub sources must be
211
+ * configured network targets; a Chapter source must be a configured reader. */
211
212
  sources?: readonly {
212
213
  sourceId: string;
213
- /** Vault key holding the dedicated Builder Library edge secret. */
214
- secretName?: string;
215
214
  }[];
216
215
  }
217
216
  interface ResolvedBuilderLibrarySource {
218
217
  sourceId: string;
219
- secretName: string;
220
218
  }
221
219
  /** Validated Builder Library settings carried on a resolved Chapter. */
222
220
  interface ResolvedBuilderLibrary {
@@ -796,8 +794,9 @@ declare function resolveSignupControl(input: ChapterSignupControl | undefined):
796
794
  /** Validate the deliberately separate member-content authoring boundary. */
797
795
  declare function resolveMemberContent(input: ChapterMemberContent | undefined): ResolvedMemberContent | null;
798
796
 
799
- /** Validate the private Builder Library federation boundary. */
800
- declare function resolveBuilderLibrary(mode: ChapterMode, input: ChapterBuilderLibrary | undefined): ResolvedBuilderLibrary | null;
797
+ /** Validate the private Builder Library boundary against Chapter's existing
798
+ * network peers. Builder Library never introduces a second edge credential. */
799
+ declare function resolveBuilderLibrary(mode: ChapterMode, input: ChapterBuilderLibrary | undefined, network?: ResolvedNetwork): ResolvedBuilderLibrary | null;
801
800
 
802
801
  /** Options for {@link leaderCrmConfig}. */
803
802
  interface LeaderCrmOptions {
package/dist/index.js CHANGED
@@ -1523,8 +1523,7 @@ function resolveMemberContent(input) {
1523
1523
 
1524
1524
  // src/config-builder-library.ts
1525
1525
  var SLUG4 = /^[a-z0-9][a-z0-9-]{1,62}$/;
1526
- var SECRET_NAME3 = /^[a-z][a-z0-9_]{1,127}$/;
1527
- function resolveBuilderLibrary(mode, input) {
1526
+ function resolveBuilderLibrary(mode, input, network = { targets: [], readers: [] }) {
1528
1527
  if (!input) return null;
1529
1528
  if (input.sources !== void 0 && !Array.isArray(input.sources)) {
1530
1529
  throw new Error("defineChapter.builderLibrary.sources: must be an array");
@@ -1544,11 +1543,19 @@ function resolveBuilderLibrary(mode, input) {
1544
1543
  throw new Error(`defineChapter.builderLibrary.sources: duplicate source "${source.sourceId}"`);
1545
1544
  }
1546
1545
  seen.add(source.sourceId);
1547
- const secretName = source.secretName?.trim() || "builder_library_control_secret";
1548
- if (!SECRET_NAME3.test(secretName)) {
1549
- throw new Error(`defineChapter.builderLibrary.sources[${index}].secretName: must be a vault-key identifier`);
1546
+ if ("secretName" in source) {
1547
+ throw new Error(
1548
+ `defineChapter.builderLibrary.sources[${index}].secretName: remove this field; Builder Library reuses the Chapter network edge`
1549
+ );
1550
1550
  }
1551
- return { sourceId: source.sourceId, secretName };
1551
+ const networkPeer = mode === "hub" ? network.targets.some((target) => target.id === source.sourceId) : network.readers.some((reader) => reader.id === source.sourceId);
1552
+ if (!networkPeer) {
1553
+ const side = mode === "hub" ? "targets" : "readers";
1554
+ throw new Error(
1555
+ `defineChapter.builderLibrary.sources[${index}]: "${source.sourceId}" must already be configured in network.${side}`
1556
+ );
1557
+ }
1558
+ return { sourceId: source.sourceId };
1552
1559
  });
1553
1560
  return { enabled: true, localAuthoring: input.localAuthoring !== false, sources };
1554
1561
  }
@@ -1587,7 +1594,7 @@ function defineChapter(config) {
1587
1594
  const network = resolveNetwork(config, crm);
1588
1595
  const signupControl = resolveSignupControl(config.signupControl);
1589
1596
  const memberContent = resolveMemberContent(config.memberContent);
1590
- const builderLibrary = resolveBuilderLibrary(mode, config.builderLibrary);
1597
+ const builderLibrary = resolveBuilderLibrary(mode, config.builderLibrary, network);
1591
1598
  const formation = resolveLeaderFormation(config.formation, crm);
1592
1599
  if (signupControl && mode !== "chapter") {
1593
1600
  throw new Error("defineChapter.signupControl: only chapter-mode followers can receive signup control");
@@ -1911,13 +1918,6 @@ function createChapterIntegration(chapter, options = {}) {
1911
1918
  ...emails?.debugEmail ? { debugEmail: emails.debugEmail } : {}
1912
1919
  });
1913
1920
  const seeds = [...crmDesc.seeds ?? []];
1914
- const builderLibrarySecrets = [...new Set(
1915
- chapter.builderLibrary?.sources.map((source) => source.secretName) ?? []
1916
- )].map((name) => ({
1917
- name,
1918
- description: "Signing secret for private Builder Library delivery from a configured source.",
1919
- required: true
1920
- }));
1921
1921
  const group = chapter.groupSeed();
1922
1922
  if (group) {
1923
1923
  seeds.push({ id: "group", ns: "groups", key: { attr: "id", value: chapter.id }, attrs: { ...group, createdAt: now } });
@@ -1950,7 +1950,7 @@ function createChapterIntegration(chapter, options = {}) {
1950
1950
  },
1951
1951
  rules: { ...crmDesc.rules, ...chapter.rules },
1952
1952
  seeds,
1953
- secrets: builderLibrarySecrets,
1953
+ secrets: [],
1954
1954
  probes: [
1955
1955
  ...crmDesc.probes ?? [],
1956
1956
  // The snapshot route is deliberately private. A credential-free smoke