@guren/server 2.26.0 → 2.28.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.
- package/dist/{DocsViewerServiceProvider-CIRNHQ2I.js → DocsViewerServiceProvider-BMbcTYVw.js} +1 -1
- package/dist/{Gate-BL_zW82W.js → Gate-CYfoGQqh.js} +13 -2
- package/dist/{McpServiceProvider-B-LioPSz.js → McpServiceProvider-PGFPlYTy.js} +1 -1
- package/dist/{Resource-gki0_2B6.js → Resource-BhOua2OB.js} +26 -20
- package/dist/{ServiceProvider-DDW3MqQJ.js → ServiceProvider-G0YclITd.js} +60 -8
- package/dist/agent/dispatch.d.ts +4 -4
- package/dist/agent/public.js +1 -1
- package/dist/agent-request-Caj6bnbj.js +18 -0
- package/dist/auth/AuthManager.d.ts +4 -0
- package/dist/auth/email-verification.d.ts +2 -1
- package/dist/auth/index.js +1 -1
- package/dist/auth/password/describe-hasher.d.ts +11 -0
- package/dist/{auth-DiyWALZT.js → auth-DIugW0O-.js} +70 -4
- package/dist/authorization/Gate.d.ts +3 -2
- package/dist/authorization/index.js +2 -2
- package/dist/authorization/middleware.d.ts +8 -0
- package/dist/{authorization-E6X6Y-B6.js → authorization-CKOLYWvi.js} +17 -2
- package/dist/broadcasting/BroadcastManager.d.ts +23 -6
- package/dist/broadcasting/index.d.ts +1 -1
- package/dist/broadcasting/index.js +1 -1
- package/dist/broadcasting/types.d.ts +13 -1
- package/dist/{broadcasting-D0vMkKcq.js → broadcasting-N4cRV42s.js} +204 -33
- package/dist/cache/CacheManager.d.ts +5 -0
- package/dist/cache/TaggedCache.d.ts +2 -0
- package/dist/cache/index.js +1 -1
- package/dist/cache/pending-computations.d.ts +22 -0
- package/dist/cache/stores/FileStore.d.ts +1 -1
- package/dist/cache/stores/file-lock.d.ts +1 -0
- package/dist/{cache-DcnRufMe.js → cache-BlXopnH1.js} +179 -39
- package/dist/container/ServiceProvider.d.ts +27 -2
- package/dist/container/defineModule.d.ts +4 -5
- package/dist/container/definePlugin.d.ts +2 -0
- package/dist/dev-banner-bekDeLgL.js +51 -0
- package/dist/{dispatch-BAwzftws.js → dispatch-ENWpBxbE.js} +26 -4
- package/dist/driver-map-CkQc52j-.js +12 -0
- package/dist/host-port-t6wQFaRu.js +15 -0
- package/dist/hot-reload/testing.d.ts +2 -1
- package/dist/http/Application.d.ts +19 -1
- package/dist/http/dev-banner.d.ts +0 -8
- package/dist/http/host-port.d.ts +8 -0
- package/dist/http/middleware/force-https.d.ts +2 -1
- package/dist/http/middleware/index.d.ts +1 -0
- package/dist/http/middleware/session-manager.d.ts +5 -0
- package/dist/http/middleware/websocket-origin.d.ts +22 -0
- package/dist/http/public-assets.d.ts +6 -1
- package/dist/index.d.ts +5 -3
- package/dist/index.js +695 -235
- package/dist/internal/agent-request.d.ts +18 -0
- package/dist/internal/dispatched-request.d.ts +4 -0
- package/dist/internal/testing.js +2 -2
- package/dist/internal/zod-json-schema.js +1 -1
- package/dist/introspection/driver-map.d.ts +3 -0
- package/dist/introspection/flag.d.ts +12 -0
- package/dist/introspection/manifest.d.ts +17 -0
- package/dist/introspection/plain-json.d.ts +7 -0
- package/dist/introspection/types.d.ts +167 -0
- package/dist/mcp/index.js +1 -1
- package/dist/mvc/Controller.d.ts +3 -2
- package/dist/mvc/Router.d.ts +33 -0
- package/dist/providers/ConfigServiceProvider.d.ts +7 -0
- package/dist/queue/QueueManager.d.ts +3 -0
- package/dist/queue/index.js +1 -1
- package/dist/{queue-Bo4Q857L.js → queue-C8s3buYz.js} +5 -0
- package/dist/runtime/index.js +15 -2
- package/dist/storage/StorageManager.d.ts +5 -0
- package/dist/storage/index.js +1 -1
- package/dist/{storage-wFsUJHZW.js → storage-IlUesK2t.js} +13 -1
- package/dist/{vite-manifest-DlU94f3Z.js → vite-manifest-wPxfAzjW.js} +1 -57
- package/package.json +2 -2
package/dist/index.js
CHANGED
|
@@ -1,49 +1,52 @@
|
|
|
1
|
-
import { C as setInertiaSsrRenderer, D as isDeferredProp, E as isAlwaysProp, O as ensureErrorStackTracePolyfill, S as setInertiaDocument, T as defer, a as renderDocument, b as inertia, c as getRequestLocale, d as mountModuleRoutes, f as definePlugin, g as shareInertiaProps, h as setInertiaSharedProps, i as Controller, 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 always } from "./Resource-
|
|
1
|
+
import { C as setInertiaSsrRenderer, D as isDeferredProp, E as isAlwaysProp, O as ensureErrorStackTracePolyfill, S as setInertiaDocument, T as defer, a as renderDocument, b as inertia, c as getRequestLocale, d as mountModuleRoutes, f as definePlugin, g as shareInertiaProps, h as setInertiaSharedProps, i as Controller, 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 always } from "./Resource-BhOua2OB.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
4
|
import { t as HttpException } from "./HttpException-BlQ2yEmT.js";
|
|
5
5
|
import { n as ValidationException } from "./errors-JpkcCjjn.js";
|
|
6
|
-
import { a as withAuthorization, c as capabilitiesOf, i as
|
|
7
|
-
import { a as mapToolResponse, i as describeBuildFailure, n as advertisesStructuredOutput,
|
|
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-CKOLYWvi.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
8
|
import { i as trimSlashes } from "./contained-path-BkNSBljW.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-Bd25ZJAV.js";
|
|
11
11
|
import { n as detectServerlessRuntime, t as SERVERLESS_RUNTIME_LABELS } from "./serverless-D96rJb6x.js";
|
|
12
|
-
import { A as verifyOAuthState, B as
|
|
12
|
+
import { A as verifyOAuthState, B as ModelUserProvider, C as createGoogleOAuthProviderConfig, D as fetchOAuthUserProfile, E as exchangeOAuthCode, F as normalizeRedirectTarget, G as installAgentPrincipal, H as NodeHasher, I as AuthManager, J as createSessionMiddleware, K as readAgentPrincipal, 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, X as getSessionFromContext, Y as defaultCookieSecure, _ 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 MemorySessionStore, 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-DIugW0O-.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, 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-DWwscxfW.js";
|
|
16
|
-
import { n as ServiceProvider, t as ProviderManager } from "./ServiceProvider-
|
|
16
|
+
import { n as ServiceProvider, t as ProviderManager } from "./ServiceProvider-G0YclITd.js";
|
|
17
17
|
import { o as AuthenticationException, r as getAuthContext, t as AUTH_CONTEXT_KEY } from "./context-af2n5abO.js";
|
|
18
18
|
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";
|
|
19
19
|
import { _ as verifyApiToken, a as getApiToken, c as hasBearerHeader, d as revokeAllApiTokens, f as revokeApiToken, g as tokenCanAny, h as tokenCanAll, i as createBearerTokenMiddleware, l as parseApiToken, m as tokenCan, n as MemoryApiTokenStore, o as getApiTokenOrFail, r as createApiToken, s as getUserApiTokens, t as API_TOKEN_KEY, u as readBearerToken } from "./api-token-BbgDEd6j.js";
|
|
20
20
|
import { a as runInRequestScope, i as keepAlive, n as filterSensitiveData, t as Logger } from "./Logger-DWXdtLSJ.js";
|
|
21
|
-
import { a as RedisStore, i as FileStore, n as createCacheManager, o as MemoryStore, r as TaggedCache, s as resolveLazyRedisClient, t as CacheManager } from "./cache-
|
|
21
|
+
import { a as RedisStore, i as FileStore, n as createCacheManager, o as MemoryStore, r as TaggedCache, s as resolveLazyRedisClient, t as CacheManager } from "./cache-BlXopnH1.js";
|
|
22
22
|
import { n as createRedisClient, r as RedisSessionStore } from "./client-C5Wj9P9o.js";
|
|
23
23
|
import { r as isMcpEndpointEnabled } from "./endpoint-Coq0K_6I.js";
|
|
24
24
|
import { n as isHotReloadRuntime, r as matchingOpenParen, t as claimHotDisposable } from "./hot-disposables-W2fH-GID.js";
|
|
25
|
+
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-N4cRV42s.js";
|
|
25
26
|
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-DmMKcbqj.js";
|
|
26
|
-
import { a as cannot, f as setGate, g as tryGetRequestContainer, h as getRequestContainer, i as can, l as getGate, m as CONTAINER_CONTEXT_KEY, n as Response$1, o as createGate, p as AuthorizationException, r as authorize, s as defineGate, t as Gate } from "./Gate-
|
|
27
|
+
import { a as cannot, f as setGate, g as tryGetRequestContainer, h as getRequestContainer, i as can, l as getGate, m as CONTAINER_CONTEXT_KEY, n as Response$1, o as createGate, p as AuthorizationException, r as authorize, s as defineGate, t as Gate } from "./Gate-CYfoGQqh.js";
|
|
28
|
+
import { n as isAgentToolRequest } from "./agent-request-Caj6bnbj.js";
|
|
27
29
|
import { r as isDocsViewerEnabled } from "./endpoint-CTIzcagh.js";
|
|
28
|
-
import {
|
|
30
|
+
import { n as isWildcardHost, t as formatHostPort } from "./host-port-t6wQFaRu.js";
|
|
31
|
+
import { c as isViteProduction, d as startViteDevServer, 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-wPxfAzjW.js";
|
|
29
32
|
import { readObjectSchema, toJsonSchema } from "./internal/zod-json-schema.js";
|
|
30
33
|
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-DQavGm8W.js";
|
|
31
34
|
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-Bp2uamzD.js";
|
|
32
35
|
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-DsFMcXVk.js";
|
|
33
|
-
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-
|
|
36
|
+
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-C8s3buYz.js";
|
|
34
37
|
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-CI2Kfe8P.js";
|
|
35
38
|
import { a as LOG_LEVEL_PRIORITY, i as matchDailyFileDate, n as dailyFileDateStamp, r as dailyFilePath, t as DailyFileChannel } from "./DailyFileChannel-CTTPA0EF.js";
|
|
36
39
|
import { a as FileChannel, i as setLogManager, n as createLogManager, o as ConsoleChannel, r as getLogManager, t as LogManager } from "./logging-Ci0mBk5k.js";
|
|
37
|
-
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-D0vMkKcq.js";
|
|
38
40
|
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";
|
|
39
41
|
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-CWK5l22W.js";
|
|
40
|
-
import { a as LocalDriver, i as S3Driver, n as createStorageManager, r as MemoryDriver$2, t as StorageManager } from "./storage-
|
|
42
|
+
import { a as LocalDriver, i as S3Driver, n as createStorageManager, r as MemoryDriver$2, t as StorageManager } from "./storage-IlUesK2t.js";
|
|
41
43
|
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-Bg0Xj3aD.js";
|
|
42
44
|
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-DNV5tj44.js";
|
|
43
45
|
import { Hono } from "hono";
|
|
44
46
|
import { deleteCookie, getCookie } from "hono/cookie";
|
|
45
47
|
import { createCipheriv, createDecipheriv, randomBytes } from "node:crypto";
|
|
46
48
|
import { join, resolve as resolve$1 } from "node:path";
|
|
49
|
+
import { AsyncLocalStorage } from "node:async_hooks";
|
|
47
50
|
import { cors } from "hono/cors";
|
|
48
51
|
import { createMiddleware } from "hono/factory";
|
|
49
52
|
import { serialize } from "hono/utils/cookie";
|
|
@@ -416,12 +419,13 @@ var Router = class {
|
|
|
416
419
|
this.modelBindings.clear();
|
|
417
420
|
}
|
|
418
421
|
definitions() {
|
|
419
|
-
return this.registry.map(({ method, path, name, schemas, resource, openapi, routeMiddlewareNames, middlewares, scopedMiddlewares, handler, bindings, agent, prototype }) => ({
|
|
422
|
+
return this.registry.map(({ method, path, name, schemas, resource, openapi, routeMiddlewareNames, middlewares, scopedMiddlewares, handler, bindings, agent, prototype, module }) => ({
|
|
420
423
|
method,
|
|
421
424
|
path,
|
|
422
425
|
name,
|
|
423
426
|
schemas,
|
|
424
427
|
prototype,
|
|
428
|
+
...module === void 0 ? {} : { module },
|
|
425
429
|
resource: serializeResourceHint(resource),
|
|
426
430
|
agent: agent ? cloneAgentMetadata(agent) : void 0,
|
|
427
431
|
middlewareNames: [...routeMiddlewareNames],
|
|
@@ -436,6 +440,47 @@ var Router = class {
|
|
|
436
440
|
...openapi
|
|
437
441
|
}));
|
|
438
442
|
}
|
|
443
|
+
/** How many routes are registered, without building {@link definitions}. */
|
|
444
|
+
get routeCount() {
|
|
445
|
+
return this.registry.length;
|
|
446
|
+
}
|
|
447
|
+
/**
|
|
448
|
+
* Records `module` on every route registered from index `start` on. `mountModuleRoutes()` calls
|
|
449
|
+
* it once the registrar settled, so a route an async registrar adds after an `await` counts, and a
|
|
450
|
+
* module a registrar mounts itself is named after the outer one, which `manifest.modules` lists.
|
|
451
|
+
* @internal
|
|
452
|
+
*/
|
|
453
|
+
assignModule(start, module) {
|
|
454
|
+
for (let index = start; index < this.registry.length; index++) this.registry[index].module = module;
|
|
455
|
+
}
|
|
456
|
+
/**
|
|
457
|
+
* The handler behind each {@link definitions} entry, index-aligned with it
|
|
458
|
+
* (RFC 0026 §3): the controller class there is reduced to its name.
|
|
459
|
+
*/
|
|
460
|
+
registeredHandlers() {
|
|
461
|
+
return this.registry.map(({ handler }, index) => isControllerAction(handler) ? {
|
|
462
|
+
index,
|
|
463
|
+
controller: handler[0],
|
|
464
|
+
action: String(handler[1])
|
|
465
|
+
} : { index });
|
|
466
|
+
}
|
|
467
|
+
/**
|
|
468
|
+
* Every alias and group resolved, and each route's chain in `mount()` order,
|
|
469
|
+
* index-aligned with {@link definitions} (RFC 0026 §3). Like `definitions()`,
|
|
470
|
+
* an unregistered name is reported rather than thrown.
|
|
471
|
+
*/
|
|
472
|
+
describeMiddleware() {
|
|
473
|
+
const aliases = {};
|
|
474
|
+
for (const name of [...this.middlewareAliases.keys(), ...this.middlewareGroups.keys()].sort()) aliases[name] = this.describeNamedMiddleware(name);
|
|
475
|
+
return {
|
|
476
|
+
aliases,
|
|
477
|
+
routes: this.registry.map((route) => [...route.routeMiddlewareNames.map((name) => aliases[name] ?? this.describeNamedMiddleware(name)), ...[...route.scopedMiddlewares, ...route.middlewares].map((handler) => ({
|
|
478
|
+
kind: "inline",
|
|
479
|
+
name: handler.name || null,
|
|
480
|
+
capabilities: this.aggregateCapabilities([], [handler])
|
|
481
|
+
}))])
|
|
482
|
+
};
|
|
483
|
+
}
|
|
439
484
|
applyMiddlewareScope(items, callback) {
|
|
440
485
|
this.middlewareStack.push([...items]);
|
|
441
486
|
try {
|
|
@@ -516,6 +561,38 @@ var Router = class {
|
|
|
516
561
|
for (const handler of inline) absorbStamp(capabilitiesOf(handler));
|
|
517
562
|
return aggregated;
|
|
518
563
|
}
|
|
564
|
+
describeNamedMiddleware(name) {
|
|
565
|
+
const capabilities = this.aggregateCapabilities([name], []);
|
|
566
|
+
if (this.middlewareGroups.has(name)) {
|
|
567
|
+
const members = this.expandGroup(name, /* @__PURE__ */ new Set());
|
|
568
|
+
const unresolved = members.filter((member) => !this.middlewareAliases.has(member));
|
|
569
|
+
return {
|
|
570
|
+
kind: "group",
|
|
571
|
+
name,
|
|
572
|
+
members,
|
|
573
|
+
capabilities,
|
|
574
|
+
...unresolved.length > 0 ? { unresolvedMembers: unresolved } : {}
|
|
575
|
+
};
|
|
576
|
+
}
|
|
577
|
+
return this.middlewareAliases.has(name) ? {
|
|
578
|
+
kind: "alias",
|
|
579
|
+
name,
|
|
580
|
+
capabilities
|
|
581
|
+
} : {
|
|
582
|
+
kind: "alias",
|
|
583
|
+
name,
|
|
584
|
+
capabilities,
|
|
585
|
+
unresolved: true
|
|
586
|
+
};
|
|
587
|
+
}
|
|
588
|
+
/** A group's alias names through nested groups, each group expanded once whatever path reaches it. */
|
|
589
|
+
expandGroup(name, visited) {
|
|
590
|
+
visited.add(name);
|
|
591
|
+
return (this.middlewareGroups.get(name) ?? []).flatMap((member) => {
|
|
592
|
+
if (!this.middlewareGroups.has(member)) return [member];
|
|
593
|
+
return visited.has(member) ? [] : this.expandGroup(member, visited);
|
|
594
|
+
});
|
|
595
|
+
}
|
|
519
596
|
resolveMiddlewareNames(names, seen) {
|
|
520
597
|
const handlers = [];
|
|
521
598
|
const visited = seen ?? /* @__PURE__ */ new Set();
|
|
@@ -998,6 +1075,17 @@ const BUILT_IN_SESSION_DRIVERS = /* @__PURE__ */ new Map([
|
|
|
998
1075
|
["database", true],
|
|
999
1076
|
["redis", true]
|
|
1000
1077
|
]);
|
|
1078
|
+
/** Null for a driver outside {@link BUILT_IN_SESSION_DRIVERS}: a plugin's `gurenPlugin` manifest says which it is. */
|
|
1079
|
+
function sessionDriverIsPerProcess(driver) {
|
|
1080
|
+
const shared = BUILT_IN_SESSION_DRIVERS.get(driver);
|
|
1081
|
+
return shared === void 0 ? null : !shared;
|
|
1082
|
+
}
|
|
1083
|
+
/** drizzle's `getTableName()`, read through its registry symbol: server must not depend on the ORM. */
|
|
1084
|
+
function drizzleTableName(table) {
|
|
1085
|
+
if (!table || typeof table !== "object") return void 0;
|
|
1086
|
+
const name = table[Symbol.for("drizzle:Name")];
|
|
1087
|
+
return typeof name === "string" ? name : void 0;
|
|
1088
|
+
}
|
|
1001
1089
|
function isPrunable(store) {
|
|
1002
1090
|
return typeof store.deleteExpired === "function";
|
|
1003
1091
|
}
|
|
@@ -1054,6 +1142,23 @@ var SessionManager = class {
|
|
|
1054
1142
|
getStoreNames() {
|
|
1055
1143
|
return Array.from(this.configs.keys());
|
|
1056
1144
|
}
|
|
1145
|
+
/** The declared stores and the default, building none of them (RFC 0026 §1). */
|
|
1146
|
+
describe() {
|
|
1147
|
+
const stores = {};
|
|
1148
|
+
for (const [name, config] of this.configs) {
|
|
1149
|
+
const driver = config.driver;
|
|
1150
|
+
const table = driver === "database" ? drizzleTableName(config.table) : void 0;
|
|
1151
|
+
stores[name] = {
|
|
1152
|
+
driver,
|
|
1153
|
+
...table === void 0 ? {} : { table },
|
|
1154
|
+
perProcess: sessionDriverIsPerProcess(driver)
|
|
1155
|
+
};
|
|
1156
|
+
}
|
|
1157
|
+
return {
|
|
1158
|
+
default: this.defaultStoreName,
|
|
1159
|
+
stores
|
|
1160
|
+
};
|
|
1161
|
+
}
|
|
1057
1162
|
/**
|
|
1058
1163
|
* Sweep expired sessions from the default store and from any other store
|
|
1059
1164
|
* already built, on stores that support it (`deleteExpired`). Stores that
|
|
@@ -1793,7 +1898,8 @@ function isSafeRedirectUrl(url, requestUrl, allowedHosts = []) {
|
|
|
1793
1898
|
//#region src/http/middleware/force-https.ts
|
|
1794
1899
|
/**
|
|
1795
1900
|
* Redirects HTTP to HTTPS and sets Strict-Transport-Security. Equivalent to
|
|
1796
|
-
* Rails' `force_ssl`.
|
|
1901
|
+
* Rails' `force_ssl`. An agent tool call the dispatcher re-enters in process
|
|
1902
|
+
* passes through.
|
|
1797
1903
|
*/
|
|
1798
1904
|
function createForceHttpsMiddleware(options = {}) {
|
|
1799
1905
|
const { hstsMaxAge = 31536e3, hstsIncludeSubDomains = true, hstsPreload = false, exclude = [] } = options;
|
|
@@ -1804,12 +1910,7 @@ function createForceHttpsMiddleware(options = {}) {
|
|
|
1804
1910
|
const url = new URL(ctx.req.url);
|
|
1805
1911
|
if ((ctx.req.header("x-forwarded-proto") ?? url.protocol.replace(":", "")) !== "https") {
|
|
1806
1912
|
const path = url.pathname + url.search;
|
|
1807
|
-
|
|
1808
|
-
if (path.startsWith(pattern.slice(0, -1))) {
|
|
1809
|
-
await next();
|
|
1810
|
-
return;
|
|
1811
|
-
}
|
|
1812
|
-
} else if (path === pattern) {
|
|
1913
|
+
if (exclude.some((pattern) => pattern.endsWith("*") ? path.startsWith(pattern.slice(0, -1)) : path === pattern) || isDispatchedToolRequest(ctx.req.raw)) {
|
|
1813
1914
|
await next();
|
|
1814
1915
|
return;
|
|
1815
1916
|
}
|
|
@@ -1861,17 +1962,6 @@ function requestLoggingMiddleware() {
|
|
|
1861
1962
|
});
|
|
1862
1963
|
}
|
|
1863
1964
|
//#endregion
|
|
1864
|
-
//#region src/http/middleware/index.ts
|
|
1865
|
-
function defineMiddleware(handler) {
|
|
1866
|
-
return handler;
|
|
1867
|
-
}
|
|
1868
|
-
function jsonResponse(data, status = 200) {
|
|
1869
|
-
return new Response(JSON.stringify(data), {
|
|
1870
|
-
status,
|
|
1871
|
-
headers: { "Content-Type": "application/json; charset=utf-8" }
|
|
1872
|
-
});
|
|
1873
|
-
}
|
|
1874
|
-
//#endregion
|
|
1875
1965
|
//#region src/http/middleware/auth.ts
|
|
1876
1966
|
const TESTING_USER_HEADER = "x-testing-user";
|
|
1877
1967
|
function resolveTestingUser(ctx) {
|
|
@@ -1913,29 +2003,25 @@ function attachAuthContext(contextFactory) {
|
|
|
1913
2003
|
await next();
|
|
1914
2004
|
};
|
|
1915
2005
|
}
|
|
2006
|
+
function refuse$1(ctx, options, status, message) {
|
|
2007
|
+
if (options.redirectTo) return isAgentToolRequest(ctx) ? jsonResponse({ message }, status) : ctx.redirect(options.redirectTo);
|
|
2008
|
+
return options.responseFactory ? options.responseFactory() : jsonResponse({ message }, status);
|
|
2009
|
+
}
|
|
1916
2010
|
function requireAuthenticated(options = {}) {
|
|
1917
|
-
const {
|
|
2011
|
+
const { status = 401 } = options;
|
|
1918
2012
|
return stampCapabilities(async (ctx, next) => {
|
|
1919
2013
|
const auth = getAuthContext(ctx);
|
|
1920
2014
|
if (!auth) throw new Error("Auth context has not been attached. Did you register the auth middleware?");
|
|
1921
|
-
if (!await auth.check())
|
|
1922
|
-
if (redirectTo) return ctx.redirect(redirectTo);
|
|
1923
|
-
if (responseFactory) return responseFactory();
|
|
1924
|
-
return jsonResponse({ message: "Unauthorized" }, status);
|
|
1925
|
-
}
|
|
2015
|
+
if (!await auth.check()) return refuse$1(ctx, options, status, "Unauthorized");
|
|
1926
2016
|
await next();
|
|
1927
2017
|
}, { authentication: { mode: "required" } });
|
|
1928
2018
|
}
|
|
1929
2019
|
function requireGuest(options = {}) {
|
|
1930
|
-
const {
|
|
2020
|
+
const { status = 403 } = options;
|
|
1931
2021
|
return stampCapabilities(async (ctx, next) => {
|
|
1932
2022
|
const auth = getAuthContext(ctx);
|
|
1933
2023
|
if (!auth) throw new Error("Auth context has not been attached. Did you register the auth middleware?");
|
|
1934
|
-
if (!await auth.guest())
|
|
1935
|
-
if (redirectTo) return ctx.redirect(redirectTo);
|
|
1936
|
-
if (responseFactory) return responseFactory();
|
|
1937
|
-
return jsonResponse({ message: "Already authenticated" }, status);
|
|
1938
|
-
}
|
|
2024
|
+
if (!await auth.guest()) return refuse$1(ctx, options, status, "Already authenticated");
|
|
1939
2025
|
await next();
|
|
1940
2026
|
}, { authentication: { mode: "guest-only" } });
|
|
1941
2027
|
}
|
|
@@ -2580,9 +2666,18 @@ var ConfigServiceProvider = class extends ServiceProvider {
|
|
|
2580
2666
|
unset = /* @__PURE__ */ new Set();
|
|
2581
2667
|
resolved = [];
|
|
2582
2668
|
owned = /* @__PURE__ */ new Map();
|
|
2669
|
+
warnings = [];
|
|
2583
2670
|
register() {
|
|
2671
|
+
this.bindAll("throw");
|
|
2672
|
+
}
|
|
2673
|
+
/** Under introspection (RFC 0026) the environment has no secrets: problems are reported, not thrown. */
|
|
2674
|
+
introspect() {
|
|
2675
|
+
this.bindAll("report");
|
|
2676
|
+
}
|
|
2677
|
+
bindAll(mode) {
|
|
2584
2678
|
const app = this.container.make("app");
|
|
2585
|
-
this.
|
|
2679
|
+
this.warnings = [];
|
|
2680
|
+
this.env = this.parseEnv(app, mode);
|
|
2586
2681
|
this.resolved = [];
|
|
2587
2682
|
this.owned = /* @__PURE__ */ new Map();
|
|
2588
2683
|
const entries = app.configEntries;
|
|
@@ -2593,7 +2688,13 @@ var ConfigServiceProvider = class extends ServiceProvider {
|
|
|
2593
2688
|
const config = definition.resolve(env);
|
|
2594
2689
|
const placeholders = [...read].filter((key) => this.unset.has(key));
|
|
2595
2690
|
if (placeholders.length > 0) {
|
|
2596
|
-
|
|
2691
|
+
const message = `the "${definition.key}" config reads ${placeholders.join(", ")}, which the environment does not set; it was left unbound.`;
|
|
2692
|
+
warnOnce(`config-unverified:${definition.key}`, `[guren] ${message}`);
|
|
2693
|
+
this.warnings.push({
|
|
2694
|
+
code: "config-unverified",
|
|
2695
|
+
message,
|
|
2696
|
+
key: definition.key
|
|
2697
|
+
});
|
|
2597
2698
|
continue;
|
|
2598
2699
|
}
|
|
2599
2700
|
const before = new Map(this.container.getBindings().map((key) => [key, this.container.bindingOf(key)]));
|
|
@@ -2614,18 +2715,27 @@ var ConfigServiceProvider = class extends ServiceProvider {
|
|
|
2614
2715
|
async boot() {
|
|
2615
2716
|
for (const { definition, config } of this.resolved) await definition.boot?.(this.container, config, this.env);
|
|
2616
2717
|
}
|
|
2718
|
+
/** @internal Env problems reported under introspection, and configs left unbound, for the manifest (RFC 0027 §1). */
|
|
2719
|
+
manifestWarnings() {
|
|
2720
|
+
return this.warnings;
|
|
2721
|
+
}
|
|
2617
2722
|
/** @internal The bindings the definitions made, for ProviderManager's twice-configured check. */
|
|
2618
2723
|
ownedBindings() {
|
|
2619
2724
|
return this.owned;
|
|
2620
2725
|
}
|
|
2621
|
-
parseEnv(app) {
|
|
2726
|
+
parseEnv(app, mode) {
|
|
2622
2727
|
const schema = app.envSchema;
|
|
2623
2728
|
this.unset = /* @__PURE__ */ new Set();
|
|
2624
2729
|
if (!schema) return {};
|
|
2625
2730
|
const source = this.container.makeOptional("env.source");
|
|
2626
|
-
const
|
|
2627
|
-
const
|
|
2628
|
-
|
|
2731
|
+
const parsed = schema.parse(source, { mode });
|
|
2732
|
+
for (const problem of parsed.problems) {
|
|
2733
|
+
warnOnce(`env-invalid:${problem.key}`, `[guren] Invalid environment: ${problem.key} ${problem.message} (reported under introspection).`);
|
|
2734
|
+
this.warnings.push({
|
|
2735
|
+
code: "env-invalid",
|
|
2736
|
+
message: `${problem.key} ${problem.message}`
|
|
2737
|
+
});
|
|
2738
|
+
}
|
|
2629
2739
|
this.unset = parsed.unset;
|
|
2630
2740
|
this.container.instance("env", parsed.values);
|
|
2631
2741
|
return parsed.values;
|
|
@@ -2643,6 +2753,427 @@ function listedAt(entry) {
|
|
|
2643
2753
|
return entry.module === void 0 ? `createApp({ config })[${entry.index}]` : `the "${entry.module}" module's config[${entry.index}]`;
|
|
2644
2754
|
}
|
|
2645
2755
|
//#endregion
|
|
2756
|
+
//#region src/introspection/flag.ts
|
|
2757
|
+
/** Set by the CLI's introspection child before the app's module graph evaluates (RFC 0026 §2). */
|
|
2758
|
+
const INTROSPECT_ENV_FLAG = "GUREN_INTROSPECT";
|
|
2759
|
+
/** `code` on the error `listen()` throws under the flag; read by duck-typing, since the reader may load another server copy. */
|
|
2760
|
+
const INTROSPECT_LISTEN_REFUSED = "GUREN_INTROSPECT_LISTEN";
|
|
2761
|
+
/** Entered around an in-process `Application.introspect()`, so only that run's async work sees it. */
|
|
2762
|
+
const scope = new AsyncLocalStorage();
|
|
2763
|
+
/**
|
|
2764
|
+
* Whether this code runs for an introspection: the CLI child's `GUREN_INTROSPECT=1`,
|
|
2765
|
+
* or inside an `Application.introspect()` in this process. The one reader of both.
|
|
2766
|
+
*/
|
|
2767
|
+
function isIntrospecting() {
|
|
2768
|
+
return scope.getStore() === true || typeof process !== "undefined" && process.env?.[INTROSPECT_ENV_FLAG] === "1";
|
|
2769
|
+
}
|
|
2770
|
+
/** Runs `fn` with {@link isIntrospecting} true for it and everything it schedules, timers that outlive it included. */
|
|
2771
|
+
function runIntrospecting(fn) {
|
|
2772
|
+
return scope.run(true, fn);
|
|
2773
|
+
}
|
|
2774
|
+
/** `listen()` under the flag: an introspection run must never open a socket. */
|
|
2775
|
+
var IntrospectionListenError = class extends Error {
|
|
2776
|
+
code = INTROSPECT_LISTEN_REFUSED;
|
|
2777
|
+
constructor() {
|
|
2778
|
+
super(`Cannot listen under ${INTROSPECT_ENV_FLAG}=1: introspection registers providers and routes, and never serves. Unset the variable to serve the app.`);
|
|
2779
|
+
this.name = "IntrospectionListenError";
|
|
2780
|
+
}
|
|
2781
|
+
};
|
|
2782
|
+
//#endregion
|
|
2783
|
+
//#region src/agent/derive.ts
|
|
2784
|
+
/** HTTP methods whose semantics are read-only, per the MCP annotation defaults. */
|
|
2785
|
+
const READ_ONLY_METHODS = /* @__PURE__ */ new Set(["GET", "QUERY"]);
|
|
2786
|
+
/** HTTP methods that are idempotent whether or not they are read-only. */
|
|
2787
|
+
const IDEMPOTENT_METHODS = /* @__PURE__ */ new Set([
|
|
2788
|
+
"GET",
|
|
2789
|
+
"QUERY",
|
|
2790
|
+
"PUT",
|
|
2791
|
+
"DELETE"
|
|
2792
|
+
]);
|
|
2793
|
+
/**
|
|
2794
|
+
* Derive the agent tools a set of route definitions exposes.
|
|
2795
|
+
*
|
|
2796
|
+
* @param definitions Registered routes, as `Router.definitions()` hands them out.
|
|
2797
|
+
*/
|
|
2798
|
+
function deriveAgentTools(definitions) {
|
|
2799
|
+
const tools = [];
|
|
2800
|
+
const warnings = [];
|
|
2801
|
+
const claimed = /* @__PURE__ */ new Map();
|
|
2802
|
+
for (const definition of definitions) {
|
|
2803
|
+
const agent = definition.agent;
|
|
2804
|
+
if (!agent) continue;
|
|
2805
|
+
const method = definition.method.toUpperCase();
|
|
2806
|
+
const where = `${method} ${definition.path}`;
|
|
2807
|
+
if (definition.prototype) {
|
|
2808
|
+
warnings.push(`${where}: declares agent metadata while still on its prototype fixture, so it is not exposed as a tool.`);
|
|
2809
|
+
continue;
|
|
2810
|
+
}
|
|
2811
|
+
if (!definition.name) {
|
|
2812
|
+
warnings.push(`${where}: declares agent metadata but has no route name, so it is not exposed as a tool. Chain .name() on the route — the tool name is its identity.`);
|
|
2813
|
+
continue;
|
|
2814
|
+
}
|
|
2815
|
+
const routeName = definition.name;
|
|
2816
|
+
const toolName = agent.toolName ?? routeName;
|
|
2817
|
+
const existing = claimed.get(toolName);
|
|
2818
|
+
if (existing) {
|
|
2819
|
+
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.`);
|
|
2820
|
+
continue;
|
|
2821
|
+
}
|
|
2822
|
+
const toolWarnings = [];
|
|
2823
|
+
const readOnlyHint = agent.readOnlyHint ?? READ_ONLY_METHODS.has(method);
|
|
2824
|
+
const input = buildInputSchema(definition, method, toolWarnings);
|
|
2825
|
+
const tool = {
|
|
2826
|
+
toolName,
|
|
2827
|
+
routeName,
|
|
2828
|
+
method,
|
|
2829
|
+
path: definition.path,
|
|
2830
|
+
description: agent.description ?? definition.description ?? definition.summary,
|
|
2831
|
+
inputSchema: input.schema,
|
|
2832
|
+
inputSources: input.sources,
|
|
2833
|
+
inputBodyNested: input.nestedBody,
|
|
2834
|
+
outputSchema: buildOutputSchema(definition, method, toolWarnings),
|
|
2835
|
+
resource: definition.schemas?.output ? void 0 : definition.resource,
|
|
2836
|
+
annotations: {
|
|
2837
|
+
readOnlyHint,
|
|
2838
|
+
destructiveHint: agent.destructiveHint ?? !readOnlyHint,
|
|
2839
|
+
idempotentHint: agent.idempotentHint ?? IDEMPOTENT_METHODS.has(method)
|
|
2840
|
+
},
|
|
2841
|
+
authorization: deriveAuthorization(definition, method),
|
|
2842
|
+
approval: agent.approval,
|
|
2843
|
+
redact: agent.redact ? [...agent.redact] : void 0,
|
|
2844
|
+
expose: {
|
|
2845
|
+
mcp: agent.expose?.mcp ?? true,
|
|
2846
|
+
webMcp: agent.expose?.webMcp ?? true
|
|
2847
|
+
},
|
|
2848
|
+
warnings: toolWarnings
|
|
2849
|
+
};
|
|
2850
|
+
claimed.set(toolName, tool);
|
|
2851
|
+
tools.push(tool);
|
|
2852
|
+
for (const warning of toolWarnings) warnings.push(`${toolName}: ${warning}`);
|
|
2853
|
+
}
|
|
2854
|
+
return {
|
|
2855
|
+
tools,
|
|
2856
|
+
warnings
|
|
2857
|
+
};
|
|
2858
|
+
}
|
|
2859
|
+
function buildInputSchema(definition, method, warnings) {
|
|
2860
|
+
const label = `${method} ${definition.path}`;
|
|
2861
|
+
const merged = {
|
|
2862
|
+
properties: Object.create(null),
|
|
2863
|
+
required: /* @__PURE__ */ new Set(),
|
|
2864
|
+
owner: /* @__PURE__ */ new Map()
|
|
2865
|
+
};
|
|
2866
|
+
const pathParamNames = extractPathParamNames(definition.path);
|
|
2867
|
+
const paramsDetails = definition.schemas?.params ? readObjectSchema(definition.schemas.params, warnings, `${label} params`, "input") : void 0;
|
|
2868
|
+
if (paramsDetails) mergeProperties(merged, paramsDetails.properties, paramsDetails.required, "params", warnings);
|
|
2869
|
+
const supplements = Object.create(null);
|
|
2870
|
+
const supplementRequired = /* @__PURE__ */ new Set();
|
|
2871
|
+
for (const name of pathParamNames) {
|
|
2872
|
+
if (merged.owner.has(name)) continue;
|
|
2873
|
+
supplements[name] = { type: "string" };
|
|
2874
|
+
supplementRequired.add(name);
|
|
2875
|
+
}
|
|
2876
|
+
mergeProperties(merged, supplements, supplementRequired, "path", warnings);
|
|
2877
|
+
const queryDetails = definition.schemas?.query ? readObjectSchema(definition.schemas.query, warnings, `${label} query`, "input") : void 0;
|
|
2878
|
+
if (queryDetails) mergeProperties(merged, queryDetails.properties, queryDetails.required, "query", warnings);
|
|
2879
|
+
let nestedBody = false;
|
|
2880
|
+
const body = definition.schemas?.body ? toJsonSchema(definition.schemas.body, warnings, `${label} body`, "input") : void 0;
|
|
2881
|
+
if (body) {
|
|
2882
|
+
if (body.type === "object" && body.properties) mergeProperties(merged, body.properties, new Set(body.required ?? []), "body", warnings);
|
|
2883
|
+
else {
|
|
2884
|
+
mergeProperties(merged, { body }, /* @__PURE__ */ new Set(["body"]), "body", warnings);
|
|
2885
|
+
nestedBody = true;
|
|
2886
|
+
}
|
|
2887
|
+
}
|
|
2888
|
+
for (const name of pathParamNames) if (name in merged.properties) merged.required.add(name);
|
|
2889
|
+
const required = Array.from(merged.required);
|
|
2890
|
+
const sources = Object.create(null);
|
|
2891
|
+
for (const [name, source] of merged.owner) sources[name] = source;
|
|
2892
|
+
return {
|
|
2893
|
+
schema: {
|
|
2894
|
+
type: "object",
|
|
2895
|
+
properties: { ...merged.properties },
|
|
2896
|
+
...required.length > 0 ? { required } : {}
|
|
2897
|
+
},
|
|
2898
|
+
sources: { ...sources },
|
|
2899
|
+
nestedBody
|
|
2900
|
+
};
|
|
2901
|
+
}
|
|
2902
|
+
/**
|
|
2903
|
+
* Fold one source's properties into the merge. A collision replaces both the
|
|
2904
|
+
* property *and* its required-ness — carrying a losing source's `required`
|
|
2905
|
+
* forward would demand a key the advertised schema does not describe.
|
|
2906
|
+
*/
|
|
2907
|
+
function mergeProperties(merged, properties, required, source, warnings) {
|
|
2908
|
+
for (const [name, schema] of Object.entries(properties)) {
|
|
2909
|
+
const previous = merged.owner.get(name);
|
|
2910
|
+
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.`);
|
|
2911
|
+
merged.properties[name] = schema;
|
|
2912
|
+
merged.owner.set(name, source);
|
|
2913
|
+
merged.required.delete(name);
|
|
2914
|
+
if (required.has(name)) merged.required.add(name);
|
|
2915
|
+
}
|
|
2916
|
+
}
|
|
2917
|
+
/**
|
|
2918
|
+
* The route's `output` schema — the only response shape validated at runtime,
|
|
2919
|
+
* so advertising it costs no new machinery. A `resource` hint is the next rung
|
|
2920
|
+
* of RFC 0016's ladder and is CLI-only: the type text behind its class names
|
|
2921
|
+
* exists solely in the CLI's AST extraction.
|
|
2922
|
+
*/
|
|
2923
|
+
function buildOutputSchema(definition, method, warnings) {
|
|
2924
|
+
const output = definition.schemas?.output;
|
|
2925
|
+
if (!output) return void 0;
|
|
2926
|
+
return toJsonSchema(output, warnings, `${method} ${definition.path} response`, "output");
|
|
2927
|
+
}
|
|
2928
|
+
/**
|
|
2929
|
+
* The ability a route's middleware chain checks, when the stamped capability
|
|
2930
|
+
* says so unambiguously (RFC 0007's `MiddlewareCapabilities.authorization`).
|
|
2931
|
+
* Everything else is omitted rather than guessed, so absence means
|
|
2932
|
+
* "undetermined" — which is what lets `guren check`'s "authn is not authz" rule
|
|
2933
|
+
* fail closed on it instead of reading a name that was never checked.
|
|
2934
|
+
*/
|
|
2935
|
+
function deriveAuthorization(definition, method) {
|
|
2936
|
+
const ability = derivableAbility(definition.capabilities?.authorization, method);
|
|
2937
|
+
return ability === void 0 ? void 0 : { ability };
|
|
2938
|
+
}
|
|
2939
|
+
//#endregion
|
|
2940
|
+
//#region src/introspection/plain-json.ts
|
|
2941
|
+
/**
|
|
2942
|
+
* A deep copy holding only JSON values, with `undefined` object keys dropped and
|
|
2943
|
+
* `undefined` array items turned into `null`, as `JSON.stringify` does. Anything
|
|
2944
|
+
* else (a function, a Map, a class instance, a bigint, a cycle) throws, so a
|
|
2945
|
+
* manifest field that would not survive `--json` fails here instead of vanishing.
|
|
2946
|
+
*/
|
|
2947
|
+
function toPlainJson(value) {
|
|
2948
|
+
return copy(value, "manifest", /* @__PURE__ */ new Set());
|
|
2949
|
+
}
|
|
2950
|
+
function refuse(path, what) {
|
|
2951
|
+
throw new TypeError(`${path} (${what}) cannot be carried by JSON`);
|
|
2952
|
+
}
|
|
2953
|
+
function copy(value, path, ancestors) {
|
|
2954
|
+
if (value === null || typeof value === "string" || typeof value === "boolean") return value;
|
|
2955
|
+
if (typeof value === "number") return Number.isFinite(value) ? value : refuse(path, String(value));
|
|
2956
|
+
if (typeof value !== "object") return refuse(path, typeof value);
|
|
2957
|
+
if (ancestors.has(value)) refuse(path, "a reference to its own ancestor");
|
|
2958
|
+
ancestors.add(value);
|
|
2959
|
+
try {
|
|
2960
|
+
if (Array.isArray(value)) return value.map((item, index) => item === void 0 ? null : copy(item, `${path}[${index}]`, ancestors));
|
|
2961
|
+
const proto = Object.getPrototypeOf(value);
|
|
2962
|
+
if (proto !== Object.prototype && proto !== null) refuse(path, value.constructor?.name ?? "object");
|
|
2963
|
+
const result = {};
|
|
2964
|
+
for (const [key, item] of Object.entries(value)) if (item !== void 0) result[key] = copy(item, `${path}.${key}`, ancestors);
|
|
2965
|
+
return result;
|
|
2966
|
+
} finally {
|
|
2967
|
+
ancestors.delete(value);
|
|
2968
|
+
}
|
|
2969
|
+
}
|
|
2970
|
+
//#endregion
|
|
2971
|
+
//#region src/introspection/manifest.ts
|
|
2972
|
+
const SCHEMA_KEYS = [
|
|
2973
|
+
"params",
|
|
2974
|
+
"query",
|
|
2975
|
+
"body",
|
|
2976
|
+
"output"
|
|
2977
|
+
];
|
|
2978
|
+
/** Builds the manifest from a registered, unmounted, unbooted app (RFC 0026 §1). */
|
|
2979
|
+
function buildAppManifest(sources) {
|
|
2980
|
+
const warnings = [...sources.providerWarnings];
|
|
2981
|
+
if (sources.hasBootCallback) warnings.push({
|
|
2982
|
+
code: "boot-callback-skipped",
|
|
2983
|
+
message: "createApp({ boot }) was not run: introspection stops before boot, so routes or middleware it adds are not in this manifest."
|
|
2984
|
+
});
|
|
2985
|
+
const definitions = sources.router.definitions();
|
|
2986
|
+
const { aliases, routes: chains } = sources.router.describeMiddleware();
|
|
2987
|
+
const routes = describeRoutes(definitions, chains, warnings);
|
|
2988
|
+
const middlewareAliases = {};
|
|
2989
|
+
for (const [name, entry] of Object.entries(aliases)) middlewareAliases[name] = withAbility(entry);
|
|
2990
|
+
const derived = deriveAgentTools(definitions);
|
|
2991
|
+
for (const message of derived.warnings) warnings.push({
|
|
2992
|
+
code: "agent-tool",
|
|
2993
|
+
message
|
|
2994
|
+
});
|
|
2995
|
+
const manifest = {
|
|
2996
|
+
schemaVersion: 1,
|
|
2997
|
+
generatedAt: (/* @__PURE__ */ new Date()).toISOString(),
|
|
2998
|
+
entry: {
|
|
2999
|
+
file: null,
|
|
3000
|
+
root: process.cwd(),
|
|
3001
|
+
stage: "register"
|
|
3002
|
+
},
|
|
3003
|
+
runtime: {
|
|
3004
|
+
bun: process.versions.bun ?? null,
|
|
3005
|
+
node: process.versions.node ?? null,
|
|
3006
|
+
platform: process.platform
|
|
3007
|
+
},
|
|
3008
|
+
providers: sources.providers,
|
|
3009
|
+
modules: sources.modules.map((gurenModule) => ({
|
|
3010
|
+
name: gurenModule.name,
|
|
3011
|
+
...gurenModule.prefix === void 0 ? {} : { prefix: gurenModule.prefix },
|
|
3012
|
+
providers: gurenModule.providers.map((provider) => provider.name),
|
|
3013
|
+
commands: gurenModule.commands.map((command) => command.name),
|
|
3014
|
+
routeCount: routes.filter((route) => route.module === gurenModule.name).length
|
|
3015
|
+
})),
|
|
3016
|
+
routes,
|
|
3017
|
+
middlewareAliases,
|
|
3018
|
+
bindings: sources.container.getBindings().sort(),
|
|
3019
|
+
agentTools: derived.tools,
|
|
3020
|
+
warnings
|
|
3021
|
+
};
|
|
3022
|
+
const section = (key) => {
|
|
3023
|
+
const read = readSection(sources, key, warnings);
|
|
3024
|
+
return read.status === "described" ? read.value : void 0;
|
|
3025
|
+
};
|
|
3026
|
+
const session = describeSession(sources, warnings);
|
|
3027
|
+
if (session) manifest.session = session;
|
|
3028
|
+
const auth = section("auth");
|
|
3029
|
+
if (auth) manifest.auth = auth;
|
|
3030
|
+
for (const key of [
|
|
3031
|
+
"cache",
|
|
3032
|
+
"storage",
|
|
3033
|
+
"queue"
|
|
3034
|
+
]) {
|
|
3035
|
+
const entry = section(key);
|
|
3036
|
+
if (entry) manifest[key] = entry;
|
|
3037
|
+
}
|
|
3038
|
+
const attachments = section("attachments");
|
|
3039
|
+
if (attachments) {
|
|
3040
|
+
const { delivery, ...rest } = attachments;
|
|
3041
|
+
manifest.attachments = delivery ? {
|
|
3042
|
+
...rest,
|
|
3043
|
+
delivery: {
|
|
3044
|
+
...delivery,
|
|
3045
|
+
mounted: sources.router.hasRoute(delivery.routeName)
|
|
3046
|
+
}
|
|
3047
|
+
} : rest;
|
|
3048
|
+
}
|
|
3049
|
+
return toPlainJson(manifest);
|
|
3050
|
+
}
|
|
3051
|
+
function describeRoutes(definitions, chains, warnings) {
|
|
3052
|
+
return definitions.map((definition, index) => {
|
|
3053
|
+
const { schemas, controller, middlewareNames, module, ...rest } = definition;
|
|
3054
|
+
const label = `${definition.method} ${definition.path}`;
|
|
3055
|
+
const entry = {
|
|
3056
|
+
...rest,
|
|
3057
|
+
module: module ?? null,
|
|
3058
|
+
middleware: (chains[index] ?? []).map((middleware) => withAbility(middleware, definition.method)),
|
|
3059
|
+
schemas: {}
|
|
3060
|
+
};
|
|
3061
|
+
for (const key of SCHEMA_KEYS) {
|
|
3062
|
+
const schema = schemas?.[key];
|
|
3063
|
+
if (!schema) continue;
|
|
3064
|
+
const notes = [];
|
|
3065
|
+
const json = toJsonSchema(schema, notes, `${label} ${key}`, key === "output" ? "output" : "input");
|
|
3066
|
+
entry.schemas[key] = json ?? { unreadable: notes.join(" ") || "not a readable Zod schema" };
|
|
3067
|
+
if (json) for (const message of notes) warnings.push({
|
|
3068
|
+
code: "schema-partial",
|
|
3069
|
+
message,
|
|
3070
|
+
route: label
|
|
3071
|
+
});
|
|
3072
|
+
}
|
|
3073
|
+
if (controller) entry.controller = {
|
|
3074
|
+
name: controller.name,
|
|
3075
|
+
action: controller.action,
|
|
3076
|
+
file: null,
|
|
3077
|
+
exportName: null,
|
|
3078
|
+
resolved: "name-only"
|
|
3079
|
+
};
|
|
3080
|
+
return entry;
|
|
3081
|
+
});
|
|
3082
|
+
}
|
|
3083
|
+
function withAbility(entry, method) {
|
|
3084
|
+
const ability = derivableAbility(entry.capabilities.authorization, method);
|
|
3085
|
+
return ability === void 0 ? entry : {
|
|
3086
|
+
...entry,
|
|
3087
|
+
ability
|
|
3088
|
+
};
|
|
3089
|
+
}
|
|
3090
|
+
function describeSession(sources, warnings) {
|
|
3091
|
+
const read = readSection(sources, "session", warnings);
|
|
3092
|
+
if (read.status === "described") {
|
|
3093
|
+
const auth = sources.authOptions;
|
|
3094
|
+
if (auth && auth.autoSession !== false && auth.sessionOptions?.store !== void 0) warnings.push({
|
|
3095
|
+
code: "session-configured-twice",
|
|
3096
|
+
message: "A \"session\" binding and createApp({ auth: { sessionOptions: { store } } }) both configure sessions; the app refuses to boot until one is removed."
|
|
3097
|
+
});
|
|
3098
|
+
return {
|
|
3099
|
+
source: "manager",
|
|
3100
|
+
...read.value
|
|
3101
|
+
};
|
|
3102
|
+
}
|
|
3103
|
+
if (read.status !== "absent") return void 0;
|
|
3104
|
+
const auth = sources.authOptions;
|
|
3105
|
+
if (!auth || auth.autoSession === false) return void 0;
|
|
3106
|
+
const store = auth.sessionOptions?.store;
|
|
3107
|
+
if (store === void 0) return {
|
|
3108
|
+
source: "none",
|
|
3109
|
+
...new SessionManager().describe()
|
|
3110
|
+
};
|
|
3111
|
+
const driver = typeof store === "function" ? null : store.constructor.name;
|
|
3112
|
+
return {
|
|
3113
|
+
source: "auth.sessionOptions.store",
|
|
3114
|
+
default: "sessionOptions.store",
|
|
3115
|
+
stores: { "sessionOptions.store": {
|
|
3116
|
+
driver,
|
|
3117
|
+
perProcess: perProcessOfStoreClass(driver)
|
|
3118
|
+
} }
|
|
3119
|
+
};
|
|
3120
|
+
}
|
|
3121
|
+
/** The framework's store classes by the driver that builds them; core's `DatabaseSessionStore` included. */
|
|
3122
|
+
const DRIVER_BY_STORE_CLASS = {
|
|
3123
|
+
MemorySessionStore: "memory",
|
|
3124
|
+
CookieSessionStore: "cookie",
|
|
3125
|
+
RedisSessionStore: "redis",
|
|
3126
|
+
DatabaseSessionStore: "database"
|
|
3127
|
+
};
|
|
3128
|
+
function perProcessOfStoreClass(storeClass) {
|
|
3129
|
+
const driver = storeClass === null ? void 0 : DRIVER_BY_STORE_CLASS[storeClass];
|
|
3130
|
+
return driver === void 0 ? null : sessionDriverIsPerProcess(driver);
|
|
3131
|
+
}
|
|
3132
|
+
/**
|
|
3133
|
+
* A section is read only when its container key exists after registration.
|
|
3134
|
+
* One a deferred provider supplies, or whose manager throws on construction,
|
|
3135
|
+
* is warned about and told apart from a plain absence.
|
|
3136
|
+
*/
|
|
3137
|
+
function readSection(sources, key, warnings) {
|
|
3138
|
+
const { container } = sources;
|
|
3139
|
+
if (!container.has(key)) {
|
|
3140
|
+
const deferred = sources.providers.find((provider) => provider.register === "skipped" && provider.provides.includes(key));
|
|
3141
|
+
if (deferred) {
|
|
3142
|
+
warnings.push({
|
|
3143
|
+
code: "section-unverified",
|
|
3144
|
+
message: `"${key}" is supplied by the deferred ${deferred.name}, which registers only after boot.`,
|
|
3145
|
+
provider: deferred.name
|
|
3146
|
+
});
|
|
3147
|
+
return { status: "unverified" };
|
|
3148
|
+
}
|
|
3149
|
+
const thrown = sources.providers.filter((provider) => provider.register === "threw");
|
|
3150
|
+
if (thrown.length === 0) return { status: "absent" };
|
|
3151
|
+
warnings.push({
|
|
3152
|
+
code: "section-unverified",
|
|
3153
|
+
message: `"${key}" is unbound, and ${thrown.map((provider) => provider.name).join(", ")} threw before it could be ruled out as its provider.`
|
|
3154
|
+
});
|
|
3155
|
+
return { status: "unverified" };
|
|
3156
|
+
}
|
|
3157
|
+
try {
|
|
3158
|
+
const service = container.make(key);
|
|
3159
|
+
if (typeof service?.describe === "function") return {
|
|
3160
|
+
status: "described",
|
|
3161
|
+
value: service.describe()
|
|
3162
|
+
};
|
|
3163
|
+
warnings.push({
|
|
3164
|
+
code: "section-unverified",
|
|
3165
|
+
message: `"${key}" is bound to something with no describe().`
|
|
3166
|
+
});
|
|
3167
|
+
return { status: "unverified" };
|
|
3168
|
+
} catch (error) {
|
|
3169
|
+
warnings.push({
|
|
3170
|
+
code: "section-unreadable",
|
|
3171
|
+
message: `"${key}" is bound but could not be described: ${error instanceof Error ? error.message : String(error)}`
|
|
3172
|
+
});
|
|
3173
|
+
return { status: "unreadable" };
|
|
3174
|
+
}
|
|
3175
|
+
}
|
|
3176
|
+
//#endregion
|
|
2646
3177
|
//#region src/http/Application.ts
|
|
2647
3178
|
const MANAGED_VITE_ENV_FLAG = "GUREN_MANAGED_VITE_DEV_SERVER";
|
|
2648
3179
|
const DEFAULT_DEV_ENTRY_PATH = "/resources/js/dev-entry.ts";
|
|
@@ -2680,6 +3211,19 @@ function toConnectableUrl(hostname, port) {
|
|
|
2680
3211
|
const host = isWildcardHost(hostname) ? hostname === "::" ? "::1" : "127.0.0.1" : hostname;
|
|
2681
3212
|
return `http://${formatHostPort(host, port)}`;
|
|
2682
3213
|
}
|
|
3214
|
+
let devBanner;
|
|
3215
|
+
/**
|
|
3216
|
+
* The banner module brings figlet and chalk, so it is loaded outside production
|
|
3217
|
+
* only. The NODE_ENV test guards the import directly, in plain member access: a
|
|
3218
|
+
* deploy bundle's `--define` folds it to `false` and drops the module. Neither
|
|
3219
|
+
* Bun nor esbuild folds it behind a function call, or beside a runtime value in
|
|
3220
|
+
* `||` (as `shouldLogBanner` has); an `&&` with such a value still folds.
|
|
3221
|
+
*/
|
|
3222
|
+
async function loadDevBanner() {
|
|
3223
|
+
if (typeof process === "undefined") return devBanner;
|
|
3224
|
+
if (process.env.NODE_ENV !== "production") devBanner ??= await import("./dev-banner-bekDeLgL.js").then((n) => n.n);
|
|
3225
|
+
return devBanner;
|
|
3226
|
+
}
|
|
2683
3227
|
function clearManagedViteEnv() {
|
|
2684
3228
|
if (typeof process === "undefined") return;
|
|
2685
3229
|
if (process.env[MANAGED_VITE_ENV_FLAG] === "1") {
|
|
@@ -2709,6 +3253,30 @@ function bunStopTimeoutMs() {
|
|
|
2709
3253
|
return shutdownTimeoutMs("GUREN_BUN_STOP_TIMEOUT_MS");
|
|
2710
3254
|
}
|
|
2711
3255
|
/**
|
|
3256
|
+
* How long a `bun --hot` reload waits on the server it replaces. That stop is
|
|
3257
|
+
* forced, and the hot-reload teardown has already server-closed every broadcast
|
|
3258
|
+
* WebSocket, so nothing is draining; on Bun 1.3.x `stop()` then never resolves
|
|
3259
|
+
* (1.4.0 resolves at once). Quoted in docs/{en,ja}/guides/architecture.md.
|
|
3260
|
+
*/
|
|
3261
|
+
const HOT_RELOAD_STOP_TIMEOUT_MS = 250;
|
|
3262
|
+
function defaultStopBound() {
|
|
3263
|
+
return {
|
|
3264
|
+
timeoutMs: bunStopTimeoutMs(),
|
|
3265
|
+
warn: true
|
|
3266
|
+
};
|
|
3267
|
+
}
|
|
3268
|
+
/**
|
|
3269
|
+
* Silent: on Bun 1.3.x it is hit on every reload, and there is nothing to
|
|
3270
|
+
* report. `GUREN_BUN_STOP_TIMEOUT_MS` can only shorten it: it is set for a
|
|
3271
|
+
* production drain, which a reload never is.
|
|
3272
|
+
*/
|
|
3273
|
+
function hotReloadStopBound() {
|
|
3274
|
+
return {
|
|
3275
|
+
timeoutMs: Math.min(bunStopTimeoutMs(), HOT_RELOAD_STOP_TIMEOUT_MS),
|
|
3276
|
+
warn: false
|
|
3277
|
+
};
|
|
3278
|
+
}
|
|
3279
|
+
/**
|
|
2712
3280
|
* A positive integer of milliseconds, or 5000 when unset or unparseable. One
|
|
2713
3281
|
* parse for both bounds, so they cannot drift apart.
|
|
2714
3282
|
*/
|
|
@@ -2730,19 +3298,20 @@ async function awaitBounded(work, timeoutMs, onTimeout) {
|
|
|
2730
3298
|
clearTimeout(timer);
|
|
2731
3299
|
}
|
|
2732
3300
|
}
|
|
2733
|
-
/** `stop()` bounded by {@link bunStopTimeoutMs}, warning rather than throwing. */
|
|
2734
|
-
async function stopBunServerBounded(server, closeActiveConnections) {
|
|
3301
|
+
/** `stop()` bounded by `bound` ({@link bunStopTimeoutMs} by default), warning rather than throwing. */
|
|
3302
|
+
async function stopBunServerBounded(server, closeActiveConnections, bound = defaultStopBound()) {
|
|
2735
3303
|
await awaitBounded((async () => {
|
|
2736
3304
|
try {
|
|
2737
3305
|
await server.stop?.(closeActiveConnections);
|
|
2738
3306
|
} catch (error) {
|
|
2739
3307
|
console.warn("Failed to stop Bun server:", error);
|
|
2740
3308
|
}
|
|
2741
|
-
})(),
|
|
3309
|
+
})(), bound.timeoutMs, (timeoutMs) => {
|
|
3310
|
+
if (!bound.warn) return;
|
|
2742
3311
|
console.warn(`Bun server did not stop within ${timeoutMs}ms — no longer waiting on it. In-flight requests may still be draining.`);
|
|
2743
3312
|
});
|
|
2744
3313
|
}
|
|
2745
|
-
async function stopActiveBunServer(closeActiveConnections = false) {
|
|
3314
|
+
async function stopActiveBunServer(closeActiveConnections = false, bound) {
|
|
2746
3315
|
const state = getGlobalState();
|
|
2747
3316
|
const previous = state.__gurenActiveServer;
|
|
2748
3317
|
if (!previous?.stop) {
|
|
@@ -2750,7 +3319,7 @@ async function stopActiveBunServer(closeActiveConnections = false) {
|
|
|
2750
3319
|
return;
|
|
2751
3320
|
}
|
|
2752
3321
|
try {
|
|
2753
|
-
await stopBunServerBounded(previous, closeActiveConnections);
|
|
3322
|
+
await stopBunServerBounded(previous, closeActiveConnections, bound);
|
|
2754
3323
|
} finally {
|
|
2755
3324
|
releaseActiveBunServer(previous);
|
|
2756
3325
|
}
|
|
@@ -2877,6 +3446,8 @@ var Application = class {
|
|
|
2877
3446
|
configEntries;
|
|
2878
3447
|
routesRegistered = false;
|
|
2879
3448
|
bootPromise;
|
|
3449
|
+
manifestPromise;
|
|
3450
|
+
bootAttempted = false;
|
|
2880
3451
|
constructor(options = {}) {
|
|
2881
3452
|
this.options = options;
|
|
2882
3453
|
this.configEntries = [...(options.config ?? []).map((definition, index) => ({
|
|
@@ -2900,7 +3471,8 @@ var Application = class {
|
|
|
2900
3471
|
if (options.inertia?.document) this.container.instance("inertia.document", options.inertia.document);
|
|
2901
3472
|
if (options.inertia?.ssrRenderer) this.container.instance("inertia.ssrRenderer", options.inertia.ssrRenderer);
|
|
2902
3473
|
if (options.inertia?.share) shareInertiaProps(options.inertia.share, this.container);
|
|
2903
|
-
|
|
3474
|
+
const framework = { source: "framework" };
|
|
3475
|
+
if (options.env || this.configEntries.length > 0) this.providerManager.register(ConfigServiceProvider, framework);
|
|
2904
3476
|
this.authManager.registerGuard("web", ({ session }) => {
|
|
2905
3477
|
const provider = this.authManager.hasProvider("users") ? this.authManager.getProvider(DEFAULT_PROVIDER) : unconfiguredUserProvider;
|
|
2906
3478
|
return new SessionGuard({
|
|
@@ -2909,16 +3481,20 @@ var Application = class {
|
|
|
2909
3481
|
});
|
|
2910
3482
|
});
|
|
2911
3483
|
this.authManager.setDefaultGuard("web");
|
|
2912
|
-
if (this.options.auth) this.providerManager.register(AuthServiceProvider);
|
|
3484
|
+
if (this.options.auth) this.providerManager.register(AuthServiceProvider, framework);
|
|
2913
3485
|
else this.hono.use("*", attachAuthContext((ctx) => this.authManager.createAuthContext(ctx)));
|
|
2914
|
-
this.providerManager.register(AuthorizationServiceProvider);
|
|
2915
|
-
const
|
|
2916
|
-
const userProviders = [...
|
|
3486
|
+
this.providerManager.register(AuthorizationServiceProvider, framework);
|
|
3487
|
+
const listedProviders = Array.isArray(this.options.providers) ? this.options.providers : [];
|
|
3488
|
+
const userProviders = [...listedProviders, ...(this.options.modules ?? []).flatMap((module) => module.providers)];
|
|
2917
3489
|
const hasUserProviderOf = (base) => userProviders.some((provider) => provider === base || provider.prototype instanceof base);
|
|
2918
|
-
if (this.options.i18n && !hasUserProviderOf(I18nServiceProvider)) this.providerManager.register(I18nServiceProvider);
|
|
2919
|
-
if (!hasUserProviderOf(ErrorServiceProvider)) this.providerManager.register(ErrorServiceProvider);
|
|
2920
|
-
|
|
2921
|
-
|
|
3490
|
+
if (this.options.i18n && !hasUserProviderOf(I18nServiceProvider)) this.providerManager.register(I18nServiceProvider, framework);
|
|
3491
|
+
if (!hasUserProviderOf(ErrorServiceProvider)) this.providerManager.register(ErrorServiceProvider, framework);
|
|
3492
|
+
this.providerManager.registerMany(listedProviders, { source: "options.providers" });
|
|
3493
|
+
for (const gurenModule of this.options.modules ?? []) this.providerManager.registerMany(gurenModule.providers, {
|
|
3494
|
+
source: "module",
|
|
3495
|
+
module: gurenModule.name
|
|
3496
|
+
});
|
|
3497
|
+
if (!hasUserProviderOf(InertiaServiceProvider)) this.providerManager.register(InertiaServiceProvider, framework);
|
|
2922
3498
|
adoptDefaultApplication(this);
|
|
2923
3499
|
}
|
|
2924
3500
|
get auth() {
|
|
@@ -2967,13 +3543,17 @@ var Application = class {
|
|
|
2967
3543
|
return this.cookielessAuthPaths;
|
|
2968
3544
|
}
|
|
2969
3545
|
async mountRoutes() {
|
|
3546
|
+
await this.registerRoutes();
|
|
3547
|
+
await this.preparePrototypeRoutes();
|
|
3548
|
+
this.router.mount(this.hono, { container: this.container });
|
|
3549
|
+
}
|
|
3550
|
+
/** Runs the registrars once; `introspect()` stops here, since mounting refuses an unregistered alias it reports. */
|
|
3551
|
+
async registerRoutes() {
|
|
2970
3552
|
if (!this.routesRegistered) {
|
|
2971
3553
|
if (this.options.routes) await this.options.routes(this.router);
|
|
2972
3554
|
for (const gurenModule of this.options.modules ?? []) await mountModuleRoutes(this.router, gurenModule);
|
|
2973
3555
|
this.routesRegistered = true;
|
|
2974
3556
|
}
|
|
2975
|
-
await this.preparePrototypeRoutes();
|
|
2976
|
-
this.router.mount(this.hono, { container: this.container });
|
|
2977
3557
|
}
|
|
2978
3558
|
/**
|
|
2979
3559
|
* Every failure here is one a request would otherwise surface as a 500:
|
|
@@ -3007,6 +3587,11 @@ var Application = class {
|
|
|
3007
3587
|
* retries on the partially mounted app rather than starting clean.
|
|
3008
3588
|
*/
|
|
3009
3589
|
async boot() {
|
|
3590
|
+
if (isIntrospecting()) {
|
|
3591
|
+
await this.introspect();
|
|
3592
|
+
return;
|
|
3593
|
+
}
|
|
3594
|
+
if (this.manifestPromise) throw new Error("[guren] This application was introspected: its providers may have run introspect() in place of register(), so it cannot boot. Construct a new application to serve it.");
|
|
3010
3595
|
this.bootPromise ??= this.bootOnce();
|
|
3011
3596
|
try {
|
|
3012
3597
|
await this.bootPromise;
|
|
@@ -3024,13 +3609,37 @@ var Application = class {
|
|
|
3024
3609
|
async booted() {
|
|
3025
3610
|
await this.bootPromise;
|
|
3026
3611
|
}
|
|
3612
|
+
/**
|
|
3613
|
+
* Registers providers and routes, then describes the result (RFC 0026 §1).
|
|
3614
|
+
* Never mounts on Hono or runs `createApp({ boot })`, a provider's `boot()`
|
|
3615
|
+
* or `listen()`. Memoised; the application cannot boot afterwards.
|
|
3616
|
+
*/
|
|
3617
|
+
async introspect() {
|
|
3618
|
+
if (this.bootAttempted) throw new Error("[guren] Cannot introspect an application that has booted: introspection describes the registered, unbooted app.");
|
|
3619
|
+
this.manifestPromise ??= runIntrospecting(() => this.introspectOnce());
|
|
3620
|
+
return this.manifestPromise;
|
|
3621
|
+
}
|
|
3622
|
+
async introspectOnce() {
|
|
3623
|
+
const providers = await this.providerManager.registerAllForIntrospection();
|
|
3624
|
+
await this.registerRoutes();
|
|
3625
|
+
return buildAppManifest({
|
|
3626
|
+
router: this.router,
|
|
3627
|
+
container: this.container,
|
|
3628
|
+
providers,
|
|
3629
|
+
providerWarnings: this.providerManager.manifestWarnings(),
|
|
3630
|
+
modules: this.options.modules ?? [],
|
|
3631
|
+
authOptions: this.options.auth,
|
|
3632
|
+
hasBootCallback: this.options.boot !== void 0
|
|
3633
|
+
});
|
|
3634
|
+
}
|
|
3027
3635
|
async bootOnce() {
|
|
3636
|
+
this.bootAttempted = true;
|
|
3028
3637
|
if (this.options.hostAuthorization !== void 0 && this.hasHttpConfig()) throw new Error("[guren] Host authorization is configured twice: createApp({ hostAuthorization }) and config/http.ts. Keep one.");
|
|
3029
3638
|
await this.providerManager.registerAll();
|
|
3030
3639
|
await this.options.boot?.(this.hono);
|
|
3031
3640
|
await this.mountRoutes();
|
|
3032
|
-
await this.mountDevEndpoint(isMcpEndpointEnabled(), async () => (await import("./McpServiceProvider-
|
|
3033
|
-
await this.mountDevEndpoint(isDocsViewerEnabled(), async () => (await import("./DocsViewerServiceProvider-
|
|
3641
|
+
await this.mountDevEndpoint(isMcpEndpointEnabled(), async () => (await import("./McpServiceProvider-PGFPlYTy.js").then((n) => n.n)).McpServiceProvider, "GUREN_MCP=1 but the MCP endpoint could not load — is @guren/cli installed?");
|
|
3642
|
+
await this.mountDevEndpoint(isDocsViewerEnabled(), async () => (await import("./DocsViewerServiceProvider-BMbcTYVw.js")).DocsViewerServiceProvider, "GUREN_DOCS=1 but the docs viewer could not load — is @guren/cli resolvable from this app?");
|
|
3034
3643
|
await this.providerManager.bootAll();
|
|
3035
3644
|
this.warnOnUnconfiguredAuth();
|
|
3036
3645
|
}
|
|
@@ -3110,12 +3719,16 @@ var Application = class {
|
|
|
3110
3719
|
return runInRequestScope(executionCtx, () => this.hono.fetch(request, env, executionCtx));
|
|
3111
3720
|
}
|
|
3112
3721
|
async listen(options = {}) {
|
|
3722
|
+
if (isIntrospecting()) throw new IntrospectionListenError();
|
|
3113
3723
|
if (!Bun) throw new Error("Bun runtime is required to call Application.listen");
|
|
3114
3724
|
const supersededServer = getGlobalState().__gurenActiveServer;
|
|
3115
|
-
await stopActiveBunServer(true);
|
|
3725
|
+
await stopActiveBunServer(true, isHotReloadRuntime() ? hotReloadStopBound() : void 0);
|
|
3116
3726
|
const { port = 3e3, hostname = "0.0.0.0", assetsUrl, vite, portFallback } = options;
|
|
3117
3727
|
const externalAssetsUrl = typeof process !== "undefined" && process.env?.[MANAGED_VITE_ENV_FLAG] !== "1" ? process.env?.VITE_DEV_SERVER_URL : void 0;
|
|
3118
3728
|
let resolvedAssetsUrl = assetsUrl ?? externalAssetsUrl;
|
|
3729
|
+
const shouldLogBanner = typeof process === "undefined" || process.env.NODE_ENV !== "production" && process.env?.GUREN_DEV_BANNER !== "0";
|
|
3730
|
+
if (shouldLogBanner) await loadDevBanner();
|
|
3731
|
+
const { websocket } = await import("hono/bun");
|
|
3119
3732
|
const shouldStartVite = vite !== false && typeof process !== "undefined" && process.env.NODE_ENV !== "production" && !resolvedAssetsUrl && process.env?.GUREN_DEV_VITE !== "0";
|
|
3120
3733
|
const adoptViteDevServer = (viteServer, localUrl) => {
|
|
3121
3734
|
const displaced = getGlobalState().__gurenActiveViteDevServer;
|
|
@@ -3158,7 +3771,8 @@ var Application = class {
|
|
|
3158
3771
|
server = Bun.serve({
|
|
3159
3772
|
port: attemptPort,
|
|
3160
3773
|
hostname,
|
|
3161
|
-
fetch: (request, server) => this.fetch(request, { server })
|
|
3774
|
+
fetch: (request, server) => this.fetch(request, { server }),
|
|
3775
|
+
websocket
|
|
3162
3776
|
});
|
|
3163
3777
|
break;
|
|
3164
3778
|
} catch (error) {
|
|
@@ -3190,7 +3804,7 @@ var Application = class {
|
|
|
3190
3804
|
this.boundAddress = address;
|
|
3191
3805
|
setActiveBunServer(server);
|
|
3192
3806
|
this.registerBunTeardown();
|
|
3193
|
-
if (
|
|
3807
|
+
if (shouldLogBanner) this.logDevServerBanner({
|
|
3194
3808
|
hostname: boundHostname,
|
|
3195
3809
|
port: boundPort,
|
|
3196
3810
|
assetsUrl: resolvedAssetsUrl ?? "http://localhost:5173"
|
|
@@ -3238,8 +3852,18 @@ var Application = class {
|
|
|
3238
3852
|
this.providerManager.registerMany(providers);
|
|
3239
3853
|
return this;
|
|
3240
3854
|
}
|
|
3855
|
+
/**
|
|
3856
|
+
* Prints the dev server banner. `listen()` loads the banner module first, so it
|
|
3857
|
+
* prints there at once; a call before anything has loaded it prints once the
|
|
3858
|
+
* import settles. The module is never loaded under `NODE_ENV=production`, which
|
|
3859
|
+
* keeps it out of deploy bundles, so a call there prints nothing.
|
|
3860
|
+
*/
|
|
3241
3861
|
logDevServerBanner(options) {
|
|
3242
|
-
|
|
3862
|
+
if (devBanner) {
|
|
3863
|
+
devBanner.logDevServerBanner(options);
|
|
3864
|
+
return;
|
|
3865
|
+
}
|
|
3866
|
+
loadDevBanner().then((loaded) => loaded?.logDevServerBanner(options), (error) => console.error("Failed to load the dev server banner:", error));
|
|
3243
3867
|
}
|
|
3244
3868
|
/**
|
|
3245
3869
|
* Closes the managed Vite dev server, but only while this application still
|
|
@@ -3331,170 +3955,6 @@ function viteAsset(entry, options = {}) {
|
|
|
3331
3955
|
return manifestAssetUrl(manifest, normalizedEntry);
|
|
3332
3956
|
}
|
|
3333
3957
|
//#endregion
|
|
3334
|
-
//#region src/agent/derive.ts
|
|
3335
|
-
/** HTTP methods whose semantics are read-only, per the MCP annotation defaults. */
|
|
3336
|
-
const READ_ONLY_METHODS = /* @__PURE__ */ new Set(["GET", "QUERY"]);
|
|
3337
|
-
/** HTTP methods that are idempotent whether or not they are read-only. */
|
|
3338
|
-
const IDEMPOTENT_METHODS = /* @__PURE__ */ new Set([
|
|
3339
|
-
"GET",
|
|
3340
|
-
"QUERY",
|
|
3341
|
-
"PUT",
|
|
3342
|
-
"DELETE"
|
|
3343
|
-
]);
|
|
3344
|
-
/**
|
|
3345
|
-
* Derive the agent tools a set of route definitions exposes.
|
|
3346
|
-
*
|
|
3347
|
-
* @param definitions Registered routes, as `Router.definitions()` hands them out.
|
|
3348
|
-
*/
|
|
3349
|
-
function deriveAgentTools(definitions) {
|
|
3350
|
-
const tools = [];
|
|
3351
|
-
const warnings = [];
|
|
3352
|
-
const claimed = /* @__PURE__ */ new Map();
|
|
3353
|
-
for (const definition of definitions) {
|
|
3354
|
-
const agent = definition.agent;
|
|
3355
|
-
if (!agent) continue;
|
|
3356
|
-
const method = definition.method.toUpperCase();
|
|
3357
|
-
const where = `${method} ${definition.path}`;
|
|
3358
|
-
if (definition.prototype) {
|
|
3359
|
-
warnings.push(`${where}: declares agent metadata while still on its prototype fixture, so it is not exposed as a tool.`);
|
|
3360
|
-
continue;
|
|
3361
|
-
}
|
|
3362
|
-
if (!definition.name) {
|
|
3363
|
-
warnings.push(`${where}: declares agent metadata but has no route name, so it is not exposed as a tool. Chain .name() on the route — the tool name is its identity.`);
|
|
3364
|
-
continue;
|
|
3365
|
-
}
|
|
3366
|
-
const routeName = definition.name;
|
|
3367
|
-
const toolName = agent.toolName ?? routeName;
|
|
3368
|
-
const existing = claimed.get(toolName);
|
|
3369
|
-
if (existing) {
|
|
3370
|
-
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.`);
|
|
3371
|
-
continue;
|
|
3372
|
-
}
|
|
3373
|
-
const toolWarnings = [];
|
|
3374
|
-
const readOnlyHint = agent.readOnlyHint ?? READ_ONLY_METHODS.has(method);
|
|
3375
|
-
const input = buildInputSchema(definition, method, toolWarnings);
|
|
3376
|
-
const tool = {
|
|
3377
|
-
toolName,
|
|
3378
|
-
routeName,
|
|
3379
|
-
method,
|
|
3380
|
-
path: definition.path,
|
|
3381
|
-
description: agent.description ?? definition.description ?? definition.summary,
|
|
3382
|
-
inputSchema: input.schema,
|
|
3383
|
-
inputSources: input.sources,
|
|
3384
|
-
inputBodyNested: input.nestedBody,
|
|
3385
|
-
outputSchema: buildOutputSchema(definition, method, toolWarnings),
|
|
3386
|
-
resource: definition.schemas?.output ? void 0 : definition.resource,
|
|
3387
|
-
annotations: {
|
|
3388
|
-
readOnlyHint,
|
|
3389
|
-
destructiveHint: agent.destructiveHint ?? !readOnlyHint,
|
|
3390
|
-
idempotentHint: agent.idempotentHint ?? IDEMPOTENT_METHODS.has(method)
|
|
3391
|
-
},
|
|
3392
|
-
authorization: deriveAuthorization(definition, method),
|
|
3393
|
-
approval: agent.approval,
|
|
3394
|
-
redact: agent.redact ? [...agent.redact] : void 0,
|
|
3395
|
-
expose: {
|
|
3396
|
-
mcp: agent.expose?.mcp ?? true,
|
|
3397
|
-
webMcp: agent.expose?.webMcp ?? true
|
|
3398
|
-
},
|
|
3399
|
-
warnings: toolWarnings
|
|
3400
|
-
};
|
|
3401
|
-
claimed.set(toolName, tool);
|
|
3402
|
-
tools.push(tool);
|
|
3403
|
-
for (const warning of toolWarnings) warnings.push(`${toolName}: ${warning}`);
|
|
3404
|
-
}
|
|
3405
|
-
return {
|
|
3406
|
-
tools,
|
|
3407
|
-
warnings
|
|
3408
|
-
};
|
|
3409
|
-
}
|
|
3410
|
-
function buildInputSchema(definition, method, warnings) {
|
|
3411
|
-
const label = `${method} ${definition.path}`;
|
|
3412
|
-
const merged = {
|
|
3413
|
-
properties: Object.create(null),
|
|
3414
|
-
required: /* @__PURE__ */ new Set(),
|
|
3415
|
-
owner: /* @__PURE__ */ new Map()
|
|
3416
|
-
};
|
|
3417
|
-
const pathParamNames = extractPathParamNames(definition.path);
|
|
3418
|
-
const paramsDetails = definition.schemas?.params ? readObjectSchema(definition.schemas.params, warnings, `${label} params`, "input") : void 0;
|
|
3419
|
-
if (paramsDetails) mergeProperties(merged, paramsDetails.properties, paramsDetails.required, "params", warnings);
|
|
3420
|
-
const supplements = Object.create(null);
|
|
3421
|
-
const supplementRequired = /* @__PURE__ */ new Set();
|
|
3422
|
-
for (const name of pathParamNames) {
|
|
3423
|
-
if (merged.owner.has(name)) continue;
|
|
3424
|
-
supplements[name] = { type: "string" };
|
|
3425
|
-
supplementRequired.add(name);
|
|
3426
|
-
}
|
|
3427
|
-
mergeProperties(merged, supplements, supplementRequired, "path", warnings);
|
|
3428
|
-
const queryDetails = definition.schemas?.query ? readObjectSchema(definition.schemas.query, warnings, `${label} query`, "input") : void 0;
|
|
3429
|
-
if (queryDetails) mergeProperties(merged, queryDetails.properties, queryDetails.required, "query", warnings);
|
|
3430
|
-
let nestedBody = false;
|
|
3431
|
-
const body = definition.schemas?.body ? toJsonSchema(definition.schemas.body, warnings, `${label} body`, "input") : void 0;
|
|
3432
|
-
if (body) {
|
|
3433
|
-
if (body.type === "object" && body.properties) mergeProperties(merged, body.properties, new Set(body.required ?? []), "body", warnings);
|
|
3434
|
-
else {
|
|
3435
|
-
mergeProperties(merged, { body }, /* @__PURE__ */ new Set(["body"]), "body", warnings);
|
|
3436
|
-
nestedBody = true;
|
|
3437
|
-
}
|
|
3438
|
-
}
|
|
3439
|
-
for (const name of pathParamNames) if (name in merged.properties) merged.required.add(name);
|
|
3440
|
-
const required = Array.from(merged.required);
|
|
3441
|
-
const sources = Object.create(null);
|
|
3442
|
-
for (const [name, source] of merged.owner) sources[name] = source;
|
|
3443
|
-
return {
|
|
3444
|
-
schema: {
|
|
3445
|
-
type: "object",
|
|
3446
|
-
properties: { ...merged.properties },
|
|
3447
|
-
...required.length > 0 ? { required } : {}
|
|
3448
|
-
},
|
|
3449
|
-
sources: { ...sources },
|
|
3450
|
-
nestedBody
|
|
3451
|
-
};
|
|
3452
|
-
}
|
|
3453
|
-
/**
|
|
3454
|
-
* Fold one source's properties into the merge. A collision replaces both the
|
|
3455
|
-
* property *and* its required-ness — carrying a losing source's `required`
|
|
3456
|
-
* forward would demand a key the advertised schema does not describe.
|
|
3457
|
-
*/
|
|
3458
|
-
function mergeProperties(merged, properties, required, source, warnings) {
|
|
3459
|
-
for (const [name, schema] of Object.entries(properties)) {
|
|
3460
|
-
const previous = merged.owner.get(name);
|
|
3461
|
-
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.`);
|
|
3462
|
-
merged.properties[name] = schema;
|
|
3463
|
-
merged.owner.set(name, source);
|
|
3464
|
-
merged.required.delete(name);
|
|
3465
|
-
if (required.has(name)) merged.required.add(name);
|
|
3466
|
-
}
|
|
3467
|
-
}
|
|
3468
|
-
/**
|
|
3469
|
-
* The route's `output` schema — the only response shape validated at runtime,
|
|
3470
|
-
* so advertising it costs no new machinery. A `resource` hint is the next rung
|
|
3471
|
-
* of RFC 0016's ladder and is CLI-only: the type text behind its class names
|
|
3472
|
-
* exists solely in the CLI's AST extraction.
|
|
3473
|
-
*/
|
|
3474
|
-
function buildOutputSchema(definition, method, warnings) {
|
|
3475
|
-
const output = definition.schemas?.output;
|
|
3476
|
-
if (!output) return void 0;
|
|
3477
|
-
return toJsonSchema(output, warnings, `${method} ${definition.path} response`, "output");
|
|
3478
|
-
}
|
|
3479
|
-
/**
|
|
3480
|
-
* The ability a route's middleware chain checks, when the stamped capability
|
|
3481
|
-
* says so unambiguously (RFC 0007's `MiddlewareCapabilities.authorization`).
|
|
3482
|
-
* Everything else is omitted rather than guessed, so absence means
|
|
3483
|
-
* "undetermined" — which is what lets `guren check`'s "authn is not authz" rule
|
|
3484
|
-
* fail closed on it instead of reading a name that was never checked.
|
|
3485
|
-
*/
|
|
3486
|
-
function deriveAuthorization(definition, method) {
|
|
3487
|
-
const authorization = definition.capabilities?.authorization;
|
|
3488
|
-
if (!authorization) return void 0;
|
|
3489
|
-
if (authorization.resource) {
|
|
3490
|
-
if (!authorization.resource.fromMethodMap) return void 0;
|
|
3491
|
-
if (authorization.abilities.length > 0 || authorization.mode !== "all") return void 0;
|
|
3492
|
-
const ability = resourceAbilityForMethod(method);
|
|
3493
|
-
return ability ? { ability } : void 0;
|
|
3494
|
-
}
|
|
3495
|
-
if (authorization.abilities.length === 1 && authorization.mode === "all") return { ability: authorization.abilities[0] };
|
|
3496
|
-
}
|
|
3497
|
-
//#endregion
|
|
3498
3958
|
//#region src/agent/meta-tools.ts
|
|
3499
3959
|
/**
|
|
3500
3960
|
* The names a protocol adapter may add to an application's tool catalogue on
|
|
@@ -7502,4 +7962,4 @@ function defineStorageConfig(resolve) {
|
|
|
7502
7962
|
//#region src/index.ts
|
|
7503
7963
|
ensureErrorStackTracePolyfill();
|
|
7504
7964
|
//#endregion
|
|
7505
|
-
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, 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, 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 };
|
|
7965
|
+
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 };
|