@hollware/core 0.4.0 → 0.6.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
@@ -439,7 +439,7 @@ export declare const DEFAULT_MAX_MARKDOWN_BYTES = 524288;
439
439
  */
440
440
  export declare const MAX_MARKDOWN_BYTES_CEILING = 786432;
441
441
  declare namespace schemas_d_exports {
442
- 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 };
442
+ export { acknowledgedWarning, collectionDescription, collectionName, componentDescription, conflict, contractDescription, document, entry, entryId, entryStatus, entrySummary, format, locale, markdown, phase, publication, review, reviewComment, reviewId, reviewStatus, revisionId, searchMode, severity, siteDescription, slug, verdict, version, violation };
443
443
  }
444
444
  /**
445
445
  * The pieces the operation schemas share. Their descriptions become the JSON Schema that agents
@@ -694,6 +694,15 @@ declare const review: z.ZodObject<{
694
694
  decidedAt: z.ZodNullable<z.ZodString>;
695
695
  note: z.ZodNullable<z.ZodString>;
696
696
  }, z.core.$strip>;
697
+ /** A comment on a review (v0.6), by a person or by the agent of one. */
698
+ declare const reviewComment: z.ZodObject<{
699
+ id: z.ZodString;
700
+ author: z.ZodString;
701
+ authorName: z.ZodNullable<z.ZodString>;
702
+ client: z.ZodNullable<z.ZodString>;
703
+ body: z.ZodString;
704
+ at: z.ZodString;
705
+ }, z.core.$strip>;
697
706
  declare const conflict: z.ZodObject<{
698
707
  currentVersion: z.ZodNumber;
699
708
  headRevision: z.ZodString;
@@ -703,6 +712,12 @@ declare const format: z.ZodEnum<{
703
712
  html: "html";
704
713
  markdown: "markdown";
705
714
  }>;
715
+ /** How a search is made: by its words, by meaning, or both merged (ADR-030). */
716
+ declare const searchMode: z.ZodEnum<{
717
+ fulltext: "fulltext";
718
+ hybrid: "hybrid";
719
+ semantic: "semantic";
720
+ }>;
706
721
  declare const componentDescription: z.ZodObject<{
707
722
  name: z.ZodString;
708
723
  description: z.ZodNullable<z.ZodString>;
@@ -1048,6 +1063,7 @@ export declare class HollwareError extends Error {
1048
1063
  export declare const ID_PREFIXES: {
1049
1064
  readonly challenge: 'chl';
1050
1065
  readonly delivery: 'dlv';
1066
+ readonly embedding: 'emb';
1051
1067
  readonly entry: 'ent';
1052
1068
  readonly event: 'evt';
1053
1069
  readonly invitation: 'inv';
@@ -1057,6 +1073,7 @@ export declare const ID_PREFIXES: {
1057
1073
  readonly revision: 'rev';
1058
1074
  readonly revisionTag: 'tag';
1059
1075
  readonly review: 'rvw';
1076
+ readonly reviewComment: 'rvc';
1060
1077
  readonly schedule: 'sch';
1061
1078
  readonly session: 'ses';
1062
1079
  readonly token: 'tok';
@@ -1238,6 +1255,48 @@ export declare const listEntries: OperationSpec<"list_entries", z.ZodObject<{
1238
1255
  }, z.core.$strip>>;
1239
1256
  nextCursor: z.ZodNullable<z.ZodString>;
1240
1257
  }, z.core.$strip>>;
1258
+ export declare const search: OperationSpec<"search", z.ZodObject<{
1259
+ query: z.ZodString;
1260
+ collection: z.ZodOptional<z.ZodString>;
1261
+ locale: z.ZodOptional<z.ZodString>;
1262
+ limit: z.ZodDefault<z.ZodNumber>;
1263
+ mode: z.ZodOptional<z.ZodEnum<{
1264
+ fulltext: "fulltext";
1265
+ hybrid: "hybrid";
1266
+ semantic: "semantic";
1267
+ }>>;
1268
+ }, z.core.$strict>, z.ZodObject<{
1269
+ outcome: z.ZodEnum<{
1270
+ ok: "ok";
1271
+ }>;
1272
+ mode: z.ZodEnum<{
1273
+ fulltext: "fulltext";
1274
+ hybrid: "hybrid";
1275
+ semantic: "semantic";
1276
+ }>;
1277
+ results: z.ZodArray<z.ZodObject<{
1278
+ entry: z.ZodObject<{
1279
+ id: z.ZodString;
1280
+ collection: z.ZodString;
1281
+ locale: z.ZodString;
1282
+ slug: z.ZodString;
1283
+ translationGroup: z.ZodNullable<z.ZodString>;
1284
+ status: z.ZodEnum<{
1285
+ draft: "draft";
1286
+ published: "published";
1287
+ scheduled: "scheduled";
1288
+ }>;
1289
+ version: z.ZodNumber;
1290
+ frontmatter: z.ZodRecord<z.ZodString, z.ZodUnknown>;
1291
+ tags: z.ZodArray<z.ZodString>;
1292
+ hasUnpublishedChanges: z.ZodBoolean;
1293
+ publishedAt: z.ZodNullable<z.ZodString>;
1294
+ updatedAt: z.ZodString;
1295
+ }, z.core.$strip>;
1296
+ snippet: z.ZodString;
1297
+ score: z.ZodNumber;
1298
+ }, z.core.$strip>>;
1299
+ }, z.core.$strip>>;
1241
1300
  export declare const getEntry: OperationSpec<"get_entry", z.ZodObject<{
1242
1301
  collection: z.ZodString;
1243
1302
  locale: z.ZodString;
@@ -1248,6 +1307,7 @@ export declare const getEntry: OperationSpec<"get_entry", z.ZodObject<{
1248
1307
  markdown: "markdown";
1249
1308
  }>>>;
1250
1309
  published: z.ZodDefault<z.ZodBoolean>;
1310
+ related: z.ZodDefault<z.ZodBoolean>;
1251
1311
  }, z.core.$strict>, z.ZodObject<{
1252
1312
  outcome: z.ZodEnum<{
1253
1313
  not_found: "not_found";
@@ -1347,6 +1407,24 @@ export declare const getEntry: OperationSpec<"get_entry", z.ZodObject<{
1347
1407
  }, z.core.$strip>>;
1348
1408
  html: z.ZodOptional<z.ZodString>;
1349
1409
  }, z.core.$strip>>;
1410
+ related: z.ZodOptional<z.ZodArray<z.ZodObject<{
1411
+ id: z.ZodString;
1412
+ collection: z.ZodString;
1413
+ locale: z.ZodString;
1414
+ slug: z.ZodString;
1415
+ translationGroup: z.ZodNullable<z.ZodString>;
1416
+ status: z.ZodEnum<{
1417
+ draft: "draft";
1418
+ published: "published";
1419
+ scheduled: "scheduled";
1420
+ }>;
1421
+ version: z.ZodNumber;
1422
+ frontmatter: z.ZodRecord<z.ZodString, z.ZodUnknown>;
1423
+ tags: z.ZodArray<z.ZodString>;
1424
+ hasUnpublishedChanges: z.ZodBoolean;
1425
+ publishedAt: z.ZodNullable<z.ZodString>;
1426
+ updatedAt: z.ZodString;
1427
+ }, z.core.$strip>>>;
1350
1428
  }, z.core.$strip>>;
1351
1429
  export declare const getTranslations: OperationSpec<"get_translations", z.ZodObject<{
1352
1430
  collection: z.ZodString;
@@ -1704,6 +1782,14 @@ export declare const listReviews: OperationSpec<"list_reviews", z.ZodObject<{
1704
1782
  publishedAt: z.ZodNullable<z.ZodString>;
1705
1783
  updatedAt: z.ZodString;
1706
1784
  }, z.core.$strip>;
1785
+ comments: z.ZodArray<z.ZodObject<{
1786
+ id: z.ZodString;
1787
+ author: z.ZodString;
1788
+ authorName: z.ZodNullable<z.ZodString>;
1789
+ client: z.ZodNullable<z.ZodString>;
1790
+ body: z.ZodString;
1791
+ at: z.ZodString;
1792
+ }, z.core.$strip>>;
1707
1793
  }, z.core.$strip>>;
1708
1794
  }, z.core.$strip>>;
1709
1795
  export declare const approveReview: OperationSpec<"approve_review", z.ZodObject<{
@@ -1786,6 +1872,109 @@ export declare const approveReview: OperationSpec<"approve_review", z.ZodObject<
1786
1872
  contractsHash: z.ZodString;
1787
1873
  }, z.core.$strip>>;
1788
1874
  }, z.core.$strip>>;
1875
+ export declare const requestReview: OperationSpec<"request_review", z.ZodObject<{
1876
+ id: z.ZodString;
1877
+ version: z.ZodNumber;
1878
+ acknowledgeWarnings: z.ZodDefault<z.ZodArray<z.ZodObject<{
1879
+ contract: z.ZodString;
1880
+ path: z.ZodString;
1881
+ }, z.core.$strip>>>;
1882
+ }, z.core.$strict>, z.ZodObject<{
1883
+ outcome: z.ZodEnum<{
1884
+ blocked: "blocked";
1885
+ conflict: "conflict";
1886
+ needs_acknowledgement: "needs_acknowledgement";
1887
+ not_found: "not_found";
1888
+ pending_review: "pending_review";
1889
+ }>;
1890
+ entry: z.ZodOptional<z.ZodObject<{
1891
+ id: z.ZodString;
1892
+ collection: z.ZodString;
1893
+ locale: z.ZodString;
1894
+ slug: z.ZodString;
1895
+ translationGroup: z.ZodNullable<z.ZodString>;
1896
+ status: z.ZodEnum<{
1897
+ draft: "draft";
1898
+ published: "published";
1899
+ scheduled: "scheduled";
1900
+ }>;
1901
+ version: z.ZodNumber;
1902
+ frontmatter: z.ZodRecord<z.ZodString, z.ZodUnknown>;
1903
+ tags: z.ZodArray<z.ZodString>;
1904
+ hasUnpublishedChanges: z.ZodBoolean;
1905
+ publishedAt: z.ZodNullable<z.ZodString>;
1906
+ updatedAt: z.ZodString;
1907
+ }, z.core.$strip>>;
1908
+ verdict: z.ZodOptional<z.ZodObject<{
1909
+ ok: z.ZodBoolean;
1910
+ phase: z.ZodEnum<{
1911
+ publish: "publish";
1912
+ write: "write";
1913
+ }>;
1914
+ errors: z.ZodArray<z.ZodObject<{
1915
+ contract: z.ZodString;
1916
+ severity: z.ZodEnum<{
1917
+ error: "error";
1918
+ warning: "warning";
1919
+ }>;
1920
+ path: z.ZodString;
1921
+ message: z.ZodString;
1922
+ fix: z.ZodString;
1923
+ line: z.ZodOptional<z.ZodNumber>;
1924
+ }, z.core.$strip>>;
1925
+ warnings: z.ZodArray<z.ZodObject<{
1926
+ contract: z.ZodString;
1927
+ severity: z.ZodEnum<{
1928
+ error: "error";
1929
+ warning: "warning";
1930
+ }>;
1931
+ path: z.ZodString;
1932
+ message: z.ZodString;
1933
+ fix: z.ZodString;
1934
+ line: z.ZodOptional<z.ZodNumber>;
1935
+ }, z.core.$strip>>;
1936
+ contractsHash: z.ZodString;
1937
+ }, z.core.$strip>>;
1938
+ conflict: z.ZodOptional<z.ZodObject<{
1939
+ currentVersion: z.ZodNumber;
1940
+ headRevision: z.ZodString;
1941
+ }, z.core.$strip>>;
1942
+ review: z.ZodOptional<z.ZodObject<{
1943
+ id: z.ZodString;
1944
+ entryId: z.ZodString;
1945
+ revision: z.ZodString;
1946
+ status: z.ZodEnum<{
1947
+ approved: "approved";
1948
+ cancelled: "cancelled";
1949
+ changes_requested: "changes_requested";
1950
+ pending: "pending";
1951
+ }>;
1952
+ requestedBy: z.ZodString;
1953
+ requestedByName: z.ZodNullable<z.ZodString>;
1954
+ requestedAt: z.ZodString;
1955
+ decidedBy: z.ZodNullable<z.ZodString>;
1956
+ decidedAt: z.ZodNullable<z.ZodString>;
1957
+ note: z.ZodNullable<z.ZodString>;
1958
+ }, z.core.$strip>>;
1959
+ }, z.core.$strip>>;
1960
+ export declare const commentReview: OperationSpec<"comment_review", z.ZodObject<{
1961
+ id: z.ZodString;
1962
+ body: z.ZodString;
1963
+ }, z.core.$strict>, z.ZodObject<{
1964
+ outcome: z.ZodEnum<{
1965
+ commented: "commented";
1966
+ not_found: "not_found";
1967
+ not_pending: "not_pending";
1968
+ }>;
1969
+ comment: z.ZodOptional<z.ZodObject<{
1970
+ id: z.ZodString;
1971
+ author: z.ZodString;
1972
+ authorName: z.ZodNullable<z.ZodString>;
1973
+ client: z.ZodNullable<z.ZodString>;
1974
+ body: z.ZodString;
1975
+ at: z.ZodString;
1976
+ }, z.core.$strip>>;
1977
+ }, z.core.$strip>>;
1789
1978
  export declare const requestChanges: OperationSpec<"request_changes", z.ZodObject<{
1790
1979
  id: z.ZodString;
1791
1980
  note: z.ZodString;
@@ -1813,6 +2002,38 @@ export declare const requestChanges: OperationSpec<"request_changes", z.ZodObjec
1813
2002
  note: z.ZodNullable<z.ZodString>;
1814
2003
  }, z.core.$strip>>;
1815
2004
  }, z.core.$strip>>;
2005
+ export declare const contentStats: OperationSpec<"content_stats", z.ZodObject<{
2006
+ days: z.ZodDefault<z.ZodNumber>;
2007
+ limit: z.ZodDefault<z.ZodNumber>;
2008
+ }, z.core.$strict>, z.ZodObject<{
2009
+ outcome: z.ZodEnum<{
2010
+ ok: "ok";
2011
+ unavailable: "unavailable";
2012
+ }>;
2013
+ since: z.ZodOptional<z.ZodString>;
2014
+ pages: z.ZodOptional<z.ZodArray<z.ZodObject<{
2015
+ path: z.ZodString;
2016
+ views: z.ZodNumber;
2017
+ entry: z.ZodNullable<z.ZodObject<{
2018
+ id: z.ZodString;
2019
+ collection: z.ZodString;
2020
+ locale: z.ZodString;
2021
+ slug: z.ZodString;
2022
+ translationGroup: z.ZodNullable<z.ZodString>;
2023
+ status: z.ZodEnum<{
2024
+ draft: "draft";
2025
+ published: "published";
2026
+ scheduled: "scheduled";
2027
+ }>;
2028
+ version: z.ZodNumber;
2029
+ frontmatter: z.ZodRecord<z.ZodString, z.ZodUnknown>;
2030
+ tags: z.ZodArray<z.ZodString>;
2031
+ hasUnpublishedChanges: z.ZodBoolean;
2032
+ publishedAt: z.ZodNullable<z.ZodString>;
2033
+ updatedAt: z.ZodString;
2034
+ }, z.core.$strip>>;
2035
+ }, z.core.$strip>>>;
2036
+ }, z.core.$strip>>;
1816
2037
  /** Every operation, sorted by name: the order of `tools/list`. */
1817
2038
  export declare const OPERATIONS: readonly [OperationSpec<"approve_review", z.ZodObject<{
1818
2039
  id: z.ZodString;
@@ -1893,6 +2114,54 @@ export declare const OPERATIONS: readonly [OperationSpec<"approve_review", z.Zod
1893
2114
  }, z.core.$strip>>;
1894
2115
  contractsHash: z.ZodString;
1895
2116
  }, z.core.$strip>>;
2117
+ }, z.core.$strip>>, OperationSpec<"comment_review", z.ZodObject<{
2118
+ id: z.ZodString;
2119
+ body: z.ZodString;
2120
+ }, z.core.$strict>, z.ZodObject<{
2121
+ outcome: z.ZodEnum<{
2122
+ commented: "commented";
2123
+ not_found: "not_found";
2124
+ not_pending: "not_pending";
2125
+ }>;
2126
+ comment: z.ZodOptional<z.ZodObject<{
2127
+ id: z.ZodString;
2128
+ author: z.ZodString;
2129
+ authorName: z.ZodNullable<z.ZodString>;
2130
+ client: z.ZodNullable<z.ZodString>;
2131
+ body: z.ZodString;
2132
+ at: z.ZodString;
2133
+ }, z.core.$strip>>;
2134
+ }, z.core.$strip>>, OperationSpec<"content_stats", z.ZodObject<{
2135
+ days: z.ZodDefault<z.ZodNumber>;
2136
+ limit: z.ZodDefault<z.ZodNumber>;
2137
+ }, z.core.$strict>, z.ZodObject<{
2138
+ outcome: z.ZodEnum<{
2139
+ ok: "ok";
2140
+ unavailable: "unavailable";
2141
+ }>;
2142
+ since: z.ZodOptional<z.ZodString>;
2143
+ pages: z.ZodOptional<z.ZodArray<z.ZodObject<{
2144
+ path: z.ZodString;
2145
+ views: z.ZodNumber;
2146
+ entry: z.ZodNullable<z.ZodObject<{
2147
+ id: z.ZodString;
2148
+ collection: z.ZodString;
2149
+ locale: z.ZodString;
2150
+ slug: z.ZodString;
2151
+ translationGroup: z.ZodNullable<z.ZodString>;
2152
+ status: z.ZodEnum<{
2153
+ draft: "draft";
2154
+ published: "published";
2155
+ scheduled: "scheduled";
2156
+ }>;
2157
+ version: z.ZodNumber;
2158
+ frontmatter: z.ZodRecord<z.ZodString, z.ZodUnknown>;
2159
+ tags: z.ZodArray<z.ZodString>;
2160
+ hasUnpublishedChanges: z.ZodBoolean;
2161
+ publishedAt: z.ZodNullable<z.ZodString>;
2162
+ updatedAt: z.ZodString;
2163
+ }, z.core.$strip>>;
2164
+ }, z.core.$strip>>>;
1896
2165
  }, z.core.$strip>>, OperationSpec<"create_draft", z.ZodObject<{
1897
2166
  collection: z.ZodString;
1898
2167
  locale: z.ZodString;
@@ -1999,6 +2268,7 @@ export declare const OPERATIONS: readonly [OperationSpec<"approve_review", z.Zod
1999
2268
  markdown: "markdown";
2000
2269
  }>>>;
2001
2270
  published: z.ZodDefault<z.ZodBoolean>;
2271
+ related: z.ZodDefault<z.ZodBoolean>;
2002
2272
  }, z.core.$strict>, z.ZodObject<{
2003
2273
  outcome: z.ZodEnum<{
2004
2274
  not_found: "not_found";
@@ -2098,6 +2368,24 @@ export declare const OPERATIONS: readonly [OperationSpec<"approve_review", z.Zod
2098
2368
  }, z.core.$strip>>;
2099
2369
  html: z.ZodOptional<z.ZodString>;
2100
2370
  }, z.core.$strip>>;
2371
+ related: z.ZodOptional<z.ZodArray<z.ZodObject<{
2372
+ id: z.ZodString;
2373
+ collection: z.ZodString;
2374
+ locale: z.ZodString;
2375
+ slug: z.ZodString;
2376
+ translationGroup: z.ZodNullable<z.ZodString>;
2377
+ status: z.ZodEnum<{
2378
+ draft: "draft";
2379
+ published: "published";
2380
+ scheduled: "scheduled";
2381
+ }>;
2382
+ version: z.ZodNumber;
2383
+ frontmatter: z.ZodRecord<z.ZodString, z.ZodUnknown>;
2384
+ tags: z.ZodArray<z.ZodString>;
2385
+ hasUnpublishedChanges: z.ZodBoolean;
2386
+ publishedAt: z.ZodNullable<z.ZodString>;
2387
+ updatedAt: z.ZodString;
2388
+ }, z.core.$strip>>>;
2101
2389
  }, z.core.$strip>>, OperationSpec<"get_translations", z.ZodObject<{
2102
2390
  collection: z.ZodString;
2103
2391
  translationGroup: z.ZodString;
@@ -2204,6 +2492,14 @@ export declare const OPERATIONS: readonly [OperationSpec<"approve_review", z.Zod
2204
2492
  publishedAt: z.ZodNullable<z.ZodString>;
2205
2493
  updatedAt: z.ZodString;
2206
2494
  }, z.core.$strip>;
2495
+ comments: z.ZodArray<z.ZodObject<{
2496
+ id: z.ZodString;
2497
+ author: z.ZodString;
2498
+ authorName: z.ZodNullable<z.ZodString>;
2499
+ client: z.ZodNullable<z.ZodString>;
2500
+ body: z.ZodString;
2501
+ at: z.ZodString;
2502
+ }, z.core.$strip>>;
2207
2503
  }, z.core.$strip>>;
2208
2504
  }, z.core.$strip>>, OperationSpec<"publish", z.ZodObject<{
2209
2505
  id: z.ZodString;
@@ -2323,6 +2619,131 @@ export declare const OPERATIONS: readonly [OperationSpec<"approve_review", z.Zod
2323
2619
  decidedAt: z.ZodNullable<z.ZodString>;
2324
2620
  note: z.ZodNullable<z.ZodString>;
2325
2621
  }, z.core.$strip>>;
2622
+ }, z.core.$strip>>, OperationSpec<"request_review", z.ZodObject<{
2623
+ id: z.ZodString;
2624
+ version: z.ZodNumber;
2625
+ acknowledgeWarnings: z.ZodDefault<z.ZodArray<z.ZodObject<{
2626
+ contract: z.ZodString;
2627
+ path: z.ZodString;
2628
+ }, z.core.$strip>>>;
2629
+ }, z.core.$strict>, z.ZodObject<{
2630
+ outcome: z.ZodEnum<{
2631
+ blocked: "blocked";
2632
+ conflict: "conflict";
2633
+ needs_acknowledgement: "needs_acknowledgement";
2634
+ not_found: "not_found";
2635
+ pending_review: "pending_review";
2636
+ }>;
2637
+ entry: z.ZodOptional<z.ZodObject<{
2638
+ id: z.ZodString;
2639
+ collection: z.ZodString;
2640
+ locale: z.ZodString;
2641
+ slug: z.ZodString;
2642
+ translationGroup: z.ZodNullable<z.ZodString>;
2643
+ status: z.ZodEnum<{
2644
+ draft: "draft";
2645
+ published: "published";
2646
+ scheduled: "scheduled";
2647
+ }>;
2648
+ version: z.ZodNumber;
2649
+ frontmatter: z.ZodRecord<z.ZodString, z.ZodUnknown>;
2650
+ tags: z.ZodArray<z.ZodString>;
2651
+ hasUnpublishedChanges: z.ZodBoolean;
2652
+ publishedAt: z.ZodNullable<z.ZodString>;
2653
+ updatedAt: z.ZodString;
2654
+ }, z.core.$strip>>;
2655
+ verdict: z.ZodOptional<z.ZodObject<{
2656
+ ok: z.ZodBoolean;
2657
+ phase: z.ZodEnum<{
2658
+ publish: "publish";
2659
+ write: "write";
2660
+ }>;
2661
+ errors: z.ZodArray<z.ZodObject<{
2662
+ contract: z.ZodString;
2663
+ severity: z.ZodEnum<{
2664
+ error: "error";
2665
+ warning: "warning";
2666
+ }>;
2667
+ path: z.ZodString;
2668
+ message: z.ZodString;
2669
+ fix: z.ZodString;
2670
+ line: z.ZodOptional<z.ZodNumber>;
2671
+ }, z.core.$strip>>;
2672
+ warnings: z.ZodArray<z.ZodObject<{
2673
+ contract: z.ZodString;
2674
+ severity: z.ZodEnum<{
2675
+ error: "error";
2676
+ warning: "warning";
2677
+ }>;
2678
+ path: z.ZodString;
2679
+ message: z.ZodString;
2680
+ fix: z.ZodString;
2681
+ line: z.ZodOptional<z.ZodNumber>;
2682
+ }, z.core.$strip>>;
2683
+ contractsHash: z.ZodString;
2684
+ }, z.core.$strip>>;
2685
+ conflict: z.ZodOptional<z.ZodObject<{
2686
+ currentVersion: z.ZodNumber;
2687
+ headRevision: z.ZodString;
2688
+ }, z.core.$strip>>;
2689
+ review: z.ZodOptional<z.ZodObject<{
2690
+ id: z.ZodString;
2691
+ entryId: z.ZodString;
2692
+ revision: z.ZodString;
2693
+ status: z.ZodEnum<{
2694
+ approved: "approved";
2695
+ cancelled: "cancelled";
2696
+ changes_requested: "changes_requested";
2697
+ pending: "pending";
2698
+ }>;
2699
+ requestedBy: z.ZodString;
2700
+ requestedByName: z.ZodNullable<z.ZodString>;
2701
+ requestedAt: z.ZodString;
2702
+ decidedBy: z.ZodNullable<z.ZodString>;
2703
+ decidedAt: z.ZodNullable<z.ZodString>;
2704
+ note: z.ZodNullable<z.ZodString>;
2705
+ }, z.core.$strip>>;
2706
+ }, z.core.$strip>>, OperationSpec<"search", z.ZodObject<{
2707
+ query: z.ZodString;
2708
+ collection: z.ZodOptional<z.ZodString>;
2709
+ locale: z.ZodOptional<z.ZodString>;
2710
+ limit: z.ZodDefault<z.ZodNumber>;
2711
+ mode: z.ZodOptional<z.ZodEnum<{
2712
+ fulltext: "fulltext";
2713
+ hybrid: "hybrid";
2714
+ semantic: "semantic";
2715
+ }>>;
2716
+ }, z.core.$strict>, z.ZodObject<{
2717
+ outcome: z.ZodEnum<{
2718
+ ok: "ok";
2719
+ }>;
2720
+ mode: z.ZodEnum<{
2721
+ fulltext: "fulltext";
2722
+ hybrid: "hybrid";
2723
+ semantic: "semantic";
2724
+ }>;
2725
+ results: z.ZodArray<z.ZodObject<{
2726
+ entry: z.ZodObject<{
2727
+ id: z.ZodString;
2728
+ collection: z.ZodString;
2729
+ locale: z.ZodString;
2730
+ slug: z.ZodString;
2731
+ translationGroup: z.ZodNullable<z.ZodString>;
2732
+ status: z.ZodEnum<{
2733
+ draft: "draft";
2734
+ published: "published";
2735
+ scheduled: "scheduled";
2736
+ }>;
2737
+ version: z.ZodNumber;
2738
+ frontmatter: z.ZodRecord<z.ZodString, z.ZodUnknown>;
2739
+ tags: z.ZodArray<z.ZodString>;
2740
+ hasUnpublishedChanges: z.ZodBoolean;
2741
+ publishedAt: z.ZodNullable<z.ZodString>;
2742
+ updatedAt: z.ZodString;
2743
+ }, z.core.$strip>;
2744
+ snippet: z.ZodString;
2745
+ score: z.ZodNumber;
2746
+ }, z.core.$strip>>;
2326
2747
  }, z.core.$strip>>, OperationSpec<"unpublish", z.ZodObject<{
2327
2748
  id: z.ZodString;
2328
2749
  }, z.core.$strict>, z.ZodObject<{
@@ -2516,7 +2937,38 @@ export interface WebhookCheck {
2516
2937
  */
2517
2938
  export declare function verifyWebhook(check: WebhookCheck): Promise<boolean>;
2518
2939
  //#endregion
2940
+ //#region src/search/chunks.d.ts
2941
+ /**
2942
+ * The pieces of an entry that semantic search embeds (v0.5): one summary, and one piece for each
2943
+ * section the body has under an `h2`. Vectors are derived data, like the Comark document: a change
2944
+ * of this version makes every vector one to make again.
2945
+ */
2946
+ export declare const CHUNKER_VERSION = "1";
2947
+ interface Chunk {
2948
+ /** The place of the piece in the entry: 0 is the summary, then the sections in order. */
2949
+ readonly index: number;
2950
+ readonly kind: 'summary' | 'section';
2951
+ /** The heading of a section; `null` for the summary. */
2952
+ readonly heading: string | null;
2953
+ readonly text: string;
2954
+ }
2955
+ /** How long a piece may grow, in characters, before it is cut at a word. */
2956
+ export declare const CHUNK_LIMITS: {
2957
+ readonly summary: 1200;
2958
+ readonly section: 2000;
2959
+ };
2960
+ /**
2961
+ * The pieces of an entry: the summary (its title, its description and the text before the first
2962
+ * `h2`), then each section (its heading and its text up to the next `h2`). An `h1` adds nothing:
2963
+ * it repeats the title. A section with no text is left out.
2964
+ */
2965
+ export declare function chunksOf(entry: {
2966
+ readonly title: string;
2967
+ readonly description?: string;
2968
+ readonly document: EntryDocument;
2969
+ }): Chunk[];
2970
+ //#endregion
2519
2971
  //#region src/index.d.ts
2520
2972
  export declare const name = "@hollware/core";
2521
2973
  //#endregion
2522
- 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 };
2974
+ export { type AcknowledgedWarning, type AuthDefinition, type BuiltInContractId, type BuiltInOptions, type Chunk, 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
@@ -1702,6 +1702,7 @@ const CROCKFORD = "0123456789ABCDEFGHJKMNPQRSTVWXYZ";
1702
1702
  const ID_PREFIXES = {
1703
1703
  challenge: "chl",
1704
1704
  delivery: "dlv",
1705
+ embedding: "emb",
1705
1706
  entry: "ent",
1706
1707
  event: "evt",
1707
1708
  invitation: "inv",
@@ -1711,6 +1712,7 @@ const ID_PREFIXES = {
1711
1712
  revision: "rev",
1712
1713
  revisionTag: "tag",
1713
1714
  review: "rvw",
1715
+ reviewComment: "rvc",
1714
1716
  schedule: "sch",
1715
1717
  session: "ses",
1716
1718
  token: "tok",
@@ -3049,9 +3051,11 @@ var schemas_exports = /* @__PURE__ */ __exportAll({
3049
3051
  phase: () => phase,
3050
3052
  publication: () => publication,
3051
3053
  review: () => review,
3054
+ reviewComment: () => reviewComment,
3052
3055
  reviewId: () => reviewId,
3053
3056
  reviewStatus: () => reviewStatus,
3054
3057
  revisionId: () => revisionId,
3058
+ searchMode: () => searchMode,
3055
3059
  severity: () => severity,
3056
3060
  siteDescription: () => siteDescription,
3057
3061
  slug: () => slug,
@@ -3153,6 +3157,15 @@ const review = z.object({
3153
3157
  decidedAt: z.string().nullable(),
3154
3158
  note: z.string().nullable().describe("What the reviewer asked to change, or null.")
3155
3159
  });
3160
+ /** A comment on a review (v0.6), by a person or by the agent of one. */
3161
+ const reviewComment = z.object({
3162
+ id: z.string(),
3163
+ author: z.string().describe("The user who wrote it, or whose token their agent used."),
3164
+ authorName: z.string().nullable(),
3165
+ client: z.string().nullable().describe("The name the client gave, such as hollware-agents for the agents; null for none."),
3166
+ body: z.string(),
3167
+ at: z.string()
3168
+ });
3156
3169
  const conflict = z.object({
3157
3170
  currentVersion: z.number().int().min(1),
3158
3171
  headRevision: revisionId
@@ -3162,6 +3175,12 @@ const format = z.enum([
3162
3175
  "document",
3163
3176
  "html"
3164
3177
  ]);
3178
+ /** How a search is made: by its words, by meaning, or both merged (ADR-030). */
3179
+ const searchMode = z.enum([
3180
+ "fulltext",
3181
+ "semantic",
3182
+ "hybrid"
3183
+ ]);
3165
3184
  const componentDescription = z.object({
3166
3185
  name: z.string(),
3167
3186
  description: z.string().nullable(),
@@ -3240,6 +3259,30 @@ const listEntries = defineOperation({
3240
3259
  effect: "read",
3241
3260
  outcomes: { ok: { isError: false } }
3242
3261
  });
3262
+ const search = defineOperation({
3263
+ name: "search",
3264
+ title: "Search entries",
3265
+ description: "Searches the published entries of the site, best match first. Full text finds the entries that hold every word of query, in their title, tags and text; semantic finds them by meaning, in any language; hybrid merges both. Narrow it to a collection or a locale. Drafts are not searched: read them with list_entries.",
3266
+ input: z.strictObject({
3267
+ query: z.string().trim().min(1).max(200).describe("The words to find, or a question; punctuation is ignored by full text."),
3268
+ collection: collectionName.optional(),
3269
+ locale: locale.optional(),
3270
+ limit: z.number().int().min(1).max(50).default(10),
3271
+ mode: searchMode.optional().describe("fulltext, semantic or hybrid; hybrid when not given. Semantic and hybrid need the semantic search of the deployment: without it the search is full text, and mode in the answer says so.")
3272
+ }),
3273
+ output: z.object({
3274
+ outcome: z.enum(["ok"]),
3275
+ mode: searchMode.describe("How the search was made."),
3276
+ results: z.array(z.object({
3277
+ entry: entrySummary,
3278
+ snippet: z.string().describe("The words around the match, the words found between [ and ]; for a match by meaning, the start of the closest part."),
3279
+ score: z.number().describe("How well it matches: higher is better.")
3280
+ }))
3281
+ }),
3282
+ scopes: ["content:read"],
3283
+ effect: "read",
3284
+ outcomes: { ok: { isError: false } }
3285
+ });
3243
3286
  const getEntry = defineOperation({
3244
3287
  name: "get_entry",
3245
3288
  title: "Get an entry",
@@ -3249,11 +3292,13 @@ const getEntry = defineOperation({
3249
3292
  locale,
3250
3293
  slug,
3251
3294
  formats: z.array(format).min(1).default(["markdown"]).describe("What to return of the revision: markdown, the Comark document, or html."),
3252
- 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.")
3295
+ 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."),
3296
+ related: z.boolean().default(false).describe("Also return the published entries closest to this one by meaning, in its collection and locale, closest first. Needs the semantic search of the deployment; empty without it.")
3253
3297
  }),
3254
3298
  output: z.object({
3255
3299
  outcome: z.enum(["ok", "not_found"]),
3256
- entry: entry.optional()
3300
+ entry: entry.optional(),
3301
+ related: z.array(entrySummary).optional().describe("When related was asked for.")
3257
3302
  }),
3258
3303
  scopes: ["content:read"],
3259
3304
  effect: "read",
@@ -3420,7 +3465,10 @@ const listReviews = defineOperation({
3420
3465
  }),
3421
3466
  output: z.object({
3422
3467
  outcome: z.enum(["ok"]),
3423
- reviews: z.array(review.extend({ entry: entrySummary }))
3468
+ reviews: z.array(review.extend({
3469
+ entry: entrySummary,
3470
+ comments: z.array(reviewComment).describe("What was said about it, oldest first.")
3471
+ }))
3424
3472
  }),
3425
3473
  scopes: ["content:read"],
3426
3474
  effect: "read",
@@ -3456,6 +3504,62 @@ const approveReview = defineOperation({
3456
3504
  not_found: { isError: true }
3457
3505
  }
3458
3506
  });
3507
+ const requestReview = defineOperation({
3508
+ name: "request_review",
3509
+ title: "Ask for a review",
3510
+ description: "Asks a person who may publish to review the latest revision of an entry, after the same checks publish makes, if the entry is still at the version you read. It never publishes, whatever your scopes: the answer is pending_review, or why not (blocked by the contracts, warnings to acknowledge, a conflict). A new revision of the entry cancels the request.",
3511
+ input: z.strictObject({
3512
+ id: entryId,
3513
+ version,
3514
+ acknowledgeWarnings: z.array(acknowledgedWarning).default([]).describe("The warnings you accept, as needs_acknowledgement listed them.")
3515
+ }),
3516
+ output: z.object({
3517
+ outcome: z.enum([
3518
+ "pending_review",
3519
+ "blocked",
3520
+ "needs_acknowledgement",
3521
+ "conflict",
3522
+ "not_found"
3523
+ ]),
3524
+ entry: entrySummary.optional(),
3525
+ verdict: verdict.optional(),
3526
+ conflict: conflict.optional(),
3527
+ review: review.optional().describe("With pending_review: the request, as list_reviews shows it.")
3528
+ }),
3529
+ scopes: ["content:write"],
3530
+ effect: "write",
3531
+ outcomes: {
3532
+ pending_review: { isError: false },
3533
+ blocked: { isError: true },
3534
+ needs_acknowledgement: { isError: false },
3535
+ conflict: { isError: true },
3536
+ not_found: { isError: true }
3537
+ }
3538
+ });
3539
+ const commentReview = defineOperation({
3540
+ name: "comment_review",
3541
+ title: "Comment on a review",
3542
+ description: "Adds a comment to a pending review, for the person who decides it and for the author: what to change, what reads well, what the contracts cannot check. It neither approves nor closes the review.",
3543
+ input: z.strictObject({
3544
+ id: reviewId,
3545
+ body: z.string().trim().min(1).max(4e3).describe("The comment, in Markdown.")
3546
+ }),
3547
+ output: z.object({
3548
+ outcome: z.enum([
3549
+ "commented",
3550
+ "not_pending",
3551
+ "not_found"
3552
+ ]),
3553
+ comment: reviewComment.optional()
3554
+ }),
3555
+ scopes: ["content:write"],
3556
+ effect: "write",
3557
+ outcomes: {
3558
+ commented: { isError: false },
3559
+ not_pending: { isError: true },
3560
+ not_found: { isError: true }
3561
+ }
3562
+ });
3459
3563
  const requestChanges = defineOperation({
3460
3564
  name: "request_changes",
3461
3565
  title: "Ask for changes",
@@ -3480,9 +3584,35 @@ const requestChanges = defineOperation({
3480
3584
  not_found: { isError: true }
3481
3585
  }
3482
3586
  });
3587
+ const contentStats = defineOperation({
3588
+ name: "content_stats",
3589
+ title: "Read what readers read",
3590
+ description: "The most read pages of the sites that read this one, over the last days, most read first, each with the published entry it shows when it shows one. Use it to pick what to update. unavailable when the deployment has no analytics.",
3591
+ input: z.strictObject({
3592
+ days: z.number().int().min(1).max(90).default(30).describe("How many days back to count."),
3593
+ limit: z.number().int().min(1).max(50).default(10)
3594
+ }),
3595
+ output: z.object({
3596
+ outcome: z.enum(["ok", "unavailable"]),
3597
+ since: z.string().optional().describe("The start of the count, in ISO 8601."),
3598
+ pages: z.array(z.object({
3599
+ path: z.string(),
3600
+ views: z.number().describe("Page views, sampling accounted for."),
3601
+ entry: entrySummary.nullable().describe("The published entry at that path, or null.")
3602
+ })).optional()
3603
+ }),
3604
+ scopes: ["content:read"],
3605
+ effect: "read",
3606
+ outcomes: {
3607
+ ok: { isError: false },
3608
+ unavailable: { isError: true }
3609
+ }
3610
+ });
3483
3611
  /** Every operation, sorted by name: the order of `tools/list`. */
3484
3612
  const OPERATIONS = [
3485
3613
  approveReview,
3614
+ commentReview,
3615
+ contentStats,
3486
3616
  createDraft,
3487
3617
  describeSite,
3488
3618
  getEntry,
@@ -3491,6 +3621,8 @@ const OPERATIONS = [
3491
3621
  listReviews,
3492
3622
  publish,
3493
3623
  requestChanges,
3624
+ requestReview,
3625
+ search,
3494
3626
  unpublish,
3495
3627
  updateDraft,
3496
3628
  validate
@@ -3607,7 +3739,82 @@ async function verifyWebhook(check) {
3607
3739
  return sameText(signature, await signWebhook(check.secret, timestamp, check.body));
3608
3740
  }
3609
3741
  //#endregion
3742
+ //#region src/search/chunks.ts
3743
+ /**
3744
+ * The pieces of an entry that semantic search embeds (v0.5): one summary, and one piece for each
3745
+ * section the body has under an `h2`. Vectors are derived data, like the Comark document: a change
3746
+ * of this version makes every vector one to make again.
3747
+ */
3748
+ const CHUNKER_VERSION = "1";
3749
+ /** How long a piece may grow, in characters, before it is cut at a word. */
3750
+ const CHUNK_LIMITS = {
3751
+ summary: 1200,
3752
+ section: 2e3
3753
+ };
3754
+ /** The text a reader sees in a node: its strings, never its tag, attributes or comments. */
3755
+ function textOf(node) {
3756
+ if (typeof node === "string") return node;
3757
+ if (!Array.isArray(node) || node[0] === null) return "";
3758
+ return node.slice(2).map((child) => textOf(child)).join("");
3759
+ }
3760
+ function tagOf(node) {
3761
+ return Array.isArray(node) && typeof node[0] === "string" ? node[0] : null;
3762
+ }
3763
+ /** The words of a text in one line, cut at the last word that fits in `limit`. */
3764
+ function fit(text, limit) {
3765
+ const flat = text.replace(/\s+/g, " ").trim();
3766
+ if (flat.length <= limit) return flat;
3767
+ const cut = flat.slice(0, limit);
3768
+ const lastSpace = cut.lastIndexOf(" ");
3769
+ return (lastSpace > 0 ? cut.slice(0, lastSpace) : cut).trim();
3770
+ }
3771
+ /**
3772
+ * The pieces of an entry: the summary (its title, its description and the text before the first
3773
+ * `h2`), then each section (its heading and its text up to the next `h2`). An `h1` adds nothing:
3774
+ * it repeats the title. A section with no text is left out.
3775
+ */
3776
+ function chunksOf(entry) {
3777
+ const intro = [];
3778
+ const sections = [];
3779
+ for (const node of entry.document.nodes) {
3780
+ const tag = tagOf(node);
3781
+ if (tag === "h1") continue;
3782
+ if (tag === "h2") {
3783
+ sections.push({
3784
+ heading: textOf(node).trim(),
3785
+ parts: []
3786
+ });
3787
+ continue;
3788
+ }
3789
+ const text = textOf(node);
3790
+ const current = sections.at(-1);
3791
+ if (current === void 0) intro.push(text);
3792
+ else current.parts.push(text);
3793
+ }
3794
+ const chunks = [{
3795
+ index: 0,
3796
+ kind: "summary",
3797
+ heading: null,
3798
+ text: fit([
3799
+ entry.title,
3800
+ entry.description ?? "",
3801
+ intro.join(" ")
3802
+ ].filter((part) => part !== "").join("\n"), CHUNK_LIMITS.summary)
3803
+ }];
3804
+ for (const section of sections) {
3805
+ const body = section.parts.join(" ").trim();
3806
+ if (body === "") continue;
3807
+ chunks.push({
3808
+ index: chunks.length,
3809
+ kind: "section",
3810
+ heading: section.heading,
3811
+ text: fit(`${section.heading}\n${body}`, CHUNK_LIMITS.section)
3812
+ });
3813
+ }
3814
+ return chunks;
3815
+ }
3816
+ //#endregion
3610
3817
  //#region src/index.ts
3611
3818
  const name = "@hollware/core";
3612
3819
  //#endregion
3613
- 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, READ_TOKEN_PREFIX, 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, generateReadToken, getEntry, getTranslations, hashPersonalToken, isBuiltInContract, isId, isPersonalToken, isReadToken, 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 };
3820
+ export { BUILT_IN_CONTRACT_IDS, CHUNKER_VERSION, CHUNK_LIMITS, 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, READ_TOKEN_PREFIX, REFUSAL_CONTRACT_IDS, SCOPES, SIGNATURE_HEADER, SITE_KEY_MAX_LENGTH, SITE_KEY_PATTERN, TIMESTAMP_HEADER, approveReview, chunksOf, commentReview, contentStats, contracts, createDraft, defineCollection, defineComponent, defineConfig, defineContract, defineOperation, describeBuiltInContracts, describeContract, describeResolvedSite, describeSite, generatePersonalToken, generateReadToken, getEntry, getTranslations, hashPersonalToken, isBuiltInContract, isId, isPersonalToken, isReadToken, isScope, isSiteKey, listEntries, listReviews, name, newId, processMarkdown, publish, renderHtml, requestChanges, requestReview, resolveConfig, runContracts, schemas_exports as schemas, search, 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.4.0",
3
+ "version": "0.6.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": {