@hollware/core 0.5.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, searchMode, 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;
@@ -1064,6 +1073,7 @@ export declare const ID_PREFIXES: {
1064
1073
  readonly revision: 'rev';
1065
1074
  readonly revisionTag: 'tag';
1066
1075
  readonly review: 'rvw';
1076
+ readonly reviewComment: 'rvc';
1067
1077
  readonly schedule: 'sch';
1068
1078
  readonly session: 'ses';
1069
1079
  readonly token: 'tok';
@@ -1772,6 +1782,14 @@ export declare const listReviews: OperationSpec<"list_reviews", z.ZodObject<{
1772
1782
  publishedAt: z.ZodNullable<z.ZodString>;
1773
1783
  updatedAt: z.ZodString;
1774
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>>;
1775
1793
  }, z.core.$strip>>;
1776
1794
  }, z.core.$strip>>;
1777
1795
  export declare const approveReview: OperationSpec<"approve_review", z.ZodObject<{
@@ -1854,6 +1872,109 @@ export declare const approveReview: OperationSpec<"approve_review", z.ZodObject<
1854
1872
  contractsHash: z.ZodString;
1855
1873
  }, z.core.$strip>>;
1856
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>>;
1857
1978
  export declare const requestChanges: OperationSpec<"request_changes", z.ZodObject<{
1858
1979
  id: z.ZodString;
1859
1980
  note: z.ZodString;
@@ -1993,6 +2114,23 @@ export declare const OPERATIONS: readonly [OperationSpec<"approve_review", z.Zod
1993
2114
  }, z.core.$strip>>;
1994
2115
  contractsHash: z.ZodString;
1995
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>>;
1996
2134
  }, z.core.$strip>>, OperationSpec<"content_stats", z.ZodObject<{
1997
2135
  days: z.ZodDefault<z.ZodNumber>;
1998
2136
  limit: z.ZodDefault<z.ZodNumber>;
@@ -2354,6 +2492,14 @@ export declare const OPERATIONS: readonly [OperationSpec<"approve_review", z.Zod
2354
2492
  publishedAt: z.ZodNullable<z.ZodString>;
2355
2493
  updatedAt: z.ZodString;
2356
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>>;
2357
2503
  }, z.core.$strip>>;
2358
2504
  }, z.core.$strip>>, OperationSpec<"publish", z.ZodObject<{
2359
2505
  id: z.ZodString;
@@ -2473,6 +2619,90 @@ export declare const OPERATIONS: readonly [OperationSpec<"approve_review", z.Zod
2473
2619
  decidedAt: z.ZodNullable<z.ZodString>;
2474
2620
  note: z.ZodNullable<z.ZodString>;
2475
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>>;
2476
2706
  }, z.core.$strip>>, OperationSpec<"search", z.ZodObject<{
2477
2707
  query: z.ZodString;
2478
2708
  collection: z.ZodOptional<z.ZodString>;
package/dist/index.mjs CHANGED
@@ -1712,6 +1712,7 @@ const ID_PREFIXES = {
1712
1712
  revision: "rev",
1713
1713
  revisionTag: "tag",
1714
1714
  review: "rvw",
1715
+ reviewComment: "rvc",
1715
1716
  schedule: "sch",
1716
1717
  session: "ses",
1717
1718
  token: "tok",
@@ -3050,6 +3051,7 @@ var schemas_exports = /* @__PURE__ */ __exportAll({
3050
3051
  phase: () => phase,
3051
3052
  publication: () => publication,
3052
3053
  review: () => review,
3054
+ reviewComment: () => reviewComment,
3053
3055
  reviewId: () => reviewId,
3054
3056
  reviewStatus: () => reviewStatus,
3055
3057
  revisionId: () => revisionId,
@@ -3155,6 +3157,15 @@ const review = z.object({
3155
3157
  decidedAt: z.string().nullable(),
3156
3158
  note: z.string().nullable().describe("What the reviewer asked to change, or null.")
3157
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
+ });
3158
3169
  const conflict = z.object({
3159
3170
  currentVersion: z.number().int().min(1),
3160
3171
  headRevision: revisionId
@@ -3454,7 +3465,10 @@ const listReviews = defineOperation({
3454
3465
  }),
3455
3466
  output: z.object({
3456
3467
  outcome: z.enum(["ok"]),
3457
- 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
+ }))
3458
3472
  }),
3459
3473
  scopes: ["content:read"],
3460
3474
  effect: "read",
@@ -3490,6 +3504,62 @@ const approveReview = defineOperation({
3490
3504
  not_found: { isError: true }
3491
3505
  }
3492
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
+ });
3493
3563
  const requestChanges = defineOperation({
3494
3564
  name: "request_changes",
3495
3565
  title: "Ask for changes",
@@ -3541,6 +3611,7 @@ const contentStats = defineOperation({
3541
3611
  /** Every operation, sorted by name: the order of `tools/list`. */
3542
3612
  const OPERATIONS = [
3543
3613
  approveReview,
3614
+ commentReview,
3544
3615
  contentStats,
3545
3616
  createDraft,
3546
3617
  describeSite,
@@ -3550,6 +3621,7 @@ const OPERATIONS = [
3550
3621
  listReviews,
3551
3622
  publish,
3552
3623
  requestChanges,
3624
+ requestReview,
3553
3625
  search,
3554
3626
  unpublish,
3555
3627
  updateDraft,
@@ -3745,4 +3817,4 @@ function chunksOf(entry) {
3745
3817
  //#region src/index.ts
3746
3818
  const name = "@hollware/core";
3747
3819
  //#endregion
3748
- 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, 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, resolveConfig, runContracts, schemas_exports as schemas, search, 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.5.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": {