@hollware/core 0.2.0 → 0.3.0

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.mts CHANGED
@@ -311,6 +311,17 @@ interface HollwareConfig {
311
311
  * content exists. v0.1 serves exactly one site per deployment.
312
312
  */
313
313
  readonly sites: Readonly<Record<string, SiteDefinition>>;
314
+ /** How MCP clients and the admin get tokens (ADR-026). */
315
+ readonly auth?: AuthDefinition;
316
+ }
317
+ /** The OAuth server of a deployment. */
318
+ interface AuthDefinition {
319
+ /**
320
+ * Whether a client may register itself (RFC 7591), for MCP clients that cannot present a
321
+ * Client ID Metadata Document. Off by default: a registration is a write to KV that anyone can
322
+ * make, and MCP 2026-07-28 prefers metadata documents.
323
+ */
324
+ readonly dynamicClientRegistration?: boolean;
314
325
  }
315
326
  /** A collection once the config is resolved: checked, with every default filled in. */
316
327
  interface ResolvedCollection {
@@ -353,6 +364,11 @@ interface ResolvedEvents {
353
364
  /** The config once resolved, at the start of the Worker. v0.1 holds exactly one site. */
354
365
  interface ResolvedConfig {
355
366
  readonly sites: ReadonlyMap<string, ResolvedSite>;
367
+ readonly auth: ResolvedAuth;
368
+ }
369
+ /** The OAuth server once the config is resolved. */
370
+ interface ResolvedAuth {
371
+ readonly dynamicClientRegistration: boolean;
356
372
  }
357
373
  /**
358
374
  * Checks a config and fills in its defaults. It throws one error that lists every problem, each
@@ -412,7 +428,7 @@ export declare const DEFAULT_MAX_MARKDOWN_BYTES = 524288;
412
428
  */
413
429
  export declare const MAX_MARKDOWN_BYTES_CEILING = 786432;
414
430
  declare namespace schemas_d_exports {
415
- export { acknowledgedWarning, collectionDescription, collectionName, componentDescription, conflict, contractDescription, document, entry, entryId, entryStatus, entrySummary, format, locale, markdown, phase, publication, revisionId, severity, siteDescription, slug, verdict, version, violation };
431
+ export { acknowledgedWarning, collectionDescription, collectionName, componentDescription, conflict, contractDescription, document, entry, entryId, entryStatus, entrySummary, format, locale, markdown, phase, publication, review, reviewId, reviewStatus, revisionId, severity, siteDescription, slug, verdict, version, violation };
416
432
  }
417
433
  /**
418
434
  * The pieces the operation schemas share. Their descriptions become the JSON Schema that agents
@@ -639,6 +655,34 @@ declare const entry: z.ZodObject<{
639
655
  }, z.core.$strip>>;
640
656
  html: z.ZodOptional<z.ZodString>;
641
657
  }, z.core.$strip>;
658
+ declare const reviewId: z.ZodString;
659
+ declare const reviewStatus: z.ZodEnum<{
660
+ approved: "approved";
661
+ cancelled: "cancelled";
662
+ changes_requested: "changes_requested";
663
+ pending: "pending";
664
+ }>;
665
+ /**
666
+ * A request to publish a revision, made by someone who may write but not publish, and what a
667
+ * person who may publish decided about it.
668
+ */
669
+ declare const review: z.ZodObject<{
670
+ id: z.ZodString;
671
+ entryId: z.ZodString;
672
+ revision: z.ZodString;
673
+ status: z.ZodEnum<{
674
+ approved: "approved";
675
+ cancelled: "cancelled";
676
+ changes_requested: "changes_requested";
677
+ pending: "pending";
678
+ }>;
679
+ requestedBy: z.ZodString;
680
+ requestedByName: z.ZodNullable<z.ZodString>;
681
+ requestedAt: z.ZodString;
682
+ decidedBy: z.ZodNullable<z.ZodString>;
683
+ decidedAt: z.ZodNullable<z.ZodString>;
684
+ note: z.ZodNullable<z.ZodString>;
685
+ }, z.core.$strip>;
642
686
  declare const conflict: z.ZodObject<{
643
687
  currentVersion: z.ZodNumber;
644
688
  headRevision: z.ZodString;
@@ -991,13 +1035,19 @@ export declare class HollwareError extends Error {
991
1035
  */
992
1036
  /** The kinds of ids and their prefixes. A new kind adds its prefix here. */
993
1037
  export declare const ID_PREFIXES: {
1038
+ readonly challenge: 'chl';
994
1039
  readonly delivery: 'dlv';
995
1040
  readonly entry: 'ent';
996
1041
  readonly event: 'evt';
1042
+ readonly invitation: 'inv';
1043
+ readonly member: 'mbr';
1044
+ readonly passkey: 'pky';
997
1045
  readonly publication: 'pub';
998
1046
  readonly revision: 'rev';
999
1047
  readonly revisionTag: 'tag';
1048
+ readonly review: 'rvw';
1000
1049
  readonly schedule: 'sch';
1050
+ readonly session: 'ses';
1001
1051
  readonly token: 'tok';
1002
1052
  readonly user: 'usr';
1003
1053
  };
@@ -1186,6 +1236,7 @@ export declare const getEntry: OperationSpec<"get_entry", z.ZodObject<{
1186
1236
  html: "html";
1187
1237
  markdown: "markdown";
1188
1238
  }>>>;
1239
+ published: z.ZodDefault<z.ZodBoolean>;
1189
1240
  }, z.core.$strict>, z.ZodObject<{
1190
1241
  outcome: z.ZodEnum<{
1191
1242
  not_found: "not_found";
@@ -1495,6 +1546,7 @@ export declare const publish: OperationSpec<"publish", z.ZodObject<{
1495
1546
  conflict: "conflict";
1496
1547
  needs_acknowledgement: "needs_acknowledgement";
1497
1548
  not_found: "not_found";
1549
+ pending_review: "pending_review";
1498
1550
  published: "published";
1499
1551
  scheduled: "scheduled";
1500
1552
  }>;
@@ -1550,6 +1602,23 @@ export declare const publish: OperationSpec<"publish", z.ZodObject<{
1550
1602
  currentVersion: z.ZodNumber;
1551
1603
  headRevision: z.ZodString;
1552
1604
  }, z.core.$strip>>;
1605
+ review: z.ZodOptional<z.ZodObject<{
1606
+ id: z.ZodString;
1607
+ entryId: z.ZodString;
1608
+ revision: z.ZodString;
1609
+ status: z.ZodEnum<{
1610
+ approved: "approved";
1611
+ cancelled: "cancelled";
1612
+ changes_requested: "changes_requested";
1613
+ pending: "pending";
1614
+ }>;
1615
+ requestedBy: z.ZodString;
1616
+ requestedByName: z.ZodNullable<z.ZodString>;
1617
+ requestedAt: z.ZodString;
1618
+ decidedBy: z.ZodNullable<z.ZodString>;
1619
+ decidedAt: z.ZodNullable<z.ZodString>;
1620
+ note: z.ZodNullable<z.ZodString>;
1621
+ }, z.core.$strip>>;
1553
1622
  failedEntry: z.ZodOptional<z.ZodString>;
1554
1623
  }, z.core.$strip>>;
1555
1624
  export declare const unpublish: OperationSpec<"unpublish", z.ZodObject<{
@@ -1578,8 +1647,242 @@ export declare const unpublish: OperationSpec<"unpublish", z.ZodObject<{
1578
1647
  updatedAt: z.ZodString;
1579
1648
  }, z.core.$strip>>;
1580
1649
  }, z.core.$strip>>;
1581
- /** Every operation of v0.1, sorted by name: the order of `tools/list`. */
1582
- export declare const OPERATIONS: readonly [OperationSpec<"create_draft", z.ZodObject<{
1650
+ export declare const listReviews: OperationSpec<"list_reviews", z.ZodObject<{
1651
+ status: z.ZodDefault<z.ZodEnum<{
1652
+ approved: "approved";
1653
+ cancelled: "cancelled";
1654
+ changes_requested: "changes_requested";
1655
+ pending: "pending";
1656
+ }>>;
1657
+ limit: z.ZodDefault<z.ZodNumber>;
1658
+ }, z.core.$strict>, z.ZodObject<{
1659
+ outcome: z.ZodEnum<{
1660
+ ok: "ok";
1661
+ }>;
1662
+ reviews: z.ZodArray<z.ZodObject<{
1663
+ id: z.ZodString;
1664
+ entryId: z.ZodString;
1665
+ revision: z.ZodString;
1666
+ status: z.ZodEnum<{
1667
+ approved: "approved";
1668
+ cancelled: "cancelled";
1669
+ changes_requested: "changes_requested";
1670
+ pending: "pending";
1671
+ }>;
1672
+ requestedBy: z.ZodString;
1673
+ requestedByName: z.ZodNullable<z.ZodString>;
1674
+ requestedAt: z.ZodString;
1675
+ decidedBy: z.ZodNullable<z.ZodString>;
1676
+ decidedAt: z.ZodNullable<z.ZodString>;
1677
+ note: z.ZodNullable<z.ZodString>;
1678
+ entry: z.ZodObject<{
1679
+ id: z.ZodString;
1680
+ collection: z.ZodString;
1681
+ locale: z.ZodString;
1682
+ slug: z.ZodString;
1683
+ translationGroup: z.ZodNullable<z.ZodString>;
1684
+ status: z.ZodEnum<{
1685
+ draft: "draft";
1686
+ published: "published";
1687
+ scheduled: "scheduled";
1688
+ }>;
1689
+ version: z.ZodNumber;
1690
+ frontmatter: z.ZodRecord<z.ZodString, z.ZodUnknown>;
1691
+ tags: z.ZodArray<z.ZodString>;
1692
+ hasUnpublishedChanges: z.ZodBoolean;
1693
+ publishedAt: z.ZodNullable<z.ZodString>;
1694
+ updatedAt: z.ZodString;
1695
+ }, z.core.$strip>;
1696
+ }, z.core.$strip>>;
1697
+ }, z.core.$strip>>;
1698
+ export declare const approveReview: OperationSpec<"approve_review", z.ZodObject<{
1699
+ id: z.ZodString;
1700
+ acknowledgeWarnings: z.ZodDefault<z.ZodArray<z.ZodObject<{
1701
+ contract: z.ZodString;
1702
+ path: z.ZodString;
1703
+ }, z.core.$strip>>>;
1704
+ }, z.core.$strict>, z.ZodObject<{
1705
+ outcome: z.ZodEnum<{
1706
+ blocked: "blocked";
1707
+ needs_acknowledgement: "needs_acknowledgement";
1708
+ not_found: "not_found";
1709
+ not_pending: "not_pending";
1710
+ published: "published";
1711
+ }>;
1712
+ review: z.ZodOptional<z.ZodObject<{
1713
+ id: z.ZodString;
1714
+ entryId: z.ZodString;
1715
+ revision: z.ZodString;
1716
+ status: z.ZodEnum<{
1717
+ approved: "approved";
1718
+ cancelled: "cancelled";
1719
+ changes_requested: "changes_requested";
1720
+ pending: "pending";
1721
+ }>;
1722
+ requestedBy: z.ZodString;
1723
+ requestedByName: z.ZodNullable<z.ZodString>;
1724
+ requestedAt: z.ZodString;
1725
+ decidedBy: z.ZodNullable<z.ZodString>;
1726
+ decidedAt: z.ZodNullable<z.ZodString>;
1727
+ note: z.ZodNullable<z.ZodString>;
1728
+ }, z.core.$strip>>;
1729
+ entry: z.ZodOptional<z.ZodObject<{
1730
+ id: z.ZodString;
1731
+ collection: z.ZodString;
1732
+ locale: z.ZodString;
1733
+ slug: z.ZodString;
1734
+ translationGroup: z.ZodNullable<z.ZodString>;
1735
+ status: z.ZodEnum<{
1736
+ draft: "draft";
1737
+ published: "published";
1738
+ scheduled: "scheduled";
1739
+ }>;
1740
+ version: z.ZodNumber;
1741
+ frontmatter: z.ZodRecord<z.ZodString, z.ZodUnknown>;
1742
+ tags: z.ZodArray<z.ZodString>;
1743
+ hasUnpublishedChanges: z.ZodBoolean;
1744
+ publishedAt: z.ZodNullable<z.ZodString>;
1745
+ updatedAt: z.ZodString;
1746
+ }, z.core.$strip>>;
1747
+ verdict: z.ZodOptional<z.ZodObject<{
1748
+ ok: z.ZodBoolean;
1749
+ phase: z.ZodEnum<{
1750
+ publish: "publish";
1751
+ write: "write";
1752
+ }>;
1753
+ errors: z.ZodArray<z.ZodObject<{
1754
+ contract: z.ZodString;
1755
+ severity: z.ZodEnum<{
1756
+ error: "error";
1757
+ warning: "warning";
1758
+ }>;
1759
+ path: z.ZodString;
1760
+ message: z.ZodString;
1761
+ fix: z.ZodString;
1762
+ line: z.ZodOptional<z.ZodNumber>;
1763
+ }, z.core.$strip>>;
1764
+ warnings: z.ZodArray<z.ZodObject<{
1765
+ contract: z.ZodString;
1766
+ severity: z.ZodEnum<{
1767
+ error: "error";
1768
+ warning: "warning";
1769
+ }>;
1770
+ path: z.ZodString;
1771
+ message: z.ZodString;
1772
+ fix: z.ZodString;
1773
+ line: z.ZodOptional<z.ZodNumber>;
1774
+ }, z.core.$strip>>;
1775
+ contractsHash: z.ZodString;
1776
+ }, z.core.$strip>>;
1777
+ }, z.core.$strip>>;
1778
+ export declare const requestChanges: OperationSpec<"request_changes", z.ZodObject<{
1779
+ id: z.ZodString;
1780
+ note: z.ZodString;
1781
+ }, z.core.$strict>, z.ZodObject<{
1782
+ outcome: z.ZodEnum<{
1783
+ changes_requested: "changes_requested";
1784
+ not_found: "not_found";
1785
+ not_pending: "not_pending";
1786
+ }>;
1787
+ review: z.ZodOptional<z.ZodObject<{
1788
+ id: z.ZodString;
1789
+ entryId: z.ZodString;
1790
+ revision: z.ZodString;
1791
+ status: z.ZodEnum<{
1792
+ approved: "approved";
1793
+ cancelled: "cancelled";
1794
+ changes_requested: "changes_requested";
1795
+ pending: "pending";
1796
+ }>;
1797
+ requestedBy: z.ZodString;
1798
+ requestedByName: z.ZodNullable<z.ZodString>;
1799
+ requestedAt: z.ZodString;
1800
+ decidedBy: z.ZodNullable<z.ZodString>;
1801
+ decidedAt: z.ZodNullable<z.ZodString>;
1802
+ note: z.ZodNullable<z.ZodString>;
1803
+ }, z.core.$strip>>;
1804
+ }, z.core.$strip>>;
1805
+ /** Every operation, sorted by name: the order of `tools/list`. */
1806
+ export declare const OPERATIONS: readonly [OperationSpec<"approve_review", z.ZodObject<{
1807
+ id: z.ZodString;
1808
+ acknowledgeWarnings: z.ZodDefault<z.ZodArray<z.ZodObject<{
1809
+ contract: z.ZodString;
1810
+ path: z.ZodString;
1811
+ }, z.core.$strip>>>;
1812
+ }, z.core.$strict>, z.ZodObject<{
1813
+ outcome: z.ZodEnum<{
1814
+ blocked: "blocked";
1815
+ needs_acknowledgement: "needs_acknowledgement";
1816
+ not_found: "not_found";
1817
+ not_pending: "not_pending";
1818
+ published: "published";
1819
+ }>;
1820
+ review: z.ZodOptional<z.ZodObject<{
1821
+ id: z.ZodString;
1822
+ entryId: z.ZodString;
1823
+ revision: z.ZodString;
1824
+ status: z.ZodEnum<{
1825
+ approved: "approved";
1826
+ cancelled: "cancelled";
1827
+ changes_requested: "changes_requested";
1828
+ pending: "pending";
1829
+ }>;
1830
+ requestedBy: z.ZodString;
1831
+ requestedByName: z.ZodNullable<z.ZodString>;
1832
+ requestedAt: z.ZodString;
1833
+ decidedBy: z.ZodNullable<z.ZodString>;
1834
+ decidedAt: z.ZodNullable<z.ZodString>;
1835
+ note: z.ZodNullable<z.ZodString>;
1836
+ }, z.core.$strip>>;
1837
+ entry: z.ZodOptional<z.ZodObject<{
1838
+ id: z.ZodString;
1839
+ collection: z.ZodString;
1840
+ locale: z.ZodString;
1841
+ slug: z.ZodString;
1842
+ translationGroup: z.ZodNullable<z.ZodString>;
1843
+ status: z.ZodEnum<{
1844
+ draft: "draft";
1845
+ published: "published";
1846
+ scheduled: "scheduled";
1847
+ }>;
1848
+ version: z.ZodNumber;
1849
+ frontmatter: z.ZodRecord<z.ZodString, z.ZodUnknown>;
1850
+ tags: z.ZodArray<z.ZodString>;
1851
+ hasUnpublishedChanges: z.ZodBoolean;
1852
+ publishedAt: z.ZodNullable<z.ZodString>;
1853
+ updatedAt: z.ZodString;
1854
+ }, z.core.$strip>>;
1855
+ verdict: z.ZodOptional<z.ZodObject<{
1856
+ ok: z.ZodBoolean;
1857
+ phase: z.ZodEnum<{
1858
+ publish: "publish";
1859
+ write: "write";
1860
+ }>;
1861
+ errors: z.ZodArray<z.ZodObject<{
1862
+ contract: z.ZodString;
1863
+ severity: z.ZodEnum<{
1864
+ error: "error";
1865
+ warning: "warning";
1866
+ }>;
1867
+ path: z.ZodString;
1868
+ message: z.ZodString;
1869
+ fix: z.ZodString;
1870
+ line: z.ZodOptional<z.ZodNumber>;
1871
+ }, z.core.$strip>>;
1872
+ warnings: z.ZodArray<z.ZodObject<{
1873
+ contract: z.ZodString;
1874
+ severity: z.ZodEnum<{
1875
+ error: "error";
1876
+ warning: "warning";
1877
+ }>;
1878
+ path: z.ZodString;
1879
+ message: z.ZodString;
1880
+ fix: z.ZodString;
1881
+ line: z.ZodOptional<z.ZodNumber>;
1882
+ }, z.core.$strip>>;
1883
+ contractsHash: z.ZodString;
1884
+ }, z.core.$strip>>;
1885
+ }, z.core.$strip>>, OperationSpec<"create_draft", z.ZodObject<{
1583
1886
  collection: z.ZodString;
1584
1887
  locale: z.ZodString;
1585
1888
  slug: z.ZodString;
@@ -1684,6 +1987,7 @@ export declare const OPERATIONS: readonly [OperationSpec<"create_draft", z.ZodOb
1684
1987
  html: "html";
1685
1988
  markdown: "markdown";
1686
1989
  }>>>;
1990
+ published: z.ZodDefault<z.ZodBoolean>;
1687
1991
  }, z.core.$strict>, z.ZodObject<{
1688
1992
  outcome: z.ZodEnum<{
1689
1993
  not_found: "not_found";
@@ -1843,6 +2147,53 @@ export declare const OPERATIONS: readonly [OperationSpec<"create_draft", z.ZodOb
1843
2147
  updatedAt: z.ZodString;
1844
2148
  }, z.core.$strip>>;
1845
2149
  nextCursor: z.ZodNullable<z.ZodString>;
2150
+ }, z.core.$strip>>, OperationSpec<"list_reviews", z.ZodObject<{
2151
+ status: z.ZodDefault<z.ZodEnum<{
2152
+ approved: "approved";
2153
+ cancelled: "cancelled";
2154
+ changes_requested: "changes_requested";
2155
+ pending: "pending";
2156
+ }>>;
2157
+ limit: z.ZodDefault<z.ZodNumber>;
2158
+ }, z.core.$strict>, z.ZodObject<{
2159
+ outcome: z.ZodEnum<{
2160
+ ok: "ok";
2161
+ }>;
2162
+ reviews: z.ZodArray<z.ZodObject<{
2163
+ id: z.ZodString;
2164
+ entryId: z.ZodString;
2165
+ revision: z.ZodString;
2166
+ status: z.ZodEnum<{
2167
+ approved: "approved";
2168
+ cancelled: "cancelled";
2169
+ changes_requested: "changes_requested";
2170
+ pending: "pending";
2171
+ }>;
2172
+ requestedBy: z.ZodString;
2173
+ requestedByName: z.ZodNullable<z.ZodString>;
2174
+ requestedAt: z.ZodString;
2175
+ decidedBy: z.ZodNullable<z.ZodString>;
2176
+ decidedAt: z.ZodNullable<z.ZodString>;
2177
+ note: z.ZodNullable<z.ZodString>;
2178
+ entry: z.ZodObject<{
2179
+ id: z.ZodString;
2180
+ collection: z.ZodString;
2181
+ locale: z.ZodString;
2182
+ slug: z.ZodString;
2183
+ translationGroup: z.ZodNullable<z.ZodString>;
2184
+ status: z.ZodEnum<{
2185
+ draft: "draft";
2186
+ published: "published";
2187
+ scheduled: "scheduled";
2188
+ }>;
2189
+ version: z.ZodNumber;
2190
+ frontmatter: z.ZodRecord<z.ZodString, z.ZodUnknown>;
2191
+ tags: z.ZodArray<z.ZodString>;
2192
+ hasUnpublishedChanges: z.ZodBoolean;
2193
+ publishedAt: z.ZodNullable<z.ZodString>;
2194
+ updatedAt: z.ZodString;
2195
+ }, z.core.$strip>;
2196
+ }, z.core.$strip>>;
1846
2197
  }, z.core.$strip>>, OperationSpec<"publish", z.ZodObject<{
1847
2198
  id: z.ZodString;
1848
2199
  version: z.ZodNumber;
@@ -1861,6 +2212,7 @@ export declare const OPERATIONS: readonly [OperationSpec<"create_draft", z.ZodOb
1861
2212
  conflict: "conflict";
1862
2213
  needs_acknowledgement: "needs_acknowledgement";
1863
2214
  not_found: "not_found";
2215
+ pending_review: "pending_review";
1864
2216
  published: "published";
1865
2217
  scheduled: "scheduled";
1866
2218
  }>;
@@ -1916,7 +2268,50 @@ export declare const OPERATIONS: readonly [OperationSpec<"create_draft", z.ZodOb
1916
2268
  currentVersion: z.ZodNumber;
1917
2269
  headRevision: z.ZodString;
1918
2270
  }, z.core.$strip>>;
2271
+ review: z.ZodOptional<z.ZodObject<{
2272
+ id: z.ZodString;
2273
+ entryId: z.ZodString;
2274
+ revision: z.ZodString;
2275
+ status: z.ZodEnum<{
2276
+ approved: "approved";
2277
+ cancelled: "cancelled";
2278
+ changes_requested: "changes_requested";
2279
+ pending: "pending";
2280
+ }>;
2281
+ requestedBy: z.ZodString;
2282
+ requestedByName: z.ZodNullable<z.ZodString>;
2283
+ requestedAt: z.ZodString;
2284
+ decidedBy: z.ZodNullable<z.ZodString>;
2285
+ decidedAt: z.ZodNullable<z.ZodString>;
2286
+ note: z.ZodNullable<z.ZodString>;
2287
+ }, z.core.$strip>>;
1919
2288
  failedEntry: z.ZodOptional<z.ZodString>;
2289
+ }, z.core.$strip>>, OperationSpec<"request_changes", z.ZodObject<{
2290
+ id: z.ZodString;
2291
+ note: z.ZodString;
2292
+ }, z.core.$strict>, z.ZodObject<{
2293
+ outcome: z.ZodEnum<{
2294
+ changes_requested: "changes_requested";
2295
+ not_found: "not_found";
2296
+ not_pending: "not_pending";
2297
+ }>;
2298
+ review: z.ZodOptional<z.ZodObject<{
2299
+ id: z.ZodString;
2300
+ entryId: z.ZodString;
2301
+ revision: z.ZodString;
2302
+ status: z.ZodEnum<{
2303
+ approved: "approved";
2304
+ cancelled: "cancelled";
2305
+ changes_requested: "changes_requested";
2306
+ pending: "pending";
2307
+ }>;
2308
+ requestedBy: z.ZodString;
2309
+ requestedByName: z.ZodNullable<z.ZodString>;
2310
+ requestedAt: z.ZodString;
2311
+ decidedBy: z.ZodNullable<z.ZodString>;
2312
+ decidedAt: z.ZodNullable<z.ZodString>;
2313
+ note: z.ZodNullable<z.ZodString>;
2314
+ }, z.core.$strip>>;
1920
2315
  }, z.core.$strip>>, OperationSpec<"unpublish", z.ZodObject<{
1921
2316
  id: z.ZodString;
1922
2317
  }, z.core.$strict>, z.ZodObject<{
@@ -2104,4 +2499,4 @@ export declare function verifyWebhook(check: WebhookCheck): Promise<boolean>;
2104
2499
  //#region src/index.d.ts
2105
2500
  export declare const name = "@hollware/core";
2106
2501
  //#endregion
2107
- export { type AcknowledgedWarning, type BuiltInContractId, type BuiltInOptions, type CollectionDefinition, type ComponentDefinition, type ComponentUse, type ConfigProblem, type Contract, type ContractContext, type ContractDescription, type ContractFinding, type ContractText, type CustomContractOptions, type DescribedSchema, type DisallowedMarker, type Effect, type EntryDocument, type EntryFacts, type EntryLookup, type EntryRef, type ErrorCode, type ExtractedContent, type Heading, type HollwareConfig, type IdPrefix, type ImageRef, type LinkRef, type LinkTarget, type Operation, type OperationByName, type OperationName, type OperationSpec, type OutcomeInfo, type OutcomeOf, type Phase, type ProcessMarkdown, type ProcessMarkdownOptions, type ProcessResult, type ProcessedMarkdown, type RenderHtml, type ResolveConfig, type ResolvedCollection, type ResolvedConfig, type ResolvedSite, type RunContractsInput, type SchemaOutput, type Scope, type Severity, type SiteDefinition, type SiteDescription, type Verdict, type Violation, schemas_d_exports as schemas };
2502
+ export { type AcknowledgedWarning, type AuthDefinition, type BuiltInContractId, type BuiltInOptions, type CollectionDefinition, type ComponentDefinition, type ComponentUse, type ConfigProblem, type Contract, type ContractContext, type ContractDescription, type ContractFinding, type ContractText, type CustomContractOptions, type DescribedSchema, type DisallowedMarker, type Effect, type EntryDocument, type EntryFacts, type EntryLookup, type EntryRef, type ErrorCode, type ExtractedContent, type Heading, type HollwareConfig, type IdPrefix, type ImageRef, type LinkRef, type LinkTarget, type Operation, type OperationByName, type OperationName, type OperationSpec, type OutcomeInfo, type OutcomeOf, type Phase, type ProcessMarkdown, type ProcessMarkdownOptions, type ProcessResult, type ProcessedMarkdown, type RenderHtml, type ResolveConfig, type ResolvedAuth, type ResolvedCollection, type ResolvedConfig, type ResolvedSite, type RunContractsInput, type SchemaOutput, type Scope, type Severity, type SiteDefinition, type SiteDescription, type Verdict, type Violation, schemas_d_exports as schemas };
package/dist/index.mjs CHANGED
@@ -1591,6 +1591,21 @@ function readSites(raw, problems) {
1591
1591
  }
1592
1592
  return sites;
1593
1593
  }
1594
+ /** `auth` of the config: absent, or an object whose `dynamicClientRegistration` is a boolean. */
1595
+ function readAuth(raw, problems) {
1596
+ if (raw === void 0) return { dynamicClientRegistration: false };
1597
+ if (!isRecord$1(raw)) {
1598
+ problems.add("auth", wrongType(raw, "an object"), "Write auth: { dynamicClientRegistration: true }, or leave auth out.");
1599
+ return { dynamicClientRegistration: false };
1600
+ }
1601
+ const value = raw["dynamicClientRegistration"];
1602
+ if (value === void 0) return { dynamicClientRegistration: false };
1603
+ if (typeof value !== "boolean") {
1604
+ problems.add("auth.dynamicClientRegistration", wrongType(value, "true or false"), "Write true to let MCP clients register themselves, or leave it out.");
1605
+ return { dynamicClientRegistration: false };
1606
+ }
1607
+ return { dynamicClientRegistration: value };
1608
+ }
1594
1609
  /**
1595
1610
  * Checks the config of the deployment and fills in its defaults, or throws a `ConfigError` with
1596
1611
  * every problem it found, so that a broken `hollware.config.ts` stops the Worker at startup with
@@ -1620,10 +1635,16 @@ function readSites(raw, problems) {
1620
1635
  function resolveConfig(config) {
1621
1636
  const problems = new Problems();
1622
1637
  let sites = /* @__PURE__ */ new Map();
1623
- if (isRecord$1(config)) sites = readSites(config["sites"], problems);
1624
- else problems.add("config", wrongType(config, "an object"), "Export the result of defineConfig({ sites: { … } }) from hollware.config.ts.");
1638
+ let auth = { dynamicClientRegistration: false };
1639
+ if (isRecord$1(config)) {
1640
+ sites = readSites(config["sites"], problems);
1641
+ auth = readAuth(config["auth"], problems);
1642
+ } else problems.add("config", wrongType(config, "an object"), "Export the result of defineConfig({ sites: { … } }) from hollware.config.ts.");
1625
1643
  if (problems.list.length > 0) throw new ConfigError(problems.list);
1626
- return { sites };
1644
+ return {
1645
+ sites,
1646
+ auth
1647
+ };
1627
1648
  }
1628
1649
  //#endregion
1629
1650
  //#region src/errors.ts
@@ -1665,13 +1686,19 @@ var HollwareError = class extends Error {
1665
1686
  const CROCKFORD = "0123456789ABCDEFGHJKMNPQRSTVWXYZ";
1666
1687
  /** The kinds of ids and their prefixes. A new kind adds its prefix here. */
1667
1688
  const ID_PREFIXES = {
1689
+ challenge: "chl",
1668
1690
  delivery: "dlv",
1669
1691
  entry: "ent",
1670
1692
  event: "evt",
1693
+ invitation: "inv",
1694
+ member: "mbr",
1695
+ passkey: "pky",
1671
1696
  publication: "pub",
1672
1697
  revision: "rev",
1673
1698
  revisionTag: "tag",
1699
+ review: "rvw",
1674
1700
  schedule: "sch",
1701
+ session: "ses",
1675
1702
  token: "tok",
1676
1703
  user: "usr"
1677
1704
  };
@@ -3007,6 +3034,9 @@ var schemas_exports = /* @__PURE__ */ __exportAll({
3007
3034
  markdown: () => markdown,
3008
3035
  phase: () => phase,
3009
3036
  publication: () => publication,
3037
+ review: () => review,
3038
+ reviewId: () => reviewId,
3039
+ reviewStatus: () => reviewStatus,
3010
3040
  revisionId: () => revisionId,
3011
3041
  severity: () => severity,
3012
3042
  siteDescription: () => siteDescription,
@@ -3086,6 +3116,29 @@ const entry = entrySummary.extend({
3086
3116
  document: document.optional(),
3087
3117
  html: z.string().optional()
3088
3118
  });
3119
+ const reviewId = z.string().regex(/^rvw_[0-9A-HJKMNP-TV-Z]{26}$/).describe("The id of a review (rvw_…), as publish and list_reviews return it.");
3120
+ const reviewStatus = z.enum([
3121
+ "pending",
3122
+ "approved",
3123
+ "changes_requested",
3124
+ "cancelled"
3125
+ ]);
3126
+ /**
3127
+ * A request to publish a revision, made by someone who may write but not publish, and what a
3128
+ * person who may publish decided about it.
3129
+ */
3130
+ const review = z.object({
3131
+ id: reviewId,
3132
+ entryId,
3133
+ revision: revisionId.describe("The revision asked for."),
3134
+ status: reviewStatus.describe("pending until someone decides; cancelled when a new revision of the entry is saved."),
3135
+ requestedBy: z.string().describe("The user who asked."),
3136
+ requestedByName: z.string().nullable().describe("The name of the user who asked, if they gave one."),
3137
+ requestedAt: z.string(),
3138
+ decidedBy: z.string().nullable(),
3139
+ decidedAt: z.string().nullable(),
3140
+ note: z.string().nullable().describe("What the reviewer asked to change, or null.")
3141
+ });
3089
3142
  const conflict = z.object({
3090
3143
  currentVersion: z.number().int().min(1),
3091
3144
  headRevision: revisionId
@@ -3181,7 +3234,8 @@ const getEntry = defineOperation({
3181
3234
  collection: collectionName,
3182
3235
  locale,
3183
3236
  slug,
3184
- formats: z.array(format).min(1).default(["markdown"]).describe("What to return of the revision: markdown, the Comark document, or html.")
3237
+ formats: z.array(format).min(1).default(["markdown"]).describe("What to return of the revision: markdown, the Comark document, or html."),
3238
+ published: z.boolean().default(false).describe("Read the revision that is live instead of the latest one: not_found when the entry is not published.")
3185
3239
  }),
3186
3240
  output: z.object({
3187
3241
  outcome: z.enum(["ok", "not_found"]),
@@ -3287,7 +3341,7 @@ const validate = defineOperation({
3287
3341
  const publish = defineOperation({
3288
3342
  name: "publish",
3289
3343
  title: "Publish an entry",
3290
- description: "Publishes the latest revision of an entry, if the entry is still at the version you read, and with group, other entries in the same step. It is blocked while the contracts report errors. Warnings have to be acknowledged: an answer of needs_acknowledgement lists them, and publish again with them in acknowledgeWarnings. Publish entries that link to each other as one group.",
3344
+ description: "Publishes the latest revision of an entry, if the entry is still at the version you read, and with group, other entries in the same step. It is blocked while the contracts report errors. Warnings have to be acknowledged: an answer of needs_acknowledgement lists them, and publish again with them in acknowledgeWarnings. Publish entries that link to each other as one group. Without content:publish, the same checks run and the answer is pending_review: a person who may publish approves the revision or asks for changes, and a new revision of the entry cancels the request. A review is for one entry, now: never with group or publishAt.",
3291
3345
  input: z.strictObject({
3292
3346
  id: entryId,
3293
3347
  version,
@@ -3304,21 +3358,24 @@ const publish = defineOperation({
3304
3358
  "scheduled",
3305
3359
  "blocked",
3306
3360
  "needs_acknowledgement",
3361
+ "pending_review",
3307
3362
  "conflict",
3308
3363
  "not_found"
3309
3364
  ]),
3310
3365
  entry: entrySummary.optional(),
3311
3366
  verdict: verdict.optional(),
3312
3367
  conflict: conflict.optional(),
3313
- failedEntry: entryId.optional().describe("In a group, the entry that kept the group from being published.")
3368
+ review: review.optional().describe("With pending_review: the request, as list_reviews shows it."),
3369
+ failedEntry: entryId.optional().describe("In a group, the entry that kept the group from being published: blocked, stale, missing, or with a warning to acknowledge.")
3314
3370
  }),
3315
- scopes: ["content:publish"],
3371
+ scopes: ["content:write"],
3316
3372
  effect: "write",
3317
3373
  outcomes: {
3318
3374
  published: { isError: false },
3319
3375
  scheduled: { isError: false },
3320
3376
  blocked: { isError: true },
3321
3377
  needs_acknowledgement: { isError: false },
3378
+ pending_review: { isError: false },
3322
3379
  conflict: { isError: true },
3323
3380
  not_found: { isError: true }
3324
3381
  }
@@ -3339,14 +3396,87 @@ const unpublish = defineOperation({
3339
3396
  not_found: { isError: true }
3340
3397
  }
3341
3398
  });
3342
- /** Every operation of v0.1, sorted by name: the order of `tools/list`. */
3399
+ const listReviews = defineOperation({
3400
+ name: "list_reviews",
3401
+ title: "List the reviews",
3402
+ description: "Lists the requests to publish, newest first, with the entry each one is for: the pending ones unless you name another status.",
3403
+ input: z.strictObject({
3404
+ status: reviewStatus.default("pending"),
3405
+ limit: z.number().int().min(1).max(100).default(50)
3406
+ }),
3407
+ output: z.object({
3408
+ outcome: z.enum(["ok"]),
3409
+ reviews: z.array(review.extend({ entry: entrySummary }))
3410
+ }),
3411
+ scopes: ["content:read"],
3412
+ effect: "read",
3413
+ outcomes: { ok: { isError: false } }
3414
+ });
3415
+ const approveReview = defineOperation({
3416
+ name: "approve_review",
3417
+ title: "Approve a review",
3418
+ description: "Publishes the revision a review asked for, in your name, after the contracts run again as publish runs them. The warnings the request acknowledged count as acknowledged; a new one answers needs_acknowledgement, and you approve again with it in acknowledgeWarnings.",
3419
+ input: z.strictObject({
3420
+ id: reviewId,
3421
+ acknowledgeWarnings: z.array(acknowledgedWarning).default([]).describe("Warnings you accept besides those the request acknowledged.")
3422
+ }),
3423
+ output: z.object({
3424
+ outcome: z.enum([
3425
+ "published",
3426
+ "blocked",
3427
+ "needs_acknowledgement",
3428
+ "not_pending",
3429
+ "not_found"
3430
+ ]),
3431
+ review: review.optional(),
3432
+ entry: entrySummary.optional(),
3433
+ verdict: verdict.optional()
3434
+ }),
3435
+ scopes: ["content:publish"],
3436
+ effect: "write",
3437
+ outcomes: {
3438
+ published: { isError: false },
3439
+ blocked: { isError: true },
3440
+ needs_acknowledgement: { isError: false },
3441
+ not_pending: { isError: true },
3442
+ not_found: { isError: true }
3443
+ }
3444
+ });
3445
+ const requestChanges = defineOperation({
3446
+ name: "request_changes",
3447
+ title: "Ask for changes",
3448
+ description: "Closes a pending review without publishing, with a note that says what to change. The author saves a new revision and asks again.",
3449
+ input: z.strictObject({
3450
+ id: reviewId,
3451
+ note: z.string().trim().min(1).max(4e3).describe("What to change, for the author.")
3452
+ }),
3453
+ output: z.object({
3454
+ outcome: z.enum([
3455
+ "changes_requested",
3456
+ "not_pending",
3457
+ "not_found"
3458
+ ]),
3459
+ review: review.optional()
3460
+ }),
3461
+ scopes: ["content:publish"],
3462
+ effect: "edit",
3463
+ outcomes: {
3464
+ changes_requested: { isError: false },
3465
+ not_pending: { isError: true },
3466
+ not_found: { isError: true }
3467
+ }
3468
+ });
3469
+ /** Every operation, sorted by name: the order of `tools/list`. */
3343
3470
  const OPERATIONS = [
3471
+ approveReview,
3344
3472
  createDraft,
3345
3473
  describeSite,
3346
3474
  getEntry,
3347
3475
  getTranslations,
3348
3476
  listEntries,
3477
+ listReviews,
3349
3478
  publish,
3479
+ requestChanges,
3350
3480
  unpublish,
3351
3481
  updateDraft,
3352
3482
  validate
@@ -3449,4 +3579,4 @@ async function verifyWebhook(check) {
3449
3579
  //#region src/index.ts
3450
3580
  const name = "@hollware/core";
3451
3581
  //#endregion
3452
- export { BUILT_IN_CONTRACT_IDS, COMARK_VERSION, ConfigError, DEFAULT_MAX_MARKDOWN_BYTES, ERROR_CODES, EVENT_ID_HEADER, HollwareError, ID_PREFIXES, MAX_MARKDOWN_BYTES_CEILING, OPERATIONS, PERSONAL_TOKEN_PREFIX, PERSONAL_TOKEN_TTL_DAYS, PIPELINE_VERSION, REFUSAL_CONTRACT_IDS, SCOPES, SIGNATURE_HEADER, SITE_KEY_MAX_LENGTH, SITE_KEY_PATTERN, TIMESTAMP_HEADER, contracts, createDraft, defineCollection, defineComponent, defineConfig, defineContract, defineOperation, describeBuiltInContracts, describeContract, describeResolvedSite, describeSite, generatePersonalToken, getEntry, getTranslations, hashPersonalToken, isBuiltInContract, isId, isPersonalToken, isScope, isSiteKey, listEntries, name, newId, processMarkdown, publish, renderHtml, resolveConfig, runContracts, schemas_exports as schemas, signWebhook, sizeLimitViolation, ulid, uniqueSlugViolation, uniqueTranslationViolation, unpublish, updateDraft, validate, verifyWebhook };
3582
+ export { BUILT_IN_CONTRACT_IDS, COMARK_VERSION, ConfigError, DEFAULT_MAX_MARKDOWN_BYTES, ERROR_CODES, EVENT_ID_HEADER, HollwareError, ID_PREFIXES, MAX_MARKDOWN_BYTES_CEILING, OPERATIONS, PERSONAL_TOKEN_PREFIX, PERSONAL_TOKEN_TTL_DAYS, PIPELINE_VERSION, REFUSAL_CONTRACT_IDS, SCOPES, SIGNATURE_HEADER, SITE_KEY_MAX_LENGTH, SITE_KEY_PATTERN, TIMESTAMP_HEADER, approveReview, contracts, createDraft, defineCollection, defineComponent, defineConfig, defineContract, defineOperation, describeBuiltInContracts, describeContract, describeResolvedSite, describeSite, generatePersonalToken, getEntry, getTranslations, hashPersonalToken, isBuiltInContract, isId, isPersonalToken, isScope, isSiteKey, listEntries, listReviews, name, newId, processMarkdown, publish, renderHtml, requestChanges, resolveConfig, runContracts, schemas_exports as schemas, signWebhook, sizeLimitViolation, ulid, uniqueSlugViolation, uniqueTranslationViolation, unpublish, updateDraft, validate, verifyWebhook };
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@hollware/core",
3
- "version": "0.2.0",
3
+ "version": "0.3.0",
4
4
  "description": "Contracts, operation specs, schemas and the Markdown pipeline of Hollware. No Cloudflare dependencies.",
5
5
  "homepage": "https://hollware.com",
6
6
  "bugs": {