@anthusai/papyrus 0.0.0 → 1.0.0-next.10

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.
Files changed (282) hide show
  1. package/LICENSE +21 -0
  2. package/amplify/auth/resource.js +61 -0
  3. package/amplify/auth/resource.ts +65 -0
  4. package/amplify/data/resource.js +2069 -0
  5. package/amplify/data/resource.ts +2185 -0
  6. package/amplify/data/schema.js +1882 -0
  7. package/amplify/data/schema.ts +1990 -0
  8. package/amplify/functions/assignment-action/handler.ts +1416 -0
  9. package/amplify/functions/assignment-action/resource.js +8 -0
  10. package/amplify/functions/assignment-action/resource.ts +9 -0
  11. package/amplify/functions/category-action/handler.ts +2259 -0
  12. package/amplify/functions/category-action/resource.js +8 -0
  13. package/amplify/functions/category-action/resource.ts +9 -0
  14. package/amplify/functions/console-chat-responder/Cargo.lock +3456 -0
  15. package/amplify/functions/console-chat-responder/Cargo.toml +26 -0
  16. package/amplify/functions/console-chat-responder/Dockerfile +19 -0
  17. package/amplify/functions/console-chat-responder/py/execute_tactus_runner.py +116 -0
  18. package/amplify/functions/console-chat-responder/resource.js +153 -0
  19. package/amplify/functions/console-chat-responder/resource.ts +179 -0
  20. package/amplify/functions/console-chat-responder/src/main.rs +3242 -0
  21. package/amplify/functions/content-actions/handler.py +149 -0
  22. package/amplify/functions/content-actions/requirements.txt +4 -0
  23. package/amplify/functions/content-actions/resource.js +40 -0
  24. package/amplify/functions/content-actions/resource.ts +54 -0
  25. package/amplify/functions/email-submission-processor/handler.py +46 -0
  26. package/amplify/functions/email-submission-processor/requirements.txt +2 -0
  27. package/amplify/functions/email-submission-processor/resource.js +56 -0
  28. package/amplify/functions/email-submission-processor/resource.ts +69 -0
  29. package/amplify/functions/graphql-jwt-authorizer/handler.ts +193 -0
  30. package/amplify/functions/graphql-jwt-authorizer/resource.js +14 -0
  31. package/amplify/functions/graphql-jwt-authorizer/resource.ts +15 -0
  32. package/amplify/functions/knowledge-query/handler.py +1 -0
  33. package/amplify/functions/knowledge-query/requirements.txt +3 -0
  34. package/amplify/functions/knowledge-query/resource.js +50 -0
  35. package/amplify/functions/knowledge-query/resource.ts +61 -0
  36. package/amplify/functions/manage-user-role/handler.ts +799 -0
  37. package/amplify/functions/manage-user-role/resource.js +8 -0
  38. package/amplify/functions/manage-user-role/resource.ts +9 -0
  39. package/amplify/functions/model-attachment-upload/handler.ts +387 -0
  40. package/amplify/functions/model-attachment-upload/resource.js +8 -0
  41. package/amplify/functions/model-attachment-upload/resource.ts +9 -0
  42. package/amplify/functions/newsroom-summary/handler.ts +321 -0
  43. package/amplify/functions/newsroom-summary/resource.js +8 -0
  44. package/amplify/functions/newsroom-summary/resource.ts +9 -0
  45. package/amplify/functions/procedure-action/handler.ts +621 -0
  46. package/amplify/functions/procedure-action/resource.js +8 -0
  47. package/amplify/functions/procedure-action/resource.ts +9 -0
  48. package/amplify/functions/reader-settings/handler.ts +322 -0
  49. package/amplify/functions/reader-settings/resource.js +8 -0
  50. package/amplify/functions/reader-settings/resource.ts +9 -0
  51. package/amplify/functions/ses-inbound-receive/handler.ts +493 -0
  52. package/amplify/functions/ses-inbound-receive/resource.js +8 -0
  53. package/amplify/functions/ses-inbound-receive/resource.ts +9 -0
  54. package/amplify/functions/shared/amplify-secrets.ts +65 -0
  55. package/amplify/functions/shared/console-chat-enqueue.ts +117 -0
  56. package/amplify/functions/shared/email-mime-intake.ts +196 -0
  57. package/amplify/functions/shared/email-submission.ts +415 -0
  58. package/amplify/functions/shared/inbound-email-intake.ts +37 -0
  59. package/amplify/functions/shared/lambda-data-client.ts +21 -0
  60. package/amplify/functions/shared/model-payloads.ts +186 -0
  61. package/amplify/functions/shared/python-bundle.js +130 -0
  62. package/amplify/functions/shared/python-bundle.ts +162 -0
  63. package/amplify/functions/shared/slack-events.ts +111 -0
  64. package/amplify/functions/slack-delivery/handler.py +112 -0
  65. package/amplify/functions/slack-delivery/requirements.txt +2 -0
  66. package/amplify/functions/slack-delivery/resource.js +38 -0
  67. package/amplify/functions/slack-delivery/resource.ts +51 -0
  68. package/amplify/functions/slack-events/handler.ts +155 -0
  69. package/amplify/functions/slack-events/resource.js +11 -0
  70. package/amplify/functions/slack-events/resource.ts +12 -0
  71. package/amplify/inbound-email/stack.js +46 -0
  72. package/amplify/inbound-email/stack.ts +61 -0
  73. package/amplify/package.json +3 -0
  74. package/amplify/rebuild-trigger-settings.js +22 -0
  75. package/amplify/rebuild-trigger-settings.ts +42 -0
  76. package/amplify/site-backend-config.js +1 -0
  77. package/amplify/site-backend-config.ts +36 -0
  78. package/amplify/site-backend.js +615 -0
  79. package/amplify/site-backend.ts +739 -0
  80. package/amplify/storage/resource.js +21 -0
  81. package/amplify/storage/resource.ts +22 -0
  82. package/app/%5F_preview/[[...path]]/route.ts +8 -0
  83. package/app/[year]/[month]/[day]/[articleSlug]/page.tsx +62 -0
  84. package/app/[year]/[month]/[day]/edition-route-page.tsx +53 -0
  85. package/app/[year]/[month]/[day]/page/[pageNumber]/page.tsx +32 -0
  86. package/app/[year]/[month]/[day]/page.tsx +22 -0
  87. package/app/[year]/[month]/[day]/section/[sectionKey]/page.tsx +32 -0
  88. package/app/api/archive/editions/route.ts +18 -0
  89. package/app/api/media/[...path]/route.ts +35 -0
  90. package/app/api/revalidate/route.ts +94 -0
  91. package/app/archive/page.tsx +24 -0
  92. package/app/articles/[slug]/page.tsx +35 -0
  93. package/app/globals.css +10345 -0
  94. package/app/layout.tsx +142 -0
  95. package/app/newsroom/[section]/[...selection]/page.tsx +50 -0
  96. package/app/newsroom/[section]/page.tsx +47 -0
  97. package/app/newsroom/articles/[id]/page.tsx +15 -0
  98. package/app/newsroom/articles/page.tsx +13 -0
  99. package/app/newsroom/forum/[threadId]/page.tsx +35 -0
  100. package/app/newsroom/insights/[threadId]/page.tsx +22 -0
  101. package/app/newsroom/insights/page.tsx +14 -0
  102. package/app/newsroom/layout.tsx +12 -0
  103. package/app/newsroom/page.tsx +31 -0
  104. package/app/newsroom/sections/[sectionId]/page.tsx +17 -0
  105. package/app/page.tsx +272 -0
  106. package/app/papyrus-theme.css +11 -0
  107. package/app/robots.ts +11 -0
  108. package/app/settings/page.tsx +14 -0
  109. package/app/tailwind.css +65 -0
  110. package/bin/papyrus-app.mjs +20 -0
  111. package/bin/papyrus-infra.mjs +95 -0
  112. package/components/ai-elements/conversation.tsx +168 -0
  113. package/components/ai-elements/message.tsx +360 -0
  114. package/components/ai-elements/model-selector.tsx +30 -0
  115. package/components/ai-elements/prompt-input.tsx +1461 -0
  116. package/components/ai-elements/shimmer.tsx +76 -0
  117. package/components/ai-elements/suggestion.tsx +54 -0
  118. package/components/ai-elements/tool.tsx +173 -0
  119. package/components/amplify-client-provider.tsx +140 -0
  120. package/components/archive-grid.tsx +89 -0
  121. package/components/archive-shell.tsx +41 -0
  122. package/components/article-video.tsx +156 -0
  123. package/components/blog-page-background.tsx +20 -0
  124. package/components/dev-sandbox-editor-sign-in.tsx +60 -0
  125. package/components/markus-ir-preview.tsx +300 -0
  126. package/components/news-desk-client-provider.tsx +211 -0
  127. package/components/news-desk-page.tsx +116 -0
  128. package/components/news-desk-taxonomy-client.ts +3684 -0
  129. package/components/newspaper.tsx +1929 -0
  130. package/components/newsroom-access-gate.tsx +66 -0
  131. package/components/newsroom-article-editor.tsx +741 -0
  132. package/components/newsroom-articles-view.tsx +129 -0
  133. package/components/newsroom-assignments-view.tsx +664 -0
  134. package/components/newsroom-ops-overview.tsx +226 -0
  135. package/components/newsroom-ops-shell.tsx +321 -0
  136. package/components/newsroom-references-view.tsx +598 -0
  137. package/components/newsroom-topics-view.tsx +425 -0
  138. package/components/papyrus-console-shell.tsx +1912 -0
  139. package/components/pictogram-figure.tsx +65 -0
  140. package/components/presentation-footer.tsx +146 -0
  141. package/components/reader-auth-control.tsx +162 -0
  142. package/components/reader-auth-state.ts +122 -0
  143. package/components/reader-settings.ts +332 -0
  144. package/components/reader-theme-control.tsx +85 -0
  145. package/components/reference-source-preview.tsx +163 -0
  146. package/components/settings-page.tsx +239 -0
  147. package/components/staging-banner.tsx +11 -0
  148. package/components/topic-steering-workspace.tsx +18005 -0
  149. package/components/ui/badge.tsx +30 -0
  150. package/components/ui/button-group.tsx +87 -0
  151. package/components/ui/button.tsx +58 -0
  152. package/components/ui/card.tsx +32 -0
  153. package/components/ui/command.tsx +194 -0
  154. package/components/ui/dialog.tsx +158 -0
  155. package/components/ui/dropdown-menu.tsx +266 -0
  156. package/components/ui/hover-card.tsx +51 -0
  157. package/components/ui/input-group.tsx +158 -0
  158. package/components/ui/input.tsx +20 -0
  159. package/components/ui/scroll-area.tsx +16 -0
  160. package/components/ui/select.tsx +199 -0
  161. package/components/ui/separator.tsx +23 -0
  162. package/components/ui/sheet.tsx +92 -0
  163. package/components/ui/spinner.tsx +10 -0
  164. package/components/ui/tabs.tsx +113 -0
  165. package/components/ui/textarea.tsx +18 -0
  166. package/components/ui/tooltip.tsx +66 -0
  167. package/components/use-resolved-papyrus-theme.ts +47 -0
  168. package/infra/amplify-app-shell.js +234 -0
  169. package/infra/amplify-app-shell.ts +284 -0
  170. package/infra/build-specs.js +85 -0
  171. package/infra/build-specs.ts +131 -0
  172. package/infra/github-oidc-provider.js +24 -0
  173. package/infra/github-oidc-provider.ts +30 -0
  174. package/infra/index.js +15 -0
  175. package/infra/site-config.js +186 -0
  176. package/infra/site-config.ts +235 -0
  177. package/lib/amplify-outputs-guard.ts +24 -0
  178. package/lib/amplify-outputs-path.ts +16 -0
  179. package/lib/amplify-server-runtime.ts +63 -0
  180. package/lib/archive-data.ts +30 -0
  181. package/lib/archive-types.ts +15 -0
  182. package/lib/articles.ts +320 -0
  183. package/lib/cached-content-repository.ts +90 -0
  184. package/lib/category-dashboard.ts +37 -0
  185. package/lib/category-repository.ts +1907 -0
  186. package/lib/console-chat-client.ts +1316 -0
  187. package/lib/console-web-context.ts +118 -0
  188. package/lib/content-actions-client.ts +98 -0
  189. package/lib/content-actions-demo.ts +190 -0
  190. package/lib/content-load-timing.ts +23 -0
  191. package/lib/content-repository.ts +43 -0
  192. package/lib/content-source-context.ts +26 -0
  193. package/lib/content-types.ts +104 -0
  194. package/lib/define-site.js +3 -0
  195. package/lib/define-site.ts +21 -0
  196. package/lib/demo-amplify-outputs.ts +15 -0
  197. package/lib/dev-sandbox-editor-auth.ts +18 -0
  198. package/lib/doctrine.ts +128 -0
  199. package/lib/edition-routes.ts +155 -0
  200. package/lib/edition-sections.ts +111 -0
  201. package/lib/empty-edition-layout-plan.ts +109 -0
  202. package/lib/empty-theme.css +1 -0
  203. package/lib/excerpts.ts +8 -0
  204. package/lib/graphql-content-repository.ts +1140 -0
  205. package/lib/image-url.ts +10 -0
  206. package/lib/layout-plan.ts +981 -0
  207. package/lib/layout-scenarios.ts +564 -0
  208. package/lib/markus-body.ts +168 -0
  209. package/lib/markus-ir.ts +235 -0
  210. package/lib/markus-projection.ts +243 -0
  211. package/lib/markus-to-article.ts +93 -0
  212. package/lib/news-desk-session.ts +160 -0
  213. package/lib/newspaper-layout.ts +3459 -0
  214. package/lib/newsroom-articles.ts +325 -0
  215. package/lib/newsroom-assignments.ts +173 -0
  216. package/lib/newsroom-base-path.ts +48 -0
  217. package/lib/newsroom-card-layout.ts +102 -0
  218. package/lib/newsroom-category-drilldown.ts +133 -0
  219. package/lib/newsroom-demo-articles.ts +90 -0
  220. package/lib/newsroom-demo-dashboard.ts +267 -0
  221. package/lib/newsroom-demo-profile.ts +46 -0
  222. package/lib/newsroom-forum-routes.ts +153 -0
  223. package/lib/newsroom-index-filters.ts +202 -0
  224. package/lib/newsroom-knowledge-query-request.ts +51 -0
  225. package/lib/newsroom-list-selection.ts +42 -0
  226. package/lib/newsroom-media-backend.ts +142 -0
  227. package/lib/newsroom-media.ts +182 -0
  228. package/lib/newsroom-nav.ts +44 -0
  229. package/lib/newsroom-references.ts +116 -0
  230. package/lib/newsroom-sections.ts +52 -0
  231. package/lib/newsroom-topics.ts +118 -0
  232. package/lib/papyrus-object-kinds.ts +24 -0
  233. package/lib/papyrus-web-locations.ts +480 -0
  234. package/lib/pilobol-sample.ts +167 -0
  235. package/lib/presentation-footer.ts +92 -0
  236. package/lib/pretext-layout.ts +179 -0
  237. package/lib/public-placeholder-config.ts +102 -0
  238. package/lib/publication-items.ts +181 -0
  239. package/lib/reader-route-config.ts +1 -0
  240. package/lib/reader-static-params.ts +56 -0
  241. package/lib/reader-storage-url.ts +63 -0
  242. package/lib/reference-display.ts +74 -0
  243. package/lib/reference-policy.ts +97 -0
  244. package/lib/reference-source-preview.ts +175 -0
  245. package/lib/renderer-config.ts +50 -0
  246. package/lib/renderer.ts +87 -0
  247. package/lib/reporting-story-budget.ts +638 -0
  248. package/lib/semantic-graph.ts +554 -0
  249. package/lib/site-brand-tenant.ts +22 -0
  250. package/lib/site-brand.ts +194 -0
  251. package/lib/site-env.ts +52 -0
  252. package/lib/site-renderer.ts +17 -0
  253. package/lib/site-stack.ts +195 -0
  254. package/lib/staging-gate.ts +37 -0
  255. package/lib/staging-preview-object.ts +98 -0
  256. package/lib/themed-image.ts +30 -0
  257. package/lib/utils.ts +6 -0
  258. package/lib/video-mode.ts +42 -0
  259. package/lib/video-script.ts +63 -0
  260. package/middleware.ts +103 -0
  261. package/package.json +318 -1
  262. package/renderers/markus/index.ts +25 -0
  263. package/renderers/markus/stubs.tsx +33 -0
  264. package/renderers/pretext/article-page.tsx +169 -0
  265. package/renderers/pretext/index.ts +30 -0
  266. package/renderers/pretext/layouts.ts +16 -0
  267. package/renderers/pretext/presentation-shell.tsx +470 -0
  268. package/routes.manifest.json +208 -0
  269. package/scripts/fixtures/pilobol-sample.ast.json +234 -0
  270. package/scripts/videoml/build-browser-bundle.mjs +22 -0
  271. package/scripts/videoml/build-preview-bundle.mjs +50 -0
  272. package/scripts/videoml/bundle-common.mjs +129 -0
  273. package/scripts/videoml/preview/preview-entry.tsx +381 -0
  274. package/scripts/videoml/preview/preview-stage-fit.ts +28 -0
  275. package/scripts/videoml/preview/preview-timing.ts +42 -0
  276. package/scripts/videoml/preview.html +77 -0
  277. package/scripts/videoml/standard-entry.tsx +46 -0
  278. package/src/backend.js +1 -0
  279. package/src/backend.ts +3 -0
  280. package/src/sync.mjs +87 -0
  281. package/src/with-papyrus.d.mts +2 -0
  282. package/src/with-papyrus.mjs +60 -0
@@ -0,0 +1,63 @@
1
+ export type VideoElementAliases = Record<string, string>;
2
+
3
+ /**
4
+ * Rewrites generic VideoML element names in a stored script to the publication's
5
+ * own scene components, e.g. `{ "quote-card": "acme-quote-card" }`.
6
+ */
7
+ export function normalizeDevPreviewDsl(dsl: string, elementAliases: VideoElementAliases = {}): string {
8
+ let normalized = dsl;
9
+ for (const [generic, branded] of Object.entries(elementAliases)) {
10
+ const escaped = generic.replace(/[.*+?^${}()|[\]\\]/g, "\\$&");
11
+ normalized = normalized.replace(new RegExp(`(</?)${escaped}(?=[\\s/>])`, "g"), `$1${branded}`);
12
+ }
13
+ return normalized;
14
+ }
15
+
16
+ export type VideoScriptTargetKind = "article" | "edition";
17
+
18
+ export type VideoScriptRef = {
19
+ slug: string;
20
+ dsl: string;
21
+ targetKind: VideoScriptTargetKind;
22
+ };
23
+
24
+ export function videomlItemSlug(targetSlug: string): string {
25
+ return `${targetSlug}--videoml`;
26
+ }
27
+
28
+ export function parseVideoScriptRef(item: {
29
+ slug: string;
30
+ editorial?: unknown;
31
+ }): VideoScriptRef | null {
32
+ const editorial = parseEditorial(item.editorial);
33
+ const videoScript = editorial?.videoScript;
34
+ if (!videoScript || typeof videoScript !== "object" || Array.isArray(videoScript)) return null;
35
+
36
+ const scriptRecord = videoScript as Record<string, unknown>;
37
+ const dsl = typeof scriptRecord.dsl === "string" ? scriptRecord.dsl.trim() : "";
38
+ if (!dsl) return null;
39
+
40
+ const target = scriptRecord.target;
41
+ const targetKind: VideoScriptTargetKind =
42
+ target && typeof target === "object" && !Array.isArray(target) && (target as Record<string, unknown>).kind === "edition"
43
+ ? "edition"
44
+ : "article";
45
+
46
+ return { slug: item.slug, dsl, targetKind };
47
+ }
48
+
49
+ function parseEditorial(editorial: unknown): Record<string, unknown> | null {
50
+ if (!editorial) return null;
51
+ if (typeof editorial === "string") {
52
+ try {
53
+ const parsed = JSON.parse(editorial) as unknown;
54
+ return parsed && typeof parsed === "object" && !Array.isArray(parsed) ? (parsed as Record<string, unknown>) : null;
55
+ } catch {
56
+ return null;
57
+ }
58
+ }
59
+ if (typeof editorial === "object" && !Array.isArray(editorial)) {
60
+ return editorial as Record<string, unknown>;
61
+ }
62
+ return null;
63
+ }
package/middleware.ts ADDED
@@ -0,0 +1,103 @@
1
+ import type { NextRequest } from "next/server";
2
+ import { NextResponse } from "next/server";
3
+ import { getSiteBrand } from "./lib/site-brand";
4
+ import { getSiteEnv, isIndexable } from "./lib/site-env";
5
+ import { getStagingAccess } from "./lib/staging-gate";
6
+ import {
7
+ isPreviewGatedPath,
8
+ isStaticPreviewEnabled,
9
+ previewRewritePathname,
10
+ shouldRewriteToPreview,
11
+ } from "./lib/staging-preview-object";
12
+
13
+ function usesNewsroomRootPaths(): boolean {
14
+ const brand = getSiteBrand();
15
+ return brand.rootRoute?.kind === "newsroom" && brand.newsroomBasePath === "";
16
+ }
17
+
18
+ function isStaticOrApiPath(pathname: string): boolean {
19
+ return (
20
+ pathname.startsWith("/_next")
21
+ || pathname.startsWith("/api")
22
+ || pathname === "/favicon.ico"
23
+ || pathname.startsWith("/icon")
24
+ || /\.[a-zA-Z0-9]+$/.test(pathname)
25
+ );
26
+ }
27
+
28
+ function isStagingGatedPath(pathname: string): boolean {
29
+ if (isStaticOrApiPath(pathname)) return false;
30
+ if (pathname === "/robots.txt") return false;
31
+ if (pathname === "/newsroom" || pathname.startsWith("/newsroom/")) return false;
32
+ return true;
33
+ }
34
+
35
+ function routeRequest(request: NextRequest): NextResponse {
36
+ if (isStaticPreviewEnabled() && shouldRewriteToPreview(request.nextUrl.pathname)) {
37
+ const rewriteUrl = request.nextUrl.clone();
38
+ rewriteUrl.pathname = previewRewritePathname(request.nextUrl.pathname);
39
+ return NextResponse.rewrite(rewriteUrl);
40
+ }
41
+ if (!usesNewsroomRootPaths()) {
42
+ return NextResponse.next();
43
+ }
44
+
45
+ const { pathname } = request.nextUrl;
46
+ if (isStaticOrApiPath(pathname)) {
47
+ return NextResponse.next();
48
+ }
49
+
50
+ if (pathname === "/newsroom" || pathname === "/newsroom/") {
51
+ return NextResponse.redirect(new URL("/", request.url));
52
+ }
53
+ if (pathname.startsWith("/newsroom/")) {
54
+ const target = pathname.slice("/newsroom".length) || "/";
55
+ return NextResponse.redirect(new URL(`${target}${request.nextUrl.search}`, request.url));
56
+ }
57
+
58
+ if (pathname === "/" || pathname === "") {
59
+ return NextResponse.next();
60
+ }
61
+
62
+ if (!pathname.startsWith("/newsroom")) {
63
+ const rewriteUrl = request.nextUrl.clone();
64
+ rewriteUrl.pathname = `/newsroom${pathname}`;
65
+ return NextResponse.rewrite(rewriteUrl);
66
+ }
67
+
68
+ return NextResponse.next();
69
+ }
70
+
71
+ export async function middleware(request: NextRequest): Promise<NextResponse> {
72
+ let sessionResponse: NextResponse | null = null;
73
+ const { pathname } = request.nextUrl;
74
+ const gated = isStaticPreviewEnabled() ? isPreviewGatedPath(pathname) : isStagingGatedPath(pathname);
75
+ if (getSiteEnv() === "staging" && gated) {
76
+ sessionResponse = NextResponse.next();
77
+ const access = await getStagingAccess(request, sessionResponse);
78
+ if (access === "anonymous") {
79
+ return withRobotsHeader(NextResponse.redirect(new URL("/newsroom", request.url)));
80
+ }
81
+ if (access === "forbidden") {
82
+ return withRobotsHeader(new NextResponse("Staging is limited to editors and admins.", { status: 403 }));
83
+ }
84
+ }
85
+
86
+ const response = routeRequest(request);
87
+ if (sessionResponse) {
88
+ for (const cookie of sessionResponse.headers.getSetCookie()) {
89
+ response.headers.append("set-cookie", cookie);
90
+ }
91
+ }
92
+ return withRobotsHeader(response);
93
+ }
94
+
95
+ function withRobotsHeader(response: NextResponse): NextResponse {
96
+ if (!isIndexable()) response.headers.set("X-Robots-Tag", "noindex, nofollow");
97
+ return response;
98
+ }
99
+
100
+ export const config = {
101
+ runtime: "nodejs",
102
+ matcher: ["/((?!_next/static|_next/image|favicon.ico|icon).*)"],
103
+ };
package/package.json CHANGED
@@ -1 +1,318 @@
1
- {"name":"@anthusai/papyrus","version":"0.0.0","description":"Placeholder; releases are published by GitHub Actions.","license":"MIT","repository":{"type":"git","url":"git+https://github.com/AnthusAI/Papyrus.git"}}
1
+ {
2
+ "name": "@anthusai/papyrus",
3
+ "description": "Papyrus newsroom app, Pretext renderer, theme packs, Amplify Gen 2 backend definition and app-shell CDK constructs (spike build).",
4
+ "license": "MIT",
5
+ "repository": {
6
+ "type": "git",
7
+ "url": "git+https://github.com/AnthusAI/Papyrus.git"
8
+ },
9
+ "homepage": "https://github.com/AnthusAI/Papyrus#readme",
10
+ "keywords": [
11
+ "newsroom",
12
+ "publishing",
13
+ "nextjs",
14
+ "pretext",
15
+ "amplify"
16
+ ],
17
+ "type": "module",
18
+ "bin": {
19
+ "papyrus-app": "./bin/papyrus-app.mjs",
20
+ "papyrus-infra": "./bin/papyrus-infra.mjs"
21
+ },
22
+ "exports": {
23
+ ".": "./src/with-papyrus.mjs",
24
+ "./next": {
25
+ "types": "./src/with-papyrus.d.mts",
26
+ "default": "./src/with-papyrus.mjs"
27
+ },
28
+ "./backend": {
29
+ "types": "./src/backend.ts",
30
+ "default": "./src/backend.js"
31
+ },
32
+ "./define-site": {
33
+ "types": "./lib/define-site.ts",
34
+ "default": "./lib/define-site.js"
35
+ },
36
+ "./app/*": [
37
+ "./app/*.tsx",
38
+ "./app/*.ts",
39
+ "./app/*"
40
+ ],
41
+ "./components/*": [
42
+ "./components/*.tsx",
43
+ "./components/*.ts",
44
+ "./components/*"
45
+ ],
46
+ "./lib/*": [
47
+ "./lib/*.tsx",
48
+ "./lib/*.ts",
49
+ "./lib/*"
50
+ ],
51
+ "./renderers/*": [
52
+ "./renderers/*.tsx",
53
+ "./renderers/*.ts",
54
+ "./renderers/*"
55
+ ],
56
+ "./amplify/*": [
57
+ "./amplify/*.ts",
58
+ "./amplify/*"
59
+ ],
60
+ "./routes.manifest.json": "./routes.manifest.json",
61
+ "./package.json": "./package.json",
62
+ "./middleware": "./middleware.ts",
63
+ "./infra": {
64
+ "types": "./infra/amplify-app-shell.ts",
65
+ "default": "./infra/index.js"
66
+ },
67
+ "./components/ai-elements/conversation": "./components/ai-elements/conversation.tsx",
68
+ "./components/ai-elements/message": "./components/ai-elements/message.tsx",
69
+ "./components/ai-elements/model-selector": "./components/ai-elements/model-selector.tsx",
70
+ "./components/ai-elements/prompt-input": "./components/ai-elements/prompt-input.tsx",
71
+ "./components/ai-elements/shimmer": "./components/ai-elements/shimmer.tsx",
72
+ "./components/ai-elements/suggestion": "./components/ai-elements/suggestion.tsx",
73
+ "./components/ai-elements/tool": "./components/ai-elements/tool.tsx",
74
+ "./components/amplify-client-provider": "./components/amplify-client-provider.tsx",
75
+ "./components/archive-grid": "./components/archive-grid.tsx",
76
+ "./components/archive-shell": "./components/archive-shell.tsx",
77
+ "./components/article-video": "./components/article-video.tsx",
78
+ "./components/blog-page-background": "./components/blog-page-background.tsx",
79
+ "./components/dev-sandbox-editor-sign-in": "./components/dev-sandbox-editor-sign-in.tsx",
80
+ "./components/markus-ir-preview": "./components/markus-ir-preview.tsx",
81
+ "./components/news-desk-client-provider": "./components/news-desk-client-provider.tsx",
82
+ "./components/news-desk-page": "./components/news-desk-page.tsx",
83
+ "./components/news-desk-taxonomy-client": "./components/news-desk-taxonomy-client.ts",
84
+ "./components/newspaper": "./components/newspaper.tsx",
85
+ "./components/newsroom-access-gate": "./components/newsroom-access-gate.tsx",
86
+ "./components/newsroom-article-editor": "./components/newsroom-article-editor.tsx",
87
+ "./components/newsroom-articles-view": "./components/newsroom-articles-view.tsx",
88
+ "./components/newsroom-assignments-view": "./components/newsroom-assignments-view.tsx",
89
+ "./components/newsroom-ops-overview": "./components/newsroom-ops-overview.tsx",
90
+ "./components/newsroom-ops-shell": "./components/newsroom-ops-shell.tsx",
91
+ "./components/newsroom-references-view": "./components/newsroom-references-view.tsx",
92
+ "./components/newsroom-topics-view": "./components/newsroom-topics-view.tsx",
93
+ "./components/papyrus-console-shell": "./components/papyrus-console-shell.tsx",
94
+ "./components/pictogram-figure": "./components/pictogram-figure.tsx",
95
+ "./components/presentation-footer": "./components/presentation-footer.tsx",
96
+ "./components/reader-auth-control": "./components/reader-auth-control.tsx",
97
+ "./components/reader-auth-state": "./components/reader-auth-state.ts",
98
+ "./components/reader-settings": "./components/reader-settings.ts",
99
+ "./components/reader-theme-control": "./components/reader-theme-control.tsx",
100
+ "./components/reference-source-preview": "./components/reference-source-preview.tsx",
101
+ "./components/settings-page": "./components/settings-page.tsx",
102
+ "./components/staging-banner": "./components/staging-banner.tsx",
103
+ "./components/topic-steering-workspace": "./components/topic-steering-workspace.tsx",
104
+ "./components/ui/badge": "./components/ui/badge.tsx",
105
+ "./components/ui/button-group": "./components/ui/button-group.tsx",
106
+ "./components/ui/button": "./components/ui/button.tsx",
107
+ "./components/ui/card": "./components/ui/card.tsx",
108
+ "./components/ui/command": "./components/ui/command.tsx",
109
+ "./components/ui/dialog": "./components/ui/dialog.tsx",
110
+ "./components/ui/dropdown-menu": "./components/ui/dropdown-menu.tsx",
111
+ "./components/ui/hover-card": "./components/ui/hover-card.tsx",
112
+ "./components/ui/input-group": "./components/ui/input-group.tsx",
113
+ "./components/ui/input": "./components/ui/input.tsx",
114
+ "./components/ui/scroll-area": "./components/ui/scroll-area.tsx",
115
+ "./components/ui/select": "./components/ui/select.tsx",
116
+ "./components/ui/separator": "./components/ui/separator.tsx",
117
+ "./components/ui/sheet": "./components/ui/sheet.tsx",
118
+ "./components/ui/spinner": "./components/ui/spinner.tsx",
119
+ "./components/ui/tabs": "./components/ui/tabs.tsx",
120
+ "./components/ui/textarea": "./components/ui/textarea.tsx",
121
+ "./components/ui/tooltip": "./components/ui/tooltip.tsx",
122
+ "./components/use-resolved-papyrus-theme": "./components/use-resolved-papyrus-theme.ts",
123
+ "./lib/amplify-outputs-guard": "./lib/amplify-outputs-guard.ts",
124
+ "./lib/amplify-outputs-path": "./lib/amplify-outputs-path.ts",
125
+ "./lib/amplify-server-runtime": "./lib/amplify-server-runtime.ts",
126
+ "./lib/archive-data": "./lib/archive-data.ts",
127
+ "./lib/archive-types": "./lib/archive-types.ts",
128
+ "./lib/articles": "./lib/articles.ts",
129
+ "./lib/cached-content-repository": "./lib/cached-content-repository.ts",
130
+ "./lib/category-dashboard": "./lib/category-dashboard.ts",
131
+ "./lib/category-repository": "./lib/category-repository.ts",
132
+ "./lib/console-chat-client": "./lib/console-chat-client.ts",
133
+ "./lib/console-web-context": "./lib/console-web-context.ts",
134
+ "./lib/content-actions-client": "./lib/content-actions-client.ts",
135
+ "./lib/content-actions-demo": "./lib/content-actions-demo.ts",
136
+ "./lib/content-load-timing": "./lib/content-load-timing.ts",
137
+ "./lib/content-repository": "./lib/content-repository.ts",
138
+ "./lib/content-source-context": "./lib/content-source-context.ts",
139
+ "./lib/content-types": "./lib/content-types.ts",
140
+ "./lib/define-site": "./lib/define-site.ts",
141
+ "./lib/demo-amplify-outputs": "./lib/demo-amplify-outputs.ts",
142
+ "./lib/dev-sandbox-editor-auth": "./lib/dev-sandbox-editor-auth.ts",
143
+ "./lib/doctrine": "./lib/doctrine.ts",
144
+ "./lib/edition-routes": "./lib/edition-routes.ts",
145
+ "./lib/edition-sections": "./lib/edition-sections.ts",
146
+ "./lib/empty-edition-layout-plan": "./lib/empty-edition-layout-plan.ts",
147
+ "./lib/excerpts": "./lib/excerpts.ts",
148
+ "./lib/graphql-content-repository": "./lib/graphql-content-repository.ts",
149
+ "./lib/image-url": "./lib/image-url.ts",
150
+ "./lib/layout-plan": "./lib/layout-plan.ts",
151
+ "./lib/layout-scenarios": "./lib/layout-scenarios.ts",
152
+ "./lib/markus-body": "./lib/markus-body.ts",
153
+ "./lib/markus-ir": "./lib/markus-ir.ts",
154
+ "./lib/markus-projection": "./lib/markus-projection.ts",
155
+ "./lib/markus-to-article": "./lib/markus-to-article.ts",
156
+ "./lib/news-desk-session": "./lib/news-desk-session.ts",
157
+ "./lib/newspaper-layout": "./lib/newspaper-layout.ts",
158
+ "./lib/newsroom-articles": "./lib/newsroom-articles.ts",
159
+ "./lib/newsroom-assignments": "./lib/newsroom-assignments.ts",
160
+ "./lib/newsroom-base-path": "./lib/newsroom-base-path.ts",
161
+ "./lib/newsroom-card-layout": "./lib/newsroom-card-layout.ts",
162
+ "./lib/newsroom-category-drilldown": "./lib/newsroom-category-drilldown.ts",
163
+ "./lib/newsroom-demo-articles": "./lib/newsroom-demo-articles.ts",
164
+ "./lib/newsroom-demo-dashboard": "./lib/newsroom-demo-dashboard.ts",
165
+ "./lib/newsroom-demo-profile": "./lib/newsroom-demo-profile.ts",
166
+ "./lib/newsroom-forum-routes": "./lib/newsroom-forum-routes.ts",
167
+ "./lib/newsroom-index-filters": "./lib/newsroom-index-filters.ts",
168
+ "./lib/newsroom-knowledge-query-request": "./lib/newsroom-knowledge-query-request.ts",
169
+ "./lib/newsroom-list-selection": "./lib/newsroom-list-selection.ts",
170
+ "./lib/newsroom-media-backend": "./lib/newsroom-media-backend.ts",
171
+ "./lib/newsroom-media": "./lib/newsroom-media.ts",
172
+ "./lib/newsroom-nav": "./lib/newsroom-nav.ts",
173
+ "./lib/newsroom-references": "./lib/newsroom-references.ts",
174
+ "./lib/newsroom-sections": "./lib/newsroom-sections.ts",
175
+ "./lib/newsroom-topics": "./lib/newsroom-topics.ts",
176
+ "./lib/papyrus-object-kinds": "./lib/papyrus-object-kinds.ts",
177
+ "./lib/papyrus-web-locations": "./lib/papyrus-web-locations.ts",
178
+ "./lib/pilobol-sample": "./lib/pilobol-sample.ts",
179
+ "./lib/presentation-footer": "./lib/presentation-footer.ts",
180
+ "./lib/pretext-layout": "./lib/pretext-layout.ts",
181
+ "./lib/public-placeholder-config": "./lib/public-placeholder-config.ts",
182
+ "./lib/publication-items": "./lib/publication-items.ts",
183
+ "./lib/reader-route-config": "./lib/reader-route-config.ts",
184
+ "./lib/reader-static-params": "./lib/reader-static-params.ts",
185
+ "./lib/reader-storage-url": "./lib/reader-storage-url.ts",
186
+ "./lib/reference-display": "./lib/reference-display.ts",
187
+ "./lib/reference-policy": "./lib/reference-policy.ts",
188
+ "./lib/reference-source-preview": "./lib/reference-source-preview.ts",
189
+ "./lib/renderer-config": "./lib/renderer-config.ts",
190
+ "./lib/renderer": "./lib/renderer.ts",
191
+ "./lib/reporting-story-budget": "./lib/reporting-story-budget.ts",
192
+ "./lib/semantic-graph": "./lib/semantic-graph.ts",
193
+ "./lib/site-brand-tenant": "./lib/site-brand-tenant.ts",
194
+ "./lib/site-brand": "./lib/site-brand.ts",
195
+ "./lib/site-env": "./lib/site-env.ts",
196
+ "./lib/site-renderer": "./lib/site-renderer.ts",
197
+ "./lib/site-stack": "./lib/site-stack.ts",
198
+ "./lib/staging-gate": "./lib/staging-gate.ts",
199
+ "./lib/staging-preview-object": "./lib/staging-preview-object.ts",
200
+ "./lib/themed-image": "./lib/themed-image.ts",
201
+ "./lib/utils": "./lib/utils.ts",
202
+ "./lib/video-mode": "./lib/video-mode.ts",
203
+ "./lib/video-script": "./lib/video-script.ts",
204
+ "./renderers/markus/index": "./renderers/markus/index.ts",
205
+ "./renderers/markus/stubs": "./renderers/markus/stubs.tsx",
206
+ "./renderers/pretext/article-page": "./renderers/pretext/article-page.tsx",
207
+ "./renderers/pretext/index": "./renderers/pretext/index.ts",
208
+ "./renderers/pretext/layouts": "./renderers/pretext/layouts.ts",
209
+ "./renderers/pretext/presentation-shell": "./renderers/pretext/presentation-shell.tsx",
210
+ "./app/%5F_preview/[[...path]]/route": "./app/%5F_preview/[[...path]]/route.ts",
211
+ "./app/[year]/[month]/[day]/[articleSlug]/page": "./app/[year]/[month]/[day]/[articleSlug]/page.tsx",
212
+ "./app/[year]/[month]/[day]/page": "./app/[year]/[month]/[day]/page.tsx",
213
+ "./app/[year]/[month]/[day]/page/[pageNumber]/page": "./app/[year]/[month]/[day]/page/[pageNumber]/page.tsx",
214
+ "./app/[year]/[month]/[day]/section/[sectionKey]/page": "./app/[year]/[month]/[day]/section/[sectionKey]/page.tsx",
215
+ "./app/api/archive/editions/route": "./app/api/archive/editions/route.ts",
216
+ "./app/api/media/[...path]/route": "./app/api/media/[...path]/route.ts",
217
+ "./app/api/revalidate/route": "./app/api/revalidate/route.ts",
218
+ "./app/archive/page": "./app/archive/page.tsx",
219
+ "./app/articles/[slug]/page": "./app/articles/[slug]/page.tsx",
220
+ "./app/layout": "./app/layout.tsx",
221
+ "./app/newsroom/[section]/[...selection]/page": "./app/newsroom/[section]/[...selection]/page.tsx",
222
+ "./app/newsroom/[section]/page": "./app/newsroom/[section]/page.tsx",
223
+ "./app/newsroom/articles/[id]/page": "./app/newsroom/articles/[id]/page.tsx",
224
+ "./app/newsroom/articles/page": "./app/newsroom/articles/page.tsx",
225
+ "./app/newsroom/forum/[threadId]/page": "./app/newsroom/forum/[threadId]/page.tsx",
226
+ "./app/newsroom/insights/[threadId]/page": "./app/newsroom/insights/[threadId]/page.tsx",
227
+ "./app/newsroom/insights/page": "./app/newsroom/insights/page.tsx",
228
+ "./app/newsroom/layout": "./app/newsroom/layout.tsx",
229
+ "./app/newsroom/page": "./app/newsroom/page.tsx",
230
+ "./app/newsroom/sections/[sectionId]/page": "./app/newsroom/sections/[sectionId]/page.tsx",
231
+ "./app/page": "./app/page.tsx",
232
+ "./app/settings/page": "./app/settings/page.tsx"
233
+ },
234
+ "files": [
235
+ "app",
236
+ "components",
237
+ "lib",
238
+ "renderers",
239
+ "amplify",
240
+ "publications",
241
+ "scripts",
242
+ "middleware.ts",
243
+ "bin",
244
+ "src",
245
+ "routes.manifest.json",
246
+ "LICENSE",
247
+ "infra"
248
+ ],
249
+ "peerDependencies": {
250
+ "next": "^15.5.18",
251
+ "react": "^19.2.6",
252
+ "react-dom": "^19.2.6",
253
+ "aws-cdk-lib": "^2.257.0",
254
+ "constructs": "^10.4.2",
255
+ "@aws-amplify/backend": "^1.22.0",
256
+ "@aws-amplify/backend-cli": "^1.8.2",
257
+ "@aws-amplify/seed": "^1.1.2"
258
+ },
259
+ "publishConfig": {
260
+ "access": "public"
261
+ },
262
+ "peerDependenciesMeta": {
263
+ "aws-cdk-lib": {
264
+ "optional": true
265
+ },
266
+ "constructs": {
267
+ "optional": true
268
+ },
269
+ "@aws-amplify/backend": {
270
+ "optional": true
271
+ },
272
+ "@aws-amplify/backend-cli": {
273
+ "optional": true
274
+ },
275
+ "@aws-amplify/seed": {
276
+ "optional": true
277
+ }
278
+ },
279
+ "version": "1.0.0-next.10",
280
+ "dependencies": {
281
+ "@aws-amplify/adapter-nextjs": "^1.7.3",
282
+ "@aws-sdk/client-cognito-identity-provider": "3.1045.0",
283
+ "@aws-sdk/client-lambda": "^3.1045.0",
284
+ "@aws-sdk/client-s3": "^3.1045.0",
285
+ "@aws-sdk/client-ssm": "^3.1045.0",
286
+ "@aws-sdk/s3-request-presigner": "^3.1045.0",
287
+ "@base-ui/react": "^1.5.0",
288
+ "@chenglou/pretext": "^0.0.7",
289
+ "@radix-ui/colors": "3.0.0",
290
+ "@streamdown/cjk": "^1.0.3",
291
+ "@streamdown/code": "^1.1.1",
292
+ "@streamdown/math": "^1.0.2",
293
+ "@streamdown/mermaid": "^1.0.2",
294
+ "@tailwindcss/postcss": "^4.3.0",
295
+ "ai": "^6.0.191",
296
+ "anthus-vultus": "github:AnthusAI/Vultus#af98d57",
297
+ "aws-amplify": "^6.17.0",
298
+ "class-variance-authority": "^0.7.1",
299
+ "clsx": "^2.1.1",
300
+ "cmdk": "^1.1.1",
301
+ "esbuild": "^0.28.2",
302
+ "gray-matter": "^4.0.3",
303
+ "gsap": "^3.15.0",
304
+ "katex": "^0.17.0",
305
+ "lucide-react": "^1.16.0",
306
+ "motion": "^12.40.0",
307
+ "nanoid": "^5.1.11",
308
+ "shadcn": "^4.8.0",
309
+ "streamdown": "^2.5.0",
310
+ "tailwind-merge": "^3.6.0",
311
+ "tailwindcss": "^4.3.0",
312
+ "tsx": "^4.23.15",
313
+ "tw-animate-css": "^1.4.0",
314
+ "use-stick-to-bottom": "^1.1.4",
315
+ "yaml": "^2.9.0",
316
+ "zod": "^3.25.76"
317
+ }
318
+ }
@@ -0,0 +1,25 @@
1
+ import type { EditionPresentationFormat } from "../../lib/content-types";
2
+ import type { Renderer } from "../../lib/renderer";
3
+ import { MarkusArticleStub, MarkusEditionStub, MarkusItemStub } from "./stubs";
4
+
5
+ /** CSS paths relative to the static site root (`web/dist/`). */
6
+ export const MARKUS_STYLESHEETS = ["css/markus-vendor.css", "css/site-theme.css"] as const;
7
+
8
+ export function markusSupportsLayout(_layout: EditionPresentationFormat): boolean {
9
+ return false;
10
+ }
11
+
12
+ /**
13
+ * Markus renderer: Python build emits static HTML under `web/dist/`.
14
+ * Preview with `python -m http.server` on that folder — no Next.js shell.
15
+ */
16
+ export const markusRenderer: Renderer = {
17
+ id: "markus",
18
+ renderEdition: MarkusEditionStub,
19
+ renderArticle: MarkusArticleStub,
20
+ renderItem: MarkusItemStub,
21
+ stylesheets: () => [...MARKUS_STYLESHEETS],
22
+ supportsLayout: markusSupportsLayout,
23
+ };
24
+
25
+ export { MarkusArticleStub, MarkusEditionStub, MarkusItemStub } from "./stubs";
@@ -0,0 +1,33 @@
1
+ "use client";
2
+
3
+ import type { RenderArticleProps, RenderEditionProps, RenderItemProps } from "../../lib/renderer";
4
+
5
+ /**
6
+ * Markus renders exclusively via the Python static build
7
+ * (`poetry run papyrus renderers markus-build` → `web/dist/`).
8
+ * These components satisfy the Renderer interface but are not wired into
9
+ * `app/*` routes and must not become a second render path.
10
+ */
11
+ function StaticRendererNotice({ label }: { label: string }) {
12
+ return (
13
+ <main className="markus-static-notice">
14
+ <p>
15
+ <strong>{label}</strong> uses the Markus static build output only. Run{" "}
16
+ <code>poetry run papyrus renderers markus-build</code>, then preview{" "}
17
+ <code>web/dist/</code> with a plain static file server — not Next.js.
18
+ </p>
19
+ </main>
20
+ );
21
+ }
22
+
23
+ export function MarkusEditionStub(_props: RenderEditionProps) {
24
+ return <StaticRendererNotice label="Edition view" />;
25
+ }
26
+
27
+ export function MarkusArticleStub(_props: RenderArticleProps) {
28
+ return <StaticRendererNotice label="Article view" />;
29
+ }
30
+
31
+ export function MarkusItemStub(_props: RenderItemProps) {
32
+ return <StaticRendererNotice label="Item view" />;
33
+ }