@neta-art/cohub-cli 10.24.0 → 10.25.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (368) hide show
  1. package/bin/cohub.js +4 -1
  2. package/dist/board-gpu/page.js +1566 -71230
  3. package/dist/bootstrap.js +67 -27
  4. package/dist/build.json +1 -1
  5. package/dist/{board-kernel/FilterPipe.js → chunks/Geometry.js} +10447 -10469
  6. package/dist/chunks/about.js +102 -0
  7. package/dist/chunks/app-realtime.js +2216 -0
  8. package/dist/chunks/app-realtime2.js +2 -0
  9. package/dist/chunks/app-ref.js +88 -0
  10. package/dist/chunks/apps.js +1423 -0
  11. package/dist/chunks/auth.js +175 -0
  12. package/dist/chunks/avatar.js +146 -0
  13. package/dist/chunks/board-export-resources.js +232 -0
  14. package/dist/chunks/board-export.js +874 -0
  15. package/dist/chunks/board-export2.js +2 -0
  16. package/dist/{board-kernel.js → chunks/board-kernel.js} +18032 -28512
  17. package/dist/chunks/board-kernel2.js +4 -0
  18. package/dist/chunks/board-profile.js +69 -0
  19. package/dist/chunks/board-simulate.js +315 -0
  20. package/dist/chunks/board-time.js +34 -0
  21. package/dist/chunks/boards.js +1943 -0
  22. package/dist/{board-kernel → chunks}/browserAll.js +9 -8
  23. package/dist/chunks/channels.js +64 -0
  24. package/dist/chunks/client.js +12606 -0
  25. package/dist/chunks/command-input.js +17 -0
  26. package/dist/chunks/commander.js +2962 -0
  27. package/dist/chunks/cron-jobs.js +163 -0
  28. package/dist/chunks/daemon.js +545 -0
  29. package/dist/chunks/daemon2.js +2 -0
  30. package/dist/chunks/desktop.js +172 -0
  31. package/dist/chunks/endpoint-options.js +26 -0
  32. package/dist/chunks/env-proxy.js +35 -0
  33. package/dist/chunks/environment.js +154 -0
  34. package/dist/chunks/feedback.js +120 -0
  35. package/dist/chunks/generations.js +379 -0
  36. package/dist/chunks/host.js +9 -0
  37. package/dist/chunks/http-put.js +131 -0
  38. package/dist/chunks/id.js +2416 -0
  39. package/dist/{board-kernel → chunks}/init.js +1 -1
  40. package/dist/chunks/install.js +11959 -0
  41. package/dist/chunks/launch.js +374 -0
  42. package/dist/chunks/local-media.js +47 -0
  43. package/dist/chunks/me.js +134 -0
  44. package/dist/chunks/media.js +315 -0
  45. package/dist/chunks/models.js +242 -0
  46. package/dist/chunks/operands.js +46 -0
  47. package/dist/chunks/package-paths.js +13 -0
  48. package/dist/chunks/policy.js +221 -0
  49. package/dist/chunks/preferences.js +29 -0
  50. package/dist/chunks/profile.js +64 -0
  51. package/dist/chunks/prompts.js +41 -0
  52. package/dist/chunks/public.js +2 -0
  53. package/dist/chunks/public2.js +244 -0
  54. package/dist/chunks/references.js +197 -0
  55. package/dist/chunks/referrals.js +90 -0
  56. package/dist/chunks/rolldown-runtime.js +26 -0
  57. package/dist/chunks/rooms-connect.js +2 -0
  58. package/dist/chunks/rooms-connect2.js +151 -0
  59. package/dist/chunks/rooms-rtc.js +309 -0
  60. package/dist/chunks/rooms.js +211 -0
  61. package/dist/chunks/run.js +220 -0
  62. package/dist/chunks/runtime.js +638 -0
  63. package/dist/chunks/runtime2.js +286 -0
  64. package/dist/chunks/runtimes.js +48 -0
  65. package/dist/chunks/safe-remote-image.js +198 -0
  66. package/dist/chunks/schemas.js +6017 -0
  67. package/dist/chunks/search.js +113 -0
  68. package/dist/chunks/self-update.js +238 -0
  69. package/dist/chunks/serve.js +1246 -0
  70. package/dist/chunks/session-status.js +24 -0
  71. package/dist/chunks/skills.js +35 -0
  72. package/dist/chunks/spaces.js +5080 -0
  73. package/dist/chunks/src.js +405 -0
  74. package/dist/chunks/supervisor.js +2511 -0
  75. package/dist/chunks/supervisor2.js +2 -0
  76. package/dist/chunks/tasks.js +82 -0
  77. package/dist/chunks/themes.js +2898 -0
  78. package/dist/chunks/version.js +2 -0
  79. package/dist/chunks/version2.js +22 -0
  80. package/dist/chunks/version3.js +18 -0
  81. package/dist/chunks/web.js +7 -0
  82. package/dist/{board-kernel → chunks}/webworkerAll.js +1 -1
  83. package/dist/runtime/native/pi-extension.js +174 -166
  84. package/dist/runtime/worker.js +27 -16
  85. package/package.json +8 -9
  86. package/dist/about.d.ts +0 -2
  87. package/dist/about.js +0 -71
  88. package/dist/app-download.d.ts +0 -11
  89. package/dist/app-download.js +0 -252
  90. package/dist/app-ref.d.ts +0 -5
  91. package/dist/app-ref.js +0 -8
  92. package/dist/app-target.d.ts +0 -26
  93. package/dist/app-target.js +0 -55
  94. package/dist/auth.d.ts +0 -45
  95. package/dist/auth.js +0 -307
  96. package/dist/avatar.d.ts +0 -55
  97. package/dist/avatar.js +0 -104
  98. package/dist/board-command-support.d.ts +0 -6
  99. package/dist/board-command-support.js +0 -88
  100. package/dist/board-export-resources.d.ts +0 -12
  101. package/dist/board-export-resources.js +0 -51
  102. package/dist/board-export.d.ts +0 -110
  103. package/dist/board-export.js +0 -592
  104. package/dist/board-fonts.d.ts +0 -11
  105. package/dist/board-fonts.js +0 -10
  106. package/dist/board-gpu/daemon.d.ts +0 -11
  107. package/dist/board-gpu/daemon.js +0 -295
  108. package/dist/board-gpu/index.d.ts +0 -33
  109. package/dist/board-gpu/index.js +0 -189
  110. package/dist/board-gpu/protocol.d.ts +0 -77
  111. package/dist/board-gpu/protocol.js +0 -1
  112. package/dist/board-kernel.d.ts +0 -5
  113. package/dist/board-media-export.d.ts +0 -17
  114. package/dist/board-media-export.js +0 -164
  115. package/dist/board-media.d.ts +0 -5
  116. package/dist/board-media.js +0 -66
  117. package/dist/board-profile.d.ts +0 -21
  118. package/dist/board-profile.js +0 -67
  119. package/dist/board-simulate.d.ts +0 -67
  120. package/dist/board-simulate.js +0 -259
  121. package/dist/board-time.d.ts +0 -3
  122. package/dist/board-time.js +0 -34
  123. package/dist/bootstrap.d.ts +0 -2
  124. package/dist/client.d.ts +0 -5
  125. package/dist/client.js +0 -24
  126. package/dist/command-input.d.ts +0 -4
  127. package/dist/command-input.js +0 -16
  128. package/dist/commands/app-commerce.d.ts +0 -2
  129. package/dist/commands/app-commerce.js +0 -228
  130. package/dist/commands/app-domains.d.ts +0 -2
  131. package/dist/commands/app-domains.js +0 -133
  132. package/dist/commands/apps.d.ts +0 -4
  133. package/dist/commands/apps.js +0 -827
  134. package/dist/commands/auth.d.ts +0 -2
  135. package/dist/commands/auth.js +0 -186
  136. package/dist/commands/boards/authoring.d.ts +0 -2
  137. package/dist/commands/boards/authoring.js +0 -166
  138. package/dist/commands/boards/examples.d.ts +0 -10
  139. package/dist/commands/boards/examples.js +0 -118
  140. package/dist/commands/boards.d.ts +0 -13
  141. package/dist/commands/boards.js +0 -836
  142. package/dist/commands/channels.d.ts +0 -2
  143. package/dist/commands/channels.js +0 -74
  144. package/dist/commands/cron-jobs.d.ts +0 -2
  145. package/dist/commands/cron-jobs.js +0 -155
  146. package/dist/commands/decision.d.ts +0 -4
  147. package/dist/commands/decision.js +0 -113
  148. package/dist/commands/desktop.d.ts +0 -10
  149. package/dist/commands/desktop.js +0 -233
  150. package/dist/commands/feedback.d.ts +0 -2
  151. package/dist/commands/feedback.js +0 -131
  152. package/dist/commands/generations.d.ts +0 -2
  153. package/dist/commands/generations.js +0 -427
  154. package/dist/commands/host.d.ts +0 -2
  155. package/dist/commands/host.js +0 -11
  156. package/dist/commands/me.d.ts +0 -2
  157. package/dist/commands/me.js +0 -121
  158. package/dist/commands/models.d.ts +0 -28
  159. package/dist/commands/models.js +0 -271
  160. package/dist/commands/profile.d.ts +0 -2
  161. package/dist/commands/profile.js +0 -81
  162. package/dist/commands/prompts.d.ts +0 -2
  163. package/dist/commands/prompts.js +0 -37
  164. package/dist/commands/public.d.ts +0 -20
  165. package/dist/commands/public.js +0 -291
  166. package/dist/commands/references.d.ts +0 -2
  167. package/dist/commands/references.js +0 -193
  168. package/dist/commands/referrals.d.ts +0 -2
  169. package/dist/commands/referrals.js +0 -88
  170. package/dist/commands/rooms-connect.d.ts +0 -17
  171. package/dist/commands/rooms-connect.js +0 -140
  172. package/dist/commands/rooms-rtc-binary.d.ts +0 -2
  173. package/dist/commands/rooms-rtc-binary.js +0 -107
  174. package/dist/commands/rooms-rtc.d.ts +0 -21
  175. package/dist/commands/rooms-rtc.js +0 -171
  176. package/dist/commands/rooms.d.ts +0 -3
  177. package/dist/commands/rooms.js +0 -277
  178. package/dist/commands/run.d.ts +0 -13
  179. package/dist/commands/run.js +0 -246
  180. package/dist/commands/runtime.d.ts +0 -3
  181. package/dist/commands/runtime.js +0 -320
  182. package/dist/commands/sandboxd-binary.d.ts +0 -11
  183. package/dist/commands/sandboxd-binary.js +0 -238
  184. package/dist/commands/search.d.ts +0 -2
  185. package/dist/commands/search.js +0 -114
  186. package/dist/commands/session-access.d.ts +0 -2
  187. package/dist/commands/session-access.js +0 -70
  188. package/dist/commands/skills.d.ts +0 -2
  189. package/dist/commands/skills.js +0 -34
  190. package/dist/commands/space-activity.d.ts +0 -26
  191. package/dist/commands/space-activity.js +0 -147
  192. package/dist/commands/space-commerce.d.ts +0 -2
  193. package/dist/commands/space-commerce.js +0 -514
  194. package/dist/commands/space-displays.d.ts +0 -2
  195. package/dist/commands/space-displays.js +0 -620
  196. package/dist/commands/space-files.d.ts +0 -5
  197. package/dist/commands/space-files.js +0 -215
  198. package/dist/commands/space-invitations.d.ts +0 -29
  199. package/dist/commands/space-invitations.js +0 -189
  200. package/dist/commands/space-turns.d.ts +0 -49
  201. package/dist/commands/space-turns.js +0 -205
  202. package/dist/commands/space-wallet.d.ts +0 -2
  203. package/dist/commands/space-wallet.js +0 -141
  204. package/dist/commands/space-webhooks.d.ts +0 -7
  205. package/dist/commands/space-webhooks.js +0 -73
  206. package/dist/commands/spaces.d.ts +0 -25
  207. package/dist/commands/spaces.js +0 -2170
  208. package/dist/commands/tasks.d.ts +0 -8
  209. package/dist/commands/tasks.js +0 -80
  210. package/dist/commands/version.d.ts +0 -2
  211. package/dist/commands/version.js +0 -21
  212. package/dist/endpoint-options.d.ts +0 -4
  213. package/dist/endpoint-options.js +0 -26
  214. package/dist/env-proxy.d.ts +0 -5
  215. package/dist/env-proxy.js +0 -20
  216. package/dist/help-path.d.ts +0 -18
  217. package/dist/help-path.js +0 -223
  218. package/dist/host/auth.d.ts +0 -20
  219. package/dist/host/auth.js +0 -119
  220. package/dist/host/login-env.d.ts +0 -1
  221. package/dist/host/login-env.js +0 -31
  222. package/dist/host/runtime.d.ts +0 -35
  223. package/dist/host/runtime.js +0 -395
  224. package/dist/host/runtimes.d.ts +0 -9
  225. package/dist/host/runtimes.js +0 -42
  226. package/dist/host/serve.d.ts +0 -2
  227. package/dist/host/serve.js +0 -117
  228. package/dist/host/workspaces.d.ts +0 -2
  229. package/dist/host/workspaces.js +0 -18
  230. package/dist/http-put.d.ts +0 -25
  231. package/dist/http-put.js +0 -132
  232. package/dist/index.d.ts +0 -2
  233. package/dist/index.js +0 -129
  234. package/dist/launcher.d.ts +0 -4
  235. package/dist/launcher.js +0 -38
  236. package/dist/local-media.d.ts +0 -2
  237. package/dist/local-media.js +0 -30
  238. package/dist/network-error.d.ts +0 -3
  239. package/dist/network-error.js +0 -22
  240. package/dist/output.d.ts +0 -46
  241. package/dist/output.js +0 -244
  242. package/dist/runtime/archive-store.d.ts +0 -54
  243. package/dist/runtime/archive-store.js +0 -379
  244. package/dist/runtime/cli-path.d.ts +0 -5
  245. package/dist/runtime/cli-path.js +0 -27
  246. package/dist/runtime/codex-usage.d.ts +0 -7
  247. package/dist/runtime/codex-usage.js +0 -11
  248. package/dist/runtime/connection.d.ts +0 -42
  249. package/dist/runtime/connection.js +0 -789
  250. package/dist/runtime/diagnostics.d.ts +0 -107
  251. package/dist/runtime/diagnostics.js +0 -392
  252. package/dist/runtime/harnesses/chained-projection.d.ts +0 -40
  253. package/dist/runtime/harnesses/chained-projection.js +0 -95
  254. package/dist/runtime/harnesses/chained-transcript.d.ts +0 -24
  255. package/dist/runtime/harnesses/chained-transcript.js +0 -62
  256. package/dist/runtime/harnesses/claude-approval.d.ts +0 -34
  257. package/dist/runtime/harnesses/claude-approval.js +0 -124
  258. package/dist/runtime/harnesses/claude-transcript.d.ts +0 -8
  259. package/dist/runtime/harnesses/claude-transcript.js +0 -138
  260. package/dist/runtime/harnesses/claude.d.ts +0 -8
  261. package/dist/runtime/harnesses/claude.js +0 -225
  262. package/dist/runtime/harnesses/codex-approval.d.ts +0 -25
  263. package/dist/runtime/harnesses/codex-approval.js +0 -69
  264. package/dist/runtime/harnesses/codex.d.ts +0 -4
  265. package/dist/runtime/harnesses/codex.js +0 -269
  266. package/dist/runtime/harnesses/cursor-transcript.d.ts +0 -37
  267. package/dist/runtime/harnesses/cursor-transcript.js +0 -183
  268. package/dist/runtime/harnesses/cursor.d.ts +0 -24
  269. package/dist/runtime/harnesses/cursor.js +0 -620
  270. package/dist/runtime/harnesses/index.d.ts +0 -16
  271. package/dist/runtime/harnesses/index.js +0 -73
  272. package/dist/runtime/harnesses/pi.d.ts +0 -4
  273. package/dist/runtime/harnesses/pi.js +0 -247
  274. package/dist/runtime/harnesses/process.d.ts +0 -31
  275. package/dist/runtime/harnesses/process.js +0 -75
  276. package/dist/runtime/harnesses/stream-json.d.ts +0 -48
  277. package/dist/runtime/harnesses/stream-json.js +0 -336
  278. package/dist/runtime/harnesses/types.d.ts +0 -117
  279. package/dist/runtime/harnesses/types.js +0 -1
  280. package/dist/runtime/harnesses/workbuddy-transcript.d.ts +0 -8
  281. package/dist/runtime/harnesses/workbuddy-transcript.js +0 -127
  282. package/dist/runtime/harnesses/workbuddy.d.ts +0 -21
  283. package/dist/runtime/harnesses/workbuddy.js +0 -123
  284. package/dist/runtime/instance.d.ts +0 -20
  285. package/dist/runtime/instance.js +0 -247
  286. package/dist/runtime/json-rpc.d.ts +0 -53
  287. package/dist/runtime/json-rpc.js +0 -212
  288. package/dist/runtime/launch.d.ts +0 -25
  289. package/dist/runtime/launch.js +0 -247
  290. package/dist/runtime/local-workspace.d.ts +0 -15
  291. package/dist/runtime/local-workspace.js +0 -52
  292. package/dist/runtime/model-catalog.d.ts +0 -12
  293. package/dist/runtime/model-catalog.js +0 -84
  294. package/dist/runtime/native/adapters.d.ts +0 -15
  295. package/dist/runtime/native/adapters.js +0 -11
  296. package/dist/runtime/native/approvals.d.ts +0 -18
  297. package/dist/runtime/native/approvals.js +0 -54
  298. package/dist/runtime/native/archive.d.ts +0 -19
  299. package/dist/runtime/native/archive.js +0 -142
  300. package/dist/runtime/native/attach.d.ts +0 -36
  301. package/dist/runtime/native/attach.js +0 -128
  302. package/dist/runtime/native/codex-link.d.ts +0 -60
  303. package/dist/runtime/native/codex-link.js +0 -322
  304. package/dist/runtime/native/config.d.ts +0 -16
  305. package/dist/runtime/native/config.js +0 -24
  306. package/dist/runtime/native/daemon.d.ts +0 -92
  307. package/dist/runtime/native/daemon.js +0 -380
  308. package/dist/runtime/native/execution.d.ts +0 -26
  309. package/dist/runtime/native/execution.js +0 -34
  310. package/dist/runtime/native/identity.d.ts +0 -9
  311. package/dist/runtime/native/identity.js +0 -15
  312. package/dist/runtime/native/ingest.d.ts +0 -263
  313. package/dist/runtime/native/ingest.js +0 -884
  314. package/dist/runtime/native/install.d.ts +0 -9
  315. package/dist/runtime/native/install.js +0 -113
  316. package/dist/runtime/native/paths.d.ts +0 -2
  317. package/dist/runtime/native/paths.js +0 -7
  318. package/dist/runtime/native/pi-extension.d.ts +0 -36
  319. package/dist/runtime/native/pi-link.d.ts +0 -69
  320. package/dist/runtime/native/pi-link.js +0 -269
  321. package/dist/runtime/native/results.d.ts +0 -41
  322. package/dist/runtime/native/results.js +0 -128
  323. package/dist/runtime/native/sessions.d.ts +0 -45
  324. package/dist/runtime/native/sessions.js +0 -87
  325. package/dist/runtime/native/transcript.d.ts +0 -89
  326. package/dist/runtime/native/transcript.js +0 -656
  327. package/dist/runtime/native/translate.d.ts +0 -46
  328. package/dist/runtime/native/translate.js +0 -299
  329. package/dist/runtime/native/transport.d.ts +0 -7
  330. package/dist/runtime/native/transport.js +0 -16
  331. package/dist/runtime/native/version.d.ts +0 -5
  332. package/dist/runtime/native/version.js +0 -21
  333. package/dist/runtime/preferences.d.ts +0 -7
  334. package/dist/runtime/preferences.js +0 -22
  335. package/dist/runtime/presentation.d.ts +0 -32
  336. package/dist/runtime/presentation.js +0 -124
  337. package/dist/runtime/process-group.d.ts +0 -5
  338. package/dist/runtime/process-group.js +0 -161
  339. package/dist/runtime/projection-store.d.ts +0 -27
  340. package/dist/runtime/projection-store.js +0 -30
  341. package/dist/runtime/space-binding.d.ts +0 -48
  342. package/dist/runtime/space-binding.js +0 -342
  343. package/dist/runtime/supervisor.d.ts +0 -19
  344. package/dist/runtime/supervisor.js +0 -441
  345. package/dist/runtime/turn-projection.d.ts +0 -41
  346. package/dist/runtime/turn-projection.js +0 -120
  347. package/dist/runtime/worker.d.ts +0 -1
  348. package/dist/safe-remote-image.d.ts +0 -36
  349. package/dist/safe-remote-image.js +0 -191
  350. package/dist/self-update.d.ts +0 -7
  351. package/dist/self-update.js +0 -202
  352. package/dist/session-status.d.ts +0 -10
  353. package/dist/session-status.js +0 -25
  354. package/dist/space-files/limit.d.ts +0 -2
  355. package/dist/space-files/limit.js +0 -16
  356. package/dist/space-files/operands.d.ts +0 -17
  357. package/dist/space-files/operands.js +0 -33
  358. package/dist/space-files/transfer.d.ts +0 -53
  359. package/dist/space-files/transfer.js +0 -297
  360. package/dist/space-files/upload.d.ts +0 -17
  361. package/dist/space-files/upload.js +0 -76
  362. package/dist/space.d.ts +0 -44
  363. package/dist/space.js +0 -192
  364. package/dist/version.d.ts +0 -2
  365. package/dist/version.js +0 -17
  366. package/dist/web.d.ts +0 -1
  367. package/dist/web.js +0 -4
  368. /package/dist/{board-kernel → chunks}/lexer.js +0 -0
@@ -0,0 +1,4 @@
1
+ import { m as parseBoardDocument } from "./id.js";
2
+ import { A as boardScriptAttachments, D as boardShaderParameters, E as boardTimedMedia, S as boardTexturePixels, T as boardMediaSpans, _ as selectBoardExportAssets, a as describeBoardScriptLanes, c as boardRenderTheme, d as inspectBoardScene, f as measureBoardText, g as planBoardExport, i as createNodeBoardScriptHost, j as hasBoardScripts, l as checkBoardShader, m as boardAutoplayLoops, n as createNodeBoardRenderer, o as describeBoardExportWarning, p as createBoardRenderSampler, r as exportBoardImageBytes, s as prepareBoardExport, t as createBoardScriptHarness, u as inspectBoardItems, v as boardAssetKey, w as boardMediaRate, x as boardTextureEdge, y as boardAssetKeySource } from "./board-kernel.js";
3
+ import { J as itemBounds, N as BOARD_SCRIPT_DRAWING_EXAMPLE, P as BOARD_SCRIPT_RAIN_EXAMPLE, S as createBoardAnimationSampler, c as boardPathTrack, d as boardSequencePatch, i as boardFrameRegions, k as boardAnimatesScriptParams, l as boardPlacePatch, s as boardRegionStep, tt as rectsIntersect, u as boardSequence, w as buildBoardScene } from "./themes.js";
4
+ export { BOARD_SCRIPT_DRAWING_EXAMPLE, BOARD_SCRIPT_RAIN_EXAMPLE, boardAnimatesScriptParams, boardAssetKey, boardAssetKeySource, boardAutoplayLoops, boardFrameRegions, boardMediaRate, boardMediaSpans, boardPathTrack, boardPlacePatch, boardRegionStep, boardRenderTheme, boardScriptAttachments, boardSequence, boardSequencePatch, boardShaderParameters, boardTextureEdge, boardTexturePixels, boardTimedMedia, buildBoardScene, checkBoardShader, createBoardAnimationSampler, createBoardRenderSampler, createBoardScriptHarness, createNodeBoardRenderer, createNodeBoardScriptHost, describeBoardExportWarning, describeBoardScriptLanes, exportBoardImageBytes, hasBoardScripts, inspectBoardItems, inspectBoardScene, itemBounds, measureBoardText, parseBoardDocument, planBoardExport, prepareBoardExport, rectsIntersect, selectBoardExportAssets };
@@ -0,0 +1,69 @@
1
+ import { C as boardModelFormat, g as planBoardExport } from "./board-kernel.js";
2
+ import { w as buildBoardScene } from "./themes.js";
3
+ import { i as settleBoardDocument, s as loadBoardDocument } from "./board-export-resources.js";
4
+ import { a as findBoardGpuBrowser, r as openBoardGpu } from "./daemon.js";
5
+ import { r as gpuResources } from "./board-export.js";
6
+ //#region src/board-profile.ts
7
+ const LARGE_OWNER = 4e3;
8
+ const LARGE_STATE = 262144;
9
+ const MANY_EFFECTS = 16;
10
+ const LARGE_MODEL = 8 * 1024 ** 2;
11
+ async function profileBoard(options) {
12
+ const browser = findBoardGpuBrowser();
13
+ if (!browser) throw new Error("Profiling needs Chrome, Chromium or Edge. Install one, or set COHUB_CHROME to its path.");
14
+ const document = await settleBoardDocument(options.spaceId, (await loadBoardDocument(options.spaceId, options.target)).document);
15
+ if (options.animation && !document.animations[options.animation]) throw new Error(`Animation ${options.animation} does not exist.`);
16
+ const plan = planBoardExport({
17
+ scene: buildBoardScene(document),
18
+ region: options.region,
19
+ scale: 1,
20
+ padding: 0
21
+ });
22
+ if (!plan) throw new Error("Nothing to profile: the region contains no items.");
23
+ const scale = Math.min(options.size.width / plan.world.width, options.size.height / plan.world.height);
24
+ const gpu = await openBoardGpu(gpuResources(options.spaceId, document), { browser });
25
+ try {
26
+ await gpu.init({
27
+ document,
28
+ animation: options.animation ?? null,
29
+ theme: "dark"
30
+ });
31
+ const profile = await gpu.profile({
32
+ time: options.time,
33
+ region: options.region,
34
+ scale,
35
+ frames: options.frames,
36
+ rounds: options.rounds,
37
+ budgetMs: options.budgetMs,
38
+ withImages: options.withImages,
39
+ imageMemory: 256 * 1024 ** 2
40
+ });
41
+ return {
42
+ ...profile,
43
+ hints: boardProfileHints(document, profile)
44
+ };
45
+ } finally {
46
+ await gpu.close();
47
+ }
48
+ }
49
+ function boardProfileHints(document, profile) {
50
+ const hints = [];
51
+ const share = (ms) => profile.frame.p50 > 0 ? ms / profile.frame.p50 : 0;
52
+ for (const owner of profile.owners) {
53
+ if (owner.filter === "always" && share(owner.ms) > .1) hints.push(`${owner.id} redraws everything under it through a filter every frame; name its filter passes and turn them on with ctx.passes() only while they show.`);
54
+ const item = document.items[owner.id];
55
+ if (item && "size" in item && Math.max(item.size.width, item.size.height) > LARGE_OWNER) hints.push(`${owner.id} is larger than any view, so its shaders never leave the screen; a Board script, or shaders on the smaller items, draw only what shows.`);
56
+ if (owner.boxes && share(owner.ms) > .1) hints.push(`${owner.id} shades every pixel of its box; if its picture changes only every few units, as pixel art or a map does, give the pass texel so it shades once per texel.`);
57
+ if (owner.state && owner.state.width * owner.state.height > LARGE_STATE) hints.push(`${owner.id} steps a ${owner.state.width}×${owner.state.height} state 60 times a second and replays it from the start in exports; keep it as small as reads well.`);
58
+ }
59
+ const noisy = profile.owners.filter((owner) => owner.ms > 1 && owner.range[1] - owner.range[0] > owner.ms);
60
+ if (noisy.length) hints.push(`${noisy.map((owner) => owner.id).join(", ")} varied more between rounds than ${noisy.length === 1 ? "its" : "their"} median; compare the frame time, or raise --rounds.`);
61
+ for (const [id, item] of Object.entries(document.items)) {
62
+ const size = item.type === "file" && boardModelFormat(item.props.src, item.props.snapshot?.mimeType) ? item.props.snapshot?.size ?? 0 : 0;
63
+ if (size > LARGE_MODEL) hints.push(`${id} is a ${(size / 1024 ** 2).toFixed(0)} MB model every viewer downloads for its card, and phones skip past 16 MB; compress it (meshopt or Draco geometry, KTX2 textures).`);
64
+ }
65
+ if (profile.effects > MANY_EFFECTS) hints.push(`${profile.effects} items draw with shadows, blurs or color filters, each in its own offscreen pass; present them only while they change, and drop neutral values.`);
66
+ return hints;
67
+ }
68
+ //#endregion
69
+ export { profileBoard };
@@ -0,0 +1,315 @@
1
+ import { t as createClient } from "./client.js";
2
+ import { d as diffMergePatch } from "./id.js";
3
+ import { A as boardScriptAttachments, D as boardShaderParameters, O as boardScriptSenseOf, a as describeBoardScriptLanes, g as planBoardExport, k as parseBoardScriptInputs, l as checkBoardShader, n as createNodeBoardRenderer, t as createBoardScriptHarness } from "./board-kernel.js";
4
+ import { J as itemBounds, tt as rectsIntersect, w as buildBoardScene } from "./themes.js";
5
+ import { i as settleBoardDocument, s as loadBoardDocument } from "./board-export-resources.js";
6
+ import { a as findBoardGpuBrowser, r as openBoardGpu } from "./daemon.js";
7
+ import { a as readSpaceFileBytes, o as resolveBundledFonts, r as gpuResources, s as runBoardExport } from "./board-export.js";
8
+ import { n as parseBoardTime } from "./board-time.js";
9
+ //#region src/board-simulate.ts
10
+ const TOOLS = [
11
+ "select",
12
+ "hand",
13
+ "play",
14
+ "text",
15
+ "shape",
16
+ "draw",
17
+ "arrow",
18
+ "frame"
19
+ ];
20
+ const POINTER_TYPES = [
21
+ "mouse",
22
+ "pen",
23
+ "touch"
24
+ ];
25
+ const MAX_STEPS = 1e4;
26
+ const MAX_TIME_MS = 6e5;
27
+ const FRAME_MS = 1e3 / 60;
28
+ function point(value, name) {
29
+ if (!Array.isArray(value) || value.length !== 2 || !value.every((n) => typeof n === "number" && Number.isFinite(n))) throw new Error(`${name} must be [x, y]`);
30
+ return {
31
+ x: value[0],
32
+ y: value[1]
33
+ };
34
+ }
35
+ function pointerInput(step, name) {
36
+ const pointerType = step.pointerType ?? "mouse";
37
+ if (!POINTER_TYPES.includes(pointerType)) throw new Error(`${name}.pointerType must be one of ${POINTER_TYPES.join(", ")}`);
38
+ const input = { pointerType };
39
+ for (const key of [
40
+ "shiftKey",
41
+ "altKey",
42
+ "ctrlKey",
43
+ "metaKey"
44
+ ]) {
45
+ if (step[key] === void 0) continue;
46
+ if (typeof step[key] !== "boolean") throw new Error(`${name}.${key} must be a boolean`);
47
+ input[key] = step[key];
48
+ }
49
+ return input;
50
+ }
51
+ function parseBoardSimulationSteps(value) {
52
+ if (!Array.isArray(value)) throw new Error("steps must be an array");
53
+ if (value.length > MAX_STEPS) throw new Error(`steps exceed the limit of ${MAX_STEPS}`);
54
+ const steps = value.map(parseStep);
55
+ if (steps.reduce((total, step) => total + ("wait" in step ? step.wait : "tap" in step ? 2 * FRAME_MS : "drag" in step ? (step.drag.length + 1) * FRAME_MS : "move" in step ? step.move.length * FRAME_MS : "pointer" in step ? FRAME_MS : 0), 0) > MAX_TIME_MS) throw new Error(`steps exceed ${MAX_TIME_MS / 6e4} minutes of simulated time`);
56
+ return steps;
57
+ }
58
+ function parseStep(entry, index) {
59
+ const name = `steps[${index}]`;
60
+ if (!entry || typeof entry !== "object" || Array.isArray(entry)) throw new Error(`${name} must be an object`);
61
+ const step = entry;
62
+ if ("wait" in step) {
63
+ const wait = typeof step.wait === "number" ? step.wait : parseBoardTime(String(step.wait), `${name}.wait`);
64
+ if (!Number.isFinite(wait) || wait < 0) throw new Error(`${name}.wait must not be negative`);
65
+ return { wait };
66
+ }
67
+ if ("tool" in step) {
68
+ if (!TOOLS.includes(step.tool)) throw new Error(`${name}.tool must be one of ${TOOLS.join(", ")}`);
69
+ return { tool: step.tool };
70
+ }
71
+ if ("tap" in step) return {
72
+ tap: point(step.tap, `${name}.tap`),
73
+ input: pointerInput(step, name)
74
+ };
75
+ if ("drag" in step) {
76
+ if (!Array.isArray(step.drag) || step.drag.length < 2) throw new Error(`${name}.drag must list at least two points`);
77
+ return {
78
+ drag: step.drag.map((entry, at) => point(entry, `${name}.drag[${at}]`)),
79
+ input: pointerInput(step, name)
80
+ };
81
+ }
82
+ if ("move" in step) {
83
+ if (!Array.isArray(step.move) || !step.move.length) throw new Error(`${name}.move must list points`);
84
+ return {
85
+ move: step.move.map((entry, at) => point(entry, `${name}.move[${at}]`)),
86
+ input: pointerInput(step, name)
87
+ };
88
+ }
89
+ if ("pointer" in step) {
90
+ if (step.pointer !== "down" && step.pointer !== "move" && step.pointer !== "up") throw new Error(`${name}.pointer must be down, move or up`);
91
+ return {
92
+ pointer: step.pointer,
93
+ at: point(step.at, `${name}.at`),
94
+ input: pointerInput(step, name)
95
+ };
96
+ }
97
+ if ("key" in step) {
98
+ if (typeof step.key !== "string" || !step.key) throw new Error(`${name}.key must be a key name`);
99
+ return { key: step.key };
100
+ }
101
+ if ("select" in step) {
102
+ if (!Array.isArray(step.select) || !step.select.every((id) => typeof id === "string")) throw new Error(`${name}.select must list item ids`);
103
+ return { select: step.select };
104
+ }
105
+ if ("input" in step) {
106
+ if (typeof step.input !== "string" || !boardScriptSenseOf(step.input)) throw new Error(`${name}.input must be a browser event, such as browser:devicemotion`);
107
+ if (!step.data || typeof step.data !== "object" || Array.isArray(step.data)) throw new Error(`${name}.data must be an object`);
108
+ return {
109
+ input: step.input,
110
+ data: step.data
111
+ };
112
+ }
113
+ if ("inputs" in step) {
114
+ if (typeof step.inputs !== "string" || !step.inputs) throw new Error(`${name}.inputs must be a Space file path`);
115
+ return { inputs: step.inputs };
116
+ }
117
+ throw new Error(`${name} must be one of wait, tool, tap, drag, move, pointer, key, select, input or inputs`);
118
+ }
119
+ async function run(harness, steps, progress, presses, readInputs) {
120
+ for (const [index, step] of steps.entries()) {
121
+ progress.step = index;
122
+ let press = null;
123
+ if ("wait" in step) await harness.advance(step.wait);
124
+ else if ("tool" in step) harness.tool = step.tool;
125
+ else if ("tap" in step) press = await harness.tap(step.tap, step.input);
126
+ else if ("drag" in step) press = await harness.drag(step.drag, step.input);
127
+ else if ("move" in step) await harness.move(step.move, step.input);
128
+ else if ("pointer" in step) press = await harness.pointer(step.pointer, step.at, step.input);
129
+ else if ("key" in step) {
130
+ await harness.key("keydown", step.key);
131
+ await harness.key("keyup", step.key);
132
+ } else if ("input" in step) await harness.input(step.input, step.data);
133
+ else if ("inputs" in step) await harness.replay(parseBoardScriptInputs(await readInputs(step.inputs)));
134
+ else await harness.select(step.select);
135
+ if (press) presses.push({
136
+ step: index,
137
+ ...press
138
+ });
139
+ }
140
+ }
141
+ function shadersOf(harness) {
142
+ const errors = {};
143
+ const shaders = [];
144
+ for (const { id } of boardScriptAttachments(harness.document)) {
145
+ const message = harness.error(id);
146
+ const output = harness.output(id);
147
+ if (message) errors[id] = message;
148
+ else if (output?.shader) shaders.push({
149
+ id,
150
+ shader: output.shader,
151
+ ...output.parameters ? { parameters: output.parameters } : {}
152
+ });
153
+ }
154
+ return {
155
+ shaders,
156
+ errors
157
+ };
158
+ }
159
+ async function checkShaders(shaders, spaceId, document) {
160
+ const browser = findBoardGpuBrowser();
161
+ const exporter = browser ? await openBoardGpu(gpuResources(spaceId, document), { browser }).catch(() => null) : null;
162
+ if (exporter) try {
163
+ return {
164
+ errors: await exporter.compile(shaders),
165
+ compiled: true
166
+ };
167
+ } finally {
168
+ await exporter.close();
169
+ }
170
+ const errors = {};
171
+ for (const { id, shader, parameters } of shaders) try {
172
+ checkBoardShader(shader, boardShaderParameters(parameters), id);
173
+ } catch (error) {
174
+ errors[id] = error instanceof Error ? error.message : String(error);
175
+ }
176
+ return {
177
+ errors,
178
+ compiled: false
179
+ };
180
+ }
181
+ async function runBoardSimulation(options) {
182
+ const client = createClient();
183
+ const document = await settleBoardDocument(options.spaceId, (await loadBoardDocument(options.spaceId, options.target)).document);
184
+ const renderer = await createNodeBoardRenderer({ fonts: resolveBundledFonts() });
185
+ const progress = {
186
+ step: -1,
187
+ phase: "starting the scripts"
188
+ };
189
+ let harness = null;
190
+ let timer;
191
+ const timeoutMs = options.timeoutMs ?? 12e4;
192
+ let stopped = false;
193
+ const expired = new Promise((_resolve, reject) => {
194
+ timer = setTimeout(() => {
195
+ stopped = true;
196
+ const busy = harness ? describeBoardScriptLanes(harness.status()) : [];
197
+ const at = harness ? ` at ${Math.round(harness.time)} ms of simulated time` : "";
198
+ const step = progress.step >= 0 ? `, step ${progress.step + 1} of ${options.steps.length}` : "";
199
+ reject(new Error([
200
+ `The simulation did not finish in ${timeoutMs / 1e3} s${at}${step}, while ${progress.phase}.`,
201
+ ...busy.map((line) => ` ${line}`),
202
+ ...!busy.length && progress.phase === "running the steps" ? [" No script was busy: the scripts keep handing each other work, or a step waits on something else."] : []
203
+ ].join("\n")));
204
+ }, timeoutMs);
205
+ });
206
+ const work = async () => {
207
+ harness = await createBoardScriptHarness({
208
+ document,
209
+ renderer,
210
+ leader: options.leader,
211
+ readModule: async (path) => new TextDecoder().decode((await readSpaceFileBytes(client, options.spaceId, path)).bytes)
212
+ });
213
+ const current = harness;
214
+ if (stopped) {
215
+ current.destroy();
216
+ throw new Error("The simulation timed out.");
217
+ }
218
+ progress.phase = "compiling shaders";
219
+ const initial = shadersOf(current);
220
+ const early = initial.shaders.length ? await checkShaders(initial.shaders, options.spaceId, current.document) : null;
221
+ const presses = [];
222
+ if (early && Object.keys(early.errors).length) return {
223
+ time: Math.round(current.time),
224
+ commits: 0,
225
+ changes: {},
226
+ errors: {
227
+ ...initial.errors,
228
+ ...early.errors
229
+ },
230
+ presses,
231
+ warnings: ["Stopped before the steps: fix the shader errors first."],
232
+ shaders: {
233
+ count: initial.shaders.length,
234
+ compiled: early.compiled
235
+ }
236
+ };
237
+ progress.phase = "running the steps";
238
+ await run(current, options.steps, progress, presses, async (path) => new TextDecoder().decode((await readSpaceFileBytes(client, options.spaceId, path)).bytes));
239
+ progress.phase = "settling the scripts";
240
+ await current.flush();
241
+ const { shaders, errors } = shadersOf(current);
242
+ const checked = new Set(initial.shaders.map(({ id }) => id));
243
+ const added = shaders.filter(({ id }) => !checked.has(id));
244
+ progress.phase = "compiling shaders";
245
+ const late = added.length ? await checkShaders(added, options.spaceId, current.document) : null;
246
+ Object.assign(errors, late?.errors);
247
+ const compiled = (early?.compiled ?? true) && (late?.compiled ?? true);
248
+ const warnings = [...current.emitFailures].map(([id, message]) => `${id}: ${message}`);
249
+ const result = {
250
+ time: Math.round(current.time),
251
+ commits: current.commits.length,
252
+ changes: diffMergePatch(document, current.document) ?? {},
253
+ errors,
254
+ presses,
255
+ warnings,
256
+ ...shaders.length ? { shaders: {
257
+ count: shaders.length,
258
+ compiled
259
+ } } : {}
260
+ };
261
+ if (options.image) {
262
+ progress.phase = "rendering the image";
263
+ const shown = await current.shown(options.image.scale);
264
+ const gpu = compiled && shaders.length > 0 && !Object.keys(errors).length && shaderShown(current.document, shaders, options.image.region);
265
+ const exported = await runBoardExport({
266
+ spaceId: options.spaceId,
267
+ target: options.target,
268
+ ...gpu ? {
269
+ document: current.document,
270
+ snapshots: await current.snapshot(),
271
+ renderer: "gpu"
272
+ } : {
273
+ document: shown.document,
274
+ ...shown.scripts ? { scripts: shown.scripts } : {}
275
+ },
276
+ region: options.image.region,
277
+ scale: options.image.scale,
278
+ theme: options.image.theme,
279
+ background: "paper",
280
+ format: options.image.format,
281
+ withImages: options.image.withImages
282
+ });
283
+ const frame = exported?.frames[0];
284
+ if (frame) result.image = {
285
+ bytes: frame.bytes,
286
+ width: frame.width,
287
+ height: frame.height
288
+ };
289
+ warnings.push(...exported?.warnings ?? []);
290
+ }
291
+ return result;
292
+ };
293
+ try {
294
+ return await Promise.race([work(), expired]);
295
+ } finally {
296
+ clearTimeout(timer);
297
+ harness?.destroy();
298
+ renderer.destroy();
299
+ }
300
+ }
301
+ function shaderShown(document, shaders, region) {
302
+ const scene = buildBoardScene(document);
303
+ const plan = planBoardExport({
304
+ scene,
305
+ region,
306
+ scale: 1
307
+ });
308
+ if (!plan) return false;
309
+ return shaders.some(({ id }) => {
310
+ const item = scene.get(id);
311
+ return !item || rectsIntersect(itemBounds(item.frame), plan.world);
312
+ });
313
+ }
314
+ //#endregion
315
+ export { parseBoardSimulationSteps, runBoardSimulation };
@@ -0,0 +1,34 @@
1
+ //#region src/board-time.ts
2
+ const UNITS = {
3
+ "": 1,
4
+ ms: 1,
5
+ s: 1e3,
6
+ m: 6e4
7
+ };
8
+ function parseBoardTime(value, name = "time") {
9
+ const match = /^\s*(\d+(?:\.\d+)?|\.\d+)\s*(ms|s|m)?\s*$/i.exec(value);
10
+ if (!match?.[1]) throw new Error(`${name}: expected a time such as 1500, 500ms, 12.5s or 2m`);
11
+ return Math.round(Number(match[1]) * (UNITS[(match[2] ?? "").toLowerCase()] ?? 1) * 1e3) / 1e3;
12
+ }
13
+ function parseBoardTimes(value, name = "--at", limit = 1e4) {
14
+ if (value.includes(",")) {
15
+ const entries = value.split(",");
16
+ if (entries.length > limit) throw new Error(`${name}: frame count exceeds the limit of ${limit}`);
17
+ return entries.map((entry) => parseBoardTime(entry, name));
18
+ }
19
+ const parts = value.split(":");
20
+ if (parts.length === 1) return [parseBoardTime(value, name)];
21
+ if (parts.length !== 3) throw new Error(`${name}: expected a time or start:end:step`);
22
+ const [start, end, step] = parts.map((part) => parseBoardTime(part, name));
23
+ if (step <= 0) throw new Error(`${name}: step must be greater than zero`);
24
+ if (end < start) throw new Error(`${name}: end must not be before start`);
25
+ const count = Math.floor((end - start) / step + 1e-9) + 1;
26
+ if (count > limit) throw new Error(`${name}: ${count} frames exceed the limit of ${limit}`);
27
+ return Array.from({ length: count }, (_, index) => Math.round((start + index * step) * 1e3) / 1e3);
28
+ }
29
+ function formatBoardTime(ms) {
30
+ if (ms < 1e3) return `${ms}ms`;
31
+ return `${Number((ms / 1e3).toFixed(3))}s`;
32
+ }
33
+ //#endregion
34
+ export { parseBoardTime as n, parseBoardTimes as r, formatBoardTime as t };