@guren/server 2.15.0 → 2.17.0

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 (302) hide show
  1. package/dist/{DocsViewerServiceProvider-qFCaeiUv.js → DocsViewerServiceProvider-D2cuVgtN.js} +7 -12
  2. package/dist/{Hash-C8aejmi8.js → Hash-D2DFd8xX.js} +7 -57
  3. package/dist/{HttpException-BkS3euNG.js → HttpException-BlQ2yEmT.js} +2 -79
  4. package/dist/{Job-BVT813DO.js → Job-DxQK8h3P.js} +24 -179
  5. package/dist/{McpServiceProvider-BawsYjgN.js → McpServiceProvider-Zihx3Bjq.js} +35 -20
  6. package/dist/{Random-DbIJ22KQ.js → Random-S0OvCuR8.js} +9 -106
  7. package/dist/agent/AgentApprovalRequested.d.ts +11 -39
  8. package/dist/agent/approval-status.d.ts +56 -0
  9. package/dist/agent/approval.d.ts +76 -187
  10. package/dist/agent/audit-emitter.d.ts +16 -44
  11. package/dist/agent/audit.d.ts +20 -56
  12. package/dist/agent/derive.d.ts +32 -66
  13. package/dist/agent/dispatch.d.ts +38 -90
  14. package/dist/agent/events.d.ts +17 -23
  15. package/dist/agent/gate.d.ts +118 -0
  16. package/dist/agent/meta-tools.d.ts +18 -46
  17. package/dist/agent/pipeline.d.ts +234 -0
  18. package/dist/agent/public.d.ts +6 -25
  19. package/dist/agent/public.js +1 -1
  20. package/dist/agent/redact.d.ts +16 -38
  21. package/dist/agent/scopes.d.ts +55 -69
  22. package/dist/auth/AgentPrincipalGuard.d.ts +49 -0
  23. package/dist/auth/AuthManager.d.ts +22 -43
  24. package/dist/auth/AuthenticatableModel.d.ts +2 -2
  25. package/dist/auth/SessionGuard.d.ts +0 -1
  26. package/dist/auth/TokenGuard.d.ts +6 -26
  27. package/dist/auth/api-token.d.ts +16 -148
  28. package/dist/auth/context.d.ts +5 -10
  29. package/dist/auth/email-verification.d.ts +29 -127
  30. package/dist/auth/index.js +1 -1
  31. package/dist/auth/oauth/index.d.ts +35 -57
  32. package/dist/auth/password/DefaultHasher.d.ts +5 -14
  33. package/dist/auth/password/PasswordHasher.d.ts +5 -13
  34. package/dist/auth/password/hash-format.d.ts +5 -13
  35. package/dist/auth/password-reset.d.ts +16 -42
  36. package/dist/auth/providers/ModelUserProvider.d.ts +3 -4
  37. package/dist/auth/providers/UserProvider.d.ts +4 -4
  38. package/dist/auth/signed-token.d.ts +18 -0
  39. package/dist/auth/types.d.ts +9 -32
  40. package/dist/auth/utils.d.ts +6 -27
  41. package/dist/{auth-DkYoAPVn.js → auth-Gg54ppQi.js} +279 -519
  42. package/dist/authorization/Gate.d.ts +9 -145
  43. package/dist/authorization/Policy.d.ts +6 -53
  44. package/dist/authorization/index.js +1 -1
  45. package/dist/authorization/middleware.d.ts +16 -62
  46. package/dist/authorization/types.d.ts +8 -64
  47. package/dist/{authorization-CdfbCj8J.js → authorization-CdEWZZw3.js} +44 -309
  48. package/dist/broadcasting/BroadcastManager.d.ts +29 -149
  49. package/dist/broadcasting/channels/Channel.d.ts +1 -19
  50. package/dist/broadcasting/channels/PresenceChannel.d.ts +1 -55
  51. package/dist/broadcasting/channels/PrivateChannel.d.ts +1 -23
  52. package/dist/broadcasting/drivers/MemoryDriver.d.ts +18 -70
  53. package/dist/broadcasting/drivers/RedisDriver.d.ts +3 -80
  54. package/dist/broadcasting/drivers/index.d.ts +1 -1
  55. package/dist/broadcasting/index.d.ts +1 -1
  56. package/dist/broadcasting/index.js +1 -1
  57. package/dist/broadcasting/types.d.ts +7 -88
  58. package/dist/{broadcasting-BwodCA4q.js → broadcasting-B5RzB0A2.js} +87 -414
  59. package/dist/cache/CacheManager.d.ts +8 -62
  60. package/dist/cache/TaggedCache.d.ts +2 -35
  61. package/dist/cache/index.js +1 -1
  62. package/dist/cache/stores/FileStore.d.ts +2 -36
  63. package/dist/cache/stores/MemoryStore.d.ts +2 -26
  64. package/dist/cache/stores/RedisStore.d.ts +1 -29
  65. package/dist/cache/types.d.ts +21 -128
  66. package/dist/{cache-BYnZf2FR.js → cache-BOOIr324.js} +19 -198
  67. package/dist/client-C4TEr_Dd.js +9 -0
  68. package/dist/console/Command.d.ts +17 -126
  69. package/dist/console/ConsoleKernel.d.ts +2 -74
  70. package/dist/console/Input.d.ts +5 -113
  71. package/dist/console/Output.d.ts +3 -99
  72. package/dist/console/types.d.ts +3 -33
  73. package/dist/container/Container.d.ts +12 -103
  74. package/dist/container/ServiceProvider.d.ts +17 -61
  75. package/dist/container/bindings.d.ts +5 -26
  76. package/dist/container/defineModule.d.ts +16 -54
  77. package/dist/container/definePlugin.d.ts +12 -45
  78. package/dist/container/types.d.ts +2 -34
  79. package/dist/context-CXk_umpT.js +21 -0
  80. package/dist/database/Factory.d.ts +4 -57
  81. package/dist/database/Seeder.d.ts +8 -46
  82. package/dist/database/SeederRunner.d.ts +3 -33
  83. package/dist/database/types.d.ts +3 -24
  84. package/dist/discovery/AutoDiscovery.d.ts +10 -82
  85. package/dist/{dispatch-erOS9epZ.js → dispatch-BAwzftws.js} +32 -79
  86. package/dist/docs-viewer/DocsViewerServiceProvider.d.ts +2 -5
  87. package/dist/docs-viewer/endpoint.d.ts +5 -11
  88. package/dist/encryption/Encrypter.d.ts +5 -71
  89. package/dist/encryption/Hash.d.ts +7 -57
  90. package/dist/encryption/Random.d.ts +6 -99
  91. package/dist/encryption/index.js +3 -3
  92. package/dist/encryption/types.d.ts +10 -72
  93. package/dist/{encryption-D99Vmls3.js → encryption-uwP3Di4D.js} +9 -78
  94. package/dist/{endpoint-D6GIqOpe.js → endpoint-BXipU2Jj.js} +6 -12
  95. package/dist/endpoint-Dsw3Acvq.js +26 -0
  96. package/dist/errors/ExceptionHandler.d.ts +3 -90
  97. package/dist/errors/HttpException.d.ts +2 -79
  98. package/dist/errors/debug-page.d.ts +3 -17
  99. package/dist/errors/error-page.d.ts +1 -0
  100. package/dist/errors/exceptions/AuthenticationException.d.ts +2 -24
  101. package/dist/errors/exceptions/AuthorizationException.d.ts +1 -24
  102. package/dist/errors/exceptions/MethodNotAllowedException.d.ts +1 -23
  103. package/dist/errors/exceptions/NotFoundHttpException.d.ts +1 -27
  104. package/dist/errors/exceptions/ValidationException.d.ts +2 -43
  105. package/dist/errors/types.d.ts +1 -25
  106. package/dist/{errors-BgeOl_DC.js → errors-JpkcCjjn.js} +3 -41
  107. package/dist/events/Event.d.ts +1 -28
  108. package/dist/events/EventManager.d.ts +5 -107
  109. package/dist/events/Listener.d.ts +7 -55
  110. package/dist/events/builtin.d.ts +0 -24
  111. package/dist/events/index.js +1 -1
  112. package/dist/events/types.d.ts +4 -22
  113. package/dist/{events-aIH_bWRx.js → events-DOmAHDeP.js} +11 -191
  114. package/dist/facades/index.d.ts +2 -14
  115. package/dist/health/HealthCheck.d.ts +0 -24
  116. package/dist/health/HealthManager.d.ts +0 -36
  117. package/dist/health/checks/CacheCheck.d.ts +2 -17
  118. package/dist/health/checks/CustomCheck.d.ts +0 -9
  119. package/dist/health/checks/DatabaseCheck.d.ts +2 -17
  120. package/dist/health/checks/MemoryCheck.d.ts +3 -12
  121. package/dist/health/checks/RedisCheck.d.ts +1 -13
  122. package/dist/health/checks/StorageCheck.d.ts +2 -17
  123. package/dist/health/index.js +1 -1
  124. package/dist/health/types.d.ts +4 -24
  125. package/dist/{health-VWdWXRwh.js → health-DQSvUplL.js} +1 -76
  126. package/dist/hot-disposables-B5BXqaIH.js +167 -0
  127. package/dist/hot-reload/hot-disposables.d.ts +22 -74
  128. package/dist/hot-reload/testing.d.ts +4 -9
  129. package/dist/http/Application.d.ts +77 -205
  130. package/dist/http/FormRequest.d.ts +4 -55
  131. package/dist/http/dev-assets.d.ts +13 -31
  132. package/dist/http/dev-banner.d.ts +2 -5
  133. package/dist/http/inertia-assets.d.ts +3 -6
  134. package/dist/http/middleware/capabilities.d.ts +27 -50
  135. package/dist/http/middleware/cors.d.ts +4 -29
  136. package/dist/http/middleware/csp.d.ts +2 -25
  137. package/dist/http/middleware/csrf.d.ts +28 -95
  138. package/dist/http/middleware/detect-locale.d.ts +7 -27
  139. package/dist/http/middleware/force-https.d.ts +6 -24
  140. package/dist/http/middleware/host-authorization.d.ts +2 -12
  141. package/dist/http/middleware/index.d.ts +1 -1
  142. package/dist/http/middleware/loopback-guard.d.ts +15 -33
  143. package/dist/http/middleware/rate-limit.d.ts +29 -126
  144. package/dist/http/middleware/redirect-safety.d.ts +2 -20
  145. package/dist/http/middleware/request-id.d.ts +1 -14
  146. package/dist/http/middleware/request-logging.d.ts +2 -13
  147. package/dist/http/middleware/response-headers.d.ts +5 -13
  148. package/dist/http/middleware/security-headers.d.ts +2 -16
  149. package/dist/http/middleware/session.d.ts +15 -34
  150. package/dist/http/middleware/validation-errors-cookie.d.ts +7 -18
  151. package/dist/http/middleware/validation.d.ts +8 -63
  152. package/dist/http/public-assets.d.ts +11 -7
  153. package/dist/http/request.d.ts +32 -118
  154. package/dist/http/resources/CursorPaginator.d.ts +5 -64
  155. package/dist/http/resources/Paginator.d.ts +7 -84
  156. package/dist/http/resources/Resource.d.ts +9 -65
  157. package/dist/http/resources/ResourceCollection.d.ts +5 -39
  158. package/dist/http/resources/types.d.ts +10 -30
  159. package/dist/http/static-documents.d.ts +10 -20
  160. package/dist/http/validation/Validator.d.ts +25 -85
  161. package/dist/http/validation/rules.d.ts +48 -147
  162. package/dist/http/validation/types.d.ts +16 -61
  163. package/dist/http/vite-assets.d.ts +5 -28
  164. package/dist/http/vite-dev-server.d.ts +6 -9
  165. package/dist/http/vite-manifest.d.ts +19 -33
  166. package/dist/i18n/I18nManager.d.ts +12 -78
  167. package/dist/i18n/Translator.d.ts +3 -54
  168. package/dist/i18n/index.js +1 -1
  169. package/dist/i18n/loaders/JsonLoader.d.ts +4 -31
  170. package/dist/i18n/loaders/MemoryLoader.d.ts +1 -21
  171. package/dist/i18n/pluralization.d.ts +4 -13
  172. package/dist/i18n/types.d.ts +17 -69
  173. package/dist/{i18n-mcWi7LCd.js → i18n-Cg1aajRP.js} +31 -225
  174. package/dist/index.d.ts +11 -4
  175. package/dist/index.js +1186 -3040
  176. package/dist/internal/agent-preflight.d.ts +9 -21
  177. package/dist/internal/agent-principal.d.ts +32 -0
  178. package/dist/internal/request.d.ts +6 -19
  179. package/dist/internal/request.js +1 -1
  180. package/dist/internal/route-path.d.ts +9 -21
  181. package/dist/internal/route-path.js +9 -21
  182. package/dist/internal/zod-compat.d.ts +55 -122
  183. package/dist/internal/zod-compat.js +39 -70
  184. package/dist/internal/zod-json-schema.d.ts +18 -54
  185. package/dist/internal/zod-json-schema.js +46 -123
  186. package/dist/jsx-runtime.d.ts +3 -8
  187. package/dist/lambda/index.d.ts +17 -79
  188. package/dist/lambda/index.js +11 -59
  189. package/dist/logging/LogManager.d.ts +1 -51
  190. package/dist/logging/Logger.d.ts +8 -47
  191. package/dist/logging/channels/ConsoleChannel.d.ts +1 -3
  192. package/dist/logging/channels/DailyFileChannel.d.ts +1 -3
  193. package/dist/logging/channels/FileChannel.d.ts +1 -3
  194. package/dist/logging/daily-file-path.d.ts +7 -16
  195. package/dist/logging/index.js +1 -1
  196. package/dist/logging/types.d.ts +13 -45
  197. package/dist/{logging-B-kngi3q.js → logging-zOY1XCtq.js} +52 -141
  198. package/dist/{loopback-guard-D0Kc7-xc.js → loopback-guard-DT9gHF0F.js} +41 -92
  199. package/dist/mail/Mail.d.ts +10 -106
  200. package/dist/mail/MailManager.d.ts +2 -60
  201. package/dist/mail/index.js +1 -1
  202. package/dist/mail/transports/LogTransport.d.ts +1 -4
  203. package/dist/mail/transports/MemoryTransport.d.ts +1 -63
  204. package/dist/mail/transports/ResendTransport.d.ts +1 -23
  205. package/dist/mail/transports/SmtpTransport.d.ts +1 -31
  206. package/dist/mail/types.d.ts +28 -150
  207. package/dist/{mail-DfEfSQEr.js → mail-76DWy9lj.js} +31 -289
  208. package/dist/mcp/McpServiceProvider.d.ts +4 -10
  209. package/dist/mcp/create-mcp-server.d.ts +42 -57
  210. package/dist/mcp/endpoint.d.ts +12 -36
  211. package/dist/mcp/index.js +1 -1
  212. package/dist/mvc/Controller.d.ts +46 -227
  213. package/dist/mvc/Router.d.ts +50 -129
  214. package/dist/mvc/inertia/InertiaEngine.d.ts +18 -48
  215. package/dist/mvc/inertia/shared.d.ts +6 -19
  216. package/dist/mvc/mount-route.d.ts +2 -6
  217. package/dist/mvc/view.d.ts +1 -2
  218. package/dist/notifications/Notification.d.ts +8 -75
  219. package/dist/notifications/NotificationManager.d.ts +15 -88
  220. package/dist/notifications/channels/DatabaseChannel.d.ts +1 -41
  221. package/dist/notifications/channels/MailChannel.d.ts +2 -31
  222. package/dist/notifications/channels/MemoryChannel.d.ts +2 -62
  223. package/dist/notifications/channels/SlackChannel.d.ts +3 -48
  224. package/dist/notifications/index.js +1 -1
  225. package/dist/notifications/notifiable-type.d.ts +3 -6
  226. package/dist/notifications/registry.d.ts +8 -27
  227. package/dist/notifications/types.d.ts +16 -53
  228. package/dist/{notifications-BGqmUNZ8.js → notifications-okWFs9ly.js} +37 -335
  229. package/dist/providers/AuthServiceProvider.d.ts +1 -3
  230. package/dist/providers/AuthorizationServiceProvider.d.ts +2 -3
  231. package/dist/providers/BroadcastServiceProvider.d.ts +1 -3
  232. package/dist/providers/CacheServiceProvider.d.ts +1 -3
  233. package/dist/providers/EncryptionServiceProvider.d.ts +1 -3
  234. package/dist/providers/ErrorServiceProvider.d.ts +1 -4
  235. package/dist/providers/EventServiceProvider.d.ts +1 -3
  236. package/dist/providers/HealthServiceProvider.d.ts +1 -3
  237. package/dist/providers/I18nServiceProvider.d.ts +6 -10
  238. package/dist/providers/InertiaServiceProvider.d.ts +1 -4
  239. package/dist/providers/LogServiceProvider.d.ts +1 -3
  240. package/dist/providers/MailServiceProvider.d.ts +1 -3
  241. package/dist/providers/NotificationServiceProvider.d.ts +1 -3
  242. package/dist/providers/OAuthServiceProvider.d.ts +1 -3
  243. package/dist/providers/QueueServiceProvider.d.ts +1 -3
  244. package/dist/providers/SchedulingServiceProvider.d.ts +1 -3
  245. package/dist/providers/StorageServiceProvider.d.ts +1 -3
  246. package/dist/queue/FailedJobReporter.d.ts +1 -24
  247. package/dist/queue/Job.d.ts +12 -99
  248. package/dist/queue/QueueManager.d.ts +6 -57
  249. package/dist/queue/Worker.d.ts +4 -65
  250. package/dist/queue/drivers/MemoryDriver.d.ts +3 -44
  251. package/dist/queue/drivers/RedisDriver.d.ts +7 -65
  252. package/dist/queue/drivers/SqsDriver.d.ts +6 -57
  253. package/dist/queue/drivers/SyncDriver.d.ts +10 -13
  254. package/dist/queue/index.js +2 -2
  255. package/dist/queue/types.d.ts +10 -92
  256. package/dist/{queue-CXrRK85G.js → queue-CcXCjuJI.js} +32 -260
  257. package/dist/redis/RedisApiTokenStore.d.ts +4 -56
  258. package/dist/redis/RedisEmailVerificationStore.d.ts +4 -37
  259. package/dist/redis/RedisOAuthStateStore.d.ts +2 -10
  260. package/dist/redis/RedisPasswordResetStore.d.ts +4 -37
  261. package/dist/redis/RedisRateLimitStore.d.ts +16 -49
  262. package/dist/redis/RedisSessionStore.d.ts +3 -44
  263. package/dist/redis/client.d.ts +2 -32
  264. package/dist/redis/index.js +47 -232
  265. package/dist/redis/redis-values.d.ts +6 -12
  266. package/dist/redis/scan-keys.d.ts +1 -4
  267. package/dist/request-CLOYytGP.js +68 -0
  268. package/dist/runtime/index.d.ts +2 -0
  269. package/dist/runtime/index.js +50 -92
  270. package/dist/scheduling/CronParser.d.ts +0 -29
  271. package/dist/scheduling/Schedule.d.ts +1 -153
  272. package/dist/scheduling/ScheduledTask.d.ts +0 -31
  273. package/dist/scheduling/Scheduler.d.ts +0 -70
  274. package/dist/scheduling/index.js +1 -1
  275. package/dist/scheduling/types.d.ts +4 -65
  276. package/dist/{scheduling-CPiEdtQd.js → scheduling-C6tcOtUl.js} +2 -287
  277. package/dist/storage/StorageManager.d.ts +0 -48
  278. package/dist/storage/drivers/LocalDriver.d.ts +1 -25
  279. package/dist/storage/drivers/MemoryDriver.d.ts +5 -35
  280. package/dist/storage/drivers/S3Driver.d.ts +6 -36
  281. package/dist/storage/drivers/s3-acl.d.ts +5 -10
  282. package/dist/storage/index.js +1 -1
  283. package/dist/storage/types.d.ts +27 -265
  284. package/dist/{storage-TLD9t0Q2.js → storage-BB59f07j.js} +17 -157
  285. package/dist/support/contained-path.d.ts +10 -20
  286. package/dist/support/error-polyfill.d.ts +4 -6
  287. package/dist/support/expiry.d.ts +17 -33
  288. package/dist/support/expiry.js +17 -33
  289. package/dist/support/import-map.d.ts +3 -7
  290. package/dist/support/inertia-defaults.d.ts +5 -10
  291. package/dist/support/redirect-target.d.ts +4 -6
  292. package/dist/support/stack-frames.d.ts +11 -50
  293. package/dist/support/trim-slashes.d.ts +4 -7
  294. package/dist/support/warn-once.d.ts +2 -6
  295. package/dist/{trim-slashes-ZJ_VsY5s.js → trim-slashes-BLY9hKAa.js} +4 -7
  296. package/dist/{vite-manifest-w_RSOvQW.js → vite-manifest-B_Iy5183.js} +34 -58
  297. package/package.json +2 -2
  298. package/dist/client-Dd7vLcqp.js +0 -27
  299. package/dist/context-DoD0c7J_.js +0 -26
  300. package/dist/endpoint-D-20PiHY.js +0 -46
  301. package/dist/hot-disposables-WsTX2ySN.js +0 -281
  302. package/dist/request-CVQwpu2J.js +0 -129
@@ -1,28 +1,16 @@
1
1
  /**
2
- * The wire protocol of an agent preflight (RFC 0016 §5.4), in a leaf module
3
- * so the two halves can share it without depending on each other.
4
- *
5
- * `Router` mounts the seam that answers a preflight; `agent/dispatch` builds
6
- * the request that asks for one and reads the answer back. Putting the names
7
- * in either of those would make one import the other — today only
8
- * `dispatch → Router` exists, and the day `Router` needs anything from
9
- * `agent/` that becomes a cycle.
10
- *
11
- * Not exported from the package index: an external dispatcher asks for a
12
- * preflight through `BuildToolRequestOptions.preflight`, and the header
13
- * spelling is this seam's business, not published API.
2
+ * The wire protocol of an agent preflight (RFC 0016 §5.4), in a leaf module so
3
+ * `Router` (which answers one) and `agent/dispatch` (which asks) share it
4
+ * without importing each other and closing a cycle. Not exported from the
5
+ * package index: an external dispatcher goes through
6
+ * `BuildToolRequestOptions.preflight`, and the header spelling stays internal.
14
7
  */
15
8
  /** Request header asking the route for a verdict instead of an execution. */
16
9
  export declare const AGENT_PREFLIGHT_HEADER = "X-Guren-Agent-Preflight";
17
10
  /**
18
- * Response header marking a body as a preflight verdict rather than the
19
- * route's own output.
20
- *
21
- * Load-bearing in two places that would otherwise mistake one for the other:
22
- * a route's `output` schema validation (which would reject the verdict and
23
- * turn it into a 500) and the MCP response mapping (which would advertise the
24
- * verdict as the tool's `structuredContent`, so an SDK client validates it
25
- * against the tool's output schema and throws). Both are answering the same
26
- * question — "is this the route's result?" — so both read the same marker.
11
+ * Response header marking a body as a preflight verdict rather than the route's
12
+ * own output. Read by the route's `output` schema validation (which would
13
+ * otherwise reject the verdict as a 500) and by the MCP response mapping (which
14
+ * would otherwise advertise it as the tool's `structuredContent`).
27
15
  */
28
16
  export declare const AGENT_PREFLIGHT_VERDICT_HEADER = "X-Guren-Agent-Preflight-Verdict";
@@ -0,0 +1,32 @@
1
+ /**
2
+ * The principal handoff seam (RFC 0017 §2), a leaf module the pipeline writes
3
+ * and the auth context reads — in either of them, one would import the other's
4
+ * whole layer. Keyed on the **object identity** of the `Request` handed to
5
+ * `app.fetch`, so it has no wire representation to forge, needs no
6
+ * `AsyncLocalStorage` (identical on workerd and Bun), and is collected with the
7
+ * request. `new Request(original)` and `clone()` carry nothing: that is the
8
+ * security property. Not exported from the package index — see the writer.
9
+ */
10
+ import type { AgentPrincipal } from '../agent/events.js';
11
+ /** What an installed principal answers for, for the life of one request. */
12
+ export interface InstalledAgentPrincipal {
13
+ /** Who the pipeline resolved before it built the request. */
14
+ principal: AgentPrincipal;
15
+ /**
16
+ * The scopes the pipeline gated the call with, carried for completeness.
17
+ * Nothing in the auth context consults them: scopes are the *pipeline's*
18
+ * verdict, taken before dispatch, and re-judging them inside the request
19
+ * would be a second, quieter scope rule beside the real one.
20
+ */
21
+ abilities: readonly string[];
22
+ }
23
+ /**
24
+ * Mark `request` as carrying `principal`, returning that same object — a copy
25
+ * would key the map on something the auth context never sees. Returning it is
26
+ * what makes the identity requirement hard to get wrong at a call site:
27
+ * `app.fetch(installAgentPrincipal(request, installed), env, ctx)`. Callers
28
+ * reach this through the pipeline's `handoff: 'seam'`, and the reader not at all.
29
+ */
30
+ export declare function installAgentPrincipal(request: Request, value: InstalledAgentPrincipal): Request;
31
+ /** The principal installed on this exact request object, or `undefined`. */
32
+ export declare function readAgentPrincipal(request: Request): InstalledAgentPrincipal | undefined;
@@ -1,25 +1,12 @@
1
1
  /**
2
2
  * The one set of request-reading rules: which content types are read, how a
3
3
  * repeated form field collapses, what an unreadable body falls back to, how a
4
- * multipart upload is pulled off the request, and how repeated query
5
- * parameters flatten for a validation schema.
6
- *
7
- * `@guren/testing`'s controller mock reads them through this subpath so a
8
- * mocked controller and a real one cannot disagree about a request. The mock
9
- * holds a `Request` rather than a Hono context, so it adapts — it wraps the
10
- * request in a `HonoRequest` and calls straight into these — rather than
11
- * reimplementing the decisions. A second copy is how the two came to disagree
12
- * on an uppercase media type, on a `;`-parameterized one, and on a repeated
13
- * `field[]`.
14
- *
15
- * `parseRequestUploads` is here for the same reason. It is deliberately not
16
- * `parseRequestBody` under another name — its own doc comment owns why, and is
17
- * the one place that argument is written out.
18
- *
19
- * Internal by the rules in `contributing/api-stability.md` — reachable only
20
- * through a deep import under `internal/`, never re-exported from an index.
21
- * `parseRequestPayload` beside them *is* public and stays exported from the
22
- * package root; this subpath exists for the ones that are not.
4
+ * multipart upload is read, and how repeated query parameters flatten.
5
+ * `@guren/testing`'s controller mock wraps its `Request` in a `HonoRequest` and
6
+ * calls into these rather than restating them — a second copy is how the two
7
+ * came to disagree on an uppercase media type and on a repeated `field[]`.
8
+ * Internal per `contributing/api-stability.md`: reachable only through this
9
+ * deep import. `parseRequestPayload` beside them is public.
23
10
  */
24
11
  export { parseRequestBody, parseRequestUploads, asRecord, flattenRequestQueries, } from '../http/request.js';
25
12
  export type { RequestBodyContext, RequestQueryContext, RequestUploads, RequestUploadsContext, } from '../http/request.js';
@@ -1,2 +1,2 @@
1
- import { i as parseRequestBody, n as flattenRequestQueries, o as parseRequestUploads, t as asRecord } from "../request-CVQwpu2J.js";
1
+ import { i as parseRequestBody, n as flattenRequestQueries, o as parseRequestUploads, t as asRecord } from "../request-CLOYytGP.js";
2
2
  export { asRecord, flattenRequestQueries, parseRequestBody, parseRequestUploads };
@@ -1,28 +1,16 @@
1
1
  /**
2
- * The one Hono route-path lexing rule, shared by every surface that has to say
3
- * what parameters a path declares: the router's own substitution and binding
4
- * scanners, RFC 0016's agent tool input, and `@guren/openapi`'s path template
5
- * and parameter list.
6
- *
7
- * Internal by the rules in `contributing/api-stability.md` — reachable only
8
- * through a deep import under `internal/`, never re-exported from an index.
9
- * It lives in `@guren/server` and is re-exported by
10
- * `@guren/core/internal/route-path` for the same build-order reason the
11
- * JSON Schema walker beside it does: core's index is
12
- * `export * from '@guren/server'`, so a server module cannot import a core
13
- * one.
14
- *
15
- * It exists because two lexers is how two surfaces come to describe one path
16
- * differently. They did: `@guren/openapi` carried its own copy with the `*`
17
- * outside the capture group, so `/files/:name*` yielded the parameter `name`
18
- * there and `name*` — what Hono actually registers — everywhere else. What
19
- * *does* legitimately differ is rendering, not lexing, and that difference now
20
- * lives at the one call site that needs it (see `stripExplodeModifier`).
2
+ * The one Hono route-path lexing rule, shared by the router's substitution and
3
+ * binding scanners, RFC 0016's agent tool input, and `@guren/openapi`'s path
4
+ * template. Two lexers is how `/files/:name*` came to yield the parameter
5
+ * `name` in openapi and `name*` — what Hono registers — everywhere else; what
6
+ * legitimately differs is rendering, at the call site (`stripExplodeModifier`).
7
+ * Internal per `contributing/api-stability.md`; re-exported by
8
+ * `@guren/core/internal/route-path`, since core's index is
9
+ * `export * from '@guren/server'` and a server module cannot import a core one.
21
10
  */
22
11
  export declare const PATH_PARAM_PATTERN: RegExp;
23
12
  /**
24
13
  * Param labels in path order, exactly as Hono registers them: constraints
25
- * dropped, a trailing `*` kept (it is part of the name), a trailing `?`
26
- * dropped (it is not).
14
+ * dropped, a trailing `*` kept (part of the name), a trailing `?` dropped.
27
15
  */
28
16
  export declare function extractPathParamNames(path: string): string[];
@@ -1,30 +1,18 @@
1
1
  //#region src/internal/route-path.ts
2
2
  /**
3
- * The one Hono route-path lexing rule, shared by every surface that has to say
4
- * what parameters a path declares: the router's own substitution and binding
5
- * scanners, RFC 0016's agent tool input, and `@guren/openapi`'s path template
6
- * and parameter list.
7
- *
8
- * Internal by the rules in `contributing/api-stability.md` — reachable only
9
- * through a deep import under `internal/`, never re-exported from an index.
10
- * It lives in `@guren/server` and is re-exported by
11
- * `@guren/core/internal/route-path` for the same build-order reason the
12
- * JSON Schema walker beside it does: core's index is
13
- * `export * from '@guren/server'`, so a server module cannot import a core
14
- * one.
15
- *
16
- * It exists because two lexers is how two surfaces come to describe one path
17
- * differently. They did: `@guren/openapi` carried its own copy with the `*`
18
- * outside the capture group, so `/files/:name*` yielded the parameter `name`
19
- * there and `name*` — what Hono actually registers — everywhere else. What
20
- * *does* legitimately differ is rendering, not lexing, and that difference now
21
- * lives at the one call site that needs it (see `stripExplodeModifier`).
3
+ * The one Hono route-path lexing rule, shared by the router's substitution and
4
+ * binding scanners, RFC 0016's agent tool input, and `@guren/openapi`'s path
5
+ * template. Two lexers is how `/files/:name*` came to yield the parameter
6
+ * `name` in openapi and `name*` — what Hono registers — everywhere else; what
7
+ * legitimately differs is rendering, at the call site (`stripExplodeModifier`).
8
+ * Internal per `contributing/api-stability.md`; re-exported by
9
+ * `@guren/core/internal/route-path`, since core's index is
10
+ * `export * from '@guren/server'` and a server module cannot import a core one.
22
11
  */
23
12
  const PATH_PARAM_PATTERN = /(^|\/):([A-Za-z0-9_-]+\*?)(?:\{[^{}]*\{[^{}]*\}[^{}]*\}|\{[^{}]*\})?\??/gu;
24
13
  /**
25
14
  * Param labels in path order, exactly as Hono registers them: constraints
26
- * dropped, a trailing `*` kept (it is part of the name), a trailing `?`
27
- * dropped (it is not).
15
+ * dropped, a trailing `*` kept (part of the name), a trailing `?` dropped.
28
16
  */
29
17
  function extractPathParamNames(path) {
30
18
  return Array.from(path.matchAll(PATH_PARAM_PATTERN), (match) => match[2]);
@@ -1,50 +1,18 @@
1
1
  /**
2
- * Zod 4 schema-reading primitives shared by everything that has to read an
3
- * application's schemas without parsing anything: the JSON Schema walker next
4
- * door (`zod-json-schema.ts`, behind `@guren/openapi`, RFC 0016's agent tools,
5
- * and `deriveAgentTools`), `@guren/cli`'s TypeScript-type renderer
6
- * (`src/schema-type-extractor.ts`), and its route contract check
7
- * (`src/route-contract-check.ts`).
8
- *
9
- * Internal by the rules in `contributing/api-stability.md`: reachable only
10
- * through a deep import under `internal/`, never re-exported from
11
- * `@guren/server`'s or `@guren/core`'s index. It sits in this package rather
12
- * than `@guren/core` because `zod-json-schema.ts` beside it has to, for the
13
- * build-order reason that module's header explains;
14
- * `@guren/core/internal/zod-compat` re-exports it so consumers outside this
15
- * package keep writing the core specifier.
16
- *
17
- * Zod 4 only. The zod 3 API (whether from the old `zod@3` package or the
18
- * `zod/v3` subpath that zod 4 ships for migration) tags every node with
19
- * `_def.typeName` and overloads `_def.type` to hold a nested schema — the
20
- * ambiguity behind a bug this module's predecessors fixed twice. Rather than
21
- * carrying both dialects forever, a v3 node is detected up front
22
- * (`isZod3Schema`) and refused with `ZOD3_UNSUPPORTED_MESSAGE`; everything
23
- * below it assumes the v4 layout, where `_def.type` is always the type name.
24
- *
25
- * What does NOT belong here: the two type switches that turn a node into an
26
- * output (a TypeScript type string vs. a JSON Schema object). Their leaf
27
- * vocabularies have legitimately diverged — the CLI renders `void`/`any`/
28
- * `never`, which JSON Schema has no way to express — and that is a rendering
29
- * decision, not schema-reading knowledge.
30
- *
31
- * No caller's `isOptional` belongs here either, but for a weaker reason than
32
- * "they are all right": the CLI's type renderer reads only the side of a
33
- * `.pipe()` it renders, while the JSON Schema walker and the CLI's route
34
- * contract check require both sides to permit omission, and *every* one of them
35
- * is an approximation that a sufficiently odd pipeline can fool. Fixing them
36
- * properly means simulating a parse, which is well beyond reading a `_def`.
37
- * They stay with their callers until someone does that. Applying the wrapper
38
- * vocabulary is not policy, though, which is why `unwrapSingleChild` does live
39
- * here: reaching a wrapper's child is schema-reading, while what a caller
40
- * *concludes* from that wrapper is the caller's to decide.
2
+ * Zod 4 schema-reading primitives shared by everything that reads an
3
+ * application's schemas without parsing: the JSON Schema walker next door and
4
+ * `@guren/cli`'s type renderer and route contract check. Internal per
5
+ * `contributing/api-stability.md`; it lives here rather than in `@guren/core` for
6
+ * the build-order reason `zod-json-schema.ts`'s header gives, re-exported by
7
+ * `@guren/core/internal/zod-compat`. Zod 4 only: a v3 node (tags `_def.typeName`,
8
+ * overloads `_def.type` with a nested schema) is refused up front, so `_def.type`
9
+ * is always the type name here. Rendering decisions (node → output, `isOptional`) stay with callers.
41
10
  */
42
11
  export interface ZodSchemaLike {
43
12
  _def?: Record<string, unknown>;
44
13
  /**
45
- * zod 4's internal container; `values` is its own computed set of accepted
46
- * literals, `def` the definition of whatever the node is (for a check entry,
47
- * the check itself — see `schemaChecks`).
14
+ * zod 4's internal container: `values` is its computed set of accepted
15
+ * literals, `def` the definition of whatever the node is.
48
16
  */
49
17
  _zod?: {
50
18
  values?: Set<unknown>;
@@ -54,33 +22,28 @@ export interface ZodSchemaLike {
54
22
  shape?: Record<string, ZodSchemaLike>;
55
23
  }
56
24
  /**
57
- * One entry of `_def.checks`, as zod stores it: a `check` discriminator plus
58
- * whatever that kind carries (`minimum`, `value`, `inclusive`, `pattern`, …).
59
- * Left open rather than modelled as a union — the kinds are zod's to add, and
60
- * a reader that does not recognise one must simply ignore it.
25
+ * One entry of `_def.checks`: a `check` discriminator plus whatever that kind
26
+ * carries. Left open rather than a union — the kinds are zod's to add, and an
27
+ * unrecognised one must simply be ignored.
61
28
  */
62
29
  export interface ZodCheckDef extends Record<string, unknown> {
63
30
  check: string;
64
31
  }
65
32
  /**
66
- * Which side of a schema is being read.
67
- *
68
- * - `output` — the parsed value, i.e. what a controller receives after
69
- * validation, or what a response body looks like.
70
- * - `input` — the value a client has to send over the wire. Coercing and
71
- * piped schemas can differ here from their output side.
33
+ * Which side of a schema is being read: `output` is the parsed value a
34
+ * controller receives, `input` what a client sends. Coercing and piped schemas
35
+ * differ between the two.
72
36
  */
73
37
  export type SchemaIo = 'input' | 'output';
74
38
  /**
75
- * Whether this node was authored with the zod 3 API. Only v3 sets
76
- * `_def.typeName` (`"ZodString"`), so its presence is the discriminator —
39
+ * Only zod 3 sets `_def.typeName`, so its presence is the discriminator —
77
40
  * checked before any other read, because on a v3 node `_def.type` holds a
78
41
  * nested *schema* and every v4-shaped read below would misfire on it.
79
42
  */
80
43
  export declare function isZod3Schema(schema: ZodSchemaLike): boolean;
81
44
  /**
82
- * The one refusal message, stated once so the CLI's console warning and the
83
- * OpenAPI document's warnings array cannot drift apart.
45
+ * The one refusal message, so the CLI's console warning and the OpenAPI
46
+ * document's warnings array cannot drift apart.
84
47
  */
85
48
  export declare const ZOD3_UNSUPPORTED_MESSAGE = "this schema was authored with the zod v3 API (zod@3 or the zod/v3 subpath), which Guren does not support. Rewrite it with the zod 4 API (`import { z } from 'zod'`).";
86
49
  /** The node's type name: `_def.type` (`"string"`, `"object"`, …) or the schema's own `.type`. */
@@ -88,11 +51,9 @@ export declare function getTypeName(schema: ZodSchemaLike): string | undefined;
88
51
  /** `getTypeName` with `'unknown'` for a node that has no readable name. */
89
52
  export declare function typeOf(schema: ZodSchemaLike): string;
90
53
  /**
91
- * The schema at `def[key]`, if it actually holds one. The object check is
92
- * load-bearing: `_def` is untyped data from someone else's package, and a key
93
- * holding a string or function must read as absent, not as a schema. (The
94
- * v3-era version of this helper took a key *list* and returned the first
95
- * match; with one dialect there is no precedence left to encode.)
54
+ * The schema at `def[key]`, if it actually holds one. `_def` is untyped data
55
+ * from someone else's package, so a key holding a string or function must read
56
+ * as absent rather than as a schema.
96
57
  */
97
58
  export declare function schemaAt(def: Record<string, unknown>, key: string): ZodSchemaLike | undefined;
98
59
  /** The schema wrapped by a single-child wrapper (`.optional()`, `.readonly()`, `.catch()`, …) — always `_def.innerType` in zod 4. */
@@ -102,17 +63,15 @@ export declare function arrayElement(def: Record<string, unknown>): ZodSchemaLik
102
63
  /** A record's value schema — `_def.valueType`. */
103
64
  export declare function recordValueType(def: Record<string, unknown>): ZodSchemaLike | undefined;
104
65
  /**
105
- * Whether this node is a `.transform()`'s output half — a wrapped function
106
- * with no type to read, as opposed to a schema that genuinely parses to
107
- * `unknown`.
66
+ * Whether this node is a `.transform()`'s output half — a wrapped function with
67
+ * no type to read, as opposed to a schema that parses to `unknown`.
108
68
  */
109
69
  export declare function isTransform(schema: ZodSchemaLike): boolean;
110
70
  /**
111
- * Both halves of a `.pipe()`. Zod 4 uses one `pipe` node for both `.pipe()`
112
- * and `.transform()`: `_def.in` is what a caller sends, `_def.out` what a
113
- * controller receives — except for a transform, whose out side is the
114
- * transform function itself and so has no type to read. `to` is therefore
115
- * absent for a transform, leaving `from` as the only readable answer.
71
+ * Both halves of a `.pipe()`. Zod 4 uses one `pipe` node for `.pipe()` and
72
+ * `.transform()` alike: `_def.in` is what a caller sends, `_def.out` what a
73
+ * controller receives — except for a transform, whose out side is the function
74
+ * itself, so `to` is absent and `from` is the only readable answer.
116
75
  */
117
76
  export declare function pipeSides(def: Record<string, unknown>): {
118
77
  from: ZodSchemaLike | undefined;
@@ -123,79 +82,53 @@ export declare function pipeSide(def: Record<string, unknown>, io: SchemaIo): Zo
123
82
  /** An object's property map — `_def.shape`, or the schema's own `.shape`. */
124
83
  export declare function objectShape(schema: ZodSchemaLike): Record<string, ZodSchemaLike> | undefined;
125
84
  /**
126
- * An enum's accepted values, read from zod's own computed set at
127
- * `_zod.values` rather than re-derived from `_def.entries`. The distinction
128
- * matters because `z.nativeEnum` produces the same node and a real TypeScript
129
- * numeric enum's runtime object carries reverse mappings (`{ A: 0, '0': 'A' }`)
130
- * — and any hand-rolled filter for those has a false positive: in
131
- * `{ A: 'B', B: 1 }`, the key `A` *looks* like a reverse entry (`entries['B']`
132
- * is a number) but zod accepts `'B'`. Reading zod's set makes what we document
133
- * what zod parses, by construction. The `entries` fallback (values unfiltered)
134
- * only runs if a future zod 4.x stops exposing the set.
85
+ * An enum's accepted values, from zod's computed `_zod.values` rather than
86
+ * re-derived from `_def.entries`: `z.nativeEnum` produces the same node, and a
87
+ * numeric enum's reverse mappings cannot be filtered without false positives
88
+ * (in `{ A: 'B', B: 1 }` the key `A` looks like one, yet zod accepts `'B'`).
89
+ * The `entries` fallback only runs if a future zod 4.x stops exposing the set.
135
90
  */
136
91
  export declare function enumValues(schema: ZodSchemaLike): Array<string | number>;
137
92
  /**
138
- * The refinements attached to a node (`.min()`, `.regex()`, `.multipleOf()`, …),
139
- * normalized to the definition objects zod keeps at each entry's `_zod.def`.
140
- *
141
- * Reading through `_zod.def` rather than the entry itself is what makes the
142
- * list uniform: `_def.checks` is heterogeneous by construction. A plain
143
- * refinement (`z.string().min(2)`) is stored as a bare check object, while a
144
- * format method (`z.string().url()`) stores the *format schema* — a full node
145
- * with `parse`, `safeParse` and the rest — in the same array. Both carry the
146
- * check definition at `_zod.def`, and nothing else about them is shared.
147
- *
148
- * Entries without a string `check` are dropped rather than passed through: a
149
- * caller switches on that discriminator, so an entry that has none can only be
150
- * misread.
93
+ * The refinements attached to a node, normalized to the definitions zod keeps
94
+ * at each entry's `_zod.def`. That indirection is what makes the list uniform:
95
+ * `_def.checks` mixes bare check objects (`z.string().min(2)`) with whole
96
+ * format schemas (`z.string().url()`), sharing only `_zod.def`. Entries without
97
+ * a string `check` are dropped — a caller switches on that discriminator.
151
98
  */
152
99
  export declare function schemaChecks(schema: ZodSchemaLike): ZodCheckDef[];
153
100
  /**
154
- * The node's declared format, if it has one — `'email'` for `z.email()`,
155
- * `'safeint'` for `z.int()`.
156
- *
157
- * This is only *half* of how zod 4 records a format, and the half a caller is
158
- * likeliest to forget. The top-level constructors (`z.email()`, `z.iso.datetime()`)
159
- * set `_def.format` and attach no check; the equivalent string methods
160
- * (`z.string().email()`, `z.string().datetime()`) attach a `string_format`
161
- * check and leave `_def.format` undefined. A reader that wants "the format of
162
- * this schema" has to consult both this and `schemaChecks`.
101
+ * The node's declared format (`'email'` for `z.email()`), which is only half of
102
+ * how zod 4 records one: top-level constructors set `_def.format` and attach no
103
+ * check, while the string methods (`z.string().email()`) attach a
104
+ * `string_format` check and leave `_def.format` undefined. A reader wanting
105
+ * "the format of this schema" must consult this *and* `schemaChecks`.
163
106
  */
164
107
  export declare function schemaFormat(schema: ZodSchemaLike): string | undefined;
165
108
  /** A literal's values — always the `_def.values` array in zod 4, which may hold more than one. */
166
109
  export declare function literalValues(def: Record<string, unknown>): unknown[];
167
110
  /**
168
- * Wrappers that neither add to a rendered type nor decide whether a field may
169
- * be omitted — whatever they wrap answers both questions. (`lazy` is here for
170
- * membership only: its child hides behind `_def.getter`, which no walker
171
- * calls, so looking through it reads as "contents unavailable" rather than
172
- * "unsupported type".)
111
+ * Wrappers that neither add to a rendered type nor decide omissibility.
112
+ * (`lazy` is here for membership only: its child hides behind `_def.getter`,
113
+ * which no walker calls, so it reads as "contents unavailable".)
173
114
  */
174
115
  export declare const TRANSPARENT_WRAPPERS: ReadonlySet<string>;
175
116
  /**
176
- * Wrappers that pass their type through but *do* decide presence: each makes a
177
- * field omissible, or (in `nonoptional`'s case) re-requires one.
117
+ * Wrappers passing their type through but deciding presence: each makes a field
118
+ * omissible, or (`nonoptional`) re-requires one.
178
119
  */
179
120
  export declare const PRESENCE_WRAPPERS: ReadonlySet<string>;
180
121
  /**
181
- * Every type name that carries exactly one nested schema and no shape of its
182
- * own — the union of the two sets above plus the two that render specially
183
- * (`nullable` becomes a union with null; a pipe holds one schema per side).
184
- *
185
- * This is the vocabulary, not a policy: callers partition it however their
186
- * rendering needs (the CLI splits transparent from presence-deciding because
187
- * it walks types and presence separately; the JSON Schema walker looks through all
188
- * of them uniformly). What none of them may do is disagree about *membership*
189
- * — a name known to one walker and not the other silently changes an output,
190
- * which is why the list lives here rather than once per package.
122
+ * Every type name carrying exactly one nested schema and no shape of its own —
123
+ * the two sets above plus the two that render specially (`nullable` becomes a
124
+ * union with null; a pipe holds one schema per side). Vocabulary, not policy:
125
+ * callers partition it as their rendering needs, but a name known to one walker
126
+ * and not another silently changes an output, so membership lives here.
191
127
  */
192
128
  export declare const SINGLE_CHILD_WRAPPERS: ReadonlySet<string>;
193
129
  /**
194
130
  * The schema a single-child wrapper wraps, in the direction being read; absent
195
- * for a node that is not a wrapper, or one whose child cannot be reached
196
- * (`z.lazy()` hides its schema behind a getter no walker calls).
197
- *
198
- * Membership comes from the set above, for the reason stated there; a pipe
199
- * resolves per direction, for the reason stated on `pipeSides`.
131
+ * for a non-wrapper, or one whose child cannot be reached (`z.lazy()` hides its
132
+ * schema behind a getter no walker calls).
200
133
  */
201
134
  export declare function unwrapSingleChild(schema: ZodSchemaLike, io: SchemaIo): ZodSchemaLike | undefined;