@allyhub/sdk 0.6.0 → 0.7.1

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 (262) hide show
  1. package/dist/define.d.ts +4 -0
  2. package/dist/define.js +1 -1
  3. package/dist/node_modules/@allyhub-next/audio/dist/node/index.d.ts +1 -1
  4. package/dist/node_modules/@allyhub-next/audio/dist/node/index.js +1 -1
  5. package/dist/node_modules/@allyhub-next/audio/dist/node/master.d.ts +4 -0
  6. package/dist/node_modules/@allyhub-next/audio/dist/node/master.js +1 -1
  7. package/dist/node_modules/@allyhub-next/audio/package.json +1 -1
  8. package/dist/node_modules/@allyhub-next/chart/dist/chart-xml.js +2 -2
  9. package/dist/node_modules/@allyhub-next/chart/dist/chart.d.ts +14 -5
  10. package/dist/node_modules/@allyhub-next/chart/dist/chart.js +1 -1
  11. package/dist/node_modules/@allyhub-next/chart/package.json +1 -1
  12. package/dist/node_modules/@allyhub-next/formats/dist/data/deck-code.d.ts +205 -0
  13. package/dist/node_modules/@allyhub-next/formats/dist/data/deck-code.js +2 -0
  14. package/dist/node_modules/@allyhub-next/formats/dist/data/script.d.ts +4 -1
  15. package/dist/node_modules/@allyhub-next/formats/dist/data/script.js +1 -1
  16. package/dist/node_modules/@allyhub-next/formats/dist/data/sheet.d.ts +69 -18
  17. package/dist/node_modules/@allyhub-next/formats/dist/data/sheet.js +1 -1
  18. package/dist/node_modules/@allyhub-next/formats/dist/data/slides.d.ts +847 -116
  19. package/dist/node_modules/@allyhub-next/formats/dist/data/slides.js +1 -1
  20. package/dist/node_modules/@allyhub-next/formats/dist/data/website.d.ts +20 -0
  21. package/dist/node_modules/@allyhub-next/formats/dist/data/website.js +2 -0
  22. package/dist/node_modules/@allyhub-next/formats/dist/index.d.ts +3 -0
  23. package/dist/node_modules/@allyhub-next/formats/dist/index.js +1 -1
  24. package/dist/node_modules/@allyhub-next/formats/dist/items.d.ts +1 -1
  25. package/dist/node_modules/@allyhub-next/formats/dist/items.js +1 -1
  26. package/dist/node_modules/@allyhub-next/formats/dist/media-type.d.ts +3 -0
  27. package/dist/node_modules/@allyhub-next/formats/dist/media-type.js +2 -0
  28. package/dist/node_modules/@allyhub-next/formats/dist/schemas.d.ts +501 -38
  29. package/dist/node_modules/@allyhub-next/formats/dist/schemas.js +1 -1
  30. package/dist/node_modules/@allyhub-next/formats/dist/strict.d.ts +2 -0
  31. package/dist/node_modules/@allyhub-next/formats/dist/strict.js +1 -1
  32. package/dist/node_modules/@allyhub-next/formats/package.json +2 -1
  33. package/dist/node_modules/@allyhub-next/ooxml/LICENSE +241 -0
  34. package/dist/node_modules/@allyhub-next/ooxml/dist/brightness.d.ts +31 -0
  35. package/dist/node_modules/@allyhub-next/ooxml/dist/brightness.js +2 -0
  36. package/dist/node_modules/@allyhub-next/ooxml/dist/color.d.ts +33 -0
  37. package/dist/node_modules/@allyhub-next/ooxml/dist/color.js +2 -0
  38. package/dist/node_modules/@allyhub-next/ooxml/dist/enums.d.ts +13 -0
  39. package/dist/node_modules/@allyhub-next/ooxml/dist/enums.js +2 -0
  40. package/dist/node_modules/@allyhub-next/ooxml/dist/ext.d.ts +79 -0
  41. package/dist/node_modules/@allyhub-next/ooxml/dist/ext.js +2 -0
  42. package/dist/node_modules/@allyhub-next/ooxml/dist/generated/enums.d.ts +132 -0
  43. package/dist/node_modules/@allyhub-next/ooxml/dist/generated/enums.js +2 -0
  44. package/dist/node_modules/@allyhub-next/ooxml/dist/generated/presets.d.ts +28 -0
  45. package/dist/node_modules/@allyhub-next/ooxml/dist/generated/presets.js +2 -0
  46. package/dist/node_modules/@allyhub-next/ooxml/dist/generated/spec.d.ts +4708 -0
  47. package/dist/node_modules/@allyhub-next/ooxml/dist/generated/spec.js +2 -0
  48. package/dist/node_modules/@allyhub-next/ooxml/dist/geometry/index.d.ts +57 -0
  49. package/dist/node_modules/@allyhub-next/ooxml/dist/geometry/index.js +2 -0
  50. package/dist/node_modules/@allyhub-next/ooxml/dist/index.d.ts +10 -0
  51. package/dist/node_modules/@allyhub-next/ooxml/dist/index.js +2 -0
  52. package/dist/node_modules/@allyhub-next/ooxml/dist/mce.d.ts +12 -0
  53. package/dist/node_modules/@allyhub-next/ooxml/dist/mce.js +2 -0
  54. package/dist/node_modules/@allyhub-next/ooxml/dist/node.d.ts +111 -0
  55. package/dist/node_modules/@allyhub-next/ooxml/dist/node.js +2 -0
  56. package/dist/node_modules/@allyhub-next/ooxml/dist/ns.d.ts +45 -0
  57. package/dist/node_modules/@allyhub-next/ooxml/dist/ns.js +2 -0
  58. package/dist/node_modules/@allyhub-next/ooxml/dist/opc.d.ts +48 -0
  59. package/dist/node_modules/@allyhub-next/ooxml/dist/opc.js +2 -0
  60. package/dist/node_modules/@allyhub-next/ooxml/dist/report.d.ts +45 -0
  61. package/dist/node_modules/@allyhub-next/ooxml/dist/report.js +2 -0
  62. package/dist/node_modules/@allyhub-next/ooxml/dist/xml.d.ts +28 -0
  63. package/dist/node_modules/@allyhub-next/ooxml/dist/xml.js +2 -0
  64. package/dist/node_modules/@allyhub-next/ooxml/package.json +26 -0
  65. package/dist/node_modules/@allyhub-next/protocol/dist/account.d.ts +338 -0
  66. package/dist/node_modules/@allyhub-next/protocol/dist/account.js +2 -0
  67. package/dist/node_modules/@allyhub-next/protocol/dist/auth.d.ts +12 -13
  68. package/dist/node_modules/@allyhub-next/protocol/dist/auth.js +1 -1
  69. package/dist/node_modules/@allyhub-next/protocol/dist/blobs.d.ts +35 -0
  70. package/dist/node_modules/@allyhub-next/protocol/dist/blobs.js +2 -0
  71. package/dist/node_modules/@allyhub-next/protocol/dist/cloud.d.ts +101 -32
  72. package/dist/node_modules/@allyhub-next/protocol/dist/cloud.js +1 -1
  73. package/dist/node_modules/@allyhub-next/protocol/dist/editor.d.ts +79 -5
  74. package/dist/node_modules/@allyhub-next/protocol/dist/editor.js +1 -1
  75. package/dist/node_modules/@allyhub-next/protocol/dist/files.d.ts +2 -2
  76. package/dist/node_modules/@allyhub-next/protocol/dist/index.d.ts +6 -0
  77. package/dist/node_modules/@allyhub-next/protocol/dist/index.js +1 -1
  78. package/dist/node_modules/@allyhub-next/protocol/dist/notes.d.ts +21 -0
  79. package/dist/node_modules/@allyhub-next/protocol/dist/notes.js +1 -1
  80. package/dist/node_modules/@allyhub-next/protocol/dist/open.d.ts +13 -0
  81. package/dist/node_modules/@allyhub-next/protocol/dist/open.js +2 -0
  82. package/dist/node_modules/@allyhub-next/protocol/dist/registry.d.ts +73 -59
  83. package/dist/node_modules/@allyhub-next/protocol/dist/registry.js +1 -1
  84. package/dist/node_modules/@allyhub-next/protocol/dist/routes.d.ts +1 -1
  85. package/dist/node_modules/@allyhub-next/protocol/dist/routes.js +1 -1
  86. package/dist/node_modules/@allyhub-next/protocol/dist/shares.d.ts +115 -0
  87. package/dist/node_modules/@allyhub-next/protocol/dist/shares.js +2 -0
  88. package/dist/node_modules/@allyhub-next/protocol/dist/sites.d.ts +293 -0
  89. package/dist/node_modules/@allyhub-next/protocol/dist/sites.js +2 -0
  90. package/dist/node_modules/@allyhub-next/protocol/dist/snapshots.d.ts +396 -0
  91. package/dist/node_modules/@allyhub-next/protocol/dist/snapshots.js +2 -0
  92. package/dist/node_modules/@allyhub-next/protocol/dist/teams.d.ts +27 -9
  93. package/dist/node_modules/@allyhub-next/protocol/dist/teams.js +1 -1
  94. package/dist/node_modules/@allyhub-next/protocol/dist/tools.d.ts +53 -14
  95. package/dist/node_modules/@allyhub-next/protocol/dist/tools.js +1 -1
  96. package/dist/node_modules/@allyhub-next/protocol/package.json +2 -1
  97. package/dist/node_modules/@allyhub-next/runtimes/dist/download.d.ts +19 -1
  98. package/dist/node_modules/@allyhub-next/runtimes/dist/download.js +1 -1
  99. package/dist/node_modules/@allyhub-next/runtimes/dist/index.d.ts +2 -2
  100. package/dist/node_modules/@allyhub-next/runtimes/dist/index.js +1 -1
  101. package/dist/node_modules/@allyhub-next/runtimes/dist/lock.d.ts +6 -0
  102. package/dist/node_modules/@allyhub-next/runtimes/dist/lock.js +1 -1
  103. package/dist/node_modules/@allyhub-next/runtimes/dist/packages.d.ts +19 -2
  104. package/dist/node_modules/@allyhub-next/runtimes/dist/packages.js +3 -3
  105. package/dist/node_modules/@allyhub-next/runtimes/dist/runtimes.d.ts +3 -0
  106. package/dist/node_modules/@allyhub-next/runtimes/dist/runtimes.js +3 -3
  107. package/dist/node_modules/@allyhub-next/runtimes/package.json +1 -1
  108. package/dist/node_modules/@allyhub-next/runtimes/schemas/runtimes.schema.json +25 -5
  109. package/dist/node_modules/@allyhub-next/scenery/package.json +1 -1
  110. package/dist/node_modules/@allyhub-next/sheet/dist/calc/analyse.d.ts +9 -3
  111. package/dist/node_modules/@allyhub-next/sheet/dist/calc/analyse.js +1 -1
  112. package/dist/node_modules/@allyhub-next/sheet/dist/calc/coerce.d.ts +5 -1
  113. package/dist/node_modules/@allyhub-next/sheet/dist/calc/coerce.js +1 -1
  114. package/dist/node_modules/@allyhub-next/sheet/dist/calc/engine.d.ts +60 -13
  115. package/dist/node_modules/@allyhub-next/sheet/dist/calc/engine.js +1 -1
  116. package/dist/node_modules/@allyhub-next/sheet/dist/calc/functions/aggregate.js +1 -1
  117. package/dist/node_modules/@allyhub-next/sheet/dist/calc/functions/convert.d.ts +4 -0
  118. package/dist/node_modules/@allyhub-next/sheet/dist/calc/functions/convert.js +2 -0
  119. package/dist/node_modules/@allyhub-next/sheet/dist/calc/functions/criteria.js +1 -1
  120. package/dist/node_modules/@allyhub-next/sheet/dist/calc/functions/database.js +1 -1
  121. package/dist/node_modules/@allyhub-next/sheet/dist/calc/functions/date.js +1 -1
  122. package/dist/node_modules/@allyhub-next/sheet/dist/calc/functions/define.d.ts +27 -1
  123. package/dist/node_modules/@allyhub-next/sheet/dist/calc/functions/define.js +1 -1
  124. package/dist/node_modules/@allyhub-next/sheet/dist/calc/functions/delimiters.d.ts +16 -0
  125. package/dist/node_modules/@allyhub-next/sheet/dist/calc/functions/delimiters.js +2 -0
  126. package/dist/node_modules/@allyhub-next/sheet/dist/calc/functions/dynamic.d.ts +18 -1
  127. package/dist/node_modules/@allyhub-next/sheet/dist/calc/functions/dynamic.js +1 -1
  128. package/dist/node_modules/@allyhub-next/sheet/dist/calc/functions/finance.js +1 -1
  129. package/dist/node_modules/@allyhub-next/sheet/dist/calc/functions/index.d.ts +2 -0
  130. package/dist/node_modules/@allyhub-next/sheet/dist/calc/functions/index.js +1 -1
  131. package/dist/node_modules/@allyhub-next/sheet/dist/calc/functions/info.js +1 -1
  132. package/dist/node_modules/@allyhub-next/sheet/dist/calc/functions/kernels.js +1 -1
  133. package/dist/node_modules/@allyhub-next/sheet/dist/calc/functions/logical.js +1 -1
  134. package/dist/node_modules/@allyhub-next/sheet/dist/calc/functions/lookup.js +1 -1
  135. package/dist/node_modules/@allyhub-next/sheet/dist/calc/functions/maths.js +1 -1
  136. package/dist/node_modules/@allyhub-next/sheet/dist/calc/functions/modern.d.ts +2 -0
  137. package/dist/node_modules/@allyhub-next/sheet/dist/calc/functions/modern.js +2 -0
  138. package/dist/node_modules/@allyhub-next/sheet/dist/calc/functions/text.js +1 -1
  139. package/dist/node_modules/@allyhub-next/sheet/dist/calc/graph.d.ts +38 -0
  140. package/dist/node_modules/@allyhub-next/sheet/dist/calc/graph.js +2 -0
  141. package/dist/node_modules/@allyhub-next/sheet/dist/calc/indexes.d.ts +19 -0
  142. package/dist/node_modules/@allyhub-next/sheet/dist/calc/indexes.js +2 -0
  143. package/dist/node_modules/@allyhub-next/sheet/dist/calc/remote.d.ts +49 -0
  144. package/dist/node_modules/@allyhub-next/sheet/dist/calc/remote.js +2 -0
  145. package/dist/node_modules/@allyhub-next/sheet/dist/calc/server.d.ts +82 -0
  146. package/dist/node_modules/@allyhub-next/sheet/dist/calc/server.js +2 -0
  147. package/dist/node_modules/@allyhub-next/sheet/dist/calc/types.d.ts +6 -1
  148. package/dist/node_modules/@allyhub-next/sheet/dist/calc/types.js +1 -1
  149. package/dist/node_modules/@allyhub-next/sheet/dist/chart.js +1 -1
  150. package/dist/node_modules/@allyhub-next/sheet/dist/check.js +1 -1
  151. package/dist/node_modules/@allyhub-next/sheet/dist/diff.d.ts +15 -0
  152. package/dist/node_modules/@allyhub-next/sheet/dist/diff.js +1 -1
  153. package/dist/node_modules/@allyhub-next/sheet/dist/export.d.ts +29 -8
  154. package/dist/node_modules/@allyhub-next/sheet/dist/export.js +3 -4
  155. package/dist/node_modules/@allyhub-next/sheet/dist/file.js +2 -2
  156. package/dist/node_modules/@allyhub-next/sheet/dist/format.d.ts +8 -2
  157. package/dist/node_modules/@allyhub-next/sheet/dist/format.js +1 -1
  158. package/dist/node_modules/@allyhub-next/sheet/dist/html.d.ts +52 -4
  159. package/dist/node_modules/@allyhub-next/sheet/dist/html.js +43 -11
  160. package/dist/node_modules/@allyhub-next/sheet/dist/index.d.ts +7 -3
  161. package/dist/node_modules/@allyhub-next/sheet/dist/index.js +1 -1
  162. package/dist/node_modules/@allyhub-next/sheet/dist/inspect.js +1 -1
  163. package/dist/node_modules/@allyhub-next/sheet/dist/paginate.d.ts +98 -0
  164. package/dist/node_modules/@allyhub-next/sheet/dist/paginate.js +2 -0
  165. package/dist/node_modules/@allyhub-next/sheet/dist/structure.js +1 -1
  166. package/dist/node_modules/@allyhub-next/sheet/dist/table-style.d.ts +32 -0
  167. package/dist/node_modules/@allyhub-next/sheet/dist/table-style.js +2 -0
  168. package/dist/node_modules/@allyhub-next/sheet/dist/table-styles.d.ts +3 -0
  169. package/dist/node_modules/@allyhub-next/sheet/dist/table-styles.js +2 -0
  170. package/dist/node_modules/@allyhub-next/sheet/dist/values.js +1 -1
  171. package/dist/node_modules/@allyhub-next/sheet/dist/workbook.d.ts +10 -1
  172. package/dist/node_modules/@allyhub-next/sheet/dist/workbook.js +1 -1
  173. package/dist/node_modules/@allyhub-next/sheet/dist/xlsx/charts.d.ts +10 -1
  174. package/dist/node_modules/@allyhub-next/sheet/dist/xlsx/charts.js +1 -1
  175. package/dist/node_modules/@allyhub-next/sheet/dist/xlsx/formula.d.ts +14 -4
  176. package/dist/node_modules/@allyhub-next/sheet/dist/xlsx/formula.js +2 -2
  177. package/dist/node_modules/@allyhub-next/sheet/dist/xlsx/functions.d.ts +11 -1
  178. package/dist/node_modules/@allyhub-next/sheet/dist/xlsx/functions.js +36 -16
  179. package/dist/node_modules/@allyhub-next/sheet/dist/xlsx/import.d.ts +3 -1
  180. package/dist/node_modules/@allyhub-next/sheet/dist/xlsx/import.js +1 -1
  181. package/dist/node_modules/@allyhub-next/sheet/dist/xlsx/read.d.ts +42 -1
  182. package/dist/node_modules/@allyhub-next/sheet/dist/xlsx/read.js +2 -1
  183. package/dist/node_modules/@allyhub-next/sheet/dist/xlsx/sax.d.ts +23 -0
  184. package/dist/node_modules/@allyhub-next/sheet/dist/xlsx/sax.js +2 -0
  185. package/dist/node_modules/@allyhub-next/sheet/dist/xlsx/styles.d.ts +2 -0
  186. package/dist/node_modules/@allyhub-next/sheet/dist/xlsx/styles.js +1 -1
  187. package/dist/node_modules/@allyhub-next/sheet/dist/xlsx/write.d.ts +6 -0
  188. package/dist/node_modules/@allyhub-next/sheet/dist/xlsx/write.js +1 -1
  189. package/dist/node_modules/@allyhub-next/sheet/dist/xlsx/zip.d.ts +40 -0
  190. package/dist/node_modules/@allyhub-next/sheet/dist/xlsx/zip.js +2 -0
  191. package/dist/node_modules/@allyhub-next/sheet/package.json +1 -1
  192. package/dist/node_modules/@allyhub-next/slides-core/dist/animation.js +1 -1
  193. package/dist/node_modules/@allyhub-next/slides-core/dist/api.d.ts +59 -39
  194. package/dist/node_modules/@allyhub-next/slides-core/dist/api.js +2 -2
  195. package/dist/node_modules/@allyhub-next/slides-core/dist/capabilities.js +1 -1
  196. package/dist/node_modules/@allyhub-next/slides-core/dist/chart-api.d.ts +27 -13
  197. package/dist/node_modules/@allyhub-next/slides-core/dist/chart-api.js +1 -1
  198. package/dist/node_modules/@allyhub-next/slides-core/dist/check.js +1 -1
  199. package/dist/node_modules/@allyhub-next/slides-core/dist/code.d.ts +33 -0
  200. package/dist/node_modules/@allyhub-next/slides-core/dist/code.js +2 -0
  201. package/dist/node_modules/@allyhub-next/slides-core/dist/components.d.ts +31 -0
  202. package/dist/node_modules/@allyhub-next/slides-core/dist/components.js +2 -0
  203. package/dist/node_modules/@allyhub-next/slides-core/dist/enums.d.ts +179 -16
  204. package/dist/node_modules/@allyhub-next/slides-core/dist/enums.js +1 -1
  205. package/dist/node_modules/@allyhub-next/slides-core/dist/file.d.ts +43 -21
  206. package/dist/node_modules/@allyhub-next/slides-core/dist/file.js +3 -3
  207. package/dist/node_modules/@allyhub-next/slides-core/dist/identity.d.ts +17 -0
  208. package/dist/node_modules/@allyhub-next/slides-core/dist/identity.js +2 -0
  209. package/dist/node_modules/@allyhub-next/slides-core/dist/index.d.ts +5 -1
  210. package/dist/node_modules/@allyhub-next/slides-core/dist/index.js +1 -1
  211. package/dist/node_modules/@allyhub-next/slides-core/dist/lang.d.ts +6 -0
  212. package/dist/node_modules/@allyhub-next/slides-core/dist/lang.js +2 -0
  213. package/dist/node_modules/@allyhub-next/slides-core/dist/measure.js +1 -1
  214. package/dist/node_modules/@allyhub-next/slides-core/dist/merge.d.ts +58 -0
  215. package/dist/node_modules/@allyhub-next/slides-core/dist/merge.js +2 -0
  216. package/dist/node_modules/@allyhub-next/slides-core/dist/model.d.ts +2 -4
  217. package/dist/node_modules/@allyhub-next/slides-core/dist/office.d.ts +17 -1
  218. package/dist/node_modules/@allyhub-next/slides-core/dist/office.js +1 -1
  219. package/dist/node_modules/@allyhub-next/slides-core/dist/resolve.d.ts +21 -5
  220. package/dist/node_modules/@allyhub-next/slides-core/dist/resolve.js +1 -1
  221. package/dist/node_modules/@allyhub-next/slides-core/dist/script.d.ts +18 -16
  222. package/dist/node_modules/@allyhub-next/slides-core/dist/script.js +2 -2
  223. package/dist/node_modules/@allyhub-next/slides-core/dist/stage.d.ts +51 -53
  224. package/dist/node_modules/@allyhub-next/slides-core/dist/strict.js +1 -1
  225. package/dist/node_modules/@allyhub-next/slides-core/dist/units.d.ts +27 -0
  226. package/dist/node_modules/@allyhub-next/slides-core/dist/units.js +1 -1
  227. package/dist/node_modules/@allyhub-next/slides-core/dist/values.d.ts +7 -0
  228. package/dist/node_modules/@allyhub-next/slides-core/dist/values.js +2 -0
  229. package/dist/node_modules/@allyhub-next/slides-core/package.json +1 -1
  230. package/dist/node_modules/@allyhub-next/video-core/dist/captions.js +6 -6
  231. package/dist/node_modules/@allyhub-next/video-core/dist/fact.d.ts +47 -8
  232. package/dist/node_modules/@allyhub-next/video-core/dist/fact.js +1 -1
  233. package/dist/node_modules/@allyhub-next/video-core/dist/index.d.ts +1 -0
  234. package/dist/node_modules/@allyhub-next/video-core/dist/index.js +1 -1
  235. package/dist/node_modules/@allyhub-next/video-core/dist/marks.d.ts +14 -0
  236. package/dist/node_modules/@allyhub-next/video-core/dist/marks.js +1 -1
  237. package/dist/node_modules/@allyhub-next/video-core/dist/music.d.ts +2 -1
  238. package/dist/node_modules/@allyhub-next/video-core/dist/piece.d.ts +11 -2
  239. package/dist/node_modules/@allyhub-next/video-core/dist/problem.d.ts +4 -0
  240. package/dist/node_modules/@allyhub-next/video-core/dist/problem.js +1 -1
  241. package/dist/node_modules/@allyhub-next/video-core/dist/schema.d.ts +2 -2
  242. package/dist/node_modules/@allyhub-next/video-core/dist/schema.js +1 -1
  243. package/dist/node_modules/@allyhub-next/video-core/dist/script.d.ts +2 -1
  244. package/dist/node_modules/@allyhub-next/video-core/dist/script.js +1 -1
  245. package/dist/node_modules/@allyhub-next/video-core/dist/source.d.ts +7 -0
  246. package/dist/node_modules/@allyhub-next/video-core/dist/source.js +2 -0
  247. package/dist/node_modules/@allyhub-next/video-core/dist/timeline.d.ts +10 -33
  248. package/dist/node_modules/@allyhub-next/video-core/package.json +1 -1
  249. package/dist/slides.d.ts +3 -1
  250. package/dist/slides.js +1 -1
  251. package/docs/README.md +1 -0
  252. package/docs/contract.md +1 -1
  253. package/docs/defaults.md +2 -2
  254. package/docs/layers.md +1 -1
  255. package/docs/project.md +3 -1
  256. package/docs/sheets.md +7 -6
  257. package/docs/slides.md +16 -12
  258. package/docs/sound.md +1 -1
  259. package/docs/websites.md +57 -0
  260. package/package.json +3 -1
  261. package/dist/node_modules/@allyhub-next/slides-core/dist/preset.d.ts +0 -5
  262. package/dist/node_modules/@allyhub-next/slides-core/dist/preset.js +0 -2
@@ -1,2 +1,2 @@
1
1
  /*! AllyHub. Copyright (c) 2026 AllyHub, Inc. All rights reserved. Use is subject to LICENSE.md. */
2
- import{z as e}from"zod";import{KINDS as c}from"@allyhub-next/formats";import{PathSchema as r}from"./files.js";import{method as t,notification as s}from"./jsonrpc.js";const i={item:r,version:e.string().optional()};export const ImageSchema=e.strictObject({mime:e.string().regex(/^image\//u),data:e.base64()}),ProblemSchema=e.looseObject({code:e.string(),level:e.enum(["error","warn"]),message:e.string(),piece:e.string().optional(),part:e.string().optional(),t:e.number().optional()}),FactSchema=e.looseObject({kind:e.string(),data:e.unknown()}),TimelineSchema=e.looseObject({fps:e.number(),width:e.number(),height:e.number(),duration:e.number(),parts:e.array(e.unknown())}),CHECK_STATES=["off","waiting","running","done","failed"],CheckStateSchema=e.strictObject({status:e.enum(CHECK_STATES),revision:e.int().nonnegative(),problems:e.array(ProblemSchema),facts:e.array(FactSchema),versions:e.strictObject({total:e.int(),loaded:e.int(),reused:e.int()}).optional(),error:e.string().optional()}),EXPORT_STATES=["queued","running","done","failed","cancelled"],ExportOptionsSchema=e.record(e.string(),e.union([e.string(),e.boolean()])),ExportJobSchema=e.strictObject({id:e.string(),item:r,versions:e.array(e.string()),types:e.array(e.string()),options:ExportOptionsSchema.optional(),state:e.enum(EXPORT_STATES),progress:e.number().min(0).max(1),files:e.array(r),error:e.string().optional()}),IndexJobSchema=e.strictObject({file:r,status:e.enum(["running","done","failed"]),message:e.string(),share:e.number().min(0).max(1).optional()});const o=e.tuple([e.number(),e.number(),e.number()]),a=e.strictObject({url:e.string(),probe:e.string()});export const PROJECT_TOOLS={"project/items":t(e.strictObject({}),e.strictObject({items:e.array(e.strictObject({kind:e.enum(c),dir:r,entry:r,title:e.string().optional()})),folder:e.string(),name:e.string(),revision:e.int().nonnegative()}),"The project's items, as the build finds them."),"sheet/generated":t(e.strictObject({item:r}),e.strictObject({generated:e.unknown().optional(),failed:e.boolean()}),"What a sheet's sheet.ts makes now: sheets as sheet.yaml would hold them. Never written to a file."),"video/versions":t(e.strictObject({item:r}),e.strictObject({piece:e.string(),kind:e.enum(["video","slides"]),title:e.string().optional(),width:e.number(),height:e.number(),versions:e.array(e.strictObject({key:e.string(),lang:e.string().optional()}))}),"A video's or a deck's versions, one per language: what its stage, its timeline and its exports are asked for."),"slides/deck":t(e.strictObject({item:r}),e.strictObject({piece:e.string(),file:r,prefix:e.string(),layouts:e.array(e.string()),components:e.record(e.string(),e.unknown()),generators:e.array(e.string()),scripts:e.record(e.string(),r)}),"A deck's layouts, components and generators, and its files: slides.yaml (its slides) and its script in each language (their words and notes), which the deck's editor edits."),"video/stage":t(e.strictObject({...i,start:e.strictObject({t:e.number().nonnegative().optional(),part:e.string().optional(),offset:e.number().nonnegative().optional(),dur:e.number().positive().optional()}).optional(),play:e.boolean().optional(),chrome:e.boolean().optional(),edit:e.boolean().optional()}),a,"The address of a version's stage page, for a sandboxed frame: it plays the piece and talks to its parent by postMessage."),"video/timeline":t(e.strictObject(i),e.strictObject({timeline:TimelineSchema,text:e.array(e.unknown())}),"A version's timeline, drawn nowhere."),"video/still":t(e.strictObject({...i,t:e.number().nonnegative().optional()}),e.strictObject({t:e.number(),image:ImageSchema,width:e.int().positive(),height:e.int().positive(),duration:e.number().nonnegative()}),"A moment of a version as the render draws it, as a picture."),"video/stills":t(e.strictObject({...i,moments:e.array(e.number().nonnegative()).min(1).max(32)}),e.strictObject({stills:e.array(e.strictObject({t:e.number(),image:ImageSchema}))}),"Several moments of a version as the render draws them: what `video/still` gives, on one page."),"check/results":t(e.strictObject({}),CheckStateSchema,"The check run after edits, as it stands."),"check/run":t(e.strictObject({}),e.strictObject({}),"Runs the check again now."),"export/start":t(e.strictObject({item:r,versions:e.array(e.string()).optional(),types:e.array(e.string().min(1)).max(10).optional(),options:ExportOptionsSchema.optional()}),e.strictObject({job:ExportJobSchema}),"Exports an item (its versions, as file types) into .allyhub/out/; `export/changed` says how it goes."),"export/cancel":t(e.strictObject({job:e.string()}),e.strictObject({}),"Stops an export."),"export/list":t(e.strictObject({}),e.strictObject({jobs:e.array(ExportJobSchema),reveal:e.boolean()}),"The exports asked for since the server started."),"export/reveal":t(e.strictObject({path:r}),e.strictObject({}),"Shows an exported file in the person's file manager, where the server runs on their computer (`export/list`'s `reveal`)."),"scenery/viewer":t(e.strictObject({item:r,camera:e.strictObject({position:o,target:o}).optional()}),a,"The address of a scenery's viewer page, for a sandboxed frame: it tells what the person does by postMessage.")},AGENT_DOES={"project/items":{files:"the project's folder"},"sheet/generated":{files:"the item's sheet.ts and sheet.yaml"},"video/versions":{command:"inspect combos"},"slides/deck":{files:"slides.ts, slides.yaml and the item's script.<locale>.yaml"},"video/stage":{command:"frames"},"video/timeline":{command:"inspect timeline"},"video/still":{command:"frames"},"video/stills":{command:"frames"},"check/results":{command:"inspect"},"check/run":{command:"check"},"export/start":{command:"render"},"export/cancel":{command:"render"},"export/list":{files:".allyhub/out/"},"export/reveal":{files:".allyhub/out/"},"scenery/viewer":{command:"scenery view"}};export function toolSpec(n){return Object.hasOwn(PROJECT_TOOLS,n)?PROJECT_TOOLS[n]:void 0}export const TOOL_NOTIFICATIONS={"project/changed":s(e.strictObject({revision:e.int().nonnegative()}),"The build saw a change: a stage or a timeline asked for now is the new one's."),"check/changed":s(CheckStateSchema,"The check started, ended or failed."),"export/changed":s(e.strictObject({job:ExportJobSchema}),"An export moved on."),"index/changed":s(e.strictObject({jobs:e.array(IndexJobSchema)}),"Making what the media index lacks moved on.")};
2
+ import{z as e}from"zod";import{KINDS as c}from"@allyhub-next/formats";import{PathSchema as s}from"./files.js";import{method as t,notification as r}from"./jsonrpc.js";const n={item:s,version:e.string().optional()};export const ImageSchema=e.strictObject({mime:e.string().regex(/^image\//u),data:e.base64()}),ProblemSchema=e.looseObject({code:e.string(),level:e.enum(["error","warn"]),message:e.string(),piece:e.string().optional(),part:e.string().optional(),t:e.number().optional()}),FactSchema=e.looseObject({kind:e.string(),data:e.unknown()}),TimelineSchema=e.looseObject({fps:e.number(),width:e.number(),height:e.number(),duration:e.number(),parts:e.array(e.unknown())}),CHECK_STATES=["off","waiting","running","done","failed"],CheckStateSchema=e.strictObject({status:e.enum(CHECK_STATES),revision:e.int().nonnegative(),problems:e.array(ProblemSchema),facts:e.array(FactSchema),versions:e.strictObject({total:e.int(),loaded:e.int(),reused:e.int()}).optional(),error:e.string().optional()}),EXPORT_STATES=["queued","running","done","failed","cancelled"],ExportOptionsSchema=e.record(e.string(),e.union([e.string(),e.boolean()])),ExportJobSchema=e.strictObject({id:e.string(),item:s,versions:e.array(e.string()),types:e.array(e.string()),options:ExportOptionsSchema.optional(),state:e.enum(EXPORT_STATES),progress:e.number().min(0).max(1),files:e.array(s),error:e.string().optional()}),IndexJobSchema=e.strictObject({file:s,status:e.enum(["running","done","failed"]),message:e.string(),share:e.number().min(0).max(1).optional()});const o=e.tuple([e.number(),e.number(),e.number()]),a=e.strictObject({url:e.string(),probe:e.string()});export const COMPONENT_STILLS_MAX=64,PROJECT_TOOLS={"project/items":t(e.strictObject({}),e.strictObject({items:e.array(e.strictObject({kind:e.enum(c),dir:s,entry:s,title:e.string().optional()})),name:e.string(),scope:e.string(),revision:e.int().nonnegative()}),"The project's items, as the build finds them."),"sheet/generated":t(e.strictObject({item:s}),e.strictObject({generated:e.unknown().optional(),failed:e.boolean()}),"What a sheet's sheet.ts makes now: sheets as sheet.yaml would hold them. Never written to a file."),"video/versions":t(e.strictObject({item:s}),e.strictObject({piece:e.string(),kind:e.enum(["video","slides"]),title:e.string().optional(),width:e.number(),height:e.number(),versions:e.array(e.strictObject({key:e.string(),lang:e.string().optional()}))}),"A video's or a deck's versions, one per language: what its stage, its timeline and its exports are asked for."),"slides/deck":t(e.strictObject({item:s}),e.strictObject({piece:e.string(),file:s,prefix:e.string(),layouts:e.array(e.string()),components:e.record(e.string(),e.unknown()),generators:e.array(e.string()),scripts:e.record(e.string(),s),code:e.unknown(),theme:e.strictObject({name:e.string(),colors:e.record(e.string(),e.string()),fonts:e.record(e.string(),e.string())})}),"A deck's layouts, components and generators, and its files: slides.yaml (its slides) and its script in each language (their words and notes), which the deck's editor edits."),"video/stage":t(e.strictObject({...n,start:e.strictObject({t:e.number().nonnegative().optional(),part:e.string().optional(),offset:e.number().nonnegative().optional(),dur:e.number().positive().optional()}).optional(),play:e.boolean().optional(),chrome:e.boolean().optional(),mode:e.enum(["code","component"]).optional()}),a,"The address of a version's stage page, for a sandboxed frame: it plays the piece and talks to its parent by postMessage."),"video/timeline":t(e.strictObject(n),e.strictObject({timeline:TimelineSchema,text:e.array(e.unknown())}),"A version's timeline, drawn nowhere."),"video/still":t(e.strictObject({...n,t:e.number().nonnegative().optional()}),e.strictObject({t:e.number(),image:ImageSchema,width:e.int().positive(),height:e.int().positive(),duration:e.number().nonnegative()}),"A moment of a version as the render draws it, as a picture."),"video/stills":t(e.strictObject({...n,moments:e.array(e.number().nonnegative()).min(1).max(32)}),e.strictObject({stills:e.array(e.strictObject({t:e.number(),image:ImageSchema}))}),"Several moments of a version as the render draws them: what `video/still` gives, on one page."),"slides/fonts":t(e.strictObject({item:s}),e.strictObject({faces:e.array(e.strictObject({family:e.string(),url:e.url(),weight:e.string().optional(),style:e.string().optional(),stretch:e.string().optional(),unicodeRange:e.string().optional()}))}),"The font faces a deck's slides draw with: the stage's own (the theme's standard fonts), allyhub.config.ts's fonts and what the deck's code imports, for a document that draws its slides without the project's stylesheets."),"slides/component-stills":t(e.strictObject({...n,components:e.array(e.strictObject({name:e.string(),props:e.record(e.string(),e.unknown()),width:e.number().positive(),height:e.number().positive(),t:e.number().nonnegative()})).min(1).max(COMPONENT_STILLS_MAX)}),e.strictObject({stills:e.array(e.strictObject({key:e.string(),url:e.url()}).nullable())}),"Components of a deck drawn alone, transparent, as the render draws them: pictures kept by what they show, given as addresses."),"check/results":t(e.strictObject({}),CheckStateSchema,"The check run after edits, as it stands."),"check/run":t(e.strictObject({}),e.strictObject({}),"Runs the check again now."),"export/start":t(e.strictObject({item:s,versions:e.array(e.string()).optional(),types:e.array(e.string().min(1)).max(10).optional(),options:ExportOptionsSchema.optional()}),e.strictObject({job:ExportJobSchema}),"Exports an item (its versions, as file types) into .allyhub/out/; `export/changed` says how it goes."),"export/cancel":t(e.strictObject({job:e.string()}),e.strictObject({}),"Stops an export."),"export/list":t(e.strictObject({}),e.strictObject({jobs:e.array(ExportJobSchema),reveal:e.boolean()}),"The exports asked for since the server started."),"export/reveal":t(e.strictObject({path:s}),e.strictObject({}),"Shows an exported file in the person's file manager, where the server runs on their computer (`export/list`'s `reveal`)."),"scenery/viewer":t(e.strictObject({item:s,camera:e.strictObject({position:o,target:o}).optional()}),a,"The address of a scenery's viewer page, for a sandboxed frame: it tells what the person does by postMessage.")},AGENT_DOES={"project/items":{files:"the project's folder"},"sheet/generated":{files:"the item's sheet.ts and sheet.yaml"},"video/versions":{command:"inspect combos"},"slides/deck":{files:"slides.ts, slides.yaml and the item's script.<locale>.yaml"},"video/stage":{command:"frames"},"video/timeline":{command:"inspect timeline"},"video/still":{command:"frames"},"video/stills":{command:"frames"},"slides/fonts":{files:"allyhub.config.ts's fonts and the stylesheets slides.ts imports"},"slides/component-stills":{command:"frames"},"check/results":{command:"inspect"},"check/run":{command:"check"},"export/start":{command:"render"},"export/cancel":{command:"render"},"export/list":{files:".allyhub/out/"},"export/reveal":{files:".allyhub/out/"},"scenery/viewer":{command:"scenery view"}};export function toolSpec(i){return Object.hasOwn(PROJECT_TOOLS,i)?PROJECT_TOOLS[i]:void 0}export const TOOL_NOTIFICATIONS={"project/changed":r(e.strictObject({revision:e.int().nonnegative()}),"The build saw a change: a stage or a timeline asked for now is the new one's."),"check/changed":r(CheckStateSchema,"The check started, ended or failed."),"export/changed":r(e.strictObject({job:ExportJobSchema}),"An export moved on."),"index/changed":r(e.strictObject({jobs:e.array(IndexJobSchema)}),"Making what the media index lacks moved on.")};
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@allyhub-next/protocol",
3
- "version": "0.6.0",
3
+ "version": "0.7.1",
4
4
  "type": "module",
5
5
  "exports": {
6
6
  ".": {
@@ -8,6 +8,7 @@
8
8
  "default": "./dist/index.js"
9
9
  }
10
10
  },
11
+ "sideEffects": false,
11
12
  "private": true,
12
13
  "license": "SEE LICENSE IN LICENSE.md"
13
14
  }
@@ -1,9 +1,27 @@
1
- export interface DownloadOptions {
1
+ import { RuntimeError } from "./errors.js";
2
+ /** How long a download may go without a byte before that try is given up (ms). */
3
+ export declare const DOWNLOAD_STALL_MS = 30000;
4
+ /** How many times a download that failed on the way is tried again. */
5
+ export declare const DOWNLOAD_RETRIES = 3;
6
+ /** The wait before the first try again, doubled before each next one (ms). */
7
+ export declare const DOWNLOAD_RETRY_DELAY_MS = 1000;
8
+ /** How a download waits and tries again; each default is its constant above. */
9
+ export interface DownloadTimings {
10
+ /** No byte for this long gives up a try (default: DOWNLOAD_STALL_MS). */
11
+ stallMs?: number | undefined;
12
+ /** Tries again after the first (default: DOWNLOAD_RETRIES). */
13
+ retries?: number | undefined;
14
+ /** The first wait before trying again (default: DOWNLOAD_RETRY_DELAY_MS). */
15
+ retryDelayMs?: number | undefined;
16
+ }
17
+ export interface DownloadOptions extends DownloadTimings {
2
18
  size: number;
3
19
  sha256: string;
4
20
  fetch: typeof globalThis.fetch;
5
21
  signal?: AbortSignal | undefined;
6
22
  onProgress?: ((received: number, total: number) => void) | undefined;
23
+ /** Before each try again: what went wrong, the try that failed and how many there are. */
24
+ onRetry?: ((error: RuntimeError, attempt: number, attempts: number) => void) | undefined;
7
25
  }
8
26
  /**
9
27
  * Downloads `url` to `dest`, hashing as it comes; a file of another size or
@@ -1,2 +1,2 @@
1
1
  /*! AllyHub. Copyright (c) 2026 AllyHub, Inc. All rights reserved. Use is subject to LICENSE.md. */
2
- import{createHash as m}from"node:crypto";import{createWriteStream as u}from"node:fs";import{rm as g}from"node:fs/promises";import{Readable as y,Transform as S}from"node:stream";import{pipeline as p}from"node:stream/promises";import{RuntimeError as o}from"./errors.js";export async function download(e,r,n){const{size:i,sha256:w,signal:a,onProgress:$}=n;let s;try{s=await n.fetch(e,{redirect:"follow",...a?{signal:a}:{}})}catch(t){throw a?.aborted?new o("cancelled",`Stopped downloading ${e}.`,{cause:t}):new o("download",`Could not reach ${e}: ${l(t)}`,{cause:t})}if(!s.ok||!s.body)throw new o("download",`${e} answered ${String(s.status)}.`);const d=m("sha256");let c=0;const b=new S({transform(t,x,h){if(c+=t.length,c>i){h(new o("checksum",`${e} is larger than its pin (${String(i)} bytes).`));return}d.update(t),$?.(c,i),h(null,t)}});try{await p(y.fromWeb(s.body),b,u(r),...a?[{signal:a}]:[])}catch(t){throw await g(r,{force:!0}),t instanceof o?t:a?.aborted?new o("cancelled",`Stopped downloading ${e}.`,{cause:t}):new o("download",`Downloading ${e} failed: ${l(t)}`,{cause:t})}const f=d.digest("hex");if(c!==i||f!==w)throw await g(r,{force:!0}),new o("checksum",`${e} came as ${String(c)} bytes with sha256 ${f}; its pin is ${String(i)} bytes, ${w}.`)}export async function sha256Of(e){const{createReadStream:r}=await import("node:fs"),n=m("sha256");return await p(r(e),n),n.digest("hex")}const l=e=>e instanceof Error?e.message:String(e);
2
+ import{createHash as T}from"node:crypto";import{createReadStream as _,createWriteStream as z}from"node:fs";import{rm as f,stat as k}from"node:fs/promises";import{Readable as C,Transform as Y}from"node:stream";import{pipeline as x}from"node:stream/promises";import{setTimeout as H}from"node:timers/promises";import{RuntimeError as i}from"./errors.js";export const DOWNLOAD_STALL_MS=3e4,DOWNLOAD_RETRIES=3,DOWNLOAD_RETRY_DELAY_MS=1e3;const I=e=>e===408||e===425||e===429||e>=500,p=(e,r)=>new i("cancelled",`Stopped downloading ${e}.`,{cause:r}),P=async e=>k(e).then(r=>r.size,()=>0),j=e=>{const r=/^bytes (\d+)-/u.exec(e??"")?.[1];return r===void 0?void 0:Number(r)};export async function download(e,r,$){const{size:s,sha256:b,signal:c,onProgress:A,onRetry:W,stallMs:S=DOWNLOAD_STALL_MS,retries:E=DOWNLOAD_RETRIES,retryDelayMs:L=DOWNLOAD_RETRY_DELAY_MS}=$,g=E+1;let h;const v=async()=>{const o=await P(r);if(o>=s)return{received:o,digest:await sha256Of(r)};const a=new AbortController,d=c?AbortSignal.any([c,a.signal]):a.signal;let m;const u=()=>{clearTimeout(m),m=setTimeout(()=>{a.abort()},S)},D=()=>new i("download",`${e} sent nothing for ${String(S/1e3)} s.`);u();try{const M=o>0?{range:`bytes=${String(o)}-`,...h?{"if-range":h}:{}}:{};let n;try{n=await $.fetch(e,{redirect:"follow",headers:M,signal:d})}catch(t){if(c?.aborted)throw p(e,t);return a.signal.aborted?D():new i("download",`Could not reach ${e}: ${R(t)}`,{cause:t})}if(!n.ok||!n.body){await n.body?.cancel().catch(()=>{});const t=new i("download",`${e} answered ${String(n.status)}.`);if(I(n.status))return t;throw t}const l=n.status===206&&j(n.headers.get("content-range"))===o;if(n.status===206&&!l)return await n.body.cancel().catch(()=>{}),await f(r,{force:!0}),new i("download",`${e} answered another range than bytes=${String(o)}-.`);if(!l){const t=n.headers.get("etag");h=t&&!t.startsWith("W/")?t:n.headers.get("last-modified")??void 0}const y=T("sha256");let w=0;if(l)for await(const t of _(r))y.update(t),w+=t.length;const N=new Y({transform(t,q,O){if(u(),w+=t.length,w>s){O(new i("checksum",`${e} is larger than its pin (${String(s)} bytes).`));return}y.update(t),A?.(w,s),O(null,t)}});u();try{await x(C.fromWeb(n.body),N,z(r,{flags:l?"a":"w"}),{signal:d})}catch(t){if(t instanceof i)throw t;if(c?.aborted)throw p(e,t);return a.signal.aborted?D():new i("download",`Downloading ${e} failed: ${R(t)}`,{cause:t})}return{received:w,digest:y.digest("hex")}}finally{clearTimeout(m)}};await f(r,{force:!0});for(let o=1;;o++){let a;try{a=await v()}catch(d){throw await f(r,{force:!0}),d}if(!(a instanceof i)){if(a.received!==s||a.digest!==b)throw await f(r,{force:!0}),new i("checksum",`${e} came as ${String(a.received)} bytes with sha256 ${a.digest}; its pin is ${String(s)} bytes, ${b}.`);return}if(o>=g)throw await f(r,{force:!0}),new i("download",g>1?`${a.message} Tried ${String(g)} times.`:a.message,{cause:a});W?.(a,o,g);try{await H(L*2**(o-1),void 0,c?{signal:c}:{})}catch(d){throw await f(r,{force:!0}),p(e,d)}}}export async function sha256Of(e){const r=T("sha256");return await x(_(e),r),r.digest("hex")}const R=e=>e instanceof Error?e.message:String(e);
@@ -1,10 +1,10 @@
1
1
  export { binVariable, createRuntimes, type EnsureOptions, type Located, type Progress, type Runtimes, type RuntimesOptions, type Status, } from "./runtimes.js";
2
- export { createPackages, npmCi, type EnsurePackageOptions, type LoadOptions, type Install, type LocatedPackage, type Packages, type PackagesOptions, } from "./packages.js";
2
+ export { createPackages, npmCi, NPM_FETCH_TIMEOUT_MS, NPM_STALL_MS, type EnsurePackageOptions, type InstallOptions, type LoadOptions, type Install, type LocatedPackage, type Packages, type PackagesOptions, } from "./packages.js";
3
3
  export { bundledEnv, type BundledOptions } from "./bundled.js";
4
4
  export { RuntimeError, type RuntimeErrorCode } from "./errors.js";
5
5
  export { cacheHome } from "./home.js";
6
6
  export { shippedManifest } from "./manifest.js";
7
- export { download, sha256Of } from "./download.js";
7
+ export { download, sha256Of, DOWNLOAD_RETRIES, DOWNLOAD_RETRY_DELAY_MS, DOWNLOAD_STALL_MS, type DownloadOptions, type DownloadTimings, } from "./download.js";
8
8
  export { withLock } from "./lock.js";
9
9
  export { unzip, untgz } from "./unpack.js";
10
10
  //# sourceMappingURL=index.d.ts.map
@@ -1,2 +1,2 @@
1
1
  /*! AllyHub. Copyright (c) 2026 AllyHub, Inc. All rights reserved. Use is subject to LICENSE.md. */
2
- export{binVariable,createRuntimes}from"./runtimes.js";export{createPackages,npmCi}from"./packages.js";export{bundledEnv}from"./bundled.js";export{RuntimeError}from"./errors.js";export{cacheHome}from"./home.js";export{shippedManifest}from"./manifest.js";export{download,sha256Of}from"./download.js";export{withLock}from"./lock.js";export{unzip,untgz}from"./unpack.js";
2
+ export{binVariable,createRuntimes}from"./runtimes.js";export{createPackages,npmCi,NPM_FETCH_TIMEOUT_MS,NPM_STALL_MS}from"./packages.js";export{bundledEnv}from"./bundled.js";export{RuntimeError}from"./errors.js";export{cacheHome}from"./home.js";export{shippedManifest}from"./manifest.js";export{download,sha256Of,DOWNLOAD_RETRIES,DOWNLOAD_RETRY_DELAY_MS,DOWNLOAD_STALL_MS}from"./download.js";export{withLock}from"./lock.js";export{unzip,untgz}from"./unpack.js";
@@ -5,4 +5,10 @@ export interface LockOptions {
5
5
  onWait?: () => void;
6
6
  }
7
7
  export declare function withLock<T>(path: string, run: () => Promise<T>, options?: LockOptions): Promise<T>;
8
+ /** A new staging folder's path for `dir`, owned by this process. */
9
+ export declare const partialOf: (dir: string) => string;
10
+ /** Whether a process of this computer runs by that pid (one of another user's counts). */
11
+ export declare function running(pid: number): boolean;
12
+ /** Removes the staging folders in `root` of any version of `name` whose process has ended. */
13
+ export declare function sweepPartials(root: string, name: string): Promise<void>;
8
14
  //# sourceMappingURL=lock.d.ts.map
@@ -1,2 +1,2 @@
1
1
  /*! AllyHub. Copyright (c) 2026 AllyHub, Inc. All rights reserved. Use is subject to LICENSE.md. */
2
- import{setTimeout as c}from"node:timers/promises";import{lock as m}from"proper-lockfile";export async function withLock(r,l,f={}){const{signal:o,pollMs:n=150,onWait:s}=f;let e,a,i=!1;for(;;){o?.throwIfAborted();try{a=await m(r,{lockfilePath:r,realpath:!1,onCompromised:t=>{e=t}});break}catch(t){if(t.code!=="ELOCKED")throw t;i||s?.(),i=!0,await c(n,void 0,o?{signal:o}:{})}}try{const t=await l();if(e)throw e;return t}finally{e||await a()}}
2
+ import{randomBytes as l}from"node:crypto";import{readdir as p,rm as u}from"node:fs/promises";import{join as m}from"node:path";import{setTimeout as d}from"node:timers/promises";import{lock as w}from"proper-lockfile";export async function withLock(r,o,i={}){const{signal:t,pollMs:a=150,onWait:f}=i;let n,c,s=!1;for(;;){t?.throwIfAborted();try{c=await w(r,{lockfilePath:r,realpath:!1,onCompromised:e=>{n=e}});break}catch(e){if(e.code!=="ELOCKED")throw e;s||f?.(),s=!0,await d(a,void 0,t?{signal:t}:{})}}try{const e=await o();if(n)throw n;return e}finally{n||await c()}}const h=/\.partial-(\d+)-[0-9a-f]+$/u;export const partialOf=r=>`${r}.partial-${String(process.pid)}-${l(4).toString("hex")}`;export function running(r){try{return process.kill(r,0),!0}catch(o){return o.code==="EPERM"}}export async function sweepPartials(r,o){let i;try{i=await p(r)}catch{return}for(const t of i){if(!t.startsWith(`${o}@`))continue;const a=h.exec(t)?.[1];a!==void 0&&!running(Number(a))&&await u(m(r,t),{recursive:!0,force:!0})}}
@@ -6,11 +6,28 @@ export interface PackagesOptions {
6
6
  env?: Readonly<Record<string, string | undefined>>;
7
7
  /** What fills a folder from its package-lock.json (default: `npm ci`). */
8
8
  install?: Install;
9
+ /** How long npm waits on a quiet connection (default: NPM_FETCH_TIMEOUT_MS). */
10
+ fetchTimeoutMs?: number | undefined;
11
+ /** How long an install may go without progress before it is stopped (default: NPM_STALL_MS). */
12
+ stallMs?: number | undefined;
9
13
  }
10
- export type Install = (dir: string, options: {
14
+ export interface InstallOptions {
11
15
  home: string;
12
16
  signal?: AbortSignal | undefined;
13
- }) => Promise<void>;
17
+ /** npm's `--fetch-timeout`, its socket's idle limit (default: NPM_FETCH_TIMEOUT_MS). */
18
+ fetchTimeoutMs?: number | undefined;
19
+ /** No output and no change in its folders for this long stops it (default: NPM_STALL_MS). */
20
+ stallMs?: number | undefined;
21
+ }
22
+ export type Install = (dir: string, options: InstallOptions) => Promise<void>;
23
+ /** npm's `--fetch-timeout`: a connection quiet this long is dropped and tried again by npm (ms). */
24
+ export declare const NPM_FETCH_TIMEOUT_MS = 30000;
25
+ /**
26
+ * An install with no output and no change in its folder or npm's download
27
+ * folder for this long is stopped (ms): longer than npm's own timeout and
28
+ * retry, so npm says what went wrong first when it can.
29
+ */
30
+ export declare const NPM_STALL_MS = 120000;
14
31
  export interface LocatedPackage {
15
32
  name: string;
16
33
  version: string;
@@ -1,4 +1,4 @@
1
1
  /*! AllyHub. Copyright (c) 2026 AllyHub, Inc. All rights reserved. Use is subject to LICENSE.md. */
2
- import{spawn as _}from"node:child_process";import{createHash as T,randomBytes as H}from"node:crypto";import{existsSync as A,readFileSync as b}from"node:fs";import{copyFile as R,mkdir as E,readdir as y,readFile as C,rename as F,rm as g,writeFile as L}from"node:fs/promises";import{createRequire as I}from"node:module";import{delimiter as z,join as o}from"node:path";import{fileURLToPath as J,pathToFileURL as U}from"node:url";import{RuntimeError as k}from"./errors.js";import{cacheHome as W}from"./home.js";import{withLock as B}from"./lock.js";import{nodeCommand as D}from"./node-program.js";import{createRuntimes as M}from"./runtimes.js";const N=".allyhub-package.json",q=J(new URL("../pins/",import.meta.url));async function G(s){const c=o(s,"node_modules","onnxruntime-node","bin","napi-v6");for(const n of await y(c)){if(n!==process.platform){await g(o(c,n),{recursive:!0,force:!0});continue}for(const p of await y(o(c,n)))p!==process.arch&&await g(o(c,n,p),{recursive:!0,force:!0})}if(process.platform!=="darwin")return;const i=o(c,"darwin",process.arch);for(const n of await y(i))/^libonnxruntime\.\d+\.\d+\.\d+\.dylib$/u.test(n)&&await g(o(i,n),{force:!0})}const V={"onnxruntime-node":G};export const NPX_SETTING=/^npm_config_(global|prefix|location|cache|.*_prefix)/iu;export function npmProblem(s,c){return s.split(`
3
- `).map(n=>n.replace(/^npm (error|ERR!)\s*/u,"").trim()).find(n=>n!==""&&!/^(code|errno|syscall|path|type|A complete log|Exit handler|This is an error with npm|<https)/u.test(n))??`npm ended with code ${String(c)}`}const X=(s,c)=>(c.PATH??"").split(z).some(i=>i!==""&&A(o(i,s)));export async function findNpm(s,c){const i=s.ALLYHUB_NPM??s.npm_execpath;if(i?.endsWith(".js"))return{command:D(s),script:[i]};if(X("npm",s))return{command:"npm",script:[]};const n=await c(),{node:p,npm:l}=n;if(!p||!l)throw new Error("AllyHub's Node has no npm");return{command:p,script:[l]}}export const npmCi=async(s,{home:c,signal:i})=>{const n=await findNpm(process.env,async()=>(await M({home:c}).ensure("node",{signal:i})).bins),p=Object.fromEntries(Object.entries(process.env).filter(([f])=>!NPX_SETTING.test(f))),l=["ci","--ignore-scripts","--omit=dev","--no-audit","--no-fund","--omit=peer","--loglevel=error","--fetch-retries=1"];await new Promise((f,m)=>{const w=_(n.command,[...n.script,...l],{cwd:s,env:{...p,npm_config_cache:o(c,"packages",".npm")},stdio:["ignore","ignore","pipe"],...i?{signal:i}:{}});let h="";w.stderr.on("data",v=>{h=`${h}${v.toString()}`.slice(-1e3)}),w.on("error",m),w.on("close",v=>{v===0?f():m(new Error(npmProblem(h,v)))})})};export function createPackages(s={}){const c=s.env??process.env,i=s.home??W(c),n=s.pins??q,p=s.install??npmCi,l=o(i,"packages"),f=e=>{const r=o(n,e);let t,a;try{t=JSON.parse(b(o(r,"package.json"),"utf8")),a=b(o(r,"package-lock.json"),"utf8")}catch{throw new k("unknown-package",`AllyHub has no package "${e}".`)}const u=t.dependencies??{},d=u[e]??t.version;if(!d)throw new k("unknown-package",`The pin of "${e}" does not name it.`);return{version:d,holds:u,lock:T("sha256").update(a).digest("hex"),dir:r,size:t.allyhubSize??0}},m=(e,r)=>o(l,`${e}@${r.version}`),w=(e,r)=>{try{const t=JSON.parse(b(o(m(e,r),N),"utf8"));return t.version===r.version&&t.lock===r.lock}catch{return!1}},h=(e,r)=>({name:e,version:r.version,dir:m(e,r)}),v=async(e,r,t)=>{const a=m(e,r),u=`${a}.partial-${String(process.pid)}-${H(4).toString("hex")}`;await E(u,{recursive:!0});try{await R(o(r.dir,"package.json"),o(u,"package.json")),await R(o(r.dir,"package-lock.json"),o(u,"package-lock.json")),await p(u,{home:i,signal:t});for(const[d,j]of Object.entries(r.holds)){const O=JSON.parse(await C(o(u,"node_modules",d,"package.json"),"utf8"));if(O.version!==j)throw new Error(`it holds ${d} ${String(O.version)}, not ${j}`)}await V[e]?.(u),await L(o(u,N),`${JSON.stringify({version:r.version,lock:r.lock,at:new Date().toISOString()})}
4
- `),await g(a,{recursive:!0,force:!0}),await F(u,a),await P(e,r)}catch(d){throw await g(u,{recursive:!0,force:!0}),t?.aborted?new k("cancelled",`Stopped getting ${e}.`,{cause:d}):new k("install",`Could not get ${e} ${r.version} (${d instanceof Error?d.message:String(d)}). Check the connection and run it again.`,{cause:d})}},P=async(e,r)=>{const t=`${e}@${r.version}`;for(const a of await y(l))a.startsWith(`${e}@`)&&a!==t&&!a.startsWith(`${t}.`)&&await g(o(l,a),{recursive:!0,force:!0})},$=e=>{const r=f(e);return w(e,r)?h(e,r):void 0},S=(e,r)=>I(o(e,"package.json")).resolve(r),x=async(e,r={})=>{const t=f(e);return w(e,t)||(await E(l,{recursive:!0}).catch(a=>{throw new k("install",`Could not get ${e} ${t.version}: AllyHub cannot write to ${l}.`,{cause:a})}),await B(`${m(e,t)}.lock`,async()=>{w(e,t)||(r.onFetch?.(e),await v(e,t,r.signal))},{signal:r.signal})),h(e,t)};return{home:i,locate:$,ensure:x,size:e=>f(e).size,entry(e){const r=$(e);return r?S(r.dir,e):void 0},resolve(e,r){const t=$(e);return t?S(t.dir,r):void 0},async load(e,r){const{dir:t}=await x(e,r),a=S(t,r?.module??e);return await import(U(a).href)},async remove(e){await g(m(e,f(e)),{recursive:!0,force:!0})}}}
2
+ import{spawn as R}from"node:child_process";import{createHash as I}from"node:crypto";import{existsSync as M,readFileSync as T}from"node:fs";import{copyFile as P,mkdir as j,readdir as _,readFile as A,rename as D,rm as k,stat as H,writeFile as C}from"node:fs/promises";import{createRequire as F}from"node:module";import{delimiter as z,join as o}from"node:path";import{fileURLToPath as U,pathToFileURL as J}from"node:url";import{DOWNLOAD_STALL_MS as W}from"./download.js";import{RuntimeError as b}from"./errors.js";import{cacheHome as G}from"./home.js";import{partialOf as q,sweepPartials as B,withLock as K}from"./lock.js";import{nodeCommand as V}from"./node-program.js";import{createRuntimes as X}from"./runtimes.js";const E=".allyhub-package.json",Y=U(new URL("../pins/",import.meta.url));export const NPM_FETCH_TIMEOUT_MS=W,NPM_STALL_MS=12e4;async function Q(n){const i=o(n,"node_modules","onnxruntime-node","bin","napi-v6");for(const s of await _(i)){if(s!==process.platform){await k(o(i,s),{recursive:!0,force:!0});continue}for(const l of await _(o(i,s)))l!==process.arch&&await k(o(i,s,l),{recursive:!0,force:!0})}if(process.platform!=="darwin")return;const a=o(i,"darwin",process.arch);for(const s of await _(a))/^libonnxruntime\.\d+\.\d+\.\d+\.dylib$/u.test(s)&&await k(o(a,s),{force:!0})}const Z={"onnxruntime-node":Q};export const NPX_SETTING=/^npm_config_(global|prefix|location|cache|.*_prefix)/iu;export function npmProblem(n,i){return n.split(`
3
+ `).map(s=>s.replace(/^npm (error|ERR!)\s*/u,"").trim()).find(s=>s!==""&&!/^(code|errno|syscall|path|type|A complete log|Exit handler|This is an error with npm|<https)/u.test(s))??`npm ended with code ${String(i)}`}const tt=(n,i)=>(i.PATH??"").split(z).some(a=>a!==""&&M(o(a,n)));export async function findNpm(n,i){const a=n.ALLYHUB_NPM??n.npm_execpath;if(a?.endsWith(".js"))return{command:V(n),script:[a]};if(tt("npm",n))return{command:"npm",script:[]};const s=await i(),{node:l,npm:d}=s;if(!l||!d)throw new Error("AllyHub's Node has no npm");return{command:l,script:[d]}}async function et(n,i){const a=await _(n,{recursive:!0}).catch(()=>[]);let s=0;for(const l of await _(i).catch(()=>[]))s+=await H(o(i,l)).then(d=>d.size,()=>0);return`${String(a.length)}:${String(s)}`}export const npmCi=async(n,{home:i,signal:a,fetchTimeoutMs:s=NPM_FETCH_TIMEOUT_MS,stallMs:l=NPM_STALL_MS})=>{const d=await findNpm(process.env,async()=>(await X({home:i}).ensure("node",{signal:a})).bins),O=Object.fromEntries(Object.entries(process.env).filter(([p])=>!NPX_SETTING.test(p))),m=o(i,"packages",".npm"),y=["ci","--ignore-scripts","--omit=dev","--no-audit","--no-fund","--omit=peer","--loglevel=error","--fetch-retries=1",`--fetch-timeout=${String(s)}`];await new Promise((p,h)=>{const w=R(d.command,[...d.script,...y],{cwd:n,env:{...O,npm_config_cache:m},stdio:["ignore","ignore","pipe"],...a?{signal:a}:{}});let g="",x=Date.now(),$="",v=!1,S=!1;const t=setInterval(()=>{v||S||(v=!0,et(n,o(m,"_cacache","tmp")).then(e=>{e!==$?($=e,x=Date.now()):Date.now()-x>=l&&(S=!0,w.kill(),setTimeout(()=>w.kill("SIGKILL"),5e3).unref())}).finally(()=>{v=!1}))},Math.max(20,Math.min(5e3,l/4)));w.stderr.on("data",e=>{x=Date.now(),g=`${g}${e.toString()}`.slice(-1e3)}),w.on("error",e=>{clearInterval(t),h(e)}),w.on("close",e=>{clearInterval(t),S?h(new b("install",`npm made no progress for ${String(l/1e3)} s and was stopped${g.trim()?`; it said: ${npmProblem(g,e)}`:""}`)):e===0?p():h(new Error(npmProblem(g,e)))})})};export function createPackages(n={}){const i=n.env??process.env,a=n.home??G(i),s=n.pins??Y,l=n.install??npmCi,{fetchTimeoutMs:d,stallMs:O}=n,m=o(a,"packages"),y=t=>{const e=o(s,t);let r,c;try{r=JSON.parse(T(o(e,"package.json"),"utf8")),c=T(o(e,"package-lock.json"),"utf8")}catch{throw new b("unknown-package",`AllyHub has no package "${t}".`)}const u=r.dependencies??{},f=u[t]??r.version;if(!f)throw new b("unknown-package",`The pin of "${t}" does not name it.`);return{version:f,holds:u,lock:I("sha256").update(c).digest("hex"),dir:e,size:r.allyhubSize??0}},p=(t,e)=>o(m,`${t}@${e.version}`),h=(t,e)=>{try{const r=JSON.parse(T(o(p(t,e),E),"utf8"));return r.version===e.version&&r.lock===e.lock}catch{return!1}},w=(t,e)=>({name:t,version:e.version,dir:p(t,e)}),g=async(t,e,r)=>{const c=p(t,e),u=q(c);await j(u,{recursive:!0});try{await P(o(e.dir,"package.json"),o(u,"package.json")),await P(o(e.dir,"package-lock.json"),o(u,"package-lock.json")),await l(u,{home:a,signal:r,fetchTimeoutMs:d,stallMs:O});for(const[f,L]of Object.entries(e.holds)){const N=JSON.parse(await A(o(u,"node_modules",f,"package.json"),"utf8"));if(N.version!==L)throw new Error(`it holds ${f} ${String(N.version)}, not ${L}`)}await Z[t]?.(u),await C(o(u,E),`${JSON.stringify({version:e.version,lock:e.lock,at:new Date().toISOString()})}
4
+ `),await k(c,{recursive:!0,force:!0}),await D(u,c),await x(t,e)}catch(f){throw await k(u,{recursive:!0,force:!0}),r?.aborted?new b("cancelled",`Stopped getting ${t}.`,{cause:f}):new b("install",`Could not get ${t} ${e.version} (${f instanceof Error?f.message:String(f)}). Check the connection and run it again.`,{cause:f})}},x=async(t,e)=>{const r=`${t}@${e.version}`;for(const c of await _(m))c.startsWith(`${t}@`)&&c!==r&&!c.startsWith(`${r}.`)&&await k(o(m,c),{recursive:!0,force:!0})},$=t=>{const e=y(t);return h(t,e)?w(t,e):void 0},v=(t,e)=>F(o(t,"package.json")).resolve(e),S=async(t,e={})=>{const r=y(t);return h(t,r)||(await j(m,{recursive:!0}).catch(c=>{throw new b("install",`Could not get ${t} ${r.version}: AllyHub cannot write to ${m}.`,{cause:c})}),await K(`${p(t,r)}.lock`,async()=>{h(t,r)||(await B(m,t),e.onFetch?.(t),await g(t,r,e.signal))},{signal:e.signal})),w(t,r)};return{home:a,locate:$,ensure:S,size:t=>y(t).size,entry(t){const e=$(t);return e?v(e.dir,t):void 0},resolve(t,e){const r=$(t);return r?v(r.dir,e):void 0},async load(t,e){const{dir:r}=await S(t,e),c=v(r,e?.module??t);return await import(J(c).href)},async remove(t){await k(p(t,y(t)),{recursive:!0,force:!0})}}}
@@ -1,4 +1,5 @@
1
1
  import { type Platform, type RuntimeManifest } from "@allyhub-next/protocol";
2
+ import { type DownloadTimings } from "./download.js";
2
3
  export interface RuntimesOptions {
3
4
  /** The cache folder (default: the system's, `cacheHome`). */
4
5
  home?: string;
@@ -13,6 +14,8 @@ export interface RuntimesOptions {
13
14
  * read as a hang to whoever runs them.
14
15
  */
15
16
  log?: (line: string) => void;
17
+ /** How a download waits and tries again (defaults: download.ts's constants). */
18
+ downloads?: DownloadTimings;
16
19
  }
17
20
  export interface Located {
18
21
  name: string;
@@ -1,4 +1,4 @@
1
1
  /*! AllyHub. Copyright (c) 2026 AllyHub, Inc. All rights reserved. Use is subject to LICENSE.md. */
2
- import{randomBytes as W}from"node:crypto";import{chmod as _,mkdir as R,readFile as T,rename as P,rm as k,writeFile as V}from"node:fs/promises";import{dirname as U,join as d}from"node:path";import{binsOf as A,filesFor as B,platformOf as Y}from"@allyhub-next/protocol";import{download as q,sha256Of as G}from"./download.js";import{RuntimeError as m}from"./errors.js";import{cacheHome as K}from"./home.js";import{withLock as Q}from"./lock.js";import{shippedManifest as X}from"./manifest.js";import{inside as C,native as Z,undmg as tt,untgz as et,unzip as rt}from"./unpack.js";const D=".allyhub-runtime.json";export const binVariable=i=>`ALLYHUB_${i.toUpperCase().replaceAll("-","_")}`;const x=i=>`${String(Math.max(1,Math.round(i/1e6)))} MB`;function nt(i,b,w,g){g(`Downloading ${i} ${b} (${x(w)}), once…`);let h=0;return u=>{const $=Math.floor(u/w*10)*10;$!==h&&(h=$,g(` ${String($)}% (${x(u)} of ${x(w)})`))}}export function createRuntimes(i={}){const b=i.log??(t=>{process.stderr.write(`${t}
3
- `)}),w=i.env??process.env,g=i.home??K(w),h=i.manifest??X(),u="platform"in i?i.platform:Y(process.platform,process.arch),$=i.fetch??globalThis.fetch,S=d(g,"runtimes"),z=t=>{const e=Object.hasOwn(h.runtimes,t)?h.runtimes[t]:void 0;if(!e)throw new m("unknown-runtime",`AllyHub has no runtime "${t}".`);return e},p=(t,e)=>d(S,`${t}@${e.version}`),O=(t,e)=>{const r=u?B(e,u):void 0;if(!r)throw new m("unsupported",`${t} ${e.version} has no build for ${u??`${process.platform}-${process.arch}`}.`);return r},F=(t,e,r)=>Object.fromEntries(Object.entries(A(O(t,e))).map(([n,s])=>[n,d(r,Z(s))])),E=(t,e)=>{const r=[...new Set(Object.values(e.platforms).flatMap(c=>Object.keys(A(c))))];if(r.length===0)return;const n=r.map(c=>[c,w[binVariable(c)]]);if(n.some(([,c])=>!c))return;const s=Object.fromEntries(n),a=n[0]?.[1]??"";return{name:t,version:void 0,dir:U(a),bins:s,from:"env"}},j=async(t,e)=>{try{const r=JSON.parse(await T(d(p(t,e),D),"utf8")),n=O(t,e).map(s=>s.sha256);return r.version===e.version&&JSON.stringify(r.files)===JSON.stringify(n)}catch{return!1}},M=async t=>{const e=z(t),r=E(t,e);if(r)return r;if(!await j(t,e))return;const n=p(t,e);return{name:t,version:e.version,dir:n,bins:F(t,e,n),from:"cache"}},H=async(t,e,r)=>{const n=O(t,e),s=p(t,e),a=`${s}.partial-${String(process.pid)}-${W(4).toString("hex")}`,c=d(a,".downloads");await R(c,{recursive:!0});const I=r.onProgress?void 0:nt(t,e.version,n.reduce((l,o)=>l+o.size,0),b);let N=0;try{for(const[l,o]of n.entries()){const v=d(c,String(l));if(await q(o.url,v,{size:o.size,sha256:o.sha256,fetch:$,signal:r.signal,onProgress:(f,y)=>{I?.(N+f),r.onProgress?.({runtime:t,url:o.url,received:f,total:y})}}),N+=o.size,o.unpack==="zip")await rt(v,a);else if(o.unpack==="tgz")await et(v,a);else if(o.unpack==="dmg")await tt(v,a);else{const f=C(a,o.name??st(o.url));if(!f)throw new m("unpack",`${o.url} would be kept outside its folder.`);await R(U(f),{recursive:!0}),await P(v,f),o.executable&&await _(f,493)}for(const f of o.check){const y=C(a,f.path),J=y?await G(y).catch(()=>"missing"):"missing";if(J!==f.sha256)throw new m("checksum",`${f.path} from ${o.url} has sha256 ${J}; its pin is ${f.sha256}.`)}}await k(c,{recursive:!0,force:!0}),await V(d(a,D),`${JSON.stringify({version:e.version,files:n.map(l=>l.sha256),at:new Date().toISOString()})}
4
- `),await k(s,{recursive:!0,force:!0}),await P(a,s)}catch(l){throw await k(a,{recursive:!0,force:!0}),l}},L=async(t,e={})=>{const r=z(t),n=await M(t);if(n)return n;O(t,r),await R(S,{recursive:!0}),await Q(`${p(t,r)}.lock`,async()=>{await j(t,r)||await H(t,r,e)},{signal:e.signal,onWait:()=>{b(`Waiting for ${t}, which another command is getting…`)}});const s=await M(t);if(!s)throw new m("download",`${t} was installed but cannot be found in ${S}.`);return s};return{home:g,platform:u,locate:M,ensure:L,async bin(t,e,r){const s=(await L(t,r)).bins[e];if(!s)throw new m("unknown-runtime",`${t} holds no program "${e}".`);return s},async remove(t){const e=z(t);await k(p(t,e),{recursive:!0,force:!0})},async status(){return Promise.all(Object.entries(h.runtimes).map(async([t,e])=>{const r=u?B(e,u):void 0,n=p(t,e),s=E(t,e)!==void 0?"env":r!==void 0&&await j(t,e)?"cache":void 0;return{name:t,about:e.about,version:e.version,license:e.license,available:r!==void 0,installed:s!==void 0,...s?{from:s}:{},size:(r??[]).reduce((a,c)=>a+c.size,0),dir:n}}))}}}const st=i=>decodeURIComponent(new URL(i).pathname.split("/").pop()??"file");
2
+ import{chmod as T,mkdir as E,readFile as W,rename as J,rm as z,writeFile as _}from"node:fs/promises";import{dirname as U,join as d}from"node:path";import{binsOf as A,filesFor as C,platformOf as V}from"@allyhub-next/protocol";import{download as Y,sha256Of as q}from"./download.js";import{RuntimeError as g}from"./errors.js";import{cacheHome as G}from"./home.js";import{partialOf as K,sweepPartials as Q,withLock as X}from"./lock.js";import{shippedManifest as Z}from"./manifest.js";import{inside as D,native as tt,undmg as et,untgz as rt,unzip as nt}from"./unpack.js";const F=".allyhub-runtime.json";export const binVariable=o=>`ALLYHUB_${o.toUpperCase().replaceAll("-","_")}`;const L=o=>`${String(Math.max(1,Math.round(o/1e6)))} MB`;function st(o,$,w,v){v(`Downloading ${o} ${$} (${L(w)}), once…`);let h=0;return u=>{const b=Math.floor(u/w*10)*10;b!==h&&(h=b,v(` ${String(b)}% (${L(u)} of ${L(w)})`))}}export function createRuntimes(o={}){const $=o.log??(t=>{process.stderr.write(`${t}
3
+ `)}),w=o.env??process.env,v=o.home??G(w),h=o.manifest??Z(),u="platform"in o?o.platform:V(process.platform,process.arch),b=o.fetch??globalThis.fetch,y=d(v,"runtimes"),j=t=>{const e=Object.hasOwn(h.runtimes,t)?h.runtimes[t]:void 0;if(!e)throw new g("unknown-runtime",`AllyHub has no runtime "${t}".`);return e},p=(t,e)=>d(y,`${t}@${e.version}`),k=(t,e)=>{const r=u?C(e,u):void 0;if(!r)throw new g("unsupported",`${t} ${e.version} has no build for ${u??`${process.platform}-${process.arch}`}.`);return r},H=(t,e,r)=>Object.fromEntries(Object.entries(A(k(t,e))).map(([n,s])=>[n,d(r,tt(s))])),N=(t,e)=>{const r=[...new Set(Object.values(e.platforms).flatMap(f=>Object.keys(A(f))))];if(r.length===0)return;const n=r.map(f=>[f,w[binVariable(f)]]);if(n.some(([,f])=>!f))return;const s=Object.fromEntries(n),c=n[0]?.[1]??"";return{name:t,version:void 0,dir:U(c),bins:s,from:"env"}},R=async(t,e)=>{try{const r=JSON.parse(await W(d(p(t,e),F),"utf8")),n=k(t,e).map(s=>s.sha256);return r.version===e.version&&JSON.stringify(r.files)===JSON.stringify(n)}catch{return!1}},M=async t=>{const e=j(t),r=N(t,e);if(r)return r;if(!await R(t,e))return;const n=p(t,e);return{name:t,version:e.version,dir:n,bins:H(t,e,n),from:"cache"}},I=async(t,e,r)=>{const n=k(t,e),s=p(t,e),c=K(s),f=d(c,".downloads");await E(f,{recursive:!0});const B=r.onProgress?void 0:st(t,e.version,n.reduce((l,i)=>l+i.size,0),$);let x=0;try{for(const[l,i]of n.entries()){const O=d(f,String(l));if(await Y(i.url,O,{size:i.size,sha256:i.sha256,fetch:b,signal:r.signal,...o.downloads,onRetry:(a,m,S)=>{$(` ${a.message} Trying again (${String(m+1)} of ${String(S)})…`)},onProgress:(a,m)=>{B?.(x+a),r.onProgress?.({runtime:t,url:i.url,received:a,total:m})}}),x+=i.size,i.unpack==="zip")await nt(O,c);else if(i.unpack==="tgz")await rt(O,c);else if(i.unpack==="dmg")await et(O,c);else{const a=D(c,i.name??ot(i.url));if(!a)throw new g("unpack",`${i.url} would be kept outside its folder.`);await E(U(a),{recursive:!0}),await J(O,a),i.executable&&await T(a,493)}for(const a of i.check){const m=D(c,a.path),S=m?await q(m).catch(()=>"missing"):"missing";if(S!==a.sha256)throw new g("checksum",`${a.path} from ${i.url} has sha256 ${S}; its pin is ${a.sha256}.`)}}await z(f,{recursive:!0,force:!0}),await _(d(c,F),`${JSON.stringify({version:e.version,files:n.map(l=>l.sha256),at:new Date().toISOString()})}
4
+ `),await z(s,{recursive:!0,force:!0}),await J(c,s)}catch(l){throw await z(c,{recursive:!0,force:!0}),l}},P=async(t,e={})=>{const r=j(t),n=await M(t);if(n)return n;k(t,r),await E(y,{recursive:!0}),await X(`${p(t,r)}.lock`,async()=>{await R(t,r)||(await Q(y,t),await I(t,r,e))},{signal:e.signal,onWait:()=>{$(`Waiting for ${t}, which another command is getting…`)}});const s=await M(t);if(!s)throw new g("download",`${t} was installed but cannot be found in ${y}.`);return s};return{home:v,platform:u,locate:M,ensure:P,async bin(t,e,r){const s=(await P(t,r)).bins[e];if(!s)throw new g("unknown-runtime",`${t} holds no program "${e}".`);return s},async remove(t){const e=j(t);await z(p(t,e),{recursive:!0,force:!0})},async status(){return Promise.all(Object.entries(h.runtimes).map(async([t,e])=>{const r=u?C(e,u):void 0,n=p(t,e),s=N(t,e)!==void 0?"env":r!==void 0&&await R(t,e)?"cache":void 0;return{name:t,about:e.about,version:e.version,license:e.license,available:r!==void 0,installed:s!==void 0,...s?{from:s}:{},size:(r??[]).reduce((c,f)=>c+f.size,0),dir:n}}))}}}const ot=o=>decodeURIComponent(new URL(o).pathname.split("/").pop()??"file");
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@allyhub-next/runtimes",
3
- "version": "0.6.0",
3
+ "version": "0.7.1",
4
4
  "type": "module",
5
5
  "exports": {
6
6
  ".": {
@@ -76,7 +76,12 @@
76
76
  "unpack": {
77
77
  "default": "none",
78
78
  "type": "string",
79
- "enum": ["none", "zip", "tgz"]
79
+ "enum": [
80
+ "none",
81
+ "zip",
82
+ "tgz",
83
+ "dmg"
84
+ ]
80
85
  },
81
86
  "name": {
82
87
  "type": "string",
@@ -97,7 +102,10 @@
97
102
  "pattern": "^[0-9a-f]{64}$"
98
103
  }
99
104
  },
100
- "required": ["path", "sha256"],
105
+ "required": [
106
+ "path",
107
+ "sha256"
108
+ ],
101
109
  "additionalProperties": false
102
110
  }
103
111
  },
@@ -118,17 +126,29 @@
118
126
  }
119
127
  }
120
128
  },
121
- "required": ["url", "sha256", "size"],
129
+ "required": [
130
+ "url",
131
+ "sha256",
132
+ "size"
133
+ ],
122
134
  "additionalProperties": false
123
135
  }
124
136
  }
125
137
  }
126
138
  },
127
- "required": ["about", "version", "license", "platforms"],
139
+ "required": [
140
+ "about",
141
+ "version",
142
+ "license",
143
+ "platforms"
144
+ ],
128
145
  "additionalProperties": false
129
146
  }
130
147
  }
131
148
  },
132
- "required": ["version", "runtimes"],
149
+ "required": [
150
+ "version",
151
+ "runtimes"
152
+ ],
133
153
  "additionalProperties": false
134
154
  }
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@allyhub-next/scenery",
3
- "version": "0.6.0",
3
+ "version": "0.7.1",
4
4
  "type": "module",
5
5
  "exports": {
6
6
  ".": {
@@ -1,5 +1,5 @@
1
1
  import type { RefNode, StructuredNode } from "../formula/ast.js";
2
- import type { SharedFormula, Workbook } from "../workbook.js";
2
+ import type { SharedFormula, Workbook, Worksheet } from "../workbook.js";
3
3
  export interface Analysis {
4
4
  reads: (RefNode | StructuredNode)[];
5
5
  /** Defined names, in lower case. */
@@ -9,13 +9,19 @@ export interface Analysis {
9
9
  unknownNames: string[];
10
10
  /** Functions that are nothing here. */
11
11
  unknownFunctions: string[];
12
- /** Functions given too few or too many arguments. */
12
+ /** Functions given too few or too many arguments, or a repeating group of them left short (`group`, its size). */
13
13
  arguments: {
14
14
  name: string;
15
15
  given: number;
16
16
  min: number;
17
17
  max: number;
18
+ group?: number;
18
19
  }[];
19
20
  }
20
- export declare function analyse(wb: Workbook, shared: SharedFormula): Analysis;
21
+ /**
22
+ * A formula's analysis. `sheet`: the sheet it is on, whose own names come
23
+ * before the workbook's; without it every sheet's name of a spelling counts,
24
+ * so what a formula can read is never less than it reads.
25
+ */
26
+ export declare function analyse(wb: Workbook, shared: SharedFormula, sheet?: Worksheet): Analysis;
21
27
  //# sourceMappingURL=analyse.d.ts.map
@@ -1,2 +1,2 @@
1
1
  /*! AllyHub. Copyright (c) 2026 AllyHub, Inc. All rights reserved. Use is subject to LICENSE.md. */
2
- import{FUNCTIONS as g}from"./functions/index.js";export function analyse(o,f){const s={reads:[],names:new Set,volatile:!1,unknownNames:[],unknownFunctions:[],arguments:[]},m=new Set,c=(e,t)=>{const n=e.toLowerCase();if(t.has(n))return!0;const a=o.name(n);if(a)return s.names.add(n),m.has(n)||(m.add(n),a.formula?.node&&r(a.formula.node,new Set)),!0;const u=o.table(n);return u?(s.reads.push({kind:"structured",table:u.name,sections:[],columns:[],thisRow:!1}),!0):!1},r=(e,t)=>{switch(e.kind){case"ref":case"structured":s.reads.push(e);return;case"name":c(e.name,t)||s.unknownNames.push(e.name);return;case"unary":case"postfix":case"paren":r(e.arg,t);return;case"binary":r(e.left,t),r(e.right,t);return;case"array":return;case"invoke":r(e.callee,t);for(const n of e.args)r(n,t);return;case"call":{const n=g.get(e.name);if(e.name==="LET"||e.name==="LAMBDA"){const a=new Set(t),u=e.args[e.args.length-1];e.args.forEach((i,d)=>{if(i!==u){if(e.name==="LET"&&d%2===1){r(i,a);return}i.kind==="name"&&a.add(i.name.toLowerCase())}}),u&&r(u,a);return}n?(n.volatile===!0&&(s.volatile=!0),(e.args.length<n.min||e.args.length>n.max)&&s.arguments.push({name:e.name,given:e.args.length,min:n.min,max:n.max})):c(e.written,t)||s.unknownFunctions.push(e.name);for(const a of e.args)r(a,t);return}default:return}};return f.node&&r(f.node,new Set),s}
2
+ import{FUNCTIONS as p}from"./functions/index.js";import{fillsGroup as w}from"./functions/define.js";export function analyse(i,c,l){const a={reads:[],names:new Set,volatile:!1,unknownNames:[],unknownFunctions:[],arguments:[]},d=new Set,g=(e,t,n)=>{const r=e.toLowerCase();if(n===void 0&&t.has(r))return!0;const u=n===void 0?l:i.sheet(n),o=u?[i.name(r,u)]:i.definitions(r);if(o.some(m=>m!==void 0)){a.names.add(r);const m=`${n??""}!${r}`;if(!d.has(m)){d.add(m);for(const h of o)h?.formula?.node&&s(h.formula.node,new Set)}return!0}if(p.has(e.toUpperCase()))return!0;const f=i.table(r);return f?(a.reads.push({kind:"structured",table:f.name,sections:[],columns:[],thisRow:!1}),!0):!1},s=(e,t)=>{switch(e.kind){case"ref":case"structured":a.reads.push(e);return;case"name":g(e.name,t,e.sheet)||a.unknownNames.push(e.name);return;case"unary":case"postfix":case"paren":s(e.arg,t);return;case"binary":s(e.left,t),s(e.right,t);return;case"array":return;case"invoke":s(e.callee,t);for(const n of e.args)s(n,t);return;case"call":{const n=p.get(e.name);if(e.name==="LET"||e.name==="LAMBDA"){const r=new Set(t),u=e.args[e.args.length-1];e.args.forEach((o,f)=>{if(o!==u){if(e.name==="LET"&&f%2===1){s(o,r);return}o.kind==="name"&&r.add(o.name.toLowerCase())}}),u&&s(u,r);return}if(!n)g(e.written,t)||a.unknownFunctions.push(e.name);else{n.volatile===!0&&(a.volatile=!0);const r=n.kind==="raw"&&!w(n.params,e.args.length);(e.args.length<n.min||e.args.length>n.max||r)&&a.arguments.push({name:e.name,given:e.args.length,min:n.min,max:n.max,...r?{group:n.params.group.length}:{}})}for(const r of e.args)s(r,t);return}default:return}};return c.node&&s(c.node,new Set),a}
@@ -4,7 +4,11 @@ export declare function numberOfText(text: string): number | undefined;
4
4
  export declare function toNumber(v: Scalar | undefined): number | CellError;
5
5
  export declare function toText(v: Scalar | undefined): string | CellError;
6
6
  export declare function toBool(v: Scalar | undefined): boolean | CellError;
7
- /** Equal to 15 significant digits, as Excel compares numbers. */
7
+ /**
8
+ * Equal to 15 significant digits, as Excel compares numbers. Two numbers that
9
+ * round to the same 15 digits are within 1e-13 of each other relatively, so
10
+ * any further apart are told apart without rounding either.
11
+ */
8
12
  export declare const sameNumber: (a: number, b: number) => boolean;
9
13
  /** Excel's order of two values that are not errors: numbers, then text, then TRUE and FALSE. */
10
14
  export declare function compare(a: Scalar, b: Scalar): number;
@@ -1,2 +1,2 @@
1
1
  /*! AllyHub. Copyright (c) 2026 AllyHub, Inc. All rights reserved. Use is subject to LICENSE.md. */
2
- import{parseValue as d}from"numfmt";import{CellError as f,ERR as s,Matrix as x,numberText as h,readTyped as b}from"../values.js";export function numberOfText(e){const r=b(e.trim());if(typeof r.value=="number")return r.value;if(e.trim()==="")return;const t=d(e);return typeof t?.value=="number"?t.value:void 0}export function toNumber(e){return typeof e=="number"?e:e==null?0:typeof e=="boolean"?e?1:0:e instanceof f?e:numberOfText(e)??s.VALUE}export function toText(e){return typeof e=="string"?e:e==null?"":typeof e=="number"?h(e):typeof e=="boolean"?e?"TRUE":"FALSE":e}export function toBool(e){if(typeof e=="boolean")return e;if(e==null)return!1;if(typeof e=="number")return e!==0;if(e instanceof f)return e;const r=e.trim().toUpperCase();return r==="TRUE"?!0:r==="FALSE"?!1:s.VALUE}const m=e=>typeof e=="number"?0:typeof e=="string"?1:2;export const sameNumber=(e,r)=>e===r||Number(e.toPrecision(15))===Number(r.toPrecision(15));export function compare(e,r){const t=e??(typeof r=="string"?"":typeof r=="boolean"?!1:0),n=r??(typeof e=="string"?"":typeof e=="boolean"?!1:0),o=m(t),c=m(n);if(o!==c)return o<c?-1:1;if(typeof t=="number"&&typeof n=="number")return sameNumber(t,n)?0:t<n?-1:1;if(typeof t=="string"&&typeof n=="string"){const a=t.toUpperCase(),u=n.toUpperCase();return a===u?0:a<u?-1:1}return t===n?0:t===!1?-1:1}export const finite=e=>Number.isFinite(e)?e:s.NUM;export function snap(e,r,t){return Math.abs(e)<=Math.max(Math.abs(r),Math.abs(t))*89e-17?0:e}export function arithmetic(e,r,t){const n=toNumber(r);if(n instanceof f)return n;const o=toNumber(t);if(o instanceof f)return o;switch(e){case"+":return finite(snap(n+o,n,o));case"-":return finite(snap(n-o,n,o));case"*":return finite(n*o);case"/":return o===0?s.DIV0:finite(n/o);default:return n===0&&o===0?s.NUM:n===0&&o<0?s.DIV0:finite(n**o)}}export function binary(e,r,t){if(r instanceof f)return r;if(t instanceof f)return t;switch(e){case"&":{const n=toText(r);if(n instanceof f)return n;const o=toText(t);return o instanceof f?o:`${n}${o}`}case"=":return compare(r,t)===0;case"<>":return compare(r,t)!==0;case"<":return compare(r,t)<0;case"<=":return compare(r,t)<=0;case">":return compare(r,t)>0;case">=":return compare(r,t)>=0;default:return arithmetic(e,r,t)}}export function mapBoth(e,r,t){const n=Math.max(e.rows,r.rows),o=Math.max(e.cols,r.cols),c=new Array(n*o),a=(u,i,l)=>{const p=u.rows===1?0:i,y=u.cols===1?0:l;return p<u.rows&&y<u.cols?u.at(p,y):void 0};for(let u=0;u<n;u++)for(let i=0;i<o;i++){const l=a(e,u,i),p=a(r,u,i);c[u*o+i]=l===void 0||p===void 0?s.NA:t(l,p)}return new x(n,o,c)}
2
+ import{parseValue as d}from"numfmt";import{CellError as f,ERR as s,Matrix as x,numberText as h,readTyped as M}from"../values.js";export function numberOfText(e){if(!/\d/u.test(e))return;const r=M(e.trim());if(typeof r.value=="number")return r.value;if(e.trim()==="")return;const t=d(e);return typeof t?.value=="number"?t.value:void 0}export function toNumber(e){return typeof e=="number"?e:e==null?0:typeof e=="boolean"?e?1:0:e instanceof f?e:numberOfText(e)??s.VALUE}export function toText(e){return typeof e=="string"?e:e==null?"":typeof e=="number"?h(e):typeof e=="boolean"?e?"TRUE":"FALSE":e}export function toBool(e){if(typeof e=="boolean")return e;if(e==null)return!1;if(typeof e=="number")return e!==0;if(e instanceof f)return e;const r=e.trim().toUpperCase();return r==="TRUE"?!0:r==="FALSE"?!1:s.VALUE}const m=e=>typeof e=="number"?0:typeof e=="string"?1:2;export const sameNumber=(e,r)=>e===r?!0:Math.abs(e-r)>1e-13*Math.max(Math.abs(e),Math.abs(r))?!1:Number(e.toPrecision(15))===Number(r.toPrecision(15));export function compare(e,r){const t=e??(typeof r=="string"?"":typeof r=="boolean"?!1:0),n=r??(typeof e=="string"?"":typeof e=="boolean"?!1:0),o=m(t),c=m(n);if(o!==c)return o<c?-1:1;if(typeof t=="number"&&typeof n=="number")return sameNumber(t,n)?0:t<n?-1:1;if(typeof t=="string"&&typeof n=="string"){const a=t.toUpperCase(),u=n.toUpperCase();return a===u?0:a<u?-1:1}return t===n?0:t===!1?-1:1}export const finite=e=>Number.isFinite(e)?e:s.NUM;export function snap(e,r,t){return Math.abs(e)<=Math.max(Math.abs(r),Math.abs(t))*89e-17?0:e}export function arithmetic(e,r,t){const n=toNumber(r);if(n instanceof f)return n;const o=toNumber(t);if(o instanceof f)return o;switch(e){case"+":return finite(snap(n+o,n,o));case"-":return finite(snap(n-o,n,o));case"*":return finite(n*o);case"/":return o===0?s.DIV0:finite(n/o);default:return n===0&&o===0?s.NUM:n===0&&o<0?s.DIV0:finite(n**o)}}export function binary(e,r,t){if(r instanceof f)return r;if(t instanceof f)return t;switch(e){case"&":{const n=toText(r);if(n instanceof f)return n;const o=toText(t);return o instanceof f?o:`${n}${o}`}case"=":return compare(r,t)===0;case"<>":return compare(r,t)!==0;case"<":return compare(r,t)<0;case"<=":return compare(r,t)<=0;case">":return compare(r,t)>0;case">=":return compare(r,t)>=0;default:return arithmetic(e,r,t)}}export function mapBoth(e,r,t){const n=Math.max(e.rows,r.rows),o=Math.max(e.cols,r.cols),c=new Array(n*o),a=(u,i,l)=>{const p=u.rows===1?0:i,y=u.cols===1?0:l;return p<u.rows&&y<u.cols?u.at(p,y):void 0};for(let u=0;u<n;u++)for(let i=0;i<o;i++){const l=a(e,u,i),p=a(r,u,i);c[u*o+i]=l===void 0||p===void 0?s.NA:t(l,p)}return new x(n,o,c)}
@@ -1,12 +1,27 @@
1
1
  import type { Node, RefNode, StructuredNode } from "../formula/ast.js";
2
2
  import { CellError, Matrix, type Scalar } from "../values.js";
3
3
  import { FormulaCell, SharedFormula, type Slot, type Workbook, type Worksheet } from "../workbook.js";
4
+ import { type Computed } from "./remote.js";
5
+ import { RangeCache, type Index } from "./indexes.js";
6
+ import { type FunctionDef } from "./functions/index.js";
4
7
  import { Lambda, Reference, Union, type Frame, type Value } from "./types.js";
5
8
  export interface CalcOptions {
6
9
  /** The moment NOW and TODAY read. Default: the clock. */
7
10
  now?: Date;
8
11
  /** What RAND reads, values from 0 up to 1. Default: Math.random. */
9
12
  random?: () => number;
13
+ /**
14
+ * Keeps what each pass settles for `takeComputed`: a calculation in a
15
+ * worker, which sends it to the model the page reads.
16
+ */
17
+ report?: boolean;
18
+ /**
19
+ * Computes nothing: a model the page reads while a calculation elsewhere
20
+ * works. What is typed shows at once; what formulas give arrives by
21
+ * `receive`, and a formula reads as it last did until then. A formula
22
+ * given to `evaluate` (a rule's, a validation's) is worked out over that.
23
+ */
24
+ replica?: boolean;
10
25
  }
11
26
  /**
12
27
  * Random numbers that are the same for the same seed, for a result that must
@@ -31,12 +46,15 @@ export declare class Calc {
31
46
  private readonly stack;
32
47
  private readonly inCycle;
33
48
  private readonly namesAt;
34
- private readonly dependents;
35
- private readonly watches;
36
- /** Watches by the column they are on, and those too wide to list by column. */
37
- private readonly watchesAt;
38
- private readonly wideWatches;
39
- private graph;
49
+ /** Who reads whom: made the first time something changes. */
50
+ private readonly graph;
51
+ private graphMade;
52
+ /** Keeps what each pass settles, for `takeComputed`. */
53
+ private readonly reports;
54
+ /** Computes nothing; results arrive by `receive`. */
55
+ readonly replica: boolean;
56
+ /** What passes settled since `takeComputed` was last asked. */
57
+ private readonly settled;
40
58
  /** What spills changed since it was last looked at. */
41
59
  private moved;
42
60
  /** Formula cells whose spill's size turned out to depend on itself. */
@@ -44,8 +62,10 @@ export declare class Calc {
44
62
  private readonly hiddenBy;
45
63
  /** What reads what no reference shows (OFFSET, INDIRECT) or changes by itself (NOW, RAND): computed with every change, as Excel's are. */
46
64
  private volatiles;
47
- /** Lookup indexes of ranges, while nothing has changed. */
48
- readonly indexes: Map<string, Map<string, number[]>>;
65
+ /** Lookup and criteria indexes of ranges, each kept until its range changes. */
66
+ readonly indexes: RangeCache<Index>;
67
+ /** Criteria functions' results over ranges, each kept until a range it read changes. */
68
+ readonly results: RangeCache<Scalar>;
49
69
  readonly wb: Workbook;
50
70
  constructor(wb: Workbook, o?: CalcOptions);
51
71
  private allCells;
@@ -65,6 +85,8 @@ export declare class Calc {
65
85
  /** What an empty place reads: nothing, or the value a formula spilled into it. */
66
86
  private ghost;
67
87
  private circular;
88
+ /** What was worked out over ranges that hold changed cells is worked out again. */
89
+ private forget;
68
90
  private run;
69
91
  /**
70
92
  * What reads a spill's cells computed again until nothing moves: who reads
@@ -79,6 +101,8 @@ export declare class Calc {
79
101
  private analysisOf;
80
102
  /** What a formula cell reads, by what evaluating its references gives. */
81
103
  private readsOf;
104
+ /** What a formula reads evaluated at a place, an entry a reference (each place of a union its own); undefined where one gives no place. */
105
+ private readsAt;
82
106
  /** What a formula that is in no cell reads: a chart's, a rule's, a check's. */
83
107
  readsOfFormula(shared: SharedFormula, sheet: Worksheet): Reference[];
84
108
  /** `seeds`, and what they read that is to be computed, each after what it reads. */
@@ -103,6 +127,7 @@ export declare class Calc {
103
127
  private bound;
104
128
  resolveRef(n: RefNode, f: Frame): Reference | Union | CellError;
105
129
  structured(n: StructuredNode, f: Frame): Reference | Union | CellError;
130
+ /** A name's value: a LET's or a LAMBDA's, else the sheet's own (`sheet` when it is written Sheet1!name), else the workbook's. */
106
131
  private nameValue;
107
132
  private intersect;
108
133
  private unary;
@@ -115,17 +140,31 @@ export declare class Calc {
115
140
  /** A LAMBDA given its arguments' values. */
116
141
  apply(l: Lambda, args: readonly Value[]): Value;
117
142
  private call;
118
- /** A function of single values given ranges or arrays: over each of their cells. */
119
- private lifted;
143
+ /**
144
+ * A function given its arguments' values: every function call goes through
145
+ * here, a function's own call of another (AGGREGATE's) too, so each is
146
+ * lifted over arrays as its parameters say.
147
+ */
148
+ applyFunction(def: FunctionDef, values: readonly Value[], f: Frame): Value;
149
+ /**
150
+ * A function over its arguments, as Excel lifts one: where a single value
151
+ * goes and an array or a range of several cells is given, the function is
152
+ * applied over each of its cells and the results are an array. Arrays of
153
+ * different sizes are stretched along a side of one, and give #N/A past the
154
+ * end of a shorter one. Every argument taken as a single value is given as
155
+ * one (a Scalar, or Missing when left empty).
156
+ */
157
+ private over;
158
+ /** One cell of a lifted function's array: what one call gave, as a single value. */
159
+ private element;
120
160
  /** One scalar from a value: a range in a place for one gives the cell in the formula's row or column. */
121
161
  scalar(v: Value, f: Frame): Scalar;
122
162
  /** Lets NOW, TODAY, RAND and whatever else is volatile change on the next pass. */
123
163
  recalculate(): this;
124
- private key;
125
- private addEdges;
126
- private removeEdges;
127
164
  /** The graph of who reads whom: made the first time something changes. */
128
165
  private build;
166
+ private addEdges;
167
+ private removeEdges;
129
168
  /** Who reads any place of an area. */
130
169
  private readersIn;
131
170
  /** Who reads a place. */
@@ -146,6 +185,14 @@ export declare class Calc {
146
185
  change(cells: readonly CellChange[]): void;
147
186
  /** Sets a defined name's constant (a scenario's) and computes what reads it. */
148
187
  setName(name: string, value: Scalar): void;
188
+ /** What passes settled since this was last asked, for the model the page reads (`receive`). */
189
+ takeComputed(): Computed;
190
+ /**
191
+ * What a calculation elsewhere computed, put in this model: each formula
192
+ * cell's value and spill. A cell no longer a formula, or another formula
193
+ * now, is left as it is: what was typed there since is newer.
194
+ */
195
+ receive(computed: Computed): void;
149
196
  /** Numbers of a value, for code outside a formula. */
150
197
  numberOf(v: Scalar): number | CellError;
151
198
  }