@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,208 @@
1
+ {
2
+ "version": "1.0.0-next.10",
3
+ "routes": [
4
+ {
5
+ "file": "app/%5F_preview/[[...path]]/route.ts",
6
+ "hasDefault": false,
7
+ "exports": [
8
+ "GET"
9
+ ],
10
+ "config": {
11
+ "dynamic": "\"force-dynamic\""
12
+ }
13
+ },
14
+ {
15
+ "file": "app/[year]/[month]/[day]/[articleSlug]/page.tsx",
16
+ "hasDefault": true,
17
+ "exports": [
18
+ "generateMetadata"
19
+ ],
20
+ "config": {
21
+ "revalidate": "3600"
22
+ }
23
+ },
24
+ {
25
+ "file": "app/[year]/[month]/[day]/page.tsx",
26
+ "hasDefault": true,
27
+ "exports": [
28
+ "generateStaticParams"
29
+ ],
30
+ "config": {
31
+ "revalidate": "3600"
32
+ }
33
+ },
34
+ {
35
+ "file": "app/[year]/[month]/[day]/page/[pageNumber]/page.tsx",
36
+ "hasDefault": true,
37
+ "exports": [],
38
+ "config": {
39
+ "revalidate": "3600"
40
+ }
41
+ },
42
+ {
43
+ "file": "app/[year]/[month]/[day]/section/[sectionKey]/page.tsx",
44
+ "hasDefault": true,
45
+ "exports": [],
46
+ "config": {
47
+ "revalidate": "3600"
48
+ }
49
+ },
50
+ {
51
+ "file": "app/api/archive/editions/route.ts",
52
+ "hasDefault": false,
53
+ "exports": [
54
+ "GET"
55
+ ],
56
+ "config": {
57
+ "revalidate": "3600"
58
+ }
59
+ },
60
+ {
61
+ "file": "app/api/media/[...path]/route.ts",
62
+ "hasDefault": false,
63
+ "exports": [
64
+ "GET"
65
+ ],
66
+ "config": {
67
+ "dynamic": "\"force-dynamic\""
68
+ }
69
+ },
70
+ {
71
+ "file": "app/api/revalidate/route.ts",
72
+ "hasDefault": false,
73
+ "exports": [
74
+ "POST"
75
+ ],
76
+ "config": {
77
+ "dynamic": "\"force-dynamic\""
78
+ }
79
+ },
80
+ {
81
+ "file": "app/archive/page.tsx",
82
+ "hasDefault": true,
83
+ "exports": [],
84
+ "config": {
85
+ "revalidate": "3600"
86
+ }
87
+ },
88
+ {
89
+ "file": "app/articles/[slug]/page.tsx",
90
+ "hasDefault": true,
91
+ "exports": [
92
+ "generateMetadata",
93
+ "generateStaticParams"
94
+ ],
95
+ "config": {
96
+ "revalidate": "3600"
97
+ }
98
+ },
99
+ {
100
+ "file": "app/layout.tsx",
101
+ "hasDefault": true,
102
+ "exports": [
103
+ "generateMetadata"
104
+ ],
105
+ "config": {}
106
+ },
107
+ {
108
+ "file": "app/newsroom/[section]/[...selection]/page.tsx",
109
+ "hasDefault": true,
110
+ "exports": [],
111
+ "config": {
112
+ "dynamic": "\"force-dynamic\""
113
+ }
114
+ },
115
+ {
116
+ "file": "app/newsroom/[section]/page.tsx",
117
+ "hasDefault": true,
118
+ "exports": [],
119
+ "config": {
120
+ "dynamic": "\"force-dynamic\""
121
+ }
122
+ },
123
+ {
124
+ "file": "app/newsroom/articles/[id]/page.tsx",
125
+ "hasDefault": true,
126
+ "exports": [],
127
+ "config": {
128
+ "dynamic": "\"force-dynamic\""
129
+ }
130
+ },
131
+ {
132
+ "file": "app/newsroom/articles/page.tsx",
133
+ "hasDefault": true,
134
+ "exports": [],
135
+ "config": {
136
+ "dynamic": "\"force-dynamic\""
137
+ }
138
+ },
139
+ {
140
+ "file": "app/newsroom/forum/[threadId]/page.tsx",
141
+ "hasDefault": true,
142
+ "exports": [],
143
+ "config": {
144
+ "dynamic": "\"force-dynamic\""
145
+ }
146
+ },
147
+ {
148
+ "file": "app/newsroom/insights/[threadId]/page.tsx",
149
+ "hasDefault": true,
150
+ "exports": [],
151
+ "config": {
152
+ "dynamic": "\"force-dynamic\""
153
+ }
154
+ },
155
+ {
156
+ "file": "app/newsroom/insights/page.tsx",
157
+ "hasDefault": true,
158
+ "exports": [],
159
+ "config": {
160
+ "dynamic": "\"force-dynamic\""
161
+ }
162
+ },
163
+ {
164
+ "file": "app/newsroom/layout.tsx",
165
+ "hasDefault": true,
166
+ "exports": [],
167
+ "config": {}
168
+ },
169
+ {
170
+ "file": "app/newsroom/page.tsx",
171
+ "hasDefault": true,
172
+ "exports": [],
173
+ "config": {
174
+ "dynamic": "\"force-dynamic\""
175
+ }
176
+ },
177
+ {
178
+ "file": "app/newsroom/sections/[sectionId]/page.tsx",
179
+ "hasDefault": true,
180
+ "exports": [],
181
+ "config": {
182
+ "dynamic": "\"force-dynamic\""
183
+ }
184
+ },
185
+ {
186
+ "file": "app/page.tsx",
187
+ "hasDefault": true,
188
+ "exports": [],
189
+ "config": {
190
+ "dynamic": "\"force-dynamic\""
191
+ }
192
+ },
193
+ {
194
+ "file": "app/settings/page.tsx",
195
+ "hasDefault": true,
196
+ "exports": [
197
+ "metadata"
198
+ ],
199
+ "config": {
200
+ "dynamic": "\"force-dynamic\""
201
+ }
202
+ }
203
+ ],
204
+ "middleware": {
205
+ "file": "middleware.ts",
206
+ "matcher": "[\"/((?!_next/static|_next/image|favicon.ico|icon).*)\"]"
207
+ }
208
+ }
@@ -0,0 +1,234 @@
1
+ {
2
+ "type": "document",
3
+ "schema_version": 1,
4
+ "front_matter": {
5
+ "title": "Agents work better with less freedom",
6
+ "authors": [
7
+ "Ada Lovelace"
8
+ ],
9
+ "date": "2026-09-06"
10
+ },
11
+ "children": [
12
+ {
13
+ "type": "paragraph",
14
+ "inline": [
15
+ {
16
+ "type": "text",
17
+ "text": "Developers are learning that reliable agents need less freedom, not more."
18
+ }
19
+ ],
20
+ "line": 8
21
+ },
22
+ {
23
+ "type": "paragraph",
24
+ "inline": [
25
+ {
26
+ "type": "text",
27
+ "text": "Across demos and tool launches, builders kept circling the same answer."
28
+ }
29
+ ],
30
+ "line": 10
31
+ },
32
+ {
33
+ "type": "directive",
34
+ "name": "pull-quote",
35
+ "attributes": {
36
+ "id": null,
37
+ "attribution": "Editorial principle",
38
+ "source": null,
39
+ "tone": "default",
40
+ "align": "inline"
41
+ },
42
+ "leaf": false,
43
+ "line": 12,
44
+ "children": [
45
+ {
46
+ "type": "paragraph",
47
+ "inline": [
48
+ {
49
+ "type": "text",
50
+ "text": "The practical breakthrough is not giving agents a bigger sandbox."
51
+ }
52
+ ],
53
+ "line": 13
54
+ }
55
+ ]
56
+ },
57
+ {
58
+ "type": "heading",
59
+ "level": 2,
60
+ "inline": [
61
+ {
62
+ "type": "text",
63
+ "text": "Planning state"
64
+ }
65
+ ],
66
+ "line": 16
67
+ },
68
+ {
69
+ "type": "paragraph",
70
+ "inline": [
71
+ {
72
+ "type": "text",
73
+ "text": "Read-only tools. An inline "
74
+ },
75
+ {
76
+ "type": "code_span",
77
+ "code": "code_span"
78
+ },
79
+ {
80
+ "type": "text",
81
+ "text": " should not be confused with a block."
82
+ }
83
+ ],
84
+ "line": 18
85
+ },
86
+ {
87
+ "type": "code",
88
+ "lang": "python",
89
+ "value": "def plan():\n return \"read only\"\n",
90
+ "line": 20
91
+ },
92
+ {
93
+ "type": "directive",
94
+ "name": "card-grid",
95
+ "attributes": {
96
+ "id": null,
97
+ "label": null,
98
+ "columns": 2
99
+ },
100
+ "leaf": false,
101
+ "line": 25,
102
+ "children": [
103
+ {
104
+ "type": "directive",
105
+ "name": "card",
106
+ "attributes": {
107
+ "id": null,
108
+ "icon": null,
109
+ "title": "Read",
110
+ "span": null
111
+ },
112
+ "leaf": false,
113
+ "line": 26,
114
+ "children": [
115
+ {
116
+ "type": "paragraph",
117
+ "inline": [
118
+ {
119
+ "type": "text",
120
+ "text": "Look before you leap."
121
+ }
122
+ ],
123
+ "line": 27
124
+ }
125
+ ]
126
+ },
127
+ {
128
+ "type": "directive",
129
+ "name": "card",
130
+ "attributes": {
131
+ "id": null,
132
+ "icon": null,
133
+ "title": "Write",
134
+ "span": null
135
+ },
136
+ "leaf": false,
137
+ "line": 29,
138
+ "children": [
139
+ {
140
+ "type": "paragraph",
141
+ "inline": [
142
+ {
143
+ "type": "text",
144
+ "text": "Only after planning."
145
+ }
146
+ ],
147
+ "line": 30
148
+ }
149
+ ]
150
+ }
151
+ ]
152
+ },
153
+ {
154
+ "type": "directive",
155
+ "name": "two-up",
156
+ "attributes": {
157
+ "id": null,
158
+ "ratio": "1:1",
159
+ "align": "start"
160
+ },
161
+ "leaf": false,
162
+ "line": 34,
163
+ "children": [
164
+ {
165
+ "type": "directive",
166
+ "name": "column",
167
+ "attributes": {
168
+ "id": null
169
+ },
170
+ "leaf": false,
171
+ "line": 35,
172
+ "children": [
173
+ {
174
+ "type": "paragraph",
175
+ "inline": [
176
+ {
177
+ "type": "text",
178
+ "text": "Planning state keeps risk low."
179
+ }
180
+ ],
181
+ "line": 36
182
+ }
183
+ ]
184
+ },
185
+ {
186
+ "type": "directive",
187
+ "name": "column",
188
+ "attributes": {
189
+ "id": null
190
+ },
191
+ "leaf": false,
192
+ "line": 38,
193
+ "children": [
194
+ {
195
+ "type": "paragraph",
196
+ "inline": [
197
+ {
198
+ "type": "text",
199
+ "text": "Implementation state is where damage happens."
200
+ }
201
+ ],
202
+ "line": 39
203
+ }
204
+ ]
205
+ }
206
+ ]
207
+ },
208
+ {
209
+ "type": "directive",
210
+ "name": "figure",
211
+ "attributes": {
212
+ "id": null,
213
+ "src": "../assets/state-diagram.svg",
214
+ "alt": "State diagram",
215
+ "credit": null,
216
+ "caption": "Two states, one agent"
217
+ },
218
+ "leaf": false,
219
+ "line": 43,
220
+ "children": []
221
+ },
222
+ {
223
+ "type": "paragraph",
224
+ "inline": [
225
+ {
226
+ "type": "text",
227
+ "text": "The lesson is not that agents are over."
228
+ }
229
+ ],
230
+ "line": 46
231
+ }
232
+ ],
233
+ "_papyrus_source_sha256": "cf899c47590d54b39b60824dc8718131a3ba8a77b073cc66947d70d2f6145757"
234
+ }
@@ -0,0 +1,22 @@
1
+ #!/usr/bin/env node
2
+ import path from "node:path";
3
+ import { fileURLToPath } from "node:url";
4
+ import { bundleVideoEntries, loadBrandVideoSlot, standardEntryPath } from "./bundle-common.mjs";
5
+
6
+ export async function buildBrowserBundle(projectRoot = process.cwd(), env = process.env) {
7
+ const { brandId, bundleEntry } = await loadBrandVideoSlot(projectRoot, env);
8
+ const result = await bundleVideoEntries({
9
+ projectRoot,
10
+ entries: [standardEntryPath, bundleEntry],
11
+ outfile: path.join(projectRoot, "public/videoml/browser-bundle.js"),
12
+ });
13
+ console.error(`VideoML browser bundle for '${brandId}': ${result.outfile} (${result.size} bytes)`);
14
+ return result;
15
+ }
16
+
17
+ if (process.argv[1] && path.resolve(process.argv[1]) === fileURLToPath(import.meta.url)) {
18
+ buildBrowserBundle().catch((error) => {
19
+ console.error(error.message);
20
+ process.exit(1);
21
+ });
22
+ }
@@ -0,0 +1,50 @@
1
+ #!/usr/bin/env node
2
+ import fs from "node:fs";
3
+ import path from "node:path";
4
+ import { fileURLToPath } from "node:url";
5
+ import {
6
+ bundleVideoEntries,
7
+ loadBrandVideoSlot,
8
+ previewEntryPath,
9
+ previewHtmlTemplatePath,
10
+ standardEntryPath,
11
+ } from "./bundle-common.mjs";
12
+
13
+ const REACT_18_VERSION = "18.3.1";
14
+ const VENDOR_FILES = {
15
+ "react.production.min.js": `https://unpkg.com/react@${REACT_18_VERSION}/umd/react.production.min.js`,
16
+ "react-dom.production.min.js": `https://unpkg.com/react-dom@${REACT_18_VERSION}/umd/react-dom.production.min.js`,
17
+ };
18
+
19
+ async function ensureReactVendor(outDirectory) {
20
+ const vendorDirectory = path.join(outDirectory, "vendor");
21
+ fs.mkdirSync(vendorDirectory, { recursive: true });
22
+ for (const [name, url] of Object.entries(VENDOR_FILES)) {
23
+ const target = path.join(vendorDirectory, name);
24
+ if (fs.existsSync(target)) continue;
25
+ const response = await fetch(url);
26
+ if (!response.ok) throw new Error(`Failed to download ${url}: ${response.status} ${response.statusText}`);
27
+ fs.writeFileSync(target, Buffer.from(await response.arrayBuffer()));
28
+ }
29
+ }
30
+
31
+ export async function buildPreviewBundle(projectRoot = process.cwd(), env = process.env) {
32
+ const { brandId, bundleEntry } = await loadBrandVideoSlot(projectRoot, env);
33
+ const outDirectory = path.join(projectRoot, "public/videoml");
34
+ await ensureReactVendor(outDirectory);
35
+ fs.copyFileSync(previewHtmlTemplatePath, path.join(outDirectory, "preview.html"));
36
+ const result = await bundleVideoEntries({
37
+ projectRoot,
38
+ entries: [standardEntryPath, previewEntryPath, bundleEntry],
39
+ outfile: path.join(outDirectory, "preview-bundle.js"),
40
+ });
41
+ console.error(`VideoML preview bundle for '${brandId}': ${result.outfile} (${result.size} bytes)`);
42
+ return result;
43
+ }
44
+
45
+ if (process.argv[1] && path.resolve(process.argv[1]) === fileURLToPath(import.meta.url)) {
46
+ buildPreviewBundle().catch((error) => {
47
+ console.error(error.message);
48
+ process.exit(1);
49
+ });
50
+ }
@@ -0,0 +1,129 @@
1
+ import fs from "node:fs";
2
+ import path from "node:path";
3
+ import { fileURLToPath, pathToFileURL } from "node:url";
4
+ import { createRequire } from "node:module";
5
+
6
+ const scriptsDirectory = path.dirname(fileURLToPath(import.meta.url));
7
+ const require = createRequire(import.meta.url);
8
+
9
+ const OPTIONAL_DYNAMIC_IMPORTS_OF_VIDEOML = ["p5", "lottie-web", "animejs"];
10
+
11
+ const REACT_GLOBALS_JSX_RUNTIME = `
12
+ var React = window.React;
13
+ function jsx(type, config, maybeKey) {
14
+ var props = config || {};
15
+ var key = maybeKey !== undefined ? maybeKey : props.key;
16
+ if (key !== undefined) {
17
+ props = Object.assign({}, props, { key: key });
18
+ }
19
+ return React.createElement(type, props);
20
+ }
21
+ exports.Fragment = React.Fragment;
22
+ exports.jsx = jsx;
23
+ exports.jsxs = jsx;
24
+ `;
25
+
26
+ const reactGlobalsPlugin = {
27
+ name: "react-globals",
28
+ setup(build) {
29
+ const globals = {
30
+ react: "module.exports = window.React",
31
+ "react-dom": "module.exports = window.ReactDOM",
32
+ "react-dom/client": "module.exports = window.ReactDOM",
33
+ "react/jsx-runtime": REACT_GLOBALS_JSX_RUNTIME,
34
+ "react/jsx-dev-runtime": REACT_GLOBALS_JSX_RUNTIME,
35
+ };
36
+ build.onResolve({ filter: /^react(-dom)?(\/.*)?$/ }, (args) =>
37
+ args.path in globals ? { path: args.path, namespace: "react-globals" } : undefined,
38
+ );
39
+ build.onLoad({ filter: /.*/, namespace: "react-globals" }, (args) => ({
40
+ contents: globals[args.path],
41
+ loader: "js",
42
+ }));
43
+ },
44
+ };
45
+
46
+ export function resolveSelectedBrandId(site, env) {
47
+ const requested = (env.PAPYRUS_SITE_BRAND ?? "").trim();
48
+ return requested || site.defaultBrand || "papyrus";
49
+ }
50
+
51
+ /**
52
+ * Loads the publication's `papyrus.config.ts` from the project root and returns the
53
+ * selected brand's `video` slot. Fails with a message naming the missing piece.
54
+ */
55
+ export async function loadBrandVideoSlot(projectRoot, env = process.env) {
56
+ const configPath = path.join(projectRoot, "papyrus.config.ts");
57
+ if (!fs.existsSync(configPath)) {
58
+ throw new Error(`No papyrus.config.ts in ${projectRoot}. Run the VideoML bundle builder from the publication root.`);
59
+ }
60
+ const { tsImport } = await import("tsx/esm/api");
61
+ // Inside a Papyrus checkout, brand components import lib/site-brand, which imports this
62
+ // config: load site-brand first so the cycle resolves in the same order as in the app.
63
+ const checkoutSiteBrand = path.join(projectRoot, "lib/site-brand.ts");
64
+ if (fs.existsSync(checkoutSiteBrand)) await tsImport(pathToFileURL(checkoutSiteBrand).href, import.meta.url);
65
+ const loaded = await tsImport(pathToFileURL(configPath).href, import.meta.url);
66
+ const exported = loaded.default ?? loaded;
67
+ const site = exported.brands === undefined && exported.default ? exported.default : exported;
68
+ const brandId = resolveSelectedBrandId(site, env);
69
+ const brand = (site.brands ?? []).find((candidate) => candidate.id === brandId);
70
+ if (!brand) {
71
+ const registered = (site.brands ?? []).map((candidate) => candidate.id).join(", ") || "none";
72
+ throw new Error(`Brand '${brandId}' is not registered in papyrus.config.ts (registered: ${registered}).`);
73
+ }
74
+ if (!brand.video || typeof brand.video.bundleEntry !== "string" || !brand.video.bundleEntry) {
75
+ throw new Error(
76
+ `Brand '${brandId}' has no brand.video.bundleEntry in papyrus.config.ts. ` +
77
+ "Set brand.video = { bundleEntry: \"<path to a TSX module that registers the brand's VideoML scene components>\" }.",
78
+ );
79
+ }
80
+ const bundleEntry = path.resolve(projectRoot, brand.video.bundleEntry);
81
+ if (!fs.existsSync(bundleEntry)) {
82
+ throw new Error(`brand.video.bundleEntry for '${brandId}' does not exist: ${bundleEntry}`);
83
+ }
84
+ return { brandId, bundleEntry, video: brand.video };
85
+ }
86
+
87
+ function resolveEsbuild(projectRoot) {
88
+ for (const base of [projectRoot, scriptsDirectory]) {
89
+ try {
90
+ return require(require.resolve("esbuild", { paths: [base] }));
91
+ } catch {
92
+ continue;
93
+ }
94
+ }
95
+ throw new Error("esbuild not found. Install it in the publication (npm install --save-dev esbuild).");
96
+ }
97
+
98
+ /**
99
+ * Bundles [standard entry, optional extra entries, brand entry] into one IIFE.
100
+ * React comes from `window.React` / `window.ReactDOM` (the render shell loads React 18 UMD).
101
+ */
102
+ export async function bundleVideoEntries({ projectRoot, entries, outfile }) {
103
+ const esbuild = resolveEsbuild(projectRoot);
104
+ fs.mkdirSync(path.dirname(outfile), { recursive: true });
105
+ const importLines = entries.map((entry) => `import ${JSON.stringify(entry)};`).join("\n");
106
+ await esbuild.build({
107
+ stdin: { contents: importLines, resolveDir: projectRoot, sourcefile: "papyrus-videoml-entry.ts", loader: "ts" },
108
+ bundle: true,
109
+ format: "iife",
110
+ platform: "browser",
111
+ jsx: "automatic",
112
+ outfile,
113
+ absWorkingDir: projectRoot,
114
+ nodePaths: [path.join(projectRoot, "node_modules")],
115
+ external: OPTIONAL_DYNAMIC_IMPORTS_OF_VIDEOML,
116
+ plugins: [reactGlobalsPlugin],
117
+ loader: { ".tsx": "tsx", ".ts": "ts" },
118
+ define: { "process.env.NODE_ENV": '"production"' },
119
+ sourcemap: true,
120
+ logLevel: "warning",
121
+ });
122
+ const size = fs.statSync(outfile).size;
123
+ if (size === 0) throw new Error(`VideoML bundle is empty: ${outfile}`);
124
+ return { outfile, size };
125
+ }
126
+
127
+ export const standardEntryPath = path.join(scriptsDirectory, "standard-entry.tsx");
128
+ export const previewEntryPath = path.join(scriptsDirectory, "preview/preview-entry.tsx");
129
+ export const previewHtmlTemplatePath = path.join(scriptsDirectory, "preview.html");