studiograph 1.3.48-next.26 → 1.3.48-next.261

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 (1640) hide show
  1. package/README.md +27 -17
  2. package/dist/agent/agent-pool.d.ts +120 -4
  3. package/dist/agent/agent-pool.js +358 -18
  4. package/dist/agent/agent-pool.js.map +1 -1
  5. package/dist/agent/context-window.d.ts +113 -0
  6. package/dist/agent/context-window.js +459 -0
  7. package/dist/agent/context-window.js.map +1 -0
  8. package/dist/agent/followups.d.ts +34 -0
  9. package/dist/agent/followups.js +52 -0
  10. package/dist/agent/followups.js.map +1 -0
  11. package/dist/agent/orchestrator.d.ts +110 -11
  12. package/dist/agent/orchestrator.js +547 -75
  13. package/dist/agent/orchestrator.js.map +1 -1
  14. package/dist/agent/prompts/entity-types-section.d.ts +18 -9
  15. package/dist/agent/prompts/entity-types-section.js +42 -18
  16. package/dist/agent/prompts/entity-types-section.js.map +1 -1
  17. package/dist/agent/prompts/system.md +107 -19
  18. package/dist/agent/skill-loader.js +3 -9
  19. package/dist/agent/skill-loader.js.map +1 -1
  20. package/dist/agent/skills/artifact-canvas/skill.md +257 -0
  21. package/dist/agent/skills/create-skill.md +39 -0
  22. package/dist/agent/skills/entity-schema.md +67 -150
  23. package/dist/agent/skills/interview/skill.md +44 -29
  24. package/dist/agent/skills/paged-documents/skill.md +147 -0
  25. package/dist/agent/skills/schema-rules.md +28 -28
  26. package/dist/agent/tools/artifact-tools.d.ts +237 -0
  27. package/dist/agent/tools/artifact-tools.js +407 -0
  28. package/dist/agent/tools/artifact-tools.js.map +1 -0
  29. package/dist/agent/tools/capture-tools.d.ts +31 -0
  30. package/dist/agent/tools/capture-tools.js +40 -0
  31. package/dist/agent/tools/capture-tools.js.map +1 -0
  32. package/dist/agent/tools/folder-tools.d.ts +50 -0
  33. package/dist/agent/tools/folder-tools.js +340 -0
  34. package/dist/agent/tools/folder-tools.js.map +1 -0
  35. package/dist/agent/tools/fs-tools.d.ts +6 -5
  36. package/dist/agent/tools/fs-tools.js +1 -1
  37. package/dist/agent/tools/fs-tools.js.map +1 -1
  38. package/dist/agent/tools/graph-tools.d.ts +45 -73
  39. package/dist/agent/tools/graph-tools.js +765 -239
  40. package/dist/agent/tools/graph-tools.js.map +1 -1
  41. package/dist/agent/tools/history-tools.d.ts +95 -0
  42. package/dist/agent/tools/history-tools.js +465 -0
  43. package/dist/agent/tools/history-tools.js.map +1 -0
  44. package/dist/agent/tools/load-skill.d.ts +4 -3
  45. package/dist/agent/tools/load-skill.js +1 -1
  46. package/dist/agent/tools/load-skill.js.map +1 -1
  47. package/dist/agent/tools/ops-tools.d.ts +2 -1
  48. package/dist/agent/tools/ops-tools.js +125 -25
  49. package/dist/agent/tools/ops-tools.js.map +1 -1
  50. package/dist/agent/tools/permission-tools.d.ts +69 -21
  51. package/dist/agent/tools/permission-tools.js +183 -18
  52. package/dist/agent/tools/permission-tools.js.map +1 -1
  53. package/dist/agent/tools/tool-loader.js +5 -4
  54. package/dist/agent/tools/tool-loader.js.map +1 -1
  55. package/dist/agent/tools/web-tools.js +58 -9
  56. package/dist/agent/tools/web-tools.js.map +1 -1
  57. package/dist/cli/commands/about.d.ts +1 -0
  58. package/dist/cli/commands/about.js +55 -3
  59. package/dist/cli/commands/about.js.map +1 -1
  60. package/dist/cli/commands/admin/audit-workspace.d.ts +23 -0
  61. package/dist/cli/commands/admin/audit-workspace.js +133 -0
  62. package/dist/cli/commands/admin/audit-workspace.js.map +1 -0
  63. package/dist/cli/commands/admin/audit.d.ts +21 -0
  64. package/dist/cli/commands/admin/audit.js +174 -0
  65. package/dist/cli/commands/admin/audit.js.map +1 -0
  66. package/dist/cli/commands/admin/backup.d.ts +54 -0
  67. package/dist/cli/commands/admin/backup.js +207 -0
  68. package/dist/cli/commands/admin/backup.js.map +1 -0
  69. package/dist/cli/commands/admin/folder.d.ts +11 -0
  70. package/dist/cli/commands/admin/folder.js +187 -0
  71. package/dist/cli/commands/admin/folder.js.map +1 -0
  72. package/dist/cli/commands/admin/index.d.ts +16 -0
  73. package/dist/cli/commands/admin/index.js +48 -0
  74. package/dist/cli/commands/admin/index.js.map +1 -0
  75. package/dist/cli/commands/admin/migrate-asset-owners.d.ts +56 -0
  76. package/dist/cli/commands/admin/migrate-asset-owners.js +86 -0
  77. package/dist/cli/commands/admin/migrate-asset-owners.js.map +1 -0
  78. package/dist/cli/commands/admin/migrate-assets.d.ts +62 -0
  79. package/dist/cli/commands/admin/migrate-assets.js +237 -0
  80. package/dist/cli/commands/admin/migrate-assets.js.map +1 -0
  81. package/dist/cli/commands/admin/migrate.d.ts +56 -0
  82. package/dist/cli/commands/admin/migrate.js +263 -0
  83. package/dist/cli/commands/admin/migrate.js.map +1 -0
  84. package/dist/cli/commands/admin/restore.d.ts +24 -0
  85. package/dist/cli/commands/admin/restore.js +228 -0
  86. package/dist/cli/commands/admin/restore.js.map +1 -0
  87. package/dist/cli/commands/admin/secrets.d.ts +23 -0
  88. package/dist/cli/commands/admin/secrets.js +256 -0
  89. package/dist/cli/commands/admin/secrets.js.map +1 -0
  90. package/dist/cli/commands/admin/settings.d.ts +28 -0
  91. package/dist/cli/commands/admin/settings.js +284 -0
  92. package/dist/cli/commands/admin/settings.js.map +1 -0
  93. package/dist/cli/commands/admin/token.d.ts +42 -0
  94. package/dist/cli/commands/admin/token.js +126 -0
  95. package/dist/cli/commands/admin/token.js.map +1 -0
  96. package/dist/cli/commands/admin/transfer-ownership.d.ts +15 -0
  97. package/dist/cli/commands/admin/transfer-ownership.js +106 -0
  98. package/dist/cli/commands/admin/transfer-ownership.js.map +1 -0
  99. package/dist/cli/commands/admin/user.d.ts +11 -0
  100. package/dist/cli/commands/admin/user.js +187 -0
  101. package/dist/cli/commands/admin/user.js.map +1 -0
  102. package/dist/cli/commands/clone.d.ts +23 -3
  103. package/dist/cli/commands/clone.js +140 -36
  104. package/dist/cli/commands/clone.js.map +1 -1
  105. package/dist/cli/commands/config.d.ts +23 -107
  106. package/dist/cli/commands/config.js +52 -260
  107. package/dist/cli/commands/config.js.map +1 -1
  108. package/dist/cli/commands/connector.d.ts +10 -13
  109. package/dist/cli/commands/connector.js +16 -58
  110. package/dist/cli/commands/connector.js.map +1 -1
  111. package/dist/cli/commands/deploy.js +215 -68
  112. package/dist/cli/commands/deploy.js.map +1 -1
  113. package/dist/cli/commands/index.js +7 -4
  114. package/dist/cli/commands/index.js.map +1 -1
  115. package/dist/cli/commands/init.js +10 -30
  116. package/dist/cli/commands/init.js.map +1 -1
  117. package/dist/cli/commands/mcp.js +54 -6
  118. package/dist/cli/commands/mcp.js.map +1 -1
  119. package/dist/cli/commands/r2.d.ts +3 -0
  120. package/dist/cli/commands/r2.js +223 -204
  121. package/dist/cli/commands/r2.js.map +1 -1
  122. package/dist/cli/commands/redeploy.js +65 -12
  123. package/dist/cli/commands/redeploy.js.map +1 -1
  124. package/dist/cli/commands/reset.d.ts +22 -6
  125. package/dist/cli/commands/reset.js +132 -34
  126. package/dist/cli/commands/reset.js.map +1 -1
  127. package/dist/cli/commands/serve.js +242 -24
  128. package/dist/cli/commands/serve.js.map +1 -1
  129. package/dist/cli/commands/sync.d.ts +1 -1
  130. package/dist/cli/commands/sync.js +230 -227
  131. package/dist/cli/commands/sync.js.map +1 -1
  132. package/dist/cli/crypto-bundle.d.ts +39 -0
  133. package/dist/cli/crypto-bundle.js +94 -0
  134. package/dist/cli/crypto-bundle.js.map +1 -0
  135. package/dist/cli/index.js +24 -23
  136. package/dist/cli/index.js.map +1 -1
  137. package/dist/cli/railway-pin.d.ts +68 -0
  138. package/dist/cli/railway-pin.js +96 -0
  139. package/dist/cli/railway-pin.js.map +1 -0
  140. package/dist/cli/railway-provisioning.d.ts +53 -0
  141. package/dist/cli/railway-provisioning.js +85 -0
  142. package/dist/cli/railway-provisioning.js.map +1 -0
  143. package/dist/cli/setup-wizard.d.ts +30 -49
  144. package/dist/cli/setup-wizard.js +39 -40
  145. package/dist/cli/setup-wizard.js.map +1 -1
  146. package/dist/cli/theme.d.ts +1 -1
  147. package/dist/core/accent-palette.d.ts +7 -18
  148. package/dist/core/accent-palette.js +27 -38
  149. package/dist/core/accent-palette.js.map +1 -1
  150. package/dist/core/artifact-asset-resolution.d.ts +90 -0
  151. package/dist/core/artifact-asset-resolution.js +138 -0
  152. package/dist/core/artifact-asset-resolution.js.map +1 -0
  153. package/dist/core/artifact-asset-urls.d.ts +111 -0
  154. package/dist/core/artifact-asset-urls.js +174 -0
  155. package/dist/core/artifact-asset-urls.js.map +1 -0
  156. package/dist/core/artifact-bundle.d.ts +69 -0
  157. package/dist/core/artifact-bundle.js +305 -0
  158. package/dist/core/artifact-bundle.js.map +1 -0
  159. package/dist/core/artifact-escape.d.ts +5 -0
  160. package/dist/core/artifact-escape.js +26 -0
  161. package/dist/core/artifact-escape.js.map +1 -0
  162. package/dist/core/artifact-export.d.ts +83 -0
  163. package/dist/core/artifact-export.js +1567 -0
  164. package/dist/core/artifact-export.js.map +1 -0
  165. package/dist/core/artifact-frame-document.d.ts +105 -0
  166. package/dist/core/artifact-frame-document.js +1427 -0
  167. package/dist/core/artifact-frame-document.js.map +1 -0
  168. package/dist/core/artifact-frame-layout.d.ts +79 -0
  169. package/dist/core/artifact-frame-layout.js +94 -0
  170. package/dist/core/artifact-frame-layout.js.map +1 -0
  171. package/dist/core/artifact-frame-model.d.ts +198 -0
  172. package/dist/core/artifact-frame-model.js +603 -0
  173. package/dist/core/artifact-frame-model.js.map +1 -0
  174. package/dist/core/artifact-frame-selectors.d.ts +42 -0
  175. package/dist/core/artifact-frame-selectors.js +65 -0
  176. package/dist/core/artifact-frame-selectors.js.map +1 -0
  177. package/dist/core/artifact-libraries.d.ts +23 -0
  178. package/dist/core/artifact-libraries.js +229 -0
  179. package/dist/core/artifact-libraries.js.map +1 -0
  180. package/dist/core/artifact-manifest.d.ts +64 -0
  181. package/dist/core/artifact-manifest.js +88 -0
  182. package/dist/core/artifact-manifest.js.map +1 -0
  183. package/dist/core/artifact-paged-css.d.ts +64 -0
  184. package/dist/core/artifact-paged-css.js +253 -0
  185. package/dist/core/artifact-paged-css.js.map +1 -0
  186. package/dist/core/artifact-patch.d.ts +58 -0
  187. package/dist/core/artifact-patch.js +309 -0
  188. package/dist/core/artifact-patch.js.map +1 -0
  189. package/dist/core/artifact-warnings.d.ts +51 -0
  190. package/dist/core/artifact-warnings.js +165 -0
  191. package/dist/core/artifact-warnings.js.map +1 -0
  192. package/dist/core/breakpoints.d.ts +27 -0
  193. package/dist/core/breakpoints.js +28 -0
  194. package/dist/core/breakpoints.js.map +1 -0
  195. package/dist/core/cell-anchor.d.ts +29 -0
  196. package/dist/core/cell-anchor.js +53 -0
  197. package/dist/core/cell-anchor.js.map +1 -0
  198. package/dist/core/comment-anchor.d.ts +41 -0
  199. package/dist/core/comment-anchor.js +147 -0
  200. package/dist/core/comment-anchor.js.map +1 -0
  201. package/dist/core/commit-messages.d.ts +57 -0
  202. package/dist/core/commit-messages.js +85 -0
  203. package/dist/core/commit-messages.js.map +1 -0
  204. package/dist/core/embeds.d.ts +108 -0
  205. package/dist/core/embeds.js +226 -0
  206. package/dist/core/embeds.js.map +1 -0
  207. package/dist/core/entity-body-templates.d.ts +21 -0
  208. package/dist/core/entity-body-templates.js +66 -0
  209. package/dist/core/entity-body-templates.js.map +1 -0
  210. package/dist/core/entity-types-catalog.d.ts +65 -0
  211. package/dist/core/entity-types-catalog.js +142 -0
  212. package/dist/core/entity-types-catalog.js.map +1 -0
  213. package/dist/core/field-library.d.ts +62 -0
  214. package/dist/core/field-library.js +129 -0
  215. package/dist/core/field-library.js.map +1 -0
  216. package/dist/core/folder-paths.d.ts +41 -0
  217. package/dist/core/folder-paths.js +95 -0
  218. package/dist/core/folder-paths.js.map +1 -0
  219. package/dist/core/folder-sidecar.d.ts +36 -0
  220. package/dist/core/folder-sidecar.js +91 -0
  221. package/dist/core/folder-sidecar.js.map +1 -0
  222. package/dist/core/font-family.d.ts +62 -0
  223. package/dist/core/font-family.js +84 -0
  224. package/dist/core/font-family.js.map +1 -0
  225. package/dist/core/format-registry.d.ts +187 -0
  226. package/dist/core/format-registry.js +411 -0
  227. package/dist/core/format-registry.js.map +1 -0
  228. package/dist/core/graph.d.ts +770 -30
  229. package/dist/core/graph.js +2282 -386
  230. package/dist/core/graph.js.map +1 -1
  231. package/dist/core/history-diff.d.ts +35 -0
  232. package/dist/core/history-diff.js +114 -0
  233. package/dist/core/history-diff.js.map +1 -0
  234. package/dist/core/markdown-strip.d.ts +22 -0
  235. package/dist/core/markdown-strip.js +51 -0
  236. package/dist/core/markdown-strip.js.map +1 -0
  237. package/dist/core/refs.d.ts +41 -0
  238. package/dist/core/refs.js +80 -0
  239. package/dist/core/refs.js.map +1 -0
  240. package/dist/core/schema-registry.d.ts +66 -0
  241. package/dist/core/schema-registry.js +198 -37
  242. package/dist/core/schema-registry.js.map +1 -1
  243. package/dist/core/schemas/connector.d.ts +67 -0
  244. package/dist/core/schemas/connector.js +100 -0
  245. package/dist/core/schemas/connector.js.map +1 -0
  246. package/dist/core/schemas/workspace.d.ts +122 -0
  247. package/dist/core/schemas/workspace.js +211 -0
  248. package/dist/core/schemas/workspace.js.map +1 -0
  249. package/dist/core/secrets/SecretStore.d.ts +77 -0
  250. package/dist/core/secrets/SecretStore.js +13 -0
  251. package/dist/core/secrets/SecretStore.js.map +1 -0
  252. package/dist/core/secrets/SettingsResolver.d.ts +54 -0
  253. package/dist/core/secrets/SettingsResolver.js +80 -0
  254. package/dist/core/secrets/SettingsResolver.js.map +1 -0
  255. package/dist/core/secrets/SettingsStore.d.ts +30 -0
  256. package/dist/core/secrets/SettingsStore.js +9 -0
  257. package/dist/core/secrets/SettingsStore.js.map +1 -0
  258. package/dist/core/secrets/SqliteEncryptedStore.d.ts +90 -0
  259. package/dist/core/secrets/SqliteEncryptedStore.js +598 -0
  260. package/dist/core/secrets/SqliteEncryptedStore.js.map +1 -0
  261. package/dist/core/secrets/audit.d.ts +36 -0
  262. package/dist/core/secrets/audit.js +60 -0
  263. package/dist/core/secrets/audit.js.map +1 -0
  264. package/dist/core/secrets/auth-db-migration.d.ts +129 -0
  265. package/dist/core/secrets/auth-db-migration.js +653 -0
  266. package/dist/core/secrets/auth-db-migration.js.map +1 -0
  267. package/dist/core/secrets/bundle.d.ts +141 -0
  268. package/dist/core/secrets/bundle.js +435 -0
  269. package/dist/core/secrets/bundle.js.map +1 -0
  270. package/dist/core/secrets/dual-write.d.ts +81 -0
  271. package/dist/core/secrets/dual-write.js +247 -0
  272. package/dist/core/secrets/dual-write.js.map +1 -0
  273. package/dist/core/secrets/encryption.d.ts +44 -0
  274. package/dist/core/secrets/encryption.js +97 -0
  275. package/dist/core/secrets/encryption.js.map +1 -0
  276. package/dist/core/secrets/index.d.ts +49 -0
  277. package/dist/core/secrets/index.js +74 -0
  278. package/dist/core/secrets/index.js.map +1 -0
  279. package/dist/core/secrets/master-key.d.ts +38 -0
  280. package/dist/core/secrets/master-key.js +122 -0
  281. package/dist/core/secrets/master-key.js.map +1 -0
  282. package/dist/core/secrets/probes/anthropic.d.ts +98 -0
  283. package/dist/core/secrets/probes/anthropic.js +300 -0
  284. package/dist/core/secrets/probes/anthropic.js.map +1 -0
  285. package/dist/core/secrets/probes/brave.d.ts +9 -0
  286. package/dist/core/secrets/probes/brave.js +15 -0
  287. package/dist/core/secrets/probes/brave.js.map +1 -0
  288. package/dist/core/secrets/probes/r2.d.ts +15 -0
  289. package/dist/core/secrets/probes/r2.js +14 -0
  290. package/dist/core/secrets/probes/r2.js.map +1 -0
  291. package/dist/core/secrets/probes/tavily.d.ts +18 -0
  292. package/dist/core/secrets/probes/tavily.js +58 -0
  293. package/dist/core/secrets/probes/tavily.js.map +1 -0
  294. package/dist/core/secrets/probes/voyage.d.ts +13 -0
  295. package/dist/core/secrets/probes/voyage.js +52 -0
  296. package/dist/core/secrets/probes/voyage.js.map +1 -0
  297. package/dist/core/secrets/r2-structural-migration.d.ts +39 -0
  298. package/dist/core/secrets/r2-structural-migration.js +109 -0
  299. package/dist/core/secrets/r2-structural-migration.js.map +1 -0
  300. package/dist/core/secrets/read-flip.d.ts +59 -0
  301. package/dist/core/secrets/read-flip.js +87 -0
  302. package/dist/core/secrets/read-flip.js.map +1 -0
  303. package/dist/core/secrets/registry.d.ts +237 -0
  304. package/dist/core/secrets/registry.js +710 -0
  305. package/dist/core/secrets/registry.js.map +1 -0
  306. package/dist/core/seed-folder.d.ts +59 -0
  307. package/dist/core/seed-folder.js +76 -0
  308. package/dist/core/seed-folder.js.map +1 -0
  309. package/dist/core/types.d.ts +88 -480
  310. package/dist/core/types.js +53 -6
  311. package/dist/core/types.js.map +1 -1
  312. package/dist/core/user-config.d.ts +81 -14
  313. package/dist/core/user-config.js +147 -17
  314. package/dist/core/user-config.js.map +1 -1
  315. package/dist/core/validation.d.ts +828 -1472
  316. package/dist/core/validation.js +475 -163
  317. package/dist/core/validation.js.map +1 -1
  318. package/dist/core/view-scope.d.ts +88 -0
  319. package/dist/core/view-scope.js +71 -0
  320. package/dist/core/view-scope.js.map +1 -0
  321. package/dist/core/workspace-manager.d.ts +156 -11
  322. package/dist/core/workspace-manager.js +364 -92
  323. package/dist/core/workspace-manager.js.map +1 -1
  324. package/dist/core/workspace.d.ts +19 -5
  325. package/dist/core/workspace.js +72 -56
  326. package/dist/core/workspace.js.map +1 -1
  327. package/dist/mcp/comment-virtual-entity.d.ts +36 -0
  328. package/dist/mcp/comment-virtual-entity.js +71 -0
  329. package/dist/mcp/comment-virtual-entity.js.map +1 -0
  330. package/dist/mcp/connector-manager.d.ts +72 -2
  331. package/dist/mcp/connector-manager.js +211 -32
  332. package/dist/mcp/connector-manager.js.map +1 -1
  333. package/dist/mcp/oauth-provider.d.ts +0 -5
  334. package/dist/mcp/oauth-provider.js +31 -25
  335. package/dist/mcp/oauth-provider.js.map +1 -1
  336. package/dist/mcp/oauth-registry.d.ts +46 -8
  337. package/dist/mcp/oauth-registry.js +52 -13
  338. package/dist/mcp/oauth-registry.js.map +1 -1
  339. package/dist/mcp/server-discovery.d.ts +73 -0
  340. package/dist/mcp/server-discovery.js +164 -0
  341. package/dist/mcp/server-discovery.js.map +1 -0
  342. package/dist/mcp/server.d.ts +24 -3
  343. package/dist/mcp/server.js +53 -10
  344. package/dist/mcp/server.js.map +1 -1
  345. package/dist/mcp/state-signer.d.ts +62 -0
  346. package/dist/mcp/state-signer.js +205 -0
  347. package/dist/mcp/state-signer.js.map +1 -0
  348. package/dist/mcp/stdio-proxy.d.ts +67 -0
  349. package/dist/mcp/stdio-proxy.js +149 -0
  350. package/dist/mcp/stdio-proxy.js.map +1 -0
  351. package/dist/mcp/tools.d.ts +73 -2
  352. package/dist/mcp/tools.js +2289 -115
  353. package/dist/mcp/tools.js.map +1 -1
  354. package/dist/server/__tests__/helpers/graph-api.d.ts +17 -0
  355. package/dist/server/__tests__/helpers/graph-api.js +17 -0
  356. package/dist/server/__tests__/helpers/graph-api.js.map +1 -0
  357. package/dist/server/__tests__/helpers/multipart.d.ts +9 -0
  358. package/dist/server/__tests__/helpers/multipart.js +14 -0
  359. package/dist/server/__tests__/helpers/multipart.js.map +1 -0
  360. package/dist/server/artifact-asset-mint.d.ts +59 -0
  361. package/dist/server/artifact-asset-mint.js +127 -0
  362. package/dist/server/artifact-asset-mint.js.map +1 -0
  363. package/dist/server/asset-index-queue.d.ts +98 -0
  364. package/dist/server/asset-index-queue.js +193 -0
  365. package/dist/server/asset-index-queue.js.map +1 -0
  366. package/dist/server/body-write-coordinator.d.ts +161 -0
  367. package/dist/server/body-write-coordinator.js +182 -0
  368. package/dist/server/body-write-coordinator.js.map +1 -0
  369. package/dist/server/cloud-billing-flow.d.ts +32 -0
  370. package/dist/server/cloud-billing-flow.js +75 -0
  371. package/dist/server/cloud-billing-flow.js.map +1 -0
  372. package/dist/server/commit-audit.d.ts +26 -0
  373. package/dist/server/commit-audit.js +30 -0
  374. package/dist/server/commit-audit.js.map +1 -0
  375. package/dist/server/index.d.ts +50 -1
  376. package/dist/server/index.js +811 -229
  377. package/dist/server/index.js.map +1 -1
  378. package/dist/server/middleware/sanitize.d.ts +46 -0
  379. package/dist/server/middleware/sanitize.js +195 -0
  380. package/dist/server/middleware/sanitize.js.map +1 -0
  381. package/dist/server/process-guards.d.ts +37 -0
  382. package/dist/server/process-guards.js +44 -0
  383. package/dist/server/process-guards.js.map +1 -0
  384. package/dist/server/routes/ai-usage-api.d.ts +24 -0
  385. package/dist/server/routes/ai-usage-api.js +68 -0
  386. package/dist/server/routes/ai-usage-api.js.map +1 -0
  387. package/dist/server/routes/artifact-export-api.d.ts +11 -0
  388. package/dist/server/routes/artifact-export-api.js +180 -0
  389. package/dist/server/routes/artifact-export-api.js.map +1 -0
  390. package/dist/server/routes/artifact-patch-api.d.ts +19 -0
  391. package/dist/server/routes/artifact-patch-api.js +114 -0
  392. package/dist/server/routes/artifact-patch-api.js.map +1 -0
  393. package/dist/server/routes/artifact-selection-api.d.ts +15 -0
  394. package/dist/server/routes/artifact-selection-api.js +90 -0
  395. package/dist/server/routes/artifact-selection-api.js.map +1 -0
  396. package/dist/server/routes/asset-api.d.ts +88 -2
  397. package/dist/server/routes/asset-api.js +858 -112
  398. package/dist/server/routes/asset-api.js.map +1 -1
  399. package/dist/server/routes/audit-api.d.ts +24 -0
  400. package/dist/server/routes/audit-api.js +113 -0
  401. package/dist/server/routes/audit-api.js.map +1 -0
  402. package/dist/server/routes/auth-api.js +536 -44
  403. package/dist/server/routes/auth-api.js.map +1 -1
  404. package/dist/server/routes/capture-api.js +81 -9
  405. package/dist/server/routes/capture-api.js.map +1 -1
  406. package/dist/server/routes/chat-sessions-api.d.ts +13 -0
  407. package/dist/server/routes/chat-sessions-api.js +462 -0
  408. package/dist/server/routes/chat-sessions-api.js.map +1 -0
  409. package/dist/server/routes/chat.d.ts +35 -1
  410. package/dist/server/routes/chat.js +858 -68
  411. package/dist/server/routes/chat.js.map +1 -1
  412. package/dist/server/routes/comments-api.d.ts +15 -0
  413. package/dist/server/routes/comments-api.js +444 -0
  414. package/dist/server/routes/comments-api.js.map +1 -0
  415. package/dist/server/routes/config-api.d.ts +3 -2
  416. package/dist/server/routes/config-api.js +183 -57
  417. package/dist/server/routes/config-api.js.map +1 -1
  418. package/dist/server/routes/connectors-api.js +178 -45
  419. package/dist/server/routes/connectors-api.js.map +1 -1
  420. package/dist/server/routes/event-ingest-api.d.ts +15 -0
  421. package/dist/server/routes/event-ingest-api.js +125 -0
  422. package/dist/server/routes/event-ingest-api.js.map +1 -0
  423. package/dist/server/routes/field-library-api.d.ts +28 -0
  424. package/dist/server/routes/field-library-api.js +126 -0
  425. package/dist/server/routes/field-library-api.js.map +1 -0
  426. package/dist/server/routes/git-http.d.ts +3 -3
  427. package/dist/server/routes/git-http.js +90 -30
  428. package/dist/server/routes/git-http.js.map +1 -1
  429. package/dist/server/routes/graph-api-access.d.ts +63 -0
  430. package/dist/server/routes/graph-api-access.js +115 -0
  431. package/dist/server/routes/graph-api-access.js.map +1 -0
  432. package/dist/server/routes/graph-api.d.ts +2 -3
  433. package/dist/server/routes/graph-api.js +1341 -423
  434. package/dist/server/routes/graph-api.js.map +1 -1
  435. package/dist/server/routes/health.d.ts +18 -0
  436. package/dist/server/routes/health.js +116 -0
  437. package/dist/server/routes/health.js.map +1 -0
  438. package/dist/server/routes/import-batch.d.ts +24 -0
  439. package/dist/server/routes/import-batch.js +33 -0
  440. package/dist/server/routes/import-batch.js.map +1 -0
  441. package/dist/server/routes/insights-api.d.ts +9 -2
  442. package/dist/server/routes/insights-api.js +352 -66
  443. package/dist/server/routes/insights-api.js.map +1 -1
  444. package/dist/server/routes/mcp.d.ts +8 -3
  445. package/dist/server/routes/mcp.js +24 -8
  446. package/dist/server/routes/mcp.js.map +1 -1
  447. package/dist/server/routes/oauth-api.d.ts +67 -0
  448. package/dist/server/routes/oauth-api.js +421 -0
  449. package/dist/server/routes/oauth-api.js.map +1 -0
  450. package/dist/server/routes/permissions-api.d.ts +8 -3
  451. package/dist/server/routes/permissions-api.js +43 -12
  452. package/dist/server/routes/permissions-api.js.map +1 -1
  453. package/dist/server/routes/r2-api.d.ts +25 -0
  454. package/dist/server/routes/r2-api.js +273 -0
  455. package/dist/server/routes/r2-api.js.map +1 -0
  456. package/dist/server/routes/secrets-api.d.ts +36 -0
  457. package/dist/server/routes/secrets-api.js +305 -0
  458. package/dist/server/routes/secrets-api.js.map +1 -0
  459. package/dist/server/routes/settings-api.d.ts +29 -0
  460. package/dist/server/routes/settings-api.js +177 -0
  461. package/dist/server/routes/settings-api.js.map +1 -0
  462. package/dist/server/routes/share-api.d.ts +30 -6
  463. package/dist/server/routes/share-api.js +240 -31
  464. package/dist/server/routes/share-api.js.map +1 -1
  465. package/dist/server/routes/views-api.d.ts +11 -2
  466. package/dist/server/routes/views-api.js +123 -22
  467. package/dist/server/routes/views-api.js.map +1 -1
  468. package/dist/server/routes/workspace-api.d.ts +2 -1
  469. package/dist/server/routes/workspace-api.js +150 -23
  470. package/dist/server/routes/workspace-api.js.map +1 -1
  471. package/dist/server/routes/ws.d.ts +2 -1
  472. package/dist/server/routes/ws.js +73 -20
  473. package/dist/server/routes/ws.js.map +1 -1
  474. package/dist/server/session-manager.d.ts +48 -5
  475. package/dist/server/session-manager.js +182 -14
  476. package/dist/server/session-manager.js.map +1 -1
  477. package/dist/server/ws-hub.d.ts +135 -56
  478. package/dist/server/ws-hub.js +0 -0
  479. package/dist/server/ws-hub.js.map +1 -1
  480. package/dist/server/yjs-manager.d.ts +275 -18
  481. package/dist/server/yjs-manager.js +819 -70
  482. package/dist/server/yjs-manager.js.map +1 -1
  483. package/dist/server/yjs-persistence.d.ts +165 -0
  484. package/dist/server/yjs-persistence.js +557 -0
  485. package/dist/server/yjs-persistence.js.map +1 -0
  486. package/dist/server/yjs-text-diff.d.ts +32 -0
  487. package/dist/server/yjs-text-diff.js +61 -0
  488. package/dist/server/yjs-text-diff.js.map +1 -0
  489. package/dist/services/access-control.d.ts +121 -0
  490. package/dist/services/access-control.js +194 -0
  491. package/dist/services/access-control.js.map +1 -0
  492. package/dist/services/ai-usage-ledger.d.ts +75 -0
  493. package/dist/services/ai-usage-ledger.js +250 -0
  494. package/dist/services/ai-usage-ledger.js.map +1 -0
  495. package/dist/services/artifact-asset-token.d.ts +69 -0
  496. package/dist/services/artifact-asset-token.js +94 -0
  497. package/dist/services/artifact-asset-token.js.map +1 -0
  498. package/dist/services/artifact-inspect-metadata.d.ts +21 -0
  499. package/dist/services/artifact-inspect-metadata.js +66 -0
  500. package/dist/services/artifact-inspect-metadata.js.map +1 -0
  501. package/dist/services/artifact-library-sources.d.ts +33 -0
  502. package/dist/services/artifact-library-sources.js +91 -0
  503. package/dist/services/artifact-library-sources.js.map +1 -0
  504. package/dist/services/artifact-patch-runner.d.ts +52 -0
  505. package/dist/services/artifact-patch-runner.js +74 -0
  506. package/dist/services/artifact-patch-runner.js.map +1 -0
  507. package/dist/services/artifact-render-export.d.ts +230 -0
  508. package/dist/services/artifact-render-export.js +1003 -0
  509. package/dist/services/artifact-render-export.js.map +1 -0
  510. package/dist/services/artifact-selection-store.d.ts +68 -0
  511. package/dist/services/artifact-selection-store.js +90 -0
  512. package/dist/services/artifact-selection-store.js.map +1 -0
  513. package/dist/services/artifact-store.d.ts +118 -0
  514. package/dist/services/artifact-store.js +234 -0
  515. package/dist/services/artifact-store.js.map +1 -0
  516. package/dist/services/asset-caption-service.d.ts +103 -0
  517. package/dist/services/asset-caption-service.js +200 -0
  518. package/dist/services/asset-caption-service.js.map +1 -0
  519. package/dist/services/asset-delete-authz.d.ts +32 -0
  520. package/dist/services/asset-delete-authz.js +62 -0
  521. package/dist/services/asset-delete-authz.js.map +1 -0
  522. package/dist/services/asset-delete-impact.d.ts +63 -0
  523. package/dist/services/asset-delete-impact.js +96 -0
  524. package/dist/services/asset-delete-impact.js.map +1 -0
  525. package/dist/services/asset-finalize-service.d.ts +58 -0
  526. package/dist/services/asset-finalize-service.js +216 -0
  527. package/dist/services/asset-finalize-service.js.map +1 -0
  528. package/dist/services/asset-import-service.d.ts +116 -0
  529. package/dist/services/asset-import-service.js +436 -0
  530. package/dist/services/asset-import-service.js.map +1 -0
  531. package/dist/services/asset-index-sweep.d.ts +95 -0
  532. package/dist/services/asset-index-sweep.js +271 -0
  533. package/dist/services/asset-index-sweep.js.map +1 -0
  534. package/dist/services/asset-lifecycle-check.d.ts +22 -0
  535. package/dist/services/asset-lifecycle-check.js +80 -0
  536. package/dist/services/asset-lifecycle-check.js.map +1 -0
  537. package/dist/services/asset-listing.d.ts +63 -0
  538. package/dist/services/asset-listing.js +124 -0
  539. package/dist/services/asset-listing.js.map +1 -0
  540. package/dist/services/asset-move-impact.d.ts +49 -0
  541. package/dist/services/asset-move-impact.js +62 -0
  542. package/dist/services/asset-move-impact.js.map +1 -0
  543. package/dist/services/asset-presign-service.d.ts +62 -0
  544. package/dist/services/asset-presign-service.js +126 -0
  545. package/dist/services/asset-presign-service.js.map +1 -0
  546. package/dist/services/asset-reference-index.d.ts +39 -0
  547. package/dist/services/asset-reference-index.js +33 -0
  548. package/dist/services/asset-reference-index.js.map +1 -0
  549. package/dist/services/asset-reference-scan.d.ts +57 -0
  550. package/dist/services/asset-reference-scan.js +150 -0
  551. package/dist/services/asset-reference-scan.js.map +1 -0
  552. package/dist/services/asset-sidecar-service.d.ts +28 -0
  553. package/dist/services/asset-sidecar-service.js +79 -0
  554. package/dist/services/asset-sidecar-service.js.map +1 -0
  555. package/dist/services/asset-upload-errors.d.ts +41 -0
  556. package/dist/services/asset-upload-errors.js +45 -0
  557. package/dist/services/asset-upload-errors.js.map +1 -0
  558. package/dist/services/asset-upload-service.d.ts +56 -0
  559. package/dist/services/asset-upload-service.js +200 -0
  560. package/dist/services/asset-upload-service.js.map +1 -0
  561. package/dist/services/asset-upload-token.d.ts +58 -0
  562. package/dist/services/asset-upload-token.js +75 -0
  563. package/dist/services/asset-upload-token.js.map +1 -0
  564. package/dist/services/assets/asset-index-service.d.ts +158 -0
  565. package/dist/services/assets/asset-index-service.js +293 -0
  566. package/dist/services/assets/asset-index-service.js.map +1 -0
  567. package/dist/services/assets/base.d.ts +119 -4
  568. package/dist/services/assets/base.js +148 -3
  569. package/dist/services/assets/base.js.map +1 -1
  570. package/dist/services/assets/index.d.ts +90 -0
  571. package/dist/services/assets/index.js +202 -0
  572. package/dist/services/assets/index.js.map +1 -1
  573. package/dist/services/assets/local.d.ts +9 -0
  574. package/dist/services/assets/local.js +30 -4
  575. package/dist/services/assets/local.js.map +1 -1
  576. package/dist/services/assets/r2-sync.d.ts +88 -0
  577. package/dist/services/assets/r2-sync.js +412 -0
  578. package/dist/services/assets/r2-sync.js.map +1 -0
  579. package/dist/services/assets/r2.d.ts +80 -0
  580. package/dist/services/assets/r2.js +159 -4
  581. package/dist/services/assets/r2.js.map +1 -1
  582. package/dist/services/auth-service.d.ts +278 -51
  583. package/dist/services/auth-service.js +995 -272
  584. package/dist/services/auth-service.js.map +1 -1
  585. package/dist/services/chat-session-service.d.ts +189 -0
  586. package/dist/services/chat-session-service.js +544 -0
  587. package/dist/services/chat-session-service.js.map +1 -0
  588. package/dist/services/cloud-inference-billing.d.ts +64 -0
  589. package/dist/services/cloud-inference-billing.js +321 -0
  590. package/dist/services/cloud-inference-billing.js.map +1 -0
  591. package/dist/services/comment-service.d.ts +97 -0
  592. package/dist/services/comment-service.js +341 -0
  593. package/dist/services/comment-service.js.map +1 -0
  594. package/dist/services/comment-virtual-entity.d.ts +36 -0
  595. package/dist/services/comment-virtual-entity.js +71 -0
  596. package/dist/services/comment-virtual-entity.js.map +1 -0
  597. package/dist/services/convert-service.d.ts +64 -0
  598. package/dist/services/convert-service.js +68 -0
  599. package/dist/services/convert-service.js.map +1 -0
  600. package/dist/services/csv-service.d.ts +22 -17
  601. package/dist/services/csv-service.js +55 -92
  602. package/dist/services/csv-service.js.map +1 -1
  603. package/dist/services/entity-mutations.d.ts +313 -0
  604. package/dist/services/entity-mutations.js +531 -0
  605. package/dist/services/entity-mutations.js.map +1 -0
  606. package/dist/services/event-processor.d.ts +104 -0
  607. package/dist/services/event-processor.js +451 -0
  608. package/dist/services/event-processor.js.map +1 -0
  609. package/dist/services/extract/docx.d.ts +1 -0
  610. package/dist/services/extract/docx.js +233 -0
  611. package/dist/services/extract/docx.js.map +1 -0
  612. package/dist/services/extract/index.d.ts +9 -0
  613. package/dist/services/extract/index.js +10 -0
  614. package/dist/services/extract/index.js.map +1 -0
  615. package/dist/services/extract/pdf.d.ts +13 -0
  616. package/dist/services/extract/pdf.js +69 -0
  617. package/dist/services/extract/pdf.js.map +1 -0
  618. package/dist/services/folder-creation.d.ts +33 -0
  619. package/dist/services/folder-creation.js +103 -0
  620. package/dist/services/folder-creation.js.map +1 -0
  621. package/dist/services/fonts/font-metadata.d.ts +42 -0
  622. package/dist/services/fonts/font-metadata.js +126 -0
  623. package/dist/services/fonts/font-metadata.js.map +1 -0
  624. package/dist/services/fonts/font-skill-service.d.ts +66 -0
  625. package/dist/services/fonts/font-skill-service.js +137 -0
  626. package/dist/services/fonts/font-skill-service.js.map +1 -0
  627. package/dist/services/git.d.ts +58 -0
  628. package/dist/services/git.js +194 -55
  629. package/dist/services/git.js.map +1 -1
  630. package/dist/services/graph-maintenance.js +4 -4
  631. package/dist/services/graph-maintenance.js.map +1 -1
  632. package/dist/services/import-service.d.ts +51 -2
  633. package/dist/services/import-service.js +254 -107
  634. package/dist/services/import-service.js.map +1 -1
  635. package/dist/services/lint-service.js +10 -17
  636. package/dist/services/lint-service.js.map +1 -1
  637. package/dist/services/markdown.d.ts +12 -1
  638. package/dist/services/markdown.js +77 -9
  639. package/dist/services/markdown.js.map +1 -1
  640. package/dist/services/mention-detector.d.ts +23 -0
  641. package/dist/services/mention-detector.js +47 -0
  642. package/dist/services/mention-detector.js.map +1 -0
  643. package/dist/services/model-capabilities.d.ts +41 -0
  644. package/dist/services/model-capabilities.js +107 -0
  645. package/dist/services/model-capabilities.js.map +1 -0
  646. package/dist/services/notification-broadcast.d.ts +32 -0
  647. package/dist/services/notification-broadcast.js +38 -0
  648. package/dist/services/notification-broadcast.js.map +1 -0
  649. package/dist/services/notification-service.d.ts +41 -0
  650. package/dist/services/notification-service.js +100 -0
  651. package/dist/services/notification-service.js.map +1 -0
  652. package/dist/services/oauth-server-store.d.ts +147 -0
  653. package/dist/services/oauth-server-store.js +319 -0
  654. package/dist/services/oauth-server-store.js.map +1 -0
  655. package/dist/services/orphan-service.js +2 -2
  656. package/dist/services/orphan-service.js.map +1 -1
  657. package/dist/services/personal-folder.d.ts +49 -0
  658. package/dist/services/personal-folder.js +122 -0
  659. package/dist/services/personal-folder.js.map +1 -0
  660. package/dist/services/playwright-bootstrap.d.ts +78 -0
  661. package/dist/services/playwright-bootstrap.js +219 -0
  662. package/dist/services/playwright-bootstrap.js.map +1 -0
  663. package/dist/services/scratch-asset-promote.d.ts +57 -0
  664. package/dist/services/scratch-asset-promote.js +95 -0
  665. package/dist/services/scratch-asset-promote.js.map +1 -0
  666. package/dist/services/scratch-attachment-service.d.ts +201 -0
  667. package/dist/services/scratch-attachment-service.js +354 -0
  668. package/dist/services/scratch-attachment-service.js.map +1 -0
  669. package/dist/services/share-link-service.d.ts +57 -0
  670. package/dist/services/share-link-service.js +142 -0
  671. package/dist/services/share-link-service.js.map +1 -0
  672. package/dist/services/user-person-bridge.d.ts +136 -0
  673. package/dist/services/user-person-bridge.js +341 -0
  674. package/dist/services/user-person-bridge.js.map +1 -0
  675. package/dist/services/utility-model-resolver.d.ts +37 -0
  676. package/dist/services/utility-model-resolver.js +67 -0
  677. package/dist/services/utility-model-resolver.js.map +1 -0
  678. package/dist/services/vector-service.d.ts +282 -5
  679. package/dist/services/vector-service.js +594 -39
  680. package/dist/services/vector-service.js.map +1 -1
  681. package/dist/services/workspace-access.d.ts +115 -0
  682. package/dist/services/workspace-access.js +154 -0
  683. package/dist/services/workspace-access.js.map +1 -0
  684. package/dist/services/workspace-assets-folder.d.ts +46 -0
  685. package/dist/services/workspace-assets-folder.js +75 -0
  686. package/dist/services/workspace-assets-folder.js.map +1 -0
  687. package/dist/utils/git.d.ts +17 -2
  688. package/dist/utils/git.js +23 -7
  689. package/dist/utils/git.js.map +1 -1
  690. package/dist/utils/log.d.ts +42 -0
  691. package/dist/utils/log.js +137 -0
  692. package/dist/utils/log.js.map +1 -0
  693. package/dist/utils/preflight.js +2 -2
  694. package/dist/utils/preflight.js.map +1 -1
  695. package/dist/utils/version-checker.d.ts +12 -19
  696. package/dist/utils/version-checker.js +14 -104
  697. package/dist/utils/version-checker.js.map +1 -1
  698. package/dist/web/_app/immutable/assets/0.B8rPC4xg.css +2 -0
  699. package/dist/web/_app/immutable/assets/12.DlIf1mKh.css +1 -0
  700. package/dist/web/_app/immutable/assets/13.WUaKJbVc.css +1 -0
  701. package/dist/web/_app/immutable/assets/15.CItnu3nw.css +1 -0
  702. package/dist/web/_app/immutable/assets/16.C3czeWWx.css +1 -0
  703. package/dist/web/_app/immutable/assets/17.CHiwoAMO.css +1 -0
  704. package/dist/web/_app/immutable/assets/18.fUGuXQ0K.css +1 -0
  705. package/dist/web/_app/immutable/assets/19.DcuK5ZVm.css +1 -0
  706. package/dist/web/_app/immutable/assets/2.bJqlVFXX.css +1 -0
  707. package/dist/web/_app/immutable/assets/3.DDfEAhbB.css +1 -0
  708. package/dist/web/_app/immutable/assets/4.Dtodt1Fe.css +1 -0
  709. package/dist/web/_app/immutable/assets/6.JPVpkzLZ.css +1 -0
  710. package/dist/web/_app/immutable/assets/AssetLibraryPicker.BWH260L8.css +1 -0
  711. package/dist/web/_app/immutable/assets/BulkActionsBar.CXSM7tO7.css +1 -0
  712. package/dist/web/_app/immutable/assets/CalendarView.Cch9MMQW.css +1 -0
  713. package/dist/web/_app/immutable/assets/CodeMirrorEditor.D6hf2pNJ.css +1 -0
  714. package/dist/web/_app/immutable/assets/CopyField.DVGZtw4U.css +1 -0
  715. package/dist/web/_app/immutable/assets/FolderMembersPanel.BvV1lBCg.css +1 -0
  716. package/dist/web/_app/immutable/assets/FolderMutationDialogs.De2NQ55E.css +1 -0
  717. package/dist/web/_app/immutable/assets/FolderPicker.Cq1tMnu_.css +1 -0
  718. package/dist/web/_app/immutable/assets/FolderTreeField.DTSzn15s.css +1 -0
  719. package/dist/web/_app/immutable/assets/FrameCanvas.Clh5Xdr7.css +1 -0
  720. package/dist/web/_app/immutable/assets/GalleryView.Cqu3-wtr.css +1 -0
  721. package/dist/web/_app/immutable/assets/GraphView.BJtGL9py.css +1 -0
  722. package/dist/web/_app/immutable/assets/GridCell.czY6eDb_.css +1 -0
  723. package/dist/web/_app/immutable/assets/KanbanView.C5X8TbQk.css +1 -0
  724. package/dist/web/_app/immutable/assets/Link.vV0ne105.css +1 -0
  725. package/dist/web/_app/immutable/assets/Markdown.CSYKSAm0.css +1 -0
  726. package/dist/web/_app/immutable/assets/Rail.Dyxy_E0O.css +1 -0
  727. package/dist/web/_app/immutable/assets/RepoCheckList.BLeJ79Eg.css +1 -0
  728. package/dist/web/_app/immutable/assets/SaveViewDialog.Bb9E81xd.css +1 -0
  729. package/dist/web/_app/immutable/assets/SearchInput.DTB6W35f.css +1 -0
  730. package/dist/web/_app/immutable/assets/SettingsDialog.CHzfQoo_.css +1 -0
  731. package/dist/web/_app/immutable/assets/Spinner.UBfl0pab.css +1 -0
  732. package/dist/web/_app/immutable/assets/StopFilledAlt.CjuwgVxu.css +1 -0
  733. package/dist/web/_app/immutable/assets/TimelineView.u4YqiztR.css +1 -0
  734. package/dist/web/_app/immutable/assets/Version.BQq1Fihu.css +1 -0
  735. package/dist/web/_app/immutable/assets/ViewBanner.DWswnFdi.css +1 -0
  736. package/dist/web/_app/immutable/assets/WorkspaceView.Cd6TS6oo.css +1 -0
  737. package/dist/web/_app/immutable/assets/button.DOg1smbV.css +1 -0
  738. package/dist/web/_app/immutable/assets/checkbox.CAcHq8G6.css +1 -0
  739. package/dist/web/_app/immutable/assets/download-with-progress.BZlFTn09.css +1 -0
  740. package/dist/web/_app/immutable/assets/filters.RgfXKVpA.css +1 -0
  741. package/dist/web/_app/immutable/assets/ibm-plex-mono-latin-400-normal.CvHOgSBP.woff +0 -0
  742. package/dist/web/_app/immutable/assets/ibm-plex-mono-latin-400-normal.DMJ8VG8y.woff2 +0 -0
  743. package/dist/web/_app/immutable/assets/ibm-plex-mono-latin-500-normal.CB9ihrfo.woff +0 -0
  744. package/dist/web/_app/immutable/assets/ibm-plex-mono-latin-500-normal.DSY6xOcd.woff2 +0 -0
  745. package/dist/web/_app/immutable/assets/ibm-plex-sans-latin-400-italic.CZTNEAuW.woff2 +0 -0
  746. package/dist/web/_app/immutable/assets/ibm-plex-sans-latin-400-italic.CsGl1sm0.woff +0 -0
  747. package/dist/web/_app/immutable/assets/ibm-plex-sans-latin-400-normal.CDDApCn2.woff2 +0 -0
  748. package/dist/web/_app/immutable/assets/ibm-plex-sans-latin-400-normal.CYLoc0-x.woff +0 -0
  749. package/dist/web/_app/immutable/assets/ibm-plex-sans-latin-500-italic.BNK2_mGO.woff2 +0 -0
  750. package/dist/web/_app/immutable/assets/ibm-plex-sans-latin-500-italic.DpEwFAQM.woff +0 -0
  751. package/dist/web/_app/immutable/assets/ibm-plex-sans-latin-500-normal.6ng42L7E.woff2 +0 -0
  752. package/dist/web/_app/immutable/assets/ibm-plex-sans-latin-500-normal.BgVn5rGT.woff +0 -0
  753. package/dist/web/_app/immutable/assets/ibm-plex-sans-latin-600-normal.Cu4Hd6ag.woff +0 -0
  754. package/dist/web/_app/immutable/assets/ibm-plex-sans-latin-600-normal.CuJfVYMP.woff2 +0 -0
  755. package/dist/web/_app/immutable/assets/list-columns.BgnafZ4K.css +1 -0
  756. package/dist/web/_app/immutable/chunks/-MYqXlc3.js +185 -0
  757. package/dist/web/_app/immutable/chunks/-Tbr-96c2.js +1 -0
  758. package/dist/web/_app/immutable/chunks/1QRy7-wo.js +1 -0
  759. package/dist/web/_app/immutable/chunks/1_BWKAKA2.js +23 -0
  760. package/dist/web/_app/immutable/chunks/2z2ekE6D2.js +2 -0
  761. package/dist/web/_app/immutable/chunks/6guf_P8c.js +1 -0
  762. package/dist/web/_app/immutable/chunks/7l950wkn.js +1 -0
  763. package/dist/web/_app/immutable/chunks/9Sn2PwSn2.js +1025 -0
  764. package/dist/web/_app/immutable/chunks/AFZSy-Vk.js +2 -0
  765. package/dist/web/_app/immutable/chunks/B06uE1qJ.js +1 -0
  766. package/dist/web/_app/immutable/chunks/B2cjR0rG.js +83 -0
  767. package/dist/web/_app/immutable/chunks/B3u4QMoU.js +1 -0
  768. package/dist/web/_app/immutable/chunks/B4PrlkmE.js +1 -0
  769. package/dist/web/_app/immutable/chunks/B5UH1FNe.js +3 -0
  770. package/dist/web/_app/immutable/chunks/B5sxjq1L2.js +1 -0
  771. package/dist/web/_app/immutable/chunks/B6Lt-qaJ.js +1 -0
  772. package/dist/web/_app/immutable/chunks/B6wo7Stk2.js +1 -0
  773. package/dist/web/_app/immutable/chunks/B9KfEsQw2.js +1 -0
  774. package/dist/web/_app/immutable/chunks/B9MY422N.js +1 -0
  775. package/dist/web/_app/immutable/chunks/B9VQbssY.js +3 -0
  776. package/dist/web/_app/immutable/chunks/BBrP9GiZ.js +1 -0
  777. package/dist/web/_app/immutable/chunks/BEGTD2EL2.js +1 -0
  778. package/dist/web/_app/immutable/chunks/BEyPhM3C.js +1 -0
  779. package/dist/web/_app/immutable/chunks/BIeOkmiV.js +1 -0
  780. package/dist/web/_app/immutable/chunks/BIwe25Lk.js +1 -0
  781. package/dist/web/_app/immutable/chunks/BO6-nRV9.js +1 -0
  782. package/dist/web/_app/immutable/chunks/BPILs-6H.js +1 -0
  783. package/dist/web/_app/immutable/chunks/BPRQzMGs.js +1 -0
  784. package/dist/web/_app/immutable/chunks/BQE7bWgF.js +1 -0
  785. package/dist/web/_app/immutable/chunks/BU5TCj7m.js +12 -0
  786. package/dist/web/_app/immutable/chunks/BZDKT2Qw2.js +2 -0
  787. package/dist/web/_app/immutable/chunks/B_y9A6Kg.js +4 -0
  788. package/dist/web/_app/immutable/chunks/BdR7t2GN.js +3 -0
  789. package/dist/web/_app/immutable/chunks/BnYohOts2.js +1 -0
  790. package/dist/web/_app/immutable/chunks/Bpmx7Umc.js +1 -0
  791. package/dist/web/_app/immutable/chunks/BqButnP4.js +1 -0
  792. package/dist/web/_app/immutable/chunks/BtDSRU36.js +1 -0
  793. package/dist/web/_app/immutable/chunks/Bvr6nSm92.js +1 -0
  794. package/dist/web/_app/immutable/chunks/BvyVm7-j.js +184 -0
  795. package/dist/web/_app/immutable/chunks/Bx6T8G5n2.js +1 -0
  796. package/dist/web/_app/immutable/chunks/BxeOdaUQ.js +1 -0
  797. package/dist/web/_app/immutable/chunks/C1B4xDs0.js +1 -0
  798. package/dist/web/_app/immutable/chunks/C2yz630b.js +2 -0
  799. package/dist/web/_app/immutable/chunks/C5YoDj-e.js +1 -0
  800. package/dist/web/_app/immutable/chunks/C6d9nn3k.js +1 -0
  801. package/dist/web/_app/immutable/chunks/C85NG5lS.js +1 -0
  802. package/dist/web/_app/immutable/chunks/C8ZiSqQm.js +1 -0
  803. package/dist/web/_app/immutable/chunks/CB-t1Bv-.js +1 -0
  804. package/dist/web/_app/immutable/chunks/CG8YKaqc.js +5 -0
  805. package/dist/web/_app/immutable/chunks/CJbr-v9X.js +1 -0
  806. package/dist/web/_app/immutable/chunks/CKGHeJzq.js +1 -0
  807. package/dist/web/_app/immutable/chunks/CKwV6HKc.js +1 -0
  808. package/dist/web/_app/immutable/chunks/CLninaDG2.js +2 -0
  809. package/dist/web/_app/immutable/chunks/CM400nLL.js +7 -0
  810. package/dist/web/_app/immutable/chunks/CPvxN2G62.js +1 -0
  811. package/dist/web/_app/immutable/chunks/CQW66fYJ.js +1 -0
  812. package/dist/web/_app/immutable/chunks/CQl_RUVN2.js +1 -0
  813. package/dist/web/_app/immutable/chunks/CR1JY_cb.js +6 -0
  814. package/dist/web/_app/immutable/chunks/CT35tdLp.js +1 -0
  815. package/dist/web/_app/immutable/chunks/CVKrGJ6C.js +1 -0
  816. package/dist/web/_app/immutable/chunks/CWIHttTH.js +1 -0
  817. package/dist/web/_app/immutable/chunks/CWZSexLW.js +1 -0
  818. package/dist/web/_app/immutable/chunks/CXPMb3zd.js +1 -0
  819. package/dist/web/_app/immutable/chunks/CZBW5wi82.js +1 -0
  820. package/dist/web/_app/immutable/chunks/CaimSvvF.js +5 -0
  821. package/dist/web/_app/immutable/chunks/CcWaWbrI2.js +1 -0
  822. package/dist/web/_app/immutable/chunks/CcgYvk_3.js +1 -0
  823. package/dist/web/_app/immutable/chunks/Cg7m1gqN.js +1 -0
  824. package/dist/web/_app/immutable/chunks/CgCz4Fj6.js +1 -0
  825. package/dist/web/_app/immutable/chunks/CgOgBK5j.js +1 -0
  826. package/dist/web/_app/immutable/chunks/ChS3kWO-.js +2 -0
  827. package/dist/web/_app/immutable/chunks/CkivrILi.js +1 -0
  828. package/dist/web/_app/immutable/chunks/CmWflMFc.js +1 -0
  829. package/dist/web/_app/immutable/chunks/Cm_yhEon2.js +1 -0
  830. package/dist/web/_app/immutable/chunks/CnoUnj6-2.js +1 -0
  831. package/dist/web/_app/immutable/chunks/CqyFdLMa.js +1 -0
  832. package/dist/web/_app/immutable/chunks/CsIWxmio2.js +22 -0
  833. package/dist/web/_app/immutable/chunks/CtgdtZ0G2.js +1 -0
  834. package/dist/web/_app/immutable/chunks/CuYL65Bn.js +2 -0
  835. package/dist/web/_app/immutable/chunks/CuatNdzp.js +2 -0
  836. package/dist/web/_app/immutable/chunks/Cx5IiiDO2.js +2 -0
  837. package/dist/web/_app/immutable/chunks/Cxdio_Al.js +2692 -0
  838. package/dist/web/_app/immutable/chunks/CyTgggiM2.js +1 -0
  839. package/dist/web/_app/immutable/chunks/D-vvXTU3.js +2 -0
  840. package/dist/web/_app/immutable/chunks/D0_Iu3Uj.js +2 -0
  841. package/dist/web/_app/immutable/chunks/D4vfNy_f.js +1 -0
  842. package/dist/web/_app/immutable/chunks/D6toh9Mr.js +1 -0
  843. package/dist/web/_app/immutable/chunks/DAsarOLg2.js +1 -0
  844. package/dist/web/_app/immutable/chunks/DBGaXAP8.js +1 -0
  845. package/dist/web/_app/immutable/chunks/DCgKWtld.js +1 -0
  846. package/dist/web/_app/immutable/chunks/DG7uGoZb2.js +58 -0
  847. package/dist/web/_app/immutable/chunks/DIsSxB_C.js +1 -0
  848. package/dist/web/_app/immutable/chunks/DJTvBXur.js +2 -0
  849. package/dist/web/_app/immutable/chunks/DLuIHCPq.js +1 -0
  850. package/dist/web/_app/immutable/chunks/DMFH9Cnt2.js +1 -0
  851. package/dist/web/_app/immutable/chunks/DNLoQniz.js +1 -0
  852. package/dist/web/_app/immutable/chunks/DPLkAijI2.js +1 -0
  853. package/dist/web/_app/immutable/chunks/DQMWa2t7.js +1 -0
  854. package/dist/web/_app/immutable/chunks/DTOO9nUj.js +1 -0
  855. package/dist/web/_app/immutable/chunks/DaB0hU8_.js +1 -0
  856. package/dist/web/_app/immutable/chunks/Dav8Lgyy2.js +5 -0
  857. package/dist/web/_app/immutable/chunks/Ddgu2Sjp.js +1 -0
  858. package/dist/web/_app/immutable/chunks/DfUXQOZ92.js +1 -0
  859. package/dist/web/_app/immutable/chunks/DgP0Pxes.js +224 -0
  860. package/dist/web/_app/immutable/chunks/DhD1HF7R.js +1 -0
  861. package/dist/web/_app/immutable/chunks/Dhmw5GUH.js +1 -0
  862. package/dist/web/_app/immutable/chunks/DiBVOY752.js +1 -0
  863. package/dist/web/_app/immutable/chunks/DiMsLIh3.js +1 -0
  864. package/dist/web/_app/immutable/chunks/DiiXREv7.js +1 -0
  865. package/dist/web/_app/immutable/chunks/DjXtgWTP.js +1 -0
  866. package/dist/web/_app/immutable/chunks/Dk2-JtmU2.js +1 -0
  867. package/dist/web/_app/immutable/chunks/Dl0bYyV_.js +1 -0
  868. package/dist/web/_app/immutable/chunks/DqKYbIld2.js +1 -0
  869. package/dist/web/_app/immutable/chunks/DtXJCaQc2.js +1 -0
  870. package/dist/web/_app/immutable/chunks/DwuBUEvU.js +1 -0
  871. package/dist/web/_app/immutable/chunks/F5xZdLlB.js +2 -0
  872. package/dist/web/_app/immutable/chunks/F92HmKX8.js +1 -0
  873. package/dist/web/_app/immutable/chunks/FISIvbqq.js +3 -0
  874. package/dist/web/_app/immutable/chunks/GC5Izn9E2.js +1 -0
  875. package/dist/web/_app/immutable/chunks/IMJutqSu2.js +1 -0
  876. package/dist/web/_app/immutable/chunks/K5YHt1WL2.js +1 -0
  877. package/dist/web/_app/immutable/chunks/MAYbL-xn2.js +6 -0
  878. package/dist/web/_app/immutable/chunks/MMtHlrry.js +1 -0
  879. package/dist/web/_app/immutable/chunks/MtN4vJa02.js +1 -0
  880. package/dist/web/_app/immutable/chunks/Oglnp7sm.js +14 -0
  881. package/dist/web/_app/immutable/chunks/PwUOTfSv.js +2 -0
  882. package/dist/web/_app/immutable/chunks/QsO256-z.js +1 -0
  883. package/dist/web/_app/immutable/chunks/RA-JwTzo.js +1 -0
  884. package/dist/web/_app/immutable/chunks/atFSAfcd2.js +2 -0
  885. package/dist/web/_app/immutable/chunks/j_uHTBnD.js +1 -0
  886. package/dist/web/_app/immutable/chunks/joKsoiFC.js +1 -0
  887. package/dist/web/_app/immutable/chunks/kNaey6uv.js +1 -0
  888. package/dist/web/_app/immutable/chunks/nqo2e2Yv.js +1 -0
  889. package/dist/web/_app/immutable/chunks/oIZupUnz.js +1 -0
  890. package/dist/web/_app/immutable/chunks/pPsy4008.js +1 -0
  891. package/dist/web/_app/immutable/chunks/qevfNcid.js +1 -0
  892. package/dist/web/_app/immutable/chunks/rjjyuGhb.js +1 -0
  893. package/dist/web/_app/immutable/chunks/sUAtda6y2.js +2 -0
  894. package/dist/web/_app/immutable/chunks/snCOoD78.js +1 -0
  895. package/dist/web/_app/immutable/chunks/uHaS74te.js +1 -0
  896. package/dist/web/_app/immutable/chunks/w5tsuIav.js +5 -0
  897. package/dist/web/_app/immutable/chunks/xihTtKlq.js +1 -0
  898. package/dist/web/_app/immutable/entry/app.1tcNTKI-.js +2 -0
  899. package/dist/web/_app/immutable/entry/start.BJMsySI1.js +1 -0
  900. package/dist/web/_app/immutable/nodes/0.v0W5DL7W.js +2 -0
  901. package/dist/web/_app/immutable/nodes/1.81Rb3Ith.js +1 -0
  902. package/dist/web/_app/immutable/nodes/10.CAlZNFOq.js +1 -0
  903. package/dist/web/_app/immutable/nodes/11.CCfUginI.js +1 -0
  904. package/dist/web/_app/immutable/nodes/12.BJLboAyk.js +1 -0
  905. package/dist/web/_app/immutable/nodes/13.Cz4UTl2G.js +1 -0
  906. package/dist/web/_app/immutable/nodes/14.DJwakC0o.js +1 -0
  907. package/dist/web/_app/immutable/nodes/15.D2mNE6C-.js +1 -0
  908. package/dist/web/_app/immutable/nodes/16.BjohAUt9.js +1 -0
  909. package/dist/web/_app/immutable/nodes/17.BI2F37bS.js +1 -0
  910. package/dist/web/_app/immutable/nodes/18.DsOT0tDo.js +1 -0
  911. package/dist/web/_app/immutable/nodes/19.BiJWLOUT.js +77 -0
  912. package/dist/web/_app/immutable/nodes/2.Cd72nG2V.js +124 -0
  913. package/dist/web/_app/immutable/nodes/3.BIT9mm9r.js +6 -0
  914. package/dist/web/_app/immutable/nodes/4.Cn7r0Poe.js +16 -0
  915. package/dist/web/_app/immutable/nodes/5.CkJNdCZG.js +1 -0
  916. package/dist/web/_app/immutable/nodes/6.1rbIRQgQ.js +6 -0
  917. package/dist/web/_app/immutable/nodes/7.w17Zl36i.js +1 -0
  918. package/dist/web/_app/immutable/nodes/8.DqTsYuU-.js +1 -0
  919. package/dist/web/_app/immutable/nodes/9.BJhYZPfc.js +1 -0
  920. package/dist/web/_app/version.json +1 -1
  921. package/dist/web/favicon-16.png +0 -0
  922. package/dist/web/favicon-180.png +0 -0
  923. package/dist/web/favicon-32.png +0 -0
  924. package/dist/web/favicon-48.png +0 -0
  925. package/dist/web/favicon-512.png +0 -0
  926. package/dist/web/favicon.ico +0 -0
  927. package/dist/web/favicon.svg +8 -0
  928. package/dist/web/index.html +59 -20
  929. package/dist/web/studiograph-logomark.svg +29 -0
  930. package/package.json +44 -15
  931. package/dist/agent/role-loader.d.ts +0 -24
  932. package/dist/agent/role-loader.js +0 -67
  933. package/dist/agent/role-loader.js.map +0 -1
  934. package/dist/agent/skills/create-deck/content-guide.md +0 -238
  935. package/dist/agent/skills/create-deck/deck-cadence.md +0 -105
  936. package/dist/agent/skills/create-deck/diagrams.md +0 -431
  937. package/dist/agent/skills/create-deck/skill.md +0 -89
  938. package/dist/agent/skills/create-deck/slide-selection.md +0 -115
  939. package/dist/agent/skills/create-deck/slide-types.md +0 -638
  940. package/dist/agent/skills/create-document/skill.md +0 -229
  941. package/dist/agent/skills/enrich-entities.md +0 -136
  942. package/dist/agent/skills/obsidian-source-setup.md +0 -246
  943. package/dist/agent/skills/skill-loader.d.ts +0 -48
  944. package/dist/agent/skills/skill-loader.js +0 -166
  945. package/dist/agent/skills/skill-loader.js.map +0 -1
  946. package/dist/agent/skills/sync-configuration.md +0 -119
  947. package/dist/agent/skills/sync-setup.md +0 -82
  948. package/dist/agent/tools/message-tools.d.ts +0 -42
  949. package/dist/agent/tools/message-tools.js +0 -96
  950. package/dist/agent/tools/message-tools.js.map +0 -1
  951. package/dist/agent/tools/sync-tools.d.ts +0 -35
  952. package/dist/agent/tools/sync-tools.js +0 -992
  953. package/dist/agent/tools/sync-tools.js.map +0 -1
  954. package/dist/auth/github.d.ts +0 -56
  955. package/dist/auth/github.js +0 -169
  956. package/dist/auth/github.js.map +0 -1
  957. package/dist/cli/commands/access.d.ts +0 -11
  958. package/dist/cli/commands/access.js +0 -156
  959. package/dist/cli/commands/access.js.map +0 -1
  960. package/dist/cli/commands/app.d.ts +0 -7
  961. package/dist/cli/commands/app.js +0 -268
  962. package/dist/cli/commands/app.js.map +0 -1
  963. package/dist/cli/commands/auth.d.ts +0 -10
  964. package/dist/cli/commands/auth.js +0 -79
  965. package/dist/cli/commands/auth.js.map +0 -1
  966. package/dist/cli/commands/clear.d.ts +0 -5
  967. package/dist/cli/commands/clear.js +0 -36
  968. package/dist/cli/commands/clear.js.map +0 -1
  969. package/dist/cli/commands/collection.d.ts +0 -10
  970. package/dist/cli/commands/collection.js +0 -185
  971. package/dist/cli/commands/collection.js.map +0 -1
  972. package/dist/cli/commands/enrich.d.ts +0 -11
  973. package/dist/cli/commands/enrich.js +0 -135
  974. package/dist/cli/commands/enrich.js.map +0 -1
  975. package/dist/cli/commands/graphrag.d.ts +0 -12
  976. package/dist/cli/commands/graphrag.js +0 -122
  977. package/dist/cli/commands/graphrag.js.map +0 -1
  978. package/dist/cli/commands/join.d.ts +0 -9
  979. package/dist/cli/commands/join.js +0 -255
  980. package/dist/cli/commands/join.js.map +0 -1
  981. package/dist/cli/commands/members.d.ts +0 -11
  982. package/dist/cli/commands/members.js +0 -230
  983. package/dist/cli/commands/members.js.map +0 -1
  984. package/dist/cli/commands/org.d.ts +0 -10
  985. package/dist/cli/commands/org.js +0 -132
  986. package/dist/cli/commands/org.js.map +0 -1
  987. package/dist/cli/commands/provision.d.ts +0 -8
  988. package/dist/cli/commands/provision.js +0 -116
  989. package/dist/cli/commands/provision.js.map +0 -1
  990. package/dist/cli/commands/resolve.d.ts +0 -8
  991. package/dist/cli/commands/resolve.js +0 -85
  992. package/dist/cli/commands/resolve.js.map +0 -1
  993. package/dist/cli/commands/review.d.ts +0 -19
  994. package/dist/cli/commands/review.js +0 -128
  995. package/dist/cli/commands/review.js.map +0 -1
  996. package/dist/cli/commands/source.d.ts +0 -16
  997. package/dist/cli/commands/source.js +0 -159
  998. package/dist/cli/commands/source.js.map +0 -1
  999. package/dist/cli/commands/start.d.ts +0 -7
  1000. package/dist/cli/commands/start.js +0 -576
  1001. package/dist/cli/commands/start.js.map +0 -1
  1002. package/dist/cli/commands/sync-collection.d.ts +0 -14
  1003. package/dist/cli/commands/sync-collection.js +0 -355
  1004. package/dist/cli/commands/sync-collection.js.map +0 -1
  1005. package/dist/cli/commands/sync-entities.d.ts +0 -13
  1006. package/dist/cli/commands/sync-entities.js +0 -242
  1007. package/dist/cli/commands/sync-entities.js.map +0 -1
  1008. package/dist/cli/commands/team.d.ts +0 -12
  1009. package/dist/cli/commands/team.js +0 -185
  1010. package/dist/cli/commands/team.js.map +0 -1
  1011. package/dist/cli/commands/update.d.ts +0 -8
  1012. package/dist/cli/commands/update.js +0 -155
  1013. package/dist/cli/commands/update.js.map +0 -1
  1014. package/dist/cli/commands/user.d.ts +0 -7
  1015. package/dist/cli/commands/user.js +0 -169
  1016. package/dist/cli/commands/user.js.map +0 -1
  1017. package/dist/cli/scaffolding.d.ts +0 -12
  1018. package/dist/cli/scaffolding.js +0 -397
  1019. package/dist/cli/scaffolding.js.map +0 -1
  1020. package/dist/cli/sync-review-interactive.d.ts +0 -31
  1021. package/dist/cli/sync-review-interactive.js +0 -393
  1022. package/dist/cli/sync-review-interactive.js.map +0 -1
  1023. package/dist/core/feature-flags.d.ts +0 -17
  1024. package/dist/core/feature-flags.js +0 -15
  1025. package/dist/core/feature-flags.js.map +0 -1
  1026. package/dist/core/features.d.ts +0 -16
  1027. package/dist/core/features.js +0 -48
  1028. package/dist/core/features.js.map +0 -1
  1029. package/dist/core/launch-entity-types.d.ts +0 -23
  1030. package/dist/core/launch-entity-types.js +0 -48
  1031. package/dist/core/launch-entity-types.js.map +0 -1
  1032. package/dist/core/migration-runner.d.ts +0 -42
  1033. package/dist/core/migration-runner.js +0 -232
  1034. package/dist/core/migration-runner.js.map +0 -1
  1035. package/dist/core/migration-types.d.ts +0 -101
  1036. package/dist/core/migration-types.js +0 -21
  1037. package/dist/core/migration-types.js.map +0 -1
  1038. package/dist/core/migrations/20260219-formalize-memory-location.d.ts +0 -2
  1039. package/dist/core/migrations/20260219-formalize-memory-location.js +0 -35
  1040. package/dist/core/migrations/20260219-formalize-memory-location.js.map +0 -1
  1041. package/dist/core/migrations/20260220-add-workspace-metadata.d.ts +0 -12
  1042. package/dist/core/migrations/20260220-add-workspace-metadata.js +0 -65
  1043. package/dist/core/migrations/20260220-add-workspace-metadata.js.map +0 -1
  1044. package/dist/core/migrations/20260220-add-workspace-readme.d.ts +0 -11
  1045. package/dist/core/migrations/20260220-add-workspace-readme.js +0 -82
  1046. package/dist/core/migrations/20260220-add-workspace-readme.js.map +0 -1
  1047. package/dist/core/migrations/20260220-migrate-yaml-to-json.d.ts +0 -9
  1048. package/dist/core/migrations/20260220-migrate-yaml-to-json.js +0 -64
  1049. package/dist/core/migrations/20260220-migrate-yaml-to-json.js.map +0 -1
  1050. package/dist/core/migrations/index.d.ts +0 -11
  1051. package/dist/core/migrations/index.js +0 -23
  1052. package/dist/core/migrations/index.js.map +0 -1
  1053. package/dist/integrations/asana.d.ts +0 -26
  1054. package/dist/integrations/asana.js +0 -78
  1055. package/dist/integrations/asana.js.map +0 -1
  1056. package/dist/integrations/figma-local.d.ts +0 -16
  1057. package/dist/integrations/figma-local.js +0 -10
  1058. package/dist/integrations/figma-local.js.map +0 -1
  1059. package/dist/integrations/figma.d.ts +0 -17
  1060. package/dist/integrations/figma.js +0 -17
  1061. package/dist/integrations/figma.js.map +0 -1
  1062. package/dist/integrations/granola.d.ts +0 -24
  1063. package/dist/integrations/granola.js +0 -60
  1064. package/dist/integrations/granola.js.map +0 -1
  1065. package/dist/integrations/linear.d.ts +0 -14
  1066. package/dist/integrations/linear.js +0 -80
  1067. package/dist/integrations/linear.js.map +0 -1
  1068. package/dist/integrations/paper-local.d.ts +0 -14
  1069. package/dist/integrations/paper-local.js +0 -10
  1070. package/dist/integrations/paper-local.js.map +0 -1
  1071. package/dist/integrations/paper.d.ts +0 -2
  1072. package/dist/integrations/paper.js +0 -10
  1073. package/dist/integrations/paper.js.map +0 -1
  1074. package/dist/integrations/pipedrive.d.ts +0 -26
  1075. package/dist/integrations/pipedrive.js +0 -97
  1076. package/dist/integrations/pipedrive.js.map +0 -1
  1077. package/dist/integrations/registry.d.ts +0 -8
  1078. package/dist/integrations/registry.js +0 -7
  1079. package/dist/integrations/registry.js.map +0 -1
  1080. package/dist/integrations/types.d.ts +0 -43
  1081. package/dist/integrations/types.js +0 -5
  1082. package/dist/integrations/types.js.map +0 -1
  1083. package/dist/lib/lib/utils.d.ts +0 -2
  1084. package/dist/lib/lib/utils.js +0 -6
  1085. package/dist/lib/lib/utils.js.map +0 -1
  1086. package/dist/mcp/connectors/asana.d.ts +0 -2
  1087. package/dist/mcp/connectors/asana.js +0 -20
  1088. package/dist/mcp/connectors/asana.js.map +0 -1
  1089. package/dist/mcp/connectors/definitions.d.ts +0 -45
  1090. package/dist/mcp/connectors/definitions.js +0 -32
  1091. package/dist/mcp/connectors/definitions.js.map +0 -1
  1092. package/dist/mcp/connectors/figma.d.ts +0 -5
  1093. package/dist/mcp/connectors/figma.js +0 -21
  1094. package/dist/mcp/connectors/figma.js.map +0 -1
  1095. package/dist/mcp/connectors/gdrive.d.ts +0 -2
  1096. package/dist/mcp/connectors/gdrive.js +0 -20
  1097. package/dist/mcp/connectors/gdrive.js.map +0 -1
  1098. package/dist/mcp/connectors/granola.d.ts +0 -2
  1099. package/dist/mcp/connectors/granola.js +0 -12
  1100. package/dist/mcp/connectors/granola.js.map +0 -1
  1101. package/dist/mcp/connectors/linear.d.ts +0 -2
  1102. package/dist/mcp/connectors/linear.js +0 -19
  1103. package/dist/mcp/connectors/linear.js.map +0 -1
  1104. package/dist/mcp/connectors/obsidian.d.ts +0 -2
  1105. package/dist/mcp/connectors/obsidian.js +0 -19
  1106. package/dist/mcp/connectors/obsidian.js.map +0 -1
  1107. package/dist/mcp/connectors/pipedrive.d.ts +0 -2
  1108. package/dist/mcp/connectors/pipedrive.js +0 -20
  1109. package/dist/mcp/connectors/pipedrive.js.map +0 -1
  1110. package/dist/mcp/connectors/slack.d.ts +0 -2
  1111. package/dist/mcp/connectors/slack.js +0 -21
  1112. package/dist/mcp/connectors/slack.js.map +0 -1
  1113. package/dist/mcp/server-oauth-provider.d.ts +0 -56
  1114. package/dist/mcp/server-oauth-provider.js +0 -142
  1115. package/dist/mcp/server-oauth-provider.js.map +0 -1
  1116. package/dist/renderers/documents/branding.d.ts +0 -2
  1117. package/dist/renderers/documents/branding.js +0 -42
  1118. package/dist/renderers/documents/branding.js.map +0 -1
  1119. package/dist/renderers/documents/entity-types.json +0 -14
  1120. package/dist/renderers/documents/parser/frontmatter.d.ts +0 -5
  1121. package/dist/renderers/documents/parser/frontmatter.js +0 -90
  1122. package/dist/renderers/documents/parser/frontmatter.js.map +0 -1
  1123. package/dist/renderers/documents/parser/index.d.ts +0 -5
  1124. package/dist/renderers/documents/parser/index.js +0 -142
  1125. package/dist/renderers/documents/parser/index.js.map +0 -1
  1126. package/dist/renderers/documents/parser/sections.d.ts +0 -18
  1127. package/dist/renderers/documents/parser/sections.js +0 -131
  1128. package/dist/renderers/documents/parser/sections.js.map +0 -1
  1129. package/dist/renderers/documents/pdf/generator.d.ts +0 -13
  1130. package/dist/renderers/documents/pdf/generator.js +0 -79
  1131. package/dist/renderers/documents/pdf/generator.js.map +0 -1
  1132. package/dist/renderers/documents/plugin.d.ts +0 -2
  1133. package/dist/renderers/documents/plugin.js +0 -63
  1134. package/dist/renderers/documents/plugin.js.map +0 -1
  1135. package/dist/renderers/documents/public/branding/logo.svg +0 -3
  1136. package/dist/renderers/documents/public/editor/chrome.css +0 -461
  1137. package/dist/renderers/documents/public/editor/chrome.js +0 -524
  1138. package/dist/renderers/documents/public/editor/editor.css +0 -751
  1139. package/dist/renderers/documents/public/editor/editor.html +0 -140
  1140. package/dist/renderers/documents/public/editor/editor.js +0 -953
  1141. package/dist/renderers/documents/public/fonts/fonts.css +0 -145
  1142. package/dist/renderers/documents/public/viewer/viewer.css +0 -1
  1143. package/dist/renderers/documents/public/viewer/viewer.js +0 -4
  1144. package/dist/renderers/documents/renderer/back.d.ts +0 -8
  1145. package/dist/renderers/documents/renderer/back.js +0 -28
  1146. package/dist/renderers/documents/renderer/back.js.map +0 -1
  1147. package/dist/renderers/documents/renderer/content.d.ts +0 -7
  1148. package/dist/renderers/documents/renderer/content.js +0 -25
  1149. package/dist/renderers/documents/renderer/content.js.map +0 -1
  1150. package/dist/renderers/documents/renderer/cover.d.ts +0 -15
  1151. package/dist/renderers/documents/renderer/cover.js +0 -43
  1152. package/dist/renderers/documents/renderer/cover.js.map +0 -1
  1153. package/dist/renderers/documents/renderer/helpers.d.ts +0 -1
  1154. package/dist/renderers/documents/renderer/helpers.js +0 -11
  1155. package/dist/renderers/documents/renderer/helpers.js.map +0 -1
  1156. package/dist/renderers/documents/renderer/index.d.ts +0 -32
  1157. package/dist/renderers/documents/renderer/index.js +0 -80
  1158. package/dist/renderers/documents/renderer/index.js.map +0 -1
  1159. package/dist/renderers/documents/renderer/styles.d.ts +0 -16
  1160. package/dist/renderers/documents/renderer/styles.js +0 -546
  1161. package/dist/renderers/documents/renderer/styles.js.map +0 -1
  1162. package/dist/renderers/documents/routes/api.d.ts +0 -2
  1163. package/dist/renderers/documents/routes/api.js +0 -587
  1164. package/dist/renderers/documents/routes/api.js.map +0 -1
  1165. package/dist/renderers/documents/routes/editor.d.ts +0 -2
  1166. package/dist/renderers/documents/routes/editor.js +0 -31
  1167. package/dist/renderers/documents/routes/editor.js.map +0 -1
  1168. package/dist/renderers/documents/routes/viewer.d.ts +0 -2
  1169. package/dist/renderers/documents/routes/viewer.js +0 -67
  1170. package/dist/renderers/documents/routes/viewer.js.map +0 -1
  1171. package/dist/renderers/documents/types.d.ts +0 -61
  1172. package/dist/renderers/documents/types.js +0 -2
  1173. package/dist/renderers/documents/types.js.map +0 -1
  1174. package/dist/renderers/index.d.ts +0 -24
  1175. package/dist/renderers/index.js +0 -66
  1176. package/dist/renderers/index.js.map +0 -1
  1177. package/dist/renderers/slides/design-system/tokens.d.ts +0 -108
  1178. package/dist/renderers/slides/design-system/tokens.js +0 -44
  1179. package/dist/renderers/slides/design-system/tokens.js.map +0 -1
  1180. package/dist/renderers/slides/entity-types.json +0 -14
  1181. package/dist/renderers/slides/parser/comment-parser.d.ts +0 -10
  1182. package/dist/renderers/slides/parser/comment-parser.js +0 -89
  1183. package/dist/renderers/slides/parser/comment-parser.js.map +0 -1
  1184. package/dist/renderers/slides/parser/frontmatter.d.ts +0 -10
  1185. package/dist/renderers/slides/parser/frontmatter.js +0 -93
  1186. package/dist/renderers/slides/parser/frontmatter.js.map +0 -1
  1187. package/dist/renderers/slides/parser/index.d.ts +0 -7
  1188. package/dist/renderers/slides/parser/index.js +0 -569
  1189. package/dist/renderers/slides/parser/index.js.map +0 -1
  1190. package/dist/renderers/slides/parser/slide-splitter.d.ts +0 -6
  1191. package/dist/renderers/slides/parser/slide-splitter.js +0 -54
  1192. package/dist/renderers/slides/parser/slide-splitter.js.map +0 -1
  1193. package/dist/renderers/slides/parser/type-detector.d.ts +0 -6
  1194. package/dist/renderers/slides/parser/type-detector.js +0 -70
  1195. package/dist/renderers/slides/parser/type-detector.js.map +0 -1
  1196. package/dist/renderers/slides/pdf/generator.d.ts +0 -11
  1197. package/dist/renderers/slides/pdf/generator.js +0 -105
  1198. package/dist/renderers/slides/pdf/generator.js.map +0 -1
  1199. package/dist/renderers/slides/plugin.d.ts +0 -2
  1200. package/dist/renderers/slides/plugin.js +0 -70
  1201. package/dist/renderers/slides/plugin.js.map +0 -1
  1202. package/dist/renderers/slides/public/editor/.gitkeep +0 -0
  1203. package/dist/renderers/slides/public/editor/chrome.css +0 -461
  1204. package/dist/renderers/slides/public/editor/chrome.js +0 -519
  1205. package/dist/renderers/slides/public/editor/editor.css +0 -896
  1206. package/dist/renderers/slides/public/editor/editor.html +0 -131
  1207. package/dist/renderers/slides/public/editor/editor.js +0 -1038
  1208. package/dist/renderers/slides/public/fonts/fonts.css +0 -145
  1209. package/dist/renderers/slides/public/viewer/.gitkeep +0 -0
  1210. package/dist/renderers/slides/public/viewer/chrome.css +0 -62
  1211. package/dist/renderers/slides/public/viewer/transitions.css +0 -1
  1212. package/dist/renderers/slides/public/viewer/viewer.css +0 -2145
  1213. package/dist/renderers/slides/public/viewer/viewer.js +0 -303
  1214. package/dist/renderers/slides/renderer/chrome/browser-frame.d.ts +0 -5
  1215. package/dist/renderers/slides/renderer/chrome/browser-frame.js +0 -22
  1216. package/dist/renderers/slides/renderer/chrome/browser-frame.js.map +0 -1
  1217. package/dist/renderers/slides/renderer/chrome/mobile-frame.d.ts +0 -6
  1218. package/dist/renderers/slides/renderer/chrome/mobile-frame.js +0 -18
  1219. package/dist/renderers/slides/renderer/chrome/mobile-frame.js.map +0 -1
  1220. package/dist/renderers/slides/renderer/helpers.d.ts +0 -13
  1221. package/dist/renderers/slides/renderer/helpers.js +0 -33
  1222. package/dist/renderers/slides/renderer/helpers.js.map +0 -1
  1223. package/dist/renderers/slides/renderer/index.d.ts +0 -16
  1224. package/dist/renderers/slides/renderer/index.js +0 -160
  1225. package/dist/renderers/slides/renderer/index.js.map +0 -1
  1226. package/dist/renderers/slides/renderer/layouts/agenda.d.ts +0 -2
  1227. package/dist/renderers/slides/renderer/layouts/agenda.js +0 -18
  1228. package/dist/renderers/slides/renderer/layouts/agenda.js.map +0 -1
  1229. package/dist/renderers/slides/renderer/layouts/blank.d.ts +0 -2
  1230. package/dist/renderers/slides/renderer/layouts/blank.js +0 -4
  1231. package/dist/renderers/slides/renderer/layouts/blank.js.map +0 -1
  1232. package/dist/renderers/slides/renderer/layouts/columns.d.ts +0 -2
  1233. package/dist/renderers/slides/renderer/layouts/columns.js +0 -32
  1234. package/dist/renderers/slides/renderer/layouts/columns.js.map +0 -1
  1235. package/dist/renderers/slides/renderer/layouts/cover.d.ts +0 -2
  1236. package/dist/renderers/slides/renderer/layouts/cover.js +0 -18
  1237. package/dist/renderers/slides/renderer/layouts/cover.js.map +0 -1
  1238. package/dist/renderers/slides/renderer/layouts/diagram-concentric.d.ts +0 -2
  1239. package/dist/renderers/slides/renderer/layouts/diagram-concentric.js +0 -120
  1240. package/dist/renderers/slides/renderer/layouts/diagram-concentric.js.map +0 -1
  1241. package/dist/renderers/slides/renderer/layouts/diagram-matrix.d.ts +0 -2
  1242. package/dist/renderers/slides/renderer/layouts/diagram-matrix.js +0 -158
  1243. package/dist/renderers/slides/renderer/layouts/diagram-matrix.js.map +0 -1
  1244. package/dist/renderers/slides/renderer/layouts/diagram-pyramid.d.ts +0 -2
  1245. package/dist/renderers/slides/renderer/layouts/diagram-pyramid.js +0 -86
  1246. package/dist/renderers/slides/renderer/layouts/diagram-pyramid.js.map +0 -1
  1247. package/dist/renderers/slides/renderer/layouts/diagram-sitemap.d.ts +0 -2
  1248. package/dist/renderers/slides/renderer/layouts/diagram-sitemap.js +0 -146
  1249. package/dist/renderers/slides/renderer/layouts/diagram-sitemap.js.map +0 -1
  1250. package/dist/renderers/slides/renderer/layouts/diagram-venn.d.ts +0 -2
  1251. package/dist/renderers/slides/renderer/layouts/diagram-venn.js +0 -100
  1252. package/dist/renderers/slides/renderer/layouts/diagram-venn.js.map +0 -1
  1253. package/dist/renderers/slides/renderer/layouts/diagram.d.ts +0 -2
  1254. package/dist/renderers/slides/renderer/layouts/diagram.js +0 -21
  1255. package/dist/renderers/slides/renderer/layouts/diagram.js.map +0 -1
  1256. package/dist/renderers/slides/renderer/layouts/divider.d.ts +0 -2
  1257. package/dist/renderers/slides/renderer/layouts/divider.js +0 -4
  1258. package/dist/renderers/slides/renderer/layouts/divider.js.map +0 -1
  1259. package/dist/renderers/slides/renderer/layouts/end.d.ts +0 -2
  1260. package/dist/renderers/slides/renderer/layouts/end.js +0 -8
  1261. package/dist/renderers/slides/renderer/layouts/end.js.map +0 -1
  1262. package/dist/renderers/slides/renderer/layouts/framework.d.ts +0 -2
  1263. package/dist/renderers/slides/renderer/layouts/framework.js +0 -47
  1264. package/dist/renderers/slides/renderer/layouts/framework.js.map +0 -1
  1265. package/dist/renderers/slides/renderer/layouts/image-browser-2up.d.ts +0 -2
  1266. package/dist/renderers/slides/renderer/layouts/image-browser-2up.js +0 -38
  1267. package/dist/renderers/slides/renderer/layouts/image-browser-2up.js.map +0 -1
  1268. package/dist/renderers/slides/renderer/layouts/image-browser-6up.d.ts +0 -2
  1269. package/dist/renderers/slides/renderer/layouts/image-browser-6up.js +0 -30
  1270. package/dist/renderers/slides/renderer/layouts/image-browser-6up.js.map +0 -1
  1271. package/dist/renderers/slides/renderer/layouts/image-browser.d.ts +0 -2
  1272. package/dist/renderers/slides/renderer/layouts/image-browser.js +0 -18
  1273. package/dist/renderers/slides/renderer/layouts/image-browser.js.map +0 -1
  1274. package/dist/renderers/slides/renderer/layouts/image-bullets.d.ts +0 -2
  1275. package/dist/renderers/slides/renderer/layouts/image-bullets.js +0 -26
  1276. package/dist/renderers/slides/renderer/layouts/image-bullets.js.map +0 -1
  1277. package/dist/renderers/slides/renderer/layouts/image-device-pair.d.ts +0 -2
  1278. package/dist/renderers/slides/renderer/layouts/image-device-pair.js +0 -34
  1279. package/dist/renderers/slides/renderer/layouts/image-device-pair.js.map +0 -1
  1280. package/dist/renderers/slides/renderer/layouts/image-full.d.ts +0 -2
  1281. package/dist/renderers/slides/renderer/layouts/image-full.js +0 -36
  1282. package/dist/renderers/slides/renderer/layouts/image-full.js.map +0 -1
  1283. package/dist/renderers/slides/renderer/layouts/image-grid-2x2.d.ts +0 -2
  1284. package/dist/renderers/slides/renderer/layouts/image-grid-2x2.js +0 -23
  1285. package/dist/renderers/slides/renderer/layouts/image-grid-2x2.js.map +0 -1
  1286. package/dist/renderers/slides/renderer/layouts/image-keywords.d.ts +0 -2
  1287. package/dist/renderers/slides/renderer/layouts/image-keywords.js +0 -31
  1288. package/dist/renderers/slides/renderer/layouts/image-keywords.js.map +0 -1
  1289. package/dist/renderers/slides/renderer/layouts/image-mobile-3up.d.ts +0 -2
  1290. package/dist/renderers/slides/renderer/layouts/image-mobile-3up.js +0 -22
  1291. package/dist/renderers/slides/renderer/layouts/image-mobile-3up.js.map +0 -1
  1292. package/dist/renderers/slides/renderer/layouts/image-mobile.d.ts +0 -2
  1293. package/dist/renderers/slides/renderer/layouts/image-mobile.js +0 -17
  1294. package/dist/renderers/slides/renderer/layouts/image-mobile.js.map +0 -1
  1295. package/dist/renderers/slides/renderer/layouts/image-split-right.d.ts +0 -2
  1296. package/dist/renderers/slides/renderer/layouts/image-split-right.js +0 -19
  1297. package/dist/renderers/slides/renderer/layouts/image-split-right.js.map +0 -1
  1298. package/dist/renderers/slides/renderer/layouts/image-split.d.ts +0 -2
  1299. package/dist/renderers/slides/renderer/layouts/image-split.js +0 -19
  1300. package/dist/renderers/slides/renderer/layouts/image-split.js.map +0 -1
  1301. package/dist/renderers/slides/renderer/layouts/introductions.d.ts +0 -2
  1302. package/dist/renderers/slides/renderer/layouts/introductions.js +0 -41
  1303. package/dist/renderers/slides/renderer/layouts/introductions.js.map +0 -1
  1304. package/dist/renderers/slides/renderer/layouts/moodboard.d.ts +0 -15
  1305. package/dist/renderers/slides/renderer/layouts/moodboard.js +0 -63
  1306. package/dist/renderers/slides/renderer/layouts/moodboard.js.map +0 -1
  1307. package/dist/renderers/slides/renderer/layouts/next-steps.d.ts +0 -2
  1308. package/dist/renderers/slides/renderer/layouts/next-steps.js +0 -13
  1309. package/dist/renderers/slides/renderer/layouts/next-steps.js.map +0 -1
  1310. package/dist/renderers/slides/renderer/layouts/pullquote.d.ts +0 -2
  1311. package/dist/renderers/slides/renderer/layouts/pullquote.js +0 -17
  1312. package/dist/renderers/slides/renderer/layouts/pullquote.js.map +0 -1
  1313. package/dist/renderers/slides/renderer/layouts/schedule.d.ts +0 -2
  1314. package/dist/renderers/slides/renderer/layouts/schedule.js +0 -58
  1315. package/dist/renderers/slides/renderer/layouts/schedule.js.map +0 -1
  1316. package/dist/renderers/slides/renderer/layouts/section.d.ts +0 -2
  1317. package/dist/renderers/slides/renderer/layouts/section.js +0 -18
  1318. package/dist/renderers/slides/renderer/layouts/section.js.map +0 -1
  1319. package/dist/renderers/slides/renderer/layouts/statement.d.ts +0 -2
  1320. package/dist/renderers/slides/renderer/layouts/statement.js +0 -13
  1321. package/dist/renderers/slides/renderer/layouts/statement.js.map +0 -1
  1322. package/dist/renderers/slides/renderer/layouts/stats.d.ts +0 -2
  1323. package/dist/renderers/slides/renderer/layouts/stats.js +0 -26
  1324. package/dist/renderers/slides/renderer/layouts/stats.js.map +0 -1
  1325. package/dist/renderers/slides/renderer/layouts/table.d.ts +0 -2
  1326. package/dist/renderers/slides/renderer/layouts/table.js +0 -23
  1327. package/dist/renderers/slides/renderer/layouts/table.js.map +0 -1
  1328. package/dist/renderers/slides/renderer/layouts/text-body.d.ts +0 -2
  1329. package/dist/renderers/slides/renderer/layouts/text-body.js +0 -14
  1330. package/dist/renderers/slides/renderer/layouts/text-body.js.map +0 -1
  1331. package/dist/renderers/slides/renderer/placeholder.d.ts +0 -5
  1332. package/dist/renderers/slides/renderer/placeholder.js +0 -12
  1333. package/dist/renderers/slides/renderer/placeholder.js.map +0 -1
  1334. package/dist/renderers/slides/routes/api.d.ts +0 -2
  1335. package/dist/renderers/slides/routes/api.js +0 -568
  1336. package/dist/renderers/slides/routes/api.js.map +0 -1
  1337. package/dist/renderers/slides/routes/editor.d.ts +0 -2
  1338. package/dist/renderers/slides/routes/editor.js +0 -32
  1339. package/dist/renderers/slides/routes/editor.js.map +0 -1
  1340. package/dist/renderers/slides/routes/viewer.d.ts +0 -2
  1341. package/dist/renderers/slides/routes/viewer.js +0 -67
  1342. package/dist/renderers/slides/routes/viewer.js.map +0 -1
  1343. package/dist/renderers/slides/types.d.ts +0 -111
  1344. package/dist/renderers/slides/types.js +0 -2
  1345. package/dist/renderers/slides/types.js.map +0 -1
  1346. package/dist/server/agents/agent-loader.d.ts +0 -16
  1347. package/dist/server/agents/agent-loader.js +0 -175
  1348. package/dist/server/agents/agent-loader.js.map +0 -1
  1349. package/dist/server/agents/agent-runner.d.ts +0 -33
  1350. package/dist/server/agents/agent-runner.js +0 -187
  1351. package/dist/server/agents/agent-runner.js.map +0 -1
  1352. package/dist/server/agents/agent-runtime.d.ts +0 -39
  1353. package/dist/server/agents/agent-runtime.js +0 -214
  1354. package/dist/server/agents/agent-runtime.js.map +0 -1
  1355. package/dist/server/agents/base-agent.d.ts +0 -30
  1356. package/dist/server/agents/base-agent.js +0 -88
  1357. package/dist/server/agents/base-agent.js.map +0 -1
  1358. package/dist/server/agents/executive-digest.d.ts +0 -16
  1359. package/dist/server/agents/executive-digest.js +0 -115
  1360. package/dist/server/agents/executive-digest.js.map +0 -1
  1361. package/dist/server/agents/graph-steward.d.ts +0 -16
  1362. package/dist/server/agents/graph-steward.js +0 -59
  1363. package/dist/server/agents/graph-steward.js.map +0 -1
  1364. package/dist/server/agents/meeting-followup.d.ts +0 -16
  1365. package/dist/server/agents/meeting-followup.js +0 -88
  1366. package/dist/server/agents/meeting-followup.js.map +0 -1
  1367. package/dist/server/agents/pipeline-monitor.d.ts +0 -15
  1368. package/dist/server/agents/pipeline-monitor.js +0 -86
  1369. package/dist/server/agents/pipeline-monitor.js.map +0 -1
  1370. package/dist/server/agents/types.d.ts +0 -81
  1371. package/dist/server/agents/types.js +0 -41
  1372. package/dist/server/agents/types.js.map +0 -1
  1373. package/dist/server/chrome/chrome.css +0 -701
  1374. package/dist/server/chrome/chrome.js +0 -374
  1375. package/dist/server/collab-authority.d.ts +0 -70
  1376. package/dist/server/collab-authority.js +0 -218
  1377. package/dist/server/collab-authority.js.map +0 -1
  1378. package/dist/server/collab.d.ts +0 -29
  1379. package/dist/server/collab.js +0 -195
  1380. package/dist/server/collab.js.map +0 -1
  1381. package/dist/server/commit-scheduler.d.ts +0 -39
  1382. package/dist/server/commit-scheduler.js +0 -113
  1383. package/dist/server/commit-scheduler.js.map +0 -1
  1384. package/dist/server/plugin-loader.d.ts +0 -53
  1385. package/dist/server/plugin-loader.js +0 -155
  1386. package/dist/server/plugin-loader.js.map +0 -1
  1387. package/dist/server/routes/agents-api.d.ts +0 -10
  1388. package/dist/server/routes/agents-api.js +0 -25
  1389. package/dist/server/routes/agents-api.js.map +0 -1
  1390. package/dist/server/routes/collab.d.ts +0 -6
  1391. package/dist/server/routes/collab.js +0 -10
  1392. package/dist/server/routes/collab.js.map +0 -1
  1393. package/dist/server/routes/features-api.d.ts +0 -10
  1394. package/dist/server/routes/features-api.js +0 -15
  1395. package/dist/server/routes/features-api.js.map +0 -1
  1396. package/dist/server/routes/git-api.d.ts +0 -9
  1397. package/dist/server/routes/git-api.js +0 -82
  1398. package/dist/server/routes/git-api.js.map +0 -1
  1399. package/dist/server/routes/meeting-ingest-api.d.ts +0 -14
  1400. package/dist/server/routes/meeting-ingest-api.js +0 -117
  1401. package/dist/server/routes/meeting-ingest-api.js.map +0 -1
  1402. package/dist/server/routes/messages-api.d.ts +0 -15
  1403. package/dist/server/routes/messages-api.js +0 -569
  1404. package/dist/server/routes/messages-api.js.map +0 -1
  1405. package/dist/server/routes/sync-api.d.ts +0 -26
  1406. package/dist/server/routes/sync-api.js +0 -848
  1407. package/dist/server/routes/sync-api.js.map +0 -1
  1408. package/dist/server/routes/view-public.d.ts +0 -10
  1409. package/dist/server/routes/view-public.js +0 -107
  1410. package/dist/server/routes/view-public.js.map +0 -1
  1411. package/dist/server/routes/webhook.d.ts +0 -14
  1412. package/dist/server/routes/webhook.js +0 -102
  1413. package/dist/server/routes/webhook.js.map +0 -1
  1414. package/dist/services/batch-processor.d.ts +0 -49
  1415. package/dist/services/batch-processor.js +0 -166
  1416. package/dist/services/batch-processor.js.map +0 -1
  1417. package/dist/services/briefing.d.ts +0 -26
  1418. package/dist/services/briefing.js +0 -206
  1419. package/dist/services/briefing.js.map +0 -1
  1420. package/dist/services/github-provisioner.d.ts +0 -36
  1421. package/dist/services/github-provisioner.js +0 -126
  1422. package/dist/services/github-provisioner.js.map +0 -1
  1423. package/dist/services/github-service.d.ts +0 -99
  1424. package/dist/services/github-service.js +0 -310
  1425. package/dist/services/github-service.js.map +0 -1
  1426. package/dist/services/heartbeat.d.ts +0 -35
  1427. package/dist/services/heartbeat.js +0 -236
  1428. package/dist/services/heartbeat.js.map +0 -1
  1429. package/dist/services/image-import-service.d.ts +0 -24
  1430. package/dist/services/image-import-service.js +0 -108
  1431. package/dist/services/image-import-service.js.map +0 -1
  1432. package/dist/services/insights.d.ts +0 -38
  1433. package/dist/services/insights.js +0 -269
  1434. package/dist/services/insights.js.map +0 -1
  1435. package/dist/services/meeting-processor.d.ts +0 -97
  1436. package/dist/services/meeting-processor.js +0 -382
  1437. package/dist/services/meeting-processor.js.map +0 -1
  1438. package/dist/services/message-service.d.ts +0 -117
  1439. package/dist/services/message-service.js +0 -414
  1440. package/dist/services/message-service.js.map +0 -1
  1441. package/dist/services/sync/collection-sync.d.ts +0 -60
  1442. package/dist/services/sync/collection-sync.js +0 -509
  1443. package/dist/services/sync/collection-sync.js.map +0 -1
  1444. package/dist/services/sync/commit.d.ts +0 -60
  1445. package/dist/services/sync/commit.js +0 -354
  1446. package/dist/services/sync/commit.js.map +0 -1
  1447. package/dist/services/sync/context-index.d.ts +0 -69
  1448. package/dist/services/sync/context-index.js +0 -280
  1449. package/dist/services/sync/context-index.js.map +0 -1
  1450. package/dist/services/sync/data-fetcher.d.ts +0 -31
  1451. package/dist/services/sync/data-fetcher.js +0 -12
  1452. package/dist/services/sync/data-fetcher.js.map +0 -1
  1453. package/dist/services/sync/derive.d.ts +0 -34
  1454. package/dist/services/sync/derive.js +0 -164
  1455. package/dist/services/sync/derive.js.map +0 -1
  1456. package/dist/services/sync/enrichment-state.d.ts +0 -31
  1457. package/dist/services/sync/enrichment-state.js +0 -63
  1458. package/dist/services/sync/enrichment-state.js.map +0 -1
  1459. package/dist/services/sync/enrichment.d.ts +0 -25
  1460. package/dist/services/sync/enrichment.js +0 -121
  1461. package/dist/services/sync/enrichment.js.map +0 -1
  1462. package/dist/services/sync/entity-refresh.d.ts +0 -30
  1463. package/dist/services/sync/entity-refresh.js +0 -275
  1464. package/dist/services/sync/entity-refresh.js.map +0 -1
  1465. package/dist/services/sync/frontmatter-extractor.d.ts +0 -40
  1466. package/dist/services/sync/frontmatter-extractor.js +0 -279
  1467. package/dist/services/sync/frontmatter-extractor.js.map +0 -1
  1468. package/dist/services/sync/graph-match-state.d.ts +0 -33
  1469. package/dist/services/sync/graph-match-state.js +0 -61
  1470. package/dist/services/sync/graph-match-state.js.map +0 -1
  1471. package/dist/services/sync/graph-match.d.ts +0 -53
  1472. package/dist/services/sync/graph-match.js +0 -316
  1473. package/dist/services/sync/graph-match.js.map +0 -1
  1474. package/dist/services/sync/graphrag-client.d.ts +0 -43
  1475. package/dist/services/sync/graphrag-client.js +0 -94
  1476. package/dist/services/sync/graphrag-client.js.map +0 -1
  1477. package/dist/services/sync/graphrag-config.d.ts +0 -16
  1478. package/dist/services/sync/graphrag-config.js +0 -39
  1479. package/dist/services/sync/graphrag-config.js.map +0 -1
  1480. package/dist/services/sync/graphrag-context.d.ts +0 -14
  1481. package/dist/services/sync/graphrag-context.js +0 -109
  1482. package/dist/services/sync/graphrag-context.js.map +0 -1
  1483. package/dist/services/sync/graphrag-indexer.d.ts +0 -30
  1484. package/dist/services/sync/graphrag-indexer.js +0 -358
  1485. package/dist/services/sync/graphrag-indexer.js.map +0 -1
  1486. package/dist/services/sync/llm.d.ts +0 -32
  1487. package/dist/services/sync/llm.js +0 -115
  1488. package/dist/services/sync/llm.js.map +0 -1
  1489. package/dist/services/sync/mcp-client.d.ts +0 -71
  1490. package/dist/services/sync/mcp-client.js +0 -299
  1491. package/dist/services/sync/mcp-client.js.map +0 -1
  1492. package/dist/services/sync/model-factory.d.ts +0 -13
  1493. package/dist/services/sync/model-factory.js +0 -38
  1494. package/dist/services/sync/model-factory.js.map +0 -1
  1495. package/dist/services/sync/name-quality.d.ts +0 -31
  1496. package/dist/services/sync/name-quality.js +0 -60
  1497. package/dist/services/sync/name-quality.js.map +0 -1
  1498. package/dist/services/sync/output-schemas.d.ts +0 -92
  1499. package/dist/services/sync/output-schemas.js +0 -43
  1500. package/dist/services/sync/output-schemas.js.map +0 -1
  1501. package/dist/services/sync/prompts.d.ts +0 -19
  1502. package/dist/services/sync/prompts.js +0 -128
  1503. package/dist/services/sync/prompts.js.map +0 -1
  1504. package/dist/services/sync/reconciler.d.ts +0 -48
  1505. package/dist/services/sync/reconciler.js +0 -294
  1506. package/dist/services/sync/reconciler.js.map +0 -1
  1507. package/dist/services/sync/rest-client.d.ts +0 -40
  1508. package/dist/services/sync/rest-client.js +0 -100
  1509. package/dist/services/sync/rest-client.js.map +0 -1
  1510. package/dist/services/sync/source-config.d.ts +0 -67
  1511. package/dist/services/sync/source-config.js +0 -304
  1512. package/dist/services/sync/source-config.js.map +0 -1
  1513. package/dist/services/sync/source-definitions/asana.d.ts +0 -14
  1514. package/dist/services/sync/source-definitions/asana.js +0 -42
  1515. package/dist/services/sync/source-definitions/asana.js.map +0 -1
  1516. package/dist/services/sync/source-definitions/definitions.d.ts +0 -8
  1517. package/dist/services/sync/source-definitions/definitions.js +0 -8
  1518. package/dist/services/sync/source-definitions/definitions.js.map +0 -1
  1519. package/dist/services/sync/source-definitions/gdrive.d.ts +0 -16
  1520. package/dist/services/sync/source-definitions/gdrive.js +0 -68
  1521. package/dist/services/sync/source-definitions/gdrive.js.map +0 -1
  1522. package/dist/services/sync/source-definitions/granola.d.ts +0 -2
  1523. package/dist/services/sync/source-definitions/granola.js +0 -21
  1524. package/dist/services/sync/source-definitions/granola.js.map +0 -1
  1525. package/dist/services/sync/source-definitions/linear.d.ts +0 -2
  1526. package/dist/services/sync/source-definitions/linear.js +0 -62
  1527. package/dist/services/sync/source-definitions/linear.js.map +0 -1
  1528. package/dist/services/sync/source-definitions/obsidian.d.ts +0 -2
  1529. package/dist/services/sync/source-definitions/obsidian.js +0 -55
  1530. package/dist/services/sync/source-definitions/obsidian.js.map +0 -1
  1531. package/dist/services/sync/source-definitions/pipedrive.d.ts +0 -2
  1532. package/dist/services/sync/source-definitions/pipedrive.js +0 -43
  1533. package/dist/services/sync/source-definitions/pipedrive.js.map +0 -1
  1534. package/dist/services/sync/staging.d.ts +0 -53
  1535. package/dist/services/sync/staging.js +0 -130
  1536. package/dist/services/sync/staging.js.map +0 -1
  1537. package/dist/services/sync/structured-extractor.d.ts +0 -57
  1538. package/dist/services/sync/structured-extractor.js +0 -584
  1539. package/dist/services/sync/structured-extractor.js.map +0 -1
  1540. package/dist/services/sync/sync-runner.d.ts +0 -32
  1541. package/dist/services/sync/sync-runner.js +0 -195
  1542. package/dist/services/sync/sync-runner.js.map +0 -1
  1543. package/dist/services/sync/sync-state.d.ts +0 -43
  1544. package/dist/services/sync/sync-state.js +0 -154
  1545. package/dist/services/sync/sync-state.js.map +0 -1
  1546. package/dist/services/sync/types.d.ts +0 -381
  1547. package/dist/services/sync/types.js +0 -8
  1548. package/dist/services/sync/types.js.map +0 -1
  1549. package/dist/services/sync/unstructured-extractor.d.ts +0 -27
  1550. package/dist/services/sync/unstructured-extractor.js +0 -185
  1551. package/dist/services/sync/unstructured-extractor.js.map +0 -1
  1552. package/dist/utils/merge-resolver.d.ts +0 -59
  1553. package/dist/utils/merge-resolver.js +0 -303
  1554. package/dist/utils/merge-resolver.js.map +0 -1
  1555. package/dist/utils/workspace-config.d.ts +0 -8
  1556. package/dist/utils/workspace-config.js +0 -22
  1557. package/dist/utils/workspace-config.js.map +0 -1
  1558. package/dist/web/_app/immutable/assets/0.B3eM5J6m.css +0 -1
  1559. package/dist/web/_app/immutable/assets/10.2jzI3cZY.css +0 -1
  1560. package/dist/web/_app/immutable/assets/11.BbBNo8jg.css +0 -1
  1561. package/dist/web/_app/immutable/assets/12.vV-8Nqud.css +0 -1
  1562. package/dist/web/_app/immutable/assets/2.CDsrnCq3.css +0 -1
  1563. package/dist/web/_app/immutable/assets/3.Ih7su2rl.css +0 -1
  1564. package/dist/web/_app/immutable/assets/4.CwXIQz3p.css +0 -1
  1565. package/dist/web/_app/immutable/assets/ChevronLeft.BwM9mwS4.css +0 -1
  1566. package/dist/web/_app/immutable/assets/GraphView.CRV5cekT.css +0 -1
  1567. package/dist/web/_app/immutable/assets/Toaster.rN8r_Hzv.css +0 -1
  1568. package/dist/web/_app/immutable/assets/ViewToolbar.CsWTe0yn.css +0 -1
  1569. package/dist/web/_app/immutable/assets/WorkspaceView.iWtzksrr.css +0 -1
  1570. package/dist/web/_app/immutable/chunks/0kuZ2gtb.js +0 -1
  1571. package/dist/web/_app/immutable/chunks/1Ea1UXwM.js +0 -2
  1572. package/dist/web/_app/immutable/chunks/284Zhbif.js +0 -1
  1573. package/dist/web/_app/immutable/chunks/7S2LGqoP.js +0 -2
  1574. package/dist/web/_app/immutable/chunks/7WZENMwt.js +0 -1
  1575. package/dist/web/_app/immutable/chunks/B0qHb2ee.js +0 -1
  1576. package/dist/web/_app/immutable/chunks/B45od9dM.js +0 -2
  1577. package/dist/web/_app/immutable/chunks/B4hXkypI.js +0 -1
  1578. package/dist/web/_app/immutable/chunks/BB_5th5W.js +0 -3383
  1579. package/dist/web/_app/immutable/chunks/BDvg8O5k.js +0 -5
  1580. package/dist/web/_app/immutable/chunks/BGiCmAMQ.js +0 -4
  1581. package/dist/web/_app/immutable/chunks/BHgT2Ede.js +0 -1
  1582. package/dist/web/_app/immutable/chunks/BQ1nK9ru.js +0 -1
  1583. package/dist/web/_app/immutable/chunks/BS0-13V2.js +0 -1
  1584. package/dist/web/_app/immutable/chunks/BSiC7hSS.js +0 -1
  1585. package/dist/web/_app/immutable/chunks/BkxW0BJZ.js +0 -1
  1586. package/dist/web/_app/immutable/chunks/Bp7FKkGt.js +0 -1
  1587. package/dist/web/_app/immutable/chunks/BrebtJNG.js +0 -18
  1588. package/dist/web/_app/immutable/chunks/Bz0ZjVQE.js +0 -2
  1589. package/dist/web/_app/immutable/chunks/C0LVZhvn.js +0 -1
  1590. package/dist/web/_app/immutable/chunks/C0Zx4tMe.js +0 -1
  1591. package/dist/web/_app/immutable/chunks/CHJcPZZK.js +0 -2
  1592. package/dist/web/_app/immutable/chunks/CRpK3grw.js +0 -2
  1593. package/dist/web/_app/immutable/chunks/CSVbGg_b.js +0 -5
  1594. package/dist/web/_app/immutable/chunks/CX_61fY8.js +0 -5
  1595. package/dist/web/_app/immutable/chunks/CYrVHOHA.js +0 -1
  1596. package/dist/web/_app/immutable/chunks/CdIKiXW6.js +0 -1
  1597. package/dist/web/_app/immutable/chunks/CqkleIqs.js +0 -1
  1598. package/dist/web/_app/immutable/chunks/D14M5KlG.js +0 -1
  1599. package/dist/web/_app/immutable/chunks/D71c9o7J.js +0 -2
  1600. package/dist/web/_app/immutable/chunks/DFYOFE3o.js +0 -1
  1601. package/dist/web/_app/immutable/chunks/DHJAqtPb.js +0 -1
  1602. package/dist/web/_app/immutable/chunks/DOqcDZIJ.js +0 -1
  1603. package/dist/web/_app/immutable/chunks/DQNtFKv6.js +0 -1
  1604. package/dist/web/_app/immutable/chunks/DZHWps9n.js +0 -1
  1605. package/dist/web/_app/immutable/chunks/DjLrjK2H.js +0 -1
  1606. package/dist/web/_app/immutable/chunks/DjvJRtva.js +0 -1
  1607. package/dist/web/_app/immutable/chunks/DnL9f0lc.js +0 -7
  1608. package/dist/web/_app/immutable/chunks/Dqq8gyOz.js +0 -1
  1609. package/dist/web/_app/immutable/chunks/DsnmJJEf.js +0 -1
  1610. package/dist/web/_app/immutable/chunks/DtG1tx2A.js +0 -1
  1611. package/dist/web/_app/immutable/chunks/Dxmmz-Kc.js +0 -1
  1612. package/dist/web/_app/immutable/chunks/DzVOENkg.js +0 -1
  1613. package/dist/web/_app/immutable/chunks/Ee5s0qSS.js +0 -5
  1614. package/dist/web/_app/immutable/chunks/KlRV1tKP.js +0 -1
  1615. package/dist/web/_app/immutable/chunks/L7dfS1-w.js +0 -1
  1616. package/dist/web/_app/immutable/chunks/MaQouOBH.js +0 -2
  1617. package/dist/web/_app/immutable/chunks/PPVm8Dsz.js +0 -1
  1618. package/dist/web/_app/immutable/chunks/WSUKABI_.js +0 -1
  1619. package/dist/web/_app/immutable/chunks/_7ZfIgbM.js +0 -1
  1620. package/dist/web/_app/immutable/chunks/pNJmbo_B.js +0 -1
  1621. package/dist/web/_app/immutable/chunks/q4I7EnCp.js +0 -1
  1622. package/dist/web/_app/immutable/chunks/qE6Hm01v.js +0 -1
  1623. package/dist/web/_app/immutable/chunks/vxEtkL8z.js +0 -1
  1624. package/dist/web/_app/immutable/chunks/wDIGUaoU.js +0 -3
  1625. package/dist/web/_app/immutable/chunks/wZWzupWT.js +0 -1
  1626. package/dist/web/_app/immutable/entry/app.Dc6h105F.js +0 -2
  1627. package/dist/web/_app/immutable/entry/start.D4codAU1.js +0 -1
  1628. package/dist/web/_app/immutable/nodes/0.BM3j5xaK.js +0 -2
  1629. package/dist/web/_app/immutable/nodes/1.CZ2dT63B.js +0 -1
  1630. package/dist/web/_app/immutable/nodes/10.AJJtsnPU.js +0 -1
  1631. package/dist/web/_app/immutable/nodes/11.B7SEgGLF.js +0 -1
  1632. package/dist/web/_app/immutable/nodes/12.BcJKl4UQ.js +0 -1
  1633. package/dist/web/_app/immutable/nodes/2.jp27tyTq.js +0 -269
  1634. package/dist/web/_app/immutable/nodes/3.I7SH_06w.js +0 -5
  1635. package/dist/web/_app/immutable/nodes/4.Bdphc-UJ.js +0 -11
  1636. package/dist/web/_app/immutable/nodes/5.CXpOErnP.js +0 -1
  1637. package/dist/web/_app/immutable/nodes/6.1wcSxmEA.js +0 -1
  1638. package/dist/web/_app/immutable/nodes/7.D0b7WYTp.js +0 -1
  1639. package/dist/web/_app/immutable/nodes/8.D0Gxvy3F.js +0 -1
  1640. package/dist/web/_app/immutable/nodes/9.B5Nr92OR.js +0 -1
@@ -0,0 +1,1427 @@
1
+ /**
2
+ * THE artifact document builder (frame model). Assembles a bundle into ONE
3
+ * sandboxed iframe document, consumed verbatim by every surface — the in-app
4
+ * canvas, the public present page, the standalone export, and the headless
5
+ * Playwright render. There is exactly one renderer.
6
+ *
7
+ * D13 boundary: a single `sandbox="allow-scripts"` document holds all frames in
8
+ * ONE script scope (shared code runs across frames). The platform owns layout —
9
+ * it injects CSS that absolutely-positions each frame container at the rect the
10
+ * shared {@link computeFrameLayout} engine computed; the HOST draws all chrome
11
+ * (labels, selection, pulse, a11y proxies) from those same rects, so chrome can
12
+ * never drift from content and nothing is measured through the sandbox wall.
13
+ *
14
+ * Asset URLs and the CSP both derive from the one {@link AssetResolution}
15
+ * (finalize step), so a document can never carry URLs from one asset model and
16
+ * a policy from another.
17
+ */
18
+ import { DEFAULT_PAGE_MARGINS, isSafeBackgroundValue } from './artifact-frame-model.js';
19
+ import { computeFrameLayout, FRAME_LAYOUT_DEFAULT_GAP } from './artifact-frame-layout.js';
20
+ import { escapeAttribute, escapeHtml, escapeScript, escapeStyle } from './artifact-escape.js';
21
+ import { applyAssetResolution, artifactCsp } from './artifact-asset-resolution.js';
22
+ import { brokenImageScriptTag, libraryTags } from './artifact-libraries.js';
23
+ import { SANITIZE_CSS_URLS_TWIN } from './artifact-paged-css.js';
24
+ /** Cap (ms) on the in-sandbox `document.fonts.ready` wait before Paged.js
25
+ * fragments. The host inlines workspace-asset fonts as data: URLs so this
26
+ * normally resolves immediately; the cap only bites when a font falls back to a
27
+ * slow network endpoint, trading a worst-case late-font reflow for not stalling
28
+ * the canvas for many seconds. Interpolated into the pagination bootstrap. */
29
+ const FONT_READY_TIMEOUT_MS = 2000;
30
+ /** Artboard fill for a frame that opts into `neutral`. The DEFAULT (unset) is
31
+ * transparent — the frame's appearance comes from its own content, so an opaque
32
+ * slide never shows a white artboard peeking around its edges. Authors opt into
33
+ * a white paper with `background: 'neutral'`. */
34
+ const FRAME_ARTBOARD_BACKGROUND = '#ffffff';
35
+ /** The whiteboard surface fill: paper + a dot grid (FigJam feel). The whiteboard
36
+ * is the ONE artifact surface the platform themes (its dot grid is platform-drawn
37
+ * chrome, not author-designed content) — slides/pages/artboard/app keep their
38
+ * authored backgrounds. Two values, one source, shared across every surface (host
39
+ * iframe, present, standalone HTML/PDF export) so the look can't drift:
40
+ * - light: warm off-white paper + a near-black, low-opacity dot grid.
41
+ * - dark: warm slate paper (a step above the app's #09090b base, so the canvas
42
+ * reads as a distinct surface) + a light, low-opacity dot grid.
43
+ * Geometry (1.2px dots / 14px cell) is identical so only color/tone changes. The
44
+ * paper hex is its own const so the surface gradient AND the `--sg-surface` ink
45
+ * token below resolve to ONE value (no paper-vs-token drift). */
46
+ const WB_PAPER_LIGHT = '#fbfaf8';
47
+ const WB_PAPER_DARK = '#1c1a17';
48
+ const WHITEBOARD_SURFACE_LIGHT = `${WB_PAPER_LIGHT} radial-gradient(circle, rgba(20,18,16,0.11) 1px, transparent 1.2px) 0 0 / 14px 14px`;
49
+ const WHITEBOARD_SURFACE_DARK = `${WB_PAPER_DARK} radial-gradient(circle, rgba(240,238,233,0.10) 1px, transparent 1.2px) 0 0 / 14px 14px`;
50
+ function whiteboardSurface(colorScheme) {
51
+ return colorScheme === 'dark' ? WHITEBOARD_SURFACE_DARK : WHITEBOARD_SURFACE_LIGHT;
52
+ }
53
+ /** The whiteboard theme-token CONTRACT. The platform injects these semantic CSS
54
+ * custom properties into the whiteboard iframe so author content can opt into
55
+ * theme-aware "ink" — connector lines, outlines, line-art, mono icons, body
56
+ * type, labels — via `var(--sg-ink)` / `currentColor`, instead of hardcoding a
57
+ * color that goes invisible when the surface flips. The platform NEVER
58
+ * auto-recolors content; it only publishes tokens to opt into. Intentional fills
59
+ * and media (a colored post-it, a photo) stay exactly as the author set them —
60
+ * they sit on their own background, not the bare surface, so they need no token.
61
+ * Tokens resolve from `colorScheme` for the live host; the standalone export
62
+ * emits them under a `prefers-color-scheme` media query (it follows the OS).
63
+ * - `--sg-ink` primary foreground (default ink against the surface).
64
+ * - `--sg-ink-muted` secondary (labels, eyebrows, hairlines).
65
+ * - `--sg-surface` the paper color (so content can draw a panel that matches
66
+ * the board). */
67
+ const WHITEBOARD_INK = { light: '#1c1a18', dark: '#f0eee9' };
68
+ const WHITEBOARD_INK_MUTED = { light: '#6b675f', dark: '#a8a39a' };
69
+ const WB_PAPER = { light: WB_PAPER_LIGHT, dark: WB_PAPER_DARK };
70
+ /** The `:root` declarations for one scheme — the ink contract resolved to values. */
71
+ function whiteboardTokenDecls(scheme) {
72
+ return `--sg-ink:${WHITEBOARD_INK[scheme]};--sg-ink-muted:${WHITEBOARD_INK_MUTED[scheme]};--sg-surface:${WB_PAPER[scheme]};`;
73
+ }
74
+ /** The whiteboard token `<style>` body for a render. Mirrors the surface emission
75
+ * EXACTLY so ink can never disagree with the paper it's drawn on:
76
+ * - live host ('iframe'): resolved to the one scheme the host threaded.
77
+ * - standalone interactive (host 'none' + interactive): light + `@media dark`
78
+ * (follows the OS, like the surface's standalone CSS).
79
+ * - static export (host 'none', non-interactive): light only (print default,
80
+ * like the surface's static frameLayoutCss path). */
81
+ function whiteboardThemeTokensCss(colorScheme, host, standaloneInteractive) {
82
+ if (host === 'iframe')
83
+ return `:root{${whiteboardTokenDecls(colorScheme === 'dark' ? 'dark' : 'light')}}`;
84
+ if (standaloneInteractive)
85
+ return `:root{${whiteboardTokenDecls('light')}}\n@media (prefers-color-scheme: dark){:root{${whiteboardTokenDecls('dark')}}}`;
86
+ return `:root{${whiteboardTokenDecls('light')}}`;
87
+ }
88
+ /** The standalone-export body fill (the area outside the canvas in a downloaded
89
+ * file). A touch darker/lighter than the paper so the canvas floats. */
90
+ const WHITEBOARD_STANDALONE_BODY_LIGHT = '#f4f2ef';
91
+ const WHITEBOARD_STANDALONE_BODY_DARK = '#121110';
92
+ function backgroundValue(background) {
93
+ if (background === undefined)
94
+ return null;
95
+ // Trim first so a padded keyword still resolves and the emitted custom value is
96
+ // clean (mirrors validateBackground's normalization for legacy/unvalidated bodies).
97
+ const v = background.trim();
98
+ if (v === 'transparent')
99
+ return 'transparent';
100
+ if (v === 'neutral')
101
+ return FRAME_ARTBOARD_BACKGROUND;
102
+ // A custom CSS color/gradient (validated at write time by isSafeBackgroundValue).
103
+ // Re-check at emit so a legacy/unvalidated body can never inject a raw value into
104
+ // the `background:…;` declaration; an unsafe value falls back to the default.
105
+ return isSafeBackgroundValue(v) ? v : null;
106
+ }
107
+ /** A frame's effective artboard fill (CSS). Layout-aware default: `pages` and
108
+ * `app` are solid surfaces (white) so a page / app isn't see-through; slides and
109
+ * artboards default transparent so opaque content shows no white border. Explicit
110
+ * `background` (frame- or artifact-level) — a keyword or a custom color/gradient —
111
+ * always wins. */
112
+ function frameBackground(layout, frameBg, displayBg) {
113
+ const solidByDefault = layout === 'pages' || layout === 'app';
114
+ const effective = frameBg ?? displayBg ?? (solidByDefault ? 'neutral' : 'transparent');
115
+ return backgroundValue(effective) ?? 'transparent';
116
+ }
117
+ /** `tokens` → `:root` custom properties. Values are escaped for the `<style>`
118
+ * element AND stripped of `;{}` so a value can't break out of its declaration
119
+ * or the rule (the emit-time guard the frame model documents). */
120
+ function tokensStyleTag(tokens) {
121
+ if (!tokens)
122
+ return '';
123
+ const decls = Object.entries(tokens)
124
+ .map(([key, value]) => {
125
+ const name = key.startsWith('--') ? key : `--${key.replace(/^-+/, '')}`;
126
+ return ` ${name}: ${escapeStyle(value.replace(/[;{}]/g, ' '))};`;
127
+ })
128
+ .join('\n');
129
+ return decls ? `<style data-artifact-tokens>:root {\n${decls}\n}</style>` : '';
130
+ }
131
+ /** Shared stylesheets, inlined as `<style>` (one assembled document). */
132
+ function sharedStyleTags(bundle) {
133
+ const files = bundle.shared?.files;
134
+ if (!files)
135
+ return '';
136
+ return Object.entries(files)
137
+ .filter(([path]) => path.toLowerCase().endsWith('.css'))
138
+ .map(([path, css]) => `<style data-artifact-file="${escapeAttribute(path)}">\n${escapeStyle(css)}\n</style>`)
139
+ .join('\n');
140
+ }
141
+ /** Concatenated shared stylesheet TEXT (raw CSS). Paged.js only honors break
142
+ * rules (`break-before/after/inside`, named pages) from stylesheets handed to
143
+ * its polisher — CSS that merely sits in the document head styles the content
144
+ * visually but is invisible to the fragmenter. So the authored shared CSS is
145
+ * passed to `preview()` alongside the `@page` rule (it is ALSO in the head for
146
+ * global styling; double-application is idempotent). */
147
+ function sharedCssText(bundle) {
148
+ const files = bundle.shared?.files;
149
+ if (!files)
150
+ return '';
151
+ return Object.entries(files)
152
+ .filter(([path]) => path.toLowerCase().endsWith('.css'))
153
+ .map(([, css]) => css)
154
+ .join('\n');
155
+ }
156
+ /** The platform layout CSS: a transparent canvas sized to the total extent, with
157
+ * each frame container absolutely positioned at its computed rect. Fixed frames
158
+ * get an exact height (content clips); auto-height frames grow to content
159
+ * (`min-height` from the estimate, the host reflows once measured). */
160
+ function frameLayoutCss(bundle, layout, colorScheme) {
161
+ const rules = layout.rects
162
+ .map((rect, index) => {
163
+ const frame = bundle.frames[index];
164
+ const auto = frame.geometry.height === 'auto';
165
+ const height = auto ? `min-height:${rect.height}px;height:auto;` : `height:${rect.height}px;`;
166
+ const background = frame.layout === 'whiteboard'
167
+ ? `background:${whiteboardSurface(colorScheme)};`
168
+ : `background:${frameBackground(frame.layout, frame.background, bundle.display?.background)};`;
169
+ // frame.id is constrained to a CSS-safe charset by the model's ID_RE.
170
+ return `[data-sg-frame-id="${frame.id}"]{left:${rect.x}px;top:${rect.y}px;width:${rect.width}px;${height}${background}}`;
171
+ })
172
+ .join('\n');
173
+ return `html,body{margin:0;padding:0;background:transparent;}
174
+ body{position:relative;width:${layout.width}px;height:${layout.height}px;overflow:hidden;}
175
+ [data-sg-frame]{position:absolute;box-sizing:border-box;overflow:hidden;}
176
+ ${rules}`;
177
+ }
178
+ /** The frame containers — each owns its content fragment; the platform CSS above
179
+ * positions it. The host anchors drawn chrome to `data-sg-frame-id`.
180
+ *
181
+ * `activeFirstFrame` statically marks frame 0 `data-sg-present-active` for a
182
+ * host-less present render (PNG/PDF/inspect of the present stage): there is no
183
+ * runtime to call `setActive(0)`, and the present CSS hides every unmarked
184
+ * frame, so without it the capture would be blank. */
185
+ function frameContainersHtml(bundle, activeFirstFrame = false) {
186
+ return bundle.frames
187
+ .map((frame, index) => {
188
+ const label = frame.title || `Frame ${index + 1}`;
189
+ const backgroundAttribute = frame.background ? ` data-sg-bg="${escapeAttribute(frame.background)}"` : '';
190
+ const activeAttribute = activeFirstFrame && index === 0 ? ' data-sg-present-active=""' : '';
191
+ return `<section data-sg-frame data-sg-frame-id="${escapeAttribute(frame.id)}" data-frame-index="${index}" data-frame-layout="${frame.layout}"${backgroundAttribute}${activeAttribute} role="group" aria-label="${escapeAttribute(label)}">${frame.content}</section>`;
192
+ })
193
+ .join('\n');
194
+ }
195
+ /** Shared scripts (cross-frame logic). When curated libraries are requested they
196
+ * load async, so the scripts are deferred behind the library-ready promise;
197
+ * otherwise they emit as plain tags. Per-frame inline scripts run inline. */
198
+ function sharedScriptTags(bundle) {
199
+ const entries = Object.entries(bundle.shared?.files ?? {})
200
+ .filter(([path]) => /\.(m?js)$/i.test(path))
201
+ .map(([path, js]) => ({ path, js, module: path.toLowerCase().endsWith('.mjs') }));
202
+ if (entries.length === 0)
203
+ return '';
204
+ if ((bundle.libraries ?? []).length === 0) {
205
+ return entries
206
+ .map(({ path, js, module }) => `<script${module ? ' type="module"' : ''} data-artifact-file="${escapeAttribute(path)}">\n${escapeScript(js)}\n</script>`)
207
+ .join('\n');
208
+ }
209
+ const payload = JSON.stringify(entries.map((entry) => ({ path: entry.path, js: entry.js, kind: entry.module ? 'module' : 'classic' })));
210
+ return `<script data-artifact-user-scripts>
211
+ (async () => {
212
+ await (window.__STUDIOGRAPH_ARTIFACT_LIBRARIES_READY__ || Promise.resolve());
213
+ const scripts = ${escapeScript(payload)};
214
+ for (const script of scripts) {
215
+ await new Promise((resolve, reject) => {
216
+ const url = URL.createObjectURL(new Blob([String(script.js) + '\\n//# sourceURL=studiograph-artifact://' + String(script.path)], { type: 'text/javascript' }));
217
+ if (script.kind === 'module') { import(url).then(resolve, reject); return; }
218
+ const element = document.createElement('script');
219
+ element.src = url; element.async = false;
220
+ element.onload = () => resolve(); element.onerror = () => reject(new Error('Could not load artifact script: ' + String(script.path)));
221
+ document.head.appendChild(element);
222
+ });
223
+ }
224
+ })().catch((error) => { console.error('Artifact script error', error); throw error; });
225
+ </script>`;
226
+ }
227
+ // ---------------------------------------------------------------------------
228
+ // The host-iframe runtime. Frame-first: it reports per-frame sizes (auto frames
229
+ // need measuring), applies host-computed layout rects, forwards pan/zoom to the
230
+ // host (which owns the transform), and reports element/frame selection. There is
231
+ // NO selector-detected stepper — frames are first-class containers now.
232
+ // ---------------------------------------------------------------------------
233
+ function frameRuntimeScript(artifactId, surface, fullBleed = false, whiteboard = false) {
234
+ return `
235
+ (() => {
236
+ const artifactId = ${JSON.stringify(artifactId)};
237
+ const surface = ${JSON.stringify(surface)};
238
+ const fullBleed = ${JSON.stringify(fullBleed)};
239
+ const whiteboard = ${JSON.stringify(whiteboard)};
240
+ // A whiteboard pans/zooms in BOTH editor and present (it is a large pannable
241
+ // surface, not a stepped deck), so wheel AND hand-drag pan are forwarded to the
242
+ // host in either mode; elsewhere only the editor navigates. In a whiteboard
243
+ // present there is no pointer/hand toolbar, so the hand tool is the default —
244
+ // the surface pans on a plain drag. A whiteboard EDITOR keeps the pointer default
245
+ // (it has the Select / Pan toggle) and the host syncs the active tool.
246
+ const canNavigate = surface === 'editor' || whiteboard;
247
+ let tool = ${JSON.stringify(whiteboard && surface !== 'editor' ? 'hand' : 'pointer')};
248
+ const send = (payload) => { try { parent.postMessage({ channel: 'studiograph-artifact', artifactId, ...payload }, '*'); } catch {} };
249
+ // Show the grab cursor over the canvas (the iframe content) whenever the hand
250
+ // tool is active — the host stage cursor doesn't reach inside the iframe. The
251
+ // pan handlers below swap to 'grabbing' while dragging.
252
+ const applyCursor = () => { try { document.body.style.cursor = (canNavigate && tool === 'hand') ? 'grab' : ''; } catch {} };
253
+ applyCursor();
254
+ const frames = () => Array.from(document.querySelectorAll('[data-sg-frame]'));
255
+ const cssEscape = (value) => (window.CSS && CSS.escape) ? CSS.escape(value) : String(value);
256
+ const frameById = (id) => document.querySelector('[data-sg-frame-id="' + cssEscape(id) + '"]');
257
+
258
+ // --- per-frame size reporting (auto frames; host reflows from these) ---
259
+ const measure = () => frames().map((el) => ({
260
+ id: el.getAttribute('data-sg-frame-id'),
261
+ width: el.offsetWidth,
262
+ height: Math.max(el.scrollHeight, el.offsetHeight),
263
+ }));
264
+ let sizeTimer = null;
265
+ const reportSizes = () => send({ type: 'frame-sizes', sizes: measure() });
266
+ const queueSizes = () => { if (sizeTimer) clearTimeout(sizeTimer); sizeTimer = setTimeout(reportSizes, 150); };
267
+
268
+ // --- apply host-computed layout rects + extent ---
269
+ // The host recomputes the analytic layout when an auto-height frame measures,
270
+ // then sends the new rects AND the new total extent. Frame width comes from
271
+ // the rect; auto frames keep height:auto (content-driven). The body is resized
272
+ // to the extent so a grown auto frame isn't clipped by the baked body box
273
+ // (the host resizes the iframe element to the same extent in lockstep).
274
+ const applyLayout = (rects, width, height) => {
275
+ for (const rect of (rects || [])) {
276
+ const el = frameById(rect.id);
277
+ if (!el) continue;
278
+ el.style.left = rect.x + 'px';
279
+ el.style.top = rect.y + 'px';
280
+ el.style.width = rect.width + 'px';
281
+ }
282
+ if (typeof width === 'number' && width > 0) document.body.style.width = width + 'px';
283
+ if (typeof height === 'number' && height > 0) document.body.style.height = height + 'px';
284
+ };
285
+
286
+ window.addEventListener('message', (event) => {
287
+ const data = event.data;
288
+ if (!data || data.channel !== 'studiograph-artifact-host' || data.artifactId !== artifactId) return;
289
+ if (data.type === 'apply-layout') applyLayout(data.rects, data.width, data.height);
290
+ if (data.type === 'set-tool' && (data.tool === 'pointer' || data.tool === 'hand')) { tool = data.tool; applyCursor(); }
291
+ if (data.type === 'clear-selection') clearSelection();
292
+ if (data.type === 'select-ancestor' && typeof data.index === 'number') selectAncestor(data.index);
293
+ });
294
+
295
+ window.addEventListener('error', (event) => send({ status: 'error', message: String((event && event.message) || 'Artifact error') }));
296
+ window.addEventListener('unhandledrejection', (event) => send({ status: 'error', message: String((event && event.reason && event.reason.message) || (event && event.reason) || 'Artifact promise rejection') }));
297
+ // Observe frames for size changes. The observer is set up AFTER the body has
298
+ // parsed (frames exist) — at head-parse time querySelectorAll is empty — so
299
+ // async content growth (fonts, images, and document pagination, which only
300
+ // settles after load) is reported, not just the one-shot load measure.
301
+ let resizeObserver = null;
302
+ const observeFrames = () => {
303
+ try {
304
+ if (!resizeObserver) resizeObserver = new ResizeObserver(queueSizes);
305
+ else resizeObserver.disconnect();
306
+ for (const el of frames()) resizeObserver.observe(el);
307
+ } catch {}
308
+ };
309
+ // applyCursor() at init is a no-op (it runs in <head>, before <body> exists), so
310
+ // set the cursor again on load — otherwise a present whiteboard (default hand
311
+ // tool) shows the grab cursor only after the first pointer interaction.
312
+ window.addEventListener('load', () => { send({ status: 'ready' }); observeFrames(); reportSizes(); applyCursor(); });
313
+ try { if (document.fonts && document.fonts.ready) document.fonts.ready.then(() => { observeFrames(); reportSizes(); }); } catch {}
314
+
315
+ // --- selection (editor only) ---
316
+ const safeText = (value, limit = 160) => String(value || '').replace(/\\s+/g, ' ').trim().slice(0, limit);
317
+ // Content/interactive elements snap selection to themselves (a click on a
318
+ // heading's text selects the heading, on a button's label the button); any other
319
+ // element selects exactly as itself (see selectionTarget).
320
+ const specificContent = 'h1,h2,h3,h4,h5,h6,p,li,td,th,blockquote,figure,figcaption,label,svg,path,g,rect,circle,text,img,video,a,button,[role="button"]';
321
+ const selectorFor = (el) => {
322
+ if (!(el instanceof Element)) return '';
323
+ if (el.id) return '#' + cssEscape(el.id);
324
+ const parts = [];
325
+ let node = el;
326
+ while (node && node.nodeType === 1 && parts.length < 5 && !node.hasAttribute('data-sg-frame')) {
327
+ let part = node.tagName.toLowerCase();
328
+ const parent = node.parentElement;
329
+ if (parent) {
330
+ const twins = Array.from(parent.children).filter((child) => child.tagName === node.tagName);
331
+ if (twins.length > 1) part += ':nth-of-type(' + (twins.indexOf(node) + 1) + ')';
332
+ }
333
+ parts.unshift(part);
334
+ node = parent;
335
+ }
336
+ return parts.join(' > ');
337
+ };
338
+ const selected = new Map();
339
+ const clearSelection = (publish = true) => {
340
+ for (const entry of selected.values()) entry.el && entry.el.removeAttribute && entry.el.removeAttribute('data-sg-selected');
341
+ selected.clear();
342
+ if (publish) publishSelection();
343
+ };
344
+ // Human label for a breadcrumb segment: data-sg-name if authored, else a
345
+ // CSS-ish token (tag, tag#id, or tag.firstClass); the frame shows its name.
346
+ const labelFor = (el) => {
347
+ if (el.hasAttribute('data-sg-frame')) {
348
+ return el.getAttribute('data-sg-name') || ('Frame ' + ((parseInt(el.getAttribute('data-frame-index'), 10) || 0) + 1));
349
+ }
350
+ const name = el.getAttribute('data-sg-name');
351
+ if (name) return name;
352
+ const tag = el.tagName.toLowerCase();
353
+ if (el.id) return tag + '#' + el.id;
354
+ const cls = (el.getAttribute('class') || '').trim().split(/\\s+/).filter(Boolean)[0];
355
+ return cls ? tag + '.' + cls : tag;
356
+ };
357
+ // The selected element's ancestor chain within its frame: frame-first → el-last.
358
+ const ancestorChain = (el) => {
359
+ const frame = el.closest('[data-sg-frame]');
360
+ if (!frame) return [];
361
+ const chain = [];
362
+ let n = el;
363
+ while (n) { chain.unshift(n); if (n === frame) break; n = n.parentElement; }
364
+ return chain;
365
+ };
366
+ const publishSelection = () => {
367
+ const entries = Array.from(selected.values());
368
+ // Recompute each target's descriptor from the LIVE element so the rects reflect
369
+ // current geometry — a scroll/resize re-emit must carry where the element is NOW,
370
+ // not where it was when first selected (the targetId/selector stay stable, so the
371
+ // host repositions its overlay in place rather than treating it as a new target).
372
+ const targets = entries.map((entry) => { entry.target = descriptorFor(entry.el); return entry.target; });
373
+ // A single selection carries its ancestor labels for the host breadcrumb;
374
+ // a multi-selection has no single path.
375
+ const path = entries.length === 1 ? ancestorChain(entries[0].el).map(labelFor) : null;
376
+ send({ type: 'selection-change', primaryTargetId: (targets[targets.length - 1] || {}).targetId || '', targets, ...(path ? { path: path } : {}) });
377
+ if (targets.length === 0) send({ type: 'clear-selection' });
378
+ };
379
+ // Breadcrumb drill-out: re-select the ancestor at the given index of the current
380
+ // single selection's chain. The selected element itself (last) is a no-op.
381
+ const selectAncestor = (index) => {
382
+ const entries = Array.from(selected.values());
383
+ if (entries.length !== 1) return;
384
+ const chain = ancestorChain(entries[0].el);
385
+ const target = chain[index];
386
+ if (!(target instanceof Element) || target === entries[0].el) return;
387
+ clearSelection(false);
388
+ const t = descriptorFor(target);
389
+ target.setAttribute('data-sg-selected', 'true');
390
+ selected.set(t.targetId, { el: target, target: t });
391
+ publishSelection();
392
+ };
393
+ const descriptorFor = (el) => {
394
+ const frame = el.closest('[data-sg-frame]');
395
+ const rect = el.getBoundingClientRect();
396
+ const frameId = frame ? frame.getAttribute('data-sg-frame-id') : '';
397
+ // Never emit an empty selector (the host drops empty-selector targets): the
398
+ // frame element addresses by its frame id, anything else by its DOM path,
399
+ // falling back to the tag name.
400
+ const isFrame = el.hasAttribute('data-sg-frame');
401
+ const selector = isFrame
402
+ ? '[data-sg-frame-id="' + frameId + '"]'
403
+ : (selectorFor(el) || el.tagName.toLowerCase());
404
+ return {
405
+ frameId,
406
+ frameIndex: frame ? Number(frame.getAttribute('data-frame-index')) : -1,
407
+ selector,
408
+ tagName: el.tagName.toLowerCase(),
409
+ text: safeText(el.textContent),
410
+ rect: { x: rect.x, y: rect.y, width: rect.width, height: rect.height },
411
+ targetId: (frameId || '') + '::' + selector,
412
+ };
413
+ };
414
+ const selectionTarget = (node) => {
415
+ if (!(node instanceof Element)) return null;
416
+ const frame = node.closest('[data-sg-frame]');
417
+ if (!frame) return null; // bare stage → clears the selection
418
+ const explicit = node.closest('[data-sg-selectable]');
419
+ if (explicit) return explicit;
420
+ // EVERYTHING is selectable. Snap a click that lands inside a meaningful
421
+ // content/interactive element up to that element (clicking a heading's text
422
+ // selects the heading; a button's label selects the button); otherwise select
423
+ // the EXACT element clicked — a structural wrapper (header bar, nav rail, logo)
424
+ // selects as itself, never silently collapsing to the whole frame. The frame is
425
+ // selected only by clicking its own bare background. Use the breadcrumb to drill
426
+ // OUT to a container.
427
+ const specific = node.closest(specificContent);
428
+ if (specific && specific !== frame && frame.contains(specific)) return specific;
429
+ return node;
430
+ };
431
+ window.addEventListener('click', (event) => {
432
+ if (surface !== 'editor' || tool !== 'pointer') return;
433
+ if (handleLinkClick(event)) { /* still select the link element */ }
434
+ const el = selectionTarget(event.target);
435
+ if (!(el instanceof Element)) { clearSelection(); return; }
436
+ const target = descriptorFor(el);
437
+ const additive = event.shiftKey || event.metaKey || event.ctrlKey;
438
+ if (!additive) clearSelection(false);
439
+ if (additive && selected.has(target.targetId)) {
440
+ const prev = selected.get(target.targetId);
441
+ prev && prev.el && prev.el.removeAttribute('data-sg-selected');
442
+ selected.delete(target.targetId);
443
+ } else {
444
+ el.setAttribute('data-sg-selected', 'true');
445
+ selected.set(target.targetId, { el, target });
446
+ }
447
+ publishSelection();
448
+ }, { capture: true });
449
+ window.addEventListener('keydown', (event) => {
450
+ if (surface !== 'editor' || event.key !== 'Escape' || selected.size === 0) return;
451
+ clearSelection();
452
+ event.preventDefault();
453
+ }, { capture: true });
454
+
455
+ // Selection chrome lives in the HOST overlay, positioned from element rects. A
456
+ // scroll (the page or any inner scroll container) moves those elements, so re-emit
457
+ // the selection with fresh rects while a selection exists — rAF-throttled, mirroring
458
+ // the pan/zoom flush — or the overlay would lag behind the content it frames.
459
+ // Capture-phase catches non-bubbling scroll events from nested scrollers; passive
460
+ // keeps scrolling smooth.
461
+ let selectionReflowFrame = null;
462
+ const flushSelectionReflow = () => { selectionReflowFrame = null; if (selected.size > 0) publishSelection(); };
463
+ window.addEventListener('scroll', () => {
464
+ if (selected.size === 0 || selectionReflowFrame !== null) return;
465
+ selectionReflowFrame = requestAnimationFrame(flushSelectionReflow);
466
+ }, { capture: true, passive: true });
467
+
468
+ // Swallow in-sandbox navigation (a relative/external href would blank the frame).
469
+ const handleLinkClick = (event) => {
470
+ if (event.defaultPrevented || event.button) return false;
471
+ const anchor = event.target instanceof Element ? event.target.closest('a[href]') : null;
472
+ if (!anchor) return false;
473
+ const href = anchor.getAttribute('href') || '';
474
+ if (!href || /^javascript:/i.test(href)) return false;
475
+ event.preventDefault();
476
+ if (href.charAt(0) === '#') {
477
+ try { const dest = document.getElementById(href.slice(1)); dest && dest.scrollIntoView({ block: 'start', behavior: 'smooth' }); } catch {}
478
+ }
479
+ return true;
480
+ };
481
+ // Non-editor surfaces (a present document scrolls like a PDF): swallow in-frame
482
+ // navigation here too, so a relative/external href can't blank the sandboxed
483
+ // frame, and an in-document #anchor smooth-scrolls to its section while reading.
484
+ // Editor runs handleLinkClick from its own click handler above.
485
+ window.addEventListener('click', (event) => {
486
+ if (surface === 'editor') return;
487
+ handleLinkClick(event);
488
+ }, { capture: true });
489
+
490
+ // --- pan/zoom forwarding (the host owns the transform) ---
491
+ let panDelta = null, panFrame = null, zoomDelta = null, zoomFrame = null;
492
+ const flushPan = () => { panFrame = null; if (!panDelta) return; const d = panDelta; panDelta = null; send({ type: 'pan-delta', dx: d.dx, dy: d.dy }); };
493
+ const queuePan = (dx, dy) => { panDelta = panDelta ? { dx: panDelta.dx + dx, dy: panDelta.dy + dy } : { dx, dy }; if (panFrame === null) panFrame = requestAnimationFrame(flushPan); };
494
+ const flushZoom = () => { zoomFrame = null; if (!zoomDelta) return; const z = zoomDelta; zoomDelta = null; send({ type: 'zoom-delta', delta: z.delta, x: z.x, y: z.y }); };
495
+ const queueZoom = (delta, x, y) => { zoomDelta = zoomDelta ? { delta: zoomDelta.delta + delta, x, y } : { delta, x, y }; if (zoomFrame === null) zoomFrame = requestAnimationFrame(flushZoom); };
496
+ window.addEventListener('wheel', (event) => {
497
+ if (!canNavigate || fullBleed) return; // full-bleed: let the app scroll natively
498
+ const unit = event.deltaMode === 1 ? 16 : event.deltaMode === 2 ? window.innerHeight : 1;
499
+ const dx = event.deltaX * unit, dy = event.deltaY * unit;
500
+ if (Math.abs(dx) < 0.01 && Math.abs(dy) < 0.01) return;
501
+ if (event.ctrlKey || event.metaKey) { queueZoom(dy, event.clientX, event.clientY); event.preventDefault(); return; }
502
+ queuePan(dx, dy);
503
+ event.preventDefault();
504
+ }, { capture: true, passive: false });
505
+ let panPointer = null;
506
+ window.addEventListener('pointerdown', (event) => {
507
+ if (!canNavigate || fullBleed || tool !== 'hand' || event.button !== 0) return;
508
+ panPointer = event.pointerId;
509
+ try { event.target.setPointerCapture && event.target.setPointerCapture(event.pointerId); } catch {}
510
+ try { document.body.style.cursor = 'grabbing'; } catch {}
511
+ send({ type: 'pan', phase: 'start', x: event.screenX, y: event.screenY });
512
+ event.preventDefault();
513
+ }, { capture: true });
514
+ window.addEventListener('pointermove', (event) => {
515
+ if (panPointer !== event.pointerId) return;
516
+ send({ type: 'pan', phase: 'move', x: event.screenX, y: event.screenY });
517
+ }, { capture: true });
518
+ const endPan = (event) => { if (panPointer !== event.pointerId) return; send({ type: 'pan', phase: 'end', x: event.screenX, y: event.screenY }); panPointer = null; applyCursor(); };
519
+ window.addEventListener('pointerup', endPan, { capture: true });
520
+ window.addEventListener('pointercancel', endPan, { capture: true });
521
+ // If capture is stolen mid-drag (system gesture, target removed), end the pan so
522
+ // the 'grabbing' cursor doesn't stick.
523
+ window.addEventListener('lostpointercapture', endPan, { capture: true });
524
+ })();`;
525
+ }
526
+ // ---------------------------------------------------------------------------
527
+ // PRESENT layout + runtime. Present is single-frame: frames are STACKED at the
528
+ // origin (each at its own size, only the active one shown), so stepping is a
529
+ // visibility toggle — never a transform jump — which is flash-free and renders
530
+ // only one frame (cheap). This is the stepper model. The host sizes the
531
+ // iframe to the active frame and fit-scales it (a constant transform across
532
+ // steps for a uniform deck), draws the controls, and forwards set-frame.
533
+ // ---------------------------------------------------------------------------
534
+ function presentLayoutCss(bundle) {
535
+ const rules = bundle.frames
536
+ .map((frame) => {
537
+ const height = frame.geometry.height === 'auto' ? 'height:auto;' : `height:${frame.geometry.height}px;`;
538
+ const background = `background:${frameBackground(frame.layout, frame.background, bundle.display?.background)};`;
539
+ return `[data-sg-frame-id="${frame.id}"]{width:${frame.geometry.width}px;${height}${background}}`;
540
+ })
541
+ .join('\n');
542
+ // left/top are forced because promoted document page-frames carry inline
543
+ // column coordinates (from pagination) that present must override to stack
544
+ // every frame at the origin (the stepper shows one at a time).
545
+ return `html,body{margin:0;padding:0;background:transparent;}
546
+ body{position:relative;margin:0;}
547
+ [data-sg-frame]{position:absolute;left:0 !important;top:0 !important;box-sizing:border-box;overflow:hidden;display:none;}
548
+ [data-sg-frame][data-sg-present-active]{display:block;}
549
+ ${rules}`;
550
+ }
551
+ function presentRuntimeScript(artifactId) {
552
+ return `
553
+ (() => {
554
+ const artifactId = ${JSON.stringify(artifactId)};
555
+ const send = (payload) => { try { parent.postMessage({ channel: 'studiograph-artifact', artifactId, ...payload }, '*'); } catch {} };
556
+ const frames = () => Array.from(document.querySelectorAll('[data-sg-frame]'));
557
+ let active = 0;
558
+ const sendState = () => { const all = frames(); if (all.length) send({ type: 'frame-state', index: active, count: all.length }); };
559
+ const sendSizes = () => send({ type: 'frame-sizes', sizes: frames().map((el) => ({ id: el.getAttribute('data-sg-frame-id'), width: el.offsetWidth, height: Math.max(el.scrollHeight, el.offsetHeight) })) });
560
+ const setActive = (index) => {
561
+ const all = frames();
562
+ if (!all.length) return;
563
+ active = Math.max(0, Math.min(all.length - 1, Number.isFinite(index) ? Math.round(index) : 0));
564
+ all.forEach((el, i) => { const on = i === active; el.toggleAttribute('data-sg-present-active', on); el.setAttribute('aria-hidden', on ? 'false' : 'true'); });
565
+ sendState();
566
+ sendSizes();
567
+ };
568
+ const step = (dir) => { const all = frames(); if (all.length) setActive((active + dir + all.length) % all.length); };
569
+ window.addEventListener('message', (event) => {
570
+ const data = event.data;
571
+ if (!data || data.channel !== 'studiograph-artifact-host' || data.artifactId !== artifactId) return;
572
+ if (data.type === 'set-frame') setActive(Number(data.index));
573
+ if (data.type === 'reset-frames') setActive(0);
574
+ });
575
+ window.addEventListener('error', (event) => send({ status: 'error', message: String((event && event.message) || 'Artifact error') }));
576
+ window.addEventListener('keydown', (event) => {
577
+ if (event.altKey || event.ctrlKey || event.metaKey) return;
578
+ if (event.key === 'ArrowRight' || event.key === 'PageDown' || event.key === ' ') { step(1); event.preventDefault(); return; }
579
+ if (event.key === 'ArrowLeft' || event.key === 'PageUp' || event.key === 'Backspace') { step(-1); event.preventDefault(); return; }
580
+ if (event.key === 'Home') { setActive(0); event.preventDefault(); return; }
581
+ if (event.key === 'End') { setActive(frames().length - 1); event.preventDefault(); return; }
582
+ });
583
+ // Navigation is via the host stepper controls + keyboard only — clicking a slide
584
+ // does NOT advance (the stepper is the clearer affordance; click-to-step was
585
+ // easy to trigger by accident). But pointer activity over the iframe (which the
586
+ // host can't see) must still re-reveal the auto-hiding controls: re-post the
587
+ // current frame-state (the host reveals on it) without changing the slide.
588
+ let activityRaf = null;
589
+ const signalActivity = () => { if (activityRaf !== null) return; activityRaf = requestAnimationFrame(() => { activityRaf = null; sendState(); }); };
590
+ window.addEventListener('pointermove', signalActivity, { passive: true });
591
+ window.addEventListener('click', signalActivity);
592
+ window.addEventListener('load', () => { send({ status: 'ready' }); setActive(0); });
593
+ try { if (document.fonts && document.fonts.ready) document.fonts.ready.then(sendSizes); } catch {}
594
+ })();`;
595
+ }
596
+ /** A single-frame artifact whose frame spans the viewport (a responsive
597
+ * prototype / full-screen app). The frame fills the iframe and reflows; the host
598
+ * sizes the iframe to the canvas/present stage. The host (FrameCanvas) imports
599
+ * this so its full-bleed predicate can't drift from the renderer. */
600
+ export function isFullBleed(bundle) {
601
+ return bundle.frames.length === 1
602
+ // A whiteboard is its own mode (large fixed surface, pannable) — never treat
603
+ // it as full-bleed even if mis-authored with a 'fill' dimension, or it would
604
+ // become a chrome-less surface that can't be panned.
605
+ && bundle.frames[0].layout !== 'whiteboard'
606
+ && (bundle.frames[0].geometry.width === 'fill' || bundle.frames[0].geometry.height === 'fill');
607
+ }
608
+ /** Full-bleed layout: the body fills the iframe (which the host sizes to the
609
+ * stage) and the single frame fills the body, scrolling internally if its
610
+ * content overflows — no grid, no fixed artboard. A NUMERIC `geometry.width`
611
+ * letterboxes the app: centered at that width (capped to the viewport), filling
612
+ * height — so a fixed-width app screen doesn't stretch edge-to-edge. A `fill`
613
+ * width spans the whole stage. */
614
+ function fullBleedLayoutCss(bundle) {
615
+ const frame = bundle.frames[0];
616
+ const bg = frameBackground(frame.layout, frame.background, bundle.display?.background);
617
+ const width = frame.geometry.width;
618
+ const horizontal = typeof width === 'number'
619
+ ? `left:50%;transform:translateX(-50%);width:${width}px;max-width:100%;`
620
+ : `left:0;right:0;`;
621
+ return `html,body{margin:0;padding:0;background:transparent;height:100%;}
622
+ body{position:relative;width:100%;height:100%;}
623
+ [data-sg-frame]{position:absolute;top:0;bottom:0;${horizontal}box-sizing:border-box;overflow:auto;background:${bg};}`;
624
+ }
625
+ /** Every frame is a `pages` frame — the artifact reads as a continuous paged
626
+ * document. In `present` it scrolls through its pages like a PDF (the
627
+ * present-document path) instead of stepping frame-by-frame like a deck. The
628
+ * host (FrameCanvas) imports this so its present-document predicate can't drift. */
629
+ export function isPagesArtifact(bundle) {
630
+ return bundle.frames.length > 0 && bundle.frames.every((frame) => frame.layout === 'pages');
631
+ }
632
+ /** A whiteboard: ONE large freeform surface (FigJam/Miro feel). Single frame,
633
+ * layout `whiteboard`. It is neither a deck (no stepper) nor full-bleed (it has
634
+ * a real, fixed extent the user pans/zooms around). The host suppresses frame
635
+ * chrome, pans the surface in BOTH editor and present, and fits-to-surface in
636
+ * present (no stepper). The host (FrameCanvas) imports this so its whiteboard
637
+ * predicate can't drift from the renderer. */
638
+ export function isWhiteboard(bundle) {
639
+ return bundle.frames.length === 1 && bundle.frames[0].layout === 'whiteboard';
640
+ }
641
+ // ---------------------------------------------------------------------------
642
+ // Standalone (host: 'none') interactive whiteboard. A downloaded HTML file has
643
+ // no host to drive the transform, so the runtime SELF-HOSTS the same Figma-style
644
+ // cover-clamp pan/zoom as the in-app present: the canvas always covers the
645
+ // viewport, pan stops at every edge, and a small built-in toolbar offers zoom
646
+ // in/out + reset. (A static PDF/PNG render leaves ctx.interactive unset and keeps
647
+ // the full-canvas layout, so the render captures the whole surface.)
648
+ // ---------------------------------------------------------------------------
649
+ /** The whiteboard's fixed canvas size (px). A whiteboard frame should declare a
650
+ * numeric box; coerce a mis-authored 'fill'/'auto' to a sane default so the
651
+ * standalone math never divides by a non-number. */
652
+ function whiteboardCanvasSize(bundle) {
653
+ const g = bundle.frames[0].geometry;
654
+ return {
655
+ width: typeof g.width === 'number' ? g.width : 1280,
656
+ height: typeof g.height === 'number' ? g.height : 800,
657
+ };
658
+ }
659
+ /** Shared standalone-export toolbar CSS (.sg-bar*) — mirrors the in-app toolbar
660
+ * (.fc-toolbar / .fc-tool-btn) with the design tokens resolved to concrete values
661
+ * (the sandbox has none). Used by every interactive standalone surface. */
662
+ function sgStandaloneToolbarCss() {
663
+ return `.sg-bar{position:fixed;left:50%;bottom:16px;transform:translateX(-50%);display:flex;align-items:center;gap:3px;padding:4px;background:#fff;border:1px solid #e5e2dd;border-radius:8px;box-shadow:0 4px 16px rgba(0,0,0,0.08),0 1px 2px rgba(0,0,0,0.04);z-index:10;cursor:default;font:13px system-ui,-apple-system,sans-serif;}
664
+ .sg-bar-btn{width:28px;height:28px;display:flex;align-items:center;justify-content:center;padding:0;border:0;border-radius:6px;color:#6b675f;background:transparent;cursor:pointer;transition:background 0.15s,color 0.15s;}
665
+ .sg-bar-btn:hover{background:#f2efea;color:#1c1a18;}
666
+ .sg-bar-btn svg{width:16px;height:16px;display:block;}
667
+ .sg-bar-sep{width:1px;height:16px;background:#e5e2dd;margin:0 3px;}
668
+ .sg-bar-zoom,.sg-bar-count{display:flex;align-items:center;justify-content:flex-end;min-width:44px;padding:0 6px;color:#6b675f;font-variant-numeric:tabular-nums;}
669
+ .sg-bar-count{justify-content:center;min-width:54px;}`;
670
+ }
671
+ function whiteboardStandaloneLayoutCss(bundle) {
672
+ const { width, height } = whiteboardCanvasSize(bundle);
673
+ // A downloaded file has no host to ask for the app theme, so the whiteboard —
674
+ // the one platform-themed surface — follows the OS via prefers-color-scheme.
675
+ return `html,body{margin:0;padding:0;height:100%;overflow:hidden;background:${WHITEBOARD_STANDALONE_BODY_LIGHT};}
676
+ body{position:relative;cursor:grab;}
677
+ body.sg-grabbing{cursor:grabbing;}
678
+ [data-sg-frame]{position:absolute;left:0;top:0;width:${width}px;height:${height}px;transform-origin:0 0;box-sizing:border-box;overflow:hidden;background:${WHITEBOARD_SURFACE_LIGHT};}
679
+ @media (prefers-color-scheme: dark){
680
+ html,body{background:${WHITEBOARD_STANDALONE_BODY_DARK};}
681
+ [data-sg-frame]{background:${WHITEBOARD_SURFACE_DARK};}
682
+ }
683
+ ${sgStandaloneToolbarCss()}`;
684
+ }
685
+ // The EXACT Carbon icon path data used by the in-app toolbar (carbon-icons-svelte
686
+ // Reset / ZoomOut / ZoomIn / ChevronLeft / ChevronRight), inlined so a downloaded
687
+ // standalone file renders the same glyphs with no dependency. Carbon icons are a
688
+ // 32×32 viewBox, filled with currentColor.
689
+ const SG_CARBON = {
690
+ reset: '<path d="M18,28A12,12,0,1,0,6,16v6.2L2.4,18.6,1,20l6,6,6-6-1.4-1.4L8,22.2V16H8A10,10,0,1,1,18,26Z"/>',
691
+ zoomOut: '<path d="M8 12H18V14H8z"/><path d="M21.4479,20A10.856,10.856,0,0,0,24,13,11,11,0,1,0,13,24a10.856,10.856,0,0,0,7-2.5521L27.5859,29,29,27.5859ZM13,22a9,9,0,1,1,9-9A9.01,9.01,0,0,1,13,22Z"/>',
692
+ zoomIn: '<path d="M18 12 14 12 14 8 12 8 12 12 8 12 8 14 12 14 12 18 14 18 14 14 18 14 18 12z"/><path d="M21.4479,20A10.856,10.856,0,0,0,24,13,11,11,0,1,0,13,24a10.856,10.856,0,0,0,7-2.5521L27.5859,29,29,27.5859ZM13,22a9,9,0,1,1,9-9A9.01,9.01,0,0,1,13,22Z"/>',
693
+ chevronLeft: '<path d="M10 16 20 6 21.4 7.4 12.8 16 21.4 24.6 20 26z"/>',
694
+ chevronRight: '<path d="M22 16 12 26 10.6 24.6 19.2 16 10.6 7.4 12 6z"/>',
695
+ };
696
+ const sgIcon = (key) => `<svg viewBox="0 0 32 32" fill="currentColor" aria-hidden="true">${SG_CARBON[key]}</svg>`;
697
+ function whiteboardStandaloneToolbarHtml() {
698
+ return `<div id="sg-wb-bar" class="sg-bar" role="toolbar" aria-label="Canvas controls">`
699
+ + `<button id="sg-wb-reset" class="sg-bar-btn" type="button" title="Reset view" aria-label="Reset view">${sgIcon('reset')}</button>`
700
+ + `<span class="sg-bar-sep" aria-hidden="true"></span>`
701
+ + `<button id="sg-wb-zoomout" class="sg-bar-btn" type="button" title="Zoom out" aria-label="Zoom out">${sgIcon('zoomOut')}</button>`
702
+ + `<button id="sg-wb-zoomin" class="sg-bar-btn" type="button" title="Zoom in" aria-label="Zoom in">${sgIcon('zoomIn')}</button>`
703
+ + `<span class="sg-bar-sep" aria-hidden="true"></span>`
704
+ + `<span id="sg-wb-zoom" class="sg-bar-zoom">100%</span>`
705
+ + `</div>`;
706
+ }
707
+ /** The self-hosted cover-clamp pan/zoom runtime for a standalone whiteboard. No
708
+ * parent host: it owns the transform on the single frame element, clamping so a
709
+ * canvas edge never enters the viewport (mirrors clampWhiteboardPan in the host
710
+ * view-state), and wires the built-in toolbar. */
711
+ function whiteboardStandaloneRuntime(canvasWidth, canvasHeight) {
712
+ return `
713
+ (() => {
714
+ const W = ${canvasWidth}, H = ${canvasHeight}, MAXZOOM = 4;
715
+ // The runtime is injected in <head>, before the body parses, so the frame
716
+ // element is looked up lazily (capturing it at parse time would be null).
717
+ const elOf = () => document.querySelector('[data-sg-frame]');
718
+ let zoom = 1, x = 0, y = 0;
719
+ const vw = () => window.innerWidth, vh = () => window.innerHeight;
720
+ const cover = () => Math.max(vw() / W, vh() / H);
721
+ const clamp = (v, a, b) => Math.min(b, Math.max(a, v));
722
+ const clampPan = () => {
723
+ const w = W * zoom, h = H * zoom;
724
+ x = w >= vw() ? clamp(x, vw() - w, 0) : (vw() - w) / 2;
725
+ y = h >= vh() ? clamp(y, vh() - h, 0) : (vh() - h) / 2;
726
+ };
727
+ const label = () => { const l = document.getElementById('sg-wb-zoom'); if (l) l.textContent = Math.round(zoom * 100) + '%'; };
728
+ const apply = () => { const el = elOf(); if (el) el.style.transform = 'translate(' + x + 'px,' + y + 'px) scale(' + zoom + ')'; label(); };
729
+ // Open (and reset) at 100% centered; a canvas too small to cover the viewport
730
+ // at 1:1 scales up to the cover scale so no edge shows.
731
+ const fit = () => { zoom = Math.max(1, cover()); x = (vw() - W * zoom) / 2; y = (vh() - H * zoom) / 2; clampPan(); apply(); };
732
+ const setZoom = (nz, fx, fy) => {
733
+ // The cover scale is the min zoom; the max must be at least cover so the clamp
734
+ // never inverts (a small canvas can need >MAXZOOM just to cover the viewport).
735
+ const lo = cover(); nz = clamp(nz, lo, Math.max(MAXZOOM, lo));
736
+ fx = (fx == null) ? vw() / 2 : fx; fy = (fy == null) ? vh() / 2 : fy;
737
+ const ax = (fx - x) / zoom, ay = (fy - y) / zoom;
738
+ zoom = nz; x = fx - ax * zoom; y = fy - ay * zoom; clampPan(); apply();
739
+ };
740
+ let dragging = false, px = 0, py = 0;
741
+ window.addEventListener('pointerdown', (e) => {
742
+ if (e.button !== 0 || (e.target && e.target.closest && e.target.closest('#sg-wb-bar'))) return;
743
+ dragging = true; px = e.clientX; py = e.clientY; document.body.classList.add('sg-grabbing');
744
+ try { e.target.setPointerCapture && e.target.setPointerCapture(e.pointerId); } catch {}
745
+ });
746
+ window.addEventListener('pointermove', (e) => { if (!dragging) return; x += e.clientX - px; y += e.clientY - py; px = e.clientX; py = e.clientY; clampPan(); apply(); });
747
+ const end = () => { dragging = false; document.body.classList.remove('sg-grabbing'); };
748
+ window.addEventListener('pointerup', end); window.addEventListener('pointercancel', end); window.addEventListener('lostpointercapture', end);
749
+ window.addEventListener('wheel', (e) => {
750
+ e.preventDefault();
751
+ const unit = e.deltaMode === 1 ? 16 : e.deltaMode === 2 ? vh() : 1;
752
+ if (e.ctrlKey || e.metaKey) { setZoom(zoom * Math.exp(-e.deltaY * unit * 0.0015), e.clientX, e.clientY); return; }
753
+ x -= e.deltaX * unit; y -= e.deltaY * unit; clampPan(); apply();
754
+ }, { passive: false });
755
+ // Wire the toolbar + do the first fit once the DOM exists (the runtime runs in
756
+ // <head>, before the toolbar buttons parse).
757
+ const wire = () => {
758
+ const onBar = (id, fn) => { const b = document.getElementById(id); if (b) b.addEventListener('click', fn); };
759
+ onBar('sg-wb-zoomout', () => setZoom(zoom / 1.2));
760
+ onBar('sg-wb-zoomin', () => setZoom(zoom * 1.2));
761
+ onBar('sg-wb-reset', () => fit());
762
+ fit();
763
+ };
764
+ window.addEventListener('resize', fit);
765
+ if (document.readyState === 'loading') window.addEventListener('DOMContentLoaded', wire); else wire();
766
+ window.addEventListener('load', fit);
767
+ })();`;
768
+ }
769
+ // ---------------------------------------------------------------------------
770
+ // Standalone (host: 'none') interactive DECK (slides / artboard set). A
771
+ // downloaded HTML file reproduces the in-app PRESENT stepper: frames stacked at
772
+ // the origin (one shown at a time), the active frame fit-centered on the stage,
773
+ // with prev/next + restart controls + keyboard/click stepping. No host — the
774
+ // runtime self-hosts the fit transform and draws its own controls (same dark
775
+ // pill + Carbon chevrons/reset as the in-app present controls).
776
+ // ---------------------------------------------------------------------------
777
+ /** Present-controls CSS for the standalone deck — mirrors .fc-present-controls
778
+ * (dark blurred pill) with tokens resolved to concrete values. */
779
+ function sgStandalonePresentControlsCss() {
780
+ return `.sg-present{position:fixed;left:0;right:0;bottom:24px;display:flex;align-items:center;justify-content:center;pointer-events:none;opacity:0;transition:opacity 300ms ease;z-index:10;font:13px system-ui,-apple-system,sans-serif;}
781
+ .sg-present.visible{opacity:1;}
782
+ .sg-present-group{display:flex;align-items:center;gap:2px;padding:4px;background:rgba(30,30,30,0.85);border-radius:8px;pointer-events:auto;-webkit-backdrop-filter:blur(12px);backdrop-filter:blur(12px);}
783
+ .sg-present-btn{width:32px;height:32px;display:flex;align-items:center;justify-content:center;padding:0;border:0;border-radius:6px;color:rgba(255,255,255,0.6);background:transparent;cursor:pointer;transition:color 120ms,background 120ms;}
784
+ .sg-present-btn svg{width:16px;height:16px;display:block;}
785
+ .sg-present-btn:hover{background:rgba(255,255,255,0.1);color:#fff;}
786
+ .sg-present-count{height:32px;display:flex;align-items:center;justify-content:center;padding:0 8px;color:rgba(255,255,255,0.6);font-weight:500;font-variant-numeric:tabular-nums;white-space:nowrap;user-select:none;}
787
+ .sg-present-reset{position:absolute;right:24px;}
788
+ .sg-present-restart{width:auto;gap:6px;padding:0 8px;font-weight:500;white-space:nowrap;}`;
789
+ }
790
+ function deckStandaloneLayoutCss(bundle) {
791
+ const rules = bundle.frames
792
+ .map((frame) => {
793
+ const width = typeof frame.geometry.width === 'number' ? `${frame.geometry.width}px` : '100%';
794
+ const height = frame.geometry.height === 'auto' || frame.geometry.height === 'fill'
795
+ ? 'height:auto;'
796
+ : `height:${frame.geometry.height}px;`;
797
+ const background = `background:${frameBackground(frame.layout, frame.background, bundle.display?.background)};`;
798
+ return `[data-sg-frame-id="${frame.id}"]{width:${width};${height}${background}}`;
799
+ })
800
+ .join('\n');
801
+ return `html,body{margin:0;padding:0;height:100%;overflow:hidden;background:#4a4a4a;}
802
+ body{position:relative;}
803
+ [data-sg-frame]{position:absolute;left:0;top:0;transform-origin:0 0;box-sizing:border-box;overflow:hidden;display:none;}
804
+ [data-sg-frame][data-sg-present-active]{display:block;}
805
+ ${rules}
806
+ ${sgStandalonePresentControlsCss()}`;
807
+ }
808
+ function deckStandaloneControlsHtml() {
809
+ return `<div id="sg-present" class="sg-present">`
810
+ + `<div class="sg-present-group" role="group" aria-label="Slide navigation">`
811
+ + `<button id="sg-prev" class="sg-present-btn" type="button" title="Previous" aria-label="Previous">${sgIcon('chevronLeft')}</button>`
812
+ + `<span id="sg-count" class="sg-present-count">1 / 1</span>`
813
+ + `<button id="sg-next" class="sg-present-btn" type="button" title="Next" aria-label="Next">${sgIcon('chevronRight')}</button>`
814
+ + `</div>`
815
+ + `<div class="sg-present-group sg-present-reset">`
816
+ + `<button id="sg-restart" class="sg-present-btn sg-present-restart" type="button" title="Restart" aria-label="Restart">${sgIcon('reset')}<span>Restart</span></button>`
817
+ + `</div>`
818
+ + `</div>`;
819
+ }
820
+ /** The self-hosted present stepper for a standalone deck: fit the active frame
821
+ * centered, step prev/next (keyboard + click-zones), restart, auto-hiding
822
+ * controls. Mirrors presentRuntimeScript + the in-app present fit. */
823
+ function deckStandaloneRuntime() {
824
+ return `
825
+ (() => {
826
+ const MAX_SCALE = 6;
827
+ const frames = () => Array.prototype.slice.call(document.querySelectorAll('[data-sg-frame]'));
828
+ let active = 0, hideTimer = null;
829
+ const fitActive = () => {
830
+ const all = frames(); if (!all.length) return;
831
+ const el = all[active]; const fw = el.offsetWidth || 1, fh = el.offsetHeight || 1;
832
+ const pad = 48; const scale = Math.min((window.innerWidth - pad) / fw, (window.innerHeight - pad) / fh, MAX_SCALE);
833
+ const s = Math.max(0.05, scale);
834
+ el.style.transform = 'translate(' + ((window.innerWidth - fw * s) / 2) + 'px,' + ((window.innerHeight - fh * s) / 2) + 'px) scale(' + s + ')';
835
+ };
836
+ const updateCount = () => { const c = document.getElementById('sg-count'); if (c) c.textContent = (active + 1) + ' / ' + frames().length; };
837
+ const show = (i) => {
838
+ const all = frames(); if (!all.length) return;
839
+ active = ((i % all.length) + all.length) % all.length;
840
+ all.forEach((el, idx) => { el.toggleAttribute('data-sg-present-active', idx === active); el.setAttribute('aria-hidden', idx === active ? 'false' : 'true'); });
841
+ fitActive(); updateCount();
842
+ };
843
+ const step = (d) => show(active + d);
844
+ const reveal = () => { const c = document.getElementById('sg-present'); if (!c) return; c.classList.add('visible'); if (hideTimer) clearTimeout(hideTimer); hideTimer = setTimeout(() => c.classList.remove('visible'), 2500); };
845
+ const wire = () => {
846
+ const on = (id, fn) => { const b = document.getElementById(id); if (b) b.addEventListener('click', (e) => { e.stopPropagation(); fn(); reveal(); }); };
847
+ on('sg-prev', () => step(-1)); on('sg-next', () => step(1)); on('sg-restart', () => show(0));
848
+ show(0); reveal();
849
+ };
850
+ window.addEventListener('keydown', (e) => {
851
+ if (e.altKey || e.ctrlKey || e.metaKey) return;
852
+ // Don't hijack keys aimed at a focused control or text field: typing in a slide
853
+ // input must work, and Space on a focused button should activate it natively
854
+ // (not double-step). Mirrors the in-app present keyboard guard.
855
+ const t = e.target;
856
+ if (t && t.closest && t.closest('input,textarea,select,[contenteditable="true"],button,a[href],[role="button"]')) return;
857
+ if (e.key === 'ArrowRight' || e.key === 'PageDown' || e.key === ' ') { step(1); reveal(); e.preventDefault(); }
858
+ else if (e.key === 'ArrowLeft' || e.key === 'PageUp' || e.key === 'Backspace') { step(-1); reveal(); e.preventDefault(); }
859
+ else if (e.key === 'Home') { show(0); reveal(); e.preventDefault(); }
860
+ else if (e.key === 'End') { show(frames().length - 1); reveal(); e.preventDefault(); }
861
+ });
862
+ // Navigation is via the stepper controls + keyboard only — clicking a slide does
863
+ // NOT advance (the stepper is the clearer affordance). A click still reveals the
864
+ // auto-hiding controls.
865
+ window.addEventListener('click', reveal);
866
+ window.addEventListener('mousemove', reveal);
867
+ window.addEventListener('resize', fitActive);
868
+ if (document.readyState === 'loading') window.addEventListener('DOMContentLoaded', wire); else wire();
869
+ window.addEventListener('load', () => { show(active); reveal(); });
870
+ })();`;
871
+ }
872
+ /** Present a `document` artifact as a continuous vertical scroll through its
873
+ * pages — read like a PDF, not stepped like a deck. The pages are Paged.js's
874
+ * natural `.pagedjs_page` boxes (present-document does NOT promote them — see the
875
+ * bootstrap's `promote` gate — so they keep Paged.js's vertical flow); a
876
+ * non-paginated (auto/fill-height) document frame flows as a single page. The
877
+ * host sizes the iframe to the present stage; the page column scrolls internally.
878
+ * Mirrors the `pagedFullscreenCss` reader model — `!important` + the surface
879
+ * scope win over Paged.js's runtime-injected `.pagedjs_*` styles (which reset
880
+ * left/top/transform and would otherwise absolutely-position the pages). */
881
+ function presentDocumentLayoutCss(bundle, surfaceAttr = 'present') {
882
+ const surface = `html[data-artifact-surface="${surfaceAttr}"]`;
883
+ // A non-paginated (auto/fill-height) document frame IS the page — give the frame
884
+ // itself page chrome. A paginated frame's wrapper stays transparent; its pages
885
+ // get chrome via .pagedjs_page below.
886
+ const rules = bundle.frames
887
+ .map((frame) => {
888
+ const width = typeof frame.geometry.width === 'number' ? `${frame.geometry.width}px` : '100%';
889
+ const minHeight = typeof frame.geometry.height === 'number' ? `min-height:${frame.geometry.height}px;` : '';
890
+ const background = frameBackground(frame.layout, frame.background, bundle.display?.background);
891
+ return `[data-sg-frame-id="${frame.id}"]:not([data-sg-paginated]){width:${width};max-width:100%;margin:0 auto 32px;${minHeight}background:${background};box-shadow:0 6px 24px rgba(0,0,0,0.18);}`;
892
+ })
893
+ .join('\n');
894
+ // The page column MUST use block flow, not flex: Chromium does not accumulate
895
+ // `counter-increment` across FLEX items, so a flex `.pagedjs_pages` renders the
896
+ // "Page N of M" footer (which resolves `counter(page)`) as "Page 1" on every
897
+ // page. Block boxes accumulate the page counter correctly. Pages center with
898
+ // `margin:0 auto` (fixed-width box in a full-width column) and gap with
899
+ // `margin-bottom`; the body block-stacks frames + scrolls.
900
+ return `html,body{margin:0;padding:0;background:transparent;height:100%;}
901
+ body{box-sizing:border-box;min-height:100%;overflow:auto;padding:48px 0;}
902
+ [data-sg-frame]{position:relative;box-sizing:border-box;background:transparent;overflow:visible;}
903
+ [data-sg-frame][data-sg-paginated]{display:block;width:100%;}
904
+ ${surface} .pagedjs_pages{display:block !important;width:auto !important;margin:0 !important;padding:0 !important;background:transparent !important;}
905
+ ${surface} .pagedjs_page{position:relative !important;left:auto !important;top:auto !important;margin:0 auto 32px !important;transform:none !important;background:#fff;box-shadow:0 6px 24px rgba(0,0,0,0.18);}
906
+ ${surface} .pagedjs_sheet{box-shadow:none !important;}
907
+ ${furniturePositionCss()}
908
+ ${rules}`;
909
+ }
910
+ // ---------------------------------------------------------------------------
911
+ // Document pagination (P3.3). A `document` frame holds ONE flowing content
912
+ // stream; when a Paged.js source is supplied the platform fragments it into page
913
+ // boxes INSIDE the sandbox (CSS Paged Media — @page geometry, running headers/
914
+ // footers, page counters, break rules). The page count is a render OUTPUT, never
915
+ // authored or persisted (the authored `document` frame is the single source of
916
+ // truth — frame model `ResolvedFrame.origin: 'derived'`). Print shares the same
917
+ // fragmentation, so PDF export gets faithful page breaks for free.
918
+ //
919
+ // A `document` frame paginates only when its height is a fixed page box (e.g.
920
+ // US Letter 816×1056); a `document` with `height:'auto'` stays a single flowing
921
+ // page (auto-height reflow). The default page margin leaves room for furniture.
922
+ // Defaults live in the model (DEFAULT_PAGE_MARGINS) so the validation cross-check
923
+ // and this render agree on what an absent `pageMargins` side resolves to.
924
+ // ---------------------------------------------------------------------------
925
+ // The Paged.js source is a large (~500KB) static library; escapeScript scans it
926
+ // for `</script` on every build. Memoize by identity so a session pays once.
927
+ let escapedPagedCache = null;
928
+ function escapedPagedSource(source) {
929
+ if (escapedPagedCache && escapedPagedCache.source === source)
930
+ return escapedPagedCache.escaped;
931
+ const escaped = escapeScript(source);
932
+ escapedPagedCache = { source, escaped };
933
+ return escaped;
934
+ }
935
+ /** The frames the platform paginates: `pages` layout with a fixed page box
936
+ * (numeric width AND height). A `'fill'`/`'auto'` pages frame is a single flowing
937
+ * page, not paginated. */
938
+ function paginatedFrames(bundle) {
939
+ return bundle.frames.filter((frame) => frame.layout === 'pages'
940
+ && typeof frame.geometry.width === 'number'
941
+ && typeof frame.geometry.height === 'number');
942
+ }
943
+ /** Whether a HOST-LESS render (PNG/PDF/inspect/standalone download) should carry
944
+ * the Paged.js source to fragment this bundle into a page column. THE single
945
+ * source of truth for that decision across every host-less caller (the headless
946
+ * render, the export route, the MCP export tool), so none drifts from the
947
+ * builder's actual column layout.
948
+ *
949
+ * Requires a FULLY-paginated document — every frame is a `pages` frame — with at
950
+ * least one fixed page box. A MIXED artifact (pages + other layouts) is NOT
951
+ * paginated host-less: the column layout ({@link isPagesArtifact}) wouldn't
952
+ * apply, so it would fall to the clipped grid AND the render's page-box selector
953
+ * would switch to `.pagedjs_page` and drop the non-page frames entirely. Instead
954
+ * a mixed artifact renders as the grid with every frame present (the live editor,
955
+ * which PROMOTES pages into the grid, is the surface that paginates mixed). This
956
+ * also drops the `.some(layout === 'pages')` variants that shipped ~500KB of
957
+ * Paged.js for an auto/fill `pages` frame the builder never paginates. */
958
+ export function bundleNeedsPagination(bundle) {
959
+ return isPagesArtifact(bundle) && paginatedFrames(bundle).length > 0;
960
+ }
961
+ /** The effective page margins: author `pageMargins` overrides per side, each
962
+ * absent side falling back to the platform default. The single source the
963
+ * `@page` rule and the furniture positioning both read, so they can't diverge. */
964
+ function resolvePageMargins(frame) {
965
+ const m = frame.pageMargins;
966
+ return {
967
+ top: m?.top ?? DEFAULT_PAGE_MARGINS.top,
968
+ right: m?.right ?? DEFAULT_PAGE_MARGINS.right,
969
+ bottom: m?.bottom ?? DEFAULT_PAGE_MARGINS.bottom,
970
+ left: m?.left ?? DEFAULT_PAGE_MARGINS.left,
971
+ };
972
+ }
973
+ /** The OVERRIDABLE `@page` defaults for one document frame: author margins and a
974
+ * "Page N of M" counter in the bottom-RIGHT corner. Bottom-right (not -center) so
975
+ * it never sits under a centered/left footer furniture band, which also lives in
976
+ * the bottom margin. This sheet is applied BEFORE the author's shared CSS, so an
977
+ * author can override the margin and the counter box with their own CSS Paged
978
+ * Media. The page SIZE is NOT here — it is locked to the frame geometry by
979
+ * pageSizeRuleCss (applied LAST) so author CSS can't desync the page box from the
980
+ * canvas frame. Passed to Paged.js as stylesheet TEXT (never a URL — no fetch
981
+ * under `connect-src 'none'`). */
982
+ function pageRuleCss(frame) {
983
+ const m = resolvePageMargins(frame);
984
+ return `@page{margin:${m.top}px ${m.right}px ${m.bottom}px ${m.left}px;`
985
+ + `@bottom-right{content:"Page " counter(page) " of " counter(pages);`
986
+ + `font:12px var(--sg-furniture-font, system-ui, -apple-system, sans-serif);color:#6b7280;}}`;
987
+ }
988
+ /** The AUTHORITATIVE `@page { size }` rule, locked to the frame geometry. Applied
989
+ * as the LAST sheet (after author CSS) so the paginated page box always matches
990
+ * the canvas frame's geometry — the page SIZE is the frame's `geometry`, not
991
+ * something author CSS overrides (which would clip/gap the geometry-forced frame
992
+ * box and desync the reported page count). Margins/margin-boxes stay overridable.
993
+ * This locks the GENERIC `@page` size (the common case); a named/pseudo page with
994
+ * its own size (e.g. `@page cover { size: A4 }`) is a deliberate advanced
995
+ * divergence and is left to the author — it will simply not match the canvas
996
+ * frame box, which is their choice. */
997
+ function pageSizeRuleCss(frame) {
998
+ const width = frame.geometry.width;
999
+ const height = frame.geometry.height;
1000
+ return `@page{size:${width}px ${height}px;}`;
1001
+ }
1002
+ /** Base style for the injected per-page furniture (running header/footer). Only
1003
+ * font/color/positioning-context here — the actual top/bottom/left/right offset
1004
+ * is set INLINE per page in the bootstrap's addFurniture, because it depends on
1005
+ * the frame's (possibly author-overridden) page margins. Shared by the
1006
+ * editor/export page sheet (paginationHostCss) and the present scroll column
1007
+ * (presentDocumentLayoutCss) so the placement can't drift. */
1008
+ function furniturePositionCss() {
1009
+ return `[data-sg-furniture]{position:absolute;font:12px var(--sg-furniture-font, system-ui, -apple-system, sans-serif);color:#374151;pointer-events:none;}`;
1010
+ }
1011
+ /** Host CSS that neutralizes Paged.js's default preview chrome (gray backdrop,
1012
+ * centering, shadows) so each promoted page sits flush as a white artboard, and
1013
+ * carries the base style for the injected header/footer furniture (its offset is
1014
+ * set inline per page from the frame's margins). */
1015
+ function paginationHostCss() {
1016
+ return `.pagedjs_pages{display:block;width:auto;padding:0;background:transparent;}
1017
+ .pagedjs_page{margin:0;background:#fff;position:relative;box-shadow:none;}
1018
+ .pagedjs_sheet{box-shadow:none;}
1019
+ [data-sg-derived] .pagedjs_page{margin:0;}
1020
+ ${furniturePositionCss()}`;
1021
+ }
1022
+ /** The in-sandbox pagination bootstrap. After fonts settle it fragments each
1023
+ * paginated `document` frame's flowing content via Paged.js and injects per-page
1024
+ * running header/footer furniture (the first/last page variants override middle).
1025
+ *
1026
+ * `promote` selects the DOM outcome:
1027
+ * - true (live host: editor/present): every page box is PROMOTED to a top-level
1028
+ * `[data-sg-frame]` with a derived id (`<sourceId>__p<n>`) so derived pages
1029
+ * reuse the same per-frame machinery as authored frames (host chrome,
1030
+ * selection, present, inspect); a `frame-pages` message tells the host to lay
1031
+ * them out in a column.
1032
+ * - false (export/print, host:'none'): pages stay in Paged.js's native
1033
+ * `.pagedjs_page` structure in place, so Chromium's print engine maps each
1034
+ * page box to one PDF page (`preferCSSPageSize`) — no guillotine.
1035
+ *
1036
+ * Runs after the Paged.js source defines the UMD global. */
1037
+ function paginationBootstrap(frames, artifactId, promote, sharedCss, renderId, hostedCanvas) {
1038
+ const configById = {};
1039
+ for (const frame of frames) {
1040
+ configById[frame.id] = {
1041
+ css: pageRuleCss(frame),
1042
+ sizeCss: pageSizeRuleCss(frame),
1043
+ width: frame.geometry.width,
1044
+ height: frame.geometry.height,
1045
+ title: frame.title || 'Document',
1046
+ margins: resolvePageMargins(frame),
1047
+ ...(frame.furniture ? { furniture: frame.furniture } : {}),
1048
+ };
1049
+ }
1050
+ return `
1051
+ (() => {
1052
+ const artifactId = ${JSON.stringify(artifactId)};
1053
+ const renderId = ${JSON.stringify(renderId)};
1054
+ const GAP = ${FRAME_LAYOUT_DEFAULT_GAP};
1055
+ const PROMOTE = ${JSON.stringify(promote)};
1056
+ const HOSTED_CANVAS = ${JSON.stringify(hostedCanvas)};
1057
+ // Runtime twin of the core sanitizer (src/core/artifact-paged-css.ts), injected
1058
+ // verbatim. Neutralizes every non-absolute url() to about:blank in the CSS handed
1059
+ // to Paged.js, because Paged.js calls new URL(value) (no base) on each url() token
1060
+ // and a scheme-less ref throws synchronously, aborting the whole pagination run.
1061
+ // Only the Paged-fed copy is sanitized — the head <style> keeps real url()s and
1062
+ // paints fonts/backgrounds. Runs AFTER asset resolution (the embedded SHARED_CSS
1063
+ // is already token-rewritten), so it can't fight the ?at= rewrite.
1064
+ ${SANITIZE_CSS_URLS_TWIN}
1065
+ const SHARED_CSS = sanitizeCssUrlsForPagination(${JSON.stringify(sharedCss)});
1066
+ const PAGINATE = ${JSON.stringify(configById)};
1067
+ const cssEscape = (value) => (window.CSS && CSS.escape) ? CSS.escape(value) : String(value);
1068
+ // The UMD global is Paged (paged.js) or PagedModule (paged.min.js).
1069
+ const Paged = window.Paged || window.PagedModule;
1070
+ // Pick the page-position variant: page 1 -> first (or middle), last page -> last
1071
+ // (or middle), every other page -> middle.
1072
+ const pickSlot = (slots, index, count) => index === 0
1073
+ ? (slots.first || slots.middle)
1074
+ : (index === count - 1 ? (slots.last || slots.middle) : slots.middle);
1075
+ const addRegion = (page, html, region, margins) => {
1076
+ if (!html) return;
1077
+ const el = document.createElement('div');
1078
+ el.setAttribute('data-sg-furniture', '');
1079
+ el.setAttribute('data-sg-furniture-region', region);
1080
+ // left/right inset to the side margins so the band aligns to the content column.
1081
+ el.style.left = margins.left + 'px';
1082
+ el.style.right = margins.right + 'px';
1083
+ el.innerHTML = html;
1084
+ page.appendChild(el);
1085
+ // Position from the MEASURED height so a tall letterhead never overlaps the
1086
+ // body: bottom-align the header to just above the content (within the top
1087
+ // margin), top-align the footer to just below the content (within the bottom
1088
+ // margin). Clamp to a min inset from the page edge. The auto "Page N of M"
1089
+ // counter is bottom-RIGHT, so a centered/left footer band clears it. If a
1090
+ // margin is smaller than its furniture the author must grow pageMargins —
1091
+ // out-of-flow furniture can't reserve space.
1092
+ const GAP = 10, MIN_INSET = 8;
1093
+ const place = () => {
1094
+ const h = el.offsetHeight;
1095
+ if (region === 'header') el.style.top = Math.max(MIN_INSET, margins.top - GAP - h) + 'px';
1096
+ else el.style.bottom = Math.max(MIN_INSET, margins.bottom - GAP - h) + 'px';
1097
+ };
1098
+ place();
1099
+ // A logo <img> without a fixed height measures 0 until it loads, which would
1100
+ // mis-place the band; re-place once each image settles (the render waits for
1101
+ // network-idle, so the reposition lands before capture).
1102
+ el.querySelectorAll('img').forEach((img) => { if (!img.complete) img.addEventListener('load', place); });
1103
+ };
1104
+ const addFurniture = (page, furniture, index, count, margins) => {
1105
+ if (furniture.header) addRegion(page, pickSlot(furniture.header, index, count), 'header', margins);
1106
+ if (furniture.footer) addRegion(page, pickSlot(furniture.footer, index, count), 'footer', margins);
1107
+ };
1108
+ const paginate = async () => {
1109
+ if (!Paged || !Paged.Previewer) return;
1110
+ // Paged.js fragments after fonts settle so line breaks match the final type.
1111
+ // The host inlines workspace-asset fonts as data: URLs, so this normally
1112
+ // resolves immediately; but TIME-BOX it so a font that falls back to a slow
1113
+ // network endpoint can't stall pagination for many seconds — past the cap we
1114
+ // paginate with whatever loaded (worst case: a fallback-metric reflow when the
1115
+ // late font swaps in, far better than a multi-second blank canvas).
1116
+ try {
1117
+ if (document.fonts && document.fonts.ready) {
1118
+ await Promise.race([document.fonts.ready, new Promise(function (r) { setTimeout(r, ${FONT_READY_TIMEOUT_MS}); })]);
1119
+ }
1120
+ } catch {}
1121
+ const expansions = [];
1122
+ // Frames whose pagination THREW (e.g. a CSS pattern Paged.js still chokes on).
1123
+ // Reported to the host so it can surface a non-blocking "couldn't paginate"
1124
+ // hint instead of silently showing a clipped, margin-less single page.
1125
+ const failed = [];
1126
+ for (const id of Object.keys(PAGINATE)) {
1127
+ const source = document.querySelector('[data-sg-frame-id="' + cssEscape(id) + '"]');
1128
+ if (!source || !source.parentNode) continue;
1129
+ const cfg = PAGINATE[id];
1130
+ const content = document.createElement('div');
1131
+ // Wrap the flowing stream in a single container element. Paged.js's
1132
+ // createBreakToken walks up from the break node and dereferences a null
1133
+ // parent when the paginated root's DIRECT children are the breakable blocks
1134
+ // (a long paragraph split mid-element crashes); a wrapper gives every block
1135
+ // a non-null parent chain within the root. (Verified: bare children throw
1136
+ // "Cannot read properties of null (reading 'getAttribute')"; wrapped works.)
1137
+ content.innerHTML = '<div data-sg-doc-flow>' + source.innerHTML + '</div>';
1138
+ // Hoist any <style>/<link> out of the flowing stream into <head>. A style
1139
+ // node sitting IN the paginated flow trips Paged.js's fragmenter (it counts
1140
+ // as a child to walk but has no box) — in the editor surface it yields a
1141
+ // blank first page + over-pagination (e.g. an inline @font-face block paged a
1142
+ // 2-page letter to 4). Styles still apply globally from <head>, where they
1143
+ // belong. Only document frames reach this bootstrap, so decks/apps are
1144
+ // untouched. We ALSO collect inline <style> text into inlineCss and feed it
1145
+ // to the paginator below: Paged.js only honors @page / break / running rules
1146
+ // from the sheets passed to preview(), so an author who put those in an
1147
+ // inline <style> (rather than shared.files) would otherwise see them painted
1148
+ // but ignored for pagination.
1149
+ let inlineCss = '';
1150
+ content.querySelectorAll('style, link[rel="stylesheet"]').forEach((node) => {
1151
+ if (node.tagName === 'STYLE') inlineCss += (node.textContent || '') + ' ';
1152
+ document.head.appendChild(node);
1153
+ });
1154
+ // Render straight into the source frame in BOTH modes (in place). Promote
1155
+ // then moves each page box out to a top-level frame (the canvas owns layout);
1156
+ // export leaves them in place so Paged.js's print structure maps to PDF pages.
1157
+ // Rendering promote into an OFFSCREEN position:absolute container made Paged.js
1158
+ // spuriously split the flow wrapper and emit a blank leading page (plus a
1159
+ // tightened first page) whenever an author used a position:running() letterhead
1160
+ // band — an editor-canvas-only defect (export, which always rendered in place,
1161
+ // was clean). Rendering in place gives promote the exact in-flow geometry
1162
+ // export uses, so the running-element pagination matches. data-sg-derived
1163
+ // still tags the source so paginationHostCss neutralizes Paged.js preview
1164
+ // chrome while the pages live inside it (before promotion).
1165
+ // Capture the authored markup before clearing so a pagination FAILURE restores
1166
+ // the frame to its EXACT original DOM (an un-paginated single flow), not the
1167
+ // doc-flow-wrapped, style-hoisted content copy — which would drop direct-child
1168
+ // selectors like [data-sg-frame-id] > .cover. (source still holds its original
1169
+ // inline styles here: the hoist above moved style/link out of the content clone.)
1170
+ const originalHtml = source.innerHTML;
1171
+ if (PROMOTE) source.setAttribute('data-sg-derived', '');
1172
+ source.innerHTML = '';
1173
+ let pageEls;
1174
+ try {
1175
+ const previewer = new Paged.Previewer();
1176
+ // Sheet ORDER is the cascade, in three layers:
1177
+ // 1. sg-pagination.css — the OVERRIDABLE platform defaults (margins +
1178
+ // bottom-right page counter), FIRST so author CSS can override them.
1179
+ // 2. sg-shared.css — the AUTHOR's CSS, so their @page margins, margin
1180
+ // boxes (@top-center/@bottom-left/…), named pages, running elements
1181
+ // (position:running()), and break rules win over our defaults. This is
1182
+ // what keeps documents fully open to divergent CSS Paged Media layouts.
1183
+ // 3. sg-page-size.css — the AUTHORITATIVE @page{size}, LAST, locked to the
1184
+ // frame geometry so author CSS can't desync the page box from the
1185
+ // canvas frame (which is sized + laid out from geometry).
1186
+ // (1b) sg-frame-inline.css — CSS lifted from the frame's own inline <style>
1187
+ // blocks, in the author layer so its @page/break/running rules paginate
1188
+ // too. Objects are CSS TEXT (no fetch under connect-src 'none').
1189
+ const sheets = [{ 'sg-pagination.css': cfg.css }];
1190
+ if (SHARED_CSS) sheets.push({ 'sg-shared.css': SHARED_CSS });
1191
+ // Sanitize inline frame CSS too: a frame <style> with a relative url()
1192
+ // would crash Paged.js exactly like the shared sheet. (SHARED_CSS is
1193
+ // sanitized once up top.)
1194
+ const safeInlineCss = sanitizeCssUrlsForPagination(inlineCss);
1195
+ if (safeInlineCss) sheets.push({ 'sg-frame-inline.css': safeInlineCss });
1196
+ sheets.push({ 'sg-page-size.css': cfg.sizeCss });
1197
+ await previewer.preview(content, sheets, source);
1198
+ pageEls = Array.prototype.slice.call(source.querySelectorAll('.pagedjs_page'));
1199
+ } catch (error) {
1200
+ console.error('Artifact pagination failed for frame ' + id, error);
1201
+ failed.push({ id: id, reason: String((error && error.message) || error) });
1202
+ // Restore the source to its exact authored DOM as an un-paginated single flow
1203
+ // (both modes now render in place, so the source was cleared above).
1204
+ source.removeAttribute('data-sg-derived');
1205
+ source.innerHTML = originalHtml;
1206
+ continue;
1207
+ }
1208
+ const furniture = cfg.furniture || {};
1209
+ const margins = cfg.margins;
1210
+ if (!PROMOTE) {
1211
+ pageEls.forEach((page, index) => addFurniture(page, furniture, index, pageEls.length, margins));
1212
+ source.setAttribute('data-sg-paginated', '');
1213
+ source.setAttribute('data-sg-pages', String(pageEls.length));
1214
+ continue;
1215
+ }
1216
+ const startLeft = source.offsetLeft;
1217
+ let cursorTop = source.offsetTop;
1218
+ const reported = [];
1219
+ pageEls.forEach((page, index) => {
1220
+ addFurniture(page, furniture, index, pageEls.length, margins);
1221
+ // Force the page-box size on the moved element so it survives leaving the
1222
+ // Paged.js .pagedjs_pages flow; margin boxes use custom props set on
1223
+ // .pagedjs_page itself, which travel with it.
1224
+ page.style.width = cfg.width + 'px';
1225
+ page.style.height = cfg.height + 'px';
1226
+ const pid = id + '__p' + (index + 1);
1227
+ const frame = document.createElement('section');
1228
+ frame.setAttribute('data-sg-frame', '');
1229
+ frame.setAttribute('data-sg-frame-id', pid);
1230
+ frame.setAttribute('data-frame-layout', 'pages');
1231
+ frame.setAttribute('data-sg-derived-from', id);
1232
+ frame.setAttribute('data-sg-page', String(index + 1));
1233
+ frame.setAttribute('role', 'group');
1234
+ frame.setAttribute('aria-label', cfg.title + ' — page ' + (index + 1));
1235
+ frame.style.width = cfg.width + 'px';
1236
+ frame.style.height = cfg.height + 'px';
1237
+ // Re-establish BOTH page counters that Paged.js kept on the .pagedjs_pages
1238
+ // container we removed by promoting each page to its own top-level frame:
1239
+ // the pages-total on EVERY page so "of M" resolves M (not 0), and a
1240
+ // page-zero reset on the FIRST page so the running number accumulates across
1241
+ // the promoted sibling frames (1..M). Without an explicit reset of the page
1242
+ // counter on a common scope, Chromium implicitly resets it per element and
1243
+ // every footer reads "Page 1". counter-reset scopes to following siblings,
1244
+ // so resetting on the first page also restarts numbering per document when an
1245
+ // artifact has more than one paginated frame.
1246
+ frame.style.counterReset = (index === 0 ? 'page 0 ' : '') + 'pages ' + pageEls.length;
1247
+ // Initial column placement (host apply-layout refines with the same math).
1248
+ frame.style.left = startLeft + 'px';
1249
+ frame.style.top = cursorTop + 'px';
1250
+ cursorTop += cfg.height + GAP;
1251
+ frame.appendChild(page);
1252
+ source.parentNode.insertBefore(frame, source);
1253
+ reported.push({ id: pid, width: cfg.width, height: cfg.height });
1254
+ });
1255
+ // Promotion moved every page box out of the source frame; drop the now-empty
1256
+ // source (its Paged.js .pagedjs_pages shell). Both modes render in place now,
1257
+ // so there is no separate offscreen container to remove.
1258
+ source.parentNode.removeChild(source);
1259
+ expansions.push({ sourceId: id, title: cfg.title, pages: reported });
1260
+ }
1261
+ // A document's author CSS usually sets a body background (the page color). The
1262
+ // bootstrap hoists the frame's inline style to head at runtime, so that rule wins
1263
+ // over the platform's transparent canvas and paints the WHOLE hosted surface
1264
+ // behind the page boxes -- the editor grid reads as a solid slab, the present
1265
+ // view loses its page separation -- instead of pages floating on the canvas.
1266
+ // Re-assert the transparent canvas LAST (after the hoisted author styles): the
1267
+ // page boxes keep their own background, so pages stay their page color and the
1268
+ // gaps show the canvas. HOSTED_CANVAS only (host iframe: editor grid + live
1269
+ // present), so standalone export / PDF / PNG -- where body IS the document
1270
+ // backdrop -- are untouched. Runs for both promote and present (present returns
1271
+ // just below). (Only document frames reach this bootstrap. NOTE: no backticks in
1272
+ // this string-built bootstrap -- they close the template literal.)
1273
+ if (HOSTED_CANVAS) {
1274
+ const canvasReset = document.createElement('style');
1275
+ canvasReset.setAttribute('data-sg-canvas-reset', '');
1276
+ canvasReset.textContent = 'html,body{background:transparent !important;}';
1277
+ document.head.appendChild(canvasReset);
1278
+ }
1279
+ if (!PROMOTE) return;
1280
+ // Renumber data-frame-index across all top-level frames in DOM order so
1281
+ // selection's frameIndex stays consistent after promotion.
1282
+ Array.prototype.slice.call(document.querySelectorAll('[data-sg-frame]'))
1283
+ .forEach((el, i) => el.setAttribute('data-frame-index', String(i)));
1284
+ // Always post — even with zero successful expansions — so the host knows
1285
+ // pagination has SETTLED and stops holding the reveal (a frame that failed
1286
+ // to paginate just renders as its un-paginated single flow).
1287
+ try { parent.postMessage({ channel: 'studiograph-artifact', artifactId, type: 'frame-pages', renderId, expansions, failed }, '*'); } catch {}
1288
+ };
1289
+ if (document.readyState === 'loading') window.addEventListener('DOMContentLoaded', () => { paginate(); });
1290
+ else paginate();
1291
+ })();`;
1292
+ }
1293
+ /**
1294
+ * Build the single sandboxed-iframe document for a frame-model bundle. Every
1295
+ * surface calls this; `host` selects whether a live host drives chrome/transform
1296
+ * (`iframe`) or the file is self-contained (`none`).
1297
+ */
1298
+ export function buildFrameDocument(bundle, ctx) {
1299
+ const surface = ctx.surface ?? (ctx.host === 'iframe' ? 'editor' : 'export');
1300
+ const isPresent = surface === 'present';
1301
+ const fullBleed = isFullBleed(bundle);
1302
+ // A whiteboard is one large pannable surface: present fits + pans it (host-
1303
+ // driven) rather than stepping, so it stays on the grid layout + frame runtime.
1304
+ const whiteboard = isWhiteboard(bundle);
1305
+ // A whiteboard outside the editor (present) is always in the hand tool, so the
1306
+ // grab cursor is baked into the static CSS — instant from first paint, rather
1307
+ // than waiting for the runtime's load handler (the source of the cursor lag).
1308
+ // The editor keeps the JS-driven cursor because its tool toggles.
1309
+ const handCursorByDefault = whiteboard && surface !== 'editor' && ctx.host === 'iframe';
1310
+ // A standalone INTERACTIVE whiteboard (downloaded HTML): no host, so the file
1311
+ // self-hosts the cover-clamp pan/zoom + a built-in toolbar. A static PDF/PNG
1312
+ // render (interactive unset) keeps the full-canvas grid so it captures it all.
1313
+ const whiteboardStandalone = whiteboard && ctx.host === 'none' && !!ctx.interactive;
1314
+ // A standalone INTERACTIVE deck (downloaded HTML for slides / an artboard set):
1315
+ // no host, so the file self-hosts the present STEPPER (fit-centered active frame
1316
+ // + prev/next/restart controls), reproducing the in-app present experience. A
1317
+ // whiteboard pans, a pages artifact scrolls, a full-bleed app fills — those are
1318
+ // not stepped, so they are excluded here.
1319
+ const deckStandalone = ctx.host === 'none' && !!ctx.interactive
1320
+ && !whiteboard && !fullBleed && !isPagesArtifact(bundle);
1321
+ // A present document scrolls through its pages (PDF-style) instead of stepping
1322
+ // frame-by-frame: it keeps Paged.js's natural vertical .pagedjs_pages flow (no
1323
+ // promotion) and uses the scroll-column layout + a non-stepper runtime.
1324
+ const presentDocument = isPresent && !fullBleed && isPagesArtifact(bundle);
1325
+ // A standalone (downloaded HTML) document reads the same way: a PDF-style page
1326
+ // column that scrolls natively. surface is 'export' (not 'present') and there is
1327
+ // no host, so it gets the scroll-reader layout + pagination but no stepper/pan
1328
+ // chrome — without this it falls through to the editor GRID (frames stacked at
1329
+ // the origin, no scroll).
1330
+ const documentStandalone = ctx.host === 'none' && !!ctx.interactive && !fullBleed && isPagesArtifact(bundle);
1331
+ // A STATIC document export (PNG/PDF — host:'none', non-interactive) lays pages
1332
+ // out as a column too. The grid would give the single `pages` source frame a
1333
+ // one-page fixed height + overflow:hidden, clipping every page after the first
1334
+ // (Paged.js stacks them inside that clipped box); the column stacks each
1335
+ // `.pagedjs_page` as a visible, measurable box so per-page PNG/PDF capture sees
1336
+ // every page.
1337
+ const documentExport = ctx.host === 'none' && !ctx.interactive && !fullBleed && isPagesArtifact(bundle);
1338
+ // Every path that lays pages out as a column rather than the grid.
1339
+ const scrollDocument = presentDocument || documentStandalone || documentExport;
1340
+ const layout = computeFrameLayout(bundle.frames, { ...ctx.layout, measuredHeights: ctx.measuredHeights });
1341
+ const csp = artifactCsp(ctx.assets, ctx.baseHref ? { allowBaseOrigin: ctx.baseHref } : undefined);
1342
+ const finalize = (html) => applyAssetResolution(html, ctx.assets);
1343
+ // Full-bleed fills the stage; a present document scrolls its page column; else
1344
+ // present stacks frames (stepper) and editor/export use the grid.
1345
+ const layoutCss = whiteboardStandalone
1346
+ ? whiteboardStandaloneLayoutCss(bundle)
1347
+ : deckStandalone
1348
+ ? deckStandaloneLayoutCss(bundle)
1349
+ : fullBleed
1350
+ ? fullBleedLayoutCss(bundle)
1351
+ : scrollDocument
1352
+ ? presentDocumentLayoutCss(bundle, surface)
1353
+ : isPresent && !whiteboard
1354
+ ? presentLayoutCss(bundle)
1355
+ : frameLayoutCss(bundle, layout, ctx.host === 'iframe' ? ctx.colorScheme : undefined);
1356
+ // A present document reads natively (scroll): the frame runtime with a
1357
+ // non-editor surface neither hijacks the wheel nor selects — exactly the
1358
+ // read-only scroll we want. A whiteboard present pans/zooms (host-driven), so
1359
+ // it also uses the frame runtime (with navigation forwarding), not the stepper.
1360
+ // A standalone whiteboard self-hosts pan/zoom (no parent host). Slides present
1361
+ // uses the stepper runtime.
1362
+ const whiteboardCanvas = whiteboardStandalone ? whiteboardCanvasSize(bundle) : null;
1363
+ const runtimeScript = whiteboardStandalone
1364
+ ? whiteboardStandaloneRuntime(whiteboardCanvas.width, whiteboardCanvas.height)
1365
+ : deckStandalone
1366
+ ? deckStandaloneRuntime()
1367
+ : isPresent && !presentDocument && !whiteboard
1368
+ ? presentRuntimeScript(bundle.artifactId)
1369
+ : frameRuntimeScript(bundle.artifactId, surface, fullBleed, whiteboard);
1370
+ // Document frames paginate when a Paged.js source is supplied (full-bleed is a
1371
+ // single non-document frame, never paginated).
1372
+ const paginate = !fullBleed && ctx.pagedSource ? paginatedFrames(bundle) : [];
1373
+ // Promote each page to a top-level frame for the live host's grid (editor) — but
1374
+ // NOT for a present document, which keeps Paged.js's native vertical flow so its
1375
+ // pages scroll as one column (export/host:none never promotes either).
1376
+ const promote = ctx.host === 'iframe' && !presentDocument;
1377
+ const head = [
1378
+ '<meta charset="utf-8">',
1379
+ `<meta http-equiv="Content-Security-Policy" content="${csp}">`,
1380
+ ctx.baseHref ? `<base href="${escapeAttribute(ctx.baseHref)}">` : '',
1381
+ '<meta name="generator" content="Studiograph Artifact Canvas">',
1382
+ `<title>${escapeHtml(bundle.title)}</title>`,
1383
+ bundle.shared?.head ?? '',
1384
+ tokensStyleTag(bundle.tokens),
1385
+ // The whiteboard ink-token contract (theme-aware --sg-ink/-muted/-surface).
1386
+ // Before the author's shared CSS so authored rules can reference the vars;
1387
+ // only a whiteboard surface is platform-themed, so other layouts emit nothing.
1388
+ whiteboard ? `<style data-artifact-whiteboard-tokens>${whiteboardThemeTokensCss(ctx.colorScheme, ctx.host, whiteboardStandalone)}</style>` : '',
1389
+ sharedStyleTags(bundle),
1390
+ `<style data-artifact-frame-layout>\n${layoutCss}\n</style>`,
1391
+ // Bake the grab cursor for an always-hand surface (present whiteboard) so it
1392
+ // shows from first paint instead of waiting for the runtime's load handler.
1393
+ handCursorByDefault ? '<style data-artifact-cursor>html,body{cursor:grab;}</style>' : '',
1394
+ // The editor/export page-neutralization + furniture CSS. A present document
1395
+ // folds its own page chrome + furniture into presentDocumentLayoutCss (its
1396
+ // pages scroll, they aren't promoted/printed), so it skips this.
1397
+ paginate.length && !scrollDocument ? `<style data-artifact-pagination>\n${paginationHostCss()}\n</style>` : '',
1398
+ libraryTags(bundle.libraries ?? [], ctx.librarySources),
1399
+ // A live host (iframe) drives chrome/transform; a standalone interactive
1400
+ // whiteboard / deck self-hosts its own pan-zoom / stepper — all need the runtime.
1401
+ ctx.host === 'iframe' || whiteboardStandalone || deckStandalone ? `<script data-artifact-runtime>${escapeScript(runtimeScript)}</script>` : '',
1402
+ ].filter(Boolean).join('\n');
1403
+ // A host-less present render (PNG/PDF/inspect of the present stage) has no
1404
+ // runtime to activate a frame, and present CSS hides all but the active one —
1405
+ // so statically mark frame 0 active. Only the stepper-present path needs it
1406
+ // (a present document scrolls; a whiteboard/full-bleed present fills).
1407
+ const staticPresentActive = ctx.host === 'none' && isPresent && !scrollDocument && !whiteboard && !fullBleed;
1408
+ const body = [
1409
+ frameContainersHtml(bundle, staticPresentActive),
1410
+ whiteboardStandalone ? whiteboardStandaloneToolbarHtml() : '',
1411
+ deckStandalone ? deckStandaloneControlsHtml() : '',
1412
+ paginate.length ? `<script data-artifact-paged>${escapedPagedSource(ctx.pagedSource)}</script>` : '',
1413
+ paginate.length ? `<script data-artifact-pagination>${escapeScript(paginationBootstrap(paginate, bundle.artifactId, promote, sharedCssText(bundle), ctx.renderId ?? '', ctx.host === 'iframe'))}</script>` : '',
1414
+ brokenImageScriptTag(),
1415
+ sharedScriptTags(bundle),
1416
+ ].filter(Boolean).join('\n');
1417
+ return finalize(`<!doctype html>
1418
+ <html data-artifact-surface="${escapeAttribute(surface)}">
1419
+ <head>
1420
+ ${head}
1421
+ </head>
1422
+ <body>
1423
+ ${body}
1424
+ </body>
1425
+ </html>`);
1426
+ }
1427
+ //# sourceMappingURL=artifact-frame-document.js.map