@guren/server 2.34.0 → 2.36.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 (63) hide show
  1. package/dist/{DocsViewerServiceProvider-BVPZjwQp.js → DocsViewerServiceProvider-DzrxQoYh.js} +15 -4
  2. package/dist/Event-COT3f5Xd.js +28 -0
  3. package/dist/{Gate-C252SwRR.js → Gate-BHyDcDKo.js} +45 -5
  4. package/dist/{HttpException-BlQ2yEmT.js → HttpException-2tfZGamp.js} +8 -2
  5. package/dist/{McpServiceProvider-CXOokGax.js → McpServiceProvider-BOeQyt7u.js} +2 -0
  6. package/dist/PrivateChannel-1krGz028.js +187 -0
  7. package/dist/{Resource-BBKaFgXf.js → Resource-PhnO_wNO.js} +116 -15
  8. package/dist/agent/derive.d.ts +23 -1
  9. package/dist/agent/dispatch.d.ts +12 -1
  10. package/dist/agent/pipeline.d.ts +6 -0
  11. package/dist/agent/public.d.ts +1 -1
  12. package/dist/agent/public.js +1 -1
  13. package/dist/{api-token-DJcqSybf.js → api-token-Cs1myxf6.js} +16 -2
  14. package/dist/auth/index.js +2 -2
  15. package/dist/{auth-Bj9uEHuC.js → auth-DYWBlmpS.js} +2 -2
  16. package/dist/authorization/Gate.d.ts +4 -1
  17. package/dist/authorization/index.js +2 -2
  18. package/dist/{authorization-C81TXOWD.js → authorization-rxx6aprN.js} +1 -1
  19. package/dist/broadcasting/BroadcastManager.d.ts +19 -5
  20. package/dist/broadcasting/event-target.d.ts +9 -0
  21. package/dist/broadcasting/index.d.ts +3 -1
  22. package/dist/broadcasting/index.js +3 -2
  23. package/dist/broadcasting/sender-envelope.d.ts +26 -0
  24. package/dist/broadcasting/types.d.ts +27 -2
  25. package/dist/{broadcasting-3pvO94xV.js → broadcasting-Bh6QoMpy.js} +51 -96
  26. package/dist/{contained-path-BkNSBljW.js → contained-path-DOVauNQC.js} +1 -22
  27. package/dist/{context-af2n5abO.js → context--l2HdOhy.js} +1 -1
  28. package/dist/{dev-banner-B_QaY29h.js → dev-banner-DGxB3HGY.js} +8 -4
  29. package/dist/{dispatch-ENWpBxbE.js → dispatch-CDNqcB3Q.js} +51 -12
  30. package/dist/errors/ExceptionHandler.d.ts +5 -1
  31. package/dist/errors/HttpException.d.ts +6 -0
  32. package/dist/errors/exceptions/NotFoundHttpException.d.ts +2 -0
  33. package/dist/errors/wants-html.d.ts +7 -0
  34. package/dist/{errors-JpkcCjjn.js → errors-C8neC8go.js} +1 -1
  35. package/dist/events/index.js +2 -1
  36. package/dist/{events-B6gfJkCH.js → events-DW197Nur.js} +2 -28
  37. package/dist/http/dev-banner.d.ts +6 -1
  38. package/dist/http/middleware/csrf.d.ts +1 -1
  39. package/dist/http/middleware/redirect-safety.d.ts +8 -0
  40. package/dist/http/vite-dev-server.d.ts +18 -1
  41. package/dist/http/vite-manifest.d.ts +4 -1
  42. package/dist/index.d.ts +7 -7
  43. package/dist/index.js +305 -161
  44. package/dist/internal/agent-principal.d.ts +8 -0
  45. package/dist/internal/testing.d.ts +1 -0
  46. package/dist/internal/testing.js +4 -4
  47. package/dist/mcp/index.js +1 -1
  48. package/dist/mvc/Router.d.ts +13 -0
  49. package/dist/mvc/inertia/InertiaEngine.d.ts +3 -0
  50. package/dist/mvc/inertia/props.d.ts +54 -3
  51. package/dist/providers/InertiaServiceProvider.d.ts +7 -0
  52. package/dist/runtime/index.js +5 -3
  53. package/dist/storage/index.js +1 -1
  54. package/dist/{storage-YPbsV9ju.js → storage-ziIKgHON.js} +2 -1
  55. package/dist/trim-slashes-BLY9hKAa.js +22 -0
  56. package/dist/vite/index.d.ts +2 -0
  57. package/dist/vite/index.js +283 -1
  58. package/dist/vite/mcp-app.d.ts +59 -0
  59. package/dist/vite/plugin.d.ts +12 -0
  60. package/dist/{vite-manifest-DO0pU1vm.js → vite-dev-server-Ag90otai.js} +25 -114
  61. package/dist/vite-manifest-BdXRybeq.js +129 -0
  62. package/package.json +1 -1
  63. package/dist/host-port-t6wQFaRu.js +0 -15
package/dist/index.js CHANGED
@@ -1,21 +1,23 @@
1
- import { A as ensureErrorStackTracePolyfill, C as setInertiaDocument, D as defer, E as always, O as isAlwaysProp, a as renderDocument, b as inertia, c as getRequestLocale, d as mountModuleRoutes, f as definePlugin, g as shareInertiaProps, h as setInertiaSharedProps, i as Controller, k as isDeferredProp, l as getRequestTranslator, m as resolveSharedInertiaProps, n as Resource, o as LOCALE_CONTEXT_KEY, p as getInertiaSharedPropsResolver, r as collect, s as detectLocaleMiddleware, t as JsonResource, u as defineModule, w as setInertiaSsrRenderer } from "./Resource-BBKaFgXf.js";
1
+ import { A as isLiveProp, C as setInertiaDocument, D as defer, E as always, M as ensureErrorStackTracePolyfill, O as isAlwaysProp, a as renderDocument, b as inertia, c as getRequestLocale, d as mountModuleRoutes, f as definePlugin, g as shareInertiaProps, h as setInertiaSharedProps, i as Controller, j as live, k as isDeferredProp, l as getRequestTranslator, m as resolveSharedInertiaProps, n as Resource, o as LOCALE_CONTEXT_KEY, p as getInertiaSharedPropsResolver, r as collect, s as detectLocaleMiddleware, t as JsonResource, u as defineModule, w as setInertiaSsrRenderer } from "./Resource-PhnO_wNO.js";
2
2
  import { a as parseRequestPayload, i as parseRequestBody, n as flattenRequestQueries, r as formatValidationErrors } from "./request-CLOYytGP.js";
3
3
  import { i as setValidatedInput, n as getValidatedInput } from "./validated-input-D84J8wcC.js";
4
- import { t as HttpException } from "./HttpException-BlQ2yEmT.js";
5
- import { n as ValidationException } from "./errors-JpkcCjjn.js";
6
- import { a as withAuthorization, c as capabilitiesOf, i as derivableAbility, l as mergeCapabilities, n as authorizeMiddleware, o as Policy, r as authorizeResourceMiddleware, s as definePolicy, t as authorizeAllMiddleware, u as stampCapabilities } from "./authorization-C81TXOWD.js";
7
- import { a as mapToolResponse, c as AGENT_PREFLIGHT_VERDICT_HEADER, i as describeBuildFailure, n as advertisesStructuredOutput, o as isDispatchedToolRequest, r as buildToolRequest, t as PREFLIGHT_ARGUMENT } from "./dispatch-ENWpBxbE.js";
8
- import { i as trimSlashes } from "./contained-path-BkNSBljW.js";
4
+ import { n as NOT_FOUND_MESSAGE, t as HttpException } from "./HttpException-2tfZGamp.js";
5
+ import { n as ValidationException } from "./errors-C8neC8go.js";
6
+ import { a as withAuthorization, c as capabilitiesOf, i as derivableAbility, l as mergeCapabilities, n as authorizeMiddleware, o as Policy, r as authorizeResourceMiddleware, s as definePolicy, t as authorizeAllMiddleware, u as stampCapabilities } from "./authorization-rxx6aprN.js";
7
+ import { a as mapToolResponse, c as AGENT_PREFLIGHT_VERDICT_HEADER, i as describeBuildFailure, n as advertisesStructuredOutput, o as isDispatchedToolRequest, r as buildToolRequest, t as PREFLIGHT_ARGUMENT } from "./dispatch-CDNqcB3Q.js";
8
+ import { t as trimSlashes } from "./trim-slashes-BLY9hKAa.js";
9
9
  import { PATH_PARAM_PATTERN, extractPathParamNames } from "./internal/route-path.js";
10
10
  import { a as generateAppKey, c as parseAppKey, i as encodeDerivedKey, l as parsePreviousAppKeys, n as deriveAppKey, o as getAppKeyringFromEnv, r as deriveAppKeyring, s as normalizeAppKey, t as MessageSigner } from "./MessageSigner-DIUT1Yao.js";
11
11
  import { n as detectServerlessRuntime, t as SERVERLESS_RUNTIME_LABELS } from "./serverless-D96rJb6x.js";
12
- import { A as verifyOAuthState, B as ModelUserProvider, C as createGoogleOAuthProviderConfig, D as fetchOAuthUserProfile, E as exchangeOAuthCode, F as normalizeRedirectTarget, G as MemorySessionStore, H as NodeHasher, I as AuthManager, J as getSessionFromContext, K as createSessionMiddleware, L as DEFAULT_PROVIDER, M as jsonResponse, N as hostMatchesAllowlist, O as parseOAuthRedirectUrl, P as isAppRelativePath, R as TokenGuard, S as createGitHubOAuthProviderConfig, T as createOAuthState, U as ScryptHasher, V as DefaultHasher, W as BaseUserProvider, _ as OAUTH_SESSION_BINDING_KEY, a as isEmailVerified, b as buildOAuthRedirectUrl, c as verifyEmailToken, d as completePasswordReset, f as createPasswordResetToken, g as MemoryOAuthStateStore, h as AuthenticatableModel, i as createEmailVerificationToken, j as defineMiddleware, k as sanitizeOAuthRedirect, l as MemoryPasswordResetStore, m as verifyPasswordResetToken, n as buildVerificationUrl, o as parseVerificationUrl, p as parsePasswordResetUrl, q as defaultCookieSecure, r as completeEmailVerification, s as requireVerifiedEmail, t as MemoryEmailVerificationStore, u as buildPasswordResetUrl, v as OAuthManager, w as createOAuthManager, x as createDiscordOAuthProviderConfig, y as buildOAuthAuthorizeUrl, z as SessionGuard } from "./auth-Bj9uEHuC.js";
12
+ import { A as verifyOAuthState, B as ModelUserProvider, C as createGoogleOAuthProviderConfig, D as fetchOAuthUserProfile, E as exchangeOAuthCode, F as normalizeRedirectTarget, G as MemorySessionStore, H as NodeHasher, I as AuthManager, J as getSessionFromContext, K as createSessionMiddleware, L as DEFAULT_PROVIDER, M as jsonResponse, N as hostMatchesAllowlist, O as parseOAuthRedirectUrl, P as isAppRelativePath, R as TokenGuard, S as createGitHubOAuthProviderConfig, T as createOAuthState, U as ScryptHasher, V as DefaultHasher, W as BaseUserProvider, _ as OAUTH_SESSION_BINDING_KEY, a as isEmailVerified, b as buildOAuthRedirectUrl, c as verifyEmailToken, d as completePasswordReset, f as createPasswordResetToken, g as MemoryOAuthStateStore, h as AuthenticatableModel, i as createEmailVerificationToken, j as defineMiddleware, k as sanitizeOAuthRedirect, l as MemoryPasswordResetStore, m as verifyPasswordResetToken, n as buildVerificationUrl, o as parseVerificationUrl, p as parsePasswordResetUrl, q as defaultCookieSecure, r as completeEmailVerification, s as requireVerifiedEmail, t as MemoryEmailVerificationStore, u as buildPasswordResetUrl, v as OAuthManager, w as createOAuthManager, x as createDiscordOAuthProviderConfig, y as buildOAuthAuthorizeUrl, z as SessionGuard } from "./auth-DYWBlmpS.js";
13
13
  import { t as resolveOptional } from "./resolve-optional-ax6gPWTp.js";
14
14
  import { t as warnOnce } from "./warn-once-p-IlMjra.js";
15
15
  import { a as defaultApplication, c as resolve, d as createContainer, f as getContainer, g as warnDeprecatedSetter, h as warnDeprecatedGetter, i as bindAmbient, l as useAsDefaultApplication, m as warnDeprecated, n as ambientBinding, o as defaultContainer, p as setContainer, r as ambientContainer, s as resetDefaultApplication, t as adoptDefaultApplication, u as Container } from "./default-application-s9SE-Er7.js";
16
+ import { t as Event } from "./Event-COT3f5Xd.js";
17
+ import { l as broadcastChannelsOf, n as PresenceChannel, r as Channel, t as PrivateChannel, u as broadcastNameOf } from "./PrivateChannel-1krGz028.js";
16
18
  import { n as ServiceProvider, t as ProviderManager } from "./ServiceProvider-G0YclITd.js";
17
- import { C as scopesAllowTool, M as markAgentDispatch, N as readAgentPrincipal, S as parseToolScope, _ as tokenCanAny, a as getApiToken, b as classifyRegistrationScope, c as hasBearerHeader, d as revokeAllApiTokens, f as revokeApiToken, g as tokenCanAll, h as tokenCan, i as createBearerTokenMiddleware, j as installAgentPrincipal, l as parseApiToken, n as MemoryApiTokenStore, o as getApiTokenOrFail, r as createApiToken, s as getUserApiTokens, t as API_TOKEN_KEY, u as readBearerToken, v as verifyApiToken, x as expandToolScopes, y as AGENT_TOOL_NAME_PATTERN } from "./api-token-DJcqSybf.js";
18
- import { o as AuthenticationException, r as getAuthContext, t as AUTH_CONTEXT_KEY } from "./context-af2n5abO.js";
19
+ import { C as scopesAllowTool, M as installAgentSharedProps, N as markAgentDispatch, P as readAgentPrincipal, S as parseToolScope, _ as tokenCanAny, a as getApiToken, b as classifyRegistrationScope, c as hasBearerHeader, d as revokeAllApiTokens, f as revokeApiToken, g as tokenCanAll, h as tokenCan, i as createBearerTokenMiddleware, j as installAgentPrincipal, l as parseApiToken, n as MemoryApiTokenStore, o as getApiTokenOrFail, r as createApiToken, s as getUserApiTokens, t as API_TOKEN_KEY, u as readBearerToken, v as verifyApiToken, x as expandToolScopes, y as AGENT_TOOL_NAME_PATTERN } from "./api-token-Cs1myxf6.js";
20
+ import { o as AuthenticationException, r as getAuthContext, t as AUTH_CONTEXT_KEY } from "./context--l2HdOhy.js";
19
21
  import { a as md5, c as sha256, d as verifyPassword, i as hmac, l as sha512, n as hash, o as needsRehash, r as hashPassword, s as secureCompare, t as check, u as verifyHmac } from "./Hash-D2DFd8xX.js";
20
22
  import { t as redactQueryParams } from "./redact-query-params-Ba-sAfcP.js";
21
23
  import { n as getRequestContainer, r as tryGetRequestContainer, t as CONTAINER_CONTEXT_KEY } from "./request-container-BbuH0JJy.js";
@@ -24,16 +26,16 @@ import { a as RedisStore, i as FileStore, n as createCacheManager, o as MemorySt
24
26
  import { n as createRedisClient, r as RedisSessionStore } from "./client-C5Wj9P9o.js";
25
27
  import { c as isDevCenterFeedbackRequest, i as loadRuntimeErrorsModule, l as isMcpEndpointEnabled, r as captureRuntimeError, t as RUNTIME_ERRORS_BINDING } from "./runtime-error-capture-DLRXwp0d.js";
26
28
  import { n as isHotReloadRuntime, r as matchingOpenParen, t as claimHotDisposable } from "./hot-disposables-W2fH-GID.js";
27
- import { a as setBroadcastManager, c as PresenceChannel, d as createWebSocketOriginGuard, i as getBroadcastManager, l as PrivateChannel, n as BroadcastManager, o as RedisDriver, r as createBroadcastManager, s as MemoryDriver, t as createTypedBroadcaster, u as Channel } from "./broadcasting-3pvO94xV.js";
29
+ import { a as setBroadcastManager, c as createWebSocketOriginGuard, i as getBroadcastManager, n as BroadcastManager, o as RedisDriver, r as createBroadcastManager, s as MemoryDriver, t as createTypedBroadcaster } from "./broadcasting-Bh6QoMpy.js";
28
30
  import { c as tc, d as Translator, f as getPluralizationRule, i as getI18n, l as tryGetI18n, m as selectPluralForm, n as I18nManager, o as setI18n, p as pluralizationRules, r as createI18n, s as t, t as MemoryLoader, u as JsonLoader } from "./i18n-BShPpJZa.js";
29
31
  import { n as isAgentToolRequest } from "./agent-request-Caj6bnbj.js";
30
- import { a as cannot, f as setGate, i as can, l as getGate, n as Response$1, o as createGate, p as AuthorizationException, r as authorize, s as defineGate, t as Gate } from "./Gate-C252SwRR.js";
32
+ import { a as cannot, f as setGate, h as hasComposedMessage, i as can, l as getGate, m as NotFoundHttpException, n as Response$1, o as createGate, p as AuthorizationException, r as authorize, s as defineGate, t as Gate } from "./Gate-BHyDcDKo.js";
31
33
  import { r as isDocsViewerEnabled } from "./endpoint-CTIzcagh.js";
32
- import { n as isWildcardHost, t as formatHostPort } from "./host-port-t6wQFaRu.js";
33
- import { C as stopBunServerBounded, S as stopActiveViteDevServer, _ as registerBunTeardown, b as setActiveBunServer, c as isViteProduction, d as startViteDevServer, g as hotReloadStopBound, h as getGlobalState, i as clientManifestCandidates, l as loadViteManifest, m as closeOwnedViteDevServer, n as INJECTED_CLIENT_MANIFEST_SOURCE, o as getManifestFile, p as adoptViteDevServer, r as PUBLIC_ASSETS_URL_PREFIX, s as injectedClientManifest, u as normalizeDevServerUrl, v as releaseActiveBunServer, x as stopActiveBunServer, y as reusableActiveViteDevServer } from "./vite-manifest-DO0pU1vm.js";
34
+ import { c as isViteProduction, d as formatHostPort, f as isWildcardHost, i as clientManifestCandidates, l as loadViteManifest, n as INJECTED_CLIENT_MANIFEST_SOURCE, o as getManifestFile, r as PUBLIC_ASSETS_URL_PREFIX, s as injectedClientManifest, u as normalizeDevServerUrl } from "./vite-manifest-BdXRybeq.js";
35
+ import { a as closeOwnedViteDevServer, c as registerBunTeardown, d as setActiveBunServer, f as stopActiveBunServer, i as adoptViteDevServer, l as releaseActiveBunServer, m as stopBunServerBounded, n as startViteDevServer, o as getGlobalState, p as stopActiveViteDevServer, s as hotReloadStopBound, t as readViteDevServerPort, u as reusableActiveViteDevServer } from "./vite-dev-server-Ag90otai.js";
34
36
  import { readObjectSchema, toJsonSchema } from "./internal/zod-json-schema.js";
35
- import { a as RequestFinished, c as UserLoggedOut, d as EventManager, f as createEventManager, i as JobProcessed, l as createQueueEventDispatcher, n as ApplicationStarted, o as RequestReceived, p as Event, r as JobFailed, s as UserAuthenticated, t as ApplicationShutdown, u as Listener } from "./events-B6gfJkCH.js";
36
37
  import { a as NotificationManager, c as setNotificationManager, d as getNotification, f as registerNotification, i as MailChannel, l as resolveNotifiableType, n as SlackChannel, o as createNotificationManager, p as Notification, r as DatabaseChannel, s as getNotificationManager, t as MemoryChannel, u as clearNotificationRegistry } from "./notifications-DV5Yr6Fl.js";
38
+ import { a as RequestFinished, c as UserLoggedOut, d as EventManager, f as createEventManager, i as JobProcessed, l as createQueueEventDispatcher, n as ApplicationStarted, o as RequestReceived, r as JobFailed, s as UserAuthenticated, t as ApplicationShutdown, u as Listener } from "./events-DW197Nur.js";
37
39
  import { a as getJob, d as resolveQueueDriver, f as setQueueDriver, l as registerJob, n as clearJobRegistry, o as getQueueDriver, r as clearQueueDriver, s as getRegisteredJobs, t as Job, u as resolveJobName } from "./Job-0Prk8k0z.js";
38
40
  import { a as processJob, c as RedisDriver$1, i as Worker, l as SyncDriver, n as createQueueManager, o as SqsDriver, r as FailedJobReporter, s as createSqsAdapter, t as QueueManager, u as MemoryDriver$1 } from "./queue-K4Bi6NRy.js";
39
41
  import { a as MailManager, c as MemoryTransport, i as setMailManager, l as ResendTransport, n as getMailManager, o as createMailManager, r as mail, s as LogTransport, t as Mail, u as SmtpTransport } from "./mail-BQ2y2U5c.js";
@@ -41,7 +43,7 @@ import { a as LOG_LEVEL_PRIORITY, i as matchDailyFileDate, n as dailyFileDateSta
41
43
  import { a as FileChannel, i as setLogManager, n as createLogManager, o as ConsoleChannel, r as getLogManager, t as LogManager } from "./logging-Br9bZlaG.js";
42
44
  import { a as random, c as randomHex, d as sample, f as shuffle, i as pick, l as randomInt, m as uuid, n as generatePassword, o as randomBase64, p as urlSafeToken, r as generateSlug, s as randomBase64Url, t as generateOtp, u as randomString } from "./Random-S0OvCuR8.js";
43
45
  import { a as decrypt, c as getEncrypter, i as createEncrypter, l as setEncrypter, n as verifySignedUrl, o as encrypt, r as Encrypter, s as generateKey, t as signUrl } from "./encryption-BS-FGkqS.js";
44
- import { a as LocalDriver, i as S3Driver, n as createStorageManager, r as MemoryDriver$2, t as StorageManager } from "./storage-YPbsV9ju.js";
46
+ import { a as LocalDriver, i as S3Driver, n as createStorageManager, r as MemoryDriver$2, t as StorageManager } from "./storage-ziIKgHON.js";
45
47
  import { a as CacheCheck, c as HealthManager, i as StorageCheck, l as createHealthManager, n as customCheck, o as RedisCheck, r as MemoryCheck, s as DatabaseCheck, t as CustomCheck, u as HealthCheck } from "./health-Wi_05kkf.js";
46
48
  import { a as ScheduledTask, c as isDue, d as parseCron, f as toTimezone, i as Schedule, l as isDueInTimezone, n as createScheduler, o as getNextOccurrence, p as MemorySchedulerLock, r as PendingSchedule, s as getNextOccurrences, t as Scheduler, u as matchesCron } from "./scheduling-iLkx4gID.js";
47
49
  import { Hono } from "hono";
@@ -229,7 +231,36 @@ async function resolveModelBinding({ model, key }, value) {
229
231
  * `schemas` and the spread OpenAPI metadata still alias the registry.
230
232
  */
231
233
  function cloneAgentMetadata(metadata) {
232
- return structuredClone(metadata);
234
+ if (metadata.ui === void 0) return structuredClone(metadata);
235
+ const { ui, ...rest } = metadata;
236
+ return {
237
+ ...structuredClone(rest),
238
+ ui: structuredClone(pageIdsOf(ui))
239
+ };
240
+ }
241
+ /**
242
+ * A generated `PageContract` reduced to its id, since its `props()` method is
243
+ * what `structuredClone` throws on. Everything else is kept as written for
244
+ * `deriveAgentToolUi()` to judge, so a malformed declaration is reported as written.
245
+ */
246
+ function pageIdsOf(ui) {
247
+ if (isPageLike(ui) && ("visibility" in ui || "page" in ui)) {
248
+ const { visibility, page } = ui;
249
+ return {
250
+ id: ui.id,
251
+ visibility,
252
+ page
253
+ };
254
+ }
255
+ if (isPageLike(ui)) return ui.id;
256
+ if (typeof ui === "object" && ui !== null && isPageLike(ui.page)) return {
257
+ ...ui,
258
+ page: ui.page.id
259
+ };
260
+ return ui;
261
+ }
262
+ function isPageLike(value) {
263
+ return typeof value === "object" && value !== null && typeof value.id === "string";
233
264
  }
234
265
  /**
235
266
  * Group scopes unwind synchronously, so an `async` callback registers routes
@@ -1225,6 +1256,105 @@ var SessionManager = class {
1225
1256
  }
1226
1257
  };
1227
1258
  //#endregion
1259
+ //#region src/errors/error-page.ts
1260
+ function escapeHtml$1(value) {
1261
+ return value.replace(/&/g, "&amp;").replace(/</g, "&lt;").replace(/>/g, "&gt;").replace(/"/g, "&quot;").replace(/'/g, "&#39;");
1262
+ }
1263
+ /** Production error page: no stack traces or internal details are exposed. */
1264
+ function renderErrorPage(statusCode, message) {
1265
+ const title = STATUS_TITLES[statusCode] ?? "Error";
1266
+ return `<!DOCTYPE html>
1267
+ <html lang="en">
1268
+ <head>
1269
+ <meta charset="utf-8">
1270
+ <meta name="viewport" content="width=device-width, initial-scale=1">
1271
+ <title>${statusCode} ${title}</title>
1272
+ <style>
1273
+ /* Guren UI's tokens (github.com/gurenjs/guren-ui); the link home is the screen's one crimson fill. */
1274
+ :root {
1275
+ color-scheme: light;
1276
+ --g-page: #ffffff; --g-heading: #111827; --g-text-2: #4b5563; --g-muted: #6b7280;
1277
+ --g-accent: #db1b1b; --g-accent-down: #b91c1c; --g-on-accent: #fff5f5;
1278
+ }
1279
+ @media (prefers-color-scheme: dark) {
1280
+ :root { color-scheme: dark; --g-page: #1a1a2e; --g-heading: #e0def4; --g-text-2: #aeabc9; --g-muted: #8d89a7; }
1281
+ }
1282
+ * { margin: 0; padding: 0; box-sizing: border-box; }
1283
+ body {
1284
+ font-family: 'Noto Sans JP', ui-sans-serif, system-ui, -apple-system, 'Segoe UI', sans-serif;
1285
+ min-height: 100vh;
1286
+ display: flex;
1287
+ align-items: center;
1288
+ justify-content: center;
1289
+ background: var(--g-page);
1290
+ color: var(--g-heading);
1291
+ -webkit-font-smoothing: antialiased;
1292
+ }
1293
+ .container { text-align: center; padding: 2rem; }
1294
+ .status { font: 700 6rem/1 'JetBrains Mono', ui-monospace, Menlo, Consolas, monospace; color: var(--g-muted); }
1295
+ .title { font-size: 1.5rem; font-weight: 700; letter-spacing: -0.01em; margin-top: 1rem; }
1296
+ .description { color: var(--g-text-2); margin-top: 0.5rem; max-width: 28rem; }
1297
+ .home-link {
1298
+ display: inline-block; margin-top: 2rem; padding: 8px 16px;
1299
+ background: var(--g-accent); color: var(--g-on-accent); border-radius: 8px;
1300
+ text-decoration: none; font-size: 13.5px; font-weight: 700;
1301
+ }
1302
+ .home-link:hover { background: var(--g-accent-down); }
1303
+ .home-link:focus-visible { outline: 2px solid var(--g-accent); outline-offset: 2px; }
1304
+ </style>
1305
+ </head>
1306
+ <body>
1307
+ <main class="container">
1308
+ <div class="status">${statusCode}</div>
1309
+ <h1 class="title">${title}</h1>
1310
+ <p class="description">${escapeHtml$1(message ?? STATUS_DESCRIPTIONS[statusCode] ?? "An unexpected error occurred.")}</p>
1311
+ <a href="/" class="home-link">Go Home</a>
1312
+ </main>
1313
+ </body>
1314
+ </html>`;
1315
+ }
1316
+ const STATUS_TITLES = {
1317
+ 400: "Bad Request",
1318
+ 401: "Unauthorized",
1319
+ 403: "Forbidden",
1320
+ 404: "Not Found",
1321
+ 405: "Method Not Allowed",
1322
+ 408: "Request Timeout",
1323
+ 419: "Page Expired",
1324
+ 422: "Unprocessable Entity",
1325
+ 429: "Too Many Requests",
1326
+ 500: "Server Error",
1327
+ 502: "Bad Gateway",
1328
+ 503: "Service Unavailable",
1329
+ 504: "Gateway Timeout"
1330
+ };
1331
+ const STATUS_DESCRIPTIONS = {
1332
+ 400: "The request could not be understood by the server.",
1333
+ 401: "You need to sign in to access this page.",
1334
+ 403: "You do not have permission to access this page.",
1335
+ 404: "The page you are looking for could not be found.",
1336
+ 405: "The request method is not supported for this page.",
1337
+ 419: "Your session has expired. Please refresh and try again.",
1338
+ 422: "The submitted data was invalid.",
1339
+ 429: "You are making too many requests. Please slow down.",
1340
+ 500: "Something went wrong on our end. Please try again later.",
1341
+ 502: "The server received an invalid response from an upstream server.",
1342
+ 503: "The service is temporarily unavailable. Please try again later.",
1343
+ 504: "The server did not receive a timely response from an upstream server."
1344
+ };
1345
+ //#endregion
1346
+ //#region src/errors/wants-html.ts
1347
+ /**
1348
+ * A browser navigation: it accepts HTML and is not an Inertia visit, an XHR or a
1349
+ * JSON caller, each of which needs a JSON payload. `ExceptionHandler` and the
1350
+ * CSRF middleware both answer an HTML page by this one rule.
1351
+ */
1352
+ function wantsHtmlResponse(ctx) {
1353
+ if (!ctx?.req?.header) return false;
1354
+ const accept = ctx.req.header("accept") ?? "";
1355
+ return !(accept.includes("application/json") || ctx.req.header("x-requested-with") === "XMLHttpRequest" || ctx.req.header("x-inertia") === "true") && accept.includes("text/html");
1356
+ }
1357
+ //#endregion
1228
1358
  //#region src/http/middleware/csrf.ts
1229
1359
  const CSRF_TOKEN_KEY = "_csrf_token";
1230
1360
  const CSRF_HEADER_NAME = "X-CSRF-TOKEN";
@@ -1237,6 +1367,9 @@ const DEFAULT_PROTECTED_METHODS = [
1237
1367
  "PATCH",
1238
1368
  "DELETE"
1239
1369
  ];
1370
+ /** Laravel's "Page Expired"; `renderErrorPage()` titles it so, where a 403 page would read "Forbidden". */
1371
+ const CSRF_PAGE_EXPIRED_STATUS = 419;
1372
+ const CSRF_PAGE_EXPIRED_MESSAGE = "This form expired before it was sent. Go back, reload the page and submit the form again.";
1240
1373
  const CSRF_CONTEXT_KEY = "guren:csrf-token";
1241
1374
  const CSRF_PURPOSE = "csrf";
1242
1375
  function createCsrfSigner() {
@@ -1426,12 +1559,24 @@ function createCsrfMiddleware(options = {}, cookielessAuthEndpoints) {
1426
1559
  }
1427
1560
  if (!verifyCsrfToken(ctx, await getTokenFromRequest(ctx))) {
1428
1561
  if (onError) return onError(ctx);
1429
- return jsonResponse({ message: "CSRF token mismatch" }, 403);
1562
+ return csrfMismatchResponse(ctx);
1430
1563
  }
1431
1564
  await next();
1432
1565
  settleCookie(ctx);
1433
1566
  };
1434
1567
  }
1568
+ /**
1569
+ * A form posted before the page hydrated carries no header token, and a browser
1570
+ * would show the JSON as the page. Every other caller keeps the 403 JSON, whose
1571
+ * message `@guren/testing`'s `withCsrf()` hint and the docs quote.
1572
+ */
1573
+ function csrfMismatchResponse(ctx) {
1574
+ if (!wantsHtmlResponse(ctx)) return jsonResponse({ message: "CSRF token mismatch" }, 403);
1575
+ return new Response(renderErrorPage(CSRF_PAGE_EXPIRED_STATUS, CSRF_PAGE_EXPIRED_MESSAGE), {
1576
+ status: CSRF_PAGE_EXPIRED_STATUS,
1577
+ headers: { "Content-Type": "text/html; charset=UTF-8" }
1578
+ });
1579
+ }
1435
1580
  function setXsrfCookie(ctx, token, options = {}) {
1436
1581
  const { path = "/", secure = defaultCookieSecure(), sameSite = "Lax" } = options;
1437
1582
  ctx.header("Set-Cookie", `${XSRF_COOKIE_NAME}=${encodeURIComponent(token)}; Path=${path}; SameSite=${sameSite}${secure ? "; Secure" : ""}`, { append: true });
@@ -1940,6 +2085,24 @@ function isSafeRedirectUrl(url, requestUrl, allowedHosts = []) {
1940
2085
  return false;
1941
2086
  }
1942
2087
  }
2088
+ /**
2089
+ * The path of a `Referer` on one of `acceptedHosts` (as `URL.host` spells them,
2090
+ * port included), for redirecting back, or `fallback`. A relative Referer resolves
2091
+ * against `requestUrl`. The scheme is not compared: behind a TLS-terminating proxy
2092
+ * the request reads `http:` while the browser's Referer reads `https:`. Only the
2093
+ * path and query are kept, so the browser stays on its own origin.
2094
+ */
2095
+ function sameHostRefererPath(referer, requestUrl, acceptedHosts, fallback = "/") {
2096
+ if (!referer) return fallback;
2097
+ try {
2098
+ const target = new URL(referer, requestUrl);
2099
+ if (target.protocol !== "http:" && target.protocol !== "https:" || !acceptedHosts.includes(target.host)) return fallback;
2100
+ const pathname = normalizeRedirectTarget(target.pathname);
2101
+ return isAppRelativePath(pathname) ? `${pathname}${target.search}` : fallback;
2102
+ } catch {
2103
+ return fallback;
2104
+ }
2105
+ }
1943
2106
  //#endregion
1944
2107
  //#region src/http/middleware/force-https.ts
1945
2108
  /**
@@ -2049,9 +2212,14 @@ function attachAuthContext(contextFactory) {
2049
2212
  await next();
2050
2213
  };
2051
2214
  }
2052
- function refuse$1(ctx, options, status, message) {
2215
+ function refuse$1(ctx, options, status, message, pageMessage) {
2053
2216
  if (options.redirectTo) return isAgentToolRequest(ctx) ? jsonResponse({ message }, status) : ctx.redirect(options.redirectTo);
2054
- return options.responseFactory ? options.responseFactory() : jsonResponse({ message }, status);
2217
+ if (options.responseFactory) return options.responseFactory();
2218
+ if (!isAgentToolRequest(ctx) && wantsHtmlResponse(ctx)) return new Response(renderErrorPage(status, pageMessage), {
2219
+ status,
2220
+ headers: { "Content-Type": "text/html; charset=UTF-8" }
2221
+ });
2222
+ return jsonResponse({ message }, status);
2055
2223
  }
2056
2224
  function requireAuthenticated(options = {}) {
2057
2225
  const { status = 401 } = options;
@@ -2067,7 +2235,7 @@ function requireGuest(options = {}) {
2067
2235
  return stampCapabilities(async (ctx, next) => {
2068
2236
  const auth = getAuthContext(ctx);
2069
2237
  if (!auth) throw new Error("Auth context has not been attached. Did you register the auth middleware?");
2070
- if (!await auth.guest()) return refuse$1(ctx, options, status, "Already authenticated");
2238
+ if (!await auth.guest()) return refuse$1(ctx, options, status, "Already authenticated", "You are already signed in.");
2071
2239
  await next();
2072
2240
  }, { authentication: { mode: "guest-only" } });
2073
2241
  }
@@ -2125,93 +2293,6 @@ var AuthServiceProvider = class extends ServiceProvider {
2125
2293
  }
2126
2294
  };
2127
2295
  //#endregion
2128
- //#region src/errors/error-page.ts
2129
- function escapeHtml$1(value) {
2130
- return value.replace(/&/g, "&amp;").replace(/</g, "&lt;").replace(/>/g, "&gt;").replace(/"/g, "&quot;").replace(/'/g, "&#39;");
2131
- }
2132
- /** Production error page: no stack traces or internal details are exposed. */
2133
- function renderErrorPage(statusCode, message) {
2134
- const title = STATUS_TITLES[statusCode] ?? "Error";
2135
- return `<!DOCTYPE html>
2136
- <html lang="en">
2137
- <head>
2138
- <meta charset="utf-8">
2139
- <meta name="viewport" content="width=device-width, initial-scale=1">
2140
- <title>${statusCode} ${title}</title>
2141
- <style>
2142
- /* Guren UI's tokens (github.com/gurenjs/guren-ui); the link home is the screen's one crimson fill. */
2143
- :root {
2144
- color-scheme: light;
2145
- --g-page: #ffffff; --g-heading: #111827; --g-text-2: #4b5563; --g-line-strong: #d1d5db;
2146
- --g-accent: #db1b1b; --g-accent-down: #b91c1c; --g-on-accent: #fff5f5;
2147
- }
2148
- @media (prefers-color-scheme: dark) {
2149
- :root { color-scheme: dark; --g-page: #1a1a2e; --g-heading: #e0def4; --g-text-2: #aeabc9; --g-line-strong: #3d3d5c; }
2150
- }
2151
- * { margin: 0; padding: 0; box-sizing: border-box; }
2152
- body {
2153
- font-family: 'Noto Sans JP', ui-sans-serif, system-ui, -apple-system, 'Segoe UI', sans-serif;
2154
- min-height: 100vh;
2155
- display: flex;
2156
- align-items: center;
2157
- justify-content: center;
2158
- background: var(--g-page);
2159
- color: var(--g-heading);
2160
- -webkit-font-smoothing: antialiased;
2161
- }
2162
- .container { text-align: center; padding: 2rem; }
2163
- .status { font: 700 6rem/1 'JetBrains Mono', ui-monospace, Menlo, Consolas, monospace; color: var(--g-line-strong); }
2164
- .title { font-size: 1.5rem; font-weight: 700; letter-spacing: -0.01em; margin-top: 1rem; }
2165
- .description { color: var(--g-text-2); margin-top: 0.5rem; max-width: 28rem; }
2166
- .home-link {
2167
- display: inline-block; margin-top: 2rem; padding: 8px 16px;
2168
- background: var(--g-accent); color: var(--g-on-accent); border-radius: 8px;
2169
- text-decoration: none; font-size: 13.5px; font-weight: 700;
2170
- }
2171
- .home-link:hover { background: var(--g-accent-down); }
2172
- .home-link:focus-visible { outline: 2px solid var(--g-accent); outline-offset: 2px; }
2173
- </style>
2174
- </head>
2175
- <body>
2176
- <div class="container">
2177
- <div class="status">${statusCode}</div>
2178
- <h1 class="title">${title}</h1>
2179
- <p class="description">${escapeHtml$1(message ?? STATUS_DESCRIPTIONS[statusCode] ?? "An unexpected error occurred.")}</p>
2180
- <a href="/" class="home-link">Go Home</a>
2181
- </div>
2182
- </body>
2183
- </html>`;
2184
- }
2185
- const STATUS_TITLES = {
2186
- 400: "Bad Request",
2187
- 401: "Unauthorized",
2188
- 403: "Forbidden",
2189
- 404: "Not Found",
2190
- 405: "Method Not Allowed",
2191
- 408: "Request Timeout",
2192
- 419: "Page Expired",
2193
- 422: "Unprocessable Entity",
2194
- 429: "Too Many Requests",
2195
- 500: "Server Error",
2196
- 502: "Bad Gateway",
2197
- 503: "Service Unavailable",
2198
- 504: "Gateway Timeout"
2199
- };
2200
- const STATUS_DESCRIPTIONS = {
2201
- 400: "The request could not be understood by the server.",
2202
- 401: "You need to sign in to access this page.",
2203
- 403: "You do not have permission to access this page.",
2204
- 404: "The page you are looking for could not be found.",
2205
- 405: "The request method is not supported for this page.",
2206
- 419: "Your session has expired. Please refresh and try again.",
2207
- 422: "The submitted data was invalid.",
2208
- 429: "You are making too many requests. Please slow down.",
2209
- 500: "Something went wrong on our end. Please try again later.",
2210
- 502: "The server received an invalid response from an upstream server.",
2211
- 503: "The service is temporarily unavailable. Please try again later.",
2212
- 504: "The server did not receive a timely response from an upstream server."
2213
- };
2214
- //#endregion
2215
2296
  //#region src/errors/debug-page.ts
2216
2297
  /** Development-only error page: exposes the stack trace and request details. */
2217
2298
  function renderDebugPage(thrown, request) {
@@ -2272,8 +2353,8 @@ function renderDebugPage(thrown, request) {
2272
2353
  .stack-frames { display: flex; flex-direction: column; gap: 2px; }
2273
2354
  .frame { padding: 0.6rem 0.75rem; border-radius: 8px; cursor: default; transition: background 0.15s; }
2274
2355
  .frame:hover { background: var(--g-raised); }
2275
- .frame.vendor { opacity: 0.5; }
2276
- .frame.vendor:hover { opacity: 0.75; }
2356
+ /* Dimmed by color: an opacity fades this text under the 4.5:1 that small text needs. */
2357
+ .frame.vendor .frame-method, .frame.vendor .frame-location { color: var(--g-muted); }
2277
2358
  .frame-header { display: flex; align-items: center; gap: 0.75rem; font-size: 0.875rem; }
2278
2359
  .frame-index { color: var(--g-muted); font: 500 0.75rem var(--g-font-mono); min-width: 2rem; flex-shrink: 0; }
2279
2360
  .frame-method { color: var(--g-heading); font-family: var(--g-font-mono); font-weight: 500; }
@@ -2299,17 +2380,19 @@ function renderDebugPage(thrown, request) {
2299
2380
  </head>
2300
2381
  <body>
2301
2382
  <div class="container">
2302
- <header class="error-header">
2303
- <div class="status-badge">${statusCode}</div>
2304
- <div class="error-info">
2305
- <h1 class="error-class">${escapeHtml(errorName)}</h1>
2306
- <p class="error-message">${errorMessage}</p>
2307
- </div>
2308
- </header>
2383
+ <main>
2384
+ <header class="error-header">
2385
+ <div class="status-badge">${statusCode}</div>
2386
+ <div class="error-info">
2387
+ <h1 class="error-class">${escapeHtml(errorName)}</h1>
2388
+ <p class="error-message">${errorMessage}</p>
2389
+ </div>
2390
+ </header>
2309
2391
 
2310
- ${stackSection}
2311
- ${requestSection}
2312
- ${environmentSection}
2392
+ ${stackSection}
2393
+ ${requestSection}
2394
+ ${environmentSection}
2395
+ </main>
2313
2396
 
2314
2397
  <footer class="footer">
2315
2398
  <p>Guren Framework &mdash; Debug Error Page</p>
@@ -2561,26 +2644,34 @@ var ExceptionHandler = class {
2561
2644
  renderDefaultException(error, ctx) {
2562
2645
  const debug = this.shouldShowDetails();
2563
2646
  const statusCode = resolveExceptionStatus(error);
2647
+ const replacement = !debug && statusCode === 404 && hasComposedNotFoundMessage(error) ? NOT_FOUND_MESSAGE : void 0;
2564
2648
  let body;
2565
- if (HttpException.isHttpException(error)) body = error.toResponse(debug).body;
2566
- else {
2567
- body = { message: statusCode < 500 || debug ? error.message : "Internal Server Error" };
2649
+ if (HttpException.isHttpException(error)) {
2650
+ body = error.toResponse(debug).body;
2651
+ if (replacement !== void 0 && body.message === error.message) body = {
2652
+ ...body,
2653
+ message: replacement
2654
+ };
2655
+ } else {
2656
+ body = { message: replacement ?? (statusCode < 500 || debug ? error.message : "Internal Server Error") };
2568
2657
  if (debug) {
2569
2658
  body.exception = error.name;
2570
2659
  body.stack = error.stack;
2571
2660
  }
2572
2661
  }
2573
2662
  if (this.wantsHtmlResponse(ctx)) {
2574
- const html = debug && statusCode >= 500 ? renderDebugPage(error, ctx.req.raw) : renderErrorPage(statusCode, body.message);
2663
+ const html = debug && statusCode >= 500 ? renderDebugPage(error, ctx.req.raw) : renderErrorPage(statusCode, statusCode === 404 && body.message === "Not Found" ? void 0 : body.message);
2575
2664
  return ctx.html(html, statusCode);
2576
2665
  }
2577
2666
  return ctx.json(body, statusCode);
2578
2667
  }
2579
- /** False for Inertia, XHR and JSON callers, which need a JSON payload. */
2668
+ /**
2669
+ * False for Inertia, XHR and JSON callers, which need a JSON payload. The CSRF
2670
+ * middleware picks its page by `wants-html.ts` directly, so an override here
2671
+ * does not change what a rejected form post answers.
2672
+ */
2580
2673
  wantsHtmlResponse(ctx) {
2581
- if (!ctx?.req?.header) return false;
2582
- const accept = ctx.req.header("accept") ?? "";
2583
- return !(accept.includes("application/json") || ctx.req.header("x-requested-with") === "XMLHttpRequest" || ctx.req.header("x-inertia") === "true") && accept.includes("text/html");
2674
+ return wantsHtmlResponse(ctx);
2584
2675
  }
2585
2676
  middleware() {
2586
2677
  return async (ctx, next) => {
@@ -2595,6 +2686,14 @@ var ExceptionHandler = class {
2595
2686
  }
2596
2687
  };
2597
2688
  /**
2689
+ * A 404 message the framework wrote from the record rather than one a developer
2690
+ * chose: the ORM's `findOrFail()` (by name and `modelName`, since it crosses a
2691
+ * package boundary), a `NotFoundHttpException.for*()`, or none at all.
2692
+ */
2693
+ function hasComposedNotFoundMessage(error) {
2694
+ return hasComposedMessage(error) || error.name === "ModelNotFoundException" && typeof error.modelName === "string" || error.message === "";
2695
+ }
2696
+ /**
2598
2697
  * The HTTP status an exception carries, or 500 when it names none. Duck-typed
2599
2698
  * on `statusCode` rather than `instanceof`, so a foreign exception crossing a
2600
2699
  * package boundary (`ModelNotFoundException` from `@guren/orm`) still renders
@@ -2630,7 +2729,7 @@ function getExceptionHandler() {
2630
2729
  return handler;
2631
2730
  }
2632
2731
  function abort(statusCode, message, errors) {
2633
- throw new HttpException(statusCode, message ?? "Error", errors);
2732
+ throw new HttpException(statusCode, message ?? (statusCode === 404 ? "Not Found" : "Error"), errors);
2634
2733
  }
2635
2734
  function abortIf(condition, statusCode, message) {
2636
2735
  if (condition) abort(statusCode, message);
@@ -2639,28 +2738,6 @@ function abortUnless(condition, statusCode, message) {
2639
2738
  if (!condition) abort(statusCode, message);
2640
2739
  }
2641
2740
  //#endregion
2642
- //#region src/errors/exceptions/NotFoundHttpException.ts
2643
- /** 404: the requested resource could not be found. */
2644
- var NotFoundHttpException = class NotFoundHttpException extends HttpException {
2645
- resourceType;
2646
- resourceId;
2647
- constructor(message = "Not Found", resourceType, resourceId) {
2648
- super(404, message);
2649
- this.name = "NotFoundHttpException";
2650
- this.resourceType = resourceType;
2651
- this.resourceId = resourceId;
2652
- }
2653
- static forModel(model, id) {
2654
- return new NotFoundHttpException(`${model} with ID ${id} not found.`, model, id);
2655
- }
2656
- static forRoute(path) {
2657
- return new NotFoundHttpException(`Route ${path} not found.`, "Route");
2658
- }
2659
- static forResource(resource) {
2660
- return new NotFoundHttpException(`${resource} not found.`, resource);
2661
- }
2662
- };
2663
- //#endregion
2664
2741
  //#region src/errors/exceptions/MethodNotAllowedException.ts
2665
2742
  /** 405: the HTTP method is not allowed for the route. */
2666
2743
  var MethodNotAllowedException = class MethodNotAllowedException extends HttpException {
@@ -2936,7 +3013,7 @@ var InertiaServiceProvider = class extends ServiceProvider {
2936
3013
  }, 422);
2937
3014
  const flattened = {};
2938
3015
  for (const [key, messages] of Object.entries(error.errors ?? {})) flattened[key] = messages[0] ?? "";
2939
- const headers = { Location: ctx.req.header("Referer") ?? "/" };
3016
+ const headers = { Location: sameHostRefererPath(ctx.req.header("Referer"), ctx.req.url, this.refererHosts(ctx.req.url)) };
2940
3017
  const session = getSessionFromContext(ctx);
2941
3018
  if (session) session.flash("errors", flattened);
2942
3019
  else headers["Set-Cookie"] = validationErrorsSetCookie(flattened);
@@ -2947,6 +3024,21 @@ var InertiaServiceProvider = class extends ServiceProvider {
2947
3024
  });
2948
3025
  }
2949
3026
  /**
3027
+ * The request's host, and the one `APP_URL` names (what `config/http.ts`'s host
3028
+ * authorization and the auth scaffold's links key on): a proxy that does not
3029
+ * forward `Host` hands the app its upstream address instead. `X-Forwarded-Host`
3030
+ * is not read, since no app-wide trusted-proxy setting says when it is genuine.
3031
+ */
3032
+ refererHosts(requestUrl) {
3033
+ const hosts = [new URL(requestUrl).host];
3034
+ const appUrl = this.container.makeOptional("env")?.APP_URL ?? (typeof process === "undefined" ? void 0 : process.env.APP_URL);
3035
+ if (typeof appUrl !== "string" || appUrl.trim() === "") return hosts;
3036
+ try {
3037
+ hosts.push(new URL(appUrl.trim()).host);
3038
+ } catch {}
3039
+ return hosts;
3040
+ }
3041
+ /**
2950
3042
  * Auto-inject flashed `errors` into shared props. Scoped to this app's
2951
3043
  * container so a second Application booted in the same process keeps its
2952
3044
  * own registrations.
@@ -3167,6 +3259,11 @@ function deriveAgentTools(definitions) {
3167
3259
  warnings.push(`${toolName}: ${where} (route "${routeName}") claims a tool name already derived from ${existing.method} ${existing.path} (route "${existing.routeName}") — the later route is not exposed. Give one of them a distinct agent toolName.`);
3168
3260
  continue;
3169
3261
  }
3262
+ const ui = agent.ui === void 0 ? void 0 : deriveAgentToolUi(agent.ui);
3263
+ if (typeof ui === "string") {
3264
+ warnings.push(`${toolName}: ${where} (route "${routeName}") declares a malformed agent ui (${ui}), so it is not exposed as a tool.`);
3265
+ continue;
3266
+ }
3170
3267
  const toolWarnings = [];
3171
3268
  const readOnlyHint = agent.readOnlyHint ?? READ_ONLY_METHODS.has(method);
3172
3269
  const input = buildInputSchema(definition, method, toolWarnings);
@@ -3179,6 +3276,7 @@ function deriveAgentTools(definitions) {
3179
3276
  inputSchema: input.schema,
3180
3277
  inputSources: input.sources,
3181
3278
  inputBodyNested: input.nestedBody,
3279
+ ...input.collisions.length > 0 ? { inputCollisions: input.collisions } : {},
3182
3280
  outputSchema: buildOutputSchema(definition, method, toolWarnings),
3183
3281
  resource: definition.schemas?.output ? void 0 : definition.resource,
3184
3282
  annotations: {
@@ -3193,6 +3291,7 @@ function deriveAgentTools(definitions) {
3193
3291
  mcp: agent.expose?.mcp ?? true,
3194
3292
  webMcp: agent.expose?.webMcp ?? true
3195
3293
  },
3294
+ ...ui ? { ui } : {},
3196
3295
  warnings: toolWarnings
3197
3296
  };
3198
3297
  claimed.set(toolName, tool);
@@ -3209,6 +3308,7 @@ function buildInputSchema(definition, method, warnings) {
3209
3308
  const merged = {
3210
3309
  properties: Object.create(null),
3211
3310
  required: /* @__PURE__ */ new Set(),
3311
+ collisions: /* @__PURE__ */ new Set(),
3212
3312
  owner: /* @__PURE__ */ new Map()
3213
3313
  };
3214
3314
  const pathParamNames = extractPathParamNames(definition.path);
@@ -3244,7 +3344,8 @@ function buildInputSchema(definition, method, warnings) {
3244
3344
  ...required.length > 0 ? { required } : {}
3245
3345
  },
3246
3346
  sources: { ...sources },
3247
- nestedBody
3347
+ nestedBody,
3348
+ collisions: Array.from(merged.collisions)
3248
3349
  };
3249
3350
  }
3250
3351
  /**
@@ -3255,7 +3356,10 @@ function buildInputSchema(definition, method, warnings) {
3255
3356
  function mergeProperties(merged, properties, required, source, warnings) {
3256
3357
  for (const [name, schema] of Object.entries(properties)) {
3257
3358
  const previous = merged.owner.get(name);
3258
- if (previous) warnings.push(`input key "${name}" is declared by both the ${previous} and the ${source} schema; the ${source} definition wins. Rename one — merged tool input has one namespace.`);
3359
+ if (previous) {
3360
+ merged.collisions.add(name);
3361
+ warnings.push(`input key "${name}" is declared by both the ${previous} and the ${source} schema; the ${source} definition wins. Rename one — merged tool input has one namespace.`);
3362
+ }
3259
3363
  merged.properties[name] = schema;
3260
3364
  merged.owner.set(name, source);
3261
3365
  merged.required.delete(name);
@@ -3284,6 +3388,44 @@ function deriveAuthorization(definition, method) {
3284
3388
  const ability = derivableAbility(definition.capabilities?.authorization, method);
3285
3389
  return ability === void 0 ? void 0 : { ability };
3286
3390
  }
3391
+ const UI_AUDIENCES = /* @__PURE__ */ new Set(["model", "app"]);
3392
+ /** Never throws, unlike `JSON.stringify` on a bigint: the derivation is total. */
3393
+ function describeEntry(entry) {
3394
+ try {
3395
+ return typeof entry === "string" ? JSON.stringify(entry) : String(entry);
3396
+ } catch {
3397
+ return `a ${typeof entry}`;
3398
+ }
3399
+ }
3400
+ function pageIdOf(value) {
3401
+ if (typeof value !== "object" || value === null) return void 0;
3402
+ const id = value.id;
3403
+ return typeof id === "string" ? id : void 0;
3404
+ }
3405
+ /**
3406
+ * The declared `ui` resolved, or why it is malformed. The one rule: the
3407
+ * derivation and `guren check` both judge a declaration through it.
3408
+ */
3409
+ function deriveAgentToolUi(declared) {
3410
+ const value = declared;
3411
+ if (pageIdOf(value) !== void 0 && ("visibility" in value || "page" in value)) return "a page contract mixed with { page, visibility } options; write { page, visibility }";
3412
+ const form = typeof value === "string" || pageIdOf(value) !== void 0 ? { page: value } : value;
3413
+ if (typeof form !== "object" || form === null || Array.isArray(form)) return "neither a page nor a { page, visibility } object";
3414
+ const { page: rawPage, visibility: rawVisibility } = form;
3415
+ const page = rawPage === void 0 ? void 0 : typeof rawPage === "string" ? rawPage : pageIdOf(rawPage);
3416
+ if (rawPage !== void 0 && page === void 0) return "a page that is neither a page id nor a page contract";
3417
+ if (page !== void 0 && page.trim() === "") return "an empty page id";
3418
+ if (page === void 0 && rawVisibility === void 0) return "neither a page nor a visibility";
3419
+ if (rawVisibility !== void 0 && !Array.isArray(rawVisibility)) return "a visibility that is not a list";
3420
+ const visibility = rawVisibility === void 0 ? ["model", "app"] : Array.from(rawVisibility);
3421
+ if (visibility.length === 0) return "an empty visibility list";
3422
+ const invalid = visibility.findIndex((entry) => typeof entry !== "string" || !UI_AUDIENCES.has(entry));
3423
+ if (invalid !== -1) return `the visibility entry ${describeEntry(visibility[invalid])}, which is neither "model" nor "app"`;
3424
+ return {
3425
+ ...page !== void 0 ? { page } : {},
3426
+ visibility: Array.from(new Set(visibility))
3427
+ };
3428
+ }
3287
3429
  //#endregion
3288
3430
  //#region src/introspection/plain-json.ts
3289
3431
  /**
@@ -3569,7 +3711,7 @@ let devBanner;
3569
3711
  */
3570
3712
  async function loadDevBanner() {
3571
3713
  if (typeof process === "undefined") return devBanner;
3572
- if (process.env.NODE_ENV !== "production") devBanner ??= await import("./dev-banner-B_QaY29h.js").then((n) => n.n);
3714
+ if (process.env.NODE_ENV !== "production") devBanner ??= await import("./dev-banner-DGxB3HGY.js").then((n) => n.n);
3573
3715
  return devBanner;
3574
3716
  }
3575
3717
  /**
@@ -3830,8 +3972,8 @@ var Application = class {
3830
3972
  this.bootSequence ??= new BootSequence([
3831
3973
  () => this.options.boot?.(this.hono),
3832
3974
  () => this.mountRoutes(),
3833
- () => this.mountDevEndpoint(isMcpEndpointEnabled(), async () => (await import("./McpServiceProvider-CXOokGax.js").then((n) => n.n)).McpServiceProvider, "GUREN_MCP=1 but the MCP endpoint could not load — is @guren/cli installed?"),
3834
- () => this.mountDevEndpoint(isDocsViewerEnabled(), async () => (await import("./DocsViewerServiceProvider-BVPZjwQp.js")).DocsViewerServiceProvider, "GUREN_DOCS=1 but the docs viewer could not load — is @guren/cli resolvable from this app?"),
3975
+ () => this.mountDevEndpoint(isMcpEndpointEnabled(), async () => (await import("./McpServiceProvider-BOeQyt7u.js").then((n) => n.n)).McpServiceProvider, "GUREN_MCP=1 but the MCP endpoint could not load — is @guren/cli installed?"),
3976
+ () => this.mountDevEndpoint(isDocsViewerEnabled(), async () => (await import("./DocsViewerServiceProvider-DzrxQoYh.js")).DocsViewerServiceProvider, "GUREN_DOCS=1 but the docs viewer could not load — is @guren/cli resolvable from this app?"),
3835
3977
  () => this.providerManager.bootAll(),
3836
3978
  () => this.warnOnUnconfiguredAuth()
3837
3979
  ]);
@@ -3937,7 +4079,7 @@ var Application = class {
3937
4079
  root: viteOptions?.root ?? process.cwd(),
3938
4080
  config: viteOptions?.config,
3939
4081
  host: viteOptions?.host,
3940
- port: viteOptions?.port
4082
+ port: viteOptions?.port ?? readViteDevServerPort()
3941
4083
  });
3942
4084
  adoptViteDevServer(this, server, localUrl);
3943
4085
  resolvedAssetsUrl = localUrl;
@@ -3991,7 +4133,8 @@ var Application = class {
3991
4133
  if (shouldLogBanner) this.logDevServerBanner({
3992
4134
  hostname: boundHostname,
3993
4135
  port: boundPort,
3994
- assetsUrl: resolvedAssetsUrl ?? "http://localhost:5173"
4136
+ assetsUrl: resolvedAssetsUrl ?? "http://localhost:5173",
4137
+ assetServer: startedViteHere || reusableVite ? "managed" : "external"
3995
4138
  });
3996
4139
  else if (typeof process !== "undefined" && process.env.NODE_ENV === "production") console.info(`[guren] Listening on http://${formatHostPort(boundHostname, boundPort)}`);
3997
4140
  return address;
@@ -4991,7 +5134,8 @@ function createAgentInvocationPipeline(options) {
4991
5134
  principal: options.principal,
4992
5135
  abilities: options.abilities
4993
5136
  }) : built.request);
4994
- const outcome = await mapToolResponse(tool, await options.app.fetch(request, options.env, options.executionCtx));
5137
+ if (options.sharedProps) installAgentSharedProps(request, options.sharedProps);
5138
+ const outcome = await mapToolResponse(tool, await options.app.fetch(request, options.env, options.executionCtx), request.url);
4995
5139
  record.invoked(audited, auditArgs, outcome.status, elapsed(startedAt));
4996
5140
  return {
4997
5141
  status: "executed",
@@ -5382,7 +5526,7 @@ var Validator = class Validator {
5382
5526
  async validateOrThrow(data) {
5383
5527
  const result = await this.validate(data);
5384
5528
  if (!result.success) {
5385
- const { ValidationException } = await import("./errors-JpkcCjjn.js").then((n) => n.t);
5529
+ const { ValidationException } = await import("./errors-C8neC8go.js").then((n) => n.t);
5386
5530
  throw new ValidationException(result.errors);
5387
5531
  }
5388
5532
  return result.data;
@@ -7749,4 +7893,4 @@ function defineStorageConfig(resolve) {
7749
7893
  //#region src/index.ts
7750
7894
  ensureErrorStackTracePolyfill();
7751
7895
  //#endregion
7752
- export { AGENT_APPROVAL_CONFIG_KEY, AGENT_AUDIT_BINDING, AGENT_REDACTED, AGENT_TOOL_NAME_PATTERN, API_TOKEN_KEY, APPROVAL_STATUS_TOOL_NAME, AUTH_CONTEXT_KEY, AgentApprovalRequested, AgentToolDenied, AgentToolInvoked, Application, ApplicationShutdown, ApplicationStarted, ScryptHasher as Argon2Hasher, ScryptHasher, AuthManager, Response$1 as AuthResponse, AuthServiceProvider, AuthenticatableModel, AuthenticationException, AuthorizationException, AuthorizationServiceProvider, AutoDiscovery, BUILT_IN_SESSION_DRIVERS, BaseFactory, BaseFactory as Factory, BaseSeeder, BaseSeeder as Seeder, BaseUserProvider, BroadcastManager, BroadcastServiceProvider, BufferedOutput, CONTAINER_CONTEXT_KEY, CSP_NONCE_KEY, CSRF_FORM_FIELD, CSRF_HEADER_NAME, CSRF_TOKEN_KEY, CacheCheck, CacheManager, CacheServiceProvider, Channel, Command, ConsoleChannel, ConsoleKernel, Container, Controller, CookieSessionStore, CursorPaginator, CustomCheck, DEFAULT_AGENT_APPROVAL_TTL_MS, DEFAULT_AGENT_AUDIT_PATH, DEFAULT_APPROVAL_CONFIGURE_HINT, DEFAULT_SCOPE_SUBJECT, DEFAULT_SESSION_STORE_NAME, DailyFileChannel, DatabaseChannel, DatabaseCheck, DefaultHasher, DefaultHasher as Hash, Encrypter, EncryptionServiceProvider, Env, EnvSchema, EnvValidationError, EnvVar, ErrorServiceProvider, Event, EventManager, EventServiceProvider, ExceptionHandler, FailedJobReporter, FieldValidator, FileStore as FileCacheStore, FileChannel, FormRequest, Gate, HealthCheck, HealthManager, HealthServiceProvider, HttpException, I18nManager, I18nServiceProvider, InertiaServiceProvider, Input, Job, JobFailed, JobProcessed, JsonLoader, JsonResource, LOCALE_CONTEXT_KEY, LOG_LEVEL_PRIORITY, Listener, LocalDriver as LocalStorageDriver, LogManager, LogServiceProvider, LogTransport, Logger, Mail, MailChannel, MailManager, MailServiceProvider, MemoryApiTokenStore, MemoryDriver as MemoryBroadcastDriver, MemoryStore as MemoryCacheStore, MemoryChannel, MemoryCheck, MemoryDriver$1 as MemoryDriver, MemoryDriver$1 as MemoryQueueDriver, MemoryEmailVerificationStore, MemoryLoader, MemoryOAuthStateStore, MemoryPasswordResetStore, MemoryRateLimitStore, MemorySchedulerLock, MemorySessionStore, MemoryDriver$2 as MemoryStorageDriver, MemoryTransport, MessageSigner, MethodNotAllowedException, ModelUserProvider, NodeHasher, NotFoundHttpException, Notification, NotificationManager, NotificationServiceProvider, OAUTH_SESSION_BINDING_KEY, OAuthManager, OAuthServiceProvider, Output, PER_PROCESS_SESSION_DRIVERS, PORTABLE_AGENT_TOOL_NAME_PATTERN, PREFLIGHT_ARGUMENT, PREFLIGHT_TOOL_NAME, Paginator, PendingSchedule, Policy, PresenceChannel, PrivateChannel, ProviderManager, QueueManager, QueueServiceProvider, RESERVED_AGENT_TOOL_NAMES, RedisDriver as RedisBroadcastDriver, RedisStore as RedisCacheStore, RedisCheck, RedisDriver$1 as RedisDriver, RedisDriver$1 as RedisQueueDriver, RequestFinished, RequestReceived, ResendTransport, Resource, ResourceCollection, Router, S3Driver, SERVERLESS_RUNTIME_LABELS, Schedule, ScheduledTask, Scheduler, SchedulingServiceProvider, SeederRunner, ServiceProvider, SessionGuard, SessionManager, SlackChannel, SlidingWindowRateLimitStore, SmtpTransport, SqsDriver, StorageCheck, StorageManager, StorageServiceProvider, SyncDriver, SyncDriver as SyncQueueDriver, TaggedCache, TokenGuard, Translator, UserAuthenticated, UserLoggedOut, VALIDATED_DATA_KEY, ValidationException, Validator, ViewEngine, Worker, abort, abortIf, abortUnless, advertisesStructuredOutput, after, afterOrEqual, agentApprovalExpiredAt, agentApprovalFingerprint, agentApprovalPrincipalKey, agentApprovalStatusAt, agentApprovalUsableAt, agentApprovalVisibleTo, alpha, alphaDash, alphaNum, always, ambientBinding, ambientContainer, approvalStatusNotFoundMessage, array as arrayRule, attachAuthContext, authorize as authorizeAbility, authorizeAllMiddleware, authorizeMiddleware, authorizeResourceMiddleware, before, beforeOrEqual, between, boolean as booleanRule, buildAgentApprovalRequest, buildOAuthAuthorizeUrl, buildOAuthRedirectUrl, buildPasswordResetUrl, buildToolRequest, buildVerificationUrl, can, cannot, canonicalizeAgentApprovalInput, check as checkHash, classifyRegistrationScope, clearJobRegistry, clearNotificationRegistry, clearQueueDriver, collect, completeEmailVerification, completePasswordReset, confirmed, createAgentApprovalContext, createAgentAuditRecorder, createAgentCallBudget, createAgentInvocationPipeline, createApiToken, createApp, createAuditEmitter, createBearerTokenMiddleware, createBroadcastManager, createCacheManager, createConsoleKernel, createContainer, createCorsMiddleware, createCspMiddleware, createCsrfMiddleware, createDiscordOAuthProviderConfig, createEmailVerificationToken, createEncrypter, createEventManager, createExceptionHandler, createFacade, createFacades, createForceHttpsMiddleware, createGate, createGitHubOAuthProviderConfig, createGoogleOAuthProviderConfig, createHealthManager, createHostAuthorizationMiddleware, createI18n, createLogManager, createMailManager, createNotificationManager, createOAuthManager, createOAuthState, createPasswordResetToken, createQueueEventDispatcher, createQueueManager, createRateLimitMiddleware, createRedirectSafetyMiddleware, createRedisClient, createScheduler, createSecurityHeaders, createSeederRunner, createSessionMiddleware, createSqsAdapter, createStorageManager, createTypedBroadcaster, createValidator, createWebSocketOriginGuard, csrfField, cursorPaginate, custom, customCheck, dailyFileDateStamp, dailyFilePath, dateFormat, date as dateRule, debugErrorMiddleware, decodeCursor, decrypt, defaultApplication, defaultContainer, defer, defineCacheConfig, defineConfig, defineEnv, defineFactory, defineGate, defineHttpConfig, defineMailConfig, defineMiddleware, defineModule, defineOAuthConfig, definePlugin, definePolicy, defineQueueConfig, defineStorageConfig, deriveAgentTools, deriveAppKey, deriveAppKeyring, describeBuildFailure, detectLocaleMiddleware, detectServerlessRuntime, different, email as emailRule, encodeCursor, encrypt, endsWith, exchangeOAuthCode, exists, expandToolScopes, fetchOAuthUserProfile, file as fileRule, filterSensitiveData, formatValidationErrors, gateApproval, gatePreflight, gateToolCall, generateAppKey, generateKey, generateOtp, generatePassword, generateSlug, getApiToken, getApiTokenOrFail, getAppKeyringFromEnv, getBroadcastManager, getContainer, getCspNonce, getCsrfToken, getEncrypter, getExceptionHandler, getGate, getI18n, getInertiaSharedPropsResolver, getJob, getLogManager, getMailManager, getNextOccurrence, getNextOccurrences, getNotification, getNotificationManager, getPluralizationRule, getQueueDriver, getRateLimitInfo, getRegisteredJobs, getRequestContainer, getRequestLocale, getRequestTranslator, getSessionFromContext, getUserApiTokens, getValidatedData, hash, hashPassword, hmac, image as imageRule, inValues, inertia, integer, ip, ipv4, ipv6, isAlwaysProp, isDeferredProp, isDue, isDueInTimezone, isEmailVerified, isIntrospecting, isRawEnvKey, isReservedAgentToolName, isSafeRedirectUrl, jsonResponse, json as jsonRule, mail, mapToolResponse, matchDailyFileDate, matchesCron, max, maxFileSize, md5, mimes, min, minFileSize, mountModuleRoutes, needsRehash, normalizeAppKey, notIn, notifyApprovers, nullable, numeric, object as objectRule, paginate, parseApiToken, parseAppKey, parseAuditRecord, parseCron, parseOAuthRedirectUrl, parsePasswordResetUrl, parsePreviousAppKeys, parseRequestPayload, parseSignature, parseToolScope, parseVerificationUrl, pick, pluralizationRules, processJob, prototype, quickValidate, quickValidateOrThrow, random, randomBase64, randomBase64Url, randomHex, randomInt, randomString, readBearerToken, recordEnvReads, redactAgentArguments, regex, registerJob, registerNotification, renderDebugPage, renderDocument, renderErrorPage, requestIdMiddleware, requestLoggingMiddleware, requireAuthenticated, requireGuest, requireVerifiedEmail, required, requiredIf, requiredUnless, requiredWith, requiredWithout, resetCalledSeeders, resetDefaultApplication, resetRateLimit, resolve, resolveAgentAuditSink, resolveJobName, resolveNotifiableType, resolveOptional, resolveQueueDriver, revokeAllApiTokens, revokeApiToken, same, sample, sanitizeOAuthRedirect, scopedShape, scopesAllowTool, secureCompare, selectPluralForm, setBroadcastManager, setContainer, setEncrypter, setExceptionHandler, setGate, setI18n, setInertiaDocument, setInertiaSharedProps, setInertiaSsrRenderer, setLogManager, setMailManager, setNotificationManager, setQueueDriver, sha256, sha512, shareInertiaProps, shuffle, signUrl, size, startsWith, string as stringRule, t, tc, toApprovalStatusReport, toAuditRecord, toTimezone, tokenCan, tokenCanAll, tokenCanAny, tryGetI18n, tryGetRequestContainer, unique, url as urlRule, urlSafeToken, useAsDefaultApplication, uuid, uuid$1 as uuidRule, validate, validateRequest, validateRequestWith, validateSafe, verifyApiToken, verifyCsrfToken, verifyEmailToken, verifyHmac, verifyOAuthState, verifyPassword, verifyPasswordResetToken, verifySignedUrl, viteAsset, withAuthorization };
7896
+ export { AGENT_APPROVAL_CONFIG_KEY, AGENT_AUDIT_BINDING, AGENT_REDACTED, AGENT_TOOL_NAME_PATTERN, API_TOKEN_KEY, APPROVAL_STATUS_TOOL_NAME, AUTH_CONTEXT_KEY, AgentApprovalRequested, AgentToolDenied, AgentToolInvoked, Application, ApplicationShutdown, ApplicationStarted, ScryptHasher as Argon2Hasher, ScryptHasher, AuthManager, Response$1 as AuthResponse, AuthServiceProvider, AuthenticatableModel, AuthenticationException, AuthorizationException, AuthorizationServiceProvider, AutoDiscovery, BUILT_IN_SESSION_DRIVERS, BaseFactory, BaseFactory as Factory, BaseSeeder, BaseSeeder as Seeder, BaseUserProvider, BroadcastManager, BroadcastServiceProvider, BufferedOutput, CONTAINER_CONTEXT_KEY, CSP_NONCE_KEY, CSRF_FORM_FIELD, CSRF_HEADER_NAME, CSRF_TOKEN_KEY, CacheCheck, CacheManager, CacheServiceProvider, Channel, Command, ConsoleChannel, ConsoleKernel, Container, Controller, CookieSessionStore, CursorPaginator, CustomCheck, DEFAULT_AGENT_APPROVAL_TTL_MS, DEFAULT_AGENT_AUDIT_PATH, DEFAULT_APPROVAL_CONFIGURE_HINT, DEFAULT_SCOPE_SUBJECT, DEFAULT_SESSION_STORE_NAME, DailyFileChannel, DatabaseChannel, DatabaseCheck, DefaultHasher, DefaultHasher as Hash, Encrypter, EncryptionServiceProvider, Env, EnvSchema, EnvValidationError, EnvVar, ErrorServiceProvider, Event, EventManager, EventServiceProvider, ExceptionHandler, FailedJobReporter, FieldValidator, FileStore as FileCacheStore, FileChannel, FormRequest, Gate, HealthCheck, HealthManager, HealthServiceProvider, HttpException, I18nManager, I18nServiceProvider, InertiaServiceProvider, Input, Job, JobFailed, JobProcessed, JsonLoader, JsonResource, LOCALE_CONTEXT_KEY, LOG_LEVEL_PRIORITY, Listener, LocalDriver as LocalStorageDriver, LogManager, LogServiceProvider, LogTransport, Logger, Mail, MailChannel, MailManager, MailServiceProvider, MemoryApiTokenStore, MemoryDriver as MemoryBroadcastDriver, MemoryStore as MemoryCacheStore, MemoryChannel, MemoryCheck, MemoryDriver$1 as MemoryDriver, MemoryDriver$1 as MemoryQueueDriver, MemoryEmailVerificationStore, MemoryLoader, MemoryOAuthStateStore, MemoryPasswordResetStore, MemoryRateLimitStore, MemorySchedulerLock, MemorySessionStore, MemoryDriver$2 as MemoryStorageDriver, MemoryTransport, MessageSigner, MethodNotAllowedException, ModelUserProvider, NodeHasher, NotFoundHttpException, Notification, NotificationManager, NotificationServiceProvider, OAUTH_SESSION_BINDING_KEY, OAuthManager, OAuthServiceProvider, Output, PER_PROCESS_SESSION_DRIVERS, PORTABLE_AGENT_TOOL_NAME_PATTERN, PREFLIGHT_ARGUMENT, PREFLIGHT_TOOL_NAME, Paginator, PendingSchedule, Policy, PresenceChannel, PrivateChannel, ProviderManager, QueueManager, QueueServiceProvider, RESERVED_AGENT_TOOL_NAMES, RedisDriver as RedisBroadcastDriver, RedisStore as RedisCacheStore, RedisCheck, RedisDriver$1 as RedisDriver, RedisDriver$1 as RedisQueueDriver, RequestFinished, RequestReceived, ResendTransport, Resource, ResourceCollection, Router, S3Driver, SERVERLESS_RUNTIME_LABELS, Schedule, ScheduledTask, Scheduler, SchedulingServiceProvider, SeederRunner, ServiceProvider, SessionGuard, SessionManager, SlackChannel, SlidingWindowRateLimitStore, SmtpTransport, SqsDriver, StorageCheck, StorageManager, StorageServiceProvider, SyncDriver, SyncDriver as SyncQueueDriver, TaggedCache, TokenGuard, Translator, UserAuthenticated, UserLoggedOut, VALIDATED_DATA_KEY, ValidationException, Validator, ViewEngine, Worker, abort, abortIf, abortUnless, advertisesStructuredOutput, after, afterOrEqual, agentApprovalExpiredAt, agentApprovalFingerprint, agentApprovalPrincipalKey, agentApprovalStatusAt, agentApprovalUsableAt, agentApprovalVisibleTo, alpha, alphaDash, alphaNum, always, ambientBinding, ambientContainer, approvalStatusNotFoundMessage, array as arrayRule, attachAuthContext, authorize as authorizeAbility, authorizeAllMiddleware, authorizeMiddleware, authorizeResourceMiddleware, before, beforeOrEqual, between, boolean as booleanRule, broadcastChannelsOf, broadcastNameOf, buildAgentApprovalRequest, buildOAuthAuthorizeUrl, buildOAuthRedirectUrl, buildPasswordResetUrl, buildToolRequest, buildVerificationUrl, can, cannot, canonicalizeAgentApprovalInput, check as checkHash, classifyRegistrationScope, clearJobRegistry, clearNotificationRegistry, clearQueueDriver, collect, completeEmailVerification, completePasswordReset, confirmed, createAgentApprovalContext, createAgentAuditRecorder, createAgentCallBudget, createAgentInvocationPipeline, createApiToken, createApp, createAuditEmitter, createBearerTokenMiddleware, createBroadcastManager, createCacheManager, createConsoleKernel, createContainer, createCorsMiddleware, createCspMiddleware, createCsrfMiddleware, createDiscordOAuthProviderConfig, createEmailVerificationToken, createEncrypter, createEventManager, createExceptionHandler, createFacade, createFacades, createForceHttpsMiddleware, createGate, createGitHubOAuthProviderConfig, createGoogleOAuthProviderConfig, createHealthManager, createHostAuthorizationMiddleware, createI18n, createLogManager, createMailManager, createNotificationManager, createOAuthManager, createOAuthState, createPasswordResetToken, createQueueEventDispatcher, createQueueManager, createRateLimitMiddleware, createRedirectSafetyMiddleware, createRedisClient, createScheduler, createSecurityHeaders, createSeederRunner, createSessionMiddleware, createSqsAdapter, createStorageManager, createTypedBroadcaster, createValidator, createWebSocketOriginGuard, csrfField, cursorPaginate, custom, customCheck, dailyFileDateStamp, dailyFilePath, dateFormat, date as dateRule, debugErrorMiddleware, decodeCursor, decrypt, defaultApplication, defaultContainer, defer, defineCacheConfig, defineConfig, defineEnv, defineFactory, defineGate, defineHttpConfig, defineMailConfig, defineMiddleware, defineModule, defineOAuthConfig, definePlugin, definePolicy, defineQueueConfig, defineStorageConfig, deriveAgentToolUi, deriveAgentTools, deriveAppKey, deriveAppKeyring, describeBuildFailure, detectLocaleMiddleware, detectServerlessRuntime, different, email as emailRule, encodeCursor, encrypt, endsWith, exchangeOAuthCode, exists, expandToolScopes, fetchOAuthUserProfile, file as fileRule, filterSensitiveData, formatValidationErrors, gateApproval, gatePreflight, gateToolCall, generateAppKey, generateKey, generateOtp, generatePassword, generateSlug, getApiToken, getApiTokenOrFail, getAppKeyringFromEnv, getBroadcastManager, getContainer, getCspNonce, getCsrfToken, getEncrypter, getExceptionHandler, getGate, getI18n, getInertiaSharedPropsResolver, getJob, getLogManager, getMailManager, getNextOccurrence, getNextOccurrences, getNotification, getNotificationManager, getPluralizationRule, getQueueDriver, getRateLimitInfo, getRegisteredJobs, getRequestContainer, getRequestLocale, getRequestTranslator, getSessionFromContext, getUserApiTokens, getValidatedData, hash, hashPassword, hmac, image as imageRule, inValues, inertia, integer, ip, ipv4, ipv6, isAlwaysProp, isDeferredProp, isDue, isDueInTimezone, isEmailVerified, isIntrospecting, isLiveProp, isRawEnvKey, isReservedAgentToolName, isSafeRedirectUrl, jsonResponse, json as jsonRule, live, mail, mapToolResponse, matchDailyFileDate, matchesCron, max, maxFileSize, md5, mimes, min, minFileSize, mountModuleRoutes, needsRehash, normalizeAppKey, notIn, notifyApprovers, nullable, numeric, object as objectRule, paginate, parseApiToken, parseAppKey, parseAuditRecord, parseCron, parseOAuthRedirectUrl, parsePasswordResetUrl, parsePreviousAppKeys, parseRequestPayload, parseSignature, parseToolScope, parseVerificationUrl, pick, pluralizationRules, processJob, prototype, quickValidate, quickValidateOrThrow, random, randomBase64, randomBase64Url, randomHex, randomInt, randomString, readBearerToken, recordEnvReads, redactAgentArguments, regex, registerJob, registerNotification, renderDebugPage, renderDocument, renderErrorPage, requestIdMiddleware, requestLoggingMiddleware, requireAuthenticated, requireGuest, requireVerifiedEmail, required, requiredIf, requiredUnless, requiredWith, requiredWithout, resetCalledSeeders, resetDefaultApplication, resetRateLimit, resolve, resolveAgentAuditSink, resolveJobName, resolveNotifiableType, resolveOptional, resolveQueueDriver, revokeAllApiTokens, revokeApiToken, same, sample, sanitizeOAuthRedirect, scopedShape, scopesAllowTool, secureCompare, selectPluralForm, setBroadcastManager, setContainer, setEncrypter, setExceptionHandler, setGate, setI18n, setInertiaDocument, setInertiaSharedProps, setInertiaSsrRenderer, setLogManager, setMailManager, setNotificationManager, setQueueDriver, sha256, sha512, shareInertiaProps, shuffle, signUrl, size, startsWith, string as stringRule, t, tc, toApprovalStatusReport, toAuditRecord, toTimezone, tokenCan, tokenCanAll, tokenCanAny, tryGetI18n, tryGetRequestContainer, unique, url as urlRule, urlSafeToken, useAsDefaultApplication, uuid, uuid$1 as uuidRule, validate, validateRequest, validateRequestWith, validateSafe, verifyApiToken, verifyCsrfToken, verifyEmailToken, verifyHmac, verifyOAuthState, verifyPassword, verifyPasswordResetToken, verifySignedUrl, viteAsset, withAuthorization };