acrylblends 1.0.3 → 1.0.5

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 (256) hide show
  1. package/docs/framework/agents/index.md +6 -4
  2. package/docs/framework/workshop/README.md +3 -3
  3. package/docs/framework/workshop/facilitator.md +1 -0
  4. package/lib/accept-CNNHu4Cf.js +193 -0
  5. package/lib/{accepts-XBuZPVRI.js → accepts-Btq83xPd.js} +1 -1
  6. package/lib/accepts.js +1 -1
  7. package/lib/acryl-base.js +1 -331
  8. package/lib/adapter-CaZ6FZUU.js +37 -0
  9. package/lib/adapter.js +1 -36
  10. package/lib/{app-BM0rTCp7.js → app-CQcGWjrk.js} +4 -4
  11. package/lib/app-base-CpRMZL4v.js +332 -0
  12. package/lib/{audit-BXnYsLge.d.ts → audit-D5z9uwOP.d.ts} +14 -1
  13. package/lib/{base-NSN_SNv-.js → base-D_6kfOr-.js} +1 -1
  14. package/lib/basic-auth-C0HTRpXh.js +20 -0
  15. package/lib/basic-auth-DFLflXNe.js +95 -0
  16. package/lib/basic-auth.js +1 -94
  17. package/lib/bearer-auth-Cwxt-vgS.js +94 -0
  18. package/lib/bearer-auth.js +1 -93
  19. package/lib/body-D7f4e7w_.js +94 -0
  20. package/lib/body-limit-WmIjWRLt.js +66 -0
  21. package/lib/body-limit.js +1 -65
  22. package/lib/buffer-CkEOJCcY.js +51 -0
  23. package/lib/bun.js +3 -3
  24. package/lib/cache-B0bHH7s5.js +169 -0
  25. package/lib/cache.js +1 -168
  26. package/lib/{client-DDLXwhBo.js → client-BrMFnMEd.js} +1 -1
  27. package/lib/{client-modules-CLvWOjbd.js → client-modules-drj4mjhj.js} +4 -4
  28. package/lib/client.js +1 -1
  29. package/lib/color-COa3DplO.js +37 -0
  30. package/lib/combine-TWuGdcbC.js +137 -0
  31. package/lib/combine.js +1 -136
  32. package/lib/{components-cEW3ovK0.js → components-B2ka9Ax1.js} +4 -4
  33. package/lib/{components-JXVm45kK.js → components-PVXwaOaC.js} +2 -2
  34. package/lib/compress-BzWqsHF1.js +79 -0
  35. package/lib/compress-C-9vK4B2.d.ts +11 -0
  36. package/lib/compress-DCyrrQ5D.js +11 -0
  37. package/lib/compress.d.ts +1 -1
  38. package/lib/compress.js +2 -78
  39. package/lib/concurrent-DrF3d2c-.js +30 -0
  40. package/lib/conninfo-BCROmdnf.d.ts +11 -0
  41. package/lib/conninfo-CWJwieh4.js +19 -0
  42. package/lib/constants-CBSEudrb.js +7 -0
  43. package/lib/{context-DDO0cfuP.js → context-CkOh7Ygv.js} +2 -2
  44. package/lib/context-storage-iuPoI_CR.js +52 -0
  45. package/lib/context-storage.js +1 -51
  46. package/lib/cookie-B1LlkzOe.js +125 -0
  47. package/lib/cookie-BHIduy2T.js +82 -0
  48. package/lib/cookie.js +1 -81
  49. package/lib/cordis/db-sqlite.d.ts +1 -1
  50. package/lib/cordis/door.d.ts +17 -3
  51. package/lib/cordis/door.js +123 -16
  52. package/lib/cordis/inspect.js +4 -4
  53. package/lib/cordis/kv-db.d.ts +1 -1
  54. package/lib/cordis/kv-db.js +1 -1
  55. package/lib/cordis/kv-json.d.ts +1 -1
  56. package/lib/cordis/kv-json.js +1 -1
  57. package/lib/cordis/node-server.d.ts +1 -1
  58. package/lib/cordis/node-server.js +3 -116
  59. package/lib/cordis/router-http.d.ts +1 -1
  60. package/lib/cordis/router-http.js +2 -2
  61. package/lib/cordis/router.d.ts +1 -1
  62. package/lib/cordis/router.js +4 -4
  63. package/lib/cordis/state.js +7 -7
  64. package/lib/{core-CaY8XDZ6.js → core-BOu1jYua.js} +1 -1
  65. package/lib/cors-CbAQ-8qU.js +106 -0
  66. package/lib/cors.js +1 -105
  67. package/lib/crypto-iVP-N-tS.js +34 -0
  68. package/lib/csrf-DqqOZtgy.js +101 -0
  69. package/lib/csrf.js +1 -100
  70. package/lib/css-C5CPVMvM.js +134 -0
  71. package/lib/css.js +2 -133
  72. package/lib/db/sqlite.d.ts +1 -25
  73. package/lib/dev-CLgu-JRe.js +50 -0
  74. package/lib/dev.js +1 -49
  75. package/lib/dom-YjND9Jt3.js +74 -0
  76. package/lib/door/host.d.ts +2 -2
  77. package/lib/door/host.js +1 -1
  78. package/lib/door/page.d.ts +12 -1
  79. package/lib/door/page.js +22 -1
  80. package/lib/door/protocol.d.ts +2 -2
  81. package/lib/door/protocol.js +2 -197
  82. package/lib/encode-BhbNLrjp.js +33 -0
  83. package/lib/factory-CLdSf-xS.js +30 -0
  84. package/lib/factory.js +1 -29
  85. package/lib/handler-C0wZ0KwO.js +12 -0
  86. package/lib/helpers-BEjcdbgw.js +5 -0
  87. package/lib/{hooks-w72iLeFR.js → hooks-CfC07ri0.js} +1 -1
  88. package/lib/html-CgNa89xw.js +31 -0
  89. package/lib/html-DGExBFNg.js +103 -0
  90. package/lib/html.d.ts +2 -5
  91. package/lib/html.js +2 -30
  92. package/lib/http-exception-MjWkT89V.js +54 -0
  93. package/lib/http-exception.js +1 -53
  94. package/lib/{index-D4nVR3wu.d.ts → index-DMOtA-NJ.d.ts} +7 -1
  95. package/lib/index-dAzQsJG9.d.ts +6 -0
  96. package/lib/index.js +3 -3
  97. package/lib/ip-restriction-jKtKCRM_.js +166 -0
  98. package/lib/ip-restriction.js +1 -165
  99. package/lib/ipaddr-DCoIo528.js +238 -0
  100. package/lib/jsx/dom/client.js +1 -1
  101. package/lib/jsx/dom/jsx-dev-runtime.js +1 -1
  102. package/lib/jsx/dom/jsx-runtime.js +2 -1
  103. package/lib/jsx/dom/server.js +3 -3
  104. package/lib/jsx/dom.js +5 -73
  105. package/lib/jsx/jsx-dev-runtime.d.ts +2 -5
  106. package/lib/jsx/jsx-dev-runtime.js +2 -13
  107. package/lib/jsx/jsx-runtime.d.ts +2 -2
  108. package/lib/jsx/jsx-runtime.js +4 -4
  109. package/lib/jsx/streaming.js +1 -1
  110. package/lib/jsx-CUQgttxU.js +47 -0
  111. package/lib/jsx-dev-runtime-B4WTyq8r.js +14 -0
  112. package/lib/{jsx-dev-runtime-CWLRA2F3.js → jsx-dev-runtime-BLfA-EhI.js} +2 -2
  113. package/lib/jsx-dev-runtime-CGt4kNYr.d.ts +6 -0
  114. package/lib/jsx-renderer-CfifM4hT.js +99 -0
  115. package/lib/jsx-renderer.js +1 -98
  116. package/lib/jsx-runtime-COCRWBJ9.js +2 -0
  117. package/lib/jsx.js +5 -46
  118. package/lib/{jwk-LkzeoaU8.js → jwk-CDPpYQpD.js} +3 -3
  119. package/lib/jwk.js +1 -1
  120. package/lib/{jwt-BGJBw5AF.js → jwt-BXoIA2fQ.js} +2 -2
  121. package/lib/{jwt-CskdhEW9.js → jwt-lyS4Q3mT.js} +3 -3
  122. package/lib/jwt.js +2 -2
  123. package/lib/kv/db.d.ts +1 -10
  124. package/lib/kv/db.js +1 -56
  125. package/lib/kv/json.d.ts +1 -9
  126. package/lib/kv/json.js +1 -223
  127. package/lib/{language-D9a4zqvn.js → language-DeGRtLJt.js} +2 -2
  128. package/lib/language.js +1 -1
  129. package/lib/{linear-router-C3FPib6h.js → linear-router-CmZn_JLV.js} +2 -2
  130. package/lib/logger-Ckxu8diz.js +54 -0
  131. package/lib/logger.js +1 -53
  132. package/lib/loopback-only-BbasoF7R.js +90 -0
  133. package/lib/loopback-only.js +1 -89
  134. package/lib/method-not-allowed-TO2_hnfl.js +82 -0
  135. package/lib/method-not-allowed.js +1 -81
  136. package/lib/method-override-DnZKfJbV.js +103 -0
  137. package/lib/method-override.js +1 -102
  138. package/lib/middleware-BfG_fp8P.js +12 -0
  139. package/lib/mime-BnScXkQn.js +77 -0
  140. package/lib/mount-QkK_3NtJ.js +67 -0
  141. package/lib/mount.js +1 -66
  142. package/lib/node-server/conninfo.d.ts +1 -10
  143. package/lib/node-server/conninfo.js +1 -18
  144. package/lib/node-server/register.js +25 -2
  145. package/lib/node-server/serve-static.d.ts +1 -17
  146. package/lib/node-server/serve-static.js +1 -1
  147. package/lib/node-server.d.ts +2 -2
  148. package/lib/node-server.js +4 -4
  149. package/lib/open-BqK4D2Wn.d.ts +11 -0
  150. package/lib/open-But9E2rL.js +57 -0
  151. package/lib/open-CULVJgOc.d.ts +12 -0
  152. package/lib/open-Dp4sxspc.js +224 -0
  153. package/lib/open-T7kgbO2O.d.ts +27 -0
  154. package/lib/{pattern-router-HZxjDGEQ.js → pattern-router-CJBecJBd.js} +1 -1
  155. package/lib/powered-by-CXQNjNIX.js +24 -0
  156. package/lib/powered-by.js +1 -23
  157. package/lib/pretty-json-CeC1yvYt.js +39 -0
  158. package/lib/pretty-json.js +1 -38
  159. package/lib/{protocol-BizVt4J6.d.ts → protocol-C37gPePD.d.ts} +9 -2
  160. package/lib/protocol-Dt0AZBOz.js +213 -0
  161. package/lib/proxy-C2w_mH7k.js +121 -0
  162. package/lib/proxy.js +1 -120
  163. package/lib/quick.js +4 -4
  164. package/lib/{reg-exp-router-DC1R3qoY.js → reg-exp-router-C_WV84eV.js} +2 -2
  165. package/lib/request-DvMgGtlW.js +323 -0
  166. package/lib/request.js +1 -322
  167. package/lib/route-D8m-a2I1.js +126 -0
  168. package/lib/route.js +1 -125
  169. package/lib/router/linear-router.js +1 -1
  170. package/lib/router/pattern-router.js +1 -1
  171. package/lib/router/reg-exp-router.js +1 -1
  172. package/lib/router/smart-router.js +1 -1
  173. package/lib/router/trie-router.js +1 -1
  174. package/lib/router-Be_o6nFu.js +35 -0
  175. package/lib/router.js +1 -34
  176. package/lib/schema-validator-EK3cUUCt.js +22 -0
  177. package/lib/schema-validator.js +1 -21
  178. package/lib/{secure-headers-mP3j6Hm6.js → secure-headers-C5ZOcXqk.js} +1 -1
  179. package/lib/secure-headers.js +1 -1
  180. package/lib/serve-static-B7sqnftW.d.ts +18 -0
  181. package/lib/{serve-static-3uo_9rjF.js → serve-static-C1Nkj_xB.js} +2 -2
  182. package/lib/{serve-static-Cp5adzGo.js → serve-static-EiJf1zkO.js} +4 -4
  183. package/lib/serve-static.js +1 -1
  184. package/lib/{smart-router-C5CZ5XSM.js → smart-router-BjxkDQCE.js} +1 -1
  185. package/lib/{snapshot-text-DmE0YfeZ.js → snapshot-text-Bbx43mN0.js} +57 -9
  186. package/lib/{src-2Z4mJg0x.js → src-BTBm4OPD.js} +22 -6
  187. package/lib/src-LX0E4ec4.js +117 -0
  188. package/lib/{ssg-BwjcA-Ge.js → ssg-BEl7MHqg.js} +5 -5
  189. package/lib/ssg.js +1 -1
  190. package/lib/stream-CzM_SHkq.js +88 -0
  191. package/lib/{streaming-DHST3Scg.js → streaming-BlDaph8U.js} +3 -3
  192. package/lib/streaming.js +1 -1
  193. package/lib/{test-websocket-D8WWqE5G.js → test-websocket-BLeEvybj.js} +2 -2
  194. package/lib/testing-BQx5T_UX.js +17 -0
  195. package/lib/testing.js +1 -16
  196. package/lib/timeout-FeqZ9A-0.js +42 -0
  197. package/lib/timeout.js +1 -41
  198. package/lib/tiny.js +2 -2
  199. package/lib/trailing-slash-DwTx-1sk.js +85 -0
  200. package/lib/trailing-slash.js +1 -84
  201. package/lib/{trie-router-CfFbapzL.js → trie-router-JydLKUa2.js} +2 -2
  202. package/lib/url-BPh4d6j-.js +197 -0
  203. package/lib/utils/accept.js +1 -192
  204. package/lib/utils/basic-auth.js +1 -19
  205. package/lib/utils/body.js +1 -93
  206. package/lib/utils/buffer.js +1 -50
  207. package/lib/utils/color.js +1 -36
  208. package/lib/utils/compress.d.ts +1 -10
  209. package/lib/utils/compress.js +1 -10
  210. package/lib/utils/concurrent.js +1 -29
  211. package/lib/utils/constants.js +1 -6
  212. package/lib/utils/cookie.js +1 -124
  213. package/lib/utils/crypto.js +1 -33
  214. package/lib/utils/encode.js +1 -32
  215. package/lib/utils/handler.js +1 -11
  216. package/lib/utils/html.js +1 -102
  217. package/lib/utils/ipaddr.js +1 -237
  218. package/lib/utils/jwt.js +1 -1
  219. package/lib/utils/mime.js +1 -76
  220. package/lib/utils/stream.js +1 -87
  221. package/lib/utils/url.js +1 -196
  222. package/lib/{validator-D84mq-dO.js → validator-Btiyt5VJ.js} +3 -3
  223. package/lib/validator.js +1 -1
  224. package/lib/websocket-DsyBIKVA.js +56 -0
  225. package/lib/ws.js +1 -55
  226. package/package.json +1 -1
  227. package/plugins/acryl-door/src/cli/acryl.ts +5 -3
  228. package/plugins/acryl-door/src/host/channel.ts +36 -0
  229. package/plugins/acryl-door/src/host/chat-tools.ts +2 -0
  230. package/plugins/acryl-door/src/host/door.ts +44 -5
  231. package/plugins/acryl-door/src/host/shim.ts +23 -0
  232. package/plugins/acryl-door/src/host/verbs.ts +4 -3
  233. package/plugins/acryl-door/src/index.ts +39 -3
  234. package/plugins/acryl-door/src/page/driver/driver.ts +22 -1
  235. package/plugins/acryl-door/src/page/protocol.ts +13 -2
  236. package/plugins/acryl-node-server/src/register.ts +29 -2
  237. package/plugins/acryl-router/src/service.ts +19 -1
  238. package/plugins/agent/model.ts +6 -1
  239. package/plugins/agent/tools.ts +12 -2
  240. package/plugins/agent-panel/client/describe.ts +44 -0
  241. package/plugins/agent-panel/client/main.ts +67 -35
  242. package/plugins/agent-panel/index.ts +137 -35
  243. package/plugins/desktop/attach.ts +72 -0
  244. package/plugins/desktop/main.ts +17 -4
  245. package/plugins/extensions/index.ts +3 -4
  246. package/plugins/extensions/stage.ts +33 -5
  247. package/plugins/openai/index.ts +1 -1
  248. package/shared/DEFAULTS.md +4 -0
  249. package/templates/agent/AGENTS.md +2 -0
  250. package/templates/agent/blend.yaml +4 -1
  251. package/templates/agent/src/app.ts +2 -0
  252. package/templates/agent/src/routes.ts +1 -1
  253. package/templates/agent/template.json +1 -0
  254. package/templates/agent/test/builder.test.ts +26 -21
  255. package/lib/helpers-CvTauQT5.js +0 -5
  256. package/lib/middleware-CPQ8himN.js +0 -12
@@ -0,0 +1,50 @@
1
+ import { t as getColorEnabled } from "./color-COa3DplO.js";
2
+ import { n as isMiddleware, t as findTargetHandler } from "./handler-C0wZ0KwO.js";
3
+ //#region ../../plugins/acryl-router/src/core/helper/dev/index.ts
4
+ const handlerName = (handler) => {
5
+ return handler.name || (isMiddleware(handler) ? "[middleware]" : "[handler]");
6
+ };
7
+ const inspectRoutes = (acryl) => {
8
+ return acryl.routes.map(({ path, method, handler }) => {
9
+ const targetHandler = findTargetHandler(handler);
10
+ return {
11
+ path,
12
+ method,
13
+ name: handlerName(targetHandler),
14
+ isMiddleware: isMiddleware(targetHandler)
15
+ };
16
+ });
17
+ };
18
+ const showRoutes = (acryl, opts) => {
19
+ const colorEnabled = opts?.colorize ?? getColorEnabled();
20
+ const routeData = {};
21
+ let maxMethodLength = 0;
22
+ let maxPathLength = 0;
23
+ inspectRoutes(acryl).filter(({ isMiddleware }) => opts?.verbose || !isMiddleware).map((route) => {
24
+ const key = `${route.method}-${route.path}`;
25
+ (routeData[key] ||= []).push(route);
26
+ if (routeData[key].length > 1) return;
27
+ maxMethodLength = Math.max(maxMethodLength, route.method.length);
28
+ maxPathLength = Math.max(maxPathLength, route.path.length);
29
+ return {
30
+ method: route.method,
31
+ path: route.path,
32
+ routes: routeData[key]
33
+ };
34
+ }).forEach((data) => {
35
+ if (!data) return;
36
+ const { method, path, routes } = data;
37
+ const methodStr = colorEnabled ? `\x1b[32m${method}\x1b[0m` : method;
38
+ console.log(`${methodStr} ${" ".repeat(maxMethodLength - method.length)} ${path}`);
39
+ if (!opts?.verbose) return;
40
+ routes.forEach(({ name }) => {
41
+ console.log(`${" ".repeat(maxMethodLength + 3)} ${name}`);
42
+ });
43
+ });
44
+ };
45
+ const getRouterName = (app) => {
46
+ app.router.match("GET", "/");
47
+ return app.router.name;
48
+ };
49
+ //#endregion
50
+ export { inspectRoutes as n, showRoutes as r, getRouterName as t };
package/lib/dev.js CHANGED
@@ -1,50 +1,2 @@
1
- import { getColorEnabled } from "./utils/color.js";
2
- import { findTargetHandler, isMiddleware } from "./utils/handler.js";
3
- //#region ../../plugins/acryl-router/src/core/helper/dev/index.ts
4
- const handlerName = (handler) => {
5
- return handler.name || (isMiddleware(handler) ? "[middleware]" : "[handler]");
6
- };
7
- const inspectRoutes = (acryl) => {
8
- return acryl.routes.map(({ path, method, handler }) => {
9
- const targetHandler = findTargetHandler(handler);
10
- return {
11
- path,
12
- method,
13
- name: handlerName(targetHandler),
14
- isMiddleware: isMiddleware(targetHandler)
15
- };
16
- });
17
- };
18
- const showRoutes = (acryl, opts) => {
19
- const colorEnabled = opts?.colorize ?? getColorEnabled();
20
- const routeData = {};
21
- let maxMethodLength = 0;
22
- let maxPathLength = 0;
23
- inspectRoutes(acryl).filter(({ isMiddleware }) => opts?.verbose || !isMiddleware).map((route) => {
24
- const key = `${route.method}-${route.path}`;
25
- (routeData[key] ||= []).push(route);
26
- if (routeData[key].length > 1) return;
27
- maxMethodLength = Math.max(maxMethodLength, route.method.length);
28
- maxPathLength = Math.max(maxPathLength, route.path.length);
29
- return {
30
- method: route.method,
31
- path: route.path,
32
- routes: routeData[key]
33
- };
34
- }).forEach((data) => {
35
- if (!data) return;
36
- const { method, path, routes } = data;
37
- const methodStr = colorEnabled ? `\x1b[32m${method}\x1b[0m` : method;
38
- console.log(`${methodStr} ${" ".repeat(maxMethodLength - method.length)} ${path}`);
39
- if (!opts?.verbose) return;
40
- routes.forEach(({ name }) => {
41
- console.log(`${" ".repeat(maxMethodLength + 3)} ${name}`);
42
- });
43
- });
44
- };
45
- const getRouterName = (app) => {
46
- app.router.match("GET", "/");
47
- return app.router.name;
48
- };
49
- //#endregion
1
+ import { n as inspectRoutes, r as showRoutes, t as getRouterName } from "./dev-CLgu-JRe.js";
50
2
  export { getRouterName, inspectRoutes, showRoutes };
@@ -0,0 +1,74 @@
1
+ import { D as createContext, E as useContext, a as isValidElement, f as shallowEqual, g as Children, l as reactAPICompatVersion } from "./base-D_6kfOr-.js";
2
+ import { r as DOM_MEMO } from "./constants-BR9jM9BC.js";
3
+ import { C as createPortal, _ as useState, a as use, b as useViewTransition, c as useDeferredValue, d as useImperativeHandle, f as useInsertionEffect, g as useRef, h as useReducer, i as startViewTransition, l as useEffect, m as useMemo, n as forwardRef, o as useCallback, p as useLayoutEffect, r as startTransition, s as useDebugValue, t as createRef, u as useId, v as useSyncExternalStore, w as flushSync, y as useTransition } from "./hooks-CfC07ri0.js";
4
+ import { a as useOptimistic, i as useFormStatus, n as jsxDEV, r as useActionState, t as Fragment } from "./jsx-dev-runtime-BLfA-EhI.js";
5
+ import "./jsx-runtime-COCRWBJ9.js";
6
+ import { n as Suspense, t as ErrorBoundary } from "./components-PVXwaOaC.js";
7
+ //#region ../../plugins/acryl-router/src/core/jsx/dom/index.ts
8
+ /**
9
+ * @module
10
+ * This module provides APIs for `acryl-router/jsx/dom`.
11
+ */
12
+ const createElement = (tag, props, ...children) => {
13
+ const jsxProps = props ? { ...props } : {};
14
+ if (children.length) jsxProps.children = children.length === 1 ? children[0] : children;
15
+ let key = void 0;
16
+ if ("key" in jsxProps) {
17
+ key = jsxProps.key;
18
+ delete jsxProps.key;
19
+ }
20
+ return jsxDEV(tag, jsxProps, key);
21
+ };
22
+ const cloneElement = (element, props, ...children) => {
23
+ return jsxDEV(element.tag, {
24
+ ...element.props,
25
+ ...props,
26
+ children: children.length ? children : element.props.children
27
+ }, element.key);
28
+ };
29
+ const memo = (component, propsAreEqual = shallowEqual) => {
30
+ const wrapper = ((props) => component(props));
31
+ wrapper[DOM_MEMO] = propsAreEqual;
32
+ return wrapper;
33
+ };
34
+ var dom_default = {
35
+ version: reactAPICompatVersion,
36
+ useState,
37
+ useEffect,
38
+ useRef,
39
+ useCallback,
40
+ use,
41
+ startTransition,
42
+ useTransition,
43
+ useDeferredValue,
44
+ startViewTransition,
45
+ useViewTransition,
46
+ useMemo,
47
+ useLayoutEffect,
48
+ useInsertionEffect,
49
+ useReducer,
50
+ useId,
51
+ useDebugValue,
52
+ createRef,
53
+ forwardRef,
54
+ useImperativeHandle,
55
+ useSyncExternalStore,
56
+ useFormStatus,
57
+ useActionState,
58
+ useOptimistic,
59
+ Suspense,
60
+ ErrorBoundary,
61
+ createContext,
62
+ useContext,
63
+ memo,
64
+ isValidElement,
65
+ createElement,
66
+ cloneElement,
67
+ Children,
68
+ Fragment,
69
+ StrictMode: Fragment,
70
+ flushSync,
71
+ createPortal
72
+ };
73
+ //#endregion
74
+ export { memo as i, createElement as n, dom_default as r, cloneElement as t };
@@ -1,6 +1,6 @@
1
1
  import { t as Acryl } from "../app-D8riatvv.js";
2
- import { t as AuditEntry, v as UiSnapshot } from "../protocol-BizVt4J6.js";
3
- import { i as UiChannel, n as auditPath, r as PageStream, t as AuditLog } from "../audit-BXnYsLge.js";
2
+ import { n as AuditEntry, y as UiSnapshot } from "../protocol-C37gPePD.js";
3
+ import { i as UiChannel, n as auditPath, r as PageStream, t as AuditLog } from "../audit-D5z9uwOP.js";
4
4
 
5
5
  //#region ../../plugins/acryl-door/src/host/page-routes.d.ts
6
6
  /** How often the Host writes a `ping`; the page gives up on a stream that is silent for three of these. */
package/lib/door/host.js CHANGED
@@ -1,2 +1,2 @@
1
- import { d as AuditLog, f as auditPath, n as HEARTBEAT_MS, p as UiChannel, r as pageChannelRoutes, t as renderSnapshot } from "../snapshot-text-DmE0YfeZ.js";
1
+ import { d as AuditLog, f as auditPath, n as HEARTBEAT_MS, p as UiChannel, r as pageChannelRoutes, t as renderSnapshot } from "../snapshot-text-Bbx43mN0.js";
2
2
  export { AuditLog, HEARTBEAT_MS, UiChannel, auditPath, pageChannelRoutes, renderSnapshot };
@@ -1,4 +1,4 @@
1
- import { _ as UiResult, g as UiRequest } from "../protocol-BizVt4J6.js";
1
+ import { _ as UiRequest, v as UiResult } from "../protocol-C37gPePD.js";
2
2
 
3
3
  //#region ../../plugins/acryl-door/src/page/driver/driver.d.ts
4
4
  interface DriverActivity {
@@ -14,6 +14,12 @@ interface UiDriverOptions {
14
14
  /** Milliseconds since the user last used the page (mouse, keyboard); Infinity when never. */
15
15
  readonly msSinceUserInput?: () => number;
16
16
  readonly sleep?: (ms: number, signal: AbortSignal) => Promise<void>;
17
+ /** Leave the page: reload it, or go to a path of the app. Default: the document's own `location`, a moment after the answer is sent. */
18
+ readonly leave?: (to: {
19
+ readonly reload: true;
20
+ } | {
21
+ readonly path: string;
22
+ }) => void;
17
23
  }
18
24
  declare class UiDriver {
19
25
  private readonly refs;
@@ -40,6 +46,11 @@ declare class UiDriver {
40
46
  /** @param signal - the Host cancelled the call. @throws UiControlError. */
41
47
  handle(request: UiRequest, signal?: AbortSignal): Promise<UiResult>;
42
48
  private run;
49
+ /**
50
+ * The page is about to be replaced, so the answer is given first and the move happens a moment later (the answer is a POST that the page's own unload would cut off).
51
+ * The Host does not wait for this answer to be the last word: it waits for the page to come back.
52
+ */
53
+ private leave;
43
54
  private yieldToUser;
44
55
  private emit;
45
56
  }
package/lib/door/page.js CHANGED
@@ -1,4 +1,4 @@
1
- import { MAX_SNAPSHOT_NODES, MAX_WAIT_MS, MUTATING_OPS, UiControlError, parseChannelToPage } from "./protocol.js";
1
+ import { a as MAX_WAIT_MS, f as parseChannelToPage, l as UiControlError, o as MUTATING_OPS, r as MAX_SNAPSHOT_NODES } from "../protocol-Dt0AZBOz.js";
2
2
  //#region ../../plugins/acryl-door/src/page/channel.ts
3
3
  /**
4
4
  * The page's end of the door's channel.
@@ -894,8 +894,29 @@ var UiDriver = class {
894
894
  case "press": return pressKey(this.env, request);
895
895
  case "scroll": return scroll(this.env, request);
896
896
  case "wait": return wait(this.env, request, signal);
897
+ case "reload": return this.leave({ reload: true }, "reloading");
898
+ case "navigate": return this.leave({ path: request.path }, `going to ${request.path}`);
897
899
  }
898
900
  }
901
+ /**
902
+ * The page is about to be replaced, so the answer is given first and the move happens a moment later (the answer is a POST that the page's own unload would cut off).
903
+ * The Host does not wait for this answer to be the last word: it waits for the page to come back.
904
+ */
905
+ leave(to, detail) {
906
+ const go = this.options.leave ?? ((target) => {
907
+ const location = this.options.document().defaultView?.location;
908
+ if (location === void 0) return;
909
+ if ("reload" in target) location.reload();
910
+ else location.assign(target.path);
911
+ });
912
+ setTimeout(() => {
913
+ if (!this.disposed) go(to);
914
+ }, 150);
915
+ return {
916
+ ok: true,
917
+ detail
918
+ };
919
+ }
899
920
  async yieldToUser(signal) {
900
921
  const since = this.options.msSinceUserInput;
901
922
  if (since === void 0) return;
@@ -1,2 +1,2 @@
1
- import { S as parseUiRequest, _ as UiResult, a as MAX_SNAPSHOT_NODES, b as parseChannelToHost, c as MUTATING_OPS, d as UiActionResult, f as UiControlError, g as UiRequest, h as UiOp, i as DEFAULT_SNAPSHOT_NODES, l as UI_ERROR_CODES, m as UiNode, n as ChannelToHost, o as MAX_TEXT_LENGTH, p as UiErrorCode, r as ChannelToPage, s as MAX_WAIT_MS, t as AuditEntry, u as UI_OPS, v as UiSnapshot, x as parseChannelToPage, y as WINDOW_ID } from "../protocol-BizVt4J6.js";
2
- export { AuditEntry, ChannelToHost, ChannelToPage, DEFAULT_SNAPSHOT_NODES, MAX_SNAPSHOT_NODES, MAX_TEXT_LENGTH, MAX_WAIT_MS, MUTATING_OPS, UI_ERROR_CODES, UI_OPS, UiActionResult, UiControlError, UiErrorCode, UiNode, UiOp, UiRequest, UiResult, UiSnapshot, WINDOW_ID, parseChannelToHost, parseChannelToPage, parseUiRequest };
1
+ import { C as parseUiRequest, S as parseChannelToPage, _ as UiRequest, a as DEFAULT_SNAPSHOT_NODES, b as WINDOW_ID, c as MAX_WAIT_MS, d as UI_OPS, f as UiActionResult, g as UiOp, h as UiNode, i as ChannelToPage, l as MUTATING_OPS, m as UiErrorCode, n as AuditEntry, o as MAX_SNAPSHOT_NODES, p as UiControlError, r as ChannelToHost, s as MAX_TEXT_LENGTH, t as APP_PATH, u as UI_ERROR_CODES, v as UiResult, x as parseChannelToHost, y as UiSnapshot } from "../protocol-C37gPePD.js";
2
+ export { APP_PATH, AuditEntry, ChannelToHost, ChannelToPage, DEFAULT_SNAPSHOT_NODES, MAX_SNAPSHOT_NODES, MAX_TEXT_LENGTH, MAX_WAIT_MS, MUTATING_OPS, UI_ERROR_CODES, UI_OPS, UiActionResult, UiControlError, UiErrorCode, UiNode, UiOp, UiRequest, UiResult, UiSnapshot, WINDOW_ID, parseChannelToHost, parseChannelToPage, parseUiRequest };
@@ -1,197 +1,2 @@
1
- //#region ../../plugins/acryl-door/src/page/protocol.ts
2
- /**
3
- * The one shape of a door call, shared by the Host and the in-page driver (moved from `acryl-agent-control`, spec 041).
4
- *
5
- * The Host turns a verb's arguments into a {@link UiRequest}, sends it to the page over the channel, and gets a {@link UiResult} back.
6
- * Everything crossing the channel is validated here once, so neither side trusts the other's JSON. The page imports this file too, so it
7
- * lives with the page code and has no Node imports.
8
- */
9
- /** The operations the driver performs on the page. */
10
- const UI_OPS = [
11
- "snapshot",
12
- "click",
13
- "type",
14
- "select",
15
- "press",
16
- "scroll",
17
- "wait"
18
- ];
19
- /** Operations that change the page, so each call needs approval. `snapshot`, `scroll` and `wait` only look. */
20
- const MUTATING_OPS = [
21
- "click",
22
- "type",
23
- "select",
24
- "press"
25
- ];
26
- const MAX_TEXT_LENGTH = 1e4;
27
- const MAX_WAIT_MS = 1e4;
28
- const MAX_SNAPSHOT_NODES = 1e3;
29
- const DEFAULT_SNAPSHOT_NODES = 300;
30
- var UiControlError = class extends Error {
31
- code;
32
- constructor(code, message) {
33
- super(message);
34
- this.code = code;
35
- this.name = "UiControlError";
36
- }
37
- };
38
- const KEYS = /^(?:[A-Za-z0-9]|Enter|Escape|Tab|Backspace|Delete|Space|Arrow(?:Up|Down|Left|Right)|Home|End|PageUp|PageDown)$/;
39
- const REF = /^\d{1,9}\.\d{1,6}$/;
40
- const isRecord = (value) => value !== null && typeof value === "object" && !Array.isArray(value);
41
- const invalid = (message) => {
42
- throw new UiControlError("invalid", message);
43
- };
44
- function ref(value) {
45
- if (typeof value !== "string" || !REF.test(value)) return invalid("ref must look like 3.17, from the latest snapshot");
46
- return value;
47
- }
48
- function text(value, max = MAX_TEXT_LENGTH) {
49
- if (typeof value !== "string" || value.length > max || value.includes("\0")) return invalid(`text must be a string of at most ${String(max)} characters`);
50
- return value;
51
- }
52
- /** @param value - untrusted JSON. @throws UiControlError `invalid`. */
53
- function parseUiRequest(value) {
54
- if (!isRecord(value) || typeof value.op !== "string") return invalid("a call needs an op");
55
- const op = value.op;
56
- const only = (allowed) => {
57
- const extra = Object.keys(value).find((key) => key !== "op" && !allowed.includes(key));
58
- if (extra !== void 0) invalid(`unknown field ${extra}`);
59
- };
60
- switch (op) {
61
- case "snapshot": {
62
- only(["cursor", "maxNodes"]);
63
- const cursor = value.cursor === void 0 ? void 0 : Number(value.cursor);
64
- const maxNodes = value.maxNodes === void 0 ? void 0 : Number(value.maxNodes);
65
- if (cursor !== void 0 && (!Number.isInteger(cursor) || cursor < 0) || maxNodes !== void 0 && (!Number.isInteger(maxNodes) || maxNodes < 1 || maxNodes > 1e3)) return invalid("cursor and maxNodes must be small positive integers");
66
- return {
67
- op,
68
- ...cursor === void 0 ? {} : { cursor },
69
- ...maxNodes === void 0 ? {} : { maxNodes }
70
- };
71
- }
72
- case "click":
73
- only(["ref"]);
74
- return {
75
- op,
76
- ref: ref(value.ref)
77
- };
78
- case "type":
79
- only([
80
- "ref",
81
- "text",
82
- "submit",
83
- "clear"
84
- ]);
85
- if (value.submit !== void 0 && typeof value.submit !== "boolean" || value.clear !== void 0 && typeof value.clear !== "boolean") return invalid("submit and clear must be true or false");
86
- return {
87
- op,
88
- ref: ref(value.ref),
89
- text: text(value.text),
90
- ...value.submit === void 0 ? {} : { submit: value.submit },
91
- ...value.clear === void 0 ? {} : { clear: value.clear }
92
- };
93
- case "select":
94
- only(["ref", "option"]);
95
- return {
96
- op,
97
- ref: ref(value.ref),
98
- option: text(value.option, 500)
99
- };
100
- case "press":
101
- only(["key", "ref"]);
102
- if (typeof value.key !== "string" || !KEYS.test(value.key)) return invalid("key must be a single character or a name such as Enter, Escape, Tab or ArrowDown");
103
- return {
104
- op,
105
- key: value.key,
106
- ...value.ref === void 0 ? {} : { ref: ref(value.ref) }
107
- };
108
- case "scroll": {
109
- only([
110
- "direction",
111
- "ref",
112
- "amount"
113
- ]);
114
- if (value.direction !== "up" && value.direction !== "down" && value.direction !== "left" && value.direction !== "right") return invalid("direction must be up, down, left or right");
115
- const amount = value.amount === void 0 ? void 0 : Number(value.amount);
116
- if (amount !== void 0 && (!Number.isFinite(amount) || amount <= 0 || amount > 1e4)) return invalid("amount must be between 1 and 10000 pixels");
117
- return {
118
- op,
119
- direction: value.direction,
120
- ...value.ref === void 0 ? {} : { ref: ref(value.ref) },
121
- ...amount === void 0 ? {} : { amount }
122
- };
123
- }
124
- case "wait": {
125
- only([
126
- "text",
127
- "role",
128
- "name",
129
- "gone",
130
- "timeoutMs"
131
- ]);
132
- const timeoutMs = value.timeoutMs === void 0 ? void 0 : Number(value.timeoutMs);
133
- if (timeoutMs !== void 0 && (!Number.isFinite(timeoutMs) || timeoutMs < 0 || timeoutMs > 1e4)) return invalid(`timeoutMs must be between 0 and ${String(MAX_WAIT_MS)}`);
134
- if (value.gone !== void 0 && typeof value.gone !== "boolean") return invalid("gone must be true or false");
135
- if (value.text === void 0 && value.role === void 0 && value.name === void 0) return invalid("wait needs text, or a role and name");
136
- return {
137
- op,
138
- ...value.text === void 0 ? {} : { text: text(value.text, 500) },
139
- ...value.role === void 0 ? {} : { role: text(value.role, 60) },
140
- ...value.name === void 0 ? {} : { name: text(value.name, 500) },
141
- ...value.gone === void 0 ? {} : { gone: value.gone },
142
- ...timeoutMs === void 0 ? {} : { timeoutMs }
143
- };
144
- }
145
- default: return invalid(`unknown op ${String(op)}`);
146
- }
147
- }
148
- /** @param text - one `call` event's data from the Host. @throws when it is not a well-formed call. */
149
- function parseChannelToPage(text) {
150
- const value = JSON.parse(text);
151
- if (isRecord(value) && value.t === "call" && typeof value.id === "number" && Number.isSafeInteger(value.id)) return {
152
- t: "call",
153
- id: value.id,
154
- request: parseUiRequest(value.request)
155
- };
156
- throw new UiControlError("invalid", "not a channel call");
157
- }
158
- /** Every code a {@link UiControlError} can carry, so a code read off the wire is validated, not cast. */
159
- const UI_ERROR_CODES = [
160
- "no-window",
161
- "stale-ref",
162
- "unknown-ref",
163
- "sensitive",
164
- "protected",
165
- "not-actionable",
166
- "not-found",
167
- "killed",
168
- "timeout",
169
- "aborted",
170
- "unloaded",
171
- "disconnected",
172
- "invalid"
173
- ];
174
- /** A window id the page chose: short, printable, so it can travel in a query string and a log line. */
175
- const WINDOW_ID = /^[A-Za-z0-9-]{1,80}$/u;
176
- /** @param value - one parsed message from the page; null when it is not a well-formed message. */
177
- function parseChannelToHost(value) {
178
- if (!isRecord(value)) return null;
179
- if (value.t === "focus" && typeof value.focused === "boolean") return {
180
- t: "focus",
181
- focused: value.focused
182
- };
183
- if (value.t === "result" && typeof value.id === "number" && isRecord(value.value)) return {
184
- t: "result",
185
- id: value.id,
186
- value: value.value
187
- };
188
- if (value.t === "error" && typeof value.id === "number" && typeof value.message === "string" && UI_ERROR_CODES.includes(value.code)) return {
189
- t: "error",
190
- id: value.id,
191
- code: value.code,
192
- message: value.message.slice(0, 500)
193
- };
194
- return null;
195
- }
196
- //#endregion
197
- export { DEFAULT_SNAPSHOT_NODES, MAX_SNAPSHOT_NODES, MAX_TEXT_LENGTH, MAX_WAIT_MS, MUTATING_OPS, UI_ERROR_CODES, UI_OPS, UiControlError, WINDOW_ID, parseChannelToHost, parseChannelToPage, parseUiRequest };
1
+ import { a as MAX_WAIT_MS, c as UI_OPS, d as parseChannelToHost, f as parseChannelToPage, i as MAX_TEXT_LENGTH, l as UiControlError, n as DEFAULT_SNAPSHOT_NODES, o as MUTATING_OPS, p as parseUiRequest, r as MAX_SNAPSHOT_NODES, s as UI_ERROR_CODES, t as APP_PATH, u as WINDOW_ID } from "../protocol-Dt0AZBOz.js";
2
+ export { APP_PATH, DEFAULT_SNAPSHOT_NODES, MAX_SNAPSHOT_NODES, MAX_TEXT_LENGTH, MAX_WAIT_MS, MUTATING_OPS, UI_ERROR_CODES, UI_OPS, UiControlError, WINDOW_ID, parseChannelToHost, parseChannelToPage, parseUiRequest };
@@ -0,0 +1,33 @@
1
+ //#region ../../plugins/acryl-router/src/core/utils/encode.ts
2
+ /**
3
+ * @module
4
+ * Encode utility.
5
+ */
6
+ const decodeBase64Url = (str) => {
7
+ return decodeBase64(str.replace(/_|-/g, (m) => ({
8
+ _: "/",
9
+ "-": "+"
10
+ })[m] ?? m));
11
+ };
12
+ const encodeBase64Url = (buf) => encodeBase64(buf).replace(/\/|\+/g, (m) => ({
13
+ "/": "_",
14
+ "+": "-"
15
+ })[m] ?? m);
16
+ const encodeBase64 = (buf) => {
17
+ let binary = "";
18
+ const bytes = new Uint8Array(buf);
19
+ for (let i = 0, len = bytes.length; i < len; i++) binary += String.fromCharCode(bytes[i]);
20
+ return btoa(binary);
21
+ };
22
+ const decodeBase64 = (str) => {
23
+ const binary = atob(str);
24
+ const bytes = new Uint8Array(new ArrayBuffer(binary.length));
25
+ const half = binary.length / 2;
26
+ for (let i = 0, j = binary.length - 1; i <= half; i++, j--) {
27
+ bytes[i] = binary.charCodeAt(i);
28
+ bytes[j] = binary.charCodeAt(j);
29
+ }
30
+ return bytes;
31
+ };
32
+ //#endregion
33
+ export { encodeBase64Url as i, decodeBase64Url as n, encodeBase64 as r, decodeBase64 as t };
@@ -0,0 +1,30 @@
1
+ import { t as Acryl } from "./app-CQcGWjrk.js";
2
+ //#region ../../plugins/acryl-router/src/core/helper/factory/index.ts
3
+ /**
4
+ * @module
5
+ * Factory Helper for Acryl.
6
+ */
7
+ var Factory = class {
8
+ initApp;
9
+ #defaultAppOptions;
10
+ constructor(init) {
11
+ this.initApp = init?.initApp;
12
+ this.#defaultAppOptions = init?.defaultAppOptions;
13
+ }
14
+ createApp = (options) => {
15
+ const app = new Acryl(options && this.#defaultAppOptions ? {
16
+ ...this.#defaultAppOptions,
17
+ ...options
18
+ } : options ?? this.#defaultAppOptions);
19
+ if (this.initApp) this.initApp(app);
20
+ return app;
21
+ };
22
+ createMiddleware = (middleware) => middleware;
23
+ createHandlers = (...handlers) => {
24
+ return handlers.filter((handler) => handler !== void 0);
25
+ };
26
+ };
27
+ const createFactory = (init) => new Factory(init);
28
+ const createMiddleware = (middleware) => middleware;
29
+ //#endregion
30
+ export { createFactory as n, createMiddleware as r, Factory as t };
package/lib/factory.js CHANGED
@@ -1,30 +1,2 @@
1
- import { t as Acryl } from "./app-BM0rTCp7.js";
2
- //#region ../../plugins/acryl-router/src/core/helper/factory/index.ts
3
- /**
4
- * @module
5
- * Factory Helper for Acryl.
6
- */
7
- var Factory = class {
8
- initApp;
9
- #defaultAppOptions;
10
- constructor(init) {
11
- this.initApp = init?.initApp;
12
- this.#defaultAppOptions = init?.defaultAppOptions;
13
- }
14
- createApp = (options) => {
15
- const app = new Acryl(options && this.#defaultAppOptions ? {
16
- ...this.#defaultAppOptions,
17
- ...options
18
- } : options ?? this.#defaultAppOptions);
19
- if (this.initApp) this.initApp(app);
20
- return app;
21
- };
22
- createMiddleware = (middleware) => middleware;
23
- createHandlers = (...handlers) => {
24
- return handlers.filter((handler) => handler !== void 0);
25
- };
26
- };
27
- const createFactory = (init) => new Factory(init);
28
- const createMiddleware = (middleware) => middleware;
29
- //#endregion
1
+ import { n as createFactory, r as createMiddleware, t as Factory } from "./factory-CLdSf-xS.js";
30
2
  export { Factory, createFactory, createMiddleware };
@@ -0,0 +1,12 @@
1
+ import { t as COMPOSED_HANDLER } from "./constants-CBSEudrb.js";
2
+ //#region ../../plugins/acryl-router/src/core/utils/handler.ts
3
+ /**
4
+ * @module
5
+ * Handler utility.
6
+ */
7
+ const isMiddleware = (handler) => handler.length > 1;
8
+ const findTargetHandler = (handler) => {
9
+ return handler["__COMPOSED_HANDLER"] ? findTargetHandler(handler[COMPOSED_HANDLER]) : handler;
10
+ };
11
+ //#endregion
12
+ export { isMiddleware as n, findTargetHandler as t };
@@ -0,0 +1,5 @@
1
+ import "./factory-CLdSf-xS.js";
2
+ import "./ssg-BEl7MHqg.js";
3
+ import "./css-C5CPVMvM.js";
4
+ import "./connection-C7xgP1hP.js";
5
+ export {};
@@ -1,4 +1,4 @@
1
- import { D as createContext, E as useContext, T as globalContexts, _ as toArray, h as styleObjectForEach, m as normalizeIntrinsicElementKey } from "./base-NSN_SNv-.js";
1
+ import { D as createContext, E as useContext, T as globalContexts, _ as toArray, h as styleObjectForEach, m as normalizeIntrinsicElementKey } from "./base-D_6kfOr-.js";
2
2
  import { a as DOM_STASH, i as DOM_RENDERER, n as DOM_INTERNAL_TAG, r as DOM_MEMO, t as DOM_ERROR_HANDLER } from "./constants-BR9jM9BC.js";
3
3
  //#region ../../plugins/acryl-router/src/core/jsx/dom/render.ts
4
4
  const ACRYL_PORTAL_ELEMENT = "_hp";
@@ -0,0 +1,31 @@
1
+ import { a as resolveCallbackSync, n as escapeToBuffer, o as stringBufferToString, r as raw } from "./html-DGExBFNg.js";
2
+ //#region ../../plugins/acryl-router/src/core/helper/html/index.ts
3
+ /**
4
+ * @module
5
+ * html Helper for Acryl.
6
+ */
7
+ const html = (strings, ...values) => {
8
+ const buffer = [""];
9
+ for (let i = 0, len = strings.length - 1; i < len; i++) {
10
+ buffer[0] += strings[i];
11
+ const children = Array.isArray(values[i]) ? values[i].flat(Infinity) : [values[i]];
12
+ for (let i = 0, len = children.length; i < len; i++) {
13
+ const child = children[i];
14
+ if (typeof child === "string") escapeToBuffer(child, buffer);
15
+ else if (typeof child === "number") buffer[0] += child;
16
+ else if (typeof child === "boolean" || child === null || child === void 0) continue;
17
+ else if (typeof child === "object" && child.isEscaped) if (child.callbacks) buffer.unshift("", child);
18
+ else {
19
+ const tmp = child.toString();
20
+ if (tmp instanceof Promise) buffer.unshift("", tmp);
21
+ else buffer[0] += tmp;
22
+ }
23
+ else if (child instanceof Promise) buffer.unshift("", child);
24
+ else escapeToBuffer(child.toString(), buffer);
25
+ }
26
+ }
27
+ buffer[0] += strings.at(-1);
28
+ return buffer.length === 1 ? "callbacks" in buffer ? raw(resolveCallbackSync(raw(buffer[0], buffer.callbacks))) : raw(buffer[0]) : stringBufferToString(buffer, buffer.callbacks);
29
+ };
30
+ //#endregion
31
+ export { html as t };