@withbuddi/buddi 0.1.0-pre.38 → 0.1.0-pre.39

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 (253) hide show
  1. package/extension/background.js +635 -21
  2. package/extension/manifest.json +2 -2
  3. package/node_modules/@buddi/cli/dist/.tsbuildinfo +1 -1
  4. package/node_modules/@buddi/cli/dist/access-cmd.d.ts +1 -1
  5. package/node_modules/@buddi/cli/dist/access-cmd.d.ts.map +1 -1
  6. package/node_modules/@buddi/cli/dist/access-cmd.js +23 -3
  7. package/node_modules/@buddi/cli/dist/access-cmd.js.map +1 -1
  8. package/node_modules/@buddi/cli/dist/args.d.ts +2 -2
  9. package/node_modules/@buddi/cli/dist/args.d.ts.map +1 -1
  10. package/node_modules/@buddi/cli/dist/args.js +7 -2
  11. package/node_modules/@buddi/cli/dist/args.js.map +1 -1
  12. package/node_modules/@buddi/cli/dist/commands.d.ts.map +1 -1
  13. package/node_modules/@buddi/cli/dist/commands.js +11 -0
  14. package/node_modules/@buddi/cli/dist/commands.js.map +1 -1
  15. package/node_modules/@buddi/cli/dist/main.d.ts.map +1 -1
  16. package/node_modules/@buddi/cli/dist/main.js +2 -1
  17. package/node_modules/@buddi/cli/dist/main.js.map +1 -1
  18. package/node_modules/@buddi/gateway/dist/.tsbuildinfo +1 -1
  19. package/node_modules/@buddi/gateway/dist/missions/ask-cap.d.ts +26 -0
  20. package/node_modules/@buddi/gateway/dist/missions/ask-cap.d.ts.map +1 -0
  21. package/node_modules/@buddi/gateway/dist/missions/ask-cap.js +83 -0
  22. package/node_modules/@buddi/gateway/dist/missions/ask-cap.js.map +1 -0
  23. package/node_modules/@buddi/gateway/dist/missions/execute.d.ts +12 -1
  24. package/node_modules/@buddi/gateway/dist/missions/execute.d.ts.map +1 -1
  25. package/node_modules/@buddi/gateway/dist/missions/execute.js +73 -11
  26. package/node_modules/@buddi/gateway/dist/missions/execute.js.map +1 -1
  27. package/node_modules/@buddi/gateway/dist/missions/parked.d.ts +6 -0
  28. package/node_modules/@buddi/gateway/dist/missions/parked.d.ts.map +1 -1
  29. package/node_modules/@buddi/gateway/dist/missions/parked.js +7 -1
  30. package/node_modules/@buddi/gateway/dist/missions/parked.js.map +1 -1
  31. package/node_modules/@buddi/gateway/dist/serve.js +1 -1
  32. package/node_modules/@buddi/gateway/dist/serve.js.map +1 -1
  33. package/node_modules/@buddi/gateway/dist/system-context.d.ts +7 -0
  34. package/node_modules/@buddi/gateway/dist/system-context.d.ts.map +1 -1
  35. package/node_modules/@buddi/gateway/dist/system-context.js +8 -0
  36. package/node_modules/@buddi/gateway/dist/system-context.js.map +1 -1
  37. package/node_modules/@buddi/gateway/dist/web/api-routes.d.ts.map +1 -1
  38. package/node_modules/@buddi/gateway/dist/web/api-routes.js +11 -3
  39. package/node_modules/@buddi/gateway/dist/web/api-routes.js.map +1 -1
  40. package/node_modules/@buddi/gateway/dist/web/extension.d.ts +13 -1
  41. package/node_modules/@buddi/gateway/dist/web/extension.d.ts.map +1 -1
  42. package/node_modules/@buddi/gateway/dist/web/extension.js +125 -5
  43. package/node_modules/@buddi/gateway/dist/web/extension.js.map +1 -1
  44. package/node_modules/@buddi/gateway/dist/web/remote-hand.d.ts.map +1 -1
  45. package/node_modules/@buddi/gateway/dist/web/remote-hand.js +45 -2
  46. package/node_modules/@buddi/gateway/dist/web/remote-hand.js.map +1 -1
  47. package/node_modules/@buddi/gateway/dist/web/secrets.d.ts +26 -1
  48. package/node_modules/@buddi/gateway/dist/web/secrets.d.ts.map +1 -1
  49. package/node_modules/@buddi/gateway/dist/web/secrets.js +66 -3
  50. package/node_modules/@buddi/gateway/dist/web/secrets.js.map +1 -1
  51. package/node_modules/@buddi/gateway/dist/web/server.d.ts.map +1 -1
  52. package/node_modules/@buddi/gateway/dist/web/server.js +63 -7
  53. package/node_modules/@buddi/gateway/dist/web/server.js.map +1 -1
  54. package/node_modules/@buddi/gateway/dist/web/version.d.ts +2 -0
  55. package/node_modules/@buddi/gateway/dist/web/version.d.ts.map +1 -1
  56. package/node_modules/@buddi/gateway/dist/web/version.js +5 -1
  57. package/node_modules/@buddi/gateway/dist/web/version.js.map +1 -1
  58. package/node_modules/@buddi/install/dist/.tsbuildinfo +1 -1
  59. package/node_modules/@buddi/install/dist/app-layout.d.ts +127 -0
  60. package/node_modules/@buddi/install/dist/app-layout.d.ts.map +1 -0
  61. package/node_modules/@buddi/install/dist/app-layout.js +323 -0
  62. package/node_modules/@buddi/install/dist/app-layout.js.map +1 -0
  63. package/node_modules/@buddi/install/dist/index.d.ts +1 -0
  64. package/node_modules/@buddi/install/dist/index.d.ts.map +1 -1
  65. package/node_modules/@buddi/install/dist/index.js +1 -0
  66. package/node_modules/@buddi/install/dist/index.js.map +1 -1
  67. package/node_modules/@buddi/install/dist/launcher.d.ts.map +1 -1
  68. package/node_modules/@buddi/install/dist/launcher.js +18 -4
  69. package/node_modules/@buddi/install/dist/launcher.js.map +1 -1
  70. package/node_modules/@buddi/install/dist/provenance.d.ts +34 -0
  71. package/node_modules/@buddi/install/dist/provenance.d.ts.map +1 -0
  72. package/node_modules/@buddi/install/dist/provenance.js +200 -0
  73. package/node_modules/@buddi/install/dist/provenance.js.map +1 -0
  74. package/node_modules/@buddi/install/dist/supervisor.d.ts.map +1 -1
  75. package/node_modules/@buddi/install/dist/supervisor.js +9 -4
  76. package/node_modules/@buddi/install/dist/supervisor.js.map +1 -1
  77. package/node_modules/@buddi/install/dist/upgrade.d.ts +77 -3
  78. package/node_modules/@buddi/install/dist/upgrade.d.ts.map +1 -1
  79. package/node_modules/@buddi/install/dist/upgrade.js +325 -43
  80. package/node_modules/@buddi/install/dist/upgrade.js.map +1 -1
  81. package/node_modules/@buddi/tool-browser/dist/.tsbuildinfo +1 -1
  82. package/node_modules/@buddi/tool-browser/dist/controller.d.ts +6 -0
  83. package/node_modules/@buddi/tool-browser/dist/controller.d.ts.map +1 -1
  84. package/node_modules/@buddi/tool-browser/dist/controller.js +80 -6
  85. package/node_modules/@buddi/tool-browser/dist/controller.js.map +1 -1
  86. package/node_modules/@buddi/tool-browser/dist/driver.d.ts +3 -1
  87. package/node_modules/@buddi/tool-browser/dist/driver.d.ts.map +1 -1
  88. package/node_modules/@buddi/tool-browser/dist/driver.js +82 -1
  89. package/node_modules/@buddi/tool-browser/dist/driver.js.map +1 -1
  90. package/node_modules/@buddi/tool-browser/dist/extension.d.ts +60 -7
  91. package/node_modules/@buddi/tool-browser/dist/extension.d.ts.map +1 -1
  92. package/node_modules/@buddi/tool-browser/dist/extension.js +90 -13
  93. package/node_modules/@buddi/tool-browser/dist/extension.js.map +1 -1
  94. package/node_modules/@buddi/tool-browser/dist/index.d.ts +6 -4
  95. package/node_modules/@buddi/tool-browser/dist/index.d.ts.map +1 -1
  96. package/node_modules/@buddi/tool-browser/dist/index.js +7 -4
  97. package/node_modules/@buddi/tool-browser/dist/index.js.map +1 -1
  98. package/node_modules/@buddi/tool-browser/dist/logins.d.ts +150 -0
  99. package/node_modules/@buddi/tool-browser/dist/logins.d.ts.map +1 -0
  100. package/node_modules/@buddi/tool-browser/dist/logins.js +476 -0
  101. package/node_modules/@buddi/tool-browser/dist/logins.js.map +1 -0
  102. package/node_modules/@buddi/tool-browser/dist/routes.d.ts +22 -1
  103. package/node_modules/@buddi/tool-browser/dist/routes.d.ts.map +1 -1
  104. package/node_modules/@buddi/tool-browser/dist/routes.js +51 -3
  105. package/node_modules/@buddi/tool-browser/dist/routes.js.map +1 -1
  106. package/node_modules/@buddi/tool-browser/dist/secrets.d.ts +3 -1
  107. package/node_modules/@buddi/tool-browser/dist/secrets.d.ts.map +1 -1
  108. package/node_modules/@buddi/tool-browser/dist/secrets.js +10 -6
  109. package/node_modules/@buddi/tool-browser/dist/secrets.js.map +1 -1
  110. package/node_modules/@buddi/tool-browser/dist/service.d.ts +26 -2
  111. package/node_modules/@buddi/tool-browser/dist/service.d.ts.map +1 -1
  112. package/node_modules/@buddi/tool-browser/dist/service.js +117 -3
  113. package/node_modules/@buddi/tool-browser/dist/service.js.map +1 -1
  114. package/node_modules/@buddi/tool-browser/dist/types.d.ts +88 -0
  115. package/node_modules/@buddi/tool-browser/dist/types.d.ts.map +1 -1
  116. package/node_modules/@buddi/tool-browser/dist/types.js +18 -0
  117. package/node_modules/@buddi/tool-browser/dist/types.js.map +1 -1
  118. package/node_modules/hono/dist/cjs/hono-base.js +2 -0
  119. package/node_modules/hono/dist/cjs/middleware/language/language.js +1 -1
  120. package/node_modules/hono/dist/cjs/middleware/mount/index.js +71 -0
  121. package/node_modules/hono/dist/cjs/request.js +4 -4
  122. package/node_modules/hono/dist/hono-base.js +2 -0
  123. package/node_modules/hono/dist/middleware/mount/index.js +70 -0
  124. package/node_modules/hono/dist/request.js +4 -4
  125. package/node_modules/hono/dist/types/hono-base.d.ts +2 -0
  126. package/node_modules/hono/dist/types/jsx/base.d.ts +1 -1
  127. package/node_modules/hono/dist/types/middleware/mount/index.d.ts +46 -0
  128. package/node_modules/hono/dist/types/request.d.ts +4 -4
  129. package/node_modules/hono/package.json +9 -1
  130. package/package.json +2 -2
  131. package/packages/cli/dist/.tsbuildinfo +1 -1
  132. package/packages/cli/dist/access-cmd.d.ts +1 -1
  133. package/packages/cli/dist/access-cmd.d.ts.map +1 -1
  134. package/packages/cli/dist/access-cmd.js +23 -3
  135. package/packages/cli/dist/access-cmd.js.map +1 -1
  136. package/packages/cli/dist/args.d.ts +2 -2
  137. package/packages/cli/dist/args.d.ts.map +1 -1
  138. package/packages/cli/dist/args.js +7 -2
  139. package/packages/cli/dist/args.js.map +1 -1
  140. package/packages/cli/dist/commands.d.ts.map +1 -1
  141. package/packages/cli/dist/commands.js +11 -0
  142. package/packages/cli/dist/commands.js.map +1 -1
  143. package/packages/cli/dist/main.d.ts.map +1 -1
  144. package/packages/cli/dist/main.js +2 -1
  145. package/packages/cli/dist/main.js.map +1 -1
  146. package/packages/gateway/dist/.tsbuildinfo +1 -1
  147. package/packages/gateway/dist/missions/ask-cap.d.ts +26 -0
  148. package/packages/gateway/dist/missions/ask-cap.d.ts.map +1 -0
  149. package/packages/gateway/dist/missions/ask-cap.js +83 -0
  150. package/packages/gateway/dist/missions/ask-cap.js.map +1 -0
  151. package/packages/gateway/dist/missions/execute.d.ts +12 -1
  152. package/packages/gateway/dist/missions/execute.d.ts.map +1 -1
  153. package/packages/gateway/dist/missions/execute.js +73 -11
  154. package/packages/gateway/dist/missions/execute.js.map +1 -1
  155. package/packages/gateway/dist/missions/parked.d.ts +6 -0
  156. package/packages/gateway/dist/missions/parked.d.ts.map +1 -1
  157. package/packages/gateway/dist/missions/parked.js +7 -1
  158. package/packages/gateway/dist/missions/parked.js.map +1 -1
  159. package/packages/gateway/dist/serve.js +1 -1
  160. package/packages/gateway/dist/serve.js.map +1 -1
  161. package/packages/gateway/dist/system-context.d.ts +7 -0
  162. package/packages/gateway/dist/system-context.d.ts.map +1 -1
  163. package/packages/gateway/dist/system-context.js +8 -0
  164. package/packages/gateway/dist/system-context.js.map +1 -1
  165. package/packages/gateway/dist/web/api-routes.d.ts.map +1 -1
  166. package/packages/gateway/dist/web/api-routes.js +11 -3
  167. package/packages/gateway/dist/web/api-routes.js.map +1 -1
  168. package/packages/gateway/dist/web/extension.d.ts +13 -1
  169. package/packages/gateway/dist/web/extension.d.ts.map +1 -1
  170. package/packages/gateway/dist/web/extension.js +125 -5
  171. package/packages/gateway/dist/web/extension.js.map +1 -1
  172. package/packages/gateway/dist/web/remote-hand.d.ts.map +1 -1
  173. package/packages/gateway/dist/web/remote-hand.js +45 -2
  174. package/packages/gateway/dist/web/remote-hand.js.map +1 -1
  175. package/packages/gateway/dist/web/secrets.d.ts +26 -1
  176. package/packages/gateway/dist/web/secrets.d.ts.map +1 -1
  177. package/packages/gateway/dist/web/secrets.js +66 -3
  178. package/packages/gateway/dist/web/secrets.js.map +1 -1
  179. package/packages/gateway/dist/web/server.d.ts.map +1 -1
  180. package/packages/gateway/dist/web/server.js +63 -7
  181. package/packages/gateway/dist/web/server.js.map +1 -1
  182. package/packages/gateway/dist/web/version.d.ts +2 -0
  183. package/packages/gateway/dist/web/version.d.ts.map +1 -1
  184. package/packages/gateway/dist/web/version.js +5 -1
  185. package/packages/gateway/dist/web/version.js.map +1 -1
  186. package/packages/install/dist/.tsbuildinfo +1 -1
  187. package/packages/install/dist/app-layout.d.ts +127 -0
  188. package/packages/install/dist/app-layout.d.ts.map +1 -0
  189. package/packages/install/dist/app-layout.js +323 -0
  190. package/packages/install/dist/app-layout.js.map +1 -0
  191. package/packages/install/dist/index.d.ts +1 -0
  192. package/packages/install/dist/index.d.ts.map +1 -1
  193. package/packages/install/dist/index.js +1 -0
  194. package/packages/install/dist/index.js.map +1 -1
  195. package/packages/install/dist/launcher.d.ts.map +1 -1
  196. package/packages/install/dist/launcher.js +18 -4
  197. package/packages/install/dist/launcher.js.map +1 -1
  198. package/packages/install/dist/provenance.d.ts +34 -0
  199. package/packages/install/dist/provenance.d.ts.map +1 -0
  200. package/packages/install/dist/provenance.js +200 -0
  201. package/packages/install/dist/provenance.js.map +1 -0
  202. package/packages/install/dist/supervisor.d.ts.map +1 -1
  203. package/packages/install/dist/supervisor.js +9 -4
  204. package/packages/install/dist/supervisor.js.map +1 -1
  205. package/packages/install/dist/upgrade.d.ts +77 -3
  206. package/packages/install/dist/upgrade.d.ts.map +1 -1
  207. package/packages/install/dist/upgrade.js +325 -43
  208. package/packages/install/dist/upgrade.js.map +1 -1
  209. package/packages/tools/browser/dist/.tsbuildinfo +1 -1
  210. package/packages/tools/browser/dist/controller.d.ts +6 -0
  211. package/packages/tools/browser/dist/controller.d.ts.map +1 -1
  212. package/packages/tools/browser/dist/controller.js +80 -6
  213. package/packages/tools/browser/dist/controller.js.map +1 -1
  214. package/packages/tools/browser/dist/driver.d.ts +3 -1
  215. package/packages/tools/browser/dist/driver.d.ts.map +1 -1
  216. package/packages/tools/browser/dist/driver.js +82 -1
  217. package/packages/tools/browser/dist/driver.js.map +1 -1
  218. package/packages/tools/browser/dist/extension.d.ts +60 -7
  219. package/packages/tools/browser/dist/extension.d.ts.map +1 -1
  220. package/packages/tools/browser/dist/extension.js +90 -13
  221. package/packages/tools/browser/dist/extension.js.map +1 -1
  222. package/packages/tools/browser/dist/index.d.ts +6 -4
  223. package/packages/tools/browser/dist/index.d.ts.map +1 -1
  224. package/packages/tools/browser/dist/index.js +7 -4
  225. package/packages/tools/browser/dist/index.js.map +1 -1
  226. package/packages/tools/browser/dist/logins.d.ts +150 -0
  227. package/packages/tools/browser/dist/logins.d.ts.map +1 -0
  228. package/packages/tools/browser/dist/logins.js +476 -0
  229. package/packages/tools/browser/dist/logins.js.map +1 -0
  230. package/packages/tools/browser/dist/routes.d.ts +22 -1
  231. package/packages/tools/browser/dist/routes.d.ts.map +1 -1
  232. package/packages/tools/browser/dist/routes.js +51 -3
  233. package/packages/tools/browser/dist/routes.js.map +1 -1
  234. package/packages/tools/browser/dist/secrets.d.ts +3 -1
  235. package/packages/tools/browser/dist/secrets.d.ts.map +1 -1
  236. package/packages/tools/browser/dist/secrets.js +10 -6
  237. package/packages/tools/browser/dist/secrets.js.map +1 -1
  238. package/packages/tools/browser/dist/service.d.ts +26 -2
  239. package/packages/tools/browser/dist/service.d.ts.map +1 -1
  240. package/packages/tools/browser/dist/service.js +117 -3
  241. package/packages/tools/browser/dist/service.js.map +1 -1
  242. package/packages/tools/browser/dist/types.d.ts +88 -0
  243. package/packages/tools/browser/dist/types.d.ts.map +1 -1
  244. package/packages/tools/browser/dist/types.js +18 -0
  245. package/packages/tools/browser/dist/types.js.map +1 -1
  246. package/packages/web/dist/assets/index-DYfeUW-0.css +1 -0
  247. package/packages/web/dist/assets/index-vpc904_b.js +146 -0
  248. package/packages/web/dist/assets/{lottie_light-CuiSMqnl.js → lottie_light-BFAMYgLA.js} +1 -1
  249. package/packages/web/dist/build.json +1 -1
  250. package/packages/web/dist/index.html +2 -2
  251. package/packages/web/dist/precache.json +4 -4
  252. package/packages/web/dist/assets/index-Bac-CdD-.css +0 -1
  253. package/packages/web/dist/assets/index-DI8bp_D7.js +0 -146
@@ -0,0 +1,71 @@
1
+ Object.defineProperty(exports, Symbol.toStringTag, { value: "Module" });
2
+ const require_helper_route_index = require("../../helper/route/index.js");
3
+ //#region src/middleware/mount/index.ts
4
+ const defaultReplaceRequest = (c) => {
5
+ const pathPrefix = require_helper_route_index.routePath(c).replace(/\/\*$/, "");
6
+ const url = new URL(c.req.raw.url);
7
+ url.pathname = c.req.path.slice(pathPrefix.length) || "/";
8
+ return new Request(url, c.req.raw);
9
+ };
10
+ const defaultGetOptions = (c) => {
11
+ let executionContext = void 0;
12
+ try {
13
+ executionContext = c.executionCtx;
14
+ } catch {}
15
+ return [c.env, executionContext];
16
+ };
17
+ /**
18
+ * `mount()` allows you to mount applications built with other frameworks into your Hono application.
19
+ *
20
+ * @see {@link https://hono.dev/docs/api/hono#mount}
21
+ *
22
+ * @param {Function} applicationHandler - other Request Handler
23
+ * @param {MountOptions} [options] - options of `mount()`
24
+ * @returns {MiddlewareHandler} handler to register with `app.all()`
25
+ *
26
+ * @example
27
+ * ```ts
28
+ * import { Router as IttyRouter } from 'itty-router'
29
+ * import { Hono } from 'hono'
30
+ * import { mount } from 'hono/mount'
31
+ * // Create itty-router application
32
+ * const ittyRouter = IttyRouter()
33
+ * // GET /itty-router/hello
34
+ * ittyRouter.get('/hello', () => new Response('Hello from itty-router'))
35
+ *
36
+ * const app = new Hono()
37
+ * app.all('/itty-router/*', mount(ittyRouter.handle))
38
+ * ```
39
+ *
40
+ * @example
41
+ * ```ts
42
+ * const app = new Hono()
43
+ * // Send the request to another application without modification.
44
+ * app.all('/app/*', mount(anotherApp, {
45
+ * replaceRequest: (req) => req,
46
+ * }))
47
+ * ```
48
+ */
49
+ const mount = (applicationHandler, options) => {
50
+ let replaceRequest;
51
+ let optionHandler;
52
+ if (options) {
53
+ if (typeof options === "function") optionHandler = options;
54
+ else {
55
+ optionHandler = options.optionHandler;
56
+ if (options.replaceRequest === false) replaceRequest = (request) => request;
57
+ else replaceRequest = options.replaceRequest;
58
+ }
59
+ }
60
+ const getOptions = optionHandler ? (c) => {
61
+ const options = optionHandler(c);
62
+ return Array.isArray(options) ? options : [options];
63
+ } : defaultGetOptions;
64
+ return async (c, next) => {
65
+ const res = await applicationHandler(replaceRequest ? replaceRequest(c.req.raw) : defaultReplaceRequest(c), ...getOptions(c));
66
+ if (res) return res;
67
+ await next();
68
+ };
69
+ };
70
+ //#endregion
71
+ exports.mount = mount;
@@ -189,7 +189,7 @@ var HonoRequest = class {
189
189
  return this.#validatedData?.[target];
190
190
  }
191
191
  /**
192
- * `.url()` can get the request url strings.
192
+ * `.url` can get the request url strings.
193
193
  *
194
194
  * @see {@link https://hono.dev/docs/api/request#url}
195
195
  *
@@ -205,7 +205,7 @@ var HonoRequest = class {
205
205
  return this.raw.url;
206
206
  }
207
207
  /**
208
- * `.method()` can get the method name of the request.
208
+ * `.method` can get the method name of the request.
209
209
  *
210
210
  * @see {@link https://hono.dev/docs/api/request#method}
211
211
  *
@@ -223,7 +223,7 @@ var HonoRequest = class {
223
223
  return this.#matchResult;
224
224
  }
225
225
  /**
226
- * `.matchedRoutes()` can return a matched route in the handler
226
+ * `.matchedRoutes` can return a matched route in the handler
227
227
  *
228
228
  * @deprecated
229
229
  *
@@ -253,7 +253,7 @@ var HonoRequest = class {
253
253
  return this.#matchResult[0].map(([[, route]]) => route);
254
254
  }
255
255
  /**
256
- * `routePath()` can retrieve the path registered within the handler
256
+ * `.routePath` can retrieve the path registered within the handler
257
257
  *
258
258
  * @deprecated
259
259
  *
@@ -175,6 +175,8 @@ var Hono = class Hono {
175
175
  /**
176
176
  * `.mount()` allows you to mount applications built with other frameworks into your Hono application.
177
177
  *
178
+ * @deprecated Use `mount()` from `hono/mount` instead. `.mount()` will be removed in v5.
179
+ *
178
180
  * @see {@link https://hono.dev/docs/api/hono#mount}
179
181
  *
180
182
  * @param {string} path - base Path
@@ -0,0 +1,70 @@
1
+ import { routePath } from "../../helper/route/index.js";
2
+ //#region src/middleware/mount/index.ts
3
+ const defaultReplaceRequest = (c) => {
4
+ const pathPrefix = routePath(c).replace(/\/\*$/, "");
5
+ const url = new URL(c.req.raw.url);
6
+ url.pathname = c.req.path.slice(pathPrefix.length) || "/";
7
+ return new Request(url, c.req.raw);
8
+ };
9
+ const defaultGetOptions = (c) => {
10
+ let executionContext = void 0;
11
+ try {
12
+ executionContext = c.executionCtx;
13
+ } catch {}
14
+ return [c.env, executionContext];
15
+ };
16
+ /**
17
+ * `mount()` allows you to mount applications built with other frameworks into your Hono application.
18
+ *
19
+ * @see {@link https://hono.dev/docs/api/hono#mount}
20
+ *
21
+ * @param {Function} applicationHandler - other Request Handler
22
+ * @param {MountOptions} [options] - options of `mount()`
23
+ * @returns {MiddlewareHandler} handler to register with `app.all()`
24
+ *
25
+ * @example
26
+ * ```ts
27
+ * import { Router as IttyRouter } from 'itty-router'
28
+ * import { Hono } from 'hono'
29
+ * import { mount } from 'hono/mount'
30
+ * // Create itty-router application
31
+ * const ittyRouter = IttyRouter()
32
+ * // GET /itty-router/hello
33
+ * ittyRouter.get('/hello', () => new Response('Hello from itty-router'))
34
+ *
35
+ * const app = new Hono()
36
+ * app.all('/itty-router/*', mount(ittyRouter.handle))
37
+ * ```
38
+ *
39
+ * @example
40
+ * ```ts
41
+ * const app = new Hono()
42
+ * // Send the request to another application without modification.
43
+ * app.all('/app/*', mount(anotherApp, {
44
+ * replaceRequest: (req) => req,
45
+ * }))
46
+ * ```
47
+ */
48
+ const mount = (applicationHandler, options) => {
49
+ let replaceRequest;
50
+ let optionHandler;
51
+ if (options) {
52
+ if (typeof options === "function") optionHandler = options;
53
+ else {
54
+ optionHandler = options.optionHandler;
55
+ if (options.replaceRequest === false) replaceRequest = (request) => request;
56
+ else replaceRequest = options.replaceRequest;
57
+ }
58
+ }
59
+ const getOptions = optionHandler ? (c) => {
60
+ const options = optionHandler(c);
61
+ return Array.isArray(options) ? options : [options];
62
+ } : defaultGetOptions;
63
+ return async (c, next) => {
64
+ const res = await applicationHandler(replaceRequest ? replaceRequest(c.req.raw) : defaultReplaceRequest(c), ...getOptions(c));
65
+ if (res) return res;
66
+ await next();
67
+ };
68
+ };
69
+ //#endregion
70
+ export { mount };
@@ -188,7 +188,7 @@ var HonoRequest = class {
188
188
  return this.#validatedData?.[target];
189
189
  }
190
190
  /**
191
- * `.url()` can get the request url strings.
191
+ * `.url` can get the request url strings.
192
192
  *
193
193
  * @see {@link https://hono.dev/docs/api/request#url}
194
194
  *
@@ -204,7 +204,7 @@ var HonoRequest = class {
204
204
  return this.raw.url;
205
205
  }
206
206
  /**
207
- * `.method()` can get the method name of the request.
207
+ * `.method` can get the method name of the request.
208
208
  *
209
209
  * @see {@link https://hono.dev/docs/api/request#method}
210
210
  *
@@ -222,7 +222,7 @@ var HonoRequest = class {
222
222
  return this.#matchResult;
223
223
  }
224
224
  /**
225
- * `.matchedRoutes()` can return a matched route in the handler
225
+ * `.matchedRoutes` can return a matched route in the handler
226
226
  *
227
227
  * @deprecated
228
228
  *
@@ -252,7 +252,7 @@ var HonoRequest = class {
252
252
  return this.#matchResult[0].map(([[, route]]) => route);
253
253
  }
254
254
  /**
255
- * `routePath()` can retrieve the path registered within the handler
255
+ * `.routePath` can retrieve the path registered within the handler
256
256
  *
257
257
  * @deprecated
258
258
  *
@@ -140,6 +140,8 @@ declare class Hono<E extends Env = Env, S extends Schema = {}, BasePath extends
140
140
  /**
141
141
  * `.mount()` allows you to mount applications built with other frameworks into your Hono application.
142
142
  *
143
+ * @deprecated Use `mount()` from `hono/mount` instead. `.mount()` will be removed in v5.
144
+ *
143
145
  * @see {@link https://hono.dev/docs/api/hono#mount}
144
146
  *
145
147
  * @param {string} path - base Path
@@ -4,7 +4,7 @@ import { JSX as JSX$1 } from "./intrinsic-elements.js";
4
4
  import { Context } from "./context.js";
5
5
  //#region src/jsx/base.d.ts
6
6
  export type Props = Record<string, any>;
7
- type FunctionComponentResult = HtmlEscapedString | Child[] | Promise<HtmlEscapedString | Child[]> | null;
7
+ type FunctionComponentResult = HtmlEscapedString | JSXNode | Child[] | Promise<HtmlEscapedString | JSXNode | Child[]> | null;
8
8
  export type FC<P = Props> = {
9
9
  (props: P): FunctionComponentResult;
10
10
  defaultProps?: Partial<P> | undefined;
@@ -0,0 +1,46 @@
1
+ import { MiddlewareHandler } from "../../types.js";
2
+ import { Context } from "../../context.js";
3
+ //#region src/middleware/mount/index.d.ts
4
+ type ApplicationHandler = (request: Request, ...args: any) => Response | Promise<Response>;
5
+ type MountOptionHandler = (c: Context) => unknown;
6
+ type MountReplaceRequest = (originalRequest: Request) => Request;
7
+ type MountOptions = MountOptionHandler | {
8
+ optionHandler?: MountOptionHandler;
9
+ replaceRequest?: MountReplaceRequest | false;
10
+ };
11
+ /**
12
+ * `mount()` allows you to mount applications built with other frameworks into your Hono application.
13
+ *
14
+ * @see {@link https://hono.dev/docs/api/hono#mount}
15
+ *
16
+ * @param {Function} applicationHandler - other Request Handler
17
+ * @param {MountOptions} [options] - options of `mount()`
18
+ * @returns {MiddlewareHandler} handler to register with `app.all()`
19
+ *
20
+ * @example
21
+ * ```ts
22
+ * import { Router as IttyRouter } from 'itty-router'
23
+ * import { Hono } from 'hono'
24
+ * import { mount } from 'hono/mount'
25
+ * // Create itty-router application
26
+ * const ittyRouter = IttyRouter()
27
+ * // GET /itty-router/hello
28
+ * ittyRouter.get('/hello', () => new Response('Hello from itty-router'))
29
+ *
30
+ * const app = new Hono()
31
+ * app.all('/itty-router/*', mount(ittyRouter.handle))
32
+ * ```
33
+ *
34
+ * @example
35
+ * ```ts
36
+ * const app = new Hono()
37
+ * // Send the request to another application without modification.
38
+ * app.all('/app/*', mount(anotherApp, {
39
+ * replaceRequest: (req) => req,
40
+ * }))
41
+ * ```
42
+ */
43
+ export declare const mount: (applicationHandler: ApplicationHandler, options?: MountOptions) => MiddlewareHandler;
44
+ //#endregion
45
+ export type { ApplicationHandler, MountOptionHandler, MountOptions, MountReplaceRequest };
46
+ export {};
@@ -217,7 +217,7 @@ export declare class HonoRequest<P extends string = '/', I extends Input['out']
217
217
  */
218
218
  valid<T extends keyof I & keyof ValidationTargets>(target: T): InputToDataByTarget<I, T>;
219
219
  /**
220
- * `.url()` can get the request url strings.
220
+ * `.url` can get the request url strings.
221
221
  *
222
222
  * @see {@link https://hono.dev/docs/api/request#url}
223
223
  *
@@ -231,7 +231,7 @@ export declare class HonoRequest<P extends string = '/', I extends Input['out']
231
231
  */
232
232
  get url(): string;
233
233
  /**
234
- * `.method()` can get the method name of the request.
234
+ * `.method` can get the method name of the request.
235
235
  *
236
236
  * @see {@link https://hono.dev/docs/api/request#method}
237
237
  *
@@ -245,7 +245,7 @@ export declare class HonoRequest<P extends string = '/', I extends Input['out']
245
245
  get method(): string;
246
246
  get [GET_MATCH_RESULT](): Result<[unknown, RouterRoute]>;
247
247
  /**
248
- * `.matchedRoutes()` can return a matched route in the handler
248
+ * `.matchedRoutes` can return a matched route in the handler
249
249
  *
250
250
  * @deprecated
251
251
  *
@@ -273,7 +273,7 @@ export declare class HonoRequest<P extends string = '/', I extends Input['out']
273
273
  */
274
274
  get matchedRoutes(): RouterRoute[];
275
275
  /**
276
- * `routePath()` can retrieve the path registered within the handler
276
+ * `.routePath` can retrieve the path registered within the handler
277
277
  *
278
278
  * @deprecated
279
279
  *
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "hono",
3
- "version": "4.13.12",
3
+ "version": "4.13.13",
4
4
  "description": "Web framework built on Web Standards",
5
5
  "main": "dist/cjs/index.js",
6
6
  "type": "module",
@@ -103,6 +103,11 @@
103
103
  "import": "./dist/helper/route/index.js",
104
104
  "require": "./dist/cjs/helper/route/index.js"
105
105
  },
106
+ "./mount": {
107
+ "types": "./dist/types/middleware/mount/index.d.ts",
108
+ "import": "./dist/middleware/mount/index.js",
109
+ "require": "./dist/cjs/middleware/mount/index.js"
110
+ },
106
111
  "./cookie": {
107
112
  "types": "./dist/types/helper/cookie/index.d.ts",
108
113
  "import": "./dist/helper/cookie/index.js",
@@ -457,6 +462,9 @@
457
462
  "route": [
458
463
  "./dist/types/helper/route"
459
464
  ],
465
+ "mount": [
466
+ "./dist/types/middleware/mount"
467
+ ],
460
468
  "cookie": [
461
469
  "./dist/types/helper/cookie"
462
470
  ],
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@withbuddi/buddi",
3
- "version": "0.1.0-pre.38",
3
+ "version": "0.1.0-pre.39",
4
4
  "type": "module",
5
5
  "description": "Your personal agents, on your computer",
6
6
  "repository": {
@@ -17,7 +17,7 @@
17
17
  "buddi": "packages/install/dist/launcher.js"
18
18
  },
19
19
  "buddi": {
20
- "notes": "- Development: the web test suite runs in a fifth of the time (nwsapi pinned to 2.2.28; its older versions recursed on every menu open under jsdom), which also unsticks the release gate.\n- Cloudflare setup: after the token is checked, type just the name and pick the domain from your Cloudflare zones; the full hostname is still accepted when the token lists none.\n- Cloudflare setup: the Done line says Cloudflare needs a minute or two before the first sign-in works, and to reload if its page can’t find the application.\n- Trusted access: the Cloudflare \"Open Cloudflare\" button opens the token form pre-filled with the four permissions buddi needs (Cloudflare template URL); the owner names and creates the token, then pastes it.\n\n### Added\n\n- Sign in from your own domain through Cloudflare: Settings → System → Sign in from elsewhere → Cloudflare Access walks you through a Cloudflare Tunnel with Cloudflare Access in front (install cloudflared, create the tunnel, point a hostname at the port the panel prints, add an Access application for your email, paste the team domain and AUD tag), with Test my setup and a status line. buddi verifies Access's signed JWT itself on every request — signature against your team's keys, issuer, audience, expiry, your email — never trusts a plain header, and gives the same remote session as Tailscale (12 hours idle, CSRF, approvals, the lock screen). cloudflared points at a separate loopback port that is always treated as a visit from elsewhere, and failed sign-ins there — a stale cookie, or an Access assertion that doesn't verify, counted per visitor address — are counted apart from this computer's and your tailnet's. `buddi doctor` has a `cloudflare access` row.\n- `buddi doctor browser` and `GET /api/browser/telemetry`: the last week's browser stops by cause, cards and routes, so flakiness can be seen to fall; `buddi doctor` has a browser line too.\n- Missions can browse while you are away, in buddi's own browser only (never your Chrome or apps), when their catalogue package says `\"browser\": \"own\"`; the install card says so. When a mission meets a sign-in, a human check, an uncertain click or its budget, it waits for you with the same card, sent to Telegram with its buttons and held on Home and Needs you; your answer carries the run on where it stopped (an answer given the moment the card arrives counts too; Take over makes the run wait until you give the page back, then it carries on), and with no answer within an hour (`missionWaitMinutes` in the browser settings) it stops and tells you in one line. Browser telemetry rows mark mission runs.\n- A colleague an agent asks for help may use the browser too, but only when you are in the asking conversation and a page is already open there; a mission's colleague never does.\n- Plugins can provide the apps route (host API 1.29: `routes` in the manifest, with health and look/do handlers, plus `reach` for the owner's list of apps, take-over without a remote hand, and native typing for `secret.type`). Tools may stop a run on a result that needs the owner (`waitsForOwner` as a function), declare their own budget (`ownBudget`), and put one card in front of the owner (`ctx.ask`).\n- Cloudflare Access can set itself up: Set it up for me (or `buddi access cloudflare setup --host <hostname>`) takes one Cloudflare API token, kept as an owner secret, and makes the tunnel, its route to this computer, the DNS record and the Access application with an Allow policy for your email, fills in the settings, shows the one `sudo cloudflared service install …` line to run (buddi never runs sudo), waits for the tunnel to connect and tests it. Running it again reuses what it made, by the ids it recorded; something of buddi's name it didn't make stops the run with Use it anyway (`--adopt`) instead of being taken silently; one setup or removal runs at a time, and a setup for another hostname waits until what buddi made for the first is removed; a missing token permission is named; Remove what buddi made (or `buddi access cloudflare remove`) deletes only the objects buddi recorded making. The install line only ever holds a well-formed connector token.\n\n### Changed\n\n- The Cloudflare Access form says what is missing in a plain line until you try to turn it on, and its row no longer says Needs setup while it is off.\n- Tailscale sign-in is now one row of Settings → System → Sign in from elsewhere, beside Cloudflare Access; the panel, its `tailscale serve` line and how it checks you are unchanged, and existing Tailscale sessions carry over. `GET/PUT /api/tailscale` stay for one release as aliases of `/api/access/tailscale`.\n- The browser picks where to look for you instead of asking you to pick a mode: buddi's own browser for every page, in the background (headless, seen on the Canvas); your Chrome for sites that need your sign-in, in background tabs, when you allow it and it is connected; your apps only for app jobs. When a route is not there it falls back without stopping, and the chat says one line when the page was not in buddi's own browser (\"I used your Chrome because Amazon needs your sign-in.\"). A login wall in buddi's browser moves to your Chrome when it can, unless the conversation, the agent or your default keeps it in buddi's browser (then the card offers Use my Chrome instead), and the site is remembered.\n- Settings → Computer & browser is now **Where agents may look**: one row per route instead of mode radios — buddi's own browser (always on; ready, Install · 150 MB, the Linux sandbox command to copy, installing), your Chrome (a switch once paired, connected or Chrome closed, Add to Chrome, the pairing code read from the extension in that browser so it pairs by itself, Pair again when Chrome forgot the pairing, Forget this Chrome; the sites that need your sign-in, yours and the ones buddi added itself, outlined dashed, each removable), your apps only when a plugin provides them (its health and fix, a switch, Settings › to the plugin's own page), a warning with Resume while a Stop holds, and Advanced: the first choice for every agent, the agents with their own rule, the sites that need your sign-in, how long Stop lasts, pages open at once, and showing buddi's browser as a window. No lock while a page is open. Your old choice is carried over: Your browser keeps your Chrome on; Use my apps keeps your apps on (and your Chrome when it is paired). A conversation can be pinned to a route (Use my Chrome under the composer, once your Chrome is paired), an agent too (its page → Tools → Where it may look, written as `browser:` in its agent.md), and Settings keeps a default.\n- Browser stops: you are asked on four occasions only, with one card in the chat, the corner chat and Telegram (one photo, then buttons): \"I’m not sure that went through. Look?\" (Carry on · Look), \"Keep going?\" (Stop here · Keep going), \"Amazon needs your sign-in\" (Save a login for next time · Use my Chrome · Take over) and \"This page asks for a human\" (Skip this site · Take over), each with one line of why; while a Stop holds, \"Browsing is paused since 10:12\" (Keep paused · Resume). A slow page, a stale target, a redirect or a closed tab is retried inside the tool, and every action returns the page as it is after it, so agents no longer \"observe again\" or wait for a paused page.\n- Budgets are 200 actions and an hour per task, renewed by any message or card tap of yours in that conversation, and browser steps no longer use up the agent's turns. Several agents can look at once: three own-browser pages by default (a fourth waits its turn; a page waiting on a card for you doesn't count), several Chrome tabs with one agent per site at a time, one page in your hands and one app job at a time.\n- Stop agents' browsing now expires after an hour (a setting; or until you say), and while it holds an agent shows one card with Resume instead of telling you to visit Settings. A Stop left from before is lifted an hour after it was pressed.\n\n…"
20
+ "notes": "- Logins: signing in again with a new password on a site where buddi keeps your login asks \"Update the login for amazon.com?\"; Update replaces the password it keeps. Signing in with the password it already keeps asks nothing, also after a restart and in your Chrome (a login saved before this release is asked about once). Saving two accounts on one site at once keeps both.\n- Logins: Save says \"Saved\" for two seconds once the login is really kept, or why it couldn't be kept with Try again — in the Page tab and in your Chrome's bar. In your Chrome the question survives the sign-in page moving on (a redirect to another page of the same site asks again there), and a Save pressed just after Give it back still counts.\n- Missions: a mission asks you one question at a time; asking the same unanswered question again within a day doesn't interrupt you (it leaves one quiet line under Needs you), and the \"needed you\" line for the same question is sent once a day at most.\n- Missions: when a mission running while you're away gets stuck, it asks you once on Telegram (with its choices as buttons) and carries on with your answer, instead of ending without a word; no answer within the wait (an hour by default) and you get one line saying it needed you.\n- buddi.app for Mac: an app that runs buddi with nothing to install, now a real app window with menus: the dashboard in its own window (first run and the lock screen included), a dock icon, the standard macOS menu bar (New Conversation, Settings, Lock, Find, Zoom, Check for Updates), microphone, downloads and native notifications, and the menu-bar glyph for status; first build, not yet distributed.\n- Logins: when you take over a page and sign in, buddi offers to keep that login for next time — \"Save this login for amazon.com?\" with Save, Not now and Never for this site, above the page in the Page tab, or in the \"buddi is waiting\" bar in your Chrome. Save keeps it under Settings → Keys and secrets (\"Login · amazon.com · for sam@… · saved 3 Oct\", with Remove), and agents sign in there with it without ever seeing the password; no agent, chat or log sees it. Your Chrome needs the extension from this release.\n- buddi.app for Mac: buddi updates itself from inside the app (Settings → System or \"Update to …\" in the menu): the new version is checked against npm's integrity hash and its signed provenance, tested, and only then switched to, with the version before kept; Advanced → Restart with the Previous Version goes back to it. Each release now builds a signed, notarized DMG for withbuddi.com once the signing keys are in place.\n- Chat: the round Send button is back at the right of the composer when Use my Chrome sits beside the model and Thinking; in a narrow box (the corner chat, a squeezed column) the model chip steps aside and the chip says just \"Chrome\".\n- Your Chrome: a page opens in an ordinary Chrome window, in the background, even when the window you last used is a popup or an installed app; when Chrome won't group the tab there, the page still opens (the \"buddi\" group is skipped), and with no ordinary window it opens in a new one that doesn't take the focus, with one line in the chat saying so.\n- Your Chrome: when the page opened and a later step failed, the agent gets the page and \"opened, then this failed\" instead of \"I couldn't open it\"; the same failure twice in a row is said plainly once rather than tried a third time.\n- Page tab: the page sits in a small browser window, with back, forward, reload and the address on a bar above it. While the agent drives, the bar is there but asleep and a click on the address copies it; a thin line along the bar shows a page loading.\n- Page tab: while you have the page in buddi's browser, back, forward and reload work, and you can type an address and press Enter to go there (the same sites the agent may visit; file and internal addresses are refused). The address follows the links you click.\n- Page tab: an Enlarge button beside Stop / Take over (and \"Open the full page view\" under ⋯) opens the page over the whole window with the same header; Esc or the button brings it back.\n- Page tab: the Keyboard button only shows on a phone, where it says \"Type into the page\"; on a computer, click the page and type.\n- Page tab: your pointer on the page is an arrow, not a crosshair.\n- Page tab: after reloading the dashboard while you have the page, clicks and typing reach it again straight away, without pressing Drive it here (on a computer; a phone still asks).\n- Your Chrome: Take over on a page in your Chrome brings its tab to the front of Chrome instead of waiting for a picture that never came; the bar in the tab says \"buddi is waiting\" with Give it back, and Give it back there or in the Canvas lets the agent carry on in that tab. Needs the extension from this release.\n- Your Chrome: when you asked for your Chrome (the Use my Chrome pin, the agent's setting, or the task) and buddi couldn't use it, the reply says why in one line: not connected to this buddi, not open right now, or turned off for agents in Settings.\n- A page that shows up signed out where the task needs your account (an Amazon cart saying \"Sign in to your account\") now asks with the \"needs your sign-in\" card, or moves to your Chrome where you're signed in, instead of the agent asking you in chat; a news front page with a Sign in link is left alone. Google's sign-in page under the title \"Gmail\" is now recognised as a sign-in page too.\n- Agents answer a list of items from a website (a cart, orders, search results) as a short list, one line per item, instead of a wide table; a table only when you ask for a comparison.\n- Lock screen: the widgets keep refreshing while it's locked, even in a tab in the back, and catch up the moment you look at it again; a slow answer can no longer put older headlines back over newer ones.\n- Settings → System: a version npm has just published but isn't serving yet is no longer offered; the panel says \"npm is still processing 0.1.0-pre.N; try again in a few minutes\" with no Upgrade button, and an upgrade that still runs into npm's 404 for buddi's own tarball says that same sentence instead of npm's output. A registry or mirror that needs your npm credentials (it gets the ones in your ~/.npmrc) or refuses the check is never mistaken for one still processing, and any other npm failure is shown in npm's own words, with credentials masked.\n- Cloudflare setup: after \"Remove what buddi made\", the panel says your Cloudflare API token is still kept here and still valid in Cloudflare, with a \"Forget the token\" button and where to revoke it (My Profile → API Tokens); Remove no longer drops the token on its own, so setting it up again doesn't ask for it. From the terminal: `buddi access cloudflare forget-token`."
21
21
  },
22
22
  "files": [
23
23
  "packages",