@acryldev/blends 1.7.0 → 1.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 (596) hide show
  1. package/dist/index.js +4 -2
  2. package/dist/index.js.map +1 -1
  3. package/package.json +2 -2
  4. package/docs/framework/LICENSE +0 -23
  5. package/docs/framework/README.md +0 -70
  6. package/docs/framework/agents/index.md +0 -59
  7. package/docs/framework/api/acryl.md +0 -247
  8. package/docs/framework/api/context.md +0 -478
  9. package/docs/framework/api/exception.md +0 -80
  10. package/docs/framework/api/index.md +0 -12
  11. package/docs/framework/api/presets.md +0 -62
  12. package/docs/framework/api/request.md +0 -396
  13. package/docs/framework/api/routing.md +0 -303
  14. package/docs/framework/api/summary.md +0 -143
  15. package/docs/framework/concepts/benchmarks.md +0 -26
  16. package/docs/framework/concepts/developer-experience.md +0 -5
  17. package/docs/framework/concepts/middleware.md +0 -21
  18. package/docs/framework/concepts/motivation.md +0 -14
  19. package/docs/framework/concepts/routers.md +0 -63
  20. package/docs/framework/concepts/stacks.md +0 -235
  21. package/docs/framework/concepts/web-standard.md +0 -27
  22. package/docs/framework/cordis/acryl-in-a-cordis-app.md +0 -160
  23. package/docs/framework/cordis/concepts.md +0 -105
  24. package/docs/framework/cordis/middleware.md +0 -8
  25. package/docs/framework/cordis/migration-from-0-3.md +0 -111
  26. package/docs/framework/cordis/migration-from-0-4.md +0 -14
  27. package/docs/framework/cordis/migration-from-dsh-webserver.md +0 -109
  28. package/docs/framework/cordis/migration-to-1-0.md +0 -46
  29. package/docs/framework/cordis/mounting.md +0 -85
  30. package/docs/framework/cordis/node-server.md +0 -100
  31. package/docs/framework/cordis/plugin-lifecycle.md +0 -111
  32. package/docs/framework/cordis/surfaces.md +0 -71
  33. package/docs/framework/cordis/transport-and-cancellation.md +0 -57
  34. package/docs/framework/cordis/validation.md +0 -135
  35. package/docs/framework/getting-started/basic.md +0 -201
  36. package/docs/framework/getting-started/bun.md +0 -219
  37. package/docs/framework/getting-started/deploy.md +0 -133
  38. package/docs/framework/getting-started/desktop.md +0 -80
  39. package/docs/framework/getting-started/nodejs.md +0 -365
  40. package/docs/framework/getting-started/other-runtimes.md +0 -30
  41. package/docs/framework/guides/best-practices.md +0 -231
  42. package/docs/framework/guides/bring-your-own-tool.md +0 -218
  43. package/docs/framework/guides/client-modules.md +0 -210
  44. package/docs/framework/guides/create-acrylblends.md +0 -143
  45. package/docs/framework/guides/data.md +0 -314
  46. package/docs/framework/guides/examples.md +0 -3
  47. package/docs/framework/guides/faq.md +0 -19
  48. package/docs/framework/guides/forms-and-sessions.md +0 -235
  49. package/docs/framework/guides/helpers.md +0 -33
  50. package/docs/framework/guides/jsx-dom.md +0 -301
  51. package/docs/framework/guides/jsx.md +0 -487
  52. package/docs/framework/guides/middleware.md +0 -253
  53. package/docs/framework/guides/production.md +0 -80
  54. package/docs/framework/guides/rpc.md +0 -878
  55. package/docs/framework/guides/testing.md +0 -133
  56. package/docs/framework/guides/validation.md +0 -470
  57. package/docs/framework/helpers/accepts.md +0 -60
  58. package/docs/framework/helpers/adapter.md +0 -57
  59. package/docs/framework/helpers/conninfo.md +0 -77
  60. package/docs/framework/helpers/cookie.md +0 -232
  61. package/docs/framework/helpers/css.md +0 -282
  62. package/docs/framework/helpers/dev.md +0 -64
  63. package/docs/framework/helpers/factory.md +0 -180
  64. package/docs/framework/helpers/html.md +0 -123
  65. package/docs/framework/helpers/jwt.md +0 -184
  66. package/docs/framework/helpers/proxy.md +0 -115
  67. package/docs/framework/helpers/route.md +0 -143
  68. package/docs/framework/helpers/ssg.md +0 -390
  69. package/docs/framework/helpers/streaming.md +0 -224
  70. package/docs/framework/helpers/testing.md +0 -118
  71. package/docs/framework/helpers/websocket.md +0 -208
  72. package/docs/framework/middleware/builtin/basic-auth.md +0 -165
  73. package/docs/framework/middleware/builtin/bearer-auth.md +0 -138
  74. package/docs/framework/middleware/builtin/body-limit.md +0 -71
  75. package/docs/framework/middleware/builtin/cache.md +0 -99
  76. package/docs/framework/middleware/builtin/combine.md +0 -94
  77. package/docs/framework/middleware/builtin/compress.md +0 -59
  78. package/docs/framework/middleware/builtin/context-storage.md +0 -74
  79. package/docs/framework/middleware/builtin/cors.md +0 -134
  80. package/docs/framework/middleware/builtin/csrf.md +0 -105
  81. package/docs/framework/middleware/builtin/etag.md +0 -54
  82. package/docs/framework/middleware/builtin/ip-restriction.md +0 -69
  83. package/docs/framework/middleware/builtin/jsx-renderer.md +0 -283
  84. package/docs/framework/middleware/builtin/jwk.md +0 -192
  85. package/docs/framework/middleware/builtin/jwt.md +0 -145
  86. package/docs/framework/middleware/builtin/language.md +0 -232
  87. package/docs/framework/middleware/builtin/logger.md +0 -74
  88. package/docs/framework/middleware/builtin/loopback-only.md +0 -31
  89. package/docs/framework/middleware/builtin/method-not-allowed.md +0 -48
  90. package/docs/framework/middleware/builtin/method-override.md +0 -80
  91. package/docs/framework/middleware/builtin/mount.md +0 -103
  92. package/docs/framework/middleware/builtin/pretty-json.md +0 -53
  93. package/docs/framework/middleware/builtin/request-id.md +0 -87
  94. package/docs/framework/middleware/builtin/secure-headers.md +0 -247
  95. package/docs/framework/middleware/builtin/timeout.md +0 -98
  96. package/docs/framework/middleware/builtin/timing.md +0 -100
  97. package/docs/framework/middleware/builtin/trailing-slash.md +0 -74
  98. package/docs/framework/middleware/third-party.md +0 -4
  99. package/docs/framework/workshop/README.md +0 -294
  100. package/docs/framework/workshop/facilitator.md +0 -101
  101. package/plugins/agent/LICENSE +0 -21
  102. package/plugins/agent/agent.ts +0 -229
  103. package/plugins/agent/index.ts +0 -20
  104. package/plugins/agent/memory.ts +0 -24
  105. package/plugins/agent/model.ts +0 -94
  106. package/plugins/agent/package.json +0 -41
  107. package/plugins/agent/plugin.json +0 -13
  108. package/plugins/agent/tools.ts +0 -67
  109. package/plugins/agent-panel/LICENSE +0 -21
  110. package/plugins/agent-panel/client/describe.ts +0 -101
  111. package/plugins/agent-panel/client/driver-pick.ts +0 -22
  112. package/plugins/agent-panel/client/frame.ts +0 -51
  113. package/plugins/agent-panel/client/main.ts +0 -707
  114. package/plugins/agent-panel/client/markdown.ts +0 -219
  115. package/plugins/agent-panel/headless.ts +0 -220
  116. package/plugins/agent-panel/index.ts +0 -523
  117. package/plugins/agent-panel/launch.ts +0 -67
  118. package/plugins/agent-panel/mount.ts +0 -27
  119. package/plugins/agent-panel/package.json +0 -69
  120. package/plugins/agent-panel/plugin.json +0 -28
  121. package/plugins/agent-panel/registry.ts +0 -17
  122. package/plugins/agent-panel/visitors.ts +0 -231
  123. package/plugins/app-settings/LICENSE +0 -21
  124. package/plugins/app-settings/index.ts +0 -270
  125. package/plugins/app-settings/merge.ts +0 -79
  126. package/plugins/app-settings/package.json +0 -45
  127. package/plugins/app-settings/plugin.json +0 -16
  128. package/plugins/builder/LICENSE +0 -21
  129. package/plugins/builder/index.ts +0 -171
  130. package/plugins/builder/package.json +0 -52
  131. package/plugins/builder/plugin.json +0 -17
  132. package/plugins/builder/script.ts +0 -158
  133. package/plugins/db/LICENSE +0 -47
  134. package/plugins/db/package.json +0 -67
  135. package/plugins/db/plugin.json +0 -25
  136. package/plugins/db/src/conformance.ts +0 -224
  137. package/plugins/db/src/cordis.ts +0 -13
  138. package/plugins/db/src/facade/database.ts +0 -41
  139. package/plugins/db/src/facade/migrations.ts +0 -50
  140. package/plugins/db/src/facade/schema.ts +0 -9
  141. package/plugins/db/src/index.ts +0 -19
  142. package/plugins/db/src/migration-files.ts +0 -31
  143. package/plugins/db-sqlite/LICENSE +0 -47
  144. package/plugins/db-sqlite/package.json +0 -89
  145. package/plugins/db-sqlite/plugin.json +0 -29
  146. package/plugins/db-sqlite/src/facade/node.ts +0 -199
  147. package/plugins/db-sqlite/src/index.ts +0 -95
  148. package/plugins/db-sqlite/src/open.ts +0 -61
  149. package/plugins/desktop-shell/LICENSE +0 -21
  150. package/plugins/desktop-shell/app-page.ts +0 -151
  151. package/plugins/desktop-shell/app-root.ts +0 -19
  152. package/plugins/desktop-shell/assets/acrylblends-logo.png +0 -0
  153. package/plugins/desktop-shell/attach.ts +0 -72
  154. package/plugins/desktop-shell/bin.ts +0 -5
  155. package/plugins/desktop-shell/brand.ts +0 -166
  156. package/plugins/desktop-shell/door-shell.ts +0 -385
  157. package/plugins/desktop-shell/frame.ts +0 -317
  158. package/plugins/desktop-shell/git.ts +0 -44
  159. package/plugins/desktop-shell/host-supervisor.ts +0 -63
  160. package/plugins/desktop-shell/launch.ts +0 -106
  161. package/plugins/desktop-shell/main.ts +0 -545
  162. package/plugins/desktop-shell/menu.ts +0 -60
  163. package/plugins/desktop-shell/package.json +0 -58
  164. package/plugins/desktop-shell/plugin.json +0 -20
  165. package/plugins/desktop-shell/preload.cjs +0 -8
  166. package/plugins/desktop-shell/product.ts +0 -164
  167. package/plugins/desktop-shell/shutdown.ts +0 -177
  168. package/plugins/desktop-shell/update-menu.ts +0 -126
  169. package/plugins/desktop-shell/updater.ts +0 -228
  170. package/plugins/desktop-shell/user-data.ts +0 -38
  171. package/plugins/desktop-shell/watch-host.d.mts +0 -10
  172. package/plugins/desktop-shell/watch-host.mjs +0 -130
  173. package/plugins/desktop-shell/window.ts +0 -119
  174. package/plugins/desktop-web/LICENSE +0 -21
  175. package/plugins/desktop-web/app-root.ts +0 -12
  176. package/plugins/desktop-web/launch.ts +0 -54
  177. package/plugins/desktop-web/main.ts +0 -108
  178. package/plugins/desktop-web/package.json +0 -49
  179. package/plugins/desktop-web/plugin.json +0 -21
  180. package/plugins/desktop-web/shutdown.ts +0 -177
  181. package/plugins/desktop-web/user-data.ts +0 -38
  182. package/plugins/desktop-web/window.ts +0 -29
  183. package/plugins/door/LICENSE +0 -47
  184. package/plugins/door/package.json +0 -116
  185. package/plugins/door/plugin.json +0 -39
  186. package/plugins/door/src/cli/acryl.ts +0 -335
  187. package/plugins/door/src/host/api.ts +0 -9
  188. package/plugins/door/src/host/audit.ts +0 -64
  189. package/plugins/door/src/host/channel.ts +0 -407
  190. package/plugins/door/src/host/chat-tools.ts +0 -76
  191. package/plugins/door/src/host/door-file.ts +0 -99
  192. package/plugins/door/src/host/door.ts +0 -492
  193. package/plugins/door/src/host/http.ts +0 -80
  194. package/plugins/door/src/host/mcp-routes.ts +0 -83
  195. package/plugins/door/src/host/operator-routes.ts +0 -58
  196. package/plugins/door/src/host/page-routes.ts +0 -69
  197. package/plugins/door/src/host/page-socket.ts +0 -88
  198. package/plugins/door/src/host/shell.ts +0 -147
  199. package/plugins/door/src/host/shim.ts +0 -125
  200. package/plugins/door/src/host/verbs.ts +0 -160
  201. package/plugins/door/src/index.ts +0 -337
  202. package/plugins/door/src/page/api.ts +0 -9
  203. package/plugins/door/src/page/base.ts +0 -32
  204. package/plugins/door/src/page/channel.ts +0 -209
  205. package/plugins/door/src/page/driver/accessibility.ts +0 -177
  206. package/plugins/door/src/page/driver/actions.ts +0 -207
  207. package/plugins/door/src/page/driver/driver.ts +0 -216
  208. package/plugins/door/src/page/driver/ref-table.ts +0 -78
  209. package/plugins/door/src/page/driver/sensitivity.ts +0 -85
  210. package/plugins/door/src/page/driver/snapshot.ts +0 -135
  211. package/plugins/door/src/page/index.ts +0 -100
  212. package/plugins/door/src/page/indicator.ts +0 -80
  213. package/plugins/door/src/page/main.ts +0 -7
  214. package/plugins/door/src/page/outline.ts +0 -56
  215. package/plugins/door/src/page/protocol.ts +0 -233
  216. package/plugins/door/src/page/snapshot-text.ts +0 -19
  217. package/plugins/door/src/page/socket-source.ts +0 -75
  218. package/plugins/door/src/page/user-input.ts +0 -24
  219. package/plugins/door/src/shell/protocol.ts +0 -133
  220. package/plugins/driver-acp/LICENSE +0 -21
  221. package/plugins/driver-acp/README.md +0 -53
  222. package/plugins/driver-acp/chat.ts +0 -258
  223. package/plugins/driver-acp/connection.ts +0 -239
  224. package/plugins/driver-acp/index.ts +0 -67
  225. package/plugins/driver-acp/package.json +0 -52
  226. package/plugins/driver-acp/plugin.json +0 -15
  227. package/plugins/driver-acp/provenance.json +0 -20
  228. package/plugins/driver-pty/LICENSE +0 -21
  229. package/plugins/driver-pty/client/terminal.ts +0 -191
  230. package/plugins/driver-pty/client/vendor/LICENSE +0 -21
  231. package/plugins/driver-pty/client/vendor/LICENSE-addon-fit +0 -19
  232. package/plugins/driver-pty/client/vendor/VERSION +0 -4
  233. package/plugins/driver-pty/client/vendor/addon-fit.d.mts +0 -6
  234. package/plugins/driver-pty/client/vendor/addon-fit.mjs +0 -18
  235. package/plugins/driver-pty/client/vendor/xterm-css.d.mts +0 -2
  236. package/plugins/driver-pty/client/vendor/xterm-css.mjs +0 -2
  237. package/plugins/driver-pty/client/vendor/xterm.d.mts +0 -17
  238. package/plugins/driver-pty/client/vendor/xterm.mjs +0 -53
  239. package/plugins/driver-pty/index.ts +0 -280
  240. package/plugins/driver-pty/package.json +0 -55
  241. package/plugins/driver-pty/plugin.json +0 -16
  242. package/plugins/driver-pty/spawn.ts +0 -74
  243. package/plugins/driver-pty/terminal.ts +0 -86
  244. package/plugins/drivers/LICENSE +0 -21
  245. package/plugins/drivers/index.ts +0 -75
  246. package/plugins/drivers/package.json +0 -37
  247. package/plugins/drivers/plugin.json +0 -11
  248. package/plugins/extensions/LICENSE +0 -21
  249. package/plugins/extensions/browser.ts +0 -100
  250. package/plugins/extensions/index.ts +0 -991
  251. package/plugins/extensions/ledger.ts +0 -39
  252. package/plugins/extensions/package.json +0 -48
  253. package/plugins/extensions/plugin-store.ts +0 -27
  254. package/plugins/extensions/plugin.json +0 -15
  255. package/plugins/extensions/resolve.ts +0 -169
  256. package/plugins/extensions/routes.ts +0 -92
  257. package/plugins/extensions/stage.ts +0 -82
  258. package/plugins/feedback/LICENSE +0 -21
  259. package/plugins/feedback/client.d.ts +0 -22
  260. package/plugins/feedback/client.js +0 -471
  261. package/plugins/feedback/index.ts +0 -143
  262. package/plugins/feedback/package.json +0 -44
  263. package/plugins/feedback/plugin.json +0 -14
  264. package/plugins/feedback/store.ts +0 -307
  265. package/plugins/home/LICENSE +0 -21
  266. package/plugins/home/index.ts +0 -124
  267. package/plugins/home/package.json +0 -41
  268. package/plugins/home/plugin.json +0 -14
  269. package/plugins/inspect/LICENSE +0 -21
  270. package/plugins/inspect/package.json +0 -84
  271. package/plugins/inspect/plugin.json +0 -24
  272. package/plugins/inspect/src/index.ts +0 -3
  273. package/plugins/inspect/src/report.ts +0 -131
  274. package/plugins/inspect/src/service.ts +0 -68
  275. package/plugins/instance/LICENSE +0 -21
  276. package/plugins/instance/archive.ts +0 -395
  277. package/plugins/instance/bundle-overlay.ts +0 -10
  278. package/plugins/instance/bundle.ts +0 -230
  279. package/plugins/instance/home.ts +0 -395
  280. package/plugins/instance/index.ts +0 -284
  281. package/plugins/instance/package.json +0 -61
  282. package/plugins/instance/plugin.json +0 -16
  283. package/plugins/instance/storage.ts +0 -463
  284. package/plugins/kv/LICENSE +0 -47
  285. package/plugins/kv/package.json +0 -67
  286. package/plugins/kv/plugin.json +0 -26
  287. package/plugins/kv/src/check.ts +0 -58
  288. package/plugins/kv/src/conformance.ts +0 -226
  289. package/plugins/kv/src/copy.ts +0 -39
  290. package/plugins/kv/src/cordis.ts +0 -13
  291. package/plugins/kv/src/index.ts +0 -14
  292. package/plugins/kv/src/kv.ts +0 -37
  293. package/plugins/kv-db/LICENSE +0 -47
  294. package/plugins/kv-db/package.json +0 -91
  295. package/plugins/kv-db/plugin.json +0 -31
  296. package/plugins/kv-db/src/index.ts +0 -37
  297. package/plugins/kv-db/src/open.ts +0 -80
  298. package/plugins/kv-json/LICENSE +0 -47
  299. package/plugins/kv-json/package.json +0 -89
  300. package/plugins/kv-json/plugin.json +0 -29
  301. package/plugins/kv-json/src/index.ts +0 -78
  302. package/plugins/kv-json/src/open.ts +0 -249
  303. package/plugins/manifest/LICENSE +0 -21
  304. package/plugins/manifest/app-plugins.ts +0 -86
  305. package/plugins/manifest/index.ts +0 -645
  306. package/plugins/manifest/lock.ts +0 -115
  307. package/plugins/manifest/package.json +0 -57
  308. package/plugins/manifest/plugin.json +0 -19
  309. package/plugins/manifest/snapshot.ts +0 -275
  310. package/plugins/manifest/upgrade-cli.ts +0 -70
  311. package/plugins/manifest/upgrade.ts +0 -97
  312. package/plugins/node-server/LICENSE +0 -47
  313. package/plugins/node-server/package.json +0 -94
  314. package/plugins/node-server/plugin.json +0 -32
  315. package/plugins/node-server/src/adapter/conninfo.ts +0 -23
  316. package/plugins/node-server/src/adapter/early-hints.ts +0 -55
  317. package/plugins/node-server/src/adapter/error.ts +0 -11
  318. package/plugins/node-server/src/adapter/headers.ts +0 -249
  319. package/plugins/node-server/src/adapter/index.ts +0 -6
  320. package/plugins/node-server/src/adapter/listener.ts +0 -549
  321. package/plugins/node-server/src/adapter/raw.ts +0 -18
  322. package/plugins/node-server/src/adapter/request.ts +0 -798
  323. package/plugins/node-server/src/adapter/response.ts +0 -186
  324. package/plugins/node-server/src/adapter/serve-static.ts +0 -238
  325. package/plugins/node-server/src/adapter/server.ts +0 -59
  326. package/plugins/node-server/src/adapter/types.ts +0 -94
  327. package/plugins/node-server/src/adapter/url.ts +0 -42
  328. package/plugins/node-server/src/adapter/utils/response/constants.ts +0 -1
  329. package/plugins/node-server/src/adapter/utils/response.ts +0 -4
  330. package/plugins/node-server/src/adapter/utils/stream.ts +0 -88
  331. package/plugins/node-server/src/adapter/utils.ts +0 -96
  332. package/plugins/node-server/src/adapter/websocket-types.ts +0 -49
  333. package/plugins/node-server/src/adapter/websocket.ts +0 -409
  334. package/plugins/node-server/src/client-modules.ts +0 -300
  335. package/plugins/node-server/src/index.ts +0 -440
  336. package/plugins/node-server/src/register.ts +0 -65
  337. package/plugins/node-server/src/test-websocket.ts +0 -110
  338. package/plugins/node-server/src/transpile.ts +0 -139
  339. package/plugins/node-server/src/upgrade-hub.ts +0 -152
  340. package/plugins/openai/LICENSE +0 -21
  341. package/plugins/openai/index.ts +0 -218
  342. package/plugins/openai/package.json +0 -43
  343. package/plugins/openai/plugin.json +0 -14
  344. package/plugins/openai/prompt.ts +0 -60
  345. package/plugins/page/package.json +0 -51
  346. package/plugins/page/plugin.json +0 -16
  347. package/plugins/page/src/favicon.ts +0 -19
  348. package/plugins/page/src/index.ts +0 -168
  349. package/plugins/plugin-share/LICENSE +0 -21
  350. package/plugins/plugin-share/README.md +0 -86
  351. package/plugins/plugin-share/index.ts +0 -791
  352. package/plugins/plugin-share/native.ts +0 -290
  353. package/plugins/plugin-share/package.json +0 -54
  354. package/plugins/plugin-share/package.ts +0 -186
  355. package/plugins/plugin-share/plugin.json +0 -19
  356. package/plugins/plugin-share/publish.ts +0 -79
  357. package/plugins/plugin-share/pull-check.ts +0 -142
  358. package/plugins/plugin-share/pull-list.ts +0 -71
  359. package/plugins/plugin-share/pulled-records.ts +0 -70
  360. package/plugins/router/LICENSE +0 -47
  361. package/plugins/router/package.json +0 -118
  362. package/plugins/router/plugin.json +0 -31
  363. package/plugins/router/src/browser/client.ts +0 -3
  364. package/plugins/router/src/browser/jsx-dom.ts +0 -9
  365. package/plugins/router/src/browser/read-sse.ts +0 -3
  366. package/plugins/router/src/client.ts +0 -2
  367. package/plugins/router/src/connection.ts +0 -42
  368. package/plugins/router/src/core/adapter/aws-lambda/conninfo.ts +0 -73
  369. package/plugins/router/src/core/adapter/aws-lambda/handler.ts +0 -682
  370. package/plugins/router/src/core/adapter/aws-lambda/index.ts +0 -14
  371. package/plugins/router/src/core/adapter/aws-lambda/types.ts +0 -173
  372. package/plugins/router/src/core/adapter/bun/conninfo.ts +0 -43
  373. package/plugins/router/src/core/adapter/bun/index.ts +0 -11
  374. package/plugins/router/src/core/adapter/bun/serve-static.ts +0 -32
  375. package/plugins/router/src/core/adapter/bun/server.ts +0 -14
  376. package/plugins/router/src/core/adapter/bun/ssg.ts +0 -26
  377. package/plugins/router/src/core/adapter/bun/websocket.ts +0 -113
  378. package/plugins/router/src/core/adapter/cloudflare-pages/conninfo.ts +0 -26
  379. package/plugins/router/src/core/adapter/cloudflare-pages/handler.ts +0 -122
  380. package/plugins/router/src/core/adapter/cloudflare-pages/index.ts +0 -11
  381. package/plugins/router/src/core/adapter/cloudflare-workers/conninfo.ts +0 -7
  382. package/plugins/router/src/core/adapter/cloudflare-workers/index.ts +0 -8
  383. package/plugins/router/src/core/adapter/cloudflare-workers/serve-static-module.ts +0 -12
  384. package/plugins/router/src/core/adapter/cloudflare-workers/serve-static.ts +0 -41
  385. package/plugins/router/src/core/adapter/cloudflare-workers/utils.ts +0 -50
  386. package/plugins/router/src/core/adapter/cloudflare-workers/websocket.ts +0 -52
  387. package/plugins/router/src/core/adapter/lambda-edge/conninfo.ts +0 -15
  388. package/plugins/router/src/core/adapter/lambda-edge/handler.ts +0 -239
  389. package/plugins/router/src/core/adapter/lambda-edge/index.ts +0 -14
  390. package/plugins/router/src/core/adapter/netlify/conninfo.ts +0 -57
  391. package/plugins/router/src/core/adapter/netlify/handler.ts +0 -10
  392. package/plugins/router/src/core/adapter/netlify/index.ts +0 -6
  393. package/plugins/router/src/core/adapter/netlify/mod.ts +0 -2
  394. package/plugins/router/src/core/adapter/service-worker/handler.ts +0 -37
  395. package/plugins/router/src/core/adapter/service-worker/index.ts +0 -36
  396. package/plugins/router/src/core/adapter/service-worker/types.ts +0 -14
  397. package/plugins/router/src/core/adapter/vercel/conninfo.ts +0 -8
  398. package/plugins/router/src/core/adapter/vercel/handler.ts +0 -8
  399. package/plugins/router/src/core/adapter/vercel/index.ts +0 -7
  400. package/plugins/router/src/core/app-base.ts +0 -544
  401. package/plugins/router/src/core/app.ts +0 -34
  402. package/plugins/router/src/core/client/client.ts +0 -249
  403. package/plugins/router/src/core/client/fetch-result-please.ts +0 -95
  404. package/plugins/router/src/core/client/index.ts +0 -17
  405. package/plugins/router/src/core/client/types.ts +0 -393
  406. package/plugins/router/src/core/client/utils.ts +0 -117
  407. package/plugins/router/src/core/compose.ts +0 -73
  408. package/plugins/router/src/core/context.ts +0 -781
  409. package/plugins/router/src/core/helper/accepts/accepts.ts +0 -96
  410. package/plugins/router/src/core/helper/accepts/index.ts +0 -6
  411. package/plugins/router/src/core/helper/adapter/index.ts +0 -90
  412. package/plugins/router/src/core/helper/conninfo/index.ts +0 -6
  413. package/plugins/router/src/core/helper/conninfo/types.ts +0 -45
  414. package/plugins/router/src/core/helper/cookie/index.ts +0 -146
  415. package/plugins/router/src/core/helper/css/common.ts +0 -337
  416. package/plugins/router/src/core/helper/css/index.ts +0 -262
  417. package/plugins/router/src/core/helper/dev/index.ts +0 -79
  418. package/plugins/router/src/core/helper/factory/index.ts +0 -375
  419. package/plugins/router/src/core/helper/html/index.ts +0 -57
  420. package/plugins/router/src/core/helper/proxy/index.ts +0 -203
  421. package/plugins/router/src/core/helper/route/index.ts +0 -144
  422. package/plugins/router/src/core/helper/ssg/index.ts +0 -14
  423. package/plugins/router/src/core/helper/ssg/middleware.ts +0 -83
  424. package/plugins/router/src/core/helper/ssg/plugins.ts +0 -72
  425. package/plugins/router/src/core/helper/ssg/ssg.ts +0 -471
  426. package/plugins/router/src/core/helper/ssg/utils.ts +0 -118
  427. package/plugins/router/src/core/helper/streaming/index.ts +0 -9
  428. package/plugins/router/src/core/helper/streaming/sse.ts +0 -101
  429. package/plugins/router/src/core/helper/streaming/stream.ts +0 -45
  430. package/plugins/router/src/core/helper/streaming/text.ts +0 -15
  431. package/plugins/router/src/core/helper/streaming/utils.ts +0 -11
  432. package/plugins/router/src/core/helper/testing/index.ts +0 -28
  433. package/plugins/router/src/core/helper/websocket/index.ts +0 -146
  434. package/plugins/router/src/core/http-exception.ts +0 -77
  435. package/plugins/router/src/core/index.ts +0 -53
  436. package/plugins/router/src/core/jsx/base.ts +0 -490
  437. package/plugins/router/src/core/jsx/children.ts +0 -20
  438. package/plugins/router/src/core/jsx/components.ts +0 -257
  439. package/plugins/router/src/core/jsx/constants.ts +0 -6
  440. package/plugins/router/src/core/jsx/context.ts +0 -266
  441. package/plugins/router/src/core/jsx/dom/client.ts +0 -89
  442. package/plugins/router/src/core/jsx/dom/components.ts +0 -39
  443. package/plugins/router/src/core/jsx/dom/context.ts +0 -52
  444. package/plugins/router/src/core/jsx/dom/css.ts +0 -263
  445. package/plugins/router/src/core/jsx/dom/hooks/index.ts +0 -91
  446. package/plugins/router/src/core/jsx/dom/index.ts +0 -170
  447. package/plugins/router/src/core/jsx/dom/intrinsic-element/components.ts +0 -438
  448. package/plugins/router/src/core/jsx/dom/jsx-dev-runtime.ts +0 -23
  449. package/plugins/router/src/core/jsx/dom/jsx-runtime.ts +0 -8
  450. package/plugins/router/src/core/jsx/dom/render.ts +0 -879
  451. package/plugins/router/src/core/jsx/dom/server.ts +0 -76
  452. package/plugins/router/src/core/jsx/dom/utils.ts +0 -7
  453. package/plugins/router/src/core/jsx/hooks/index.ts +0 -437
  454. package/plugins/router/src/core/jsx/index.ts +0 -115
  455. package/plugins/router/src/core/jsx/intrinsic-element/common.ts +0 -23
  456. package/plugins/router/src/core/jsx/intrinsic-element/components.ts +0 -210
  457. package/plugins/router/src/core/jsx/intrinsic-elements.ts +0 -938
  458. package/plugins/router/src/core/jsx/jsx-dev-runtime.ts +0 -26
  459. package/plugins/router/src/core/jsx/jsx-runtime.ts +0 -51
  460. package/plugins/router/src/core/jsx/streaming.ts +0 -231
  461. package/plugins/router/src/core/jsx/types.ts +0 -41
  462. package/plugins/router/src/core/jsx/utils.ts +0 -202
  463. package/plugins/router/src/core/middleware/basic-auth/index.ts +0 -152
  464. package/plugins/router/src/core/middleware/bearer-auth/index.ts +0 -220
  465. package/plugins/router/src/core/middleware/body-limit/index.ts +0 -110
  466. package/plugins/router/src/core/middleware/cache/index.ts +0 -323
  467. package/plugins/router/src/core/middleware/combine/index.ts +0 -171
  468. package/plugins/router/src/core/middleware/compress/index.ts +0 -142
  469. package/plugins/router/src/core/middleware/context-storage/index.ts +0 -58
  470. package/plugins/router/src/core/middleware/cors/index.ts +0 -163
  471. package/plugins/router/src/core/middleware/csrf/index.ts +0 -150
  472. package/plugins/router/src/core/middleware/etag/digest.ts +0 -95
  473. package/plugins/router/src/core/middleware/etag/index.ts +0 -135
  474. package/plugins/router/src/core/middleware/ip-restriction/index.ts +0 -278
  475. package/plugins/router/src/core/middleware/jsx-renderer/index.ts +0 -162
  476. package/plugins/router/src/core/middleware/jwk/index.ts +0 -1
  477. package/plugins/router/src/core/middleware/jwk/jwk.ts +0 -196
  478. package/plugins/router/src/core/middleware/jwt/index.ts +0 -9
  479. package/plugins/router/src/core/middleware/jwt/jwt.ts +0 -190
  480. package/plugins/router/src/core/middleware/language/index.ts +0 -12
  481. package/plugins/router/src/core/middleware/language/language.ts +0 -314
  482. package/plugins/router/src/core/middleware/logger/index.ts +0 -95
  483. package/plugins/router/src/core/middleware/method-not-allowed/index.ts +0 -141
  484. package/plugins/router/src/core/middleware/method-override/index.ts +0 -147
  485. package/plugins/router/src/core/middleware/mount/index.ts +0 -108
  486. package/plugins/router/src/core/middleware/powered-by/index.ts +0 -35
  487. package/plugins/router/src/core/middleware/pretty-json/index.ts +0 -67
  488. package/plugins/router/src/core/middleware/request-id/index.ts +0 -7
  489. package/plugins/router/src/core/middleware/request-id/request-id.ts +0 -59
  490. package/plugins/router/src/core/middleware/secure-headers/index.ts +0 -8
  491. package/plugins/router/src/core/middleware/secure-headers/permissions-policy.ts +0 -101
  492. package/plugins/router/src/core/middleware/secure-headers/secure-headers.ts +0 -340
  493. package/plugins/router/src/core/middleware/serve-static/index.ts +0 -135
  494. package/plugins/router/src/core/middleware/serve-static/path.ts +0 -25
  495. package/plugins/router/src/core/middleware/timeout/index.ts +0 -58
  496. package/plugins/router/src/core/middleware/timing/index.ts +0 -8
  497. package/plugins/router/src/core/middleware/timing/timing.ts +0 -256
  498. package/plugins/router/src/core/middleware/trailing-slash/index.ts +0 -156
  499. package/plugins/router/src/core/preset/quick.ts +0 -24
  500. package/plugins/router/src/core/preset/tiny.ts +0 -20
  501. package/plugins/router/src/core/request/constants.ts +0 -1
  502. package/plugins/router/src/core/request.ts +0 -502
  503. package/plugins/router/src/core/router/linear-router/index.ts +0 -6
  504. package/plugins/router/src/core/router/linear-router/router.ts +0 -152
  505. package/plugins/router/src/core/router/pattern-router/index.ts +0 -6
  506. package/plugins/router/src/core/router/pattern-router/router.ts +0 -54
  507. package/plugins/router/src/core/router/reg-exp-router/index.ts +0 -7
  508. package/plugins/router/src/core/router/reg-exp-router/matcher.ts +0 -33
  509. package/plugins/router/src/core/router/reg-exp-router/node.ts +0 -170
  510. package/plugins/router/src/core/router/reg-exp-router/prepared-router.ts +0 -165
  511. package/plugins/router/src/core/router/reg-exp-router/router.ts +0 -174
  512. package/plugins/router/src/core/router/reg-exp-router/trie.ts +0 -84
  513. package/plugins/router/src/core/router/smart-router/index.ts +0 -6
  514. package/plugins/router/src/core/router/smart-router/router.ts +0 -70
  515. package/plugins/router/src/core/router/trie-router/index.ts +0 -6
  516. package/plugins/router/src/core/router/trie-router/node.ts +0 -221
  517. package/plugins/router/src/core/router/trie-router/router.ts +0 -18
  518. package/plugins/router/src/core/router/utils.ts +0 -1
  519. package/plugins/router/src/core/router.ts +0 -103
  520. package/plugins/router/src/core/types.ts +0 -2782
  521. package/plugins/router/src/core/utils/accept.ts +0 -268
  522. package/plugins/router/src/core/utils/basic-auth.ts +0 -26
  523. package/plugins/router/src/core/utils/body.ts +0 -263
  524. package/plugins/router/src/core/utils/buffer.ts +0 -117
  525. package/plugins/router/src/core/utils/color.ts +0 -56
  526. package/plugins/router/src/core/utils/compress.ts +0 -10
  527. package/plugins/router/src/core/utils/concurrent.ts +0 -55
  528. package/plugins/router/src/core/utils/constants.ts +0 -4
  529. package/plugins/router/src/core/utils/cookie.ts +0 -281
  530. package/plugins/router/src/core/utils/crypto.ts +0 -58
  531. package/plugins/router/src/core/utils/encode.ts +0 -34
  532. package/plugins/router/src/core/utils/filepath.ts +0 -60
  533. package/plugins/router/src/core/utils/handler.ts +0 -15
  534. package/plugins/router/src/core/utils/headers.ts +0 -355
  535. package/plugins/router/src/core/utils/html.ts +0 -182
  536. package/plugins/router/src/core/utils/http-status.ts +0 -72
  537. package/plugins/router/src/core/utils/ipaddr.ts +0 -374
  538. package/plugins/router/src/core/utils/jwt/index.ts +0 -7
  539. package/plugins/router/src/core/utils/jwt/jwa.ts +0 -38
  540. package/plugins/router/src/core/utils/jwt/jws.ts +0 -235
  541. package/plugins/router/src/core/utils/jwt/jwt.ts +0 -292
  542. package/plugins/router/src/core/utils/jwt/types.ts +0 -157
  543. package/plugins/router/src/core/utils/jwt/utf8.ts +0 -7
  544. package/plugins/router/src/core/utils/mime.ts +0 -94
  545. package/plugins/router/src/core/utils/stream.ts +0 -107
  546. package/plugins/router/src/core/utils/types.ts +0 -174
  547. package/plugins/router/src/core/utils/url.ts +0 -337
  548. package/plugins/router/src/core/validator/index.ts +0 -8
  549. package/plugins/router/src/core/validator/utils.ts +0 -69
  550. package/plugins/router/src/core/validator/validator.ts +0 -185
  551. package/plugins/router/src/helpers/index.ts +0 -17
  552. package/plugins/router/src/helpers/read-sse.ts +0 -111
  553. package/plugins/router/src/helpers/schema-validator.ts +0 -62
  554. package/plugins/router/src/index.ts +0 -6
  555. package/plugins/router/src/middleware/index.ts +0 -28
  556. package/plugins/router/src/middleware/loopback-only.ts +0 -183
  557. package/plugins/router/src/service.ts +0 -477
  558. package/plugins/router-http/LICENSE +0 -21
  559. package/plugins/router-http/package.json +0 -87
  560. package/plugins/router-http/plugin.json +0 -23
  561. package/plugins/router-http/src/bridge.ts +0 -54
  562. package/plugins/router-http/src/index.ts +0 -141
  563. package/plugins/router-http/src/serve.ts +0 -55
  564. package/plugins/sandbox/LICENSE +0 -21
  565. package/plugins/sandbox/index.ts +0 -150
  566. package/plugins/sandbox/package.json +0 -41
  567. package/plugins/sandbox/plugin.json +0 -13
  568. package/plugins/sandbox/runner.mjs +0 -18
  569. package/plugins/save/LICENSE +0 -21
  570. package/plugins/save/cli.ts +0 -19
  571. package/plugins/save/index.ts +0 -55
  572. package/plugins/save/package.json +0 -43
  573. package/plugins/save/plugin.json +0 -15
  574. package/plugins/save/share-cli.ts +0 -95
  575. package/plugins/save/share.ts +0 -193
  576. package/plugins/showcase/LICENSE +0 -21
  577. package/plugins/showcase/cards.ts +0 -162
  578. package/plugins/showcase/index.ts +0 -117
  579. package/plugins/showcase/package.json +0 -49
  580. package/plugins/showcase/plugin.json +0 -14
  581. package/plugins/state/LICENSE +0 -21
  582. package/plugins/state/package.json +0 -104
  583. package/plugins/state/plugin.json +0 -27
  584. package/plugins/state/src/cell.ts +0 -67
  585. package/plugins/state/src/client-source.ts +0 -244
  586. package/plugins/state/src/index.ts +0 -3
  587. package/plugins/state/src/service.ts +0 -146
  588. package/plugins/state/src/socket.ts +0 -96
  589. package/plugins/tasks/LICENSE +0 -21
  590. package/plugins/tasks/index.ts +0 -246
  591. package/plugins/tasks/package.json +0 -45
  592. package/plugins/tasks/plugin.json +0 -14
  593. package/plugins/tasks/store.ts +0 -86
  594. package/plugins/web-server/package.json +0 -52
  595. package/plugins/web-server/plugin.json +0 -20
  596. package/plugins/web-server/src/index.ts +0 -164
@@ -1,230 +0,0 @@
1
- /**
2
- * The Program and the person's source as one app tree (specs/049-framework-architecture/app-storage.md in ACRYL, slice 3). A desktop product ships the
3
- * Program in its bundle, read-only and replaced by every update: the framework's plugins, the generated host and the frame's packages. An app's
4
- * `source` holds only what is the person's. Their files still name the framework the way every app does (`../plugins/router/src/index.ts`,
5
- * `acrylblends`), so the module resolver serves the tree from both places: a Program path from the bundle, anything else from the source.
6
- *
7
- * Framework packages resolve from the bundle FIRST, for any importer outside it: a package the person added that carries its own `acrylblends` or
8
- * `@deepseek-ai/cordis` still gets the bundle's, because two framework copies in one process break it (the `matchedRoutes` 500). Any other package
9
- * resolves as Node resolves it, from the source's own `node_modules` (what the person added), with the bundle's as the fallback.
10
- *
11
- * `NODE_PATH` does not reach ESM; the seam is `registerHooks`, which covers `import`, `require` and (from Node 24, the frame host's Electron Node) `require.resolve` alike. `bundle-overlay.ts`
12
- * registers it, first, in a product's frame host. Pure apart from `readProduct`.
13
- */
14
- import { readFileSync, realpathSync } from 'node:fs'
15
- import { createRequire, type registerHooks } from 'node:module'
16
- import { join } from 'node:path'
17
- import { pathToFileURL } from 'node:url'
18
- import { ROOT_ENV } from './index.ts'
19
-
20
- /** The product marker at the bundle root: which product it is, its first app's name, and which paths of the app tree are the Program. */
21
- export interface Product {
22
- /** The product's name: its root folder in the OS per-user data folder (`ACRYL Blends`). */
23
- readonly product: string
24
- /** The name the first app gets, until the person names it (`Blank`). */
25
- readonly appName: string
26
- /** The Program's paths in the app tree, `/`-separated and relative; a folder ends in `/` (`node_modules/`, `plugins/router/`, `cordis.yml`). */
27
- readonly program: readonly string[]
28
- /**
29
- * A folder of the bundle that holds the Blend this product is: its first app is made from it (the person's part of it) instead of from the bundle itself.
30
- * `/`-separated, relative, no `.` or `..` segment. Absent in a product that ships the starting app as its own tree (the Blank product).
31
- */
32
- readonly seed?: string
33
- /** The first app's name is the product's own, final (a finished Blend: ACRYL Control Center, ACRYL ADE): the first start does not ask for one. Absent in the Blank product. */
34
- readonly named?: true
35
- /**
36
- * Which build of the product this is (the packer writes the Blend's commit). A named product's app is a finished Blend, not the person's work: when its
37
- * source was made from another build, the next start copies this build's files over it (`openProductApp`), so an update reaches the screen.
38
- */
39
- readonly build?: string
40
- /** Where newer builds are published (the packer reads the Blend's GitHub remote): the app offers them in place (plugins/desktop-shell/updater.ts). */
41
- readonly releases?: { readonly repo: string; readonly file: string; readonly tagPrefix?: string }
42
- }
43
-
44
- export const PRODUCT_FILE = 'product.json'
45
-
46
- /** The product marker at `bundle`, or undefined for an app made with `acrylblends init`. One reader for the file: the desktop shell and the resolver. */
47
- export function readProduct(bundle: string): Product | undefined {
48
- try {
49
- const value: unknown = JSON.parse(readFileSync(join(bundle, PRODUCT_FILE), 'utf8'))
50
- if (value === null || typeof value !== 'object') return undefined
51
- const { product, appName, program, seed, named, build, releases } = value as {
52
- product?: unknown
53
- appName?: unknown
54
- program?: unknown
55
- seed?: unknown
56
- named?: unknown
57
- build?: unknown
58
- releases?: { repo?: unknown; file?: unknown; tagPrefix?: unknown }
59
- }
60
- if (typeof product !== 'string' || product.trim() === '') return undefined
61
- return {
62
- product: product.trim(),
63
- appName:
64
- typeof appName === 'string' && appName.trim() !== '' ? appName.trim() : product.trim(),
65
- program: Array.isArray(program)
66
- ? program.filter((path): path is string => isProgramPath(path))
67
- : [],
68
- ...(isProgramPath(seed) ? { seed: seed.replace(/\/$/u, '') } : {}),
69
- ...(named === true ? { named: true as const } : {}),
70
- ...(typeof build === 'string' && build.trim() !== '' ? { build: build.trim() } : {}),
71
- ...(typeof releases?.repo === 'string' &&
72
- /^[\w.-]+\/[\w.-]+$/u.test(releases.repo) &&
73
- typeof releases.file === 'string' &&
74
- /^[\w.-]+$/u.test(releases.file)
75
- ? {
76
- releases: {
77
- repo: releases.repo,
78
- file: releases.file,
79
- // A repository that releases several products (acryldev/acryl: ade-v*, control-center-v*) names this product's tags by their prefix.
80
- ...(typeof releases.tagPrefix === 'string' && /^[\w.-]+$/u.test(releases.tagPrefix)
81
- ? { tagPrefix: releases.tagPrefix }
82
- : {}),
83
- },
84
- }
85
- : {}),
86
- }
87
- } catch {
88
- return undefined
89
- }
90
- }
91
-
92
- /** A Program path as product.json may name it: relative, `/`-separated, no `.` or `..` segment. Anything else is ignored, never followed. */
93
- function isProgramPath(path: unknown): path is string {
94
- return (
95
- typeof path === 'string' &&
96
- path !== '' &&
97
- !path.startsWith('/') &&
98
- !path.includes('\\') &&
99
- path
100
- .replace(/\/$/u, '')
101
- .split('/')
102
- .every((segment) => segment !== '' && segment !== '.' && segment !== '..')
103
- )
104
- }
105
-
106
- /** Whether a path of the app tree (relative, `/`-separated) is the Program's. */
107
- export function inProgram(program: readonly string[], path: string): boolean {
108
- return program.some((entry) => (entry.endsWith('/') ? path.startsWith(entry) : path === entry))
109
- }
110
-
111
- /**
112
- * The framework's package names: its own (`acrylblends`, the frame's `acryl-*` and `@acryldev/*`, the brand row's `dsh-*`), the engine's
113
- * (`@deepseek-ai/*`), and the shared ones the frame is built from (`@acryldev/*`, `@acryldev/*`). One copy each per process, the bundle's.
114
- */
115
- const FRAMEWORK_PACKAGE =
116
- /^(?:acrylblends(?:\/|$)|acryl-|dsh-|@acryldev\/|@deepseek-ai\/|@acryl\/|@webboxes\/)/u
117
-
118
- export function isFrameworkPackage(specifier: string): boolean {
119
- return FRAMEWORK_PACKAGE.test(specifier)
120
- }
121
-
122
- /** The two halves of one app tree, as `file:` URLs ending in `/`. */
123
- export interface AppTree {
124
- /** The bundle: the Program, read-only. */
125
- readonly bundle: string
126
- /** The app's source: the person's. */
127
- readonly source: string
128
- readonly program: readonly string[]
129
- }
130
-
131
- /** A folder as Node names the modules in it: its real path (macOS's temporary folders sit behind `/var` -> `/private/var`), as a `file:` URL ending in `/`. */
132
- const folderUrl = (path: string): string => {
133
- let real = path
134
- try {
135
- real = realpathSync(path)
136
- } catch {
137
- // A folder that does not exist yet keeps its name: nothing in it can be imported anyway.
138
- }
139
- const href = pathToFileURL(real).href
140
- return href.endsWith('/') ? href : `${href}/`
141
- }
142
-
143
- /** The tree of a product's frame host: the bundle this module sits in, the source `ACRYLBLENDS_ROOT` names. Undefined outside a product. */
144
- export function appTree(
145
- env: Readonly<Record<string, string | undefined>>,
146
- bundle: string,
147
- ): AppTree | undefined {
148
- const root = env[ROOT_ENV]?.trim()
149
- const product = readProduct(bundle)
150
- if (root === undefined || root === '' || product === undefined) return undefined
151
- const tree = { bundle: folderUrl(bundle), source: folderUrl(root), program: product.program }
152
- return tree.bundle === tree.source ? undefined : tree
153
- }
154
-
155
- /** Split a `file:` URL of the tree into its half and its relative path (decoded, `/`-separated), keeping any query or hash for the way back. */
156
- function locate(
157
- url: string,
158
- tree: AppTree,
159
- ): { half: 'bundle' | 'source'; path: string; suffix: string } | undefined {
160
- const cut = url.search(/[?#]/u)
161
- const bare = cut === -1 ? url : url.slice(0, cut)
162
- const suffix = cut === -1 ? '' : url.slice(cut)
163
- for (const half of ['bundle', 'source'] as const) {
164
- const base = tree[half]
165
- if (bare.startsWith(base))
166
- return { half, path: decodeURIComponent(bare.slice(base.length)), suffix }
167
- }
168
- return undefined
169
- }
170
-
171
- /**
172
- * Where a file of the app tree is served from: a Program path from the bundle, any other path from the source (a bundle file importing `../src/app.ts`
173
- * gets the person's). A URL outside the tree is returned as it is.
174
- */
175
- export function servedFrom(url: string, tree: AppTree): string {
176
- const found = locate(url, tree)
177
- if (found === undefined) return url
178
- const half = inProgram(tree.program, found.path) ? 'bundle' : 'source'
179
- if (half === found.half) return url
180
- return `${new URL(found.path.split('/').map(encodeURIComponent).join('/'), tree[half]).href}${found.suffix}`
181
- }
182
-
183
- /** What Node answers when the source has no such package or import: the cases the bundle may serve. Any other failure is the module's own. */
184
- const NOT_THERE = new Set([
185
- 'ERR_MODULE_NOT_FOUND',
186
- 'MODULE_NOT_FOUND',
187
- 'ERR_PACKAGE_IMPORT_NOT_DEFINED',
188
- ])
189
-
190
- const isBare = (specifier: string): boolean =>
191
- !/^(?:\.{1,2}(?:\/|$)|\/|[a-z][a-z0-9+.-]*:)/iu.test(specifier) && !specifier.startsWith('#')
192
-
193
- type Resolve = Parameters<typeof registerHooks>[0]['resolve'] & {}
194
-
195
- /** The resolve hook for one tree (exported for the tests; `installBundleOverlay` registers it). */
196
- export function overlayResolve(tree: AppTree): Resolve {
197
- const fromBundle = `${tree.bundle}package.json`
198
- const bundleRequire = createRequire(fromBundle)
199
- const insideBundle = (parent: string | undefined): boolean =>
200
- parent !== undefined && locate(parent, tree)?.half === 'bundle'
201
- /** A bare name as the bundle resolves it. `import` honours a changed parent; `require` resolves from its caller's own paths, so it is asked of the bundle. */
202
- const resolveInBundle: Resolve = (specifier, context, nextResolve) =>
203
- context.conditions.includes('require')
204
- ? nextResolve(bundleRequire.resolve(specifier), context)
205
- : nextResolve(specifier, { ...context, parentURL: fromBundle })
206
- return (specifier, context, nextResolve) => {
207
- // A package name, or a `#` name of the package's import map (the framework's own, `#acryl-jsx/jsx-runtime`, is the bundle manifest's).
208
- if (isBare(specifier) || specifier.startsWith('#')) {
209
- if (insideBundle(context.parentURL)) return nextResolve(specifier, context)
210
- // The framework: the bundle's copy, whoever imports it.
211
- if (isFrameworkPackage(specifier)) return resolveInBundle(specifier, context, nextResolve)
212
- try {
213
- return nextResolve(specifier, context)
214
- } catch (error) {
215
- // Anything else the person's files use and their source does not have: the bundle's packages and import map serve it.
216
- if (!NOT_THERE.has((error as { code?: string }).code ?? '')) throw error
217
- return resolveInBundle(specifier, context, nextResolve)
218
- }
219
- }
220
- // A path of the tree: the half it belongs to, decided before Node checks that the file exists.
221
- let target: string
222
- try {
223
- target = new URL(specifier, context.parentURL).href
224
- } catch {
225
- return nextResolve(specifier, context)
226
- }
227
- const served = servedFrom(target, tree)
228
- return nextResolve(served === target ? specifier : served, context)
229
- }
230
- }
@@ -1,395 +0,0 @@
1
- /**
2
- * Where an app's data lives, decided in this one file (specs/049-framework-architecture/app-storage.md, task T026).
3
- *
4
- * The root is `~/.acryl` on every OS (`acrylRoot`). An app's data is `~/.acryl/apps/<id>/data/`, whether the app is installed (its source is in
5
- * `apps/<id>/source/`) or is a folder made by `acryl new` (its source is that folder). The id of a folder app is written once into
6
- * `<app>/.acryl/app.json`, which is git-ignored: a moved folder keeps its id and so its data, and a git clone has none, so it gets its own.
7
- *
8
- * Nothing else computes this: the plugin, the generated host and the CLI import it. `scripts/lib/bulkhead.test.mjs` fails when another file does.
9
- * Only `node:` modules are imported here, so the CLI can bundle this file and an app can carry it.
10
- */
11
- import { randomBytes } from 'node:crypto'
12
- import {
13
- cpSync,
14
- existsSync,
15
- lstatSync,
16
- mkdirSync,
17
- readdirSync,
18
- readFileSync,
19
- renameSync,
20
- rmSync,
21
- symlinkSync,
22
- writeFileSync,
23
- } from 'node:fs'
24
- import { homedir } from 'node:os'
25
- import { basename, join, posix, resolve, win32 } from 'node:path'
26
-
27
- export class AppInstanceError extends Error {
28
- override name = 'AppInstanceError'
29
- }
30
-
31
- export const APPS_DIR = 'apps'
32
- /** The app folder's own state (the door's address file, the app id). Git-ignored by every template. */
33
- export const APP_STATE_DIR = '.acryl'
34
- export const APP_ID_FILE = 'app.json'
35
- /** Where an app made before T026 kept its data, beside its code. */
36
- export const OLD_HOME_DIR = '.acrylblends'
37
-
38
- type Env = Readonly<Record<string, string | undefined>>
39
-
40
- /** The person's home folder: the one place the product asks the OS for it. `HOME` (or `USERPROFILE` on Windows) wins, so an isolated run moves it. */
41
- export function personHome(
42
- env: Env = process.env,
43
- platform: NodeJS.Platform = process.platform,
44
- ): string {
45
- const fromEnv = (platform === 'win32' ? env.USERPROFILE : env.HOME)?.trim()
46
- return fromEnv !== undefined && fromEnv !== '' ? fromEnv : homedir()
47
- }
48
-
49
- /** The path module of a platform, so a root computed for Windows on a Mac is a Windows path. */
50
- export const pathOf = (platform: NodeJS.Platform) => (platform === 'win32' ? win32 : posix)
51
-
52
- /**
53
- * The root of everything ACRYL keeps for one person: `<home>/.acryl`, one short, predictable folder on every OS, as DeepSeek Harness keeps `<home>/.dsh`.
54
- * It is deliberately not the OS's application-data folder (Library/Application Support, AppData, .local/share): those differ per OS, hide the work, and
55
- * are not what a person types or finds. `ACRYL_HOME`, when it is an absolute path, moves the root (an isolated run, a test), as it moves ACRYL's own home.
56
- */
57
- export function acrylRoot(platform: NodeJS.Platform, env: Env, home: string): string {
58
- const path = pathOf(platform)
59
- const pinned = env.ACRYL_HOME?.trim()
60
- return pinned !== undefined && path.isAbsolute(pinned)
61
- ? path.normalize(pinned)
62
- : path.join(home, '.acryl')
63
- }
64
-
65
- /** Windows refuses these as a file or folder name, whatever the case and whatever follows a dot. */
66
- const RESERVED = /^(con|prn|aux|nul|com[1-9¹²³]|lpt[1-9¹²³])(\..*)?$/iu
67
-
68
- /** A control character (U+0000 to U+001F): never in a file name on Windows, never in a one-line label. */
69
- export const hasControlCharacter = (text: string): boolean =>
70
- [...text].some((character) => (character.codePointAt(0) ?? 0) < 0x20)
71
-
72
- /** A name every OS accepts as one path segment: no separators or characters Windows forbids, no trailing dot or space, not reserved, not too long. */
73
- export function isPortableName(name: string, maxLength: number): boolean {
74
- return (
75
- name.length > 0 &&
76
- name.length <= maxLength &&
77
- name.trim() === name &&
78
- !name.endsWith('.') &&
79
- !/[<>:"/\\|?*]/u.test(name) &&
80
- !hasControlCharacter(name) &&
81
- !RESERVED.test(name)
82
- )
83
- }
84
-
85
- /** An app id: lower-case ASCII letters, digits and single dashes, 40 characters at most, never reserved. Compared as is (always lower-case). */
86
- export function isAppId(id: string): boolean {
87
- return /^[a-z0-9]+(?:-[a-z0-9]+)*$/u.test(id) && isPortableName(id, 40)
88
- }
89
-
90
- /**
91
- * A new app's id: the name, folded to ASCII lower-case and dashes, cut to 30 characters, then 4 random hex digits (`my-notes-3f2a`). The name stays a label;
92
- * renaming the app never moves its folder.
93
- */
94
- export function newAppId(
95
- name: string,
96
- random: () => string = () => randomBytes(2).toString('hex'),
97
- ): string {
98
- const base =
99
- name
100
- .normalize('NFKD')
101
- .replace(/[̀-ͯ]/gu, '')
102
- .toLowerCase()
103
- .replace(/[^a-z0-9]+/gu, '-')
104
- .slice(0, 30)
105
- .replace(/^-+|-+$/gu, '') || 'app'
106
- const id = `${base}-${random()}`
107
- if (!isAppId(id))
108
- throw new AppInstanceError(`could not make an app id from "${name}" (got "${id}")`)
109
- return id
110
- }
111
-
112
- /** The id of an app folder, when it has one: `<app>/.acryl/app.json` holding `{ "id": "<id>" }` with a valid id. Never creates anything. */
113
- export function readAppId(appRoot: string): string | undefined {
114
- try {
115
- const id = (
116
- JSON.parse(readFileSync(join(appRoot, APP_STATE_DIR, APP_ID_FILE), 'utf8')) as {
117
- id?: unknown
118
- }
119
- ).id
120
- return typeof id === 'string' && isAppId(id) ? id : undefined
121
- } catch {
122
- return undefined
123
- }
124
- }
125
-
126
- /**
127
- * The id of an app folder: the one in `.acryl/app.json`, else a new one (the folder's name and four hex digits) written there. Two processes starting a
128
- * fresh folder at once end with the same id: the file is created exclusively and the loser reads the winner's.
129
- */
130
- export function appIdOf(appRoot: string, random?: () => string): string {
131
- const existing = readAppId(appRoot)
132
- if (existing !== undefined) return existing
133
- const id = newAppId(basename(resolve(appRoot)), random)
134
- const folder = join(appRoot, APP_STATE_DIR)
135
- try {
136
- mkdirSync(folder, { recursive: true })
137
- writeFileSync(join(folder, APP_ID_FILE), `${JSON.stringify({ id }, null, 2)}\n`, { flag: 'wx' })
138
- return id
139
- } catch (cause) {
140
- const raced = readAppId(appRoot)
141
- if (raced !== undefined) return raced
142
- throw new AppInstanceError(
143
- `cannot write the app's id into ${folder}: ${cause instanceof Error ? cause.message : String(cause)}`,
144
- )
145
- }
146
- }
147
-
148
- /** The folders an app keeps under the root: its data, and what can be rebuilt (`cache`, Chromium's files). Built, never checked. */
149
- export interface AppHomes {
150
- readonly id: string
151
- readonly data: string
152
- readonly cache: string
153
- }
154
-
155
- export function appHomesOf(id: string, root: string, platform: NodeJS.Platform): AppHomes {
156
- if (!isAppId(id)) throw new AppInstanceError(`"${id}" is not an app id`)
157
- const folder = pathOf(platform).join(root, APPS_DIR, id)
158
- return Object.freeze({
159
- id,
160
- data: pathOf(platform).join(folder, 'data'),
161
- cache: pathOf(platform).join(folder, 'cache'),
162
- })
163
- }
164
-
165
- /**
166
- * The folders of an app made by `acryl new`: `~/.acryl/apps/<id>/data` for its data, `~/.acryl/apps/<id>/cache` for what can be rebuilt. The id is read
167
- * from (or first written to) the app folder's `.acryl/app.json`. An app that still has a `.acrylblends/` folder beside its code is moved by
168
- * `migrateOldHome`, which the host runs once at start.
169
- */
170
- export function appHomes(
171
- appRoot: string,
172
- platform: NodeJS.Platform = process.platform,
173
- env: Env = process.env,
174
- home: string = personHome(env, platform),
175
- ): AppHomes {
176
- return appHomesOf(appIdOf(appRoot), acrylRoot(platform, env, home), platform)
177
- }
178
-
179
- /** The data folder of an app made by `acryl new`: the one answer every part of the app and the CLI shares. */
180
- export function appDataHome(
181
- appRoot: string,
182
- platform: NodeJS.Platform = process.platform,
183
- env: Env = process.env,
184
- home: string = personHome(env, platform),
185
- ): string {
186
- return appHomes(appRoot, platform, env, home).data
187
- }
188
-
189
- /** `{ path: size }` of every file under a folder, relative with `/`: what two copies must agree on. A symbolic link counts as a file, never followed. */
190
- function inventory(folder: string, prefix = ''): Map<string, number> {
191
- const found = new Map<string, number>()
192
- for (const entry of readdirSync(join(folder, prefix), { withFileTypes: true })) {
193
- const relative = prefix === '' ? entry.name : `${prefix}/${entry.name}`
194
- if (entry.isDirectory()) {
195
- found.set(`${relative}/`, 0)
196
- for (const [path, size] of inventory(folder, relative)) found.set(path, size)
197
- } else found.set(relative, lstatSync(join(folder, relative)).size)
198
- }
199
- return found
200
- }
201
-
202
- export type MigrationResult =
203
- | { readonly status: 'none' }
204
- | {
205
- readonly status: 'moved'
206
- readonly from: string
207
- readonly kept: string
208
- readonly files: number
209
- }
210
- | { readonly status: 'refused'; readonly reason: string }
211
-
212
- /**
213
- * Move an app's data from `<app>/.acrylblends/` to its data folder, once. The old folder is copied, checked file by file (names and sizes), and only
214
- * then renamed to `.acrylblends.old`; it is never deleted. A data folder that already has content is never touched (the move is refused and nothing
215
- * changes). When the copy or the check fails, what was copied is removed and the old folder stays exactly as it was.
216
- * `copy` is the copy step, replaceable so a test can fail half way.
217
- */
218
- export function migrateOldHome(
219
- appRoot: string,
220
- dataHome: string,
221
- copy: (from: string, to: string) => void = (from, to) => {
222
- // Entry by entry into the empty data folder: on Linux cpSync refuses a target folder that exists (EEXIST) even when it is empty, while
223
- // nothing inside may ever be overwritten either way.
224
- for (const entry of readdirSync(from))
225
- cpSync(join(from, entry), join(to, entry), {
226
- recursive: true,
227
- errorOnExist: true,
228
- force: false,
229
- verbatimSymlinks: true,
230
- })
231
- },
232
- ): MigrationResult {
233
- const old = join(appRoot, OLD_HOME_DIR)
234
- if (!existsSync(old) || !lstatSync(old).isDirectory()) return { status: 'none' }
235
- if (existsSync(dataHome) && readdirSync(dataHome).length > 0)
236
- return {
237
- status: 'refused',
238
- reason: `${dataHome} already has content, so ${old} was not moved; look at both and remove one`,
239
- }
240
- const created = !existsSync(dataHome)
241
- try {
242
- mkdirSync(dataHome, { recursive: true })
243
- copy(old, dataHome)
244
- const before = inventory(old)
245
- const after = inventory(dataHome)
246
- for (const [path, size] of before)
247
- if (after.get(path) !== size)
248
- throw new Error(
249
- `${path} was not copied whole (${String(after.get(path))} of ${String(size)})`,
250
- )
251
- if (after.size !== before.size) throw new Error('the copy has files the original does not')
252
- } catch (cause) {
253
- // Only what this call put into the (empty) data folder is removed; the old folder was never changed.
254
- for (const entry of readdirSync(dataHome))
255
- rmSync(join(dataHome, entry), { recursive: true, force: true })
256
- if (created) rmSync(dataHome, { recursive: true, force: true })
257
- throw new AppInstanceError(
258
- `could not move ${old} to ${dataHome}: ${cause instanceof Error ? cause.message : String(cause)}; the old folder is unchanged`,
259
- )
260
- }
261
- let kept = `${old}.old`
262
- for (let n = 2; existsSync(kept); n += 1) kept = `${old}.old-${String(n)}`
263
- renameSync(old, kept)
264
- return {
265
- status: 'moved',
266
- from: old,
267
- kept,
268
- files: [...inventory(dataHome).keys()].filter((p) => !p.endsWith('/')).length,
269
- }
270
- }
271
-
272
- const isLink = (path: string): boolean => {
273
- try {
274
- return lstatSync(path).isSymbolicLink()
275
- } catch {
276
- return false
277
- }
278
- }
279
-
280
- /**
281
- * DSH's folder for the chats of one working folder (`dsh-session-persistence-jsonl`, `projectKey`): separators become one dash, safe characters stay, the
282
- * rest is `~XXXX`, between two dashes pairs, cut to 251. Copied so a chat folder can be renamed with the app's; keep it in step with that function.
283
- */
284
- export function chatKeyOf(folder: string): string {
285
- let readable = ''
286
- let separatorRun = false
287
- for (let i = 0; i < folder.length; i += 1) {
288
- const code = folder.charCodeAt(i)
289
- const character = String.fromCharCode(code)
290
- if (character === '/' || character === '\\' || character === ':') {
291
- if (!separatorRun) readable += '-'
292
- separatorRun = true
293
- } else if (character !== '~' && /^[A-Za-z0-9._-]$/u.test(character)) {
294
- readable += character
295
- separatorRun = false
296
- } else {
297
- readable += `~${code.toString(16).toUpperCase().padStart(4, '0')}`
298
- separatorRun = false
299
- }
300
- }
301
- return `--${(readable.replace(/^-+/u, '') || 'root').slice(0, 251)}--`
302
- }
303
-
304
- /** What {@link moveChats} changed: how many of the three places that name a chat folder were rewritten. */
305
- export interface ChatMove {
306
- readonly sessions: boolean
307
- readonly workspaces: number
308
- readonly branchChats: boolean
309
- }
310
-
311
- function rewriteJson(file: string, change: (value: unknown) => boolean): boolean {
312
- if (!existsSync(file)) return false
313
- let value: unknown
314
- try {
315
- value = JSON.parse(readFileSync(file, 'utf8'))
316
- } catch {
317
- return false
318
- }
319
- if (!change(value)) return false
320
- const temporary = `${file}.${String(process.pid)}.tmp`
321
- writeFileSync(temporary, `${JSON.stringify(value, null, 2)}\n`)
322
- renameSync(temporary, file)
323
- return true
324
- }
325
-
326
- /**
327
- * Make the chats an app filed under one folder belong to another, once: the engine's folder for the new place becomes a link to the folder the chats are in, the
328
- * workspace the engine registered keeps its id and its chats under the new path, and the frame's branch chats move to the new key. For an app that was moved
329
- * or renamed ({@link followFolder}). The chats stay where they are: the engine checks that a chat's log is at the place its own header names
330
- * (its working folder then), so a renamed folder is refused as corrupt and takes the whole workspace down with it. A chat made later is filed under the new place,
331
- * in the same folder. A chat made before the move still has the old folder as its working folder. Nothing is overwritten: a folder already at the new key is left alone, and an app with no chat under `from` changes nothing. Run before the engine starts.
332
- */
333
- export function moveChats(dataHome: string, from: string, to: string): ChatMove {
334
- const none: ChatMove = { sessions: false, workspaces: 0, branchChats: false }
335
- if (from === to) return none
336
- let sessions = false
337
- const oldKey = join(dataHome, 'sessions', chatKeyOf(from))
338
- const newKey = join(dataHome, 'sessions', chatKeyOf(to))
339
- if (existsSync(oldKey) && !isLink(oldKey) && !existsSync(newKey) && !isLink(newKey)) {
340
- // A junction (Windows, no privilege needed) wants an absolute target; elsewhere the link is relative, so a moved data root keeps it.
341
- symlinkSync(
342
- process.platform === 'win32' ? oldKey : chatKeyOf(from),
343
- newKey,
344
- process.platform === 'win32' ? 'junction' : 'dir',
345
- )
346
- sessions = true
347
- }
348
- let workspaces = 0
349
- rewriteJson(join(dataHome, 'storages', 'workspace.json'), (value) => {
350
- const table = (value as { tables?: { workspaces?: Record<string, { path?: unknown }> } } | null)
351
- ?.tables?.workspaces
352
- for (const entry of Object.values(table ?? {}))
353
- if (entry.path === from) {
354
- entry.path = to
355
- workspaces += 1
356
- }
357
- return workspaces > 0
358
- })
359
- const branchChats = rewriteJson(join(dataHome, 'frame', 'branch-chats.json'), (value) => {
360
- const file = value as { roots?: Record<string, unknown>; open?: Record<string, unknown> } | null
361
- let changed = false
362
- for (const table of [file?.roots, file?.open])
363
- if (table !== undefined && Object.hasOwn(table, from) && !Object.hasOwn(table, to)) {
364
- table[to] = table[from]
365
- delete table[from]
366
- changed = true
367
- }
368
- return changed
369
- })
370
- return { sessions, workspaces, branchChats }
371
- }
372
-
373
- /** Where an app's data home records the folder the app was last started in, so a start in another folder is a move. */
374
- export const APP_FOLDER_FILE = 'app-folder.json'
375
-
376
- /**
377
- * The app was started in another folder than last time (it was moved or renamed): its chats follow it ({@link moveChats} from the folder it was in to the one it is in).
378
- * Records the folder it is in now. The engine files a chat under the folder it works in, so a moved app would otherwise show no chats. Run before the engine starts.
379
- * The first start only records. @returns what was changed, none when the folder is the same or unknown.
380
- */
381
- export function followFolder(dataHome: string, appRoot: string): ChatMove | undefined {
382
- const file = join(dataHome, APP_FOLDER_FILE)
383
- let before: string | undefined
384
- try {
385
- const recorded = (JSON.parse(readFileSync(file, 'utf8')) as { root?: unknown }).root
386
- before = typeof recorded === 'string' && recorded !== '' ? recorded : undefined
387
- } catch {
388
- before = undefined
389
- }
390
- if (before === appRoot) return undefined
391
- const moved = before === undefined ? undefined : moveChats(dataHome, before, appRoot)
392
- mkdirSync(dataHome, { recursive: true })
393
- writeFileSync(file, `${JSON.stringify({ root: appRoot }, null, 2)}\n`)
394
- return moved
395
- }