@guren/server 2.21.0 → 2.23.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 (115) hide show
  1. package/dist/Job-BxioDEcS.js +165 -0
  2. package/dist/{Logger-DFifRAtc.js → Logger-DWXdtLSJ.js} +62 -2
  3. package/dist/agent/approval-status.d.ts +1 -1
  4. package/dist/agent/approval.d.ts +2 -2
  5. package/dist/agent/audit-emitter.d.ts +11 -1
  6. package/dist/agent/gate.d.ts +10 -8
  7. package/dist/agent/meta-tools.d.ts +13 -5
  8. package/dist/agent/pipeline.d.ts +10 -9
  9. package/dist/auth/AuthManager.d.ts +29 -0
  10. package/dist/auth/AuthenticatableModel.d.ts +15 -0
  11. package/dist/auth/RequestAuthContext.d.ts +10 -1
  12. package/dist/auth/SessionGuard.d.ts +2 -0
  13. package/dist/auth/api-token.d.ts +6 -0
  14. package/dist/auth/context.d.ts +32 -0
  15. package/dist/auth/index.d.ts +7 -0
  16. package/dist/auth/index.js +2 -2
  17. package/dist/auth/model-capability.d.ts +8 -0
  18. package/dist/auth/oauth/index.d.ts +5 -0
  19. package/dist/auth/password/DefaultHasher.d.ts +17 -6
  20. package/dist/auth/password/configured-hasher.d.ts +23 -0
  21. package/dist/auth/providers/ModelUserProvider.d.ts +3 -0
  22. package/dist/auth/providers/unconfigured-user-provider.d.ts +12 -0
  23. package/dist/auth/types.d.ts +9 -0
  24. package/dist/{auth-CjE2oO50.js → auth-D_W1cJp3.js} +279 -84
  25. package/dist/authorization/Gate.d.ts +12 -0
  26. package/dist/authorization/index.js +1 -1
  27. package/dist/{authorization-CdEWZZw3.js → authorization-0mCGUFoI.js} +58 -12
  28. package/dist/broadcasting/BroadcastManager.d.ts +10 -0
  29. package/dist/broadcasting/index.js +1 -1
  30. package/dist/{broadcasting-B5RzB0A2.js → broadcasting-BdJnaq1O.js} +17 -3
  31. package/dist/cache/index.js +1 -1
  32. package/dist/{cache-thXRnaju.js → cache-DikxP7Bk.js} +1 -1
  33. package/dist/container/Container.d.ts +18 -1
  34. package/dist/container/bindings.d.ts +9 -4
  35. package/dist/container/index.d.ts +4 -2
  36. package/dist/container/resolve-optional.d.ts +10 -0
  37. package/dist/context-af2n5abO.js +91 -0
  38. package/dist/{Job-CvDwk2Gj.js → default-application-Chbrul_m.js} +126 -82
  39. package/dist/encryption/Encrypter.d.ts +10 -0
  40. package/dist/encryption/index.js +1 -1
  41. package/dist/{encryption-uwP3Di4D.js → encryption-BRjZnshr.js} +23 -5
  42. package/dist/errors/ExceptionHandler.d.ts +10 -0
  43. package/dist/events/Event.d.ts +18 -0
  44. package/dist/events/EventManager.d.ts +56 -4
  45. package/dist/events/index.d.ts +2 -1
  46. package/dist/events/index.js +2 -2
  47. package/dist/events/queued.d.ts +8 -0
  48. package/dist/events/serialize.d.ts +8 -0
  49. package/dist/events/types.d.ts +19 -2
  50. package/dist/events-C86rS63h.js +428 -0
  51. package/dist/health/checks/CacheCheck.d.ts +3 -5
  52. package/dist/health/checks/StorageCheck.d.ts +3 -5
  53. package/dist/health/index.js +1 -1
  54. package/dist/{health-DQSvUplL.js → health-CB0oS_UE.js} +2 -2
  55. package/dist/http/Application.d.ts +28 -0
  56. package/dist/http/default-application.d.ts +33 -0
  57. package/dist/http/middleware/detect-locale.d.ts +2 -1
  58. package/dist/http/request-container.d.ts +25 -0
  59. package/dist/i18n/I18nManager.d.ts +16 -3
  60. package/dist/i18n/index.d.ts +1 -1
  61. package/dist/i18n/index.js +2 -2
  62. package/dist/{i18n-BZ2VrSud.js → i18n-DRo1g0AN.js} +34 -10
  63. package/dist/index.d.ts +16 -11
  64. package/dist/index.js +248 -129
  65. package/dist/lambda/index.js +1 -1
  66. package/dist/logging/LogManager.d.ts +9 -0
  67. package/dist/logging/index.js +2 -2
  68. package/dist/{logging-DXmqqUl4.js → logging-CXotojgW.js} +17 -4
  69. package/dist/mail/Mail.d.ts +14 -1
  70. package/dist/mail/MailManager.d.ts +10 -2
  71. package/dist/mail/index.js +1 -1
  72. package/dist/{mail-9CrvJyBZ.js → mail-CmxO2Ttx.js} +42 -11
  73. package/dist/mvc/Controller.d.ts +1 -1
  74. package/dist/mvc/Router.d.ts +16 -5
  75. package/dist/mvc/inertia/InertiaEngine.d.ts +24 -3
  76. package/dist/mvc/inertia/shared.d.ts +7 -0
  77. package/dist/notifications/NotificationManager.d.ts +15 -0
  78. package/dist/notifications/index.js +1 -1
  79. package/dist/{notifications-D0VXkFLF.js → notifications-CE3U7uyg.js} +24 -5
  80. package/dist/providers/AuthServiceProvider.d.ts +5 -4
  81. package/dist/providers/AuthorizationServiceProvider.d.ts +2 -2
  82. package/dist/providers/BroadcastServiceProvider.d.ts +4 -1
  83. package/dist/providers/EncryptionServiceProvider.d.ts +7 -1
  84. package/dist/providers/EventServiceProvider.d.ts +1 -0
  85. package/dist/providers/LogServiceProvider.d.ts +6 -1
  86. package/dist/providers/MailServiceProvider.d.ts +7 -1
  87. package/dist/providers/NotificationServiceProvider.d.ts +4 -1
  88. package/dist/queue/Job.d.ts +39 -0
  89. package/dist/queue/QueueManager.d.ts +14 -5
  90. package/dist/queue/Worker.d.ts +2 -1
  91. package/dist/queue/index.d.ts +1 -1
  92. package/dist/queue/index.js +3 -3
  93. package/dist/queue/types.d.ts +7 -0
  94. package/dist/{queue-zPPYZdif.js → queue-B3x_RKnB.js} +24 -10
  95. package/dist/redis/RedisSchedulerLock.d.ts +17 -0
  96. package/dist/redis/index.d.ts +2 -0
  97. package/dist/redis/index.js +21 -1
  98. package/dist/runtime/index.js +1 -1
  99. package/dist/scheduling/MemorySchedulerLock.d.ts +16 -0
  100. package/dist/scheduling/ScheduledTask.d.ts +19 -2
  101. package/dist/scheduling/Scheduler.d.ts +25 -0
  102. package/dist/scheduling/index.d.ts +2 -1
  103. package/dist/scheduling/index.js +2 -2
  104. package/dist/scheduling/types.d.ts +26 -2
  105. package/dist/{scheduling-C6tcOtUl.js → scheduling-DudNXGnh.js} +178 -20
  106. package/dist/storage/index.js +1 -1
  107. package/dist/{storage-D_yNe54O.js → storage-6HLaUf9j.js} +2 -13
  108. package/dist/support/deprecate.d.ts +16 -0
  109. package/dist/support/keep-alive.d.ts +26 -0
  110. package/dist/support/request-deferrer.d.ts +10 -0
  111. package/dist/{vite-manifest-CdfPfQdj.js → vite-manifest-B8720V7w.js} +1 -1
  112. package/dist/warn-once-p-IlMjra.js +13 -0
  113. package/package.json +3 -2
  114. package/dist/context-CXk_umpT.js +0 -21
  115. package/dist/events-DOmAHDeP.js +0 -230
package/dist/index.js CHANGED
@@ -1,38 +1,40 @@
1
1
  import { a as parseRequestPayload, i as parseRequestBody, n as flattenRequestQueries, o as parseRequestUploads, r as formatValidationErrors, t as asRecord } from "./request-CLOYytGP.js";
2
2
  import { t as HttpException } from "./HttpException-BlQ2yEmT.js";
3
3
  import { n as ValidationException } from "./errors-JpkcCjjn.js";
4
- import { _ as setGate, a as withAuthorization, b as mergeCapabilities, c as Gate, d as can, f as cannot, h as getGate, i as resourceAbilityForMethod, l as Response$1, m as defineGate, n as authorizeMiddleware, o as Policy, p as createGate, r as authorizeResourceMiddleware, s as definePolicy, t as authorizeAllMiddleware, u as authorize, v as AuthorizationException, x as stampCapabilities, y as capabilitiesOf } from "./authorization-CdEWZZw3.js";
4
+ import { C as capabilitiesOf, S as tryGetRequestContainer, T as stampCapabilities, _ as resolveGate, a as withAuthorization, b as CONTAINER_CONTEXT_KEY, c as Gate, d as can, f as cannot, h as getGate, i as resourceAbilityForMethod, l as Response$1, m as defineGate, n as authorizeMiddleware, o as Policy, p as createGate, r as authorizeResourceMiddleware, s as definePolicy, t as authorizeAllMiddleware, u as authorize, v as setGate, w as mergeCapabilities, x as getRequestContainer, y as AuthorizationException } from "./authorization-0mCGUFoI.js";
5
5
  import { a as mapToolResponse, i as describeBuildFailure, n as advertisesStructuredOutput, r as buildToolRequest, s as AGENT_PREFLIGHT_VERDICT_HEADER, t as PREFLIGHT_ARGUMENT } from "./dispatch-BAwzftws.js";
6
6
  import { t as trimSlashes } from "./trim-slashes-BLY9hKAa.js";
7
7
  import { PATH_PARAM_PATTERN, extractPathParamNames } from "./internal/route-path.js";
8
8
  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-Bd25ZJAV.js";
9
9
  import { n as detectServerlessRuntime, t as SERVERLESS_RUNTIME_LABELS } from "./serverless-D96rJb6x.js";
10
- import { A as verifyOAuthState, B as getApiToken, C as createGoogleOAuthProviderConfig, D as fetchOAuthUserProfile, E as exchangeOAuthCode, F as TokenGuard, G as readBearerToken, H as getUserApiTokens, I as API_TOKEN_KEY, J as tokenCan, K as revokeAllApiTokens, L as MemoryApiTokenStore, M as isAppRelativePath, N as normalizeRedirectTarget, O as parseOAuthRedirectUrl, P as AuthManager, Q as SessionGuard, R as createApiToken, S as createGitHubOAuthProviderConfig, T as createOAuthState, U as hasBearerHeader, V as getApiTokenOrFail, W as parseApiToken, X as tokenCanAny, Y as tokenCanAll, Z as verifyApiToken, _ as OAUTH_SESSION_BINDING_KEY, _t as getSessionFromContext, a as isEmailVerified, b as buildOAuthRedirectUrl, c as verifyEmailToken, ct as NodeHasher, d as completePasswordReset, dt as BaseUserProvider, f as createPasswordResetToken, ft as installAgentPrincipal, g as MemoryOAuthStateStore, gt as defaultCookieSecure, h as AuthenticatableModel, ht as createSessionMiddleware, i as createEmailVerificationToken, j as hostMatchesAllowlist, k as sanitizeOAuthRedirect, l as MemoryPasswordResetStore, lt as ScryptHasher, m as verifyPasswordResetToken, mt as MemorySessionStore, n as buildVerificationUrl, o as parseVerificationUrl, ot as ModelUserProvider, p as parsePasswordResetUrl, pt as readAgentPrincipal, q as revokeApiToken, r as completeEmailVerification, s as requireVerifiedEmail, st as DefaultHasher, t as MemoryEmailVerificationStore, u as buildPasswordResetUrl, ut as AuthenticationException, v as OAuthManager, w as createOAuthManager, x as createDiscordOAuthProviderConfig, y as buildOAuthAuthorizeUrl, z as createBearerTokenMiddleware } from "./auth-CjE2oO50.js";
11
- import { _ as parseImportMap, c as isViteProduction, d as startViteDevServer, g as DEFAULT_DEV_STYLES_ENTRY, h as logDevServerBanner, i as clientManifestCandidates, l as loadViteManifest, m as isWildcardHost, n as INJECTED_CLIENT_MANIFEST_SOURCE, o as getManifestFile, p as formatHostPort, r as PUBLIC_ASSETS_URL_PREFIX, s as injectedClientManifest, u as normalizeDevServerUrl } from "./vite-manifest-CdfPfQdj.js";
12
- import { a as getRegisteredJobs, c as setQueueDriver, d as getContainer, f as resolve, i as getQueueDriver, l as Container, n as clearJobRegistry, o as registerJob, p as setContainer, r as getJob, s as resolveJobName, t as Job, u as createContainer } from "./Job-CvDwk2Gj.js";
10
+ import { $ as SessionGuard, A as verifyOAuthState, B as createBearerTokenMiddleware, C as createGoogleOAuthProviderConfig, D as fetchOAuthUserProfile, E as exchangeOAuthCode, F as DEFAULT_PROVIDER, G as parseApiToken, H as getApiTokenOrFail, I as TokenGuard, J as revokeApiToken, K as readBearerToken, L as API_TOKEN_KEY, M as isAppRelativePath, N as normalizeRedirectTarget, O as parseOAuthRedirectUrl, P as AuthManager, Q as verifyApiToken, R as MemoryApiTokenStore, S as createGitHubOAuthProviderConfig, T as createOAuthState, U as getUserApiTokens, V as getApiToken, W as hasBearerHeader, X as tokenCanAll, Y as tokenCan, Z as tokenCanAny, _ as OAUTH_SESSION_BINDING_KEY, _t as getSessionFromContext, a as isEmailVerified, b as buildOAuthRedirectUrl, c as verifyEmailToken, ct as DefaultHasher, d as completePasswordReset, dt as BaseUserProvider, f as createPasswordResetToken, ft as installAgentPrincipal, g as MemoryOAuthStateStore, gt as defaultCookieSecure, h as AuthenticatableModel, ht as createSessionMiddleware, i as createEmailVerificationToken, j as hostMatchesAllowlist, k as sanitizeOAuthRedirect, l as MemoryPasswordResetStore, lt as NodeHasher, m as verifyPasswordResetToken, mt as MemorySessionStore, n as buildVerificationUrl, o as parseVerificationUrl, p as parsePasswordResetUrl, pt as readAgentPrincipal, q as revokeAllApiTokens, r as completeEmailVerification, s as requireVerifiedEmail, st as ModelUserProvider, t as MemoryEmailVerificationStore, u as buildPasswordResetUrl, ut as ScryptHasher, v as OAuthManager, w as createOAuthManager, x as createDiscordOAuthProviderConfig, y as buildOAuthAuthorizeUrl, z as createApiToken } from "./auth-D_W1cJp3.js";
11
+ import { _ as parseImportMap, c as isViteProduction, d as startViteDevServer, g as DEFAULT_DEV_STYLES_ENTRY, h as logDevServerBanner, i as clientManifestCandidates, l as loadViteManifest, m as isWildcardHost, n as INJECTED_CLIENT_MANIFEST_SOURCE, o as getManifestFile, p as formatHostPort, r as PUBLIC_ASSETS_URL_PREFIX, s as injectedClientManifest, u as normalizeDevServerUrl } from "./vite-manifest-B8720V7w.js";
12
+ import { a as getJob, d as resolveQueueDriver, f as setQueueDriver, l as registerJob, n as clearJobRegistry, o as getQueueDriver, p as resolveOptional, r as clearQueueDriver, s as getRegisteredJobs, t as Job, u as resolveJobName } from "./Job-BxioDEcS.js";
13
+ import { t as warnOnce } from "./warn-once-p-IlMjra.js";
14
+ import { a as defaultApplication, c as resolve, d as createContainer, f as getContainer, h as warnDeprecatedSetter, i as bindAmbient, l as useAsDefaultApplication, m as warnDeprecatedGetter, n as ambientBinding, o as defaultContainer, p as setContainer, r as ambientContainer, s as resetDefaultApplication, t as adoptDefaultApplication, u as Container } from "./default-application-Chbrul_m.js";
13
15
  import { n as ProviderManager, r as ServiceProvider } from "./loopback-guard-DT9gHF0F.js";
16
+ import { o as AuthenticationException, r as getAuthContext, t as AUTH_CONTEXT_KEY } from "./context-af2n5abO.js";
14
17
  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";
15
- import { n as getAuthContext, t as AUTH_CONTEXT_KEY } from "./context-CXk_umpT.js";
16
- import { n as filterSensitiveData, t as Logger } from "./Logger-DFifRAtc.js";
17
- import { a as RedisStore, i as FileStore, n as createCacheManager, o as MemoryStore, r as TaggedCache, s as resolveLazyRedisClient, t as CacheManager } from "./cache-thXRnaju.js";
18
+ import { a as runInRequestScope, i as keepAlive, n as filterSensitiveData, t as Logger } from "./Logger-DWXdtLSJ.js";
19
+ import { a as RedisStore, i as FileStore, n as createCacheManager, o as MemoryStore, r as TaggedCache, s as resolveLazyRedisClient, t as CacheManager } from "./cache-DikxP7Bk.js";
18
20
  import { n as createRedisClient, r as RedisSessionStore } from "./client-C5Wj9P9o.js";
19
21
  import { r as isMcpEndpointEnabled } from "./endpoint-Dsw3Acvq.js";
20
22
  import { n as isHotReloadRuntime, r as matchingOpenParen, t as claimHotDisposable } from "./hot-disposables-B5BXqaIH.js";
21
- import { a as setI18n, c as tryGetI18n, d as getPluralizationRule, f as pluralizationRules, i as getI18n, l as JsonLoader, n as I18nManager, o as t, p as selectPluralForm, r as createI18n, s as tc, t as MemoryLoader, u as Translator } from "./i18n-BZ2VrSud.js";
23
+ import { a as resolveI18n, 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-DRo1g0AN.js";
22
24
  import { r as isDocsViewerEnabled } from "./endpoint-BXipU2Jj.js";
23
25
  import { t as jsx_runtime_exports } from "./jsx-runtime.js";
24
26
  import { readObjectSchema, toJsonSchema } from "./internal/zod-json-schema.js";
25
- import { a as RequestFinished, c as UserLoggedOut, d as createEventManager, f as Event, i as JobProcessed, l as Listener, n as ApplicationStarted, o as RequestReceived, r as JobFailed, s as UserAuthenticated, t as ApplicationShutdown, u as EventManager } from "./events-DOmAHDeP.js";
26
- 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-D0VXkFLF.js";
27
- 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-zPPYZdif.js";
28
- 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-9CrvJyBZ.js";
29
- import { a as DailyFileChannel, c as matchDailyFileDate, d as LOG_LEVEL_PRIORITY, i as setLogManager, l as FileChannel, n as createLogManager, o as dailyFileDateStamp, r as getLogManager, s as dailyFilePath, t as LogManager, u as ConsoleChannel } from "./logging-DXmqqUl4.js";
30
- import { a as setBroadcastManager, c as PresenceChannel, 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-B5RzB0A2.js";
27
+ 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-C86rS63h.js";
28
+ 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-CE3U7uyg.js";
29
+ 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-B3x_RKnB.js";
30
+ 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-CmxO2Ttx.js";
31
+ import { a as DailyFileChannel, c as matchDailyFileDate, d as LOG_LEVEL_PRIORITY, i as setLogManager, l as FileChannel, n as createLogManager, o as dailyFileDateStamp, r as getLogManager, s as dailyFilePath, t as LogManager, u as ConsoleChannel } from "./logging-CXotojgW.js";
32
+ import { a as setBroadcastManager, c as PresenceChannel, 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-BdJnaq1O.js";
31
33
  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";
32
- 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-uwP3Di4D.js";
33
- import { a as LocalDriver, i as S3Driver, n as createStorageManager, o as warnOnce, r as MemoryDriver$2, t as StorageManager } from "./storage-D_yNe54O.js";
34
- 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-DQSvUplL.js";
35
- 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, r as PendingSchedule, s as getNextOccurrences, t as Scheduler, u as matchesCron } from "./scheduling-C6tcOtUl.js";
34
+ 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-BRjZnshr.js";
35
+ import { a as LocalDriver, i as S3Driver, n as createStorageManager, r as MemoryDriver$2, t as StorageManager } from "./storage-6HLaUf9j.js";
36
+ 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-CB0oS_UE.js";
37
+ 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-DudNXGnh.js";
36
38
  import { Hono } from "hono";
37
39
  import { deleteCookie, getCookie } from "hono/cookie";
38
40
  import { createCipheriv, createDecipheriv, randomBytes } from "node:crypto";
@@ -110,13 +112,17 @@ function mountRoute(app, method, path, ...handlers) {
110
112
  ensureErrorStackTracePolyfill();
111
113
  let documentOptions;
112
114
  /**
113
- * Register app-wide document defaults for server-rendered Inertia responses;
114
- * call it at module scope in the app entry so every runtime picks it up.
115
+ * Register app-wide document defaults for server-rendered Inertia responses.
115
116
  * Process-wide, not request-scoped: calling it mid-flight leaks the policy into
116
117
  * in-flight requests — use the {@link InertiaOptions} fields per response.
117
118
  * Values are emitted verbatim, so never pass user input. `undefined` clears.
119
+ *
120
+ * @deprecated since 2.23.0, removed in 3.0.0 (RFC 0023). Pass
121
+ * `createApp({ inertia: { document } })`, which binds it on the app rather than
122
+ * the process. The slot stays the engine's second read.
118
123
  */
119
124
  function setInertiaDocument(options) {
125
+ warnDeprecatedSetter("setInertiaDocument");
120
126
  documentOptions = options;
121
127
  }
122
128
  let defaultSsrRenderer;
@@ -125,8 +131,13 @@ let defaultSsrRenderer;
125
131
  * cannot resolve a runtime path (Workers has no filesystem for
126
132
  * `GUREN_INERTIA_SSR_ENTRY`'s dynamic import). Per-call `ssr.render` still
127
133
  * wins; `undefined` clears (test isolation).
134
+ *
135
+ * @deprecated since 2.23.0, removed in 3.0.0 (RFC 0023). Pass
136
+ * `createApp({ inertia: { ssrRenderer } })`, or bind `inertia.ssrRenderer` on
137
+ * the app when the renderer only exists after `createApp()` has run.
128
138
  */
129
139
  function setInertiaSsrRenderer(renderer) {
140
+ warnDeprecatedSetter("setInertiaSsrRenderer");
130
141
  defaultSsrRenderer = renderer;
131
142
  }
132
143
  const DEFAULT_TITLE = "Guren";
@@ -204,26 +215,25 @@ async function renderDocument$1(page, options) {
204
215
  ...options.importMap
205
216
  };
206
217
  const importMap = JSON.stringify({ imports: importMapEntries }, null, 2);
207
- const serializedPage = serializePage(page);
208
218
  const stylesheetLinks = renderStyles(styles);
209
219
  const criticalCss = resolveDocumentValue("criticalCss", options, page.component);
210
220
  const prepaintScript = resolveDocumentValue("prepaintScript", options, page.component);
211
221
  const headMarkup = resolveDocumentValue("head", options, page.component);
212
222
  const ssrResult = await tryRenderSsr(page, options);
213
223
  const headElements = (ssrResult?.head ?? []).map(normalizeHeadElement);
224
+ const hasCustomTitle = headElements.some((element) => /<title\b[^>]*>/iu.test(element));
225
+ const appMarkup = ssrResult === void 0 ? `${pagePayloadElement(page)}<div id="app"></div>` : ssrResult.pageEmbedded ? ssrResult.body : `${ssrResult.body}${pagePayloadElement(page)}`;
214
226
  const headSegments = [
215
227
  "<meta charset=\"utf-8\" />",
216
228
  "<meta name=\"viewport\" content=\"width=device-width, initial-scale=1\" />",
217
- headElements.some((element) => /<title\b[^>]*>/iu.test(element)) ? "" : `<title>${title}</title>`,
229
+ hasCustomTitle ? "" : `<title>${title}</title>`,
218
230
  headMarkup ?? "",
219
231
  criticalCss ? `<style id="guren-critical">${criticalCss}</style>` : "",
220
232
  prepaintScript ? `<script>${prepaintScript}<\/script>` : "",
221
233
  stylesheetLinks,
222
234
  ...headElements,
223
- Object.keys(importMapEntries).length > 0 ? `<script type="importmap">${importMap}<\/script>` : "",
224
- `<script>window.__INERTIA_PAGE__ = ${serializedPage};<\/script>`
235
+ Object.keys(importMapEntries).length > 0 ? `<script type="importmap">${importMap}<\/script>` : ""
225
236
  ].filter((segment) => segment && segment.length > 0);
226
- const appMarkup = ssrResult?.body ?? `<script data-page="app" type="application/json">${serializedPage}<\/script><div id="app"></div>`;
227
237
  const bodyClass = resolveDocumentValue("bodyClass", options, page.component);
228
238
  const bodyAttributes = bodyClass ? ` class="${escapeAttribute(bodyClass)}"` : "";
229
239
  return `<!DOCTYPE html>
@@ -232,16 +242,26 @@ async function renderDocument$1(page, options) {
232
242
  ${headSegments.join("\n ")}
233
243
  </head>
234
244
  <body${bodyAttributes}>
235
- ${appMarkup}
245
+ ${appMarkup}${PAGE_GLOBAL_FROM_ELEMENT}
236
246
  <script type="module" src="${entry}"><\/script>
237
247
  </body>
238
248
  </html>`;
239
249
  }
250
+ function pagePayloadElement(page) {
251
+ return `<script data-page="app" type="application/json">${serializePage(page)}<\/script>`;
252
+ }
253
+ /**
254
+ * `window.__INERTIA_PAGE__` for readers other than the client. Same selector
255
+ * and guards as the client's `getInitialPage` (@guren/inertia-client), so a
256
+ * container carrying a non-payload `data-page` is ignored rather than mounted.
257
+ * A classic inline script, so it has run before the module entry does.
258
+ */
259
+ const PAGE_GLOBAL_FROM_ELEMENT = "<script>try{var e=document.querySelector('script[data-page=\"app\"][type=\"application/json\"]')||document.getElementById(\"app\"),p=JSON.parse(e.tagName===\"SCRIPT\"?e.textContent:e.getAttribute(\"data-page\"));if(p&&p.component)window.__INERTIA_PAGE__=p}catch(_){}<\/script>";
240
260
  async function tryRenderSsr(page, options) {
241
261
  const ssrOptions = options.ssr;
242
262
  if (ssrOptions?.enabled === false) return;
243
263
  const manifest = (ssrOptions?.manifest ?? process.env.GUREN_INERTIA_SSR_MANIFEST)?.trim() || void 0;
244
- const renderer = ssrOptions?.render ?? defaultSsrRenderer ?? await loadSsrRenderer(ssrOptions?.entry ?? process.env.GUREN_INERTIA_SSR_ENTRY);
264
+ const renderer = ssrOptions?.render ?? resolveOptional(options.container, "inertia.ssrRenderer") ?? defaultSsrRenderer ?? await loadSsrRenderer(ssrOptions?.entry ?? process.env.GUREN_INERTIA_SSR_ENTRY);
245
265
  if (!renderer) return;
246
266
  try {
247
267
  const result = await renderer({
@@ -252,7 +272,8 @@ async function tryRenderSsr(page, options) {
252
272
  if (!result || typeof result.body !== "string") return;
253
273
  return {
254
274
  body: result.body,
255
- head: Array.isArray(result.head) ? result.head : []
275
+ head: Array.isArray(result.head) ? result.head : [],
276
+ pageEmbedded: result.pageEmbedded === true
256
277
  };
257
278
  } catch (error) {
258
279
  console.error("Inertia SSR renderer failed; falling back to client rendering.", error);
@@ -312,7 +333,7 @@ function normalizeHeadElement(element) {
312
333
  function resolveDocumentValue(key, options, componentName) {
313
334
  const override = options[key];
314
335
  if (override !== void 0) return override;
315
- const value = documentOptions?.[key];
336
+ const value = (resolveOptional(options.container, "inertia.document") ?? documentOptions)?.[key];
316
337
  return (typeof value === "function" ? value({ component: componentName }) : value) ?? "";
317
338
  }
318
339
  function serializePage(page) {
@@ -432,16 +453,25 @@ function ensureSharedInertiaPropsRegistry(container) {
432
453
  /**
433
454
  * Replace the module-global shared props resolver. Props registered on an
434
455
  * application's container (see {@link shareInertiaProps}) are unaffected.
456
+ * @deprecated since 2.23.0, removed in 3.0.0 (RFC 0023). Use
457
+ * `shareInertiaProps(fn, container)`, which scopes the registration to one app.
458
+ * It composes rather than replaces, so a wholesale reset becomes one
459
+ * registration on a fresh container.
435
460
  */
436
461
  function setInertiaSharedProps(resolverFn) {
462
+ warnDeprecatedSetter("setInertiaSharedProps");
437
463
  globalRegistry.set(resolverFn);
438
464
  }
439
465
  /**
440
466
  * The module-global registrations composed into one resolver, for manual
441
467
  * composition. Container-scoped props are not included — get those from
442
468
  * `ensureSharedInertiaPropsRegistry(container).get()`.
469
+ * @deprecated since 2.23.0, removed in 3.0.0 (RFC 0023). Use
470
+ * `ensureSharedInertiaPropsRegistry(container).get()` on the container that owns
471
+ * the call.
443
472
  */
444
473
  function getInertiaSharedPropsResolver() {
474
+ warnDeprecatedGetter("getInertiaSharedPropsResolver");
445
475
  return globalRegistry.get();
446
476
  }
447
477
  /**
@@ -584,7 +614,10 @@ async function answer(result, c, fixture, shared, deps) {
584
614
  case "page": return inertia(result.component, {
585
615
  ...shared,
586
616
  ...result.props
587
- }, { request: c.req.raw });
617
+ }, {
618
+ request: c.req.raw,
619
+ container: deps.container
620
+ });
588
621
  case "redirect": return c.redirect(deps.routeUrl(result.to, result.params), 303);
589
622
  case "location":
590
623
  if (c.req.header("X-Inertia")) return new Response(null, {
@@ -600,7 +633,8 @@ async function answer(result, c, fixture, shared, deps) {
600
633
  message: "Not Found"
601
634
  }, {
602
635
  request: c.req.raw,
603
- status: 404
636
+ status: 404,
637
+ container: deps.container
604
638
  });
605
639
  throw HttpException.notFound();
606
640
  }
@@ -684,7 +718,12 @@ const RESOURCE_ACTIONS = [
684
718
  httpMethod: "delete"
685
719
  }
686
720
  ];
687
- /** Instance-based router for app-local route registration and mounting. */
721
+ /**
722
+ * Instance-based router for app-local route registration and mounting.
723
+ *
724
+ * `in M` is an explicit pin, not the source of the contravariance: the
725
+ * `RouteBuilder<M>` return positions already force it (measured).
726
+ */
688
727
  var Router = class {
689
728
  registry = [];
690
729
  prefixStack = [];
@@ -2382,7 +2421,7 @@ function detectLocaleMiddleware(options) {
2382
2421
  }
2383
2422
  }
2384
2423
  c.set(LOCALE_CONTEXT_KEY, resolved);
2385
- const i18n = options.i18n === false ? void 0 : options.i18n ?? tryGetI18n();
2424
+ const i18n = options.i18n === false ? void 0 : options.i18n ?? tryGetRequestContainer(c)?.makeOptional("i18n") ?? resolveI18n();
2386
2425
  if (i18n) {
2387
2426
  await i18n.loadLocale(resolved).catch(() => {});
2388
2427
  const current = () => bindingFor(getRequestLocale(c) ?? resolved, i18n);
@@ -2473,14 +2512,13 @@ function requireGuest(options = {}) {
2473
2512
  }
2474
2513
  //#endregion
2475
2514
  //#region src/providers/AuthServiceProvider.ts
2476
- const DEFAULT_GUARD = "web";
2477
- const DEFAULT_PROVIDER = "users";
2478
2515
  const DOUBLE_SESSION_CONFIG = "Sessions are configured twice: `auth.sessionOptions.store` in createApp() and a \"session\" container binding (SessionProvider). Keep one — the manager, or the explicit store.";
2479
2516
  /**
2480
- * Sets up authentication guards, session middleware, and auth context. The
2481
- * session store may come from a `session` container binding (RFC 0020 §1),
2482
- * which an app's SessionProvider must make in `register()`: the middleware is
2483
- * built in `boot()`, before any user provider's own boot runs.
2517
+ * Sets up session middleware, CSRF, and the auth context. The default guard is
2518
+ * the `Application` constructor's, registered before this provider. The session
2519
+ * store may come from a `session` container binding (RFC 0020 §1), which an
2520
+ * app's SessionProvider must make in `register()`: the middleware is built in
2521
+ * `boot()`, before any user provider's own boot runs.
2484
2522
  */
2485
2523
  var AuthServiceProvider = class extends ServiceProvider {
2486
2524
  app;
@@ -2490,10 +2528,6 @@ var AuthServiceProvider = class extends ServiceProvider {
2490
2528
  const app = this.container.make("app");
2491
2529
  this.app = app;
2492
2530
  const auth = this.container.make("auth");
2493
- if (!auth.guardNames().length) {
2494
- auth.registerGuard(DEFAULT_GUARD, createDefaultGuardFactory(DEFAULT_PROVIDER));
2495
- auth.setDefaultGuard(DEFAULT_GUARD);
2496
- }
2497
2531
  const authOptions = app.authOptions ?? {};
2498
2532
  if (authOptions.autoSession !== false && !app.hasAutoSessionAttached()) {
2499
2533
  app.use("*", (ctx, next) => (this.sessionMiddleware ??= this.buildSessionMiddleware())(ctx, next));
@@ -2529,15 +2563,6 @@ var AuthServiceProvider = class extends ServiceProvider {
2529
2563
  });
2530
2564
  }
2531
2565
  };
2532
- function createDefaultGuardFactory(providerName) {
2533
- return ({ session, manager }) => {
2534
- const provider = manager.getProvider(providerName);
2535
- return new SessionGuard({
2536
- provider,
2537
- session
2538
- });
2539
- };
2540
- }
2541
2566
  //#endregion
2542
2567
  //#region src/errors/error-page.ts
2543
2568
  function escapeHtml$1(value) {
@@ -2721,12 +2746,25 @@ function createExceptionHandler(options) {
2721
2746
  return new ExceptionHandler(options);
2722
2747
  }
2723
2748
  let globalExceptionHandler = null;
2749
+ /**
2750
+ * @deprecated since 2.23.0, removed in 3.0.0 (RFC 0023). Bind the handler on the
2751
+ * app's container instead — `ErrorServiceProvider` already does, and a provider
2752
+ * of your own reaches it as `this.container.instance('exception.handler', h)`.
2753
+ */
2724
2754
  function setExceptionHandler(handler) {
2725
- globalExceptionHandler = handler;
2755
+ warnDeprecatedSetter("setExceptionHandler");
2756
+ globalExceptionHandler = bindAmbient("exception.handler", handler) ? null : handler;
2726
2757
  }
2758
+ /**
2759
+ * @deprecated since 2.23.0, removed in 3.0.0 (RFC 0023). Use
2760
+ * `this.make('exception.handler')` in a controller, job or command, or
2761
+ * `defaultContainer().make('exception.handler')`.
2762
+ */
2727
2763
  function getExceptionHandler() {
2728
- if (!globalExceptionHandler) throw new Error("ExceptionHandler not initialized. Call setExceptionHandler() first.");
2729
- return globalExceptionHandler;
2764
+ warnDeprecatedGetter("getExceptionHandler");
2765
+ const handler = ambientBinding("exception.handler") ?? globalExceptionHandler;
2766
+ if (!handler) throw new Error("ExceptionHandler not initialized. Construct the app with createApp(), or call setExceptionHandler() first.");
2767
+ return handler;
2730
2768
  }
2731
2769
  function abort(statusCode, message, errors) {
2732
2770
  throw new HttpException(statusCode, message ?? "Error", errors);
@@ -2782,14 +2820,12 @@ var MethodNotAllowedException = class MethodNotAllowedException extends HttpExce
2782
2820
  //#endregion
2783
2821
  //#region src/providers/AuthorizationServiceProvider.ts
2784
2822
  /**
2785
- * Binds the Gate as a singleton and sets it as the global gate, so `getGate()`,
2786
- * `can()`, and the controller authorization helpers need no manual wiring.
2823
+ * Binds the Gate as a singleton. Controllers, the authorization middleware and
2824
+ * `getGate()` resolve it from there (RFC 0023 §4), so no global is written.
2787
2825
  */
2788
2826
  var AuthorizationServiceProvider = class extends ServiceProvider {
2789
2827
  register() {
2790
- const gate = createGate();
2791
- setGate(gate);
2792
- this.container.singleton("gate", () => gate);
2828
+ this.container.singleton("gate", () => createGate());
2793
2829
  }
2794
2830
  };
2795
2831
  //#endregion
@@ -3029,6 +3065,31 @@ var InertiaServiceProvider = class extends ServiceProvider {
3029
3065
  }
3030
3066
  };
3031
3067
  //#endregion
3068
+ //#region src/auth/providers/unconfigured-user-provider.ts
3069
+ /** The remediation both the thrown message and the boot warning end on. */
3070
+ const REGISTER_USER_PROVIDER_HINT = "Register one with `auth.useModel(User)` in a service provider (what `guren add auth` scaffolds), or `auth.registerProvider('users', ...)`.";
3071
+ const NO_USER_PROVIDER_MESSAGE = `AuthManager: a login was attempted, but no user provider is registered, so there is nothing to check the credentials against. ${REGISTER_USER_PROVIDER_HINT} An OAuth or passwordless app that only calls \`auth.login(user)\` needs no provider for that call, but does need one to load the user back on the next request.`;
3072
+ function noProvider() {
3073
+ throw new Error(NO_USER_PROVIDER_MESSAGE);
3074
+ }
3075
+ /**
3076
+ * The provider behind the default guard until an app registers `users`. An
3077
+ * anonymous request on an app with no auth is legitimately unauthenticated, so
3078
+ * `retrieveById` answers null; a credential check with nothing to check
3079
+ * against is a misconfiguration, so it throws rather than answering "wrong
3080
+ * password" forever. One object: the guard is built per request.
3081
+ */
3082
+ const unconfiguredUserProvider = {
3083
+ retrieveById: async () => null,
3084
+ retrieveByCredentials: async () => noProvider(),
3085
+ validateCredentials: async () => noProvider(),
3086
+ getId: (user) => identifierOf(user)
3087
+ };
3088
+ function identifierOf(user) {
3089
+ const record = user;
3090
+ return typeof record?.getAuthIdentifier === "function" ? record.getAuthIdentifier() : record?.id;
3091
+ }
3092
+ //#endregion
3032
3093
  //#region src/http/Application.ts
3033
3094
  const MANAGED_VITE_ENV_FLAG = "GUREN_MANAGED_VITE_DEV_SERVER";
3034
3095
  const DEFAULT_DEV_ENTRY_PATH = "/resources/js/dev-entry.ts";
@@ -3266,32 +3327,23 @@ var Application = class {
3266
3327
  this.hono = new Hono();
3267
3328
  this.container = new Container();
3268
3329
  this.router = new Router();
3269
- this.authManager = new AuthManager();
3330
+ this.authManager = new AuthManager({ hasher: options.auth?.hasher });
3270
3331
  this.providerManager = new ProviderManager(this.container);
3271
3332
  this.mountSecurityDefaults();
3272
3333
  this.container.instance("app", this);
3273
3334
  this.container.instance("hono", this.hono);
3274
3335
  this.container.instance("auth", this.authManager);
3275
3336
  this.container.instance("router", this.router);
3276
- if (!this.authManager.guardNames().length) {
3277
- this.authManager.registerGuard("web", ({ session, manager }) => {
3278
- let provider;
3279
- try {
3280
- provider = manager.getProvider("users");
3281
- } catch {
3282
- provider = {
3283
- retrieveById: async () => null,
3284
- retrieveByCredentials: async () => null,
3285
- validateCredentials: async () => false
3286
- };
3287
- }
3288
- return new SessionGuard({
3289
- provider,
3290
- session
3291
- });
3337
+ if (options.inertia?.document) this.container.instance("inertia.document", options.inertia.document);
3338
+ if (options.inertia?.ssrRenderer) this.container.instance("inertia.ssrRenderer", options.inertia.ssrRenderer);
3339
+ this.authManager.registerGuard("web", ({ session }) => {
3340
+ const provider = this.authManager.hasProvider("users") ? this.authManager.getProvider(DEFAULT_PROVIDER) : unconfiguredUserProvider;
3341
+ return new SessionGuard({
3342
+ provider,
3343
+ session
3292
3344
  });
3293
- this.authManager.setDefaultGuard("web");
3294
- }
3345
+ });
3346
+ this.authManager.setDefaultGuard("web");
3295
3347
  if (this.options.auth) this.providerManager.register(AuthServiceProvider);
3296
3348
  else this.hono.use("*", attachAuthContext((ctx) => this.authManager.createAuthContext(ctx)));
3297
3349
  this.providerManager.register(AuthorizationServiceProvider);
@@ -3302,7 +3354,7 @@ var Application = class {
3302
3354
  if (!hasUserProviderOf(ErrorServiceProvider)) this.providerManager.register(ErrorServiceProvider);
3303
3355
  if (userProviders.length > 0) this.providerManager.registerMany(userProviders);
3304
3356
  if (!hasUserProviderOf(InertiaServiceProvider)) this.providerManager.register(InertiaServiceProvider);
3305
- setContainer(this.container);
3357
+ adoptDefaultApplication(this);
3306
3358
  }
3307
3359
  get auth() {
3308
3360
  return this.authManager;
@@ -3407,9 +3459,29 @@ var Application = class {
3407
3459
  await this.mountDevEndpoint(isMcpEndpointEnabled(), async () => (await import("./McpServiceProvider-BvJRcDOm.js").then((n) => n.n)).McpServiceProvider, "GUREN_MCP=1 but the MCP endpoint could not load — is @modelcontextprotocol/sdk installed?");
3408
3460
  await this.mountDevEndpoint(isDocsViewerEnabled(), async () => (await import("./DocsViewerServiceProvider-DWnlXx_y.js")).DocsViewerServiceProvider, "GUREN_DOCS=1 but the docs viewer could not load — is @guren/cli resolvable from this app?");
3409
3461
  await this.providerManager.bootAll();
3462
+ this.warnOnUnconfiguredAuth();
3463
+ }
3464
+ /**
3465
+ * After every provider has booted: `auth` was asked for, yet the default
3466
+ * guard still runs against the placeholder provider, so a session login
3467
+ * attempt would throw. Silent for an app that authenticates through tokens,
3468
+ * or that mounts its own sessions, since neither reaches that guard.
3469
+ */
3470
+ warnOnUnconfiguredAuth() {
3471
+ if (!this.options.auth) return;
3472
+ if (this.options.auth.autoSession === false) return;
3473
+ if (this.authManager.getTokenGuard()) return;
3474
+ if (this.authManager.getDefaultGuard() !== "web") return;
3475
+ if (this.authManager.hasProvider("users")) return;
3476
+ console.warn(`[guren] createApp() received \`auth\`, but no "${DEFAULT_PROVIDER}" user provider was registered by the time the app booted. Sessions and CSRF are mounted, and any login attempt will throw. ${REGISTER_USER_PROVIDER_HINT}`);
3410
3477
  }
3411
3478
  /** Called once, from the constructor — see the note there for why. */
3412
3479
  mountSecurityDefaults() {
3480
+ const container = this.container;
3481
+ this.hono.use("*", (ctx, next) => {
3482
+ ctx.set(CONTAINER_CONTEXT_KEY, container);
3483
+ return next();
3484
+ });
3413
3485
  const { securityHeaders } = this.options;
3414
3486
  if (securityHeaders !== false) this.hono.use("*", createSecurityHeaders(securityHeaders ?? {}));
3415
3487
  this.mountHostAuthorization();
@@ -3437,7 +3509,7 @@ var Application = class {
3437
3509
  await provider.boot?.();
3438
3510
  }
3439
3511
  async fetch(request, env, executionCtx) {
3440
- return this.hono.fetch(request, env, executionCtx);
3512
+ return runInRequestScope(executionCtx, () => this.hono.fetch(request, env, executionCtx));
3441
3513
  }
3442
3514
  async listen(options = {}) {
3443
3515
  if (!Bun) throw new Error("Bun runtime is required to call Application.listen");
@@ -3743,11 +3815,15 @@ var Controller = class {
3743
3815
  * record: `await this.authorize('update', [Post, post])`.
3744
3816
  */
3745
3817
  async authorize(ability, ...args) {
3746
- await getGate().forUser(await this.gateUser()).authorize(ability, ...args);
3818
+ await this.#resolveGate().forUser(await this.gateUser()).authorize(ability, ...args);
3747
3819
  }
3748
3820
  /** Check an ability without throwing: `await this.can('update', [Post, post])`. */
3749
3821
  async can(ability, ...args) {
3750
- return getGate().forUser(await this.gateUser()).allows(ability, ...args);
3822
+ return this.#resolveGate().forUser(await this.gateUser()).allows(ability, ...args);
3823
+ }
3824
+ /** This app's `gate` (RFC 0023 §2); the ambient one only off a container, as on a bare Hono app. */
3825
+ #resolveGate() {
3826
+ return resolveOptional(this._container, "gate") ?? resolveGate();
3751
3827
  }
3752
3828
  async gateUser() {
3753
3829
  const auth = getAuthContext(this.ctx);
@@ -3773,7 +3849,8 @@ var Controller = class {
3773
3849
  const response = await inertia(component, propsWithShared, {
3774
3850
  ...options,
3775
3851
  lang: options.lang ?? this.#resolveLocale(),
3776
- request: ctx.req.raw
3852
+ request: ctx.req.raw,
3853
+ container: this._container
3777
3854
  });
3778
3855
  response.__gurenInertia = {
3779
3856
  component,
@@ -3817,8 +3894,7 @@ var Controller = class {
3817
3894
  return typeof locale === "string" && locale.length > 0 ? locale : void 0;
3818
3895
  }
3819
3896
  #resolveI18n() {
3820
- if (this._container?.has?.("i18n")) return this._container.make("i18n");
3821
- return tryGetI18n();
3897
+ return resolveOptional(this._container, "i18n") ?? resolveI18n();
3822
3898
  }
3823
3899
  json(data, init = {}) {
3824
3900
  return new Response(JSON.stringify(data), {
@@ -4186,21 +4262,29 @@ function deriveAuthorization(definition, method) {
4186
4262
  /**
4187
4263
  * The names a protocol adapter may add to an application's tool catalogue on
4188
4264
  * its own, and which an application route therefore may not claim (RFC 0016
4189
- * §5.4). One rule, two readers: `@guren/plugin-mcp` adds `guren.preflight` to
4265
+ * §5.4). One rule, two readers: `@guren/plugin-mcp` adds `guren_preflight` to
4190
4266
  * the catalogue it serves, `guren check` fails a route whose tool name
4191
4267
  * collides; the CLI cannot import the plugin, hence beside the derivation. A
4192
4268
  * `tools/list` carrying two tools with one name is rejected wholesale by an MCP
4193
- * client, so a collision costs the *entire* catalogue. The `guren.` prefix is
4269
+ * client, so a collision costs the *entire* catalogue. The `guren_` prefix is
4194
4270
  * not reserved wholesale: that would fail routes over collisions that do not exist.
4195
4271
  */
4196
4272
  /**
4273
+ * The grammar every known client accepts: a strict subset of MCP's own
4274
+ * (`AGENT_TOOL_NAME_PATTERN`, which admits `.` and 128 characters). The Claude and
4275
+ * OpenAI tool APIs enforce it; Claude Managed Agents silently skips an MCP tool
4276
+ * outside it (#787). Meta-tools have no `toolName` escape hatch, so the names
4277
+ * below must match; `guren check` warns on a route name that does not.
4278
+ */
4279
+ const PORTABLE_AGENT_TOOL_NAME_PATTERN = /^[A-Za-z0-9_-]{1,64}$/;
4280
+ /**
4197
4281
  * The preflight companion tool (RFC 0016 §5.4). Preflight cannot be an
4198
4282
  * *argument* of the tool being checked: a tool advertising an `outputSchema`
4199
4283
  * must answer with conforming `structuredContent` unless the result is an
4200
4284
  * error, and a verdict conforms to no route's output. One meta-tool for the
4201
4285
  * whole catalogue, not one companion per tool (§5.5).
4202
4286
  */
4203
- const PREFLIGHT_TOOL_NAME = "guren.preflight";
4287
+ const PREFLIGHT_TOOL_NAME = "guren_preflight";
4204
4288
  /**
4205
4289
  * The approval-status companion tool (RFC 0016 §5.4 item 4). A caller handed a
4206
4290
  * request id needs something that can say what became of it, and the gated tool
@@ -4208,12 +4292,12 @@ const PREFLIGHT_TOOL_NAME = "guren.preflight";
4208
4292
  * mode of the first, so neither output schema is the union of two unrelated
4209
4293
  * shapes.
4210
4294
  */
4211
- const APPROVAL_STATUS_TOOL_NAME = "guren.approval_status";
4295
+ const APPROVAL_STATUS_TOOL_NAME = "guren_approval_status";
4212
4296
  /** Every meta-tool name an adapter may occupy. */
4213
4297
  const RESERVED_AGENT_TOOL_NAMES = [PREFLIGHT_TOOL_NAME, APPROVAL_STATUS_TOOL_NAME];
4214
4298
  /**
4215
4299
  * Whether a tool name belongs to the framework rather than the application.
4216
- * Case-sensitive: MCP tool names are matched literally, so `Guren.Preflight` is
4300
+ * Case-sensitive: MCP tool names are matched literally, so `Guren_Preflight` is
4217
4301
  * a different tool and reserving it would take a name away for nothing.
4218
4302
  */
4219
4303
  function isReservedAgentToolName(name) {
@@ -4661,18 +4745,24 @@ const AGENT_AUDIT_BINDING = "agent.audit";
4661
4745
  * emitted for genuine listeners (RFC 0016 §5.2). Neither half may fail the call
4662
4746
  * it records: both are caught, the sink's failure warned rather than swallowed.
4663
4747
  */
4664
- function createAuditEmitter(sink, events, now = () => /* @__PURE__ */ new Date()) {
4748
+ function createAuditEmitter(sink, events, now = () => /* @__PURE__ */ new Date(), options = {}) {
4665
4749
  return (event) => {
4666
- if (sink) try {
4667
- Promise.resolve(sink(toAuditRecord(event, now()))).catch(warnSinkFailure);
4668
- } catch (error) {
4669
- warnSinkFailure(error);
4670
- }
4671
- events?.emit(event).catch((error) => {
4672
- console.warn(`[guren] audit event listener failed: ${String(error)}`);
4673
- });
4750
+ if (sink) keepAlive({
4751
+ run: () => sink(toAuditRecord(event, now())),
4752
+ onFailure: warnSinkFailure,
4753
+ label: LABEL
4754
+ }, options.defer);
4755
+ if (events) keepAlive({
4756
+ run: () => events.emit(event),
4757
+ onFailure: warnListenerFailure,
4758
+ label: LABEL
4759
+ }, options.defer);
4674
4760
  };
4675
4761
  }
4762
+ const LABEL = "agent audit work";
4763
+ function warnListenerFailure(error) {
4764
+ console.warn(`[guren] audit event listener failed: ${String(error)}`);
4765
+ }
4676
4766
  function warnSinkFailure(error) {
4677
4767
  console.warn(`[guren] agent audit sink failed, record dropped: ${String(error)}`);
4678
4768
  }
@@ -4797,7 +4887,7 @@ function agentApprovalUsableAt(request, now) {
4797
4887
  }
4798
4888
  /**
4799
4889
  * Whether `principal` may be told anything at all about `request` — the scope
4800
- * rule of `guren.approval_status` (RFC 0016 §5.4): a caller reads only the
4890
+ * rule of `guren_approval_status` (RFC 0016 §5.4): a caller reads only the
4801
4891
  * status of a request it created, or an agent could walk ids and enumerate
4802
4892
  * other principals' pending actions. A `false` here must be answered *exactly*
4803
4893
  * as an unknown id is: any difference in message, shape or timing reintroduces it.
@@ -4891,19 +4981,19 @@ const DEFAULT_APPROVAL_CONFIGURE_HINT = "an approval queue on the invocation pip
4891
4981
  */
4892
4982
  const DEFAULT_SCOPE_SUBJECT = "The caller's scopes";
4893
4983
  /**
4894
- * Wrap the application's `notify` so a failure can neither fail the tool call nor
4895
- * lose the record: it is already persisted when this runs, so a dead channel costs
4896
- * an approver an email, not a request. The failure is warned about with the request
4897
- * id, which is what finds the record sitting there unannounced. Both shapes are
4898
- * caught — a synchronous throw and a rejected promise.
4984
+ * A failure may neither fail the tool call nor lose the record: it is persisted
4985
+ * before this runs, so a dead channel costs an approver an email. The warning
4986
+ * carries the request id, which is what finds the record sitting there
4987
+ * unannounced. Everything else about invoking a best-effort channel — which
4988
+ * failures are caught, and when `defer` runs — is {@link keepAlive}'s.
4899
4989
  */
4900
- function notifyApprovers(notify) {
4990
+ function notifyApprovers(notify, defer) {
4901
4991
  return (request) => {
4902
- try {
4903
- Promise.resolve(notify(request)).catch((error) => warnNotifyFailure(request, error));
4904
- } catch (error) {
4905
- warnNotifyFailure(request, error);
4906
- }
4992
+ keepAlive({
4993
+ run: () => notify(request),
4994
+ onFailure: (error) => warnNotifyFailure(request, error),
4995
+ label: `approval notification for request ${request.id}`
4996
+ }, defer);
4907
4997
  };
4908
4998
  }
4909
4999
  function warnNotifyFailure(request, error) {
@@ -5010,7 +5100,7 @@ function spentVerdict(tool, request) {
5010
5100
  return approvalRefusal("spent", `The tool "${tool.toolName}" requires approval, and the approval for this exact call was already used by another call. Nothing was executed. Ask again to request a new one.`, request);
5011
5101
  }
5012
5102
  /**
5013
- * The scope half alone — what `guren.preflight` checks before rehearsing a call
5103
+ * The scope half alone — what `guren_preflight` checks before rehearsing a call
5014
5104
  * (RFC 0016 §5.4). Checking requires the *same* scope as calling, or the
5015
5105
  * companion becomes a probe of tools the token cannot call. Approval is not
5016
5106
  * applied: a rehearsal executes nothing, and approval gates an ability rather
@@ -5034,13 +5124,13 @@ function scopedShape(tool) {
5034
5124
  //#endregion
5035
5125
  //#region src/agent/pipeline.ts
5036
5126
  /**
5037
- * Build {@link AgentInvocationOptions.approvals} for one caller.
5038
- *
5039
- * The TTL default, the redaction rules and the `notify` wrapping are invariants
5040
- * of an approval record rather than of a protocol. Per caller, because an
5041
- * approval binds to the principal that asked; `undefined` means no queue.
5127
+ * Build {@link AgentInvocationOptions.approvals} for one caller — an approval binds
5128
+ * to the principal that asked; `undefined` means no queue. The TTL default, the
5129
+ * redaction rules and the `notify` wrapping are invariants of an approval record
5130
+ * rather than of a protocol, which is why `defer` arrives here: a `notify` the
5131
+ * pipeline received already wrapped cannot be given a deferrer afterwards.
5042
5132
  */
5043
- function createAgentApprovalContext(config, principal) {
5133
+ function createAgentApprovalContext(config, principal, defer) {
5044
5134
  if (!config) return void 0;
5045
5135
  return {
5046
5136
  store: config.store,
@@ -5048,7 +5138,7 @@ function createAgentApprovalContext(config, principal) {
5048
5138
  now: () => /* @__PURE__ */ new Date(),
5049
5139
  ttlMs: config.ttlMs ?? 36e5,
5050
5140
  redact: (tool, args) => redactAgentArguments(args, tool.redact),
5051
- notify: notifyApprovers(config.notify)
5141
+ notify: notifyApprovers(config.notify, defer)
5052
5142
  };
5053
5143
  }
5054
5144
  /**
@@ -5192,7 +5282,7 @@ function elapsed(startedAt) {
5192
5282
  * clock, no protocol.
5193
5283
  *
5194
5284
  * Here rather than in an adapter because two surfaces answer this question —
5195
- * `guren.approval_status` over MCP and a durable agent's own status check
5285
+ * `guren_approval_status` over MCP and a durable agent's own status check
5196
5286
  * (RFC 0017 §5) — and a record one of them calls "approved" must not be one
5197
5287
  * the other hides.
5198
5288
  */
@@ -5243,6 +5333,9 @@ var EventServiceProvider = class extends ServiceProvider {
5243
5333
  register() {
5244
5334
  this.container.singleton("events", () => createEventManager());
5245
5335
  }
5336
+ boot() {
5337
+ this.container.make("events").setQueueDispatcher(createQueueEventDispatcher());
5338
+ }
5246
5339
  };
5247
5340
  //#endregion
5248
5341
  //#region src/providers/CacheServiceProvider.ts
@@ -5262,26 +5355,43 @@ var QueueServiceProvider = class extends ServiceProvider {
5262
5355
  };
5263
5356
  //#endregion
5264
5357
  //#region src/providers/MailServiceProvider.ts
5265
- /** Binds the MailManager as a singleton in the container. */
5358
+ /**
5359
+ * Binds the MailManager as a singleton in the container, on the `log`
5360
+ * transport: an app that never configured mail gets every message in the
5361
+ * server output rather than "Mail transport not found: smtp" on the first
5362
+ * send. The scaffolded `MailProvider` rebinds `mail` with the app's own
5363
+ * config, so this default only reaches apps that never ran `guren add mail`.
5364
+ */
5266
5365
  var MailServiceProvider = class extends ServiceProvider {
5267
5366
  register() {
5268
- this.container.singleton("mail", () => createMailManager());
5367
+ this.container.singleton("mail", (container) => createMailManager({
5368
+ default: "log",
5369
+ transports: { log: { driver: "log" } }
5370
+ }, container));
5269
5371
  }
5270
5372
  };
5271
5373
  //#endregion
5272
5374
  //#region src/providers/LogServiceProvider.ts
5273
- /** Binds the LogManager as a singleton in the container. */
5375
+ /**
5376
+ * Binds the LogManager as a singleton in the container. The default channel is
5377
+ * declared, not merely named: `LogManager` resolves channels from `channels`
5378
+ * alone, so a `default` with no matching entry throws on the first write.
5379
+ * `getLogManager()` resolves it from the default application (RFC 0023 §4).
5380
+ */
5274
5381
  var LogServiceProvider = class extends ServiceProvider {
5275
5382
  register() {
5276
5383
  this.container.singleton("log", () => createLogManager({
5277
5384
  default: "console",
5278
- channels: {}
5385
+ channels: { console: { driver: "console" } }
5279
5386
  }));
5280
5387
  }
5281
5388
  };
5282
5389
  //#endregion
5283
5390
  //#region src/providers/NotificationServiceProvider.ts
5284
- /** Binds the NotificationManager as a singleton in the container. */
5391
+ /**
5392
+ * Binds the NotificationManager as a singleton in the container;
5393
+ * `getNotificationManager()` resolves it from the default application (RFC 0023 §4).
5394
+ */
5285
5395
  var NotificationServiceProvider = class extends ServiceProvider {
5286
5396
  register() {
5287
5397
  this.container.singleton("notifications", () => createNotificationManager());
@@ -5292,7 +5402,10 @@ var NotificationServiceProvider = class extends ServiceProvider {
5292
5402
  };
5293
5403
  //#endregion
5294
5404
  //#region src/providers/BroadcastServiceProvider.ts
5295
- /** Binds the BroadcastManager as a singleton in the container. */
5405
+ /**
5406
+ * Binds the BroadcastManager as a singleton in the container;
5407
+ * `getBroadcastManager()` resolves it from the default application (RFC 0023 §4).
5408
+ */
5296
5409
  var BroadcastServiceProvider = class extends ServiceProvider {
5297
5410
  register() {
5298
5411
  this.container.singleton("broadcast", () => createBroadcastManager());
@@ -5300,7 +5413,13 @@ var BroadcastServiceProvider = class extends ServiceProvider {
5300
5413
  };
5301
5414
  //#endregion
5302
5415
  //#region src/providers/EncryptionServiceProvider.ts
5303
- /** Binds the Encrypter as a singleton in the container. */
5416
+ /**
5417
+ * Binds the Encrypter as a singleton. `encrypt()` / `decrypt()` /
5418
+ * `getEncrypter()` resolve it from the default application's container
5419
+ * (RFC 0023 §4), so no global is written. The keyring is read lazily, so a
5420
+ * provider registering later can still replace `app.keyring` before the
5421
+ * encrypter is built.
5422
+ */
5304
5423
  var EncryptionServiceProvider = class extends ServiceProvider {
5305
5424
  register() {
5306
5425
  if (!this.container.has("app.keyring")) this.container.instance("app.keyring", getAppKeyringFromEnv());
@@ -7907,4 +8026,4 @@ function renderEnvironmentSection() {
7907
8026
  //#region src/index.ts
7908
8027
  ensureErrorStackTracePolyfill();
7909
8028
  //#endregion
7910
- 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, 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, 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, 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, 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, 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, ScryptHasher, 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, 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, collect, completeEmailVerification, completePasswordReset, confirmed, createAgentApprovalContext, createAgentAuditRecorder, 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, createQueueManager, createRateLimitMiddleware, createRedirectSafetyMiddleware, createRedisClient, createScheduler, createSecurityHeaders, createSeederRunner, createSessionMiddleware, createSqsAdapter, createStorageManager, createTypedBroadcaster, createValidator, csrfField, cursorPaginate, custom, customCheck, dailyFileDateStamp, dailyFilePath, dateFormat, date as dateRule, debugErrorMiddleware, decodeCursor, decrypt, defineFactory, defineGate, defineMiddleware, defineModule, definePlugin, definePolicy, 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, getRequestLocale, getRequestTranslator, getSessionFromContext, getUserApiTokens, getValidatedData, hash, hashPassword, hmac, image as imageRule, inValues, inertia, integer, ip, ipv4, ipv6, isDue, isDueInTimezone, isEmailVerified, 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, redactAgentArguments, regex, registerJob, registerNotification, renderDebugPage, renderDocument, renderErrorPage, requestIdMiddleware, requestLoggingMiddleware, requireAuthenticated, requireGuest, requireVerifiedEmail, required, requiredIf, requiredUnless, requiredWith, requiredWithout, resetCalledSeeders, resetRateLimit, resolve, resolveJobName, resolveNotifiableType, 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, unique, url as urlRule, urlSafeToken, uuid, uuid$1 as uuidRule, validate, validateRequest, validateRequestWith, validateSafe, verifyApiToken, verifyCsrfToken, verifyEmailToken, verifyHmac, verifyOAuthState, verifyPassword, verifyPasswordResetToken, verifySignedUrl, viteAsset, withAuthorization };
8029
+ 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, 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, 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, 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, csrfField, cursorPaginate, custom, customCheck, dailyFileDateStamp, dailyFilePath, dateFormat, date as dateRule, debugErrorMiddleware, decodeCursor, decrypt, defaultApplication, defaultContainer, defineFactory, defineGate, defineMiddleware, defineModule, definePlugin, definePolicy, 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, isDue, isDueInTimezone, isEmailVerified, 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, redactAgentArguments, regex, registerJob, registerNotification, renderDebugPage, renderDocument, renderErrorPage, requestIdMiddleware, requestLoggingMiddleware, requireAuthenticated, requireGuest, requireVerifiedEmail, required, requiredIf, requiredUnless, requiredWith, requiredWithout, resetCalledSeeders, resetDefaultApplication, resetRateLimit, resolve, 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 };