@guren/server 1.2.0 → 1.4.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 (44) hide show
  1. package/dist/{Application-DN9Ndl37.d.ts → Application-BvBqgc2k.d.ts} +204 -22
  2. package/dist/{AuthManager-SfhCNkAU.d.ts → AuthManager-C84xF5ks.d.ts} +1 -1
  3. package/dist/{BroadcastManager-CGWl9rUO.d.ts → BroadcastManager-D8KoJxiV.d.ts} +21 -0
  4. package/dist/{CacheManager-BkvHEOZX.d.ts → CacheManager-BmDzUKrF.d.ts} +17 -0
  5. package/dist/{ConsoleKernel-DxmUxdAz.d.ts → ConsoleKernel-Dw9X9qZY.d.ts} +1 -1
  6. package/dist/{I18nManager-BiSoczfV.d.ts → I18nManager-CmUqj6bU.d.ts} +1 -1
  7. package/dist/{McpServiceProvider-JW6PDVMD.js → McpServiceProvider-TZWQWXCT.js} +2 -2
  8. package/dist/{Scheduler-BstvSca7.d.ts → Scheduler-pZiT8i57.d.ts} +2 -0
  9. package/dist/{api-token-BSSCLlFW.d.ts → api-token-COQHXyM_.d.ts} +123 -1
  10. package/dist/auth/index.d.ts +5 -5
  11. package/dist/auth/index.js +3 -1
  12. package/dist/authorization/index.js +2 -2
  13. package/dist/broadcasting/index.d.ts +2 -2
  14. package/dist/broadcasting/index.js +2 -1
  15. package/dist/cache/index.d.ts +2 -2
  16. package/dist/cache/index.js +2 -1
  17. package/dist/{chunk-EGU5KB7V.js → chunk-4SBGSJNT.js} +31 -1
  18. package/dist/{chunk-THSX7OOR.js → chunk-63SKW5PS.js} +3 -0
  19. package/dist/{chunk-2T6JN4VR.js → chunk-AUXQISW5.js} +169 -14
  20. package/dist/chunk-DCYKSYAT.js +63 -0
  21. package/dist/{chunk-ZRBLZY3M.js → chunk-FZD2AKJI.js} +1 -1
  22. package/dist/{chunk-HLXL2AYJ.js → chunk-JIT7QVMJ.js} +2 -2
  23. package/dist/{chunk-HKQSAFSN.js → chunk-MC752CQT.js} +15 -0
  24. package/dist/{chunk-WVY45EIW.js → chunk-NQCZQAJL.js} +93 -28
  25. package/dist/{chunk-VT5KRDPH.js → chunk-NYQGAWDN.js} +49 -1
  26. package/dist/{chunk-44F7JQ7I.js → chunk-XMQZENBP.js} +35 -1
  27. package/dist/{client-CKXJLsTe.d.ts → client-BQwF2b9Y.d.ts} +7 -0
  28. package/dist/{email-verification-CAeArjui.d.ts → email-verification-H_WlpsVH.d.ts} +1 -1
  29. package/dist/{errors-JOOPDDQ6.js → errors-PUNHAFL2.js} +1 -1
  30. package/dist/i18n/index.d.ts +2 -2
  31. package/dist/index.d.ts +129 -19
  32. package/dist/index.js +314 -105
  33. package/dist/lambda/index.d.ts +8 -8
  34. package/dist/mcp/index.d.ts +54 -20
  35. package/dist/mcp/index.js +2 -2
  36. package/dist/notifications/index.d.ts +8 -8
  37. package/dist/queue/index.d.ts +8 -8
  38. package/dist/redis/index.d.ts +11 -21
  39. package/dist/redis/index.js +42 -6
  40. package/dist/runtime/index.d.ts +8 -8
  41. package/dist/runtime/index.js +1 -1
  42. package/dist/scheduling/index.d.ts +2 -2
  43. package/dist/scheduling/index.js +2 -1
  44. package/package.json +2 -2
@@ -1,18 +1,18 @@
1
1
  import * as hono from 'hono';
2
2
  import { Context, MiddlewareHandler, Hono, Next, ExecutionContext } from 'hono';
3
- import { l as OAuthManager, g as AuthContext, j as ApiToken, C as CreateSessionMiddlewareOptions } from './api-token-BSSCLlFW.js';
4
- import { A as AuthManager } from './AuthManager-SfhCNkAU.js';
3
+ import { l as OAuthManager, g as AuthContext, j as ApiToken, C as CreateSessionMiddlewareOptions } from './api-token-COQHXyM_.js';
4
+ import { A as AuthManager } from './AuthManager-C84xF5ks.js';
5
5
  import { InlineConfig, ViteDevServer } from 'vite';
6
6
  import { E as EventManager } from './EventManager-CmIoLt7r.js';
7
- import { C as CacheManager } from './CacheManager-BkvHEOZX.js';
7
+ import { C as CacheManager } from './CacheManager-BmDzUKrF.js';
8
8
  import { M as MailManager } from './MailManager-DpMvYiP9.js';
9
9
  import { L as LogManager } from './LogManager-7mxnkaPM.js';
10
- import { I as I18nManager } from './I18nManager-BiSoczfV.js';
11
- import { B as BroadcastManager } from './BroadcastManager-CGWl9rUO.js';
10
+ import { I as I18nManager } from './I18nManager-CmUqj6bU.js';
11
+ import { B as BroadcastManager } from './BroadcastManager-D8KoJxiV.js';
12
12
  import { E as Encrypter, A as AppKeyring } from './app-key-CsBfRC_Q.js';
13
13
  import { S as StorageManager } from './StorageManager-oZTHqaza.js';
14
14
  import { H as HealthManager } from './HealthManager-DUyMIzsZ.js';
15
- import { S as Scheduler } from './Scheduler-BstvSca7.js';
15
+ import { S as Scheduler } from './Scheduler-pZiT8i57.js';
16
16
  import { G as Gate } from './Gate-CynjZCtS.js';
17
17
  import { M as Middleware } from './index-9_Jzj5jo.js';
18
18
 
@@ -52,8 +52,13 @@ interface CsrfOptions {
52
52
  };
53
53
  }
54
54
  /**
55
- * Get the CSRF token from the current session.
56
- * Creates a new token if one doesn't exist.
55
+ * Get the request's CSRF token.
56
+ *
57
+ * Signed token bound to the session when a stable one exists, otherwise a
58
+ * stateless signed double-submit token for guests. Nothing is stored
59
+ * server-side, so anonymous page views cost no session writes. A cookie
60
+ * token that is still valid for this request's mode is reused; otherwise a
61
+ * fresh token is minted and set on the response by the middleware.
57
62
  */
58
63
  declare function getCsrfToken(ctx: Context): string;
59
64
  /**
@@ -61,16 +66,43 @@ declare function getCsrfToken(ctx: Context): string;
61
66
  */
62
67
  declare function csrfField(ctx: Context): string;
63
68
  /**
64
- * Verify that the provided token matches the session's CSRF token.
69
+ * Verify a request token.
70
+ *
71
+ * The token must first carry a valid app-key signature (proving this server
72
+ * minted it). Then, by mode:
73
+ * - **Session-bound** (token carries a `sid`): the id must match the live
74
+ * session. This is immune to cookie injection — a sibling-subdomain
75
+ * attacker can plant a cookie but cannot know the victim's session id.
76
+ * - **Stateless** (guest, no `sid`): the token must match the `XSRF-TOKEN`
77
+ * cookie (double-submit). Guests hold no authenticated state to protect.
78
+ *
79
+ * Legacy fallback: tokens stored in sessions by earlier releases keep
80
+ * verifying against the session until those sessions expire. Remove this
81
+ * branch once all pre-upgrade sessions have aged out (a major release).
65
82
  */
66
83
  declare function verifyCsrfToken(ctx: Context, token: string | undefined): boolean;
67
84
  /**
68
85
  * Creates a CSRF protection middleware.
69
86
  *
70
87
  * This middleware:
71
- * - Generates and stores a CSRF token in the session for GET requests
72
- * - Validates the CSRF token for state-changing HTTP methods (POST, PUT, PATCH, DELETE)
88
+ * - Issues a signed token in the `XSRF-TOKEN` cookie on safe requests.
89
+ * With a logged-in session the token is bound to the session id; for
90
+ * guests it is a stateless double-submit token. Nothing is stored
91
+ * server-side, so anonymous traffic costs no session writes and session
92
+ * middleware is optional.
93
+ * - Validates the token for state-changing HTTP methods (POST, PUT, PATCH,
94
+ * DELETE): always requires a valid app-key signature, then the bound
95
+ * session id or (guest) the cookie match.
73
96
  * - Supports token submission via form field (_token) or header (X-CSRF-TOKEN)
97
+ * - Keeps verifying tokens stored in sessions by earlier releases until
98
+ * those sessions expire
99
+ * - Exempts the dev-only MCP endpoint while it is mounted, since agent
100
+ * clients cannot fetch a token first (it guards local-only access instead)
101
+ *
102
+ * `cookie: false` disables the `XSRF-TOKEN` cookie for apps that deliver the
103
+ * token themselves (meta tag / form field). Session-bound tokens still
104
+ * verify without the cookie; guest (stateless) tokens require the cookie, so
105
+ * disable it only for session-authenticated flows.
74
106
  *
75
107
  * @example
76
108
  * ```ts
@@ -84,7 +116,15 @@ declare function verifyCsrfToken(ctx: Context, token: string | undefined): boole
84
116
  */
85
117
  declare function createCsrfMiddleware(options?: CsrfOptions): MiddlewareHandler;
86
118
 
87
- interface InertiaOptions {
119
+ /**
120
+ * Per-response form of {@link InertiaDocumentOptions}: the same fields, already
121
+ * resolved to strings. Each one overrides the app-wide default registered
122
+ * through {@link setInertiaDocument}.
123
+ */
124
+ type InertiaDocumentOverrides = {
125
+ readonly [K in keyof InertiaDocumentOptions]?: string;
126
+ };
127
+ interface InertiaOptions extends InertiaDocumentOverrides {
88
128
  readonly url?: string;
89
129
  readonly version?: string;
90
130
  readonly status?: number;
@@ -120,6 +160,66 @@ interface InertiaSsrOptions {
120
160
  manifest?: string;
121
161
  render?: InertiaSsrRenderer;
122
162
  }
163
+ interface InertiaDocumentContext {
164
+ /** Page component being rendered, e.g. `"Docs/Show"`. */
165
+ readonly component: string;
166
+ }
167
+ type InertiaDocumentValue = string | ((context: InertiaDocumentContext) => string | undefined);
168
+ interface InertiaDocumentOptions {
169
+ /**
170
+ * Class attribute for the root `<body>` element. Pass a function to vary it
171
+ * per page component — a docs section that needs a light surface while the
172
+ * marketing pages keep a dark one, for instance.
173
+ */
174
+ readonly bodyClass?: InertiaDocumentValue;
175
+ /**
176
+ * CSS inlined into `<head>` ahead of the stylesheet links. Keep it to the
177
+ * few declarations that decide the first paint (surface and text colors);
178
+ * the main stylesheet still wins for everything it defines later.
179
+ */
180
+ readonly criticalCss?: InertiaDocumentValue;
181
+ /**
182
+ * Body of a blocking inline `<script>` executed before the first paint.
183
+ * Use it for theme prepaint logic that has to read `localStorage` or
184
+ * `matchMedia` before React hydrates.
185
+ */
186
+ readonly prepaintScript?: InertiaDocumentValue;
187
+ }
188
+ /**
189
+ * Register app-wide document defaults for server-rendered Inertia responses.
190
+ *
191
+ * Without this, the `<body>` ships without a class and nothing is inlined into
192
+ * `<head>`, so a page whose theme is applied by a client effect flashes the
193
+ * stylesheet's default surface color until React hydrates. Call it at module
194
+ * scope in the app entry so every runtime (Bun, serverless handlers, generated
195
+ * worker bundles) picks it up.
196
+ *
197
+ * Registration is process-wide and not request-scoped: calling this while
198
+ * requests are in flight leaks the new policy into them. Use the matching
199
+ * {@link InertiaOptions} fields for a single response instead.
200
+ *
201
+ * The values are emitted verbatim inside `<style>` / `<script>` elements —
202
+ * they are developer-authored assets, never user input.
203
+ *
204
+ * ```typescript
205
+ * setInertiaDocument({
206
+ * bodyClass: ({ component }) => (component.startsWith('Docs/') ? 'docs-theme' : undefined),
207
+ * })
208
+ * ```
209
+ *
210
+ * Pass `undefined` to clear (test isolation).
211
+ */
212
+ declare function setInertiaDocument(options: InertiaDocumentOptions | undefined): void;
213
+ /**
214
+ * Register a process-wide default SSR renderer.
215
+ *
216
+ * Serverless adapters whose bundlers cannot resolve a runtime file path
217
+ * (Cloudflare Workers has no filesystem for `GUREN_INERTIA_SSR_ENTRY`'s
218
+ * dynamic import) register the statically imported renderer once at module
219
+ * scope. Per-call `ssr.render` still takes precedence; pass `undefined` to
220
+ * clear (test isolation).
221
+ */
222
+ declare function setInertiaSsrRenderer(renderer: InertiaSsrRenderer | undefined): void;
123
223
  declare function inertia(component: string, props: Record<string, unknown>, options?: InertiaOptions): Promise<Response>;
124
224
 
125
225
  /**
@@ -200,7 +300,7 @@ declare function getValidatedData<T = Record<string, unknown>>(ctx: Context): T
200
300
  *
201
301
  * const CreateUserSchema = z.object({
202
302
  * name: z.string().min(1),
203
- * email: z.string().email(),
303
+ * email: z.email(),
204
304
  * })
205
305
  *
206
306
  * app.post('/users', validateRequest(CreateUserSchema), (c) => {
@@ -1260,6 +1360,7 @@ interface ServiceBindings {
1260
1360
  /** Structural type for DI containers, avoiding a hard dependency on Container. */
1261
1361
  interface ContainerLike {
1262
1362
  make(key: string): unknown;
1363
+ has?(key: string): boolean;
1263
1364
  }
1264
1365
  /**
1265
1366
  * Duck-type interface for Zod-like schemas.
@@ -1786,6 +1887,8 @@ type ModelBindingResolver = (value: string) => Promise<unknown>;
1786
1887
  */
1787
1888
  interface BindableModel {
1788
1889
  findOrFail(id: unknown, key?: string): Promise<unknown>;
1890
+ /** Bound values are model classes at runtime; the constructor name is the introspection payload. */
1891
+ readonly name?: string;
1789
1892
  }
1790
1893
  type SchemaLike<T = unknown> = ValidationSchema<T> | undefined;
1791
1894
  type InferSchema<TSchema extends SchemaLike<unknown>> = TSchema extends ValidationSchema<infer TValue> ? TValue : never;
@@ -1847,6 +1950,8 @@ interface RouteDefinition {
1847
1950
  name: string;
1848
1951
  action: string;
1849
1952
  };
1953
+ /** Route model bindings: param name → bound model class name (from `bind`) */
1954
+ bindings?: Record<string, string>;
1850
1955
  summary?: string;
1851
1956
  description?: string;
1852
1957
  tags?: string[];
@@ -1891,6 +1996,8 @@ declare class Router<M extends string = never> {
1891
1996
  private readonly middlewareAliases;
1892
1997
  private readonly middlewareGroups;
1893
1998
  private readonly modelBindings;
1999
+ /** Model class names for router-level bind(param, Model) calls — resolver-only binds carry no name. */
2000
+ private readonly modelBindingNames;
1894
2001
  aliasMiddleware<N extends string>(name: N, handler: MiddlewareHandler): Router<M | N>;
1895
2002
  groupMiddleware<N extends string>(name: N, middlewareNames: M[]): Router<M | N>;
1896
2003
  middleware(...names: M[]): RouterMiddlewareGroupBuilder<M>;
@@ -1943,6 +2050,10 @@ declare class RouterMiddlewareGroupBuilder<M extends string = never> {
1943
2050
  delete<TParamsSchema extends SchemaLike<unknown>, TQuerySchema extends SchemaLike<unknown>, TBodySchema extends SchemaLike<unknown>, TOutputSchema extends SchemaLike<unknown>>(path: string, options: RouteContractOptions<TParamsSchema, TQuerySchema, TBodySchema, TOutputSchema>, handler: TypedRouteHandler<TParamsSchema, TQuerySchema, TBodySchema, TOutputSchema>): RouteBuilder<M>;
1944
2051
  }
1945
2052
 
2053
+ /**
2054
+ * Constructor shape accepted wherever a provider class can be registered.
2055
+ */
2056
+ type ServiceProviderConstructor = new (container: Container) => ServiceProvider;
1946
2057
  /**
1947
2058
  * Base service provider class.
1948
2059
  *
@@ -2010,11 +2121,11 @@ declare class ProviderManager {
2010
2121
  /**
2011
2122
  * Register a provider.
2012
2123
  */
2013
- register(providerOrClass: ServiceProvider | (new (container: Container) => ServiceProvider)): this;
2124
+ register(providerOrClass: ServiceProvider | ServiceProviderConstructor): this;
2014
2125
  /**
2015
2126
  * Register multiple providers.
2016
2127
  */
2017
- registerMany(providers: Array<ServiceProvider | (new (container: Container) => ServiceProvider)>): this;
2128
+ registerMany(providers: Array<ServiceProvider | ServiceProviderConstructor>): this;
2018
2129
  /**
2019
2130
  * Register all non-deferred providers.
2020
2131
  */
@@ -2041,6 +2152,75 @@ declare class ProviderManager {
2041
2152
  getDeferredServices(): string[];
2042
2153
  }
2043
2154
 
2155
+ /**
2156
+ * Declarative definition of an application module — a self-contained
2157
+ * `modules/<name>/` directory that can register routes and providers, per
2158
+ * RFC 0002. Unlike `definePlugin()`, a module has no config stage and no
2159
+ * register/boot lifecycle of its own: it's a plain descriptor bundling
2160
+ * providers and a route registrar that `Application` folds into its own
2161
+ * provider list and route mounting.
2162
+ */
2163
+ interface ModuleDefinition {
2164
+ /** Diagnostic name; also the expected directory name under `modules/`. */
2165
+ name: string;
2166
+ /**
2167
+ * URL prefix applied to all module routes via `router.group(prefix, ...)`.
2168
+ * Declarative on purpose — tooling can read a module's URL surface
2169
+ * statically without executing the registrar.
2170
+ */
2171
+ prefix?: string;
2172
+ /** Route registrar, invoked after `options.routes` during boot. */
2173
+ routes?: (router: Router) => void | Promise<void>;
2174
+ /** Providers appended to the application's provider list. */
2175
+ providers?: ServiceProviderConstructor[];
2176
+ }
2177
+ /**
2178
+ * A module as `Application` consumes it — `providers` normalized to always
2179
+ * be an array so callers don't repeat the `?? []` fallback.
2180
+ */
2181
+ interface GurenModule {
2182
+ name: string;
2183
+ prefix?: string;
2184
+ routes?: (router: Router) => void | Promise<void>;
2185
+ providers: ServiceProviderConstructor[];
2186
+ }
2187
+ /**
2188
+ * Define a Guren application module without boilerplate.
2189
+ *
2190
+ * @example
2191
+ * ```typescript
2192
+ * // modules/billing/index.ts
2193
+ * export const billingModule = defineModule({
2194
+ * name: 'billing',
2195
+ * prefix: '/billing',
2196
+ * routes: registerBillingRoutes,
2197
+ * providers: [BillingServiceProvider],
2198
+ * })
2199
+ *
2200
+ * // src/app.ts
2201
+ * createApp({ routes, providers, modules: [billingModule] })
2202
+ * ```
2203
+ */
2204
+ declare function defineModule(definition: ModuleDefinition): GurenModule;
2205
+ /**
2206
+ * Runs a module's route registrar against `router`, applying its `prefix`
2207
+ * via `router.group()` when set. Shared by `Application.mountRoutes()` (at
2208
+ * boot) and the CLI's route loader (for `guren codegen`/`audit`/`routes`/
2209
+ * `openapi:generate`, which need the same route set without booting a real
2210
+ * app) so both stay in sync — a bugfix to one path fixes the other.
2211
+ *
2212
+ * `router.group(prefix, callback)`'s callback is synchronous — it pushes
2213
+ * the prefix, invokes the callback, then pops it, with no support for
2214
+ * awaiting inside. Capturing the registrar's return value and awaiting it
2215
+ * after `group()` returns preserves prefixing for the common case (a
2216
+ * synchronous registrar, or an async one that calls `router.get`/`post`/
2217
+ * etc. before its first `await`); route calls after an `await` inside an
2218
+ * async, prefixed module registrar would run with the prefix already
2219
+ * popped. Registrars with no prefix don't go through group() and have no
2220
+ * such limitation.
2221
+ */
2222
+ declare function mountModuleRoutes(router: Router, gurenModule: GurenModule): Promise<void>;
2223
+
2044
2224
  declare const GUREN_ASCII_ART: string;
2045
2225
  interface DevBannerOptions {
2046
2226
  hostname: string;
@@ -2063,10 +2243,7 @@ interface StartedViteDevServer {
2063
2243
  declare function startViteDevServer(options?: StartViteDevServerOptions): Promise<StartedViteDevServer>;
2064
2244
 
2065
2245
  type BootCallback = (app: Hono) => void | Promise<void>;
2066
- /**
2067
- * Service provider class constructor type.
2068
- */
2069
- type ServiceProviderConstructor = new (container: Container) => ServiceProvider;
2246
+
2070
2247
  type RouteRegistration = (router: Router) => void | Promise<void>;
2071
2248
  type ApplicationFeatures = Record<string, unknown>;
2072
2249
  interface ApplicationOptions {
@@ -2075,6 +2252,12 @@ interface ApplicationOptions {
2075
2252
  readonly auth?: AuthPluginOptions;
2076
2253
  readonly discover?: boolean;
2077
2254
  readonly routes?: RouteRegistration;
2255
+ /**
2256
+ * Application modules (RFC 0002) — each module's providers are appended
2257
+ * to `providers` below, and its route registrar runs after `routes`
2258
+ * (wrapped in `router.group(prefix, ...)` when the module declares one).
2259
+ */
2260
+ readonly modules?: GurenModule[];
2078
2261
  readonly features?: ApplicationFeatures;
2079
2262
  /**
2080
2263
  * Configure or disable the default security headers middleware.
@@ -2150,8 +2333,7 @@ declare class Application {
2150
2333
  private mountSecurityDefaults;
2151
2334
  private mountHostAuthorization;
2152
2335
  /**
2153
- * Mounts the MCP endpoint at /_guren/mcp when explicitly enabled.
2154
- * Requires GUREN_MCP=1 environment variable. Never active in production.
2336
+ * Mounts the MCP endpoint at /_guren/mcp when enabled.
2155
2337
  * This allows AI coding agents to introspect the project.
2156
2338
  */
2157
2339
  private mountMcpEndpoint;
@@ -2181,4 +2363,4 @@ declare class Application {
2181
2363
  }
2182
2364
  declare function createApp(options?: ApplicationOptions): Application;
2183
2365
 
2184
- export { type NotificationAttachment as $, Application as A, type InertiaPagePayload as B, Container as C, type DevBannerOptions as D, type ErrorResponse as E, type FailedJob as F, GUREN_ASCII_ART as G, type HostAuthorizationOptions as H, type InertiaOptions as I, type InertiaResponse as J, type InertiaSharedProps as K, type InertiaSsrContext as L, type InertiaSsrOptions as M, NotificationManager as N, type InertiaSsrRenderer as O, type Provider as P, QueueManager as Q, type InertiaSsrResult as R, ServiceProvider as S, type InferInertiaProps as T, Job as U, type JobClass as V, type JobFailureHandler as W, type JobHandler as X, type JobOptions as Y, type Notifiable as Z, Notification as _, type StartViteDevServerOptions as a, setExceptionHandler as a$, type NotificationChannel as a0, type NotificationChannelFactory as a1, type NotificationClass as a2, type NotificationMailMessage as a3, type NotificationManagerOptions as a4, ProviderManager as a5, type QueueConfig as a6, type QueueDriver as a7, type QueueDriverFactory as a8, type QueuedJob as a9, abortIf as aA, abortUnless as aB, clearJobRegistry as aC, createApp as aD, createContainer as aE, createCsrfMiddleware as aF, createExceptionHandler as aG, createHostAuthorizationMiddleware as aH, createNotificationManager as aI, createQueueManager as aJ, createSecurityHeaders as aK, csrfField as aL, formatValidationErrors as aM, getContainer as aN, getCsrfToken as aO, getExceptionHandler as aP, getInertiaSharedPropsResolver as aQ, getJob as aR, getNotificationManager as aS, getQueueDriver as aT, getRegisteredJobs as aU, getValidatedData as aV, inertia as aW, parseRequestPayload as aX, registerJob as aY, resolve as aZ, setContainer as a_, type RendererRegistration as aa, type ResolvedSharedInertiaProps as ab, type ResourceRouteOptions as ac, type RouteBuilder as ad, type RouteContractOptions as ae, type RouteDefinition as af, type RouteOpenApiMetadata as ag, type ResourceAction as ah, Router as ai, type SecurityHeadersOptions as aj, type SentNotification as ak, type ServiceBinding as al, type ServiceClass as am, type ServiceFactory as an, type ServiceProviderClass as ao, type ServiceProviderConstructor as ap, type ServiceProviderOptions as aq, type SharedInertiaPropsResolver as ar, type SlackAttachment as as, type SlackBlock as at, type SlackMessage as au, VALIDATED_DATA_KEY as av, type ValidateRequestOptions as aw, type ValidationSchema as ax, type WorkerOptions as ay, abort as az, type StartedViteDevServer as b, setInertiaSharedProps as b0, setNotificationManager as b1, setQueueDriver as b2, shareInertiaProps as b3, validate as b4, validateRequest as b5, validateRequestWith as b6, validateSafe as b7, verifyCsrfToken as b8, type ServiceBindings as c, type ApplicationListenOptions as d, type ApplicationOptions as e, type AuthPayload as f, type AuthPluginOptions as g, CSRF_FORM_FIELD as h, CSRF_HEADER_NAME as i, CSRF_TOKEN_KEY as j, type ContextualBinding as k, logDevServerBanner as l, type ContextualBindingBuilder as m, type ContextualNeedsBuilder as n, Controller as o, type ControllerInertiaProps as p, type CsrfOptions as q, type DatabaseChannelOptions as r, startViteDevServer as s, type DatabaseNotification as t, type ExceptionClass as u, ExceptionHandler as v, type ExceptionHandlerOptions as w, type ExceptionRenderer as x, type ExceptionReporter as y, type HstsOptions as z };
2366
+ export { type JobHandler as $, Application as A, type GurenModule as B, Container as C, type DevBannerOptions as D, type ErrorResponse as E, type FailedJob as F, GUREN_ASCII_ART as G, type HostAuthorizationOptions as H, type HstsOptions as I, type InertiaDocumentContext as J, type InertiaDocumentOptions as K, type InertiaOptions as L, type InertiaPagePayload as M, NotificationManager as N, type InertiaResponse as O, type Provider as P, QueueManager as Q, type InertiaSharedProps as R, ServiceProvider as S, type InertiaSsrContext as T, type InertiaSsrOptions as U, type InertiaSsrRenderer as V, type InertiaSsrResult as W, type InferInertiaProps as X, Job as Y, type JobClass as Z, type JobFailureHandler as _, type StartViteDevServerOptions as a, inertia as a$, type JobOptions as a0, type ModuleDefinition as a1, type Notifiable as a2, Notification as a3, type NotificationAttachment as a4, type NotificationChannel as a5, type NotificationChannelFactory as a6, type NotificationClass as a7, type NotificationMailMessage as a8, type NotificationManagerOptions as a9, type ValidateRequestOptions as aA, type ValidationSchema as aB, type WorkerOptions as aC, abort as aD, abortIf as aE, abortUnless as aF, clearJobRegistry as aG, createApp as aH, createContainer as aI, createCsrfMiddleware as aJ, createExceptionHandler as aK, createHostAuthorizationMiddleware as aL, createNotificationManager as aM, createQueueManager as aN, createSecurityHeaders as aO, csrfField as aP, defineModule as aQ, formatValidationErrors as aR, getContainer as aS, getCsrfToken as aT, getExceptionHandler as aU, getInertiaSharedPropsResolver as aV, getJob as aW, getNotificationManager as aX, getQueueDriver as aY, getRegisteredJobs as aZ, getValidatedData as a_, ProviderManager as aa, type QueueConfig as ab, type QueueDriver as ac, type QueueDriverFactory as ad, type QueuedJob as ae, type RendererRegistration as af, type ResolvedSharedInertiaProps as ag, type ResourceRouteOptions as ah, type RouteBuilder as ai, type RouteContractOptions as aj, type RouteDefinition as ak, type RouteOpenApiMetadata as al, type ResourceAction as am, Router as an, type SecurityHeadersOptions as ao, type SentNotification as ap, type ServiceBinding as aq, type ServiceClass as ar, type ServiceFactory as as, type ServiceProviderClass as at, type ServiceProviderOptions as au, type SharedInertiaPropsResolver as av, type SlackAttachment as aw, type SlackBlock as ax, type SlackMessage as ay, VALIDATED_DATA_KEY as az, type StartedViteDevServer as b, mountModuleRoutes as b0, parseRequestPayload as b1, registerJob as b2, resolve as b3, setContainer as b4, setExceptionHandler as b5, setInertiaDocument as b6, setInertiaSharedProps as b7, setInertiaSsrRenderer as b8, setNotificationManager as b9, setQueueDriver as ba, shareInertiaProps as bb, validate as bc, validateRequest as bd, validateRequestWith as be, validateSafe as bf, verifyCsrfToken as bg, type ServiceProviderConstructor as c, type ServiceBindings as d, type ApplicationListenOptions as e, type ApplicationOptions as f, type AuthPayload as g, type AuthPluginOptions as h, CSRF_FORM_FIELD as i, CSRF_HEADER_NAME as j, CSRF_TOKEN_KEY as k, logDevServerBanner as l, type ContextualBinding as m, type ContextualBindingBuilder as n, type ContextualNeedsBuilder as o, Controller as p, type ControllerInertiaProps as q, type CsrfOptions as r, startViteDevServer as s, type DatabaseChannelOptions as t, type DatabaseNotification as u, type ExceptionClass as v, ExceptionHandler as w, type ExceptionHandlerOptions as x, type ExceptionRenderer as y, type ExceptionReporter as z };
@@ -1,6 +1,6 @@
1
1
  import { Context } from 'hono';
2
2
  import { Model } from '@guren/orm';
3
- import { A as Authenticatable, U as UserProvider, a as AuthCredentials, b as AuthManagerContract, c as AuthManagerOptions, G as GuardFactory, P as ProviderFactory, d as GuardContext, e as Guard, f as AttachContextOptions, g as AuthContext } from './api-token-BSSCLlFW.js';
3
+ import { A as Authenticatable, U as UserProvider, a as AuthCredentials, b as AuthManagerContract, c as AuthManagerOptions, G as GuardFactory, P as ProviderFactory, d as GuardContext, e as Guard, f as AttachContextOptions, g as AuthContext } from './api-token-COQHXyM_.js';
4
4
 
5
5
  interface PasswordHasher {
6
6
  hash(plain: string): Promise<string>;
@@ -450,6 +450,21 @@ declare class BroadcastManager {
450
450
  * Get clients subscribed to a channel.
451
451
  */
452
452
  getChannelClients(channel: string): SSEClient[];
453
+ /**
454
+ * Close every SSE connection this manager is holding.
455
+ *
456
+ * Each connection owns a ping timer that is only cleared when the stream is
457
+ * cancelled or the request aborts. `Bun.serve().stop()` without forcing waits
458
+ * for in-flight requests instead of cutting them, and an SSE response never
459
+ * finishes — so on a hot reload those connections outlive the manager, and
460
+ * their timers go on pinging a stream nobody reads.
461
+ *
462
+ * `getClients()` returns a snapshot. A `Map` iterator does tolerate an entry
463
+ * deleting itself, which is all `cleanup()` does today — but not a `close()`
464
+ * that reaches another client, which would drop that one from the iteration
465
+ * unvisited and leave its timer running.
466
+ */
467
+ disconnectAll(): void;
453
468
  /**
454
469
  * Generate a unique client ID.
455
470
  */
@@ -465,6 +480,12 @@ declare function setBroadcastManager(manager: BroadcastManager): void;
465
480
  declare function getBroadcastManager(): BroadcastManager;
466
481
  /**
467
482
  * Create a broadcast manager.
483
+ *
484
+ * Under `bun --hot`, the manager this one replaces has its SSE connections
485
+ * closed first, so their ping timers stop with it. Registered from the factory
486
+ * rather than the constructor because the factory is what application code
487
+ * calls: frame 2 of the stack is the provider that built the manager, not this
488
+ * file. A bare `new BroadcastManager()` is left alone.
468
489
  */
469
490
  declare function createBroadcastManager(options?: BroadcastManagerOptions): BroadcastManager;
470
491
 
@@ -200,6 +200,15 @@ declare class CacheManager {
200
200
  private readonly defaultStoreName;
201
201
  private readonly storeFactories;
202
202
  private readonly resolvedStores;
203
+ /**
204
+ * Where this manager was built, for identifying its stores across hot reloads.
205
+ *
206
+ * Captured here rather than in `store()` because stores resolve lazily, from
207
+ * whichever request first asks for one — a call site that says nothing about
208
+ * which manager owns the result. Skipped outside `--hot`, where it would be a
209
+ * formatted stack string held for the manager's lifetime and never read.
210
+ */
211
+ private readonly builtAt;
203
212
  constructor(config?: CacheConfig);
204
213
  private driverFactories;
205
214
  /**
@@ -215,6 +224,14 @@ declare class CacheManager {
215
224
  * Returns the default store if no name is specified.
216
225
  */
217
226
  store(name?: string): TaggableCacheStore;
227
+ /**
228
+ * Under `bun --hot`, stops the sweep timer held by the store this one replaces.
229
+ *
230
+ * Registered from here rather than from `MemoryStore` itself because this is
231
+ * where the store's name is known, and the name is what keeps two memory
232
+ * stores in one config from sharing a slot and cancelling each other's sweep.
233
+ */
234
+ private stopPreviousStore;
218
235
  /**
219
236
  * Register a custom store factory.
220
237
  */
@@ -1,4 +1,4 @@
1
- import { C as Container } from './Application-DN9Ndl37.js';
1
+ import { C as Container } from './Application-BvBqgc2k.js';
2
2
 
3
3
  /**
4
4
  * Parsed argument definition.
@@ -272,4 +272,4 @@ declare function t(key: string, replacements?: ReplacementValues): string;
272
272
  */
273
273
  declare function tc(key: string, count: number, replacements?: ReplacementValues): string;
274
274
 
275
- export { I18nManager as I, type PluralizationRule as P, type ReplacementValues as R, type TranslationLoader as T, type I18nConfig as a, type TranslationLoaderFactory as b, type TranslationMessages as c, Translator as d, type TranslatorOptions as e, createI18n as f, getI18n as g, tc as h, setI18n as s, t };
275
+ export { I18nManager as I, type PluralizationRule as P, type ReplacementValues as R, Translator as T, type I18nConfig as a, type TranslationLoader as b, type TranslationLoaderFactory as c, type TranslationMessages as d, type TranslatorOptions as e, createI18n as f, getI18n as g, tc as h, setI18n as s, t };
@@ -1,7 +1,7 @@
1
1
  import {
2
2
  McpServiceProvider
3
- } from "./chunk-WVY45EIW.js";
4
- import "./chunk-VT5KRDPH.js";
3
+ } from "./chunk-NQCZQAJL.js";
4
+ import "./chunk-NYQGAWDN.js";
5
5
  export {
6
6
  McpServiceProvider
7
7
  };
@@ -399,6 +399,8 @@ declare class Scheduler {
399
399
  private interval;
400
400
  private isRunning;
401
401
  private lastCheck;
402
+ /** This scheduler's claim on its hot-reload slot while it is running. */
403
+ private hotReloadClaim;
402
404
  constructor(options?: SchedulerOptions);
403
405
  /**
404
406
  * Define schedules using a callback.