@anthusai/papyrus 5.136.0-next.5 → 5.136.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.
@@ -112,6 +112,8 @@ export const announcementsSchemaDefinitions = {
112
112
  index("announcementId").sortKeys(["createdAt"]).queryField("listDeliveriesByAnnouncementAndCreatedAt"),
113
113
  index("accountKey").sortKeys(["createdAt"]).queryField("listDeliveriesByAccountKeyAndCreatedAt"),
114
114
  index("dueKey").sortKeys(["dueAt"]).queryField("listDeliveriesByDueKeyAndDueAt"),
115
+ // Sparse: only a Delivery that is an active example carries exampleKey, so the drafter reads a scope's examples newest first and never scans.
116
+ index("exampleKey").sortKeys(["exampleAt"]).queryField("listDeliveriesByExampleKeyAndExampleAt"),
115
117
  ])
116
118
  .disableOperations(["subscriptions"])
117
119
  .authorization((allow) => [allow.groups(editors).to(["read"])]),
@@ -115,6 +115,8 @@ export const announcementsSchemaDefinitions = {
115
115
  index("announcementId").sortKeys(["createdAt"]).queryField("listDeliveriesByAnnouncementAndCreatedAt"),
116
116
  index("accountKey").sortKeys(["createdAt"]).queryField("listDeliveriesByAccountKeyAndCreatedAt"),
117
117
  index("dueKey").sortKeys(["dueAt"]).queryField("listDeliveriesByDueKeyAndDueAt"),
118
+ // Sparse: only a Delivery that is an active example carries exampleKey, so the drafter reads a scope's examples newest first and never scans.
119
+ index("exampleKey").sortKeys(["exampleAt"]).queryField("listDeliveriesByExampleKeyAndExampleAt"),
118
120
  ])
119
121
  .disableOperations(["subscriptions"])
120
122
  .authorization((allow) => [allow.groups(editors).to(["read"])]),
@@ -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)
789
+ published = publish_item(client, record["id"], actor=actor, approved_by=approved_by, by_person=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) -> dict:
884
+ def publish_item_action(arguments: dict, actor: str, approved_by: str | None = None, by_person: 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)
893
+ result = publish_item(client, arguments["id"], actor=actor, approved_by=approved_by, by_person=by_person)
894
894
  response = {
895
895
  "ok": True,
896
896
  "changed": result.changed,
@@ -1168,7 +1168,8 @@ def _handle_field(event):
1168
1168
  if field == "saveItemDraft":
1169
1169
  return save_item_draft_action(arguments, actor, person_from_event(event))
1170
1170
  if field == "publishItem":
1171
- return publish_item_action(arguments, actor, person_from_event(event))
1171
+ person = person_from_event(event)
1172
+ return publish_item_action(arguments, actor, person, person)
1172
1173
  if field == "createStoryFromReference":
1173
1174
  return create_story_from_reference_action(arguments, actor)
1174
1175
  if field == "moveStoryStage":
@@ -882,12 +882,15 @@ export type GuidelinesResolveInput = {
882
882
  section?: string;
883
883
  /** The language of the text the guidelines are for: its overlays (a variant's base language first) are laid over the shared guidelines. Leave it out for the guidelines every language shares. */
884
884
  language?: string;
885
+ /** The channel the text is for (x, linkedin, email): a rule file scoped to channel/<name> is in the answer only for that channel. */
886
+ channel?: string;
885
887
  };
886
888
 
887
889
  export type GuidelinesResolveResult = {
888
890
  kind: string;
889
891
  section?: string;
890
892
  language?: string;
893
+ channel?: string;
891
894
  /** False when the publication has no guidelines of this kind yet. */
892
895
  found: boolean;
893
896
  /** A guideline document of that kind: schemaVersion and the fields the kind allows. */
@@ -1655,17 +1658,19 @@ export type AnnouncementsRecentResult = {
1655
1658
  next: string | null;
1656
1659
  };
1657
1660
 
1658
- /** Why a Story was or was not announced, for each channel, naming the rule. Reads the rules; writes nothing. */
1661
+ /** Why a Story was or was not announced, for each channel, naming the rule; or what a Delivery's draft read. Reads the rules; writes nothing. */
1659
1662
  export type AnnouncementsExplainInput = {
1660
1663
  /** The lineage id of the Story. */
1661
- story: string;
1664
+ story?: string;
1665
+ /** Ask instead about a Delivery: the guideline layers (scope, item, version, hash) and the examples its draft read. */
1666
+ delivery?: string;
1662
1667
  };
1663
1668
 
1664
1669
  export type AnnouncementsExplainResult = {
1665
- story: string;
1670
+ story?: string;
1666
1671
  title?: string;
1667
1672
  stars?: number;
1668
- channels: {
1673
+ channels?: {
1669
1674
  channel: string;
1670
1675
  announced: boolean;
1671
1676
  /** 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. */
@@ -1673,6 +1678,20 @@ export type AnnouncementsExplainResult = {
1673
1678
  words: string;
1674
1679
  delivery?: string;
1675
1680
  }[];
1681
+ /** The Delivery asked about. */
1682
+ delivery?: string;
1683
+ recorded?: boolean;
1684
+ words?: string;
1685
+ storyVersion?: number | null;
1686
+ model?: string | null;
1687
+ /** Each guideline layer the draft read: scope, itemId, versionNumber, contentHash. */
1688
+ guidelineLayers?: Record<string, unknown>[];
1689
+ /** The examples the draft read, and whether each is still on. */
1690
+ examples?: ({
1691
+ delivery: string;
1692
+ state: string;
1693
+ scope?: string | null;
1694
+ })[];
1676
1695
  };
1677
1696
 
1678
1697
  /** 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. */
package/package.json CHANGED
@@ -650,7 +650,7 @@
650
650
  "optional": true
651
651
  }
652
652
  },
653
- "version": "5.136.0-next.5",
653
+ "version": "5.136.0",
654
654
  "dependencies": {
655
655
  "@aws-amplify/adapter-nextjs": "^1.7.3",
656
656
  "@aws-crypto/sha256-js": "5.2.0",
@@ -1,5 +1,5 @@
1
1
  {
2
- "version": "5.136.0-next.5",
2
+ "version": "5.136.0",
3
3
  "routes": [
4
4
  {
5
5
  "file": "app/%5F_preview/[[...path]]/route.ts",