@guren/server 2.33.0 → 2.34.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/{Gate-COWQbA96.js → Gate-C252SwRR.js} +13 -5
- package/dist/{McpServiceProvider-BDDr-7lh.js → McpServiceProvider-CXOokGax.js} +1 -1
- package/dist/{Resource-LQT1L4j0.js → Resource-BBKaFgXf.js} +41 -30
- package/dist/agent/scopes.d.ts +7 -0
- package/dist/{api-token-BbgDEd6j.js → api-token-DJcqSybf.js} +186 -1
- package/dist/auth/AuthManager.d.ts +4 -1
- package/dist/auth/TokenGuard.d.ts +4 -1
- package/dist/auth/api-token.d.ts +11 -1
- package/dist/auth/index.js +2 -2
- package/dist/{auth-DRMeSwev.js → auth-Bj9uEHuC.js} +15 -23
- package/dist/authorization/Gate.d.ts +5 -4
- package/dist/authorization/index.js +2 -2
- package/dist/{authorization-DEHuBps5.js → authorization-C81TXOWD.js} +1 -1
- package/dist/broadcasting/index.js +1 -1
- package/dist/{broadcasting-CcevVE5Y.js → broadcasting-3pvO94xV.js} +2 -1
- package/dist/{dev-banner-CSjrSNZi.js → dev-banner-B_QaY29h.js} +1 -1
- package/dist/errors/ExceptionHandler.d.ts +2 -1
- package/dist/errors/debug-page.d.ts +1 -1
- package/dist/errors/redact-query-params.d.ts +16 -0
- package/dist/health/index.js +1 -1
- package/dist/{health-Bg0Xj3aD.js → health-Wi_05kkf.js} +2 -1
- package/dist/http/Application.d.ts +12 -0
- package/dist/index.js +54 -139
- package/dist/internal/agent-principal.d.ts +12 -3
- package/dist/internal/redact-query-params.d.ts +1 -0
- package/dist/internal/redact-query-params.js +2 -0
- package/dist/internal/testing.d.ts +2 -1
- package/dist/internal/testing.js +2 -2
- package/dist/lambda/index.js +3 -2
- package/dist/mcp/index.js +1 -1
- package/dist/mvc/Controller.d.ts +5 -5
- package/dist/mvc/inertia/InertiaEngine.d.ts +6 -0
- package/dist/notifications/index.js +1 -1
- package/dist/{notifications-R7Uj-aT7.js → notifications-DV5Yr6Fl.js} +2 -1
- package/dist/queue/index.js +1 -1
- package/dist/{queue-CO07wib_.js → queue-K4Bi6NRy.js} +17 -11
- package/dist/redact-query-params-Ba-sAfcP.js +106 -0
- package/dist/runtime/index.js +1 -1
- package/dist/{runtime-error-capture-DzllKc0d.js → runtime-error-capture-DLRXwp0d.js} +2 -2
- package/dist/{runtime-errors-D229wyoc.js → runtime-errors-Dh7nA2-p.js} +1 -1
- package/dist/scheduling/index.js +1 -1
- package/dist/{scheduling-DNV5tj44.js → scheduling-iLkx4gID.js} +2 -1
- package/dist/support/default-headers.d.ts +6 -0
- package/package.json +5 -1
|
@@ -1,3 +1,3 @@
|
|
|
1
|
-
import { a as withAuthorization, n as authorizeMiddleware, o as Policy, r as authorizeResourceMiddleware, s as definePolicy, t as authorizeAllMiddleware } from "../authorization-
|
|
2
|
-
import { a as cannot, f as setGate, i as can, l as getGate, n as Response, o as createGate, r as authorize, s as defineGate, t as Gate, u as isAuthorizationResponse } from "../Gate-
|
|
1
|
+
import { a as withAuthorization, n as authorizeMiddleware, o as Policy, r as authorizeResourceMiddleware, s as definePolicy, t as authorizeAllMiddleware } from "../authorization-C81TXOWD.js";
|
|
2
|
+
import { a as cannot, f as setGate, i as can, l as getGate, n as Response, o as createGate, r as authorize, s as defineGate, t as Gate, u as isAuthorizationResponse } from "../Gate-C252SwRR.js";
|
|
3
3
|
export { Gate, Policy, Response, authorize, authorizeAllMiddleware, authorizeMiddleware, authorizeResourceMiddleware, can, cannot, createGate, defineGate, definePolicy, getGate, isAuthorizationResponse, setGate, withAuthorization };
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { r as tryGetRequestContainer } from "./request-container-BbuH0JJy.js";
|
|
2
|
-
import { c as denialToException, d as resolveGate, n as Response, p as AuthorizationException } from "./Gate-
|
|
2
|
+
import { c as denialToException, d as resolveGate, n as Response, p as AuthorizationException } from "./Gate-C252SwRR.js";
|
|
3
3
|
//#region src/http/middleware/capabilities.ts
|
|
4
4
|
/**
|
|
5
5
|
* Internal security-capability marker (RFC 0007): built-in middleware
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
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-
|
|
1
|
+
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-3pvO94xV.js";
|
|
2
2
|
export { BroadcastManager, Channel, MemoryDriver, PresenceChannel, PrivateChannel, RedisDriver, createBroadcastManager, createTypedBroadcaster, getBroadcastManager, setBroadcastManager };
|
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
import { a as parseRequestPayload, t as asRecord } from "./request-CLOYytGP.js";
|
|
2
2
|
import { g as warnDeprecatedSetter, h as warnDeprecatedGetter, i as bindAmbient, n as ambientBinding } from "./default-application-s9SE-Er7.js";
|
|
3
3
|
import { r as getAuthContext } from "./context-af2n5abO.js";
|
|
4
|
+
import { t as redactQueryParams } from "./redact-query-params-Ba-sAfcP.js";
|
|
4
5
|
import { n as isHotReloadRuntime, t as claimHotDisposable } from "./hot-disposables-W2fH-GID.js";
|
|
5
6
|
import { c as randomHex } from "./Random-S0OvCuR8.js";
|
|
6
7
|
//#region src/http/middleware/websocket-origin.ts
|
|
@@ -645,7 +646,7 @@ var BroadcastManager = class {
|
|
|
645
646
|
return;
|
|
646
647
|
}
|
|
647
648
|
const result = await this.authorizeAndAttach(channel, user, clientId).catch((error) => {
|
|
648
|
-
console.error(`Error authorizing broadcast channel "${channel}":`, error);
|
|
649
|
+
console.error(`Error authorizing broadcast channel "${channel}":`, redactQueryParams(error));
|
|
649
650
|
return { authorized: false };
|
|
650
651
|
});
|
|
651
652
|
await client.send("subscription", {
|
|
@@ -4,7 +4,7 @@ import chalk from "chalk";
|
|
|
4
4
|
import figlet from "figlet";
|
|
5
5
|
import standard from "figlet/importable-fonts/Standard.js";
|
|
6
6
|
//#region package.json
|
|
7
|
-
var version = "2.
|
|
7
|
+
var version = "2.34.0";
|
|
8
8
|
//#endregion
|
|
9
9
|
//#region src/http/dev-banner.ts
|
|
10
10
|
var dev_banner_exports = /* @__PURE__ */ __exportAll({
|
|
@@ -13,7 +13,8 @@ export declare class ExceptionHandler {
|
|
|
13
13
|
render<T extends Error>(errorClass: ExceptionClass<T>, renderer: ExceptionRenderer<T>): this;
|
|
14
14
|
dontReport(errorClass: ExceptionClass): this;
|
|
15
15
|
shouldShowDetails(): boolean;
|
|
16
|
-
|
|
16
|
+
/** Reporters and renderers receive the error with SQL bound parameters redacted. */
|
|
17
|
+
handle(thrown: Error, ctx: Context): Promise<Response>;
|
|
17
18
|
protected reportException(error: Error): Promise<void>;
|
|
18
19
|
protected shouldNotReport(error: Error): boolean;
|
|
19
20
|
protected matchesErrorClass(error: Error, errorClass: ExceptionClass): boolean;
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import type { MiddlewareHandler } from 'hono';
|
|
2
2
|
/** Development-only error page: exposes the stack trace and request details. */
|
|
3
|
-
export declare function renderDebugPage(
|
|
3
|
+
export declare function renderDebugPage(thrown: Error, request?: Request): string;
|
|
4
4
|
/**
|
|
5
5
|
* @deprecated since 2.30.0, removed in 3.0.0. The ExceptionHandler renders this
|
|
6
6
|
* page itself for a browser request while debug details are on. Hono hands a
|
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Strips SQL bound parameters out of an exception before anything prints it:
|
|
3
|
+
* drizzle's `DrizzleQueryError` writes `Failed query: <sql>\nparams: <values>`
|
|
4
|
+
* into its message and stack and keeps the values on `.params`, so a failed
|
|
5
|
+
* INSERT would hand a password hash to the 500 body, the debug page and the log.
|
|
6
|
+
* The shape is detected structurally, since the app may load its own drizzle.
|
|
7
|
+
*/
|
|
8
|
+
/**
|
|
9
|
+
* The value itself unless it is an error that, or whose cause chain, carries
|
|
10
|
+
* bound parameters; then a copy with the same prototype and own properties
|
|
11
|
+
* whose message, stack, parameter fields and causes are redacted. Being a copy,
|
|
12
|
+
* it carries no `#private` field a custom renderer or `toResponse()` reads.
|
|
13
|
+
*/
|
|
14
|
+
export declare function redactQueryParams<T>(error: T): T;
|
|
15
|
+
/** `error.message` with bound parameters redacted, for a log line that prints the message alone. */
|
|
16
|
+
export declare function redactedMessage(error: unknown): string | undefined;
|
package/dist/health/index.js
CHANGED
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
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-
|
|
1
|
+
import { a as CacheCheck, c as HealthManager, i as StorageCheck, l as createHealthManager, n as customCheck, o as RedisCheck, r as MemoryCheck, s as DatabaseCheck, t as CustomCheck, u as HealthCheck } from "../health-Wi_05kkf.js";
|
|
2
2
|
export { CacheCheck, CustomCheck, DatabaseCheck, HealthCheck, HealthManager, MemoryCheck, RedisCheck, StorageCheck, createHealthManager, customCheck };
|
|
@@ -1,3 +1,4 @@
|
|
|
1
|
+
import { n as redactedMessage } from "./redact-query-params-Ba-sAfcP.js";
|
|
1
2
|
//#region src/health/HealthCheck.ts
|
|
2
3
|
var HealthCheck = class {
|
|
3
4
|
healthy(message, meta) {
|
|
@@ -110,7 +111,7 @@ var HealthManager = class {
|
|
|
110
111
|
return {
|
|
111
112
|
name: check.name,
|
|
112
113
|
status: "unhealthy",
|
|
113
|
-
message: error
|
|
114
|
+
message: redactedMessage(error) ?? "Check failed with error",
|
|
114
115
|
duration
|
|
115
116
|
};
|
|
116
117
|
} finally {
|
|
@@ -158,6 +158,7 @@ export declare class Application {
|
|
|
158
158
|
private disposeBunTeardown?;
|
|
159
159
|
private autoSessionAttached;
|
|
160
160
|
private readonly cookielessAuthPaths;
|
|
161
|
+
private readonly agentEndpointPaths;
|
|
161
162
|
/** {@link configDefinitions} with where each was listed, which ConfigServiceProvider's errors name. */
|
|
162
163
|
readonly configEntries: ReadonlyArray<ConfiguredDefinition>;
|
|
163
164
|
private routeRegistration?;
|
|
@@ -188,6 +189,17 @@ export declare class Application {
|
|
|
188
189
|
declareCookielessAuthPath(path: string): void;
|
|
189
190
|
/** Matched by exact path — see {@link declareCookielessAuthPath}. */
|
|
190
191
|
getCookielessAuthPaths(): ReadonlySet<string>;
|
|
192
|
+
/**
|
|
193
|
+
* Asserts that the endpoint at `path` judges `tool:` / `tools:` scopes itself,
|
|
194
|
+
* so a tools-only token authenticates there (through app-wide auth middleware
|
|
195
|
+
* in front of it) and nowhere else. Call from `boot`, after `mountRoutes()`.
|
|
196
|
+
* Only an app route at exactly this path is detected: a parameterised or
|
|
197
|
+
* wildcard route registered ahead of the endpoint would answer here unseen.
|
|
198
|
+
*/
|
|
199
|
+
declareAgentEndpoint(path: string): void;
|
|
200
|
+
/** Matched by exact pathname — see {@link declareAgentEndpoint}. */
|
|
201
|
+
getAgentEndpointPaths(): ReadonlySet<string>;
|
|
202
|
+
private routeAt;
|
|
191
203
|
mountRoutes(): Promise<void>;
|
|
192
204
|
/** Runs the registrars once; `introspect()` stops here, since mounting refuses an unregistered alias it reports. */
|
|
193
205
|
private registerRoutes;
|
package/dist/index.js
CHANGED
|
@@ -1,48 +1,49 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import { A as ensureErrorStackTracePolyfill, C as setInertiaDocument, D as defer, E as always, O as isAlwaysProp, a as renderDocument, b as inertia, c as getRequestLocale, d as mountModuleRoutes, f as definePlugin, g as shareInertiaProps, h as setInertiaSharedProps, i as Controller, k as isDeferredProp, l as getRequestTranslator, m as resolveSharedInertiaProps, n as Resource, o as LOCALE_CONTEXT_KEY, p as getInertiaSharedPropsResolver, r as collect, s as detectLocaleMiddleware, t as JsonResource, u as defineModule, w as setInertiaSsrRenderer } from "./Resource-BBKaFgXf.js";
|
|
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 derivableAbility, l as mergeCapabilities, n as authorizeMiddleware, o as Policy, r as authorizeResourceMiddleware, s as definePolicy, t as authorizeAllMiddleware, u as stampCapabilities } from "./authorization-
|
|
6
|
+
import { a as withAuthorization, c as capabilitiesOf, i as derivableAbility, l as mergeCapabilities, n as authorizeMiddleware, o as Policy, r as authorizeResourceMiddleware, s as definePolicy, t as authorizeAllMiddleware, u as stampCapabilities } from "./authorization-C81TXOWD.js";
|
|
7
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-DIUT1Yao.js";
|
|
11
11
|
import { n as detectServerlessRuntime, t as SERVERLESS_RUNTIME_LABELS } from "./serverless-D96rJb6x.js";
|
|
12
|
-
import { A as verifyOAuthState, B as ModelUserProvider, C as createGoogleOAuthProviderConfig, D as fetchOAuthUserProfile, E as exchangeOAuthCode, F as normalizeRedirectTarget, G as
|
|
12
|
+
import { A as verifyOAuthState, B as ModelUserProvider, C as createGoogleOAuthProviderConfig, D as fetchOAuthUserProfile, E as exchangeOAuthCode, F as normalizeRedirectTarget, G as MemorySessionStore, H as NodeHasher, I as AuthManager, J as getSessionFromContext, K as createSessionMiddleware, L as DEFAULT_PROVIDER, M as jsonResponse, N as hostMatchesAllowlist, O as parseOAuthRedirectUrl, P as isAppRelativePath, R as TokenGuard, S as createGitHubOAuthProviderConfig, T as createOAuthState, U as ScryptHasher, V as DefaultHasher, W as BaseUserProvider, _ as OAUTH_SESSION_BINDING_KEY, a as isEmailVerified, b as buildOAuthRedirectUrl, c as verifyEmailToken, d as completePasswordReset, f as createPasswordResetToken, g as MemoryOAuthStateStore, h as AuthenticatableModel, i as createEmailVerificationToken, j as defineMiddleware, k as sanitizeOAuthRedirect, l as MemoryPasswordResetStore, m as verifyPasswordResetToken, n as buildVerificationUrl, o as parseVerificationUrl, p as parsePasswordResetUrl, q as defaultCookieSecure, r as completeEmailVerification, s as requireVerifiedEmail, t as MemoryEmailVerificationStore, u as buildPasswordResetUrl, v as OAuthManager, w as createOAuthManager, x as createDiscordOAuthProviderConfig, y as buildOAuthAuthorizeUrl, z as SessionGuard } from "./auth-Bj9uEHuC.js";
|
|
13
13
|
import { t as resolveOptional } from "./resolve-optional-ax6gPWTp.js";
|
|
14
14
|
import { t as warnOnce } from "./warn-once-p-IlMjra.js";
|
|
15
15
|
import { a as defaultApplication, c as resolve, d as createContainer, f as getContainer, g as warnDeprecatedSetter, h as warnDeprecatedGetter, i as bindAmbient, l as useAsDefaultApplication, m as warnDeprecated, n as ambientBinding, o as defaultContainer, p as setContainer, r as ambientContainer, s as resetDefaultApplication, t as adoptDefaultApplication, u as Container } from "./default-application-s9SE-Er7.js";
|
|
16
16
|
import { n as ServiceProvider, t as ProviderManager } from "./ServiceProvider-G0YclITd.js";
|
|
17
|
+
import { C as scopesAllowTool, M as markAgentDispatch, N as readAgentPrincipal, S as parseToolScope, _ as tokenCanAny, a as getApiToken, b as classifyRegistrationScope, c as hasBearerHeader, d as revokeAllApiTokens, f as revokeApiToken, g as tokenCanAll, h as tokenCan, i as createBearerTokenMiddleware, j as installAgentPrincipal, l as parseApiToken, n as MemoryApiTokenStore, o as getApiTokenOrFail, r as createApiToken, s as getUserApiTokens, t as API_TOKEN_KEY, u as readBearerToken, v as verifyApiToken, x as expandToolScopes, y as AGENT_TOOL_NAME_PATTERN } from "./api-token-DJcqSybf.js";
|
|
17
18
|
import { o as AuthenticationException, r as getAuthContext, t as AUTH_CONTEXT_KEY } from "./context-af2n5abO.js";
|
|
18
19
|
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
|
-
import {
|
|
20
|
+
import { t as redactQueryParams } from "./redact-query-params-Ba-sAfcP.js";
|
|
21
|
+
import { n as getRequestContainer, r as tryGetRequestContainer, t as CONTAINER_CONTEXT_KEY } from "./request-container-BbuH0JJy.js";
|
|
20
22
|
import { a as runInRequestScope, i as keepAlive, n as filterSensitiveData, t as Logger } from "./Logger-DWXdtLSJ.js";
|
|
21
23
|
import { a as RedisStore, i as FileStore, n as createCacheManager, o as MemoryStore, r as TaggedCache, s as resolveLazyRedisClient, t as CacheManager } from "./cache-Bi5U8N5P.js";
|
|
22
24
|
import { n as createRedisClient, r as RedisSessionStore } from "./client-C5Wj9P9o.js";
|
|
23
|
-
import { c as isDevCenterFeedbackRequest, i as loadRuntimeErrorsModule, l as isMcpEndpointEnabled, r as captureRuntimeError, t as RUNTIME_ERRORS_BINDING } from "./runtime-error-capture-
|
|
25
|
+
import { c as isDevCenterFeedbackRequest, i as loadRuntimeErrorsModule, l as isMcpEndpointEnabled, r as captureRuntimeError, t as RUNTIME_ERRORS_BINDING } from "./runtime-error-capture-DLRXwp0d.js";
|
|
24
26
|
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-
|
|
27
|
+
import { a as setBroadcastManager, c as PresenceChannel, d as createWebSocketOriginGuard, i as getBroadcastManager, l as PrivateChannel, n as BroadcastManager, o as RedisDriver, r as createBroadcastManager, s as MemoryDriver, t as createTypedBroadcaster, u as Channel } from "./broadcasting-3pvO94xV.js";
|
|
26
28
|
import { c as tc, d as Translator, f as getPluralizationRule, i as getI18n, l as tryGetI18n, m as selectPluralForm, n as I18nManager, o as setI18n, p as pluralizationRules, r as createI18n, s as t, t as MemoryLoader, u as JsonLoader } from "./i18n-BShPpJZa.js";
|
|
27
|
-
import { n as getRequestContainer, r as tryGetRequestContainer, t as CONTAINER_CONTEXT_KEY } from "./request-container-BbuH0JJy.js";
|
|
28
29
|
import { n as isAgentToolRequest } from "./agent-request-Caj6bnbj.js";
|
|
29
|
-
import { a as cannot, f as setGate, i as can, l as getGate, n as Response$1, o as createGate, p as AuthorizationException, r as authorize, s as defineGate, t as Gate } from "./Gate-
|
|
30
|
+
import { a as cannot, f as setGate, i as can, l as getGate, n as Response$1, o as createGate, p as AuthorizationException, r as authorize, s as defineGate, t as Gate } from "./Gate-C252SwRR.js";
|
|
30
31
|
import { r as isDocsViewerEnabled } from "./endpoint-CTIzcagh.js";
|
|
31
32
|
import { n as isWildcardHost, t as formatHostPort } from "./host-port-t6wQFaRu.js";
|
|
32
33
|
import { C as stopBunServerBounded, S as stopActiveViteDevServer, _ as registerBunTeardown, b as setActiveBunServer, c as isViteProduction, d as startViteDevServer, g as hotReloadStopBound, h as getGlobalState, i as clientManifestCandidates, l as loadViteManifest, m as closeOwnedViteDevServer, n as INJECTED_CLIENT_MANIFEST_SOURCE, o as getManifestFile, p as adoptViteDevServer, r as PUBLIC_ASSETS_URL_PREFIX, s as injectedClientManifest, u as normalizeDevServerUrl, v as releaseActiveBunServer, x as stopActiveBunServer, y as reusableActiveViteDevServer } from "./vite-manifest-DO0pU1vm.js";
|
|
33
34
|
import { readObjectSchema, toJsonSchema } from "./internal/zod-json-schema.js";
|
|
34
35
|
import { a as RequestFinished, c as UserLoggedOut, d as EventManager, f as createEventManager, i as JobProcessed, l as createQueueEventDispatcher, n as ApplicationStarted, o as RequestReceived, p as Event, r as JobFailed, s as UserAuthenticated, t as ApplicationShutdown, u as Listener } from "./events-B6gfJkCH.js";
|
|
35
|
-
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-
|
|
36
|
+
import { a as NotificationManager, c as setNotificationManager, d as getNotification, f as registerNotification, i as MailChannel, l as resolveNotifiableType, n as SlackChannel, o as createNotificationManager, p as Notification, r as DatabaseChannel, s as getNotificationManager, t as MemoryChannel, u as clearNotificationRegistry } from "./notifications-DV5Yr6Fl.js";
|
|
36
37
|
import { a as getJob, d as resolveQueueDriver, f as setQueueDriver, l as registerJob, n as clearJobRegistry, o as getQueueDriver, r as clearQueueDriver, s as getRegisteredJobs, t as Job, u as resolveJobName } from "./Job-0Prk8k0z.js";
|
|
37
|
-
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-
|
|
38
|
+
import { a as processJob, c as RedisDriver$1, i as Worker, l as SyncDriver, n as createQueueManager, o as SqsDriver, r as FailedJobReporter, s as createSqsAdapter, t as QueueManager, u as MemoryDriver$1 } from "./queue-K4Bi6NRy.js";
|
|
38
39
|
import { a as MailManager, c as MemoryTransport, i as setMailManager, l as ResendTransport, n as getMailManager, o as createMailManager, r as mail, s as LogTransport, t as Mail, u as SmtpTransport } from "./mail-BQ2y2U5c.js";
|
|
39
40
|
import { a as LOG_LEVEL_PRIORITY, i as matchDailyFileDate, n as dailyFileDateStamp, r as dailyFilePath, t as DailyFileChannel } from "./DailyFileChannel-CTTPA0EF.js";
|
|
40
41
|
import { a as FileChannel, i as setLogManager, n as createLogManager, o as ConsoleChannel, r as getLogManager, t as LogManager } from "./logging-Br9bZlaG.js";
|
|
41
42
|
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";
|
|
42
43
|
import { a as decrypt, c as getEncrypter, i as createEncrypter, l as setEncrypter, n as verifySignedUrl, o as encrypt, r as Encrypter, s as generateKey, t as signUrl } from "./encryption-BS-FGkqS.js";
|
|
43
44
|
import { a as LocalDriver, i as S3Driver, n as createStorageManager, r as MemoryDriver$2, t as StorageManager } from "./storage-YPbsV9ju.js";
|
|
44
|
-
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-
|
|
45
|
-
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-
|
|
45
|
+
import { a as CacheCheck, c as HealthManager, i as StorageCheck, l as createHealthManager, n as customCheck, o as RedisCheck, r as MemoryCheck, s as DatabaseCheck, t as CustomCheck, u as HealthCheck } from "./health-Wi_05kkf.js";
|
|
46
|
+
import { a as ScheduledTask, c as isDue, d as parseCron, f as toTimezone, i as Schedule, l as isDueInTimezone, n as createScheduler, o as getNextOccurrence, p as MemorySchedulerLock, r as PendingSchedule, s as getNextOccurrences, t as Scheduler, u as matchesCron } from "./scheduling-iLkx4gID.js";
|
|
46
47
|
import { Hono } from "hono";
|
|
47
48
|
import { deleteCookie, getCookie } from "hono/cookie";
|
|
48
49
|
import { createCipheriv, createDecipheriv, randomBytes } from "node:crypto";
|
|
@@ -2145,7 +2146,7 @@ function renderErrorPage(statusCode, message) {
|
|
|
2145
2146
|
--g-accent: #db1b1b; --g-accent-down: #b91c1c; --g-on-accent: #fff5f5;
|
|
2146
2147
|
}
|
|
2147
2148
|
@media (prefers-color-scheme: dark) {
|
|
2148
|
-
:root { color-scheme: dark; --g-page: #1a1a2e; --g-heading: #e0def4; --g-text-2: #
|
|
2149
|
+
:root { color-scheme: dark; --g-page: #1a1a2e; --g-heading: #e0def4; --g-text-2: #aeabc9; --g-line-strong: #3d3d5c; }
|
|
2149
2150
|
}
|
|
2150
2151
|
* { margin: 0; padding: 0; box-sizing: border-box; }
|
|
2151
2152
|
body {
|
|
@@ -2213,7 +2214,8 @@ const STATUS_DESCRIPTIONS = {
|
|
|
2213
2214
|
//#endregion
|
|
2214
2215
|
//#region src/errors/debug-page.ts
|
|
2215
2216
|
/** Development-only error page: exposes the stack trace and request details. */
|
|
2216
|
-
function renderDebugPage(
|
|
2217
|
+
function renderDebugPage(thrown, request) {
|
|
2218
|
+
const error = redactQueryParams(thrown);
|
|
2217
2219
|
const errorName = error.name || "Error";
|
|
2218
2220
|
const errorMessage = escapeHtml(error.message || "An unknown error occurred");
|
|
2219
2221
|
const stackFrames = parseStackTrace(error.stack ?? "");
|
|
@@ -2234,7 +2236,7 @@ function renderDebugPage(error, request) {
|
|
|
2234
2236
|
--g-font-sans: 'Noto Sans JP', ui-sans-serif, system-ui, -apple-system, "Segoe UI", sans-serif;
|
|
2235
2237
|
--g-font-mono: 'JetBrains Mono', ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
|
|
2236
2238
|
--g-page: #ffffff; --g-panel: #ffffff; --g-raised: #fffafa; --g-line: #e5e7eb; --g-line-strong: #d1d5db;
|
|
2237
|
-
--g-heading: #111827; --g-text: #1f2937; --g-text-2: #4b5563; --g-muted: #
|
|
2239
|
+
--g-heading: #111827; --g-text: #1f2937; --g-text-2: #4b5563; --g-muted: #6b7280;
|
|
2238
2240
|
--g-danger: #b91c1c; --g-danger-chip: #f23a3a; --g-danger-tint: #fff1f2; --g-accent: #db1b1b;
|
|
2239
2241
|
--g-shadow-card: 0 4px 6px -1px rgba(0, 0, 0, 0.05), 0 2px 4px -1px rgba(0, 0, 0, 0.03);
|
|
2240
2242
|
}
|
|
@@ -2242,7 +2244,7 @@ function renderDebugPage(error, request) {
|
|
|
2242
2244
|
:root {
|
|
2243
2245
|
color-scheme: dark;
|
|
2244
2246
|
--g-page: #1a1a2e; --g-panel: #1e1e34; --g-raised: #232340; --g-line: #2e2e4a; --g-line-strong: #3d3d5c;
|
|
2245
|
-
--g-heading: #e0def4; --g-text: #e0def4; --g-text-2: #
|
|
2247
|
+
--g-heading: #e0def4; --g-text: #e0def4; --g-text-2: #aeabc9; --g-muted: #8d89a7;
|
|
2246
2248
|
--g-danger: #ffa5a5; --g-danger-tint: rgba(242, 58, 58, 0.12);
|
|
2247
2249
|
--g-shadow-card: 0 4px 6px -1px rgba(0, 0, 0, 0.3), 0 2px 4px -1px rgba(0, 0, 0, 0.2);
|
|
2248
2250
|
}
|
|
@@ -2527,7 +2529,9 @@ var ExceptionHandler = class {
|
|
|
2527
2529
|
if (this.options.debug !== void 0) return this.options.debug;
|
|
2528
2530
|
return process.env.NODE_ENV !== "production";
|
|
2529
2531
|
}
|
|
2530
|
-
|
|
2532
|
+
/** Reporters and renderers receive the error with SQL bound parameters redacted. */
|
|
2533
|
+
async handle(thrown, ctx) {
|
|
2534
|
+
const error = redactQueryParams(thrown);
|
|
2531
2535
|
if (!this.shouldNotReport(error)) captureRuntimeError(error, ctx, resolveExceptionStatus(error));
|
|
2532
2536
|
await this.reportException(error);
|
|
2533
2537
|
return this.renderException(error, ctx);
|
|
@@ -2538,7 +2542,7 @@ var ExceptionHandler = class {
|
|
|
2538
2542
|
for (const reporter of this.reporters) try {
|
|
2539
2543
|
await reporter(error);
|
|
2540
2544
|
} catch (reporterError) {
|
|
2541
|
-
console.error("Exception reporter failed:", reporterError);
|
|
2545
|
+
console.error("Exception reporter failed:", redactQueryParams(reporterError));
|
|
2542
2546
|
}
|
|
2543
2547
|
}
|
|
2544
2548
|
shouldNotReport(error) {
|
|
@@ -3565,7 +3569,7 @@ let devBanner;
|
|
|
3565
3569
|
*/
|
|
3566
3570
|
async function loadDevBanner() {
|
|
3567
3571
|
if (typeof process === "undefined") return devBanner;
|
|
3568
|
-
if (process.env.NODE_ENV !== "production") devBanner ??= await import("./dev-banner-
|
|
3572
|
+
if (process.env.NODE_ENV !== "production") devBanner ??= await import("./dev-banner-B_QaY29h.js").then((n) => n.n);
|
|
3569
3573
|
return devBanner;
|
|
3570
3574
|
}
|
|
3571
3575
|
/**
|
|
@@ -3594,6 +3598,7 @@ var Application = class {
|
|
|
3594
3598
|
disposeBunTeardown;
|
|
3595
3599
|
autoSessionAttached = false;
|
|
3596
3600
|
cookielessAuthPaths = /* @__PURE__ */ new Set();
|
|
3601
|
+
agentEndpointPaths = /* @__PURE__ */ new Set();
|
|
3597
3602
|
/** {@link configDefinitions} with where each was listed, which ConfigServiceProvider's errors name. */
|
|
3598
3603
|
configEntries;
|
|
3599
3604
|
routeRegistration;
|
|
@@ -3617,6 +3622,7 @@ var Application = class {
|
|
|
3617
3622
|
this.container = new Container();
|
|
3618
3623
|
this.router = new Router();
|
|
3619
3624
|
this.authManager = new AuthManager({ hasher: options.auth?.hasher });
|
|
3625
|
+
this.authManager.setAgentEndpoints(() => this.agentEndpointPaths);
|
|
3620
3626
|
this.providerManager = new ProviderManager(this.container);
|
|
3621
3627
|
this.mountSecurityDefaults();
|
|
3622
3628
|
this.container.instance("app", this);
|
|
@@ -3695,9 +3701,9 @@ var Application = class {
|
|
|
3695
3701
|
* after `mountRoutes()` — at `register` the collision check sees no routes.
|
|
3696
3702
|
*/
|
|
3697
3703
|
declareCookielessAuthPath(path) {
|
|
3698
|
-
const collision = this.
|
|
3704
|
+
const collision = this.routeAt(path);
|
|
3699
3705
|
if (collision) {
|
|
3700
|
-
console.warn(`[guren] Refusing to exempt "${path}" from CSRF verification: the application already routes ${collision
|
|
3706
|
+
console.warn(`[guren] Refusing to exempt "${path}" from CSRF verification: the application already routes ${collision}, which is registered first and answers there. Mount the declaring endpoint on a path of its own — as it stands it is unreachable, and exempting the path would disarm CSRF for the route that does answer.`);
|
|
3701
3707
|
return;
|
|
3702
3708
|
}
|
|
3703
3709
|
this.cookielessAuthPaths.add(path);
|
|
@@ -3706,6 +3712,29 @@ var Application = class {
|
|
|
3706
3712
|
getCookielessAuthPaths() {
|
|
3707
3713
|
return this.cookielessAuthPaths;
|
|
3708
3714
|
}
|
|
3715
|
+
/**
|
|
3716
|
+
* Asserts that the endpoint at `path` judges `tool:` / `tools:` scopes itself,
|
|
3717
|
+
* so a tools-only token authenticates there (through app-wide auth middleware
|
|
3718
|
+
* in front of it) and nowhere else. Call from `boot`, after `mountRoutes()`.
|
|
3719
|
+
* Only an app route at exactly this path is detected: a parameterised or
|
|
3720
|
+
* wildcard route registered ahead of the endpoint would answer here unseen.
|
|
3721
|
+
*/
|
|
3722
|
+
declareAgentEndpoint(path) {
|
|
3723
|
+
const collision = this.routeAt(path);
|
|
3724
|
+
if (collision) {
|
|
3725
|
+
console.warn(`[guren] Refusing to accept tools-only tokens at "${path}": the application already routes ${collision}, which is registered first and answers there and checks no tool scope.`);
|
|
3726
|
+
return;
|
|
3727
|
+
}
|
|
3728
|
+
this.agentEndpointPaths.add(path);
|
|
3729
|
+
}
|
|
3730
|
+
/** Matched by exact pathname — see {@link declareAgentEndpoint}. */
|
|
3731
|
+
getAgentEndpointPaths() {
|
|
3732
|
+
return this.agentEndpointPaths;
|
|
3733
|
+
}
|
|
3734
|
+
routeAt(path) {
|
|
3735
|
+
const route = this.router.definitions().find((definition) => definition.path === path);
|
|
3736
|
+
return route ? `${route.method} ${path}${route.name ? ` (${route.name})` : ""}` : void 0;
|
|
3737
|
+
}
|
|
3709
3738
|
async mountRoutes() {
|
|
3710
3739
|
await this.registerRoutes();
|
|
3711
3740
|
await this.preparePrototypeRoutes();
|
|
@@ -3801,7 +3830,7 @@ var Application = class {
|
|
|
3801
3830
|
this.bootSequence ??= new BootSequence([
|
|
3802
3831
|
() => this.options.boot?.(this.hono),
|
|
3803
3832
|
() => this.mountRoutes(),
|
|
3804
|
-
() => this.mountDevEndpoint(isMcpEndpointEnabled(), async () => (await import("./McpServiceProvider-
|
|
3833
|
+
() => this.mountDevEndpoint(isMcpEndpointEnabled(), async () => (await import("./McpServiceProvider-CXOokGax.js").then((n) => n.n)).McpServiceProvider, "GUREN_MCP=1 but the MCP endpoint could not load — is @guren/cli installed?"),
|
|
3805
3834
|
() => this.mountDevEndpoint(isDocsViewerEnabled(), async () => (await import("./DocsViewerServiceProvider-BVPZjwQp.js")).DocsViewerServiceProvider, "GUREN_DOCS=1 but the docs viewer could not load — is @guren/cli resolvable from this app?"),
|
|
3806
3835
|
() => this.providerManager.bootAll(),
|
|
3807
3836
|
() => this.warnOnUnconfiguredAuth()
|
|
@@ -4123,120 +4152,6 @@ function isReservedAgentToolName(name) {
|
|
|
4123
4152
|
return RESERVED_AGENT_TOOL_NAMES.includes(name);
|
|
4124
4153
|
}
|
|
4125
4154
|
//#endregion
|
|
4126
|
-
//#region src/agent/scopes.ts
|
|
4127
|
-
/**
|
|
4128
|
-
* The scope grammar an API token's `abilities` use to reach agent tools
|
|
4129
|
-
* (RFC 0016 §5.1). Four forms, so a human can read a scope on a consent screen:
|
|
4130
|
-
* `tool:<name>`, `tools:read` (every tool whose resolved `readOnlyHint` is
|
|
4131
|
-
* true), `tools:*`, `tools:<prefix>.*`. **Only `tool:` / `tools:` entries are
|
|
4132
|
-
* considered**, so the store's default `['*']` grants no tool (default deny). A
|
|
4133
|
-
* malformed entry is ignored, not thrown: this module judges an issued token and
|
|
4134
|
-
* must grant less, never more; rejecting belongs to the issuer, which refuses a
|
|
4135
|
-
* `null` from {@link parseToolScope}. Case-sensitive and untrimmed, for the same reason.
|
|
4136
|
-
*/
|
|
4137
|
-
/**
|
|
4138
|
-
* The MCP tool-name grammar (SEP-986), which a `tool:` scope names and a
|
|
4139
|
-
* `tools:<prefix>.*` scope must stay inside. `*` is not in the charset, so
|
|
4140
|
-
* `tool:posts.*` is rejected with no special case.
|
|
4141
|
-
*/
|
|
4142
|
-
const AGENT_TOOL_NAME_PATTERN = /^[A-Za-z0-9._-]{1,128}$/;
|
|
4143
|
-
/** `tool:` scope prefix, including the separator. */
|
|
4144
|
-
const SINGLE_PREFIX = "tool:";
|
|
4145
|
-
/** `tools:` scope prefix, including the separator. */
|
|
4146
|
-
const SET_PREFIX = "tools:";
|
|
4147
|
-
/** The reserved `tools:` word granting every read-only tool. */
|
|
4148
|
-
const READ_KEYWORD = "read";
|
|
4149
|
-
/** The reserved `tools:` word granting every tool. */
|
|
4150
|
-
const ALL_KEYWORD = "*";
|
|
4151
|
-
/** Wildcard suffix of a prefix scope, dot included. */
|
|
4152
|
-
const PREFIX_SUFFIX = ".*";
|
|
4153
|
-
/**
|
|
4154
|
-
* Parse one `abilities` entry. The two reserved `tools:` words are matched
|
|
4155
|
-
* before the wildcard form, so a family named `read.…` is still reachable as
|
|
4156
|
-
* `tools:read.*` while a tool named exactly `read` is only `tool:read`.
|
|
4157
|
-
* @returns The scope, or `null` for both a non-tool entry and a malformed one
|
|
4158
|
-
* (`tools:`, `tools:.*`, `tools:*.store`): both mean "grants no tool", on purpose.
|
|
4159
|
-
*/
|
|
4160
|
-
function parseToolScope(entry) {
|
|
4161
|
-
if (entry.startsWith(SINGLE_PREFIX)) {
|
|
4162
|
-
const name = entry.slice(5);
|
|
4163
|
-
return AGENT_TOOL_NAME_PATTERN.test(name) ? {
|
|
4164
|
-
kind: "tool",
|
|
4165
|
-
name
|
|
4166
|
-
} : null;
|
|
4167
|
-
}
|
|
4168
|
-
if (!entry.startsWith(SET_PREFIX)) return null;
|
|
4169
|
-
const rest = entry.slice(6);
|
|
4170
|
-
if (rest === READ_KEYWORD) return { kind: "read" };
|
|
4171
|
-
if (rest === ALL_KEYWORD) return { kind: "all" };
|
|
4172
|
-
if (!rest.endsWith(PREFIX_SUFFIX)) return null;
|
|
4173
|
-
const prefix = rest.slice(0, -2);
|
|
4174
|
-
if (!AGENT_TOOL_NAME_PATTERN.test(prefix)) return null;
|
|
4175
|
-
return {
|
|
4176
|
-
kind: "prefix",
|
|
4177
|
-
prefix
|
|
4178
|
-
};
|
|
4179
|
-
}
|
|
4180
|
-
/**
|
|
4181
|
-
* Judge one `scopes` entry of an agent registration.
|
|
4182
|
-
*
|
|
4183
|
-
* @param entry The scope as written in the config.
|
|
4184
|
-
*/
|
|
4185
|
-
function classifyRegistrationScope(entry) {
|
|
4186
|
-
const scope = parseToolScope(entry);
|
|
4187
|
-
if (scope?.kind === "tool" || scope?.kind === "read") return {
|
|
4188
|
-
allowed: true,
|
|
4189
|
-
scope
|
|
4190
|
-
};
|
|
4191
|
-
if (scope?.kind === "all") return {
|
|
4192
|
-
allowed: false,
|
|
4193
|
-
reason: "wildcard",
|
|
4194
|
-
message: `"${entry}" grants every tool the application has, including every tool it grows later. An unattended agent must not acquire consent to tools that did not exist when this was written. List the tools as tool:<name> entries, or use tools:read if the agent only reads.`
|
|
4195
|
-
};
|
|
4196
|
-
if (scope?.kind === "prefix") return {
|
|
4197
|
-
allowed: false,
|
|
4198
|
-
reason: "prefix",
|
|
4199
|
-
message: `"${entry}" grants every tool in the ${scope.prefix}.* family, including ones added later. An unattended agent must not acquire consent to tools that did not exist when this was written. List the tools it needs as tool:<name> entries.`
|
|
4200
|
-
};
|
|
4201
|
-
const suggestion = AGENT_TOOL_NAME_PATTERN.test(entry) ? ` Did you mean "tool:${entry}"?` : "";
|
|
4202
|
-
return {
|
|
4203
|
-
allowed: false,
|
|
4204
|
-
reason: "not-a-tool-scope",
|
|
4205
|
-
message: `"${entry}" is not a tool scope, so it grants nothing. The registration grammar is tool:<name> for one tool by exact name, or tools:read for every read-only tool.` + suggestion
|
|
4206
|
-
};
|
|
4207
|
-
}
|
|
4208
|
-
/** Whether one parsed scope covers a given tool. */
|
|
4209
|
-
function scopeAllowsTool(scope, tool) {
|
|
4210
|
-
switch (scope.kind) {
|
|
4211
|
-
case "tool": return scope.name === tool.name;
|
|
4212
|
-
case "read": return tool.readOnly;
|
|
4213
|
-
case "all": return true;
|
|
4214
|
-
case "prefix": return tool.name.startsWith(`${scope.prefix}.`);
|
|
4215
|
-
default: return scope;
|
|
4216
|
-
}
|
|
4217
|
-
}
|
|
4218
|
-
/**
|
|
4219
|
-
* Whether a token's abilities grant a tool. Any one entry suffices — scopes
|
|
4220
|
-
* are additive, and there is no deny form.
|
|
4221
|
-
*/
|
|
4222
|
-
function scopesAllowTool(abilities, tool) {
|
|
4223
|
-
for (const entry of abilities) {
|
|
4224
|
-
const scope = parseToolScope(entry);
|
|
4225
|
-
if (scope && scopeAllowsTool(scope, tool)) return true;
|
|
4226
|
-
}
|
|
4227
|
-
return false;
|
|
4228
|
-
}
|
|
4229
|
-
/**
|
|
4230
|
-
* The concrete tool names a token's abilities grant, for the surfaces that show
|
|
4231
|
-
* a human what a scope means: the OAuth consent screen, the `token:issue`
|
|
4232
|
-
* confirmation, the issuance-time lint. Literally a filter over
|
|
4233
|
-
* {@link scopesAllowTool}, and it must stay one: a second matcher is how a
|
|
4234
|
-
* consent screen comes to list a tool the dispatcher then denies. Order of `tools`.
|
|
4235
|
-
*/
|
|
4236
|
-
function expandToolScopes(abilities, tools) {
|
|
4237
|
-
return tools.filter((tool) => scopesAllowTool(abilities, tool)).map((tool) => tool.name);
|
|
4238
|
-
}
|
|
4239
|
-
//#endregion
|
|
4240
4155
|
//#region src/agent/events.ts
|
|
4241
4156
|
/**
|
|
4242
4157
|
* The audit trail of the agent surface (RFC 0016 §5.2): every tool invocation
|
|
@@ -5072,10 +4987,10 @@ function createAgentInvocationPipeline(options) {
|
|
|
5072
4987
|
outcome
|
|
5073
4988
|
};
|
|
5074
4989
|
}
|
|
5075
|
-
const request = options.handoff === "seam" && options.principal ? installAgentPrincipal(built.request, {
|
|
4990
|
+
const request = markAgentDispatch(options.handoff === "seam" && options.principal ? installAgentPrincipal(built.request, {
|
|
5076
4991
|
principal: options.principal,
|
|
5077
4992
|
abilities: options.abilities
|
|
5078
|
-
}) : built.request;
|
|
4993
|
+
}) : built.request);
|
|
5079
4994
|
const outcome = await mapToolResponse(tool, await options.app.fetch(request, options.env, options.executionCtx));
|
|
5080
4995
|
record.invoked(audited, auditArgs, outcome.status, elapsed(startedAt));
|
|
5081
4996
|
return {
|
|
@@ -6869,7 +6784,7 @@ var Command = class {
|
|
|
6869
6784
|
const result = await this.handle();
|
|
6870
6785
|
return typeof result === "number" ? result : 0;
|
|
6871
6786
|
} catch (error) {
|
|
6872
|
-
if (error instanceof Error) this.error(error.message);
|
|
6787
|
+
if (error instanceof Error) this.error(redactQueryParams(error).message);
|
|
6873
6788
|
return 1;
|
|
6874
6789
|
}
|
|
6875
6790
|
}
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
/**
|
|
2
|
-
* The principal handoff seam (RFC 0017 §2)
|
|
3
|
-
* and the auth context reads — in either of
|
|
4
|
-
* whole layer. Keyed on the **object identity** of the `Request` handed to
|
|
2
|
+
* The principal handoff seam (RFC 0017 §2) and the scope-gated dispatch mark,
|
|
3
|
+
* a leaf module the pipeline writes and the auth context reads — in either of
|
|
4
|
+
* them, one would import the other's whole layer. Keyed on the **object identity** of the `Request` handed to
|
|
5
5
|
* `app.fetch`, so it has no wire representation to forge, needs no
|
|
6
6
|
* `AsyncLocalStorage` (identical on workerd and Bun), and is collected with the
|
|
7
7
|
* request. `new Request(original)` and `clone()` carry nothing: that is the
|
|
@@ -30,3 +30,12 @@ export interface InstalledAgentPrincipal {
|
|
|
30
30
|
export declare function installAgentPrincipal(request: Request, value: InstalledAgentPrincipal): Request;
|
|
31
31
|
/** The principal installed on this exact request object, or `undefined`. */
|
|
32
32
|
export declare function readAgentPrincipal(request: Request): InstalledAgentPrincipal | undefined;
|
|
33
|
+
/**
|
|
34
|
+
* Mark `request` as a tool call the pipeline scope-gated, returning that same
|
|
35
|
+
* object: a token granting only agent tools authenticates such a request and no
|
|
36
|
+
* other. Not `markDispatchedToolRequest()`, which `buildToolRequest` sets for
|
|
37
|
+
* un-gated callers too (`guren tool:call`, `TestApp.agent()`, plugin-webmcp).
|
|
38
|
+
*/
|
|
39
|
+
export declare function markAgentDispatch(request: Request): Request;
|
|
40
|
+
/** Whether the pipeline dispatched this exact request object. */
|
|
41
|
+
export declare function isAgentDispatch(request: Request): boolean;
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export { redactQueryParams, redactedMessage } from '../errors/redact-query-params.js';
|
|
@@ -7,7 +7,8 @@
|
|
|
7
7
|
*/
|
|
8
8
|
export { Controller } from '../mvc/Controller.js';
|
|
9
9
|
export type { InertiaPageContractLike, InertiaResponseOptions } from '../mvc/Controller.js';
|
|
10
|
-
export { acceptsJson, buildInertiaPage, INERTIA_VARY, serializePage } from '../mvc/inertia/InertiaEngine.js';
|
|
10
|
+
export { acceptsJson, buildInertiaPage, INERTIA_VARY, mergeInertiaVary, serializePage } from '../mvc/inertia/InertiaEngine.js';
|
|
11
|
+
export { withDefaultHeaders } from '../support/default-headers.js';
|
|
11
12
|
export { Resource, JsonResource, collect } from '../http/resources/Resource.js';
|
|
12
13
|
export { ValidationException } from '../errors/exceptions/ValidationException.js';
|
|
13
14
|
export { AuthenticationException } from '../errors/exceptions/AuthenticationException.js';
|
package/dist/internal/testing.js
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
|
-
import { _ as INERTIA_VARY, f as definePlugin, i as Controller, n as Resource, r as collect, t as JsonResource, u as defineModule, v as acceptsJson, x as
|
|
1
|
+
import { S as serializePage, T as withDefaultHeaders, _ as INERTIA_VARY, f as definePlugin, i as Controller, n as Resource, r as collect, t as JsonResource, u as defineModule, v as acceptsJson, x as mergeInertiaVary, y as buildInertiaPage } from "../Resource-BBKaFgXf.js";
|
|
2
2
|
import { r as formatValidationErrors } from "../request-CLOYytGP.js";
|
|
3
3
|
import { n as ValidationException } from "../errors-JpkcCjjn.js";
|
|
4
4
|
import { n as ServiceProvider } from "../ServiceProvider-G0YclITd.js";
|
|
5
5
|
import { o as AuthenticationException } from "../context-af2n5abO.js";
|
|
6
|
-
export { AuthenticationException, Controller, INERTIA_VARY, JsonResource, Resource, ServiceProvider, ValidationException, acceptsJson, buildInertiaPage, collect, defineModule, definePlugin, formatValidationErrors, serializePage };
|
|
6
|
+
export { AuthenticationException, Controller, INERTIA_VARY, JsonResource, Resource, ServiceProvider, ValidationException, acceptsJson, buildInertiaPage, collect, defineModule, definePlugin, formatValidationErrors, mergeInertiaVary, serializePage, withDefaultHeaders };
|
package/dist/lambda/index.js
CHANGED
|
@@ -1,4 +1,5 @@
|
|
|
1
1
|
import { n as detectServerlessRuntime } from "../serverless-D96rJb6x.js";
|
|
2
|
+
import { n as redactedMessage } from "../redact-query-params-Ba-sAfcP.js";
|
|
2
3
|
import { a as getJob } from "../Job-0Prk8k0z.js";
|
|
3
4
|
import { t as deserializeQueuedJob } from "../serialize-CKXek0Tr.js";
|
|
4
5
|
import { handle } from "hono/aws-lambda";
|
|
@@ -62,7 +63,7 @@ async function processSqsRecord(record) {
|
|
|
62
63
|
msg: "Error in job.failed() handler",
|
|
63
64
|
messageId: record.messageId,
|
|
64
65
|
job: job.name,
|
|
65
|
-
error: hookError
|
|
66
|
+
error: redactedMessage(hookError)
|
|
66
67
|
});
|
|
67
68
|
}
|
|
68
69
|
throw error;
|
|
@@ -75,7 +76,7 @@ async function processSqsRecord(record) {
|
|
|
75
76
|
queue: job?.queue,
|
|
76
77
|
attempt: job?.attempts,
|
|
77
78
|
maxAttempts: job?.maxAttempts,
|
|
78
|
-
error: error
|
|
79
|
+
error: redactedMessage(error)
|
|
79
80
|
});
|
|
80
81
|
throw error;
|
|
81
82
|
}
|
package/dist/mcp/index.js
CHANGED
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
import { t as McpServiceProvider } from "../McpServiceProvider-
|
|
1
|
+
import { t as McpServiceProvider } from "../McpServiceProvider-CXOokGax.js";
|
|
2
2
|
export { McpServiceProvider };
|
package/dist/mvc/Controller.d.ts
CHANGED
|
@@ -132,11 +132,11 @@ export declare class Controller {
|
|
|
132
132
|
/** Get the authenticated user ID from the API token. */
|
|
133
133
|
protected apiTokenUserId(): string | number;
|
|
134
134
|
/**
|
|
135
|
-
* Authorize the current user (or guest) for an ability; throws
|
|
136
|
-
*
|
|
137
|
-
*
|
|
138
|
-
*
|
|
139
|
-
*
|
|
135
|
+
* Authorize the current user (or guest) for an ability; throws AuthorizationException
|
|
136
|
+
* (403) when denied. An ORM record is a plain object, so pass its class beside it:
|
|
137
|
+
* `this.authorize('update', [Post, post])`; an ability with no record takes `Post`
|
|
138
|
+
* or `[Post]`. A bare record or another array that resolves no policy and no gate
|
|
139
|
+
* throws an Error rather than denying.
|
|
140
140
|
*/
|
|
141
141
|
protected authorize(ability: string, ...args: unknown[]): Promise<void>;
|
|
142
142
|
/** Check an ability, answering a denial with `false` rather than a 403: `await this.can('update', [Post, post])`. */
|
|
@@ -115,6 +115,12 @@ export interface InertiaRenderResult {
|
|
|
115
115
|
* partial response to the next full visit.
|
|
116
116
|
*/
|
|
117
117
|
export declare const INERTIA_VARY = "Accept, X-Inertia, X-Inertia-Partial-Component, X-Inertia-Partial-Data, X-Inertia-Partial-Except";
|
|
118
|
+
/**
|
|
119
|
+
* Adds each {@link INERTIA_VARY} token the response's `Vary` does not list yet, so a
|
|
120
|
+
* caller's own `Vary` extends the engine's rather than replacing it. `*` already
|
|
121
|
+
* varies on everything and is left alone.
|
|
122
|
+
*/
|
|
123
|
+
export declare function mergeInertiaVary(headers: Headers): Headers;
|
|
118
124
|
/**
|
|
119
125
|
* {@link inertia} plus the page it sent, for a caller that records the props
|
|
120
126
|
* actually resolved (`Controller.inertia()`'s response marker). The version
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
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-
|
|
1
|
+
import { a as NotificationManager, c as setNotificationManager, d as getNotification, f as registerNotification, i as MailChannel, l as resolveNotifiableType, n as SlackChannel, o as createNotificationManager, p as Notification, r as DatabaseChannel, s as getNotificationManager, t as MemoryChannel, u as clearNotificationRegistry } from "../notifications-DV5Yr6Fl.js";
|
|
2
2
|
export { DatabaseChannel, MailChannel, MemoryChannel, Notification, NotificationManager, SlackChannel, clearNotificationRegistry, createNotificationManager, getNotification, getNotificationManager, registerNotification, resolveNotifiableType, setNotificationManager };
|
|
@@ -1,4 +1,5 @@
|
|
|
1
1
|
import { g as warnDeprecatedSetter, h as warnDeprecatedGetter, i as bindAmbient, n as ambientBinding } from "./default-application-s9SE-Er7.js";
|
|
2
|
+
import { t as redactQueryParams } from "./redact-query-params-Ba-sAfcP.js";
|
|
2
3
|
import { l as registerJob, p as reportRegistryCollision, t as Job } from "./Job-0Prk8k0z.js";
|
|
3
4
|
import { t as parseMailAddress } from "./address-D0Iq-XIH.js";
|
|
4
5
|
//#region src/notifications/Notification.ts
|
|
@@ -136,7 +137,7 @@ var NotificationManager = class {
|
|
|
136
137
|
try {
|
|
137
138
|
await this.channel(channelName).send(notifiable, notification);
|
|
138
139
|
} catch (error) {
|
|
139
|
-
console.error(`Failed to send notification via ${channelName}:`, error);
|
|
140
|
+
console.error(`Failed to send notification via ${channelName}:`, redactQueryParams(error));
|
|
140
141
|
throw error;
|
|
141
142
|
}
|
|
142
143
|
}));
|