@odla-ai/chapter 0.42.1 → 0.42.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.
@@ -23,7 +23,7 @@ type TextFields$1<Key extends string> = {
23
23
  [Field in Key]: string;
24
24
  };
25
25
  /** User-visible language for sharing, delivery state, and leader rollups. */
26
- type AdminNetworkCopy = TextFields$1<"title" | "allowlistDescription" | "sharing" | "shareWith" | "shared" | "shareFailed" | "deliveryFailed" | "loadingRollup" | "loadRollupFailed" | "overview" | "configuredFollowers" | "reachableFollowers" | "recordsAcrossFollowers" | "noFollowers" | "followers" | "available" | "unavailable" | "recordTotals" | "noRecordTotals">;
26
+ type AdminNetworkCopy = TextFields$1<"title" | "allowlistDescription" | "sharing" | "shareWith" | "shared" | "shareFailed" | "deliveryFailed" | "loadingRollup" | "loadRollupFailed" | "overview" | "configuredFollowers" | "reachableFollowers" | "recordsAcrossFollowers" | "noFollowers" | "followers" | "available" | "unavailable" | "transportReachable" | "transportUnavailable" | "transportNotChecked" | "bindingTransport" | "urlTransport" | "activeConfiguration" | "noActiveConfiguration" | "publicSiteAvailable" | "publicSiteUnavailable" | "publicSiteNotChecked" | "recordTotals" | "noRecordTotals">;
27
27
 
28
28
  type TextFields<Key extends string> = {
29
29
  [Field in Key]: string;
@@ -192,6 +192,9 @@ interface ChapterNetworkTarget {
192
192
  /** Record types on which this leader permits remote lifecycle transitions.
193
193
  * The follower must independently opt in and remains pipeline authority. */
194
194
  stageTransitions?: readonly string[];
195
+ /** Allow package-owned desired admission decisions for existing leader CRM
196
+ * people to be delivered to this target. Omitted means default deny. */
197
+ admissionGrants?: boolean;
195
198
  }
196
199
  /** One signed peer allowed to browse a privacy-bounded projection of this
197
200
  * site's CRM. The follower owns this allowlist; a leader target declaration
@@ -201,7 +204,7 @@ interface ChapterNetworkReader {
201
204
  id: string;
202
205
  /** Per-record-type field allowlist. Omitted types and fields never leave
203
206
  * this site. Record id, name, stage, and timestamps are bounded metadata. */
204
- fields: Record<string, readonly string[]>;
207
+ fields?: Record<string, readonly string[]>;
205
208
  /** Record types on which this reader may append an explicitly shared note.
206
209
  * Omitted by default: browse permission never silently grants write access.
207
210
  * Shared notes land in the follower CRM activity feed. */
@@ -213,6 +216,9 @@ interface ChapterNetworkReader {
213
216
  /** Local CRM record types on which this reader may request a lifecycle
214
217
  * transition. Chapter still enforces the local pipeline and gates. */
215
218
  stageTransitions?: readonly string[];
219
+ /** Accept signed desired admission decisions from this reader. Independent
220
+ * of record browsing; an admission-only reader may omit `fields`. */
221
+ admissionGrants?: boolean;
216
222
  }
217
223
  /** Leader/follower network configuration. A follower needs no code config to
218
224
  * receive pushed records. It must explicitly declare `readers` before any peer
@@ -257,6 +263,7 @@ interface ResolvedNetworkTarget {
257
263
  sharedNotes: readonly string[];
258
264
  editableFields: Record<string, readonly string[]>;
259
265
  stageTransitions: readonly string[];
266
+ admissionGrants?: boolean;
260
267
  }
261
268
  /** A validated follower-owned record projection for one signed reader. */
262
269
  interface ResolvedNetworkReader {
@@ -265,6 +272,7 @@ interface ResolvedNetworkReader {
265
272
  sharedNotes: readonly string[];
266
273
  editableFields: Record<string, readonly string[]>;
267
274
  stageTransitions: readonly string[];
275
+ admissionGrants?: boolean;
268
276
  }
269
277
  /** Fully-resolved leader network configuration. */
270
278
  interface ResolvedNetwork {
@@ -1210,9 +1218,54 @@ interface AdmissionGrantDeliveryOptions {
1210
1218
  envelope: AdmissionGrantEnvelope;
1211
1219
  fetch?: typeof globalThis.fetch;
1212
1220
  }
1221
+ /** Structured follower rejection retained by the durable leader outbox. */
1222
+ declare class AdmissionGrantDeliveryError extends Error {
1223
+ readonly status: number;
1224
+ readonly reason: string;
1225
+ constructor(status: number, reason: string);
1226
+ }
1213
1227
  /** Deliver one signed Parent admission revision. Durable retry belongs upstream. */
1214
1228
  declare function deliverAdmissionGrants(options: AdmissionGrantDeliveryOptions): Promise<AdmissionGrantReceipt>;
1215
1229
 
1230
+ /** Durable state of the latest desired admission document for one target. */
1231
+ type LeaderAdmissionDeliveryStatus = "saved" | "pending" | "acknowledged" | "retrying" | "rejected";
1232
+ /** Leader-owned desired admission decision for one authoritative CRM person. */
1233
+ interface LeaderAdmissionAssignment {
1234
+ id: string;
1235
+ targetId: string;
1236
+ personId: string;
1237
+ grantId: string;
1238
+ decision: AdmissionDecision;
1239
+ note?: string;
1240
+ expiresAt?: number;
1241
+ active: boolean;
1242
+ lastMutationId: string;
1243
+ lastRequestDigest: string;
1244
+ createdAt: number;
1245
+ createdBy: string;
1246
+ updatedAt: number;
1247
+ updatedBy: string;
1248
+ }
1249
+ /** Persisted desired admission envelope and its latest delivery evidence. */
1250
+ interface LeaderAdmissionDelivery {
1251
+ id: string;
1252
+ targetId: string;
1253
+ environment: string;
1254
+ revision: number;
1255
+ digest: string;
1256
+ envelope: AdmissionGrantEnvelope;
1257
+ status: LeaderAdmissionDeliveryStatus;
1258
+ attempts: number;
1259
+ lastAttemptAt?: number;
1260
+ lastError?: string;
1261
+ acknowledgedAt?: number;
1262
+ updatedAt: number;
1263
+ }
1264
+
1265
+ /** Retry every non-final saved delivery. Hosts may call this from a cron using
1266
+ * the same Worker context; request retries use the packaged admin route. */
1267
+ declare function retryLeaderAdmissionDeliveries(env: ChapterEnv, ctx: WorkerContext, limit?: number): Promise<LeaderAdmissionDelivery[]>;
1268
+
1216
1269
  /** Identity shared by initial HTML, response caching, and client hydration. */
1217
1270
  interface SignupControlThemeMetadata {
1218
1271
  source: "active" | "bootstrap";
@@ -1283,4 +1336,4 @@ declare function chapterWorker(options: ChapterWorkerOptions): {
1283
1336
  fetch(req: Request, env: ChapterEnv): Promise<Response>;
1284
1337
  };
1285
1338
 
1286
- export { type ActiveSignupControlHtml, type ActiveSignupControlThemeOptions, type AdmissionGrantDeliveryOptions, type BuilderLibraryDeliveryOptions, type ChapterEnv, type ChapterWorkerOptions, type MemberContentDeliveryOptions, type Route, type SignupControlDeliveryOptions, type WorkerContext, chapterWorker, createWorkerContext, deliverAdmissionGrants, deliverBuilderLibrary, deliverMemberContent, deliverSignupControl, renderActiveSignupControlHtml, withActiveSignupControlTheme };
1339
+ export { type ActiveSignupControlHtml, type ActiveSignupControlThemeOptions, AdmissionGrantDeliveryError, type AdmissionGrantDeliveryOptions, type BuilderLibraryDeliveryOptions, type ChapterEnv, type ChapterWorkerOptions, type LeaderAdmissionAssignment, type LeaderAdmissionDelivery, type LeaderAdmissionDeliveryStatus, type MemberContentDeliveryOptions, type Route, type SignupControlDeliveryOptions, type WorkerContext, chapterWorker, createWorkerContext, deliverAdmissionGrants, deliverBuilderLibrary, deliverMemberContent, deliverSignupControl, renderActiveSignupControlHtml, retryLeaderAdmissionDeliveries, withActiveSignupControlTheme };
@@ -23,7 +23,7 @@ type TextFields$1<Key extends string> = {
23
23
  [Field in Key]: string;
24
24
  };
25
25
  /** User-visible language for sharing, delivery state, and leader rollups. */
26
- type AdminNetworkCopy = TextFields$1<"title" | "allowlistDescription" | "sharing" | "shareWith" | "shared" | "shareFailed" | "deliveryFailed" | "loadingRollup" | "loadRollupFailed" | "overview" | "configuredFollowers" | "reachableFollowers" | "recordsAcrossFollowers" | "noFollowers" | "followers" | "available" | "unavailable" | "recordTotals" | "noRecordTotals">;
26
+ type AdminNetworkCopy = TextFields$1<"title" | "allowlistDescription" | "sharing" | "shareWith" | "shared" | "shareFailed" | "deliveryFailed" | "loadingRollup" | "loadRollupFailed" | "overview" | "configuredFollowers" | "reachableFollowers" | "recordsAcrossFollowers" | "noFollowers" | "followers" | "available" | "unavailable" | "transportReachable" | "transportUnavailable" | "transportNotChecked" | "bindingTransport" | "urlTransport" | "activeConfiguration" | "noActiveConfiguration" | "publicSiteAvailable" | "publicSiteUnavailable" | "publicSiteNotChecked" | "recordTotals" | "noRecordTotals">;
27
27
 
28
28
  type TextFields<Key extends string> = {
29
29
  [Field in Key]: string;
@@ -192,6 +192,9 @@ interface ChapterNetworkTarget {
192
192
  /** Record types on which this leader permits remote lifecycle transitions.
193
193
  * The follower must independently opt in and remains pipeline authority. */
194
194
  stageTransitions?: readonly string[];
195
+ /** Allow package-owned desired admission decisions for existing leader CRM
196
+ * people to be delivered to this target. Omitted means default deny. */
197
+ admissionGrants?: boolean;
195
198
  }
196
199
  /** One signed peer allowed to browse a privacy-bounded projection of this
197
200
  * site's CRM. The follower owns this allowlist; a leader target declaration
@@ -201,7 +204,7 @@ interface ChapterNetworkReader {
201
204
  id: string;
202
205
  /** Per-record-type field allowlist. Omitted types and fields never leave
203
206
  * this site. Record id, name, stage, and timestamps are bounded metadata. */
204
- fields: Record<string, readonly string[]>;
207
+ fields?: Record<string, readonly string[]>;
205
208
  /** Record types on which this reader may append an explicitly shared note.
206
209
  * Omitted by default: browse permission never silently grants write access.
207
210
  * Shared notes land in the follower CRM activity feed. */
@@ -213,6 +216,9 @@ interface ChapterNetworkReader {
213
216
  /** Local CRM record types on which this reader may request a lifecycle
214
217
  * transition. Chapter still enforces the local pipeline and gates. */
215
218
  stageTransitions?: readonly string[];
219
+ /** Accept signed desired admission decisions from this reader. Independent
220
+ * of record browsing; an admission-only reader may omit `fields`. */
221
+ admissionGrants?: boolean;
216
222
  }
217
223
  /** Leader/follower network configuration. A follower needs no code config to
218
224
  * receive pushed records. It must explicitly declare `readers` before any peer
@@ -257,6 +263,7 @@ interface ResolvedNetworkTarget {
257
263
  sharedNotes: readonly string[];
258
264
  editableFields: Record<string, readonly string[]>;
259
265
  stageTransitions: readonly string[];
266
+ admissionGrants?: boolean;
260
267
  }
261
268
  /** A validated follower-owned record projection for one signed reader. */
262
269
  interface ResolvedNetworkReader {
@@ -265,6 +272,7 @@ interface ResolvedNetworkReader {
265
272
  sharedNotes: readonly string[];
266
273
  editableFields: Record<string, readonly string[]>;
267
274
  stageTransitions: readonly string[];
275
+ admissionGrants?: boolean;
268
276
  }
269
277
  /** Fully-resolved leader network configuration. */
270
278
  interface ResolvedNetwork {
@@ -1210,9 +1218,54 @@ interface AdmissionGrantDeliveryOptions {
1210
1218
  envelope: AdmissionGrantEnvelope;
1211
1219
  fetch?: typeof globalThis.fetch;
1212
1220
  }
1221
+ /** Structured follower rejection retained by the durable leader outbox. */
1222
+ declare class AdmissionGrantDeliveryError extends Error {
1223
+ readonly status: number;
1224
+ readonly reason: string;
1225
+ constructor(status: number, reason: string);
1226
+ }
1213
1227
  /** Deliver one signed Parent admission revision. Durable retry belongs upstream. */
1214
1228
  declare function deliverAdmissionGrants(options: AdmissionGrantDeliveryOptions): Promise<AdmissionGrantReceipt>;
1215
1229
 
1230
+ /** Durable state of the latest desired admission document for one target. */
1231
+ type LeaderAdmissionDeliveryStatus = "saved" | "pending" | "acknowledged" | "retrying" | "rejected";
1232
+ /** Leader-owned desired admission decision for one authoritative CRM person. */
1233
+ interface LeaderAdmissionAssignment {
1234
+ id: string;
1235
+ targetId: string;
1236
+ personId: string;
1237
+ grantId: string;
1238
+ decision: AdmissionDecision;
1239
+ note?: string;
1240
+ expiresAt?: number;
1241
+ active: boolean;
1242
+ lastMutationId: string;
1243
+ lastRequestDigest: string;
1244
+ createdAt: number;
1245
+ createdBy: string;
1246
+ updatedAt: number;
1247
+ updatedBy: string;
1248
+ }
1249
+ /** Persisted desired admission envelope and its latest delivery evidence. */
1250
+ interface LeaderAdmissionDelivery {
1251
+ id: string;
1252
+ targetId: string;
1253
+ environment: string;
1254
+ revision: number;
1255
+ digest: string;
1256
+ envelope: AdmissionGrantEnvelope;
1257
+ status: LeaderAdmissionDeliveryStatus;
1258
+ attempts: number;
1259
+ lastAttemptAt?: number;
1260
+ lastError?: string;
1261
+ acknowledgedAt?: number;
1262
+ updatedAt: number;
1263
+ }
1264
+
1265
+ /** Retry every non-final saved delivery. Hosts may call this from a cron using
1266
+ * the same Worker context; request retries use the packaged admin route. */
1267
+ declare function retryLeaderAdmissionDeliveries(env: ChapterEnv, ctx: WorkerContext, limit?: number): Promise<LeaderAdmissionDelivery[]>;
1268
+
1216
1269
  /** Identity shared by initial HTML, response caching, and client hydration. */
1217
1270
  interface SignupControlThemeMetadata {
1218
1271
  source: "active" | "bootstrap";
@@ -1283,4 +1336,4 @@ declare function chapterWorker(options: ChapterWorkerOptions): {
1283
1336
  fetch(req: Request, env: ChapterEnv): Promise<Response>;
1284
1337
  };
1285
1338
 
1286
- export { type ActiveSignupControlHtml, type ActiveSignupControlThemeOptions, type AdmissionGrantDeliveryOptions, type BuilderLibraryDeliveryOptions, type ChapterEnv, type ChapterWorkerOptions, type MemberContentDeliveryOptions, type Route, type SignupControlDeliveryOptions, type WorkerContext, chapterWorker, createWorkerContext, deliverAdmissionGrants, deliverBuilderLibrary, deliverMemberContent, deliverSignupControl, renderActiveSignupControlHtml, withActiveSignupControlTheme };
1339
+ export { type ActiveSignupControlHtml, type ActiveSignupControlThemeOptions, AdmissionGrantDeliveryError, type AdmissionGrantDeliveryOptions, type BuilderLibraryDeliveryOptions, type ChapterEnv, type ChapterWorkerOptions, type LeaderAdmissionAssignment, type LeaderAdmissionDelivery, type LeaderAdmissionDeliveryStatus, type MemberContentDeliveryOptions, type Route, type SignupControlDeliveryOptions, type WorkerContext, chapterWorker, createWorkerContext, deliverAdmissionGrants, deliverBuilderLibrary, deliverMemberContent, deliverSignupControl, renderActiveSignupControlHtml, retryLeaderAdmissionDeliveries, withActiveSignupControlTheme };