@suveren/gateway 0.3.17 → 0.4.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 (257) hide show
  1. package/bin/suveren-gateway.js +419 -28
  2. package/content/integrations/calendar.json +20 -8
  3. package/content/integrations/crm.json +97 -23
  4. package/content/integrations/gmail.json +166 -29
  5. package/content/integrations/linkedin.json +15 -3
  6. package/content/integrations/mollie.json +2 -2
  7. package/dist/control-plane/index.mjs +341 -42
  8. package/dist/mcp-server/http.mjs +880 -210
  9. package/dist/ui/assets/index-Cog54HOo.js +105 -0
  10. package/dist/ui/assets/{index-DOt3SNnl.css → index-JHaCddDE.css} +1 -1
  11. package/dist/ui/index.html +2 -2
  12. package/lib/autostart-templates.d.mts +37 -0
  13. package/lib/autostart-templates.mjs +208 -0
  14. package/node_modules/@hap/core/dist/index.d.mts +27 -0
  15. package/node_modules/@hap/core/dist/index.d.ts +27 -0
  16. package/node_modules/@hap/core/dist/index.js +13 -1
  17. package/node_modules/@hap/core/dist/index.mjs +13 -1
  18. package/node_modules/@hap/core/package.json +1 -1
  19. package/node_modules/@hap/core/src/gatekeeper.ts +47 -1
  20. package/node_modules/@hap/core/src/types.ts +27 -0
  21. package/node_modules/@hono/node-server/README.md +58 -25
  22. package/node_modules/@hono/node-server/dist/conninfo.cjs +22 -0
  23. package/node_modules/@hono/node-server/dist/{conninfo.d.ts → conninfo.d.cts} +4 -3
  24. package/node_modules/@hono/node-server/dist/conninfo.d.mts +4 -3
  25. package/node_modules/@hono/node-server/dist/conninfo.mjs +19 -16
  26. package/node_modules/@hono/node-server/dist/constants-BLSFu_RU.mjs +5 -0
  27. package/node_modules/@hono/node-server/dist/constants-BXAKTxRC.cjs +11 -0
  28. package/node_modules/@hono/node-server/dist/index.cjs +1173 -0
  29. package/node_modules/@hono/node-server/dist/index.d.cts +101 -0
  30. package/node_modules/@hono/node-server/dist/index.d.mts +101 -8
  31. package/node_modules/@hono/node-server/dist/index.mjs +1143 -637
  32. package/node_modules/@hono/node-server/dist/serve-static.cjs +151 -0
  33. package/node_modules/@hono/node-server/dist/serve-static.d.cts +18 -0
  34. package/node_modules/@hono/node-server/dist/serve-static.d.mts +14 -13
  35. package/node_modules/@hono/node-server/dist/serve-static.mjs +143 -145
  36. package/node_modules/@hono/node-server/dist/utils/response.cjs +8 -0
  37. package/node_modules/@hono/node-server/dist/utils/response.d.cts +4 -0
  38. package/node_modules/@hono/node-server/dist/utils/response.d.mts +3 -2
  39. package/node_modules/@hono/node-server/dist/utils/response.mjs +6 -9
  40. package/node_modules/@hono/node-server/dist/utils/stream.cjs +65 -0
  41. package/node_modules/@hono/node-server/dist/utils/stream.d.cts +6 -0
  42. package/node_modules/@hono/node-server/dist/utils/stream.d.mts +6 -0
  43. package/node_modules/@hono/node-server/dist/utils/stream.mjs +64 -0
  44. package/node_modules/@hono/node-server/package.json +65 -54
  45. package/node_modules/@modelcontextprotocol/sdk/dist/cjs/client/index.d.ts.map +1 -1
  46. package/node_modules/@modelcontextprotocol/sdk/dist/cjs/client/index.js +1 -12
  47. package/node_modules/@modelcontextprotocol/sdk/dist/cjs/client/index.js.map +1 -1
  48. package/node_modules/@modelcontextprotocol/sdk/dist/cjs/client/stdio.d.ts +7 -0
  49. package/node_modules/@modelcontextprotocol/sdk/dist/cjs/client/stdio.d.ts.map +1 -1
  50. package/node_modules/@modelcontextprotocol/sdk/dist/cjs/client/stdio.js +9 -3
  51. package/node_modules/@modelcontextprotocol/sdk/dist/cjs/client/stdio.js.map +1 -1
  52. package/node_modules/@modelcontextprotocol/sdk/dist/cjs/client/streamableHttp.d.ts.map +1 -1
  53. package/node_modules/@modelcontextprotocol/sdk/dist/cjs/client/streamableHttp.js +5 -3
  54. package/node_modules/@modelcontextprotocol/sdk/dist/cjs/client/streamableHttp.js.map +1 -1
  55. package/node_modules/@modelcontextprotocol/sdk/dist/cjs/server/index.d.ts.map +1 -1
  56. package/node_modules/@modelcontextprotocol/sdk/dist/cjs/server/index.js +1 -12
  57. package/node_modules/@modelcontextprotocol/sdk/dist/cjs/server/index.js.map +1 -1
  58. package/node_modules/@modelcontextprotocol/sdk/dist/cjs/server/sseKeepAlive.d.ts +5 -0
  59. package/node_modules/@modelcontextprotocol/sdk/dist/cjs/server/sseKeepAlive.d.ts.map +1 -0
  60. package/node_modules/@modelcontextprotocol/sdk/dist/cjs/server/sseKeepAlive.js +17 -0
  61. package/node_modules/@modelcontextprotocol/sdk/dist/cjs/server/sseKeepAlive.js.map +1 -0
  62. package/node_modules/@modelcontextprotocol/sdk/dist/cjs/server/stdio.d.ts +9 -1
  63. package/node_modules/@modelcontextprotocol/sdk/dist/cjs/server/stdio.d.ts.map +1 -1
  64. package/node_modules/@modelcontextprotocol/sdk/dist/cjs/server/stdio.js +10 -4
  65. package/node_modules/@modelcontextprotocol/sdk/dist/cjs/server/stdio.js.map +1 -1
  66. package/node_modules/@modelcontextprotocol/sdk/dist/cjs/server/webStandardStreamableHttp.d.ts +21 -0
  67. package/node_modules/@modelcontextprotocol/sdk/dist/cjs/server/webStandardStreamableHttp.d.ts.map +1 -1
  68. package/node_modules/@modelcontextprotocol/sdk/dist/cjs/server/webStandardStreamableHttp.js +239 -41
  69. package/node_modules/@modelcontextprotocol/sdk/dist/cjs/server/webStandardStreamableHttp.js.map +1 -1
  70. package/node_modules/@modelcontextprotocol/sdk/dist/cjs/server/zod-compat.d.ts.map +1 -1
  71. package/node_modules/@modelcontextprotocol/sdk/dist/cjs/server/zod-compat.js +25 -6
  72. package/node_modules/@modelcontextprotocol/sdk/dist/cjs/server/zod-compat.js.map +1 -1
  73. package/node_modules/@modelcontextprotocol/sdk/dist/cjs/shared/mediaType.d.ts +32 -0
  74. package/node_modules/@modelcontextprotocol/sdk/dist/cjs/shared/mediaType.d.ts.map +1 -0
  75. package/node_modules/@modelcontextprotocol/sdk/dist/cjs/shared/mediaType.js +64 -0
  76. package/node_modules/@modelcontextprotocol/sdk/dist/cjs/shared/mediaType.js.map +1 -0
  77. package/node_modules/@modelcontextprotocol/sdk/dist/cjs/shared/stdio.d.ts +5 -0
  78. package/node_modules/@modelcontextprotocol/sdk/dist/cjs/shared/stdio.d.ts.map +1 -1
  79. package/node_modules/@modelcontextprotocol/sdk/dist/cjs/shared/stdio.js +10 -1
  80. package/node_modules/@modelcontextprotocol/sdk/dist/cjs/shared/stdio.js.map +1 -1
  81. package/node_modules/@modelcontextprotocol/sdk/dist/esm/client/index.d.ts.map +1 -1
  82. package/node_modules/@modelcontextprotocol/sdk/dist/esm/client/index.js +2 -13
  83. package/node_modules/@modelcontextprotocol/sdk/dist/esm/client/index.js.map +1 -1
  84. package/node_modules/@modelcontextprotocol/sdk/dist/esm/client/stdio.d.ts +7 -0
  85. package/node_modules/@modelcontextprotocol/sdk/dist/esm/client/stdio.d.ts.map +1 -1
  86. package/node_modules/@modelcontextprotocol/sdk/dist/esm/client/stdio.js +9 -3
  87. package/node_modules/@modelcontextprotocol/sdk/dist/esm/client/stdio.js.map +1 -1
  88. package/node_modules/@modelcontextprotocol/sdk/dist/esm/client/streamableHttp.d.ts.map +1 -1
  89. package/node_modules/@modelcontextprotocol/sdk/dist/esm/client/streamableHttp.js +5 -3
  90. package/node_modules/@modelcontextprotocol/sdk/dist/esm/client/streamableHttp.js.map +1 -1
  91. package/node_modules/@modelcontextprotocol/sdk/dist/esm/server/index.d.ts.map +1 -1
  92. package/node_modules/@modelcontextprotocol/sdk/dist/esm/server/index.js +2 -13
  93. package/node_modules/@modelcontextprotocol/sdk/dist/esm/server/index.js.map +1 -1
  94. package/node_modules/@modelcontextprotocol/sdk/dist/esm/server/sseKeepAlive.d.ts +5 -0
  95. package/node_modules/@modelcontextprotocol/sdk/dist/esm/server/sseKeepAlive.d.ts.map +1 -0
  96. package/node_modules/@modelcontextprotocol/sdk/dist/esm/server/sseKeepAlive.js +13 -0
  97. package/node_modules/@modelcontextprotocol/sdk/dist/esm/server/sseKeepAlive.js.map +1 -0
  98. package/node_modules/@modelcontextprotocol/sdk/dist/esm/server/stdio.d.ts +9 -1
  99. package/node_modules/@modelcontextprotocol/sdk/dist/esm/server/stdio.d.ts.map +1 -1
  100. package/node_modules/@modelcontextprotocol/sdk/dist/esm/server/stdio.js +10 -4
  101. package/node_modules/@modelcontextprotocol/sdk/dist/esm/server/stdio.js.map +1 -1
  102. package/node_modules/@modelcontextprotocol/sdk/dist/esm/server/webStandardStreamableHttp.d.ts +21 -0
  103. package/node_modules/@modelcontextprotocol/sdk/dist/esm/server/webStandardStreamableHttp.d.ts.map +1 -1
  104. package/node_modules/@modelcontextprotocol/sdk/dist/esm/server/webStandardStreamableHttp.js +239 -41
  105. package/node_modules/@modelcontextprotocol/sdk/dist/esm/server/webStandardStreamableHttp.js.map +1 -1
  106. package/node_modules/@modelcontextprotocol/sdk/dist/esm/server/zod-compat.d.ts.map +1 -1
  107. package/node_modules/@modelcontextprotocol/sdk/dist/esm/server/zod-compat.js +25 -6
  108. package/node_modules/@modelcontextprotocol/sdk/dist/esm/server/zod-compat.js.map +1 -1
  109. package/node_modules/@modelcontextprotocol/sdk/dist/esm/shared/mediaType.d.ts +32 -0
  110. package/node_modules/@modelcontextprotocol/sdk/dist/esm/shared/mediaType.d.ts.map +1 -0
  111. package/node_modules/@modelcontextprotocol/sdk/dist/esm/shared/mediaType.js +57 -0
  112. package/node_modules/@modelcontextprotocol/sdk/dist/esm/shared/mediaType.js.map +1 -0
  113. package/node_modules/@modelcontextprotocol/sdk/dist/esm/shared/stdio.d.ts +5 -0
  114. package/node_modules/@modelcontextprotocol/sdk/dist/esm/shared/stdio.d.ts.map +1 -1
  115. package/node_modules/@modelcontextprotocol/sdk/dist/esm/shared/stdio.js +9 -0
  116. package/node_modules/@modelcontextprotocol/sdk/dist/esm/shared/stdio.js.map +1 -1
  117. package/node_modules/@modelcontextprotocol/sdk/node_modules/media-typer/README.md +15 -14
  118. package/node_modules/@modelcontextprotocol/sdk/node_modules/media-typer/index.js +0 -8
  119. package/node_modules/@modelcontextprotocol/sdk/node_modules/media-typer/package.json +16 -12
  120. package/node_modules/@modelcontextprotocol/sdk/package.json +4 -3
  121. package/node_modules/@types/node/README.md +1 -1
  122. package/node_modules/@types/node/crypto.d.ts +1 -1
  123. package/node_modules/@types/node/package.json +2 -2
  124. package/node_modules/body-parser/HISTORY.md +7 -1
  125. package/node_modules/body-parser/lib/types/json.js +7 -3
  126. package/node_modules/body-parser/lib/types/raw.js +7 -3
  127. package/node_modules/body-parser/lib/types/text.js +7 -3
  128. package/node_modules/body-parser/lib/types/urlencoded.js +7 -3
  129. package/node_modules/body-parser/package.json +1 -1
  130. package/node_modules/express-rate-limit/dist/index.cjs +69 -5
  131. package/node_modules/express-rate-limit/dist/index.d.cts +16 -0
  132. package/node_modules/express-rate-limit/dist/index.d.mts +16 -0
  133. package/node_modules/express-rate-limit/dist/index.d.ts +16 -0
  134. package/node_modules/express-rate-limit/dist/index.mjs +55 -5
  135. package/node_modules/express-rate-limit/node_modules/debug/LICENSE +20 -0
  136. package/node_modules/express-rate-limit/node_modules/debug/README.md +481 -0
  137. package/node_modules/express-rate-limit/node_modules/debug/package.json +64 -0
  138. package/node_modules/express-rate-limit/node_modules/debug/src/browser.js +272 -0
  139. package/node_modules/express-rate-limit/node_modules/debug/src/common.js +292 -0
  140. package/node_modules/express-rate-limit/node_modules/debug/src/index.js +10 -0
  141. package/node_modules/express-rate-limit/node_modules/debug/src/node.js +263 -0
  142. package/node_modules/express-rate-limit/node_modules/ms/index.js +162 -0
  143. package/node_modules/express-rate-limit/node_modules/ms/license.md +21 -0
  144. package/node_modules/express-rate-limit/node_modules/ms/package.json +38 -0
  145. package/node_modules/express-rate-limit/node_modules/ms/readme.md +59 -0
  146. package/node_modules/express-rate-limit/package.json +12 -9
  147. package/node_modules/fast-uri/index.js +17 -0
  148. package/node_modules/fast-uri/package.json +1 -1
  149. package/node_modules/fast-uri/test/security.test.js +62 -0
  150. package/node_modules/hono/dist/adapter/aws-lambda/handler.js +1 -4
  151. package/node_modules/hono/dist/adapter/lambda-edge/handler.js +12 -2
  152. package/node_modules/hono/dist/cjs/adapter/aws-lambda/handler.js +1 -4
  153. package/node_modules/hono/dist/cjs/adapter/lambda-edge/handler.js +12 -2
  154. package/node_modules/hono/dist/cjs/client/client.js +10 -1
  155. package/node_modules/hono/dist/cjs/client/utils.js +1 -1
  156. package/node_modules/hono/dist/cjs/helper/streaming/sse.js +5 -4
  157. package/node_modules/hono/dist/cjs/middleware/cache/index.js +1 -1
  158. package/node_modules/hono/dist/cjs/middleware/compress/index.js +2 -1
  159. package/node_modules/hono/dist/cjs/middleware/etag/index.js +2 -1
  160. package/node_modules/hono/dist/cjs/middleware/method-override/index.js +5 -3
  161. package/node_modules/hono/dist/cjs/middleware/secure-headers/secure-headers.js +10 -4
  162. package/node_modules/hono/dist/cjs/request.js +8 -3
  163. package/node_modules/hono/dist/cjs/router/trie-router/node.js +9 -0
  164. package/node_modules/hono/dist/cjs/utils/accept.js +1 -1
  165. package/node_modules/hono/dist/cjs/utils/body.js +6 -0
  166. package/node_modules/hono/dist/cjs/utils/url.js +1 -1
  167. package/node_modules/hono/dist/client/client.js +10 -1
  168. package/node_modules/hono/dist/client/utils.js +1 -1
  169. package/node_modules/hono/dist/helper/streaming/sse.js +5 -4
  170. package/node_modules/hono/dist/middleware/cache/index.js +1 -1
  171. package/node_modules/hono/dist/middleware/compress/index.js +2 -1
  172. package/node_modules/hono/dist/middleware/etag/index.js +2 -1
  173. package/node_modules/hono/dist/middleware/method-override/index.js +5 -3
  174. package/node_modules/hono/dist/middleware/secure-headers/secure-headers.js +10 -4
  175. package/node_modules/hono/dist/request.js +8 -3
  176. package/node_modules/hono/dist/router/trie-router/node.js +9 -0
  177. package/node_modules/hono/dist/types/adapter/aws-lambda/types.d.ts +9 -0
  178. package/node_modules/hono/dist/types/adapter/lambda-edge/handler.d.ts +1 -1
  179. package/node_modules/hono/dist/types/helper/websocket/index.d.ts +1 -1
  180. package/node_modules/hono/dist/types/middleware/combine/index.d.ts +1 -1
  181. package/node_modules/hono/dist/types/middleware/language/language.d.ts +18 -0
  182. package/node_modules/hono/dist/types/utils/types.d.ts +1 -1
  183. package/node_modules/hono/dist/utils/accept.js +1 -1
  184. package/node_modules/hono/dist/utils/body.js +6 -0
  185. package/node_modules/hono/dist/utils/url.js +1 -1
  186. package/node_modules/hono/package.json +4 -4
  187. package/node_modules/ip-address/README.md +102 -96
  188. package/node_modules/ip-address/dist/common.d.ts +23 -0
  189. package/node_modules/ip-address/dist/common.js +27 -4
  190. package/node_modules/ip-address/dist/common.js.map +1 -1
  191. package/node_modules/ip-address/dist/ipv4.d.ts +8 -1
  192. package/node_modules/ip-address/dist/ipv4.js +21 -8
  193. package/node_modules/ip-address/dist/ipv4.js.map +1 -1
  194. package/node_modules/ip-address/dist/ipv6.d.ts +59 -1
  195. package/node_modules/ip-address/dist/ipv6.js +149 -41
  196. package/node_modules/ip-address/dist/ipv6.js.map +1 -1
  197. package/node_modules/ip-address/dist/v4/constants.js +5 -1
  198. package/node_modules/ip-address/dist/v4/constants.js.map +1 -1
  199. package/node_modules/ip-address/dist/v6/constants.js +3 -2
  200. package/node_modules/ip-address/dist/v6/constants.js.map +1 -1
  201. package/node_modules/ip-address/package.json +2 -2
  202. package/node_modules/jose/README.md +1 -4
  203. package/node_modules/jose/dist/types/jwks/remote.d.ts +3 -3
  204. package/node_modules/jose/dist/webapi/jwks/remote.js +1 -1
  205. package/node_modules/jose/dist/webapi/lib/key_to_jwk.js +4 -1
  206. package/node_modules/jose/package.json +1 -1
  207. package/package.json +3 -2
  208. package/profiles/customers/0.4.profile.json +7 -4
  209. package/profiles/customers/0.5.profile.json +131 -0
  210. package/profiles/customers/0.6.profile.json +153 -0
  211. package/profiles/email/0.4.profile.json +8 -4
  212. package/profiles/index.json +2 -0
  213. package/server.js +10 -0
  214. package/dist/ui/assets/index-CTmWS7W4.js +0 -105
  215. package/node_modules/@hono/node-server/dist/conninfo.js +0 -42
  216. package/node_modules/@hono/node-server/dist/globals.d.mts +0 -2
  217. package/node_modules/@hono/node-server/dist/globals.d.ts +0 -2
  218. package/node_modules/@hono/node-server/dist/globals.js +0 -29
  219. package/node_modules/@hono/node-server/dist/globals.mjs +0 -5
  220. package/node_modules/@hono/node-server/dist/index.d.ts +0 -8
  221. package/node_modules/@hono/node-server/dist/index.js +0 -702
  222. package/node_modules/@hono/node-server/dist/listener.d.mts +0 -13
  223. package/node_modules/@hono/node-server/dist/listener.d.ts +0 -13
  224. package/node_modules/@hono/node-server/dist/listener.js +0 -670
  225. package/node_modules/@hono/node-server/dist/listener.mjs +0 -635
  226. package/node_modules/@hono/node-server/dist/request.d.mts +0 -25
  227. package/node_modules/@hono/node-server/dist/request.d.ts +0 -25
  228. package/node_modules/@hono/node-server/dist/request.js +0 -238
  229. package/node_modules/@hono/node-server/dist/request.mjs +0 -206
  230. package/node_modules/@hono/node-server/dist/response.d.mts +0 -26
  231. package/node_modules/@hono/node-server/dist/response.d.ts +0 -26
  232. package/node_modules/@hono/node-server/dist/response.js +0 -112
  233. package/node_modules/@hono/node-server/dist/response.mjs +0 -85
  234. package/node_modules/@hono/node-server/dist/serve-static.d.ts +0 -17
  235. package/node_modules/@hono/node-server/dist/serve-static.js +0 -177
  236. package/node_modules/@hono/node-server/dist/server.d.mts +0 -10
  237. package/node_modules/@hono/node-server/dist/server.d.ts +0 -10
  238. package/node_modules/@hono/node-server/dist/server.js +0 -696
  239. package/node_modules/@hono/node-server/dist/server.mjs +0 -660
  240. package/node_modules/@hono/node-server/dist/types.d.mts +0 -44
  241. package/node_modules/@hono/node-server/dist/types.d.ts +0 -44
  242. package/node_modules/@hono/node-server/dist/types.js +0 -18
  243. package/node_modules/@hono/node-server/dist/types.mjs +0 -0
  244. package/node_modules/@hono/node-server/dist/utils/response/constants.d.mts +0 -3
  245. package/node_modules/@hono/node-server/dist/utils/response/constants.d.ts +0 -3
  246. package/node_modules/@hono/node-server/dist/utils/response/constants.js +0 -30
  247. package/node_modules/@hono/node-server/dist/utils/response/constants.mjs +0 -5
  248. package/node_modules/@hono/node-server/dist/utils/response.d.ts +0 -3
  249. package/node_modules/@hono/node-server/dist/utils/response.js +0 -37
  250. package/node_modules/@hono/node-server/dist/utils.d.mts +0 -9
  251. package/node_modules/@hono/node-server/dist/utils.d.ts +0 -9
  252. package/node_modules/@hono/node-server/dist/utils.js +0 -99
  253. package/node_modules/@hono/node-server/dist/utils.mjs +0 -71
  254. package/node_modules/@hono/node-server/dist/vercel.d.mts +0 -7
  255. package/node_modules/@hono/node-server/dist/vercel.d.ts +0 -7
  256. package/node_modules/@hono/node-server/dist/vercel.js +0 -677
  257. package/node_modules/@hono/node-server/dist/vercel.mjs +0 -640
@@ -555,12 +555,23 @@ function checkBoundsFromFrameSchema(request, profile) {
555
555
  }
556
556
  return errors;
557
557
  }
558
+ function boundGovernsAction(fieldName, fieldDef, bt, actionType) {
559
+ if (fieldDef.appliesTo) {
560
+ return actionType ? fieldDef.appliesTo.includes(actionType) : true;
561
+ }
562
+ if (bt.kind !== "cumulative_count" || !actionType) return true;
563
+ const prefix = fieldName.replace(/_(?:daily|monthly|weekly)_max$/, "");
564
+ const namedForAnAction = prefix !== fieldName;
565
+ const matches = prefix === actionType || prefix.startsWith("transaction");
566
+ return !namedForAnAction || matches;
567
+ }
558
568
  function checkBoundsV4(request, profile, executionLog, now) {
559
569
  const errors = [];
560
570
  if (!profile.boundsSchema) return errors;
561
571
  const bounds = request.frame;
562
572
  const profileId = String(bounds.profile ?? profile.id);
563
- const path = bounds.path ? String(bounds.path) : "";
573
+ const actionType = typeof request.execution.action_type === "string" ? request.execution.action_type : void 0;
574
+ const path = request.path ?? (bounds.path ? String(bounds.path) : "");
564
575
  for (const [fieldName, fieldDef] of Object.entries(profile.boundsSchema.fields)) {
565
576
  if (fieldName === "profile" || fieldName === "path") continue;
566
577
  const boundValue = bounds[fieldName];
@@ -576,6 +587,7 @@ function checkBoundsV4(request, profile, executionLog, now) {
576
587
  });
577
588
  continue;
578
589
  }
590
+ if (!boundGovernsAction(fieldName, fieldDef, bt, actionType)) continue;
579
591
  switch (bt.kind) {
580
592
  case "per_transaction": {
581
593
  const actual = request.execution[bt.of];
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@humanagencyp/hap-core",
3
- "version": "0.6.2",
3
+ "version": "0.7.0",
4
4
  "description": "Core types, cryptographic primitives, and verification logic for the Human Agency Protocol",
5
5
  "license": "MIT",
6
6
  "repository": {
@@ -40,6 +40,8 @@ import type {
40
40
  AgentContextParams,
41
41
  ExecutionLogQuery,
42
42
  CumulativeFieldDef,
43
+ ProfileBoundsField,
44
+ BoundType,
43
45
  } from './types';
44
46
 
45
47
  /**
@@ -406,6 +408,41 @@ function checkBoundsFromFrameSchema(request: GatekeeperRequest, profile: AgentPr
406
408
  * enum — bound value must be in the allowed set (attest-time
407
409
  * validation; not an execution-time check)
408
410
  */
411
+ /**
412
+ * Does this bound govern the action being attempted?
413
+ *
414
+ * Cumulative totals are scoped by (profileId, path) only, so without this every
415
+ * cumulative_count bound on a profile sees the same running count. On customers
416
+ * — which declares both write_daily_max and delete_daily_max — the smaller
417
+ * delete limit would count writes and block them.
418
+ *
419
+ * Preferred answer is the profile's declared `appliesTo`. Absent that, fall back
420
+ * to the field-name convention (`delete_daily_max` → `delete`), matching how the
421
+ * Authority Server selects bounds so the two enforcement points cannot disagree.
422
+ *
423
+ * Fails CLOSED: when the action type is unknown, or the bound's name implies no
424
+ * particular action, the bound is enforced.
425
+ */
426
+ function boundGovernsAction(
427
+ fieldName: string,
428
+ fieldDef: ProfileBoundsField,
429
+ bt: BoundType,
430
+ actionType: string | undefined,
431
+ ): boolean {
432
+ if (fieldDef.appliesTo) {
433
+ return actionType ? fieldDef.appliesTo.includes(actionType) : true;
434
+ }
435
+
436
+ // The name convention only ever disambiguated count bounds; sums are governed
437
+ // by their `of` field and stay unfiltered, as at the Authority Server.
438
+ if (bt.kind !== 'cumulative_count' || !actionType) return true;
439
+
440
+ const prefix = fieldName.replace(/_(?:daily|monthly|weekly)_max$/, '');
441
+ const namedForAnAction = prefix !== fieldName;
442
+ const matches = prefix === actionType || prefix.startsWith('transaction');
443
+ return !namedForAnAction || matches;
444
+ }
445
+
409
446
  function checkBoundsV4(
410
447
  request: GatekeeperRequest,
411
448
  profile: AgentProfile,
@@ -417,7 +454,14 @@ function checkBoundsV4(
417
454
 
418
455
  const bounds = request.frame as AgentBoundsParams;
419
456
  const profileId = String(bounds.profile ?? profile.id);
420
- const path = bounds.path ? String(bounds.path) : '';
457
+ const actionType = typeof request.execution.action_type === 'string'
458
+ ? request.execution.action_type
459
+ : undefined;
460
+ // Prefer the explicit request path. `frame.path` is retained only as a
461
+ // fallback for callers that legitimately declare `path` in their profile's
462
+ // boundsSchema; for every shipped profile it is absent, which is exactly why
463
+ // this silently resolved to "" and disabled the cumulative gate entirely.
464
+ const path = request.path ?? (bounds.path ? String(bounds.path) : '');
421
465
 
422
466
  for (const [fieldName, fieldDef] of Object.entries(profile.boundsSchema.fields)) {
423
467
  if (fieldName === 'profile' || fieldName === 'path') continue;
@@ -441,6 +485,8 @@ function checkBoundsV4(
441
485
  continue;
442
486
  }
443
487
 
488
+ if (!boundGovernsAction(fieldName, fieldDef, bt, actionType)) continue;
489
+
444
490
  switch (bt.kind) {
445
491
  case 'per_transaction': {
446
492
  const actual = request.execution[bt.of];
@@ -213,6 +213,21 @@ export interface ProfileBoundsField {
213
213
  * treat a missing boundType as an error when running in v0.4 mode.
214
214
  */
215
215
  boundType?: BoundType;
216
+ /**
217
+ * Which execution action types this bound governs, e.g. `["write"]`.
218
+ *
219
+ * When present, this is authoritative. When absent, enforcement falls back to
220
+ * inferring the action type from the FIELD NAME (`send_daily_max` → `send`),
221
+ * which is a convention rather than a contract: a profile that names a bound
222
+ * after the domain concept instead of the action — calendar's
223
+ * `booking_daily_max` against an action type of `write` — matches nothing and
224
+ * is skipped, so a limit the user set is never applied and nothing says so.
225
+ *
226
+ * Declaring it removes the guess. Deliberately additive: profiles migrate one
227
+ * at a time, and every remaining fallback is logged, so the cases still
228
+ * relying on the naming convention become visible instead of staying silent.
229
+ */
230
+ appliesTo?: string[];
216
231
  /**
217
232
  * The measurement dimension of the bound's value. UI renders the unit
218
233
  * inline next to the input (e.g. `4 min`, `100 EUR`). Independent from
@@ -502,6 +517,18 @@ export interface GatekeeperRequest {
502
517
  execution: Record<string, string | number>;
503
518
  /** v0.4: context parameters (currency, action_type, etc.) */
504
519
  context?: AgentContextParams;
520
+ /**
521
+ * Authorization path used to scope cumulative lookups in the execution log.
522
+ *
523
+ * Deliberately OUTSIDE `frame`: the frame is hashed and validated against the
524
+ * profile's boundsSchema, so an extra key there is rejected as an unknown
525
+ * field and breaks attestation verification outright. Cumulative checks
526
+ * previously read the path from the frame, where callers cannot legally put
527
+ * it — so it resolved to "" while the log stored real paths, no entry ever
528
+ * matched, and every running total read zero. The local gate existed but
529
+ * could never fire.
530
+ */
531
+ path?: string;
505
532
  }
506
533
 
507
534
  /**
@@ -1,12 +1,11 @@
1
1
  # Node.js Adapter for Hono
2
2
 
3
3
  This adapter `@hono/node-server` allows you to run your Hono application on Node.js.
4
- Initially, Hono wasn't designed for Node.js, but with this adapter, you can now use Hono on Node.js.
5
- It utilizes web standard APIs implemented in Node.js version 18 or higher.
4
+ Initially, Hono wasn't designed for Node.js, but with this adapter, you can now use Hono on Node.js. It utilizes web standard APIs implemented in Node.js.
6
5
 
7
6
  ## Benchmarks
8
7
 
9
- Hono is 3.5 times faster than Express.
8
+ Hono is 4.1 times faster than Express.
10
9
 
11
10
  Express:
12
11
 
@@ -14,12 +13,12 @@ Express:
14
13
  $ bombardier -d 10s --fasthttp http://localhost:3000/
15
14
 
16
15
  Statistics Avg Stdev Max
17
- Reqs/sec 16438.94 1603.39 19155.47
18
- Latency 7.60ms 7.51ms 559.89ms
16
+ Reqs/sec 20803.37 1713.06 24910.85
17
+ Latency 6.01ms 5.21ms 451.37ms
19
18
  HTTP codes:
20
- 1xx - 0, 2xx - 164494, 3xx - 0, 4xx - 0, 5xx - 0
19
+ 1xx - 0, 2xx - 208131, 3xx - 0, 4xx - 0, 5xx - 0
21
20
  others - 0
22
- Throughput: 4.55MB/s
21
+ Throughput: 5.75MB/s
23
22
  ```
24
23
 
25
24
  Hono + `@hono/node-server`:
@@ -28,36 +27,25 @@ Hono + `@hono/node-server`:
28
27
  $ bombardier -d 10s --fasthttp http://localhost:3000/
29
28
 
30
29
  Statistics Avg Stdev Max
31
- Reqs/sec 58296.56 5512.74 74403.56
32
- Latency 2.14ms 1.46ms 190.92ms
30
+ Reqs/sec 85405.51 7250.65 102658.51
31
+ Latency 1.46ms 1.00ms 149.95ms
33
32
  HTTP codes:
34
- 1xx - 0, 2xx - 583059, 3xx - 0, 4xx - 0, 5xx - 0
33
+ 1xx - 0, 2xx - 854120, 3xx - 0, 4xx - 0, 5xx - 0
35
34
  others - 0
36
- Throughput: 12.56MB/s
35
+ Throughput: 18.49MB/s
37
36
  ```
38
37
 
39
38
  ## Requirements
40
39
 
41
- It works on Node.js versions greater than 18.x. The specific required Node.js versions are as follows:
42
-
43
- - 18.x => 18.14.1+
44
- - 19.x => 19.7.0+
45
- - 20.x => 20.0.0+
46
-
47
- Essentially, you can simply use the latest version of each major release.
40
+ It works on Node.js versions greater than 20.x.
48
41
 
49
42
  ## Installation
50
43
 
51
- You can install it from the npm registry with `npm` command:
44
+ You can install it from the npm registry:
52
45
 
53
46
  ```sh
54
47
  npm install @hono/node-server
55
- ```
56
-
57
- Or use `yarn`:
58
-
59
- ```sh
60
- yarn add @hono/node-server
48
+ pnpm add @hono/node-server
61
49
  ```
62
50
 
63
51
  ## Usage
@@ -77,6 +65,34 @@ serve(app, (info) => {
77
65
  })
78
66
  ```
79
67
 
68
+ ## WebSocket
69
+
70
+ You can upgrade WebSocket connections with `upgradeWebSocket` from `@hono/node-server`.
71
+ To enable this, install `ws` (and `@types/ws`) in your project, then create and provide a `WebSocketServer` as shown in the example below.
72
+
73
+ ```ts
74
+ import { serve, upgradeWebSocket } from '@hono/node-server'
75
+ import { WebSocketServer } from 'ws'
76
+ import { Hono } from 'hono'
77
+
78
+ const app = new Hono()
79
+
80
+ app.get(
81
+ '/ws',
82
+ upgradeWebSocket(() => ({
83
+ onMessage(event, ws) {
84
+ ws.send(event.data)
85
+ },
86
+ }))
87
+ )
88
+
89
+ const wss = new WebSocketServer({ noServer: true }) // important to create with `noServer: true`
90
+ serve({
91
+ fetch: app.fetch,
92
+ websocket: { server: wss },
93
+ })
94
+ ```
95
+
80
96
  For example, run it using `ts-node`. Then an HTTP server will be launched. The default port is `3000`.
81
97
 
82
98
  ```sh
@@ -138,6 +154,23 @@ serve({
138
154
  })
139
155
  ```
140
156
 
157
+ ### `websocket`
158
+
159
+ provide a websocket server to enable websocket support.
160
+
161
+ ```ts
162
+ import { serve, upgradeWebSocket } from '@hono/node-server'
163
+ import { WebSocketServer } from 'ws'
164
+
165
+ // ...
166
+ const wss = new WebSocketServer({ noServer: true })
167
+
168
+ serve({
169
+ fetch: app.fetch,
170
+ websocket: { server: wss },
171
+ })
172
+ ```
173
+
141
174
  ## Middleware
142
175
 
143
176
  Most built-in middleware also works with Node.js.
@@ -0,0 +1,22 @@
1
+ Object.defineProperty(exports, Symbol.toStringTag, { value: 'Module' });
2
+
3
+ //#region src/conninfo.ts
4
+ /**
5
+ * ConnInfo Helper for Node.js
6
+ * @param c Context
7
+ * @returns ConnInfo
8
+ */
9
+ const getConnInfo = (c) => {
10
+ const bindings = c.env.server ? c.env.server : c.env;
11
+ const address = bindings.incoming.socket.remoteAddress;
12
+ const port = bindings.incoming.socket.remotePort;
13
+ const family = bindings.incoming.socket.remoteFamily;
14
+ return { remote: {
15
+ address,
16
+ port,
17
+ addressType: family === "IPv4" ? "IPv4" : family === "IPv6" ? "IPv6" : void 0
18
+ } };
19
+ };
20
+
21
+ //#endregion
22
+ exports.getConnInfo = getConnInfo;
@@ -1,10 +1,11 @@
1
- import { GetConnInfo } from 'hono/conninfo';
1
+ import { GetConnInfo } from "hono/conninfo";
2
2
 
3
+ //#region src/conninfo.d.ts
3
4
  /**
4
5
  * ConnInfo Helper for Node.js
5
6
  * @param c Context
6
7
  * @returns ConnInfo
7
8
  */
8
9
  declare const getConnInfo: GetConnInfo;
9
-
10
- export { getConnInfo };
10
+ //#endregion
11
+ export { getConnInfo };
@@ -1,10 +1,11 @@
1
- import { GetConnInfo } from 'hono/conninfo';
1
+ import { GetConnInfo } from "hono/conninfo";
2
2
 
3
+ //#region src/conninfo.d.ts
3
4
  /**
4
5
  * ConnInfo Helper for Node.js
5
6
  * @param c Context
6
7
  * @returns ConnInfo
7
8
  */
8
9
  declare const getConnInfo: GetConnInfo;
9
-
10
- export { getConnInfo };
10
+ //#endregion
11
+ export { getConnInfo };
@@ -1,17 +1,20 @@
1
- // src/conninfo.ts
2
- var getConnInfo = (c) => {
3
- const bindings = c.env.server ? c.env.server : c.env;
4
- const address = bindings.incoming.socket.remoteAddress;
5
- const port = bindings.incoming.socket.remotePort;
6
- const family = bindings.incoming.socket.remoteFamily;
7
- return {
8
- remote: {
9
- address,
10
- port,
11
- addressType: family === "IPv4" ? "IPv4" : family === "IPv6" ? "IPv6" : void 0
12
- }
13
- };
14
- };
15
- export {
16
- getConnInfo
1
+ //#region src/conninfo.ts
2
+ /**
3
+ * ConnInfo Helper for Node.js
4
+ * @param c Context
5
+ * @returns ConnInfo
6
+ */
7
+ const getConnInfo = (c) => {
8
+ const bindings = c.env.server ? c.env.server : c.env;
9
+ const address = bindings.incoming.socket.remoteAddress;
10
+ const port = bindings.incoming.socket.remotePort;
11
+ const family = bindings.incoming.socket.remoteFamily;
12
+ return { remote: {
13
+ address,
14
+ port,
15
+ addressType: family === "IPv4" ? "IPv4" : family === "IPv6" ? "IPv6" : void 0
16
+ } };
17
17
  };
18
+
19
+ //#endregion
20
+ export { getConnInfo };
@@ -0,0 +1,5 @@
1
+ //#region src/utils/response/constants.ts
2
+ const X_ALREADY_SENT = "x-hono-already-sent";
3
+
4
+ //#endregion
5
+ export { X_ALREADY_SENT as t };
@@ -0,0 +1,11 @@
1
+
2
+ //#region src/utils/response/constants.ts
3
+ const X_ALREADY_SENT = "x-hono-already-sent";
4
+
5
+ //#endregion
6
+ Object.defineProperty(exports, 'X_ALREADY_SENT', {
7
+ enumerable: true,
8
+ get: function () {
9
+ return X_ALREADY_SENT;
10
+ }
11
+ });