@anthusai/papyrus 5.131.0-next.1 → 5.131.0-next.3

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -1,7 +1,7 @@
1
1
  /**
2
- * The logic behind Administration > Policies > Writing guidelines, apart from React: what the editable form holds, how it becomes a guideline document, how each
3
- * field of a section's effective guidelines is labelled with where it came from, and the client for the guidelines door (`guidelinesRead` and `guidelinesWrite`).
4
- * Nothing here knows how a document is stored: every read and write is one of the `guidelines_*` operations (docs/plans/guidelines-as-data.md section 8).
2
+ * The logic behind Administration > Policies > Writing guidelines, apart from React: the types of the guidelines door, how each field of a section's effective
3
+ * guidelines is labelled with where it came from, change lines, and the checks drawn from a set. The files editor itself is `guideline-files.ts`. Nothing here
4
+ * knows how a set is stored: every read and write is one of the `guidelines_*` operations (docs/plans/guidelines-as-data.md section 8).
5
5
  */
6
6
  import type { ImageEnvelope, ImageOperationName, ImageOperations } from "../images/operations.generated";
7
7
 
@@ -18,73 +18,12 @@ export const NO_REASON_PROBLEM = "Say why you are changing the guidelines. The r
18
18
  export const NO_WRITING_WARNING = "This publication has no writing guidelines yet, so agents and the editorial checks have no house voice to follow. Write them here.";
19
19
  export const EDITORS_READ_ONLY = "You can read the writing guidelines. Only an admin can change them.";
20
20
 
21
- export const LIST_FIELDS = [
22
- { key: "tone", label: "Tone", hint: "How the writing should sound. One sentence per line." },
23
- { key: "sentenceStyle", label: "Sentence style", hint: "How sentences are built. One per line." },
24
- { key: "voicePatterns", label: "Voice patterns", hint: "Moves the voice makes, and moves it avoids. One per line." },
25
- { key: "structure", label: "Structure", hint: "How a story is laid out. One per line." },
26
- { key: "evidenceRules", label: "Evidence rules", hint: "What a claim needs before it is written. One per line." },
27
- ] as const;
28
- export const CHOICE_FIELDS = [
29
- { key: "audience", label: "Audience", hint: "Who the publication writes for." },
30
- { key: "editorialAim", label: "Editorial aim", hint: "What the writing is for." },
31
- ] as const;
32
- export const LOCKABLE_FIELDS: { key: string; label: string }[] = [
33
- { key: "voice", label: "Voice" }, { key: "audience", label: "Audience" }, { key: "editorialAim", label: "Editorial aim" }, { key: "headline", label: "Headline" }, { key: "glossary", label: "Glossary" },
34
- ];
35
21
  export const FIELD_LABELS: Record<string, string> = {
36
22
  voice: "Voice", audience: "Audience", editorialAim: "Editorial aim", headline: "Headline", tone: "Tone", sentenceStyle: "Sentence style", voicePatterns: "Voice patterns",
37
23
  structure: "Structure", evidenceRules: "Evidence rules", bodyMarkus: "Guidance in your own words", lexicon: "Words to prefer and avoid", glossary: "Glossary",
38
24
  exemplars: "Voice examples", constraints: "Binding rules",
39
25
  };
40
26
 
41
- export type GlossaryRow = { term: string; use: string; avoid: string };
42
- export type WritingForm = {
43
- voiceName: string; audience: string; editorialAim: string; lists: Record<string, string>; prefer: string; avoid: string; bodyMarkus: string;
44
- glossary: GlossaryRow[]; exemplars: { storyLineageId: string; note: string }[]; locked: string[];
45
- };
46
-
47
- export const textLines = (text: string): string[] => text.split("\n").map((line) => line.trim()).filter(Boolean);
48
- const joinLines = (items: unknown): string => (Array.isArray(items) ? items.filter((item) => typeof item === "string").join("\n") : "");
49
- const asText = (value: unknown): string => (typeof value === "string" ? value : "");
50
-
51
- export function formFromDocument(document: GuidelineDocument | null): WritingForm {
52
- const source = document ?? {};
53
- return {
54
- voiceName: asText(source.voice?.name), audience: asText(source.audience), editorialAim: asText(source.editorialAim),
55
- lists: Object.fromEntries(LIST_FIELDS.map((field) => [field.key, joinLines(source[field.key])])),
56
- prefer: joinLines(source.lexicon?.prefer), avoid: joinLines(source.lexicon?.avoid), bodyMarkus: asText(source.bodyMarkus),
57
- glossary: (Array.isArray(source.glossary) ? source.glossary : []).map((entry: any) => ({ term: asText(entry.term), use: asText(entry.use), avoid: joinLines(entry.avoid).split("\n").join(", ") })),
58
- exemplars: (Array.isArray(source.exemplars) ? source.exemplars : []).map((entry: any) => ({ storyLineageId: asText(entry.storyLineageId), note: asText(entry.note) })),
59
- locked: Array.isArray(source.locked) ? source.locked.filter((item: unknown) => typeof item === "string") : [],
60
- };
61
- }
62
-
63
- /**
64
- * The document a form makes. Fields the form does not edit (headline, binding rules, the legacy publication-only fields) are carried over from `base` untouched;
65
- * a section's document never carries the publication-only fields, so a section form leaves them out. An empty field is left out, never saved empty.
66
- */
67
- export function documentFromForm(form: WritingForm, base: GuidelineDocument | null, scope: "publication" | "section"): GuidelineDocument {
68
- const document: GuidelineDocument = { ...(base ?? {}), schemaVersion: 2 };
69
- const setOrDrop = (key: string, value: unknown, present: boolean) => { if (present) document[key] = value; else delete document[key]; };
70
- setOrDrop("voice", { ...(base?.voice ?? {}), name: form.voiceName.trim() }, form.voiceName.trim() !== "");
71
- setOrDrop("audience", form.audience.trim(), form.audience.trim() !== "");
72
- setOrDrop("editorialAim", form.editorialAim.trim(), form.editorialAim.trim() !== "");
73
- for (const field of LIST_FIELDS) { const lines = textLines(form.lists[field.key] ?? ""); setOrDrop(field.key, lines, lines.length > 0); }
74
- const prefer = textLines(form.prefer), avoid = textLines(form.avoid);
75
- setOrDrop("lexicon", { ...(prefer.length ? { prefer } : {}), ...(avoid.length ? { avoid } : {}) }, prefer.length + avoid.length > 0);
76
- setOrDrop("bodyMarkus", form.bodyMarkus, form.bodyMarkus.trim() !== "");
77
- const glossary = form.glossary.filter((row) => row.term.trim()).map((row) => ({
78
- term: row.term.trim(), ...(row.use.trim() ? { use: row.use.trim() } : {}), ...(row.avoid.trim() ? { avoid: row.avoid.split(",").map((word) => word.trim()).filter(Boolean) } : {}),
79
- }));
80
- setOrDrop("glossary", glossary, glossary.length > 0);
81
- const exemplars = form.exemplars.filter((row) => row.storyLineageId).map((row) => ({ storyLineageId: row.storyLineageId, ...(row.note.trim() ? { note: row.note.trim() } : {}) }));
82
- setOrDrop("exemplars", exemplars, exemplars.length > 0);
83
- if (scope === "publication") setOrDrop("locked", form.locked, form.locked.length > 0);
84
- else for (const key of ["locked", "constraints", "publicationKey", "judge", "checks", "density", "rules", "compare", "referenceSamples"]) delete document[key];
85
- return document;
86
- }
87
-
88
27
  export function reasonProblem(reason: string): string | null {
89
28
  return reason.trim() ? null : NO_REASON_PROBLEM;
90
29
  }
@@ -110,9 +49,6 @@ export function describeChange(change: { path: string; from?: unknown; to?: unkn
110
49
  return `${name}: changed from ${shown(change.from)} to ${shown(change.to)}`;
111
50
  }
112
51
 
113
- export const addExemplar = (rows: WritingForm["exemplars"], story: PublishedStory): WritingForm["exemplars"] =>
114
- rows.some((row) => row.storyLineageId === story.lineageId) ? rows : [...rows, { storyLineageId: story.lineageId, note: "" }];
115
-
116
52
  export function storyTitle(stories: PublishedStory[], lineageId: string): string {
117
53
  return stories.find((story) => story.lineageId === lineageId)?.title ?? lineageId;
118
54
  }
@@ -41,6 +41,19 @@ export type ImageOperationName =
41
41
  | "announcements_settings_show"
42
42
  | "announcements_settings_set"
43
43
  | "announcements_account_status"
44
+ | "announcements_review_show"
45
+ | "announcements_review_set"
46
+ | "announcements_delivery_review_set"
47
+ | "announcements_draft"
48
+ | "announcements_pinned_change"
49
+ | "announcements_release"
50
+ | "announcements_unlock"
51
+ | "announcements_correct"
52
+ | "announcements_record_manual"
53
+ | "announcements_withdraw"
54
+ | "announcements_where"
55
+ | "announcements_recent"
56
+ | "announcements_explain"
44
57
  | "ratings_set"
45
58
  ;
46
59
 
@@ -1110,7 +1123,7 @@ export type AnnouncementsSettingsShowInput = Record<string, unknown>;
1110
1123
  export type AnnouncementsSettingsShowResult = {
1111
1124
  settings: {
1112
1125
  mode: "off" | "dry_run" | "on";
1113
- /** minStars, storyTypes and sections: what is announced. */
1126
+ /** minStars, storyTypes, sections and requireReviewedSource: what is announced. */
1114
1127
  rules?: Record<string, unknown>;
1115
1128
  /** Dollars for each X billing cycle. No default. */
1116
1129
  budget?: number | null;
@@ -1135,6 +1148,8 @@ export type AnnouncementsSettingsSetInput = {
1135
1148
  storyTypes?: string[];
1136
1149
  /** Limit to these sections. */
1137
1150
  sections?: string[];
1151
+ /** On: an Announcement is made only for a Story a person has reviewed on its current version. Off by default. */
1152
+ requireReviewedSource?: boolean;
1138
1153
  /** Dollars for each X billing cycle, such as 10.00. No default. */
1139
1154
  budget?: string;
1140
1155
  /** The day of the month your X billing cycle starts. */
@@ -1148,7 +1163,7 @@ export type AnnouncementsSettingsSetInput = {
1148
1163
  export type AnnouncementsSettingsSetResult = {
1149
1164
  settings: {
1150
1165
  mode: "off" | "dry_run" | "on";
1151
- /** minStars, storyTypes and sections: what is announced. */
1166
+ /** minStars, storyTypes, sections and requireReviewedSource: what is announced. */
1152
1167
  rules?: Record<string, unknown>;
1153
1168
  /** Dollars for each X billing cycle. No default. */
1154
1169
  budget?: number | null;
@@ -1176,6 +1191,320 @@ export type AnnouncementsAccountStatusResult = {
1176
1191
  pricesAsOf?: string;
1177
1192
  };
1178
1193
 
1194
+ /** Show the publication's announcement review and each override, and what a channel and kind would get. */
1195
+ export type AnnouncementsReviewShowInput = {
1196
+ /** Narrow to one channel, such as linkedin. */
1197
+ channel?: string;
1198
+ /** Narrow to one kind of Announcement, such as roundup or story_published. */
1199
+ kind?: string;
1200
+ /** Narrow to one newsletter list. */
1201
+ list?: string;
1202
+ };
1203
+
1204
+ export type AnnouncementsReviewShowResult = {
1205
+ policyVersion: number;
1206
+ approval?: string | null;
1207
+ rung: string;
1208
+ overrides: Record<string, unknown>[];
1209
+ /** With a channel and kind: the approval, the rung and where it came from. */
1210
+ chosen?: Record<string, unknown> | null;
1211
+ };
1212
+
1213
+ /** Set the announcement review for the publication, or for one channel, kind or list. Applies to Announcements made afterwards. */
1214
+ export type AnnouncementsReviewSetInput = {
1215
+ /** none: fully automatic. soft: a person may edit or stop it before its lock time; silence lets it go. hard: a person must release it. inherit takes an override away, so that scope follows the next wider one. */
1216
+ approval: "none" | "soft" | "hard" | "inherit";
1217
+ /** Narrow to one channel, such as linkedin. */
1218
+ channel?: string;
1219
+ /** Narrow to one kind of Announcement, such as roundup or story_published. */
1220
+ kind?: string;
1221
+ /** Narrow to one newsletter list. */
1222
+ list?: string;
1223
+ /** Why, in plain words. It is recorded with who and when. */
1224
+ reason: string;
1225
+ };
1226
+
1227
+ export type AnnouncementsReviewSetResult = {
1228
+ policyVersion: number;
1229
+ approval?: string | null;
1230
+ rung?: string;
1231
+ scope?: Record<string, unknown> | null;
1232
+ changed: boolean;
1233
+ };
1234
+
1235
+ /** Change the review of one Delivery that has not gone. The publication's policy and the other Deliveries do not change. */
1236
+ export type AnnouncementsDeliveryReviewSetInput = {
1237
+ /** The Delivery's id. */
1238
+ delivery: string;
1239
+ /** none: fully automatic. soft: a person may edit or stop it before its lock time; silence lets it go. hard: a person must release it. */
1240
+ approval: "none" | "soft" | "hard";
1241
+ };
1242
+
1243
+ export type AnnouncementsDeliveryReviewSetResult = {
1244
+ id: string;
1245
+ approval: string;
1246
+ approvalPolicy: string;
1247
+ approvedBy?: string | null;
1248
+ };
1249
+
1250
+ /** Draft a Delivery, add a candidate text or picture, or edit a block nobody pinned. */
1251
+ export type AnnouncementsDraftInput = {
1252
+ /** The Delivery's id. */
1253
+ delivery: string;
1254
+ };
1255
+
1256
+ export type AnnouncementsDraftResult = {
1257
+ id: string;
1258
+ };
1259
+
1260
+ /** Change or unpin a block a person pinned. */
1261
+ export type AnnouncementsPinnedChangeInput = {
1262
+ /** The Delivery's id. */
1263
+ delivery: string;
1264
+ };
1265
+
1266
+ export type AnnouncementsPinnedChangeResult = {
1267
+ id: string;
1268
+ };
1269
+
1270
+ /** Release a Delivery: hand it to its channel now. */
1271
+ export type AnnouncementsReleaseInput = {
1272
+ /** The Delivery's id. */
1273
+ delivery: string;
1274
+ };
1275
+
1276
+ export type AnnouncementsReleaseResult = {
1277
+ id: string;
1278
+ };
1279
+
1280
+ /** Unlock a Delivery after its lock time, so it can be edited again. */
1281
+ export type AnnouncementsUnlockInput = {
1282
+ /** The Delivery's id. */
1283
+ delivery: string;
1284
+ };
1285
+
1286
+ export type AnnouncementsUnlockResult = {
1287
+ id: string;
1288
+ };
1289
+
1290
+ /** Correct a Delivery with a new public text: the next generation, which supersedes the one that went. */
1291
+ export type AnnouncementsCorrectInput = {
1292
+ /** The Delivery's id. */
1293
+ delivery: string;
1294
+ };
1295
+
1296
+ export type AnnouncementsCorrectResult = {
1297
+ id: string;
1298
+ };
1299
+
1300
+ /** Record the address of a post a person made by hand for a manual Delivery: the Delivery becomes sent and its attempt names that person. */
1301
+ export type AnnouncementsRecordManualInput = {
1302
+ /** The Delivery's id. */
1303
+ delivery: string;
1304
+ /** The address of the post, an http or https URL. */
1305
+ url: string;
1306
+ };
1307
+
1308
+ export type AnnouncementsRecordManualResult = {
1309
+ id: string;
1310
+ state: string;
1311
+ resultUrl: string;
1312
+ /** The attempt that was written: number, at, outcome, by and url. */
1313
+ attempt: Record<string, unknown>;
1314
+ };
1315
+
1316
+ /** Withdraw a Delivery that went: this deletes a public post. */
1317
+ export type AnnouncementsWithdrawInput = {
1318
+ /** The Delivery's id. */
1319
+ delivery: string;
1320
+ };
1321
+
1322
+ export type AnnouncementsWithdrawResult = {
1323
+ id: string;
1324
+ };
1325
+
1326
+ /** Where a Story was announced: each Announcement that announces it, with one line for each live Delivery. */
1327
+ export type AnnouncementsWhereInput = {
1328
+ /** The lineage id of the Story. */
1329
+ story: string;
1330
+ };
1331
+
1332
+ export type AnnouncementsWhereResult = {
1333
+ story: string;
1334
+ announcements: ({
1335
+ id: string;
1336
+ kind: string;
1337
+ state: string;
1338
+ releaseAt: string;
1339
+ trigger?: string | null;
1340
+ createdBy?: string | null;
1341
+ /** The version of the Story the Announcement looked at. */
1342
+ versionLookedAt?: number | null;
1343
+ /** The one open review flag for a blocked draft, once for each Announcement: id, words, mark, reason and ask. */
1344
+ reviewFlag?: Record<string, unknown> | null;
1345
+ /** One line for each live Delivery, in channel order. */
1346
+ deliveries: ({
1347
+ /** The Delivery's id. */
1348
+ id: string;
1349
+ announcementId: string;
1350
+ channel: string;
1351
+ accountId: string;
1352
+ generation?: number;
1353
+ /** The Delivery's state. */
1354
+ state: string;
1355
+ /** The state in words, such as Sent or Blocked: check failed. */
1356
+ words: string;
1357
+ /** The Lucide icon of the state. */
1358
+ mark: string;
1359
+ /** The review in words and a mark: words, mark and approval (none, soft or hard). Null for a Delivery that will not go. */
1360
+ approval?: Record<string, unknown> | null;
1361
+ releaseAt?: string | null;
1362
+ lockAt?: string | null;
1363
+ /** The earliest time it is still waiting for. */
1364
+ dueAt?: string | null;
1365
+ waitingFor?: string | null;
1366
+ nextAttemptAt?: string | null;
1367
+ blockedReason?: string | null;
1368
+ /** How many attempts were opened. */
1369
+ attempts: number;
1370
+ /** The last attempt: number, at, outcome, code, words and mark. */
1371
+ lastAttempt?: Record<string, unknown> | null;
1372
+ resultUrl?: string | null;
1373
+ /** What needs a person's eye: Overdue (due, with no attempt), Outcome unknown (an attempt with no answer yet, until Caducus settles it), or a failed check. */
1374
+ attention: ({
1375
+ kind: "overdue" | "outcome_unknown" | "check_failed";
1376
+ words: string;
1377
+ mark: string;
1378
+ /** When it began, as a UTC time. */
1379
+ since?: string;
1380
+ })[];
1381
+ })[];
1382
+ /** In the list: the Stories it is about, each with lineageId and title. */
1383
+ stories?: Record<string, unknown>[];
1384
+ })[];
1385
+ };
1386
+
1387
+ /** The Announcements list: Announcements newest first, one line for each live Delivery, and every Delivery that is overdue. */
1388
+ export type AnnouncementsRecentInput = {
1389
+ /** The size of a page; 25 when left out. A page never splits Announcements released at the same moment. */
1390
+ limit?: number;
1391
+ /** The next value of the last page: shows the Announcements released before that time. */
1392
+ before?: string;
1393
+ };
1394
+
1395
+ export type AnnouncementsRecentResult = {
1396
+ announcements: ({
1397
+ id: string;
1398
+ kind: string;
1399
+ state: string;
1400
+ releaseAt: string;
1401
+ trigger?: string | null;
1402
+ createdBy?: string | null;
1403
+ /** The version of the Story the Announcement looked at. */
1404
+ versionLookedAt?: number | null;
1405
+ /** The one open review flag for a blocked draft, once for each Announcement: id, words, mark, reason and ask. */
1406
+ reviewFlag?: Record<string, unknown> | null;
1407
+ /** One line for each live Delivery, in channel order. */
1408
+ deliveries: ({
1409
+ /** The Delivery's id. */
1410
+ id: string;
1411
+ announcementId: string;
1412
+ channel: string;
1413
+ accountId: string;
1414
+ generation?: number;
1415
+ /** The Delivery's state. */
1416
+ state: string;
1417
+ /** The state in words, such as Sent or Blocked: check failed. */
1418
+ words: string;
1419
+ /** The Lucide icon of the state. */
1420
+ mark: string;
1421
+ /** The review in words and a mark: words, mark and approval (none, soft or hard). Null for a Delivery that will not go. */
1422
+ approval?: Record<string, unknown> | null;
1423
+ releaseAt?: string | null;
1424
+ lockAt?: string | null;
1425
+ /** The earliest time it is still waiting for. */
1426
+ dueAt?: string | null;
1427
+ waitingFor?: string | null;
1428
+ nextAttemptAt?: string | null;
1429
+ blockedReason?: string | null;
1430
+ /** How many attempts were opened. */
1431
+ attempts: number;
1432
+ /** The last attempt: number, at, outcome, code, words and mark. */
1433
+ lastAttempt?: Record<string, unknown> | null;
1434
+ resultUrl?: string | null;
1435
+ /** What needs a person's eye: Overdue (due, with no attempt), Outcome unknown (an attempt with no answer yet, until Caducus settles it), or a failed check. */
1436
+ attention: ({
1437
+ kind: "overdue" | "outcome_unknown" | "check_failed";
1438
+ words: string;
1439
+ mark: string;
1440
+ /** When it began, as a UTC time. */
1441
+ since?: string;
1442
+ })[];
1443
+ })[];
1444
+ /** In the list: the Stories it is about, each with lineageId and title. */
1445
+ stories?: Record<string, unknown>[];
1446
+ })[];
1447
+ /** Every Delivery that is due and has no attempt, read from the sparse due index. */
1448
+ overdue: ({
1449
+ /** The Delivery's id. */
1450
+ id: string;
1451
+ announcementId: string;
1452
+ channel: string;
1453
+ accountId: string;
1454
+ generation?: number;
1455
+ /** The Delivery's state. */
1456
+ state: string;
1457
+ /** The state in words, such as Sent or Blocked: check failed. */
1458
+ words: string;
1459
+ /** The Lucide icon of the state. */
1460
+ mark: string;
1461
+ /** The review in words and a mark: words, mark and approval (none, soft or hard). Null for a Delivery that will not go. */
1462
+ approval?: Record<string, unknown> | null;
1463
+ releaseAt?: string | null;
1464
+ lockAt?: string | null;
1465
+ /** The earliest time it is still waiting for. */
1466
+ dueAt?: string | null;
1467
+ waitingFor?: string | null;
1468
+ nextAttemptAt?: string | null;
1469
+ blockedReason?: string | null;
1470
+ /** How many attempts were opened. */
1471
+ attempts: number;
1472
+ /** The last attempt: number, at, outcome, code, words and mark. */
1473
+ lastAttempt?: Record<string, unknown> | null;
1474
+ resultUrl?: string | null;
1475
+ /** What needs a person's eye: Overdue (due, with no attempt), Outcome unknown (an attempt with no answer yet, until Caducus settles it), or a failed check. */
1476
+ attention: ({
1477
+ kind: "overdue" | "outcome_unknown" | "check_failed";
1478
+ words: string;
1479
+ mark: string;
1480
+ /** When it began, as a UTC time. */
1481
+ since?: string;
1482
+ })[];
1483
+ })[];
1484
+ /** Pass as before for the next page; null on the last page. */
1485
+ next: string | null;
1486
+ };
1487
+
1488
+ /** Why a Story was or was not announced, for each channel, naming the rule. Reads the rules; writes nothing. */
1489
+ export type AnnouncementsExplainInput = {
1490
+ /** The lineage id of the Story. */
1491
+ story: string;
1492
+ };
1493
+
1494
+ export type AnnouncementsExplainResult = {
1495
+ story: string;
1496
+ title?: string;
1497
+ stars?: number;
1498
+ channels: {
1499
+ channel: string;
1500
+ announced: boolean;
1501
+ /** The rule: announced, off, not_published, type_not_announced, section_not_announced, below_bar, below_floor, machine_five, story_not_reviewed, no_delivery or would_announce. */
1502
+ rule: string;
1503
+ words: string;
1504
+ delivery?: string;
1505
+ }[];
1506
+ };
1507
+
1179
1508
  /** Give a Story a star rating, 1 to 5. An agent may give only three or four stars, and only to a Story nobody has rated. */
1180
1509
  export type RatingsSetInput = {
1181
1510
  /** The lineage id of the Story. */
@@ -1231,6 +1560,19 @@ export interface ImageOperations {
1231
1560
  announcements_settings_show: { input: AnnouncementsSettingsShowInput; result: AnnouncementsSettingsShowResult };
1232
1561
  announcements_settings_set: { input: AnnouncementsSettingsSetInput; result: AnnouncementsSettingsSetResult };
1233
1562
  announcements_account_status: { input: AnnouncementsAccountStatusInput; result: AnnouncementsAccountStatusResult };
1563
+ announcements_review_show: { input: AnnouncementsReviewShowInput; result: AnnouncementsReviewShowResult };
1564
+ announcements_review_set: { input: AnnouncementsReviewSetInput; result: AnnouncementsReviewSetResult };
1565
+ announcements_delivery_review_set: { input: AnnouncementsDeliveryReviewSetInput; result: AnnouncementsDeliveryReviewSetResult };
1566
+ announcements_draft: { input: AnnouncementsDraftInput; result: AnnouncementsDraftResult };
1567
+ announcements_pinned_change: { input: AnnouncementsPinnedChangeInput; result: AnnouncementsPinnedChangeResult };
1568
+ announcements_release: { input: AnnouncementsReleaseInput; result: AnnouncementsReleaseResult };
1569
+ announcements_unlock: { input: AnnouncementsUnlockInput; result: AnnouncementsUnlockResult };
1570
+ announcements_correct: { input: AnnouncementsCorrectInput; result: AnnouncementsCorrectResult };
1571
+ announcements_record_manual: { input: AnnouncementsRecordManualInput; result: AnnouncementsRecordManualResult };
1572
+ announcements_withdraw: { input: AnnouncementsWithdrawInput; result: AnnouncementsWithdrawResult };
1573
+ announcements_where: { input: AnnouncementsWhereInput; result: AnnouncementsWhereResult };
1574
+ announcements_recent: { input: AnnouncementsRecentInput; result: AnnouncementsRecentResult };
1575
+ announcements_explain: { input: AnnouncementsExplainInput; result: AnnouncementsExplainResult };
1234
1576
  ratings_set: { input: RatingsSetInput; result: RatingsSetResult };
1235
1577
  }
1236
1578
 
@@ -1274,6 +1616,19 @@ export const IMAGE_OPERATIONS = {
1274
1616
  announcements_settings_show: { effect: "read", agentAllowed: true, agentRung: "observe", agentRefusal: "human_required", group: "announcements", command: "papyrus announcements settings show" },
1275
1617
  announcements_settings_set: { effect: "write", agentAllowed: false, agentRung: "person", agentRefusal: "blocked", group: "announcements", command: "papyrus announcements settings set" },
1276
1618
  announcements_account_status: { effect: "read", agentAllowed: true, agentRung: "observe", agentRefusal: "human_required", group: "announcements", command: "papyrus announcements account status" },
1619
+ announcements_review_show: { effect: "read", agentAllowed: true, agentRung: "observe", agentRefusal: "human_required", group: "announcements", command: "papyrus announcements review show" },
1620
+ announcements_review_set: { effect: "write", agentAllowed: false, agentRung: "person", agentRefusal: "blocked", group: "announcements", command: "papyrus announcements review set" },
1621
+ announcements_delivery_review_set: { effect: "write", agentAllowed: false, agentRung: "person", agentRefusal: "human_required", group: "announcements", command: "papyrus announcements delivery review" },
1622
+ announcements_draft: { effect: "write", agentAllowed: true, agentRung: "draft", agentRefusal: "human_required", group: "announcements", command: "papyrus announcements draft" },
1623
+ announcements_pinned_change: { effect: "write", agentAllowed: false, agentRung: "person", agentRefusal: "blocked", group: "announcements", command: "papyrus announcements pinned" },
1624
+ announcements_release: { effect: "write", agentAllowed: true, agentRung: "publish_auto", agentRefusal: "human_required", group: "announcements", command: "papyrus announcements release" },
1625
+ announcements_unlock: { effect: "write", agentAllowed: false, agentRung: "person", agentRefusal: "human_required", group: "announcements", command: "papyrus announcements unlock" },
1626
+ announcements_correct: { effect: "write", agentAllowed: true, agentRung: "prepare", agentRefusal: "human_required", group: "announcements", command: "papyrus announcements correct" },
1627
+ announcements_record_manual: { effect: "write", agentAllowed: false, agentRung: "person", agentRefusal: "human_required", group: "announcements", command: "papyrus announcements record-manual" },
1628
+ announcements_withdraw: { effect: "write", agentAllowed: false, agentRung: "person", agentRefusal: "human_required", group: "announcements", command: "papyrus announcements withdraw" },
1629
+ announcements_where: { effect: "read", agentAllowed: true, agentRung: "observe", agentRefusal: "human_required", group: "announcements", command: "papyrus announcements where" },
1630
+ announcements_recent: { effect: "read", agentAllowed: true, agentRung: "observe", agentRefusal: "human_required", group: "announcements", command: "papyrus announcements recent" },
1631
+ announcements_explain: { effect: "read", agentAllowed: true, agentRung: "observe", agentRefusal: "human_required", group: "announcements", command: "papyrus announcements explain" },
1277
1632
  ratings_set: { effect: "write", agentAllowed: true, agentRung: "draft", agentRefusal: "human_required", group: "ratings", command: "papyrus ratings set" },
1278
1633
  } as const;
1279
1634
 
@@ -11,6 +11,8 @@ import {
11
11
  createStoryFromReference,
12
12
  type ContentActionError,
13
13
  } from "./content-actions-client";
14
+ import type { AnnouncementsDoor } from "./announcement-lines";
15
+ import { announcementsDoor } from "./announcements-door-client";
14
16
  import { createDemoArticlesBackend } from "./content-actions-demo";
15
17
  import { UNTYPED_ITEM_TYPE } from "./content-item-lifecycle";
16
18
  import { ALWAYS_PROJECTED, typeForNewStory, siteStoryTypes } from "./site-story-types";
@@ -111,6 +113,8 @@ export type ArticlesBackend = {
111
113
  };
112
114
  listRows: () => Promise<NewsroomArticleRow[]>;
113
115
  loadArticle: (id: string) => Promise<EditableArticle>;
116
+ /** The announcements door (reads only): where the Story was announced, one line for each Delivery. */
117
+ announcementsDoor: AnnouncementsDoor;
114
118
  };
115
119
 
116
120
  export function slugify(value: string): string {
@@ -350,6 +354,7 @@ export function createLiveArticlesBackend(): ArticlesBackend {
350
354
  actions: { deriveMarkus, saveItemDraft, publishItem, unpublishItem, moveStoryStage, scheduleStory, scheduleList, createStoryFromReference, setItemStars },
351
355
  listRows: () => loadArticleRows(dataClient()),
352
356
  loadArticle: (id) => loadEditableArticle(dataClient(), id),
357
+ announcementsDoor,
353
358
  };
354
359
  }
355
360
 
@@ -48,5 +48,12 @@ export const FIXTURE_TODAY: TodayOverview = {
48
48
  { automationId: "digest.weekly", title: "Weekly digest", state: "Did not run", whyCode: "disabled", why: "Disabled: the router starts nothing for a disabled automation" },
49
49
  { automationId: "newsletter.daily", title: "Daily summary", state: "Did not run", whyCode: "no_wake", why: "Nothing woke it today" },
50
50
  ],
51
+ sends: [
52
+ {
53
+ deliveryId: "announcement-weekly#email#site#g1", announcementId: "announcement-weekly", kind: "roundup", releasedAt: "2026-11-16T13:00:00Z", lists: ["weekly"], items: 5,
54
+ state: "sent", stateShown: "✓ Sent", stateWords: "Sent", attempts: 1, lastAttempt: "sent",
55
+ counts: { queued: 0, sent: 12, failed: 0, suppressed: 1, skipped: 2, delivered: 11, bounced: 1, complained: 0 }, countsText: "12 sent, 1 suppressed, 2 skipped, 11 delivered, 1 bounced", cost: null,
56
+ },
57
+ ],
51
58
  totals: { runs: 15, counts: { ...none, acted: 8, nothing: 4, asked: 1, failed: 1, unknown: 1 }, costUsd: 0.43, costKnownRuns: 14, costUnknownRuns: 1 },
52
59
  };
@@ -39,6 +39,29 @@ export type TodayRow = TodayCosts & {
39
39
 
40
40
  export type TodayDidNotRun = { automationId: string; title: string; state: "Did not run"; whyCode: "disabled" | "unsupported" | "no_wake"; why: string };
41
41
 
42
+ export type TodaySendCounts = Record<"queued" | "sent" | "failed" | "suppressed" | "skipped" | "delivered" | "bounced" | "complained", number>;
43
+
44
+ /** One email send: an email Delivery of an Announcement released in the day, with the counts Caducus's records add up to. */
45
+ export type TodaySend = {
46
+ deliveryId: string;
47
+ announcementId: string;
48
+ kind: string;
49
+ releasedAt: string;
50
+ lists: string[];
51
+ items: number;
52
+ state: string;
53
+ /** Where the send stands as a mark and its words, as the command line prints it. */
54
+ stateShown: string;
55
+ /** The same words without the mark: the page draws its own mark (a Lucide icon). */
56
+ stateWords: string;
57
+ attempts: number;
58
+ lastAttempt: string | null;
59
+ counts: TodaySendCounts;
60
+ countsText: string;
61
+ /** What Caducus charged, a decimal string, or null when nothing was charged. */
62
+ cost: string | null;
63
+ };
64
+
42
65
  export type TodayOverview = {
43
66
  state: "ready";
44
67
  asOf: string;
@@ -48,6 +71,7 @@ export type TodayOverview = {
48
71
  end: string;
49
72
  rows: TodayRow[];
50
73
  didNotRun: TodayDidNotRun[];
74
+ sends: TodaySend[];
51
75
  totals: TodayCosts & { runs: number; counts: TodayCounts };
52
76
  };
53
77
 
@@ -65,6 +89,22 @@ export const OTHER_WORDS: Record<"notFinished" | "beforeOutcomes", string> = {
65
89
  notFinished: "Not finished yet",
66
90
  beforeOutcomes: "Recorded before outcomes",
67
91
  };
92
+ /** The words of each send count, in the order a send lists them. A count of zero is left out; a send with none says so. */
93
+ export const SEND_COUNT_WORDS: Record<keyof TodaySendCounts, string> = {
94
+ queued: "Queued", sent: "Sent", failed: "Failed", suppressed: "Suppressed", skipped: "Skipped", delivered: "Delivered", bounced: "Bounced", complained: "Complained",
95
+ };
96
+ export const SEND_COUNT_ORDER = Object.keys(SEND_COUNT_WORDS) as (keyof TodaySendCounts)[];
97
+
98
+ export const NO_SEND_COST = "no cost recorded";
99
+
100
+ export function sendCostText(cost: string | null): string {
101
+ return cost === null ? NO_SEND_COST : dollars(Number(cost));
102
+ }
103
+
104
+ export function sendItemsText(items: number): string {
105
+ return `${items} item${items === 1 ? "" : "s"}`;
106
+ }
107
+
68
108
  export const OUTCOME_ORDER: TodayOutcome[] = ["acted", "nothing", "asked", "failed", "unknown"];
69
109
  export const OTHER_ORDER: ("notFinished" | "beforeOutcomes")[] = ["notFinished", "beforeOutcomes"];
70
110
 
package/package.json CHANGED
@@ -72,6 +72,8 @@
72
72
  "./components/ai-elements/suggestion": "./components/ai-elements/suggestion.tsx",
73
73
  "./components/ai-elements/tool": "./components/ai-elements/tool.tsx",
74
74
  "./components/amplify-client-provider": "./components/amplify-client-provider.tsx",
75
+ "./components/announcement-lines": "./components/announcement-lines.tsx",
76
+ "./components/announcement-marks": "./components/announcement-marks.tsx",
75
77
  "./components/announcements-panel": "./components/announcements-panel.tsx",
76
78
  "./components/archive-grid": "./components/archive-grid.tsx",
77
79
  "./components/archive-shell": "./components/archive-shell.tsx",
@@ -262,8 +264,10 @@
262
264
  "./lib/amplify-outputs-guard": "./lib/amplify-outputs-guard.ts",
263
265
  "./lib/amplify-outputs-path": "./lib/amplify-outputs-path.ts",
264
266
  "./lib/amplify-server-runtime": "./lib/amplify-server-runtime.ts",
267
+ "./lib/announcement-lines": "./lib/announcement-lines.ts",
265
268
  "./lib/announcements-client": "./lib/announcements-client.ts",
266
- "./lib/announcements-data": "./lib/announcements-data.ts",
269
+ "./lib/announcements-demo": "./lib/announcements-demo.ts",
270
+ "./lib/announcements-door-client": "./lib/announcements-door-client.ts",
267
271
  "./lib/announcements-fixture": "./lib/announcements-fixture.ts",
268
272
  "./lib/announcements-model": "./lib/announcements-model.ts",
269
273
  "./lib/approved-priming-proof-reports": "./lib/approved-priming-proof-reports.ts",
@@ -328,6 +332,7 @@
328
332
  "./lib/front-mosaic": "./lib/front-mosaic.ts",
329
333
  "./lib/furniture": "./lib/furniture.ts",
330
334
  "./lib/graphql-content-repository": "./lib/graphql-content-repository.ts",
335
+ "./lib/guidelines/guideline-files": "./lib/guidelines/guideline-files.ts",
331
336
  "./lib/guidelines/guidelines-door-client": "./lib/guidelines/guidelines-door-client.ts",
332
337
  "./lib/guidelines/writing-guidelines-admin": "./lib/guidelines/writing-guidelines-admin.ts",
333
338
  "./lib/hosted-cyclotron-status": "./lib/hosted-cyclotron-status.ts",
@@ -645,7 +650,7 @@
645
650
  "optional": true
646
651
  }
647
652
  },
648
- "version": "5.131.0-next.1",
653
+ "version": "5.131.0-next.3",
649
654
  "dependencies": {
650
655
  "@aws-amplify/adapter-nextjs": "^1.7.3",
651
656
  "@aws-crypto/sha256-js": "5.2.0",
@@ -1,5 +1,5 @@
1
1
  {
2
- "version": "5.131.0-next.1",
2
+ "version": "5.131.0-next.3",
3
3
  "routes": [
4
4
  {
5
5
  "file": "app/%5F_preview/[[...path]]/route.ts",