@anthusai/papyrus 5.138.0-next.1 → 5.138.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.
@@ -12,6 +12,7 @@ export const AUTOMATION_VIEW_FUNCTION_FIELDS = [
12
12
  "Query/fields/listAutomations",
13
13
  "Query/fields/listAutomationsByTenant",
14
14
  "Query/fields/listDeliveriesByAnnouncementAndCreatedAt",
15
+ "Query/fields/listDeliveriesByDueKeyAndDueAt",
15
16
  "Query/fields/listProcedureRunsByProcedureAndRequestedAt",
16
17
  "Query/fields/listProcedureRunsByStatusAndRequestedAt",
17
18
  "Query/fields/listSemanticRelationsBySubjectState",
@@ -19,6 +19,7 @@ export const AUTOMATION_VIEW_FUNCTION_FIELDS = [
19
19
  "Query/fields/listAutomations",
20
20
  "Query/fields/listAutomationsByTenant",
21
21
  "Query/fields/listDeliveriesByAnnouncementAndCreatedAt",
22
+ "Query/fields/listDeliveriesByDueKeyAndDueAt",
22
23
  "Query/fields/listProcedureRunsByProcedureAndRequestedAt",
23
24
  "Query/fields/listProcedureRunsByStatusAndRequestedAt",
24
25
  "Query/fields/listSemanticRelationsBySubjectState",
@@ -786,7 +786,7 @@ def save_item_draft_action(arguments: dict, actor: str, approved_by: str | None
786
786
  },
787
787
  }
788
788
  if record["status"] == "published" and projection_configured():
789
- published = publish_item(client, record["id"], actor=actor, approved_by=approved_by, by_person=approved_by)
789
+ published = publish_item(client, record["id"], actor=actor, approved_by=approved_by)
790
790
  response["item"]["versionNumber"] = published.version_number
791
791
  response.update(project_item_action(client, record["id"], unpublished=False))
792
792
  return response
@@ -881,7 +881,7 @@ def drain_publish_queue_action() -> dict:
881
881
  return {"ok": True, "scheduled": bool(schedule_projection_task({"task": "drain"}, "batch publish"))}
882
882
 
883
883
 
884
- def publish_item_action(arguments: dict, actor: str, approved_by: str | None = None, by_person: str | None = None) -> dict:
884
+ def publish_item_action(arguments: dict, actor: str, approved_by: str | None = None) -> dict:
885
885
  if arguments.get("jobStatus"):
886
886
  return projection_status_action(arguments)
887
887
  if arguments.get("drain") is True:
@@ -890,7 +890,7 @@ def publish_item_action(arguments: dict, actor: str, approved_by: str | None = N
890
890
  candidate = client.get_record("Item", arguments["id"]) or {}
891
891
  live = client.get_record("PublishedItem", published_item_id_for(candidate.get("lineageId") or arguments["id"]))
892
892
  render_preflight(client, arguments["id"]) # a page the site cannot render is refused before any published data is written
893
- result = publish_item(client, arguments["id"], actor=actor, approved_by=approved_by, by_person=by_person)
893
+ result = publish_item(client, arguments["id"], actor=actor, approved_by=approved_by)
894
894
  response = {
895
895
  "ok": True,
896
896
  "changed": result.changed,
@@ -1169,7 +1169,7 @@ def _handle_field(event):
1169
1169
  return save_item_draft_action(arguments, actor, person_from_event(event))
1170
1170
  if field == "publishItem":
1171
1171
  person = person_from_event(event)
1172
- return publish_item_action(arguments, actor, person, person)
1172
+ return publish_item_action(arguments, actor, person)
1173
1173
  if field == "createStoryFromReference":
1174
1174
  return create_story_from_reference_action(arguments, actor)
1175
1175
  if field == "moveStoryStage":
@@ -1,5 +1,6 @@
1
1
  import Link from "next/link";
2
2
  import { RunNowControl } from "./automation-run-now";
3
+ import { RunOutcome } from "./run-outcome";
3
4
  import {
4
5
  ENABLED_NOTE,
5
6
  OUTSIDE_NOTICE,
@@ -38,7 +39,7 @@ function RunLine({ run, demo }: { run: AutomationRun; demo: boolean }) {
38
39
  <li data-automation-run={run.runId ?? run.sourceId ?? "unlinked"} data-run-status={run.status ?? "unknown"}>
39
40
  <strong>{formatUtc(run.startedAt)}</strong>
40
41
  <span><span aria-hidden="true">{statusMark(run.status)} </span>Status: {statusText(run.status)} &middot; {durationText(run.durationSeconds)}</span>
41
- <span data-automation-run-outcome={run.outcome ?? undefined}>Outcome: {run.outcomeShown}</span>
42
+ <span data-automation-run-outcome={run.outcome ?? undefined}>Outcome: <RunOutcome outcome={run.outcome} shown={run.outcomeShown} /></span>
42
43
  <span>{whoText(run)}</span>
43
44
  {run.reason ? <span data-automation-run-reason>Reason: {run.reason}</span> : null}
44
45
  {run.error ? <span data-automation-run-error>Error: {run.error}</span> : null}
@@ -64,7 +65,7 @@ function OutsideRunLine({ run, demo }: { run: AutomationOutsideRun; demo: boolea
64
65
  <li data-automation-outside-run={run.runId ?? "unlinked"} data-run-status={run.status ?? "unknown"}>
65
66
  <strong>{formatUtc(run.startedAt)}</strong>
66
67
  <span><span aria-hidden="true">{statusMark(run.status)} </span>Status: {statusText(run.status)} &middot; {durationText(run.durationSeconds)}</span>
67
- <span data-automation-run-outcome={run.outcome ?? undefined}>Outcome: {run.outcomeShown}</span>
68
+ <span data-automation-run-outcome={run.outcome ?? undefined}>Outcome: <RunOutcome outcome={run.outcome} shown={run.outcomeShown} /></span>
68
69
  <span>Started by: {run.requestedBy ?? "unknown"}</span>
69
70
  {run.error ? <span data-automation-run-error>Error: {run.error}</span> : null}
70
71
  <span>{run.runId ? <>Run {run.runId} (<Link href={proceduresHref(demo)}>Procedures</Link>)</> : "No run id"}</span>
@@ -0,0 +1,37 @@
1
+ import { CheckIcon, CircleHelpIcon, ClockIcon, MinusIcon, TriangleAlertIcon, XIcon, type LucideIcon } from "lucide-react";
2
+
3
+ /**
4
+ * What came of a run, as a Lucide icon and its words (PPY-1a322a). The icons differ by shape, not by colour, and the words are always beside them, so
5
+ * the five outcomes tell apart in greyscale. The server's text mark (`✓ – ? ✗ !`, kept for the command line) is never shown here: `outcomeWords` takes it off.
6
+ */
7
+ export const OUTCOME_MARKS: Record<string, LucideIcon> = {
8
+ acted: CheckIcon,
9
+ nothing: MinusIcon,
10
+ asked: CircleHelpIcon,
11
+ failed: XIcon,
12
+ unknown: TriangleAlertIcon,
13
+ notFinished: ClockIcon,
14
+ beforeOutcomes: MinusIcon,
15
+ };
16
+
17
+ const TEXT_MARK = /^[✓–?✗!]\s+/;
18
+
19
+ /** The words of an outcome line without the command line's leading text mark. */
20
+ export function outcomeWords(shown: string): string {
21
+ return shown.replace(TEXT_MARK, "");
22
+ }
23
+
24
+ export function OutcomeMark({ outcome }: { outcome: string }) {
25
+ const Icon = OUTCOME_MARKS[outcome];
26
+ return Icon ? <Icon aria-hidden="true" className="size-3.5 shrink-0" data-outcome-mark={outcome} /> : null;
27
+ }
28
+
29
+ /** The outcome of one run: its icon (when it has an outcome the table knows) and its words. */
30
+ export function RunOutcome({ outcome, shown }: { outcome: string | null; shown: string }) {
31
+ return (
32
+ <span className="inline-flex items-center gap-1.5" data-run-outcome-shown={outcome ?? undefined}>
33
+ {outcome ? <OutcomeMark outcome={outcome} /> : null}
34
+ {outcomeWords(shown)}
35
+ </span>
36
+ );
37
+ }
@@ -1,5 +1,6 @@
1
1
  import Link from "next/link";
2
- import { CheckIcon, ChevronDownIcon, CircleHelpIcon, ClockIcon, MinusIcon, TriangleAlertIcon, XIcon, type LucideIcon } from "lucide-react";
2
+ import { AlarmClockIcon, CheckIcon, ChevronDownIcon, ClockIcon, MinusIcon, TriangleAlertIcon, XIcon, type LucideIcon } from "lucide-react";
3
+ import { OUTCOME_MARKS, RunOutcome } from "./run-outcome";
3
4
  import {
4
5
  OTHER_ORDER,
5
6
  OUTCOME_ORDER,
@@ -16,6 +17,7 @@ import {
16
17
  sendItemsText,
17
18
  type TodayCountKey,
18
19
  type TodayDidNotRun,
20
+ type TodayOverdue,
19
21
  type TodayOverview,
20
22
  type TodayResult,
21
23
  type TodayRow,
@@ -23,19 +25,8 @@ import {
23
25
  type TodaySend,
24
26
  } from "../lib/today-overview";
25
27
 
26
- /** Every status is a mark and its words, never a colour alone. The marks are Lucide icons; the words come with them. */
27
- const MARKS: Record<TodayCountKey, LucideIcon> = {
28
- acted: CheckIcon,
29
- nothing: MinusIcon,
30
- asked: CircleHelpIcon,
31
- failed: XIcon,
32
- unknown: TriangleAlertIcon,
33
- notFinished: ClockIcon,
34
- beforeOutcomes: MinusIcon,
35
- };
36
-
37
28
  function Mark({ name }: { name: TodayCountKey }) {
38
- const Icon = MARKS[name];
29
+ const Icon = OUTCOME_MARKS[name];
39
30
  return <Icon aria-hidden="true" className="size-3.5 shrink-0" />;
40
31
  }
41
32
 
@@ -54,10 +45,7 @@ function RunLine({ run }: { run: TodayRun }) {
54
45
  const outcome = run.outcome ?? (run.runStatus === "completed" || run.runStatus === "failed" ? "beforeOutcomes" : "notFinished");
55
46
  return (
56
47
  <li className="flex flex-wrap items-center gap-x-3 gap-y-1 text-xs" data-today-run={run.runId ?? "unlinked"} data-today-run-outcome={outcome}>
57
- <span className="inline-flex items-center gap-1.5 font-medium">
58
- <Mark name={outcome} />
59
- {run.outcomeShown}
60
- </span>
48
+ <span className="font-medium"><RunOutcome outcome={outcome} shown={run.outcomeShown} /></span>
61
49
  <span className="tabular-nums text-muted-foreground">{run.requestedAt ? run.requestedAt.slice(11, 16) + " UTC" : "time not recorded"}</span>
62
50
  <span className="text-muted-foreground">{run.costUsd === null ? "cost unknown" : costText({ costUsd: run.costUsd, costKnownRuns: 1, costUnknownRuns: 0 })}</span>
63
51
  <span className="break-all text-muted-foreground">{run.runId ? `Run ${run.runId}` : "No run id"}</span>
@@ -149,6 +137,19 @@ function SendLine({ send }: { send: TodaySend }) {
149
137
  );
150
138
  }
151
139
 
140
+ function OverdueLine({ entry }: { entry: TodayOverdue }) {
141
+ return (
142
+ <li className="flex flex-wrap items-center gap-x-3 gap-y-1 rounded-[16px] bg-[var(--feed-card)] p-3 text-sm" data-today-overdue={entry.id} data-today-overdue-kind={entry.kind}>
143
+ <span className="inline-flex items-center gap-1.5 font-medium">
144
+ <AlarmClockIcon aria-hidden="true" className="size-3.5 shrink-0" />
145
+ Overdue
146
+ </span>
147
+ <span>{entry.kind} {entry.id}</span>
148
+ <span className="text-xs text-muted-foreground">was due {entry.dueAt}{entry.waitingFor ? ` (${entry.waitingFor})` : ""} and nothing ran</span>
149
+ </li>
150
+ );
151
+ }
152
+
152
153
  function DidNotRunLine({ entry, demo }: { entry: TodayDidNotRun; demo: boolean }) {
153
154
  return (
154
155
  <li className="flex flex-wrap items-center gap-x-3 gap-y-1 rounded-[16px] bg-[var(--feed-card)] p-3 text-sm" data-today-did-not-run={entry.automationId} data-today-why={entry.whyCode}>
@@ -169,6 +170,14 @@ function Ready({ overview, demo }: { overview: TodayOverview; demo: boolean }) {
169
170
  <p className="text-sm text-muted-foreground" data-today-summary role="status">
170
171
  {runsText(overview.totals.runs)} · {costText(overview.totals)}
171
172
  </p>
173
+ {overview.overdue.length ? (
174
+ <>
175
+ <h3 className="text-xs font-medium uppercase tracking-wide text-muted-foreground">Needs attention</h3>
176
+ <ul className="space-y-2" data-today-overdue-list>
177
+ {overview.overdue.map((entry) => <OverdueLine entry={entry} key={`${entry.kind}:${entry.id}`} />)}
178
+ </ul>
179
+ </>
180
+ ) : null}
172
181
  <h3 className="text-xs font-medium uppercase tracking-wide text-muted-foreground">What ran</h3>
173
182
  {overview.rows.length ? (
174
183
  <ul className="space-y-2" data-today-rows>
@@ -63,8 +63,8 @@ export interface SubTaskItemRecord {
63
63
  metadata?: unknown;
64
64
  }
65
65
 
66
- /** The steps whose done needs a short findings note (the four review lenses); mirrors `manual` in src/papyrus_content/newsroom_process.py. */
67
- export const MANUAL_STEP_KEYS: readonly string[] = ["review_people", "review_reader_agents", "review_search", "review_social", "concepts", "related_content"];
66
+ /** The steps whose done needs a short findings note (the four review lenses, and a translation's `human_review`); mirrors `manual` in src/papyrus_content/newsroom_process.py and TRANSLATION_STEPS in src/papyrus_content/story_checklist.py. */
67
+ export const MANUAL_STEP_KEYS: readonly string[] = ["review_people", "human_review", "review_reader_agents", "review_search", "review_social", "concepts", "related_content"];
68
68
 
69
69
  /** What an editor must give for a change, the same rules the backend enforces (src/papyrus_content/story_checklist.py): a reason to skip or mark not applicable, findings to mark a review done. */
70
70
  export function stepChangeProblem(stepKey: string, state: StoryStepState, input: { reason?: string; note?: string }): string | null {
@@ -43,6 +43,12 @@ const announce: TodayRow = {
43
43
  /** A realistic Today for tests and the `?demo=1` newsroom. */
44
44
  export const FIXTURE_TODAY: TodayOverview = {
45
45
  state: "ready", asOf: "2026-11-16T17:00:00.000Z", day: "2026-11-16", timeZone: "America/New_York", start: "2026-11-16T05:00:00.000Z", end: "2026-11-17T05:00:00.000Z",
46
+ overdue: [
47
+ {
48
+ kind: "Delivery", id: "announcement-daily#email#site#g1", dueAt: "2026-11-16T11:00:00Z", waitingFor: "release", flagId: "overdue-0f3a",
49
+ shown: "⏰ Overdue: Delivery announcement-daily#email#site#g1 was due 2026-11-16T11:00:00Z (release) and nothing ran",
50
+ },
51
+ ],
46
52
  rows: [announce, rate, translate],
47
53
  didNotRun: [
48
54
  { automationId: "digest.weekly", title: "Weekly digest", state: "Did not run", whyCode: "disabled", why: "Disabled: the router starts nothing for a disabled automation" },
@@ -62,6 +62,18 @@ export type TodaySend = {
62
62
  cost: string | null;
63
63
  };
64
64
 
65
+ /** A record whose due time passed long enough ago that no wake is in flight and that nothing ran for (src/papyrus_content/overdue.py). */
66
+ export type TodayOverdue = {
67
+ kind: string;
68
+ id: string;
69
+ dueAt: string;
70
+ waitingFor: string | null;
71
+ /** The one flag raised for this record and the time it missed. */
72
+ flagId: string;
73
+ /** The words with their mark, as the command line prints it. */
74
+ shown: string;
75
+ };
76
+
65
77
  export type TodayOverview = {
66
78
  state: "ready";
67
79
  asOf: string;
@@ -69,6 +81,7 @@ export type TodayOverview = {
69
81
  timeZone: string;
70
82
  start: string;
71
83
  end: string;
84
+ overdue: TodayOverdue[];
72
85
  rows: TodayRow[];
73
86
  didNotRun: TodayDidNotRun[];
74
87
  sends: TodaySend[];
package/package.json CHANGED
@@ -195,6 +195,7 @@
195
195
  "./components/references-prefetch": "./components/references-prefetch.ts",
196
196
  "./components/related-section": "./components/related-section.tsx",
197
197
  "./components/research-assignment-card": "./components/research-assignment-card.tsx",
198
+ "./components/run-outcome": "./components/run-outcome.tsx",
198
199
  "./components/schedule-calendar": "./components/schedule-calendar.tsx",
199
200
  "./components/section-concepts-editor": "./components/section-concepts-editor.tsx",
200
201
  "./components/seeded-from-reference-note": "./components/seeded-from-reference-note.tsx",
@@ -650,7 +651,7 @@
650
651
  "optional": true
651
652
  }
652
653
  },
653
- "version": "5.138.0-next.1",
654
+ "version": "5.138.0-next.3",
654
655
  "dependencies": {
655
656
  "@aws-amplify/adapter-nextjs": "^1.7.3",
656
657
  "@aws-crypto/sha256-js": "5.2.0",
@@ -1,5 +1,5 @@
1
1
  {
2
- "version": "5.138.0-next.1",
2
+ "version": "5.138.0-next.3",
3
3
  "routes": [
4
4
  {
5
5
  "file": "app/%5F_preview/[[...path]]/route.ts",