kizunajs 2.0.0-beta.20 → 2.0.0-beta.22
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/README.md +1 -1
- package/dist/{adapter-C9fbHfjn.d.mts → adapter-BdkB6ql9.d.mts} +22 -8
- package/dist/{adapter-CrrbTr4O.cjs → adapter-D7KXowQc.cjs} +80 -7
- package/dist/{adapter-Bz9TLpbr.mjs → adapter-_R9w_PZc.mjs} +76 -9
- package/dist/{adapter-oar_-jZV.d.cts → adapter-nQIkQwsM.d.cts} +22 -8
- package/dist/adapter.cjs +3 -2
- package/dist/adapter.d.cts +2 -2
- package/dist/adapter.d.mts +2 -2
- package/dist/adapter.mjs +3 -3
- package/dist/generator.cjs +1 -1
- package/dist/generator.d.cts +1 -1
- package/dist/generator.d.mts +1 -1
- package/dist/generator.mjs +1 -1
- package/dist/index.cjs +2 -2
- package/dist/index.d.cts +1 -1
- package/dist/index.d.mts +1 -1
- package/dist/index.mjs +2 -2
- package/dist/jobs-entry.cjs +2 -2
- package/dist/jobs-entry.d.cts +1 -1
- package/dist/jobs-entry.d.mts +1 -1
- package/dist/jobs-entry.mjs +2 -2
- package/dist/{plugin-server-kUsK7thV.cjs → plugin-server-D6-b-Sw8.cjs} +10 -5
- package/dist/{plugin-server-BztlE1fz.mjs → plugin-server-DZx4-wXx.mjs} +10 -5
- package/dist/plugin.d.cts +1 -1
- package/dist/plugin.d.mts +1 -1
- package/package.json +1 -1
- package/src/adapter.ts +19 -5
- package/src/coercion.ts +25 -16
- package/src/handler-pipeline.ts +25 -1
- package/src/routes.ts +97 -1
package/README.md
CHANGED
|
@@ -4,7 +4,7 @@
|
|
|
4
4
|
|
|
5
5
|
A spec-driven framework for building fully typed REST APIs in TypeScript, where your route declarations produce the validation, the documentation, the clients, and the AI tools.
|
|
6
6
|
|
|
7
|
-
[](https://www.npmjs.com/package/kizunajs/v/2.0.0-beta.
|
|
7
|
+
[](https://www.npmjs.com/package/kizunajs/v/2.0.0-beta.22)
|
|
8
8
|

|
|
9
9
|
|
|
10
10
|
[Documentation](https://kizunajs.com)
|
|
@@ -699,7 +699,22 @@ type RawBodyArg<R> = R extends {
|
|
|
699
699
|
*/
|
|
700
700
|
rawBody: string;
|
|
701
701
|
} : unknown;
|
|
702
|
-
type
|
|
702
|
+
type EventStreamStatuses<R extends Pick<RouteDefinition, 'responses'>> = { [Status in keyof R['responses']]: R['responses'][Status] extends {
|
|
703
|
+
stream: unknown;
|
|
704
|
+
} ? R['responses'][Status] extends {
|
|
705
|
+
contentType: infer ContentType extends string;
|
|
706
|
+
} ? 'text/event-stream' extends ContentType ? Status : never : Status : never }[keyof R['responses']];
|
|
707
|
+
/**
|
|
708
|
+
* Where a client that lost an event stream asks it to resume, for a route that streams events.
|
|
709
|
+
*/
|
|
710
|
+
type LastEventIdArg<R extends RouteDefinition> = [EventStreamStatuses<R>] extends [never] ? unknown : {
|
|
711
|
+
/**
|
|
712
|
+
* The `id` of the last event the client received before it reconnected, from its `Last-Event-ID`
|
|
713
|
+
* header. Send what follows it.
|
|
714
|
+
*/
|
|
715
|
+
lastEventId: string | undefined;
|
|
716
|
+
};
|
|
717
|
+
type HandlerArgs<R extends RouteDefinition> = ToolsArg<R> & RawBodyArg<R> & LastEventIdArg<R> & {
|
|
703
718
|
params: R extends {
|
|
704
719
|
pathParams: z.ZodType;
|
|
705
720
|
} ? z.output<R['pathParams']> : ExtractPathParams<R['path']>;
|
|
@@ -2381,7 +2396,7 @@ declare const contractOf: <C = unknown>(api: unknown) => C;
|
|
|
2381
2396
|
/**
|
|
2382
2397
|
* What kizuna puts in handler args. Must agree with the spread in `runPipeline`.
|
|
2383
2398
|
*/
|
|
2384
|
-
declare const HANDLER_ARG_KEYS: readonly ["params", "query", "body", "headers", "throwError", "auth", "requestContext", "plugins", "tools", "rawBody"];
|
|
2399
|
+
declare const HANDLER_ARG_KEYS: readonly ["params", "query", "body", "headers", "throwError", "auth", "requestContext", "plugins", "tools", "rawBody", "lastEventId"];
|
|
2385
2400
|
/**
|
|
2386
2401
|
* The adapter's own context, with kizuna's arguments removed.
|
|
2387
2402
|
*/
|
|
@@ -2644,11 +2659,6 @@ interface HandleArgs<NativeRequest, HandlerContext, ResponseContext, TRoutes ext
|
|
|
2644
2659
|
basePath?: string;
|
|
2645
2660
|
responseValidation?: boolean;
|
|
2646
2661
|
}
|
|
2647
|
-
/**
|
|
2648
|
-
* Read a raw header value as a single string: the first entry of an array
|
|
2649
|
-
* header, `undefined` when absent. For guards and request context resolvers on
|
|
2650
|
-
* adapters that expose raw header records.
|
|
2651
|
-
*/
|
|
2652
2662
|
declare const getHeaderValue: (value: unknown) => string | undefined;
|
|
2653
2663
|
/**
|
|
2654
2664
|
* Extract the credential an identity's authentication method expects from the
|
|
@@ -2727,6 +2737,10 @@ interface RenderedResult {
|
|
|
2727
2737
|
declare const renderJsonResult: (result: Exclude<AdapterResult, {
|
|
2728
2738
|
kind: "raw-response";
|
|
2729
2739
|
}>, formatError?: ErrorFormatter, request?: unknown, requestMethod?: string) => RenderedResult;
|
|
2740
|
+
/**
|
|
2741
|
+
* A query string or form as an object. A repeated key collects every value into a list.
|
|
2742
|
+
*/
|
|
2743
|
+
declare const entriesToObject: (source: URLSearchParams | FormData) => Record<string, unknown>;
|
|
2730
2744
|
/**
|
|
2731
2745
|
* Parse a body from its text, the way {@link parseFetchBody} would, for a route
|
|
2732
2746
|
* whose text core already read.
|
|
@@ -2741,4 +2755,4 @@ declare const parseBodyText: (text: string, route: RouteDefinition) => unknown;
|
|
|
2741
2755
|
declare const parseFetchBody: (request: Request, route: RouteDefinition) => Promise<unknown>;
|
|
2742
2756
|
declare const headersToObject: (headers: Headers) => ResponseHeaders;
|
|
2743
2757
|
//#endregion
|
|
2744
|
-
export {
|
|
2758
|
+
export { jobRoutes as $, StreamComment as $i, isJobDefinition as $n, AuthContextOf as $r, PluginsBySlug as $t, RenderedResult as A, BearerConfig as Aa, ToolRunOptions as Ai, RoutesOf as An, parseCron as Ar, sanitizeIdentifier as At, bearerChallenge as B, NoCredential as Ba, ExtractPathParams as Bi, JobHandler as Bn, GroupSet as Br, PluginApi as Bt, JOBS_META as C, insufficientScope as Ca, isRouteDefinition as Ci, GeneratedFile as Cn, ParsedCron as Cr, resolveResponseBody as Ct, REQUEST_CONTEXT_META as D, ApiKeyCredential as Da, ToolAnswer as Di, GuardSchemaOf as Dn, firesBetween as Dr, resolveResponseHeaders as Dt, MountedOf as E, ApiKeyConfig as Ea, StreamTools as Ei, ApiPluginsOf as En, dueSchedules as Er, resolveResponseEtag as Et, RouteMatcher as F, GrantsOf as Fa, buildToolInputSchema as Fi, CompiledJobs as Fn, RequestContextHeaderValues as Fr, AnyPlugin as Ft, dispatchRoute as G, RoutePathParamsCheck as Gi, JobRunnerConfig as Gn, isRawResponse as Gr, PluginExportsOf as Gt, contractOf as H, OpenIdConnectConfig as Ha, PathParamName as Hi, JobHandlerReturn as Hn, createGroups as Hr, PluginDeclaration as Ht, SCHEMES_META as I, GuardHoldings as Ia, describeTool as Ii, FlattenedJob as In, RequestContextSchema as Ir, ApiPlugins as It, getHeaderValue as J, EVENT_STREAM_MEDIA_TYPE as Ji, JobsArg as Jn, RouteWithHandler as Jr, PluginRouteBuilder as Jt, entriesToObject as K, buildPath as Ki, JobVoidReturn as Kn, rawResponse as Kr, PluginFactory as Kt, ServerOptions as L, Identity as La, selectToolRoutes as Li, HttpJobsConfig as Ln, GroupOptions as Lr, InstallOptions as Lt, RequestContextRun as M, Credential as Ma, ToolDefinition as Mi, AuthoredJobDefinition as Mn, scheduleTimezone as Mr, statusToCamelCase as Mt, RequestPipeline as N, CredentialOf as Na, ToolInputSchema as Ni, AuthoredJobs as Nn, RequestContextConfig as Nr, toCamelCase as Nt, ROUTER_META as O, BasicConfig as Oa, ToolEventYield as Oi, JobsOf as On, nextRun as Or, resolveResponseStream as Ot, ResponseValidationError as P, CustomConfig as Pa, buildToolDefinitions as Pi, CompiledJob as Pn, RequestContextHeaderInputs as Pr, toPascalCase as Pt, jobRouter as Q, StreamChunk as Qi, isCompiledJob as Qn, sortFlattenedRoutes as Qr, PluginSetupContext as Qt, adapterContextOf as R, IdentityParamsOf as Ra, toolOptionsOf as Ri, InProcessJobsConfig as Rn, GroupPaths as Rr, PLUGIN_ROUTES_META_KEY as Rt, HandlerContextOf as S, AccessCheckInput as Sa, formatValidationError as Si, DiffSettings as Sn, JobSchedule as Sr, mergeHeaderFields as St, MountArgsOf as T, withPermissions as Ta, ModelToolCall as Ti, ApiDefinition as Tn, cron as Tr, resolveResponseContentType as Tt, defineAdapter as U, RoleOf as Ua, PathParamsCheck as Ui, JobHandlers as Un, isGroupSet as Ur, PluginDefinition as Ut, boundJobKeys as V, OAuth2Config as Va, HasPathParams as Vi, JobHandlerArgs as Vn, ResolvedGroup as Vr, PluginArgs as Vt, dispatchHandler as W, RolesOf as Wa, PathSegment as Wi, JobResponses as Wn, RawResponse as Wr, PluginExportValues as Wt, headersToObject as X, StreamBody as Xi, NoJobs as Xn, RouteMatch as Xr, PluginRoutesOf as Xt, guardDenyFor as Y, EncodeStreamOptions as Yi, JobsConfig as Yn, MatchResult as Yr, PluginRoutes as Yt, isGuardDenial as Z, StreamBodyOf as Zi, flattenJobs as Zn, matchRoute as Zr, PluginSetup as Zt, GuardDeny as _, ToolEvents as _a, ThrowableReturn as _i, ConfiguredRequestContextSchemas as _n, JobTransportSupports as _r, isJsonMediaType as _t, AdapterRequest as a, encodeStreamBody as aa, GuardReturn as ai, pluginRouteTree as an, JobQueueArgs as ar, runHandler as at, HANDLER_ARG_KEYS as b, expandStreamTools as ba, allowedMethodsForPath as bi, KizunaConfigShape as bn, ScheduledJob as br, isZodSchema as bt, ApiBrand as c, soleStreamResponse as ca, HandlerArgs as ci, ConfiguredAdapterContext as cn, JobRunner as cr, ApiRouter as ct, DISPATCH_ROUTE_KEY as d, streamSchemas as da, RawInputs as di, ConfiguredGroups as dn, jobFnAt as dr, createApiReference as dt, StreamContext as ea, BrandedHandlerContext as ei, ResolvedPlugin as en, jobAt as er, jobRunnerFrom as et, ErrorFormatter as f, streamStatuses as fa, RequestContextValues as fi, ConfiguredGuardSchema as fn, JobDescriptor as fr, pluginExportsOf as ft, GuardDenialBody as g, ToolError as ga, RoutesWithHandlerContext as gi, ConfiguredRequestContext as gn, JobTransportDefinition as gr, isHintPrefix as gt, GuardDenial as h, ToolCall as ha, Router as hi, ConfiguredPlugins as hn, JobTransport as hr, resolvePlugins as ht, AdapterDefinition as i, StreamYield as ia, GuardParams as ii, definePlugin as in, JobInputError as ir, routerFromRoutes as it, RequestContextMap as j, BearerCredential as ja, ToolRunResult as ji, SchemesOf as jn, scheduleExpression as jr, shortTypeName as jt, RUN_ROUTE_KEY as k, BasicCredential as ka, ToolRunCall as ki, RequestContextOf as kn, nextRuns as kr, sanitizeFieldName as kt, ApiParts as l, streamContentType as la, HandlerReturn as li, ConfiguredAdapterValue as ln, JobRunnerOptions as lr, ResponseError as lt, GUARD_SCHEMA_META as m, ToolAt as ma, RouteHandler as mi, ConfiguredJobs as mn, JobMessage as mr, pluginRoutesOf as mt, API_META as n, StreamMessageOf as na, FlattenedRoute as ni, RoutePathSchema as nn, JobFn as nr, parseFetchBody as nt, AdapterResult as o, isNamedStream as oa, GuardSuccess as oi, route as on, JobQueueOptions as or, runRoute as ot, GUARDS_META as p, StreamWithTools as pa, RouteGuardBrandOf as pi, ConfiguredIdentities as pn, JobDispatchError as pr, pluginRouterOf as pt, extractCredential as q, parsePath as qi, Jobs as qn, RouteBuilder as qr, PluginList as qt, Adapter as r, StreamMode as ra, GuardAnswer as ri, SlugOption as rn, JobFnByKey as rr, renderJsonResult as rt, AnyAdapter as s, routeStreams as sa, GuardedParamNames as si, ApiContext as sn, JobRunArgs as sr, warnUnsupportedJobOptions as st, ADAPTER_CONTEXT as t, StreamMessage as ta, ContextFromAuth as ti, RouteAuthSchema as tn, JobErrorHandler as tr, parseBodyText as tt, ApiWithRouter as u, streamMode as ua, HandlersFromRoutes as ui, ConfiguredCodes as un, createJobRunner as ur, groupRoutes as ut, GuardMap as v, ToolKeys as va, ValidationFailure as vi, JobFnOf as vn, JobWorker as vr, isStreamResponse as vt, JobsMeta as w, requiresDenial as wa, validateRequest as wi, apiEntries as wn, assertValidSchedule as wr, resolveResponseCache as wt, HandleArgs as x, toolEvents as xa, flattenRoutes as xi, ApiEntry as xn, defineJobTransport as xr, localTypeName as xt, GuardRun as y, ToolResult as ya, ValidationStage as yi, JobsOfTree as yn, JobWorkerContext as yr, isSuccessStatus as yt, assembleApi as z, IdentityRole as za, toolRefusal as zi, JobDefinition as zn, GroupPathsOf as zr, PLUGIN_SERVERS_META_KEY as zt };
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
const require_plugin = require("./plugin-Dw-yCjTY.cjs");
|
|
2
2
|
const require_error_response = require("./error-response-C9ymqSU4.cjs");
|
|
3
|
-
const require_plugin_server = require("./plugin-server-
|
|
3
|
+
const require_plugin_server = require("./plugin-server-D6-b-Sw8.cjs");
|
|
4
4
|
const require_schemas = require("./schemas-DNPVDvkd.cjs");
|
|
5
5
|
let zod = require("zod");
|
|
6
6
|
//#region src/tool-definitions.ts
|
|
@@ -312,6 +312,64 @@ const assertPathParamsAreScalar = (route, routeKey) => {
|
|
|
312
312
|
}
|
|
313
313
|
};
|
|
314
314
|
/**
|
|
315
|
+
* What a field holds once optional and default wrappers are peeled away: a schema kind, or a file or bytes.
|
|
316
|
+
*/
|
|
317
|
+
const fieldKind = (schema) => {
|
|
318
|
+
const { inner } = require_error_response.unwrapOptionalWrappers(schema);
|
|
319
|
+
if (require_error_response.isFileSchema(inner)) return "file";
|
|
320
|
+
if (require_error_response.isBinarySchema(inner)) return "BinarySchema";
|
|
321
|
+
return require_error_response.resolveBaseType(inner);
|
|
322
|
+
};
|
|
323
|
+
const listElement = (schema) => {
|
|
324
|
+
const def = require_error_response.readDef(require_error_response.unwrapOptionalWrappers(schema).inner);
|
|
325
|
+
return def.type === "array" ? def.element : void 0;
|
|
326
|
+
};
|
|
327
|
+
const isValue = (kind) => !STRUCTURED_TYPES.has(kind) && kind !== "file" && kind !== "BinarySchema";
|
|
328
|
+
/**
|
|
329
|
+
* Names a field the way an error shows it: its kind, or what a list holds.
|
|
330
|
+
*/
|
|
331
|
+
const describeField = (schema) => {
|
|
332
|
+
const element = listElement(schema);
|
|
333
|
+
return element === void 0 ? fieldKind(schema) : `array of ${fieldKind(element)}`;
|
|
334
|
+
};
|
|
335
|
+
const fieldsOf = (schema) => Object.entries((schema && require_error_response.readObjectShape(schema)) ?? {});
|
|
336
|
+
/**
|
|
337
|
+
* A query string carries values and lists of values, the way OpenAPI's default `form` style sends them.
|
|
338
|
+
*/
|
|
339
|
+
const assertQuerySendable = (route, routeKey) => {
|
|
340
|
+
for (const [name, field] of fieldsOf(route.query)) {
|
|
341
|
+
const element = listElement(field);
|
|
342
|
+
if (element === void 0 ? isValue(fieldKind(field)) : isValue(fieldKind(element))) continue;
|
|
343
|
+
throw new Error(`Route "${routeKey}" declares query field "${name}" as ${describeField(field)}. A query string carries values and lists of values, so this cannot be sent.
|
|
344
|
+
Split it into fields of their own, or move it to a body.`);
|
|
345
|
+
}
|
|
346
|
+
};
|
|
347
|
+
/**
|
|
348
|
+
* A header carries one value.
|
|
349
|
+
*/
|
|
350
|
+
const assertHeadersSendable = (route, routeKey) => {
|
|
351
|
+
for (const [name, field] of fieldsOf(route.headers)) {
|
|
352
|
+
if (listElement(field) === void 0 && isValue(fieldKind(field))) continue;
|
|
353
|
+
throw new Error(`Route "${routeKey}" declares header "${name}" as ${describeField(field)}. A header carries one value, so this cannot be sent.
|
|
354
|
+
Use a scalar schema (z.string(), z.int(), z.enum([...])), or split it into headers of their own.`);
|
|
355
|
+
}
|
|
356
|
+
};
|
|
357
|
+
/**
|
|
358
|
+
* A form carries values and lists of values, and a multipart one carries files too (RFC 7578).
|
|
359
|
+
*/
|
|
360
|
+
const assertFormFieldsSendable = (route, routeKey) => {
|
|
361
|
+
if (route.contentType !== "multipart/form-data" && route.contentType !== "application/x-www-form-urlencoded") return;
|
|
362
|
+
const multipart = route.contentType === "multipart/form-data";
|
|
363
|
+
for (const [name, field] of fieldsOf(route.body)) {
|
|
364
|
+
const kind = fieldKind(listElement(field) ?? field);
|
|
365
|
+
if (kind === "BinarySchema") throw new Error(`Route "${routeKey}" declares form field "${name}" as BinarySchema, but a form sends a file part as a File. Declare it with FileSchema.`);
|
|
366
|
+
if (kind === "file" && !multipart) throw new Error(`Route "${routeKey}" declares form field "${name}" as a file, which a urlencoded body cannot carry. Send it as contentType: 'multipart/form-data'.`);
|
|
367
|
+
if (kind === "file" || isValue(kind)) continue;
|
|
368
|
+
throw new Error(`Route "${routeKey}" declares form field "${name}" as ${describeField(field)}. A form carries values, lists of values and files, so this cannot be sent.
|
|
369
|
+
Split it into fields of their own, or take the body as JSON.`);
|
|
370
|
+
}
|
|
371
|
+
};
|
|
372
|
+
/**
|
|
315
373
|
* A tool's description is the one thing a model reads before choosing it, so a
|
|
316
374
|
* route that publishes as one has to carry it.
|
|
317
375
|
*/
|
|
@@ -328,6 +386,9 @@ const validateRoutes = (routes, prefix) => {
|
|
|
328
386
|
expandStreamTools(value, fullKey);
|
|
329
387
|
assertPathParamsMatchPath(value, fullKey);
|
|
330
388
|
assertPathParamsAreScalar(value, fullKey);
|
|
389
|
+
assertQuerySendable(value, fullKey);
|
|
390
|
+
assertHeadersSendable(value, fullKey);
|
|
391
|
+
assertFormFieldsSendable(value, fullKey);
|
|
331
392
|
assertNoCoercion(value, fullKey);
|
|
332
393
|
require_plugin_server.assertValidStreams(value, fullKey);
|
|
333
394
|
assertToolDescribed(value, fullKey);
|
|
@@ -1371,7 +1432,8 @@ const HANDLER_ARG_KEYS = [
|
|
|
1371
1432
|
"requestContext",
|
|
1372
1433
|
"plugins",
|
|
1373
1434
|
"tools",
|
|
1374
|
-
"rawBody"
|
|
1435
|
+
"rawBody",
|
|
1436
|
+
"lastEventId"
|
|
1375
1437
|
];
|
|
1376
1438
|
/**
|
|
1377
1439
|
* The adapter's own context, with kizuna's arguments removed.
|
|
@@ -1572,6 +1634,7 @@ const boundJobKeys = (meta) => {
|
|
|
1572
1634
|
* header, `undefined` when absent. For guards and request context resolvers on
|
|
1573
1635
|
* adapters that expose raw header records.
|
|
1574
1636
|
*/
|
|
1637
|
+
const streamsEvents = (route) => Object.values(route.responses).some((response) => require_plugin_server.isStreamResponse(response) && require_plugin_server.streamContentType(response) === "text/event-stream");
|
|
1575
1638
|
const getHeaderValue = (value) => {
|
|
1576
1639
|
if (typeof value === "string") return value;
|
|
1577
1640
|
if (Array.isArray(value) && typeof value[0] === "string") return value[0];
|
|
@@ -2047,6 +2110,7 @@ const invokeRoute = async (invocation) => {
|
|
|
2047
2110
|
body: parsed.body,
|
|
2048
2111
|
headers: parsed.headers,
|
|
2049
2112
|
...route.rawBody === true ? { rawBody: invocation.rawBody } : {},
|
|
2113
|
+
...streamsEvents(route) ? { lastEventId: getHeaderValue(invocation.request.headers["last-event-id"]) } : {},
|
|
2050
2114
|
throwError,
|
|
2051
2115
|
...handlerContext,
|
|
2052
2116
|
...tools ? { tools: streamToolsFor(tools, invocation, handlerContext) } : {},
|
|
@@ -2223,9 +2287,12 @@ const renderResult = (result, formatError, request) => {
|
|
|
2223
2287
|
case "handler-error": return renderError(500, "Internal Server Error", void 0, result.headers);
|
|
2224
2288
|
}
|
|
2225
2289
|
};
|
|
2226
|
-
|
|
2290
|
+
/**
|
|
2291
|
+
* A query string or form as an object. A repeated key collects every value into a list.
|
|
2292
|
+
*/
|
|
2293
|
+
const entriesToObject = (source) => {
|
|
2227
2294
|
const result = {};
|
|
2228
|
-
for (const [key, value] of
|
|
2295
|
+
for (const [key, value] of source.entries()) {
|
|
2229
2296
|
const existing = result[key];
|
|
2230
2297
|
if (existing === void 0) result[key] = value;
|
|
2231
2298
|
else if (Array.isArray(existing)) existing.push(value);
|
|
@@ -2238,7 +2305,7 @@ const formDataToObject = (form) => {
|
|
|
2238
2305
|
* whose text core already read.
|
|
2239
2306
|
*/
|
|
2240
2307
|
const parseBodyText = (text, route) => {
|
|
2241
|
-
if (route.contentType === "application/x-www-form-urlencoded") return
|
|
2308
|
+
if (route.contentType === "application/x-www-form-urlencoded") return entriesToObject(new URLSearchParams(text));
|
|
2242
2309
|
return text.length > 0 ? JSON.parse(text) : void 0;
|
|
2243
2310
|
};
|
|
2244
2311
|
/**
|
|
@@ -2249,8 +2316,8 @@ const parseBodyText = (text, route) => {
|
|
|
2249
2316
|
* */
|
|
2250
2317
|
const parseFetchBody = async (request, route) => {
|
|
2251
2318
|
switch (route.contentType) {
|
|
2252
|
-
case "multipart/form-data": return
|
|
2253
|
-
case "application/x-www-form-urlencoded": return
|
|
2319
|
+
case "multipart/form-data": return entriesToObject(await request.formData());
|
|
2320
|
+
case "application/x-www-form-urlencoded": return entriesToObject(new URLSearchParams(await request.text()));
|
|
2254
2321
|
default: {
|
|
2255
2322
|
const text = await request.text();
|
|
2256
2323
|
return text.length > 0 ? JSON.parse(text) : void 0;
|
|
@@ -2493,6 +2560,12 @@ Object.defineProperty(exports, "dueJobs", {
|
|
|
2493
2560
|
return dueJobs;
|
|
2494
2561
|
}
|
|
2495
2562
|
});
|
|
2563
|
+
Object.defineProperty(exports, "entriesToObject", {
|
|
2564
|
+
enumerable: true,
|
|
2565
|
+
get: function() {
|
|
2566
|
+
return entriesToObject;
|
|
2567
|
+
}
|
|
2568
|
+
});
|
|
2496
2569
|
Object.defineProperty(exports, "expandStreamTools", {
|
|
2497
2570
|
enumerable: true,
|
|
2498
2571
|
get: function() {
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { g as ROUTES_GROUP, n as PLUGIN_SERVERS_META_KEY, o as pluginRouteTree, p as HANDLER, t as PLUGIN_ROUTES_META_KEY } from "./plugin-xxCxibmu.mjs";
|
|
2
|
-
import { E as resolveBaseType, T as readObjectShape, c as isBinarySchema, o as findCoercedSchemaPath, p as isVoidSchema, t as ProblemDetailsSchema } from "./error-response-CNQaKVYd.mjs";
|
|
3
|
-
import { F as routeStreams, G as isZodSchema, H as isJsonMediaType, J as resolveResponseBody, L as streamContentType, M as assertValidStreams, N as encodeStreamBody, S as dueSchedules, U as isStreamResponse, W as isSuccessStatus, X as resolveResponseContentType, Y as resolveResponseCache, Z as resolveResponseEtag, _ as jobAt, c as cacheHeaders, ct as allowedMethodsForPath, dt as isRouteDefinition, ft as validateRequest, h as isCompiledJob, j as EVENT_STREAM_MEDIA_TYPE, k as deriveToolNames, lt as flattenRoutes, m as flattenJobs, pt as resolveCoercionPlans, st as parsePath, u as deprecationHeaders, ut as formatValidationError, y as toJobResponse, z as streamSchemas } from "./plugin-server-
|
|
2
|
+
import { D as unwrapOptionalWrappers, E as resolveBaseType, T as readObjectShape, c as isBinarySchema, m as readDef, o as findCoercedSchemaPath, p as isVoidSchema, t as ProblemDetailsSchema, u as isFileSchema } from "./error-response-CNQaKVYd.mjs";
|
|
3
|
+
import { F as routeStreams, G as isZodSchema, H as isJsonMediaType, J as resolveResponseBody, L as streamContentType, M as assertValidStreams, N as encodeStreamBody, S as dueSchedules, U as isStreamResponse, W as isSuccessStatus, X as resolveResponseContentType, Y as resolveResponseCache, Z as resolveResponseEtag, _ as jobAt, c as cacheHeaders, ct as allowedMethodsForPath, dt as isRouteDefinition, ft as validateRequest, h as isCompiledJob, j as EVENT_STREAM_MEDIA_TYPE, k as deriveToolNames, lt as flattenRoutes, m as flattenJobs, pt as resolveCoercionPlans, st as parsePath, u as deprecationHeaders, ut as formatValidationError, y as toJobResponse, z as streamSchemas } from "./plugin-server-DZx4-wXx.mjs";
|
|
4
4
|
import { l as authenticationChallenge, p as resolveSecurityRequirements } from "./schemas-HW2FDsvz.mjs";
|
|
5
5
|
import { z } from "zod";
|
|
6
6
|
//#region src/tool-definitions.ts
|
|
@@ -312,6 +312,64 @@ const assertPathParamsAreScalar = (route, routeKey) => {
|
|
|
312
312
|
}
|
|
313
313
|
};
|
|
314
314
|
/**
|
|
315
|
+
* What a field holds once optional and default wrappers are peeled away: a schema kind, or a file or bytes.
|
|
316
|
+
*/
|
|
317
|
+
const fieldKind = (schema) => {
|
|
318
|
+
const { inner } = unwrapOptionalWrappers(schema);
|
|
319
|
+
if (isFileSchema(inner)) return "file";
|
|
320
|
+
if (isBinarySchema(inner)) return "BinarySchema";
|
|
321
|
+
return resolveBaseType(inner);
|
|
322
|
+
};
|
|
323
|
+
const listElement = (schema) => {
|
|
324
|
+
const def = readDef(unwrapOptionalWrappers(schema).inner);
|
|
325
|
+
return def.type === "array" ? def.element : void 0;
|
|
326
|
+
};
|
|
327
|
+
const isValue = (kind) => !STRUCTURED_TYPES.has(kind) && kind !== "file" && kind !== "BinarySchema";
|
|
328
|
+
/**
|
|
329
|
+
* Names a field the way an error shows it: its kind, or what a list holds.
|
|
330
|
+
*/
|
|
331
|
+
const describeField = (schema) => {
|
|
332
|
+
const element = listElement(schema);
|
|
333
|
+
return element === void 0 ? fieldKind(schema) : `array of ${fieldKind(element)}`;
|
|
334
|
+
};
|
|
335
|
+
const fieldsOf = (schema) => Object.entries((schema && readObjectShape(schema)) ?? {});
|
|
336
|
+
/**
|
|
337
|
+
* A query string carries values and lists of values, the way OpenAPI's default `form` style sends them.
|
|
338
|
+
*/
|
|
339
|
+
const assertQuerySendable = (route, routeKey) => {
|
|
340
|
+
for (const [name, field] of fieldsOf(route.query)) {
|
|
341
|
+
const element = listElement(field);
|
|
342
|
+
if (element === void 0 ? isValue(fieldKind(field)) : isValue(fieldKind(element))) continue;
|
|
343
|
+
throw new Error(`Route "${routeKey}" declares query field "${name}" as ${describeField(field)}. A query string carries values and lists of values, so this cannot be sent.
|
|
344
|
+
Split it into fields of their own, or move it to a body.`);
|
|
345
|
+
}
|
|
346
|
+
};
|
|
347
|
+
/**
|
|
348
|
+
* A header carries one value.
|
|
349
|
+
*/
|
|
350
|
+
const assertHeadersSendable = (route, routeKey) => {
|
|
351
|
+
for (const [name, field] of fieldsOf(route.headers)) {
|
|
352
|
+
if (listElement(field) === void 0 && isValue(fieldKind(field))) continue;
|
|
353
|
+
throw new Error(`Route "${routeKey}" declares header "${name}" as ${describeField(field)}. A header carries one value, so this cannot be sent.
|
|
354
|
+
Use a scalar schema (z.string(), z.int(), z.enum([...])), or split it into headers of their own.`);
|
|
355
|
+
}
|
|
356
|
+
};
|
|
357
|
+
/**
|
|
358
|
+
* A form carries values and lists of values, and a multipart one carries files too (RFC 7578).
|
|
359
|
+
*/
|
|
360
|
+
const assertFormFieldsSendable = (route, routeKey) => {
|
|
361
|
+
if (route.contentType !== "multipart/form-data" && route.contentType !== "application/x-www-form-urlencoded") return;
|
|
362
|
+
const multipart = route.contentType === "multipart/form-data";
|
|
363
|
+
for (const [name, field] of fieldsOf(route.body)) {
|
|
364
|
+
const kind = fieldKind(listElement(field) ?? field);
|
|
365
|
+
if (kind === "BinarySchema") throw new Error(`Route "${routeKey}" declares form field "${name}" as BinarySchema, but a form sends a file part as a File. Declare it with FileSchema.`);
|
|
366
|
+
if (kind === "file" && !multipart) throw new Error(`Route "${routeKey}" declares form field "${name}" as a file, which a urlencoded body cannot carry. Send it as contentType: 'multipart/form-data'.`);
|
|
367
|
+
if (kind === "file" || isValue(kind)) continue;
|
|
368
|
+
throw new Error(`Route "${routeKey}" declares form field "${name}" as ${describeField(field)}. A form carries values, lists of values and files, so this cannot be sent.
|
|
369
|
+
Split it into fields of their own, or take the body as JSON.`);
|
|
370
|
+
}
|
|
371
|
+
};
|
|
372
|
+
/**
|
|
315
373
|
* A tool's description is the one thing a model reads before choosing it, so a
|
|
316
374
|
* route that publishes as one has to carry it.
|
|
317
375
|
*/
|
|
@@ -328,6 +386,9 @@ const validateRoutes = (routes, prefix) => {
|
|
|
328
386
|
expandStreamTools(value, fullKey);
|
|
329
387
|
assertPathParamsMatchPath(value, fullKey);
|
|
330
388
|
assertPathParamsAreScalar(value, fullKey);
|
|
389
|
+
assertQuerySendable(value, fullKey);
|
|
390
|
+
assertHeadersSendable(value, fullKey);
|
|
391
|
+
assertFormFieldsSendable(value, fullKey);
|
|
331
392
|
assertNoCoercion(value, fullKey);
|
|
332
393
|
assertValidStreams(value, fullKey);
|
|
333
394
|
assertToolDescribed(value, fullKey);
|
|
@@ -1371,7 +1432,8 @@ const HANDLER_ARG_KEYS = [
|
|
|
1371
1432
|
"requestContext",
|
|
1372
1433
|
"plugins",
|
|
1373
1434
|
"tools",
|
|
1374
|
-
"rawBody"
|
|
1435
|
+
"rawBody",
|
|
1436
|
+
"lastEventId"
|
|
1375
1437
|
];
|
|
1376
1438
|
/**
|
|
1377
1439
|
* The adapter's own context, with kizuna's arguments removed.
|
|
@@ -1572,6 +1634,7 @@ const boundJobKeys = (meta) => {
|
|
|
1572
1634
|
* header, `undefined` when absent. For guards and request context resolvers on
|
|
1573
1635
|
* adapters that expose raw header records.
|
|
1574
1636
|
*/
|
|
1637
|
+
const streamsEvents = (route) => Object.values(route.responses).some((response) => isStreamResponse(response) && streamContentType(response) === "text/event-stream");
|
|
1575
1638
|
const getHeaderValue = (value) => {
|
|
1576
1639
|
if (typeof value === "string") return value;
|
|
1577
1640
|
if (Array.isArray(value) && typeof value[0] === "string") return value[0];
|
|
@@ -2047,6 +2110,7 @@ const invokeRoute = async (invocation) => {
|
|
|
2047
2110
|
body: parsed.body,
|
|
2048
2111
|
headers: parsed.headers,
|
|
2049
2112
|
...route.rawBody === true ? { rawBody: invocation.rawBody } : {},
|
|
2113
|
+
...streamsEvents(route) ? { lastEventId: getHeaderValue(invocation.request.headers["last-event-id"]) } : {},
|
|
2050
2114
|
throwError,
|
|
2051
2115
|
...handlerContext,
|
|
2052
2116
|
...tools ? { tools: streamToolsFor(tools, invocation, handlerContext) } : {},
|
|
@@ -2223,9 +2287,12 @@ const renderResult = (result, formatError, request) => {
|
|
|
2223
2287
|
case "handler-error": return renderError(500, "Internal Server Error", void 0, result.headers);
|
|
2224
2288
|
}
|
|
2225
2289
|
};
|
|
2226
|
-
|
|
2290
|
+
/**
|
|
2291
|
+
* A query string or form as an object. A repeated key collects every value into a list.
|
|
2292
|
+
*/
|
|
2293
|
+
const entriesToObject = (source) => {
|
|
2227
2294
|
const result = {};
|
|
2228
|
-
for (const [key, value] of
|
|
2295
|
+
for (const [key, value] of source.entries()) {
|
|
2229
2296
|
const existing = result[key];
|
|
2230
2297
|
if (existing === void 0) result[key] = value;
|
|
2231
2298
|
else if (Array.isArray(existing)) existing.push(value);
|
|
@@ -2238,7 +2305,7 @@ const formDataToObject = (form) => {
|
|
|
2238
2305
|
* whose text core already read.
|
|
2239
2306
|
*/
|
|
2240
2307
|
const parseBodyText = (text, route) => {
|
|
2241
|
-
if (route.contentType === "application/x-www-form-urlencoded") return
|
|
2308
|
+
if (route.contentType === "application/x-www-form-urlencoded") return entriesToObject(new URLSearchParams(text));
|
|
2242
2309
|
return text.length > 0 ? JSON.parse(text) : void 0;
|
|
2243
2310
|
};
|
|
2244
2311
|
/**
|
|
@@ -2249,8 +2316,8 @@ const parseBodyText = (text, route) => {
|
|
|
2249
2316
|
* */
|
|
2250
2317
|
const parseFetchBody = async (request, route) => {
|
|
2251
2318
|
switch (route.contentType) {
|
|
2252
|
-
case "multipart/form-data": return
|
|
2253
|
-
case "application/x-www-form-urlencoded": return
|
|
2319
|
+
case "multipart/form-data": return entriesToObject(await request.formData());
|
|
2320
|
+
case "application/x-www-form-urlencoded": return entriesToObject(new URLSearchParams(await request.text()));
|
|
2254
2321
|
default: {
|
|
2255
2322
|
const text = await request.text();
|
|
2256
2323
|
return text.length > 0 ? JSON.parse(text) : void 0;
|
|
@@ -2265,4 +2332,4 @@ const headersToObject = (headers) => {
|
|
|
2265
2332
|
return result;
|
|
2266
2333
|
};
|
|
2267
2334
|
//#endregion
|
|
2268
|
-
export {
|
|
2335
|
+
export { dispatchDueJobs as $, parseFetchBody as A, matchRoute as B, guardDenyFor as C, toolRefusal as Ct, jobRoutes as D, jobRouter as E, warnUnsupportedJobOptions as F, JobDispatchError as G, insufficientScope as H, isRawResponse as I, createJobRunner as J, defineJobTransport as K, rawResponse as L, routerFromRoutes as M, runHandler as N, jobRunnerFrom as O, runRoute as P, DispatchResultSchema as Q, assertNoPathCollisions as R, getHeaderValue as S, toolOptionsOf as St, isGuardDenial as T, requiresDenial as U, sortFlattenedRoutes as V, withPermissions as W, ResponseError as X, jobFnAt as Y, DispatchFailedSchema as Z, defineAdapter as _, toolEvents as _t, HANDLER_ARG_KEYS as a, STATUS_TITLES as at, entriesToObject as b, describeTool as bt, ROUTER_META as c, createRoles as ct, SCHEMES_META as d, permissionNames as dt, dispatchSucceeded as et, adapterContextOf as f, createGroups as ft, contractOf as g, expandStreamTools as gt, boundJobKeys as h, groupRoutes as ht, GUARD_SCHEMA_META as i, problemFromBody as it, renderJsonResult as j, parseBodyText as k, RUN_ROUTE_KEY as l, isPermissions as lt, bearerChallenge as m, assembleRoutes as mt, DISPATCH_ROUTE_KEY as n, failedJobs as nt, JOBS_META as o, getStatusText as ot, assembleApi as p, isGroupSet as pt, JobInputError as q, GUARDS_META as r, problemDetails as rt, REQUEST_CONTEXT_META as s, createPermissions as st, API_META as t, dueJobs as tt, ResponseValidationError as u, isRoles as ut, dispatchHandler as v, buildToolDefinitions as vt, headersToObject as w, extractCredential as x, selectToolRoutes as xt, dispatchRoute as y, buildToolInputSchema as yt, routeClaims as z };
|
|
@@ -699,7 +699,22 @@ type RawBodyArg<R> = R extends {
|
|
|
699
699
|
*/
|
|
700
700
|
rawBody: string;
|
|
701
701
|
} : unknown;
|
|
702
|
-
type
|
|
702
|
+
type EventStreamStatuses<R extends Pick<RouteDefinition, 'responses'>> = { [Status in keyof R['responses']]: R['responses'][Status] extends {
|
|
703
|
+
stream: unknown;
|
|
704
|
+
} ? R['responses'][Status] extends {
|
|
705
|
+
contentType: infer ContentType extends string;
|
|
706
|
+
} ? 'text/event-stream' extends ContentType ? Status : never : Status : never }[keyof R['responses']];
|
|
707
|
+
/**
|
|
708
|
+
* Where a client that lost an event stream asks it to resume, for a route that streams events.
|
|
709
|
+
*/
|
|
710
|
+
type LastEventIdArg<R extends RouteDefinition> = [EventStreamStatuses<R>] extends [never] ? unknown : {
|
|
711
|
+
/**
|
|
712
|
+
* The `id` of the last event the client received before it reconnected, from its `Last-Event-ID`
|
|
713
|
+
* header. Send what follows it.
|
|
714
|
+
*/
|
|
715
|
+
lastEventId: string | undefined;
|
|
716
|
+
};
|
|
717
|
+
type HandlerArgs<R extends RouteDefinition> = ToolsArg<R> & RawBodyArg<R> & LastEventIdArg<R> & {
|
|
703
718
|
params: R extends {
|
|
704
719
|
pathParams: z.ZodType;
|
|
705
720
|
} ? z.output<R['pathParams']> : ExtractPathParams<R['path']>;
|
|
@@ -2381,7 +2396,7 @@ declare const contractOf: <C = unknown>(api: unknown) => C;
|
|
|
2381
2396
|
/**
|
|
2382
2397
|
* What kizuna puts in handler args. Must agree with the spread in `runPipeline`.
|
|
2383
2398
|
*/
|
|
2384
|
-
declare const HANDLER_ARG_KEYS: readonly ["params", "query", "body", "headers", "throwError", "auth", "requestContext", "plugins", "tools", "rawBody"];
|
|
2399
|
+
declare const HANDLER_ARG_KEYS: readonly ["params", "query", "body", "headers", "throwError", "auth", "requestContext", "plugins", "tools", "rawBody", "lastEventId"];
|
|
2385
2400
|
/**
|
|
2386
2401
|
* The adapter's own context, with kizuna's arguments removed.
|
|
2387
2402
|
*/
|
|
@@ -2644,11 +2659,6 @@ interface HandleArgs<NativeRequest, HandlerContext, ResponseContext, TRoutes ext
|
|
|
2644
2659
|
basePath?: string;
|
|
2645
2660
|
responseValidation?: boolean;
|
|
2646
2661
|
}
|
|
2647
|
-
/**
|
|
2648
|
-
* Read a raw header value as a single string: the first entry of an array
|
|
2649
|
-
* header, `undefined` when absent. For guards and request context resolvers on
|
|
2650
|
-
* adapters that expose raw header records.
|
|
2651
|
-
*/
|
|
2652
2662
|
declare const getHeaderValue: (value: unknown) => string | undefined;
|
|
2653
2663
|
/**
|
|
2654
2664
|
* Extract the credential an identity's authentication method expects from the
|
|
@@ -2727,6 +2737,10 @@ interface RenderedResult {
|
|
|
2727
2737
|
declare const renderJsonResult: (result: Exclude<AdapterResult, {
|
|
2728
2738
|
kind: "raw-response";
|
|
2729
2739
|
}>, formatError?: ErrorFormatter, request?: unknown, requestMethod?: string) => RenderedResult;
|
|
2740
|
+
/**
|
|
2741
|
+
* A query string or form as an object. A repeated key collects every value into a list.
|
|
2742
|
+
*/
|
|
2743
|
+
declare const entriesToObject: (source: URLSearchParams | FormData) => Record<string, unknown>;
|
|
2730
2744
|
/**
|
|
2731
2745
|
* Parse a body from its text, the way {@link parseFetchBody} would, for a route
|
|
2732
2746
|
* whose text core already read.
|
|
@@ -2741,4 +2755,4 @@ declare const parseBodyText: (text: string, route: RouteDefinition) => unknown;
|
|
|
2741
2755
|
declare const parseFetchBody: (request: Request, route: RouteDefinition) => Promise<unknown>;
|
|
2742
2756
|
declare const headersToObject: (headers: Headers) => ResponseHeaders;
|
|
2743
2757
|
//#endregion
|
|
2744
|
-
export {
|
|
2758
|
+
export { jobRoutes as $, StreamComment as $i, isJobDefinition as $n, AuthContextOf as $r, PluginsBySlug as $t, RenderedResult as A, BearerConfig as Aa, ToolRunOptions as Ai, RoutesOf as An, parseCron as Ar, sanitizeIdentifier as At, bearerChallenge as B, NoCredential as Ba, ExtractPathParams as Bi, JobHandler as Bn, GroupSet as Br, PluginApi as Bt, JOBS_META as C, insufficientScope as Ca, isRouteDefinition as Ci, GeneratedFile as Cn, ParsedCron as Cr, resolveResponseBody as Ct, REQUEST_CONTEXT_META as D, ApiKeyCredential as Da, ToolAnswer as Di, GuardSchemaOf as Dn, firesBetween as Dr, resolveResponseHeaders as Dt, MountedOf as E, ApiKeyConfig as Ea, StreamTools as Ei, ApiPluginsOf as En, dueSchedules as Er, resolveResponseEtag as Et, RouteMatcher as F, GrantsOf as Fa, buildToolInputSchema as Fi, CompiledJobs as Fn, RequestContextHeaderValues as Fr, AnyPlugin as Ft, dispatchRoute as G, RoutePathParamsCheck as Gi, JobRunnerConfig as Gn, isRawResponse as Gr, PluginExportsOf as Gt, contractOf as H, OpenIdConnectConfig as Ha, PathParamName as Hi, JobHandlerReturn as Hn, createGroups as Hr, PluginDeclaration as Ht, SCHEMES_META as I, GuardHoldings as Ia, describeTool as Ii, FlattenedJob as In, RequestContextSchema as Ir, ApiPlugins as It, getHeaderValue as J, EVENT_STREAM_MEDIA_TYPE as Ji, JobsArg as Jn, RouteWithHandler as Jr, PluginRouteBuilder as Jt, entriesToObject as K, buildPath as Ki, JobVoidReturn as Kn, rawResponse as Kr, PluginFactory as Kt, ServerOptions as L, Identity as La, selectToolRoutes as Li, HttpJobsConfig as Ln, GroupOptions as Lr, InstallOptions as Lt, RequestContextRun as M, Credential as Ma, ToolDefinition as Mi, AuthoredJobDefinition as Mn, scheduleTimezone as Mr, statusToCamelCase as Mt, RequestPipeline as N, CredentialOf as Na, ToolInputSchema as Ni, AuthoredJobs as Nn, RequestContextConfig as Nr, toCamelCase as Nt, ROUTER_META as O, BasicConfig as Oa, ToolEventYield as Oi, JobsOf as On, nextRun as Or, resolveResponseStream as Ot, ResponseValidationError as P, CustomConfig as Pa, buildToolDefinitions as Pi, CompiledJob as Pn, RequestContextHeaderInputs as Pr, toPascalCase as Pt, jobRouter as Q, StreamChunk as Qi, isCompiledJob as Qn, sortFlattenedRoutes as Qr, PluginSetupContext as Qt, adapterContextOf as R, IdentityParamsOf as Ra, toolOptionsOf as Ri, InProcessJobsConfig as Rn, GroupPaths as Rr, PLUGIN_ROUTES_META_KEY as Rt, HandlerContextOf as S, AccessCheckInput as Sa, formatValidationError as Si, DiffSettings as Sn, JobSchedule as Sr, mergeHeaderFields as St, MountArgsOf as T, withPermissions as Ta, ModelToolCall as Ti, ApiDefinition as Tn, cron as Tr, resolveResponseContentType as Tt, defineAdapter as U, RoleOf as Ua, PathParamsCheck as Ui, JobHandlers as Un, isGroupSet as Ur, PluginDefinition as Ut, boundJobKeys as V, OAuth2Config as Va, HasPathParams as Vi, JobHandlerArgs as Vn, ResolvedGroup as Vr, PluginArgs as Vt, dispatchHandler as W, RolesOf as Wa, PathSegment as Wi, JobResponses as Wn, RawResponse as Wr, PluginExportValues as Wt, headersToObject as X, StreamBody as Xi, NoJobs as Xn, RouteMatch as Xr, PluginRoutesOf as Xt, guardDenyFor as Y, EncodeStreamOptions as Yi, JobsConfig as Yn, MatchResult as Yr, PluginRoutes as Yt, isGuardDenial as Z, StreamBodyOf as Zi, flattenJobs as Zn, matchRoute as Zr, PluginSetup as Zt, GuardDeny as _, ToolEvents as _a, ThrowableReturn as _i, ConfiguredRequestContextSchemas as _n, JobTransportSupports as _r, isJsonMediaType as _t, AdapterRequest as a, encodeStreamBody as aa, GuardReturn as ai, pluginRouteTree as an, JobQueueArgs as ar, runHandler as at, HANDLER_ARG_KEYS as b, expandStreamTools as ba, allowedMethodsForPath as bi, KizunaConfigShape as bn, ScheduledJob as br, isZodSchema as bt, ApiBrand as c, soleStreamResponse as ca, HandlerArgs as ci, ConfiguredAdapterContext as cn, JobRunner as cr, ApiRouter as ct, DISPATCH_ROUTE_KEY as d, streamSchemas as da, RawInputs as di, ConfiguredGroups as dn, jobFnAt as dr, createApiReference as dt, StreamContext as ea, BrandedHandlerContext as ei, ResolvedPlugin as en, jobAt as er, jobRunnerFrom as et, ErrorFormatter as f, streamStatuses as fa, RequestContextValues as fi, ConfiguredGuardSchema as fn, JobDescriptor as fr, pluginExportsOf as ft, GuardDenialBody as g, ToolError as ga, RoutesWithHandlerContext as gi, ConfiguredRequestContext as gn, JobTransportDefinition as gr, isHintPrefix as gt, GuardDenial as h, ToolCall as ha, Router as hi, ConfiguredPlugins as hn, JobTransport as hr, resolvePlugins as ht, AdapterDefinition as i, StreamYield as ia, GuardParams as ii, definePlugin as in, JobInputError as ir, routerFromRoutes as it, RequestContextMap as j, BearerCredential as ja, ToolRunResult as ji, SchemesOf as jn, scheduleExpression as jr, shortTypeName as jt, RUN_ROUTE_KEY as k, BasicCredential as ka, ToolRunCall as ki, RequestContextOf as kn, nextRuns as kr, sanitizeFieldName as kt, ApiParts as l, streamContentType as la, HandlerReturn as li, ConfiguredAdapterValue as ln, JobRunnerOptions as lr, ResponseError as lt, GUARD_SCHEMA_META as m, ToolAt as ma, RouteHandler as mi, ConfiguredJobs as mn, JobMessage as mr, pluginRoutesOf as mt, API_META as n, StreamMessageOf as na, FlattenedRoute as ni, RoutePathSchema as nn, JobFn as nr, parseFetchBody as nt, AdapterResult as o, isNamedStream as oa, GuardSuccess as oi, route as on, JobQueueOptions as or, runRoute as ot, GUARDS_META as p, StreamWithTools as pa, RouteGuardBrandOf as pi, ConfiguredIdentities as pn, JobDispatchError as pr, pluginRouterOf as pt, extractCredential as q, parsePath as qi, Jobs as qn, RouteBuilder as qr, PluginList as qt, Adapter as r, StreamMode as ra, GuardAnswer as ri, SlugOption as rn, JobFnByKey as rr, renderJsonResult as rt, AnyAdapter as s, routeStreams as sa, GuardedParamNames as si, ApiContext as sn, JobRunArgs as sr, warnUnsupportedJobOptions as st, ADAPTER_CONTEXT as t, StreamMessage as ta, ContextFromAuth as ti, RouteAuthSchema as tn, JobErrorHandler as tr, parseBodyText as tt, ApiWithRouter as u, streamMode as ua, HandlersFromRoutes as ui, ConfiguredCodes as un, createJobRunner as ur, groupRoutes as ut, GuardMap as v, ToolKeys as va, ValidationFailure as vi, JobFnOf as vn, JobWorker as vr, isStreamResponse as vt, JobsMeta as w, requiresDenial as wa, validateRequest as wi, apiEntries as wn, assertValidSchedule as wr, resolveResponseCache as wt, HandleArgs as x, toolEvents as xa, flattenRoutes as xi, ApiEntry as xn, defineJobTransport as xr, localTypeName as xt, GuardRun as y, ToolResult as ya, ValidationStage as yi, JobsOfTree as yn, JobWorkerContext as yr, isSuccessStatus as yt, assembleApi as z, IdentityRole as za, toolRefusal as zi, JobDefinition as zn, GroupPathsOf as zr, PLUGIN_SERVERS_META_KEY as zt };
|
package/dist/adapter.cjs
CHANGED
|
@@ -1,8 +1,8 @@
|
|
|
1
1
|
Object.defineProperty(exports, Symbol.toStringTag, { value: "Module" });
|
|
2
2
|
const require_plugin = require("./plugin-Dw-yCjTY.cjs");
|
|
3
|
-
const require_plugin_server = require("./plugin-server-
|
|
3
|
+
const require_plugin_server = require("./plugin-server-D6-b-Sw8.cjs");
|
|
4
4
|
const require_schemas = require("./schemas-DNPVDvkd.cjs");
|
|
5
|
-
const require_adapter = require("./adapter-
|
|
5
|
+
const require_adapter = require("./adapter-D7KXowQc.cjs");
|
|
6
6
|
exports.API_META = require_adapter.API_META;
|
|
7
7
|
exports.AUTO_GUARD_BRAND = require_plugin.AUTO_GUARD_BRAND;
|
|
8
8
|
exports.AUTO_RESPONSES_BRAND = require_plugin.AUTO_RESPONSES_BRAND;
|
|
@@ -40,6 +40,7 @@ exports.describeTool = require_adapter.describeTool;
|
|
|
40
40
|
exports.dispatchHandler = require_adapter.dispatchHandler;
|
|
41
41
|
exports.dispatchRoute = require_adapter.dispatchRoute;
|
|
42
42
|
exports.encodeStreamBody = require_plugin_server.encodeStreamBody;
|
|
43
|
+
exports.entriesToObject = require_adapter.entriesToObject;
|
|
43
44
|
exports.extractCredential = require_adapter.extractCredential;
|
|
44
45
|
exports.flattenJobs = require_plugin_server.flattenJobs;
|
|
45
46
|
exports.flattenRoutes = require_plugin_server.flattenRoutes;
|
package/dist/adapter.d.cts
CHANGED
|
@@ -1,3 +1,3 @@
|
|
|
1
1
|
import { A as AutoResponsesBrand, B as ROUTES_GROUP, D as AUTO_RESPONSES_BRAND, I as HANDLER_CONTEXT_BRAND, K as RouteDefinition, L as HandlerContextBrand, T as AUTO_GUARD_BRAND, W as ResponseHeaders, Y as RoutePath, Z as Routes, at as ProblemDetails, c as authenticationChallenge, f as resolveSecurityRequirements, st as problemDetails, z as Method } from "./error-response-YbkRMKno.cjs";
|
|
2
|
-
import { $ as
|
|
3
|
-
export { ADAPTER_CONTEXT, API_META, AUTO_GUARD_BRAND, AUTO_RESPONSES_BRAND, AccessCheckInput, Adapter, AdapterDefinition, AdapterRequest, AdapterResult, AnyAdapter, ApiBrand, ApiParts, ApiPlugins, ApiRouter, ApiWithRouter, AutoResponsesBrand, BrandedHandlerContext, CompiledJob, ContextFromAuth, DISPATCH_ROUTE_KEY, EncodeStreamOptions, ErrorFormatter, FlattenedJob, FlattenedRoute, GUARDS_META, GUARD_SCHEMA_META, GuardDenial, GuardDenialBody, GuardDeny, GuardMap, GuardParams, GuardRun, GuardedParamNames, HANDLER_ARG_KEYS, HANDLER_CONTEXT_BRAND, HandleArgs, HandlerContextBrand, HandlerContextOf, HandlersFromRoutes, JOBS_META, JobDescriptor, JobDispatchError, JobErrorHandler, JobFnByKey, JobHandler, JobHandlers, JobInputError, JobMessage, JobRunner, JobRunnerOptions, JobTransport, JobWorker, JobWorkerContext, Jobs, JobsMeta, MatchResult, Method, MountArgsOf, MountedOf, PathSegment, PluginArgs, PluginDeclaration, PluginDefinition, PluginExportValues, PluginExportsOf, PluginRoutes, PluginRoutesOf, ProblemDetails, REQUEST_CONTEXT_META, ROUTER_META, ROUTES_GROUP, RUN_ROUTE_KEY, RawInputs, RawResponse, RenderedResult, RequestContextMap, RequestContextRun, RequestContextValues, RequestPipeline, ResolvedPlugin, ResponseError, ResponseHeaders, ResponseValidationError, RouteDefinition, RouteHandler, RouteMatch, RouteMatcher, RoutePath, Router, Routes, RoutesWithHandlerContext, SCHEMES_META, ScheduledJob, ServerOptions, StreamContext, ToolDefinition, ToolInputSchema, ValidationFailure, ValidationStage, adapterContextOf, allowedMethodsForPath, assembleApi, authenticationChallenge, bearerChallenge, boundJobKeys, buildPath, buildToolDefinitions, buildToolInputSchema, contractOf, createApiReference, createJobRunner, defineAdapter, defineJobTransport, definePlugin, describeTool, dispatchHandler, dispatchRoute, encodeStreamBody, extractCredential, flattenJobs, flattenRoutes, formatValidationError, getHeaderValue, groupRoutes, guardDenyFor, headersToObject, insufficientScope, isCompiledJob, isGroupSet, isGuardDenial, isRawResponse, isRouteDefinition, isStreamResponse, jobAt, jobFnAt, jobRouter, jobRoutes, jobRunnerFrom, matchRoute, parseBodyText, parseFetchBody, parsePath, pluginExportsOf, pluginRouteTree, pluginRouterOf, pluginRoutesOf, problemDetails, rawResponse, renderJsonResult, requiresDenial, resolvePlugins, resolveSecurityRequirements, routerFromRoutes, runHandler, runRoute, selectToolRoutes, sortFlattenedRoutes, toolOptionsOf, toolRefusal, validateRequest, warnUnsupportedJobOptions, withPermissions };
|
|
2
|
+
import { $ as jobRoutes, A as RenderedResult, B as bearerChallenge, Bn as JobHandler, C as JOBS_META, Ca as insufficientScope, Ci as isRouteDefinition, D as REQUEST_CONTEXT_META, E as MountedOf, F as RouteMatcher, Fi as buildToolInputSchema, G as dispatchRoute, Gr as isRawResponse, Gt as PluginExportsOf, H as contractOf, Ht as PluginDeclaration, I as SCHEMES_META, Ii as describeTool, In as FlattenedJob, It as ApiPlugins, J as getHeaderValue, K as entriesToObject, Ki as buildPath, Kr as rawResponse, L as ServerOptions, Li as selectToolRoutes, M as RequestContextRun, Mi as ToolDefinition, N as RequestPipeline, Ni as ToolInputSchema, O as ROUTER_META, P as ResponseValidationError, Pi as buildToolDefinitions, Pn as CompiledJob, Q as jobRouter, Qn as isCompiledJob, Qr as sortFlattenedRoutes, R as adapterContextOf, Ri as toolOptionsOf, S as HandlerContextOf, Sa as AccessCheckInput, Si as formatValidationError, T as MountArgsOf, Ta as withPermissions, U as defineAdapter, Un as JobHandlers, Ur as isGroupSet, Ut as PluginDefinition, V as boundJobKeys, Vt as PluginArgs, W as dispatchHandler, Wi as PathSegment, Wr as RawResponse, Wt as PluginExportValues, X as headersToObject, Xr as RouteMatch, Xt as PluginRoutesOf, Y as guardDenyFor, Yi as EncodeStreamOptions, Yr as MatchResult, Yt as PluginRoutes, Z as isGuardDenial, Zn as flattenJobs, Zr as matchRoute, _ as GuardDeny, a as AdapterRequest, aa as encodeStreamBody, an as pluginRouteTree, at as runHandler, b as HANDLER_ARG_KEYS, bi as allowedMethodsForPath, br as ScheduledJob, c as ApiBrand, cr as JobRunner, ct as ApiRouter, d as DISPATCH_ROUTE_KEY, di as RawInputs, dr as jobFnAt, dt as createApiReference, ea as StreamContext, ei as BrandedHandlerContext, en as ResolvedPlugin, er as jobAt, et as jobRunnerFrom, f as ErrorFormatter, fi as RequestContextValues, fr as JobDescriptor, ft as pluginExportsOf, g as GuardDenialBody, gi as RoutesWithHandlerContext, h as GuardDenial, hi as Router, hr as JobTransport, ht as resolvePlugins, i as AdapterDefinition, ii as GuardParams, in as definePlugin, ir as JobInputError, it as routerFromRoutes, j as RequestContextMap, k as RUN_ROUTE_KEY, l as ApiParts, lr as JobRunnerOptions, lt as ResponseError, m as GUARD_SCHEMA_META, mi as RouteHandler, mr as JobMessage, mt as pluginRoutesOf, n as API_META, ni as FlattenedRoute, nt as parseFetchBody, o as AdapterResult, ot as runRoute, p as GUARDS_META, pr as JobDispatchError, pt as pluginRouterOf, q as extractCredential, qi as parsePath, qn as Jobs, r as Adapter, rr as JobFnByKey, rt as renderJsonResult, s as AnyAdapter, si as GuardedParamNames, st as warnUnsupportedJobOptions, t as ADAPTER_CONTEXT, ti as ContextFromAuth, tr as JobErrorHandler, tt as parseBodyText, u as ApiWithRouter, ui as HandlersFromRoutes, ur as createJobRunner, ut as groupRoutes, v as GuardMap, vi as ValidationFailure, vr as JobWorker, vt as isStreamResponse, w as JobsMeta, wa as requiresDenial, wi as validateRequest, x as HandleArgs, xi as flattenRoutes, xr as defineJobTransport, y as GuardRun, yi as ValidationStage, yr as JobWorkerContext, z as assembleApi, zi as toolRefusal } from "./adapter-nQIkQwsM.cjs";
|
|
3
|
+
export { ADAPTER_CONTEXT, API_META, AUTO_GUARD_BRAND, AUTO_RESPONSES_BRAND, AccessCheckInput, Adapter, AdapterDefinition, AdapterRequest, AdapterResult, AnyAdapter, ApiBrand, ApiParts, ApiPlugins, ApiRouter, ApiWithRouter, AutoResponsesBrand, BrandedHandlerContext, CompiledJob, ContextFromAuth, DISPATCH_ROUTE_KEY, EncodeStreamOptions, ErrorFormatter, FlattenedJob, FlattenedRoute, GUARDS_META, GUARD_SCHEMA_META, GuardDenial, GuardDenialBody, GuardDeny, GuardMap, GuardParams, GuardRun, GuardedParamNames, HANDLER_ARG_KEYS, HANDLER_CONTEXT_BRAND, HandleArgs, HandlerContextBrand, HandlerContextOf, HandlersFromRoutes, JOBS_META, JobDescriptor, JobDispatchError, JobErrorHandler, JobFnByKey, JobHandler, JobHandlers, JobInputError, JobMessage, JobRunner, JobRunnerOptions, JobTransport, JobWorker, JobWorkerContext, Jobs, JobsMeta, MatchResult, Method, MountArgsOf, MountedOf, PathSegment, PluginArgs, PluginDeclaration, PluginDefinition, PluginExportValues, PluginExportsOf, PluginRoutes, PluginRoutesOf, ProblemDetails, REQUEST_CONTEXT_META, ROUTER_META, ROUTES_GROUP, RUN_ROUTE_KEY, RawInputs, RawResponse, RenderedResult, RequestContextMap, RequestContextRun, RequestContextValues, RequestPipeline, ResolvedPlugin, ResponseError, ResponseHeaders, ResponseValidationError, RouteDefinition, RouteHandler, RouteMatch, RouteMatcher, RoutePath, Router, Routes, RoutesWithHandlerContext, SCHEMES_META, ScheduledJob, ServerOptions, StreamContext, ToolDefinition, ToolInputSchema, ValidationFailure, ValidationStage, adapterContextOf, allowedMethodsForPath, assembleApi, authenticationChallenge, bearerChallenge, boundJobKeys, buildPath, buildToolDefinitions, buildToolInputSchema, contractOf, createApiReference, createJobRunner, defineAdapter, defineJobTransport, definePlugin, describeTool, dispatchHandler, dispatchRoute, encodeStreamBody, entriesToObject, extractCredential, flattenJobs, flattenRoutes, formatValidationError, getHeaderValue, groupRoutes, guardDenyFor, headersToObject, insufficientScope, isCompiledJob, isGroupSet, isGuardDenial, isRawResponse, isRouteDefinition, isStreamResponse, jobAt, jobFnAt, jobRouter, jobRoutes, jobRunnerFrom, matchRoute, parseBodyText, parseFetchBody, parsePath, pluginExportsOf, pluginRouteTree, pluginRouterOf, pluginRoutesOf, problemDetails, rawResponse, renderJsonResult, requiresDenial, resolvePlugins, resolveSecurityRequirements, routerFromRoutes, runHandler, runRoute, selectToolRoutes, sortFlattenedRoutes, toolOptionsOf, toolRefusal, validateRequest, warnUnsupportedJobOptions, withPermissions };
|
package/dist/adapter.d.mts
CHANGED
|
@@ -1,3 +1,3 @@
|
|
|
1
1
|
import { A as AutoResponsesBrand, B as ROUTES_GROUP, D as AUTO_RESPONSES_BRAND, I as HANDLER_CONTEXT_BRAND, K as RouteDefinition, L as HandlerContextBrand, T as AUTO_GUARD_BRAND, W as ResponseHeaders, Y as RoutePath, Z as Routes, at as ProblemDetails, c as authenticationChallenge, f as resolveSecurityRequirements, st as problemDetails, z as Method } from "./error-response-NoOGdh8H.mjs";
|
|
2
|
-
import { $ as
|
|
3
|
-
export { ADAPTER_CONTEXT, API_META, AUTO_GUARD_BRAND, AUTO_RESPONSES_BRAND, AccessCheckInput, Adapter, AdapterDefinition, AdapterRequest, AdapterResult, AnyAdapter, ApiBrand, ApiParts, ApiPlugins, ApiRouter, ApiWithRouter, AutoResponsesBrand, BrandedHandlerContext, CompiledJob, ContextFromAuth, DISPATCH_ROUTE_KEY, EncodeStreamOptions, ErrorFormatter, FlattenedJob, FlattenedRoute, GUARDS_META, GUARD_SCHEMA_META, GuardDenial, GuardDenialBody, GuardDeny, GuardMap, GuardParams, GuardRun, GuardedParamNames, HANDLER_ARG_KEYS, HANDLER_CONTEXT_BRAND, HandleArgs, HandlerContextBrand, HandlerContextOf, HandlersFromRoutes, JOBS_META, JobDescriptor, JobDispatchError, JobErrorHandler, JobFnByKey, JobHandler, JobHandlers, JobInputError, JobMessage, JobRunner, JobRunnerOptions, JobTransport, JobWorker, JobWorkerContext, Jobs, JobsMeta, MatchResult, Method, MountArgsOf, MountedOf, PathSegment, PluginArgs, PluginDeclaration, PluginDefinition, PluginExportValues, PluginExportsOf, PluginRoutes, PluginRoutesOf, ProblemDetails, REQUEST_CONTEXT_META, ROUTER_META, ROUTES_GROUP, RUN_ROUTE_KEY, RawInputs, RawResponse, RenderedResult, RequestContextMap, RequestContextRun, RequestContextValues, RequestPipeline, ResolvedPlugin, ResponseError, ResponseHeaders, ResponseValidationError, RouteDefinition, RouteHandler, RouteMatch, RouteMatcher, RoutePath, Router, Routes, RoutesWithHandlerContext, SCHEMES_META, ScheduledJob, ServerOptions, StreamContext, ToolDefinition, ToolInputSchema, ValidationFailure, ValidationStage, adapterContextOf, allowedMethodsForPath, assembleApi, authenticationChallenge, bearerChallenge, boundJobKeys, buildPath, buildToolDefinitions, buildToolInputSchema, contractOf, createApiReference, createJobRunner, defineAdapter, defineJobTransport, definePlugin, describeTool, dispatchHandler, dispatchRoute, encodeStreamBody, extractCredential, flattenJobs, flattenRoutes, formatValidationError, getHeaderValue, groupRoutes, guardDenyFor, headersToObject, insufficientScope, isCompiledJob, isGroupSet, isGuardDenial, isRawResponse, isRouteDefinition, isStreamResponse, jobAt, jobFnAt, jobRouter, jobRoutes, jobRunnerFrom, matchRoute, parseBodyText, parseFetchBody, parsePath, pluginExportsOf, pluginRouteTree, pluginRouterOf, pluginRoutesOf, problemDetails, rawResponse, renderJsonResult, requiresDenial, resolvePlugins, resolveSecurityRequirements, routerFromRoutes, runHandler, runRoute, selectToolRoutes, sortFlattenedRoutes, toolOptionsOf, toolRefusal, validateRequest, warnUnsupportedJobOptions, withPermissions };
|
|
2
|
+
import { $ as jobRoutes, A as RenderedResult, B as bearerChallenge, Bn as JobHandler, C as JOBS_META, Ca as insufficientScope, Ci as isRouteDefinition, D as REQUEST_CONTEXT_META, E as MountedOf, F as RouteMatcher, Fi as buildToolInputSchema, G as dispatchRoute, Gr as isRawResponse, Gt as PluginExportsOf, H as contractOf, Ht as PluginDeclaration, I as SCHEMES_META, Ii as describeTool, In as FlattenedJob, It as ApiPlugins, J as getHeaderValue, K as entriesToObject, Ki as buildPath, Kr as rawResponse, L as ServerOptions, Li as selectToolRoutes, M as RequestContextRun, Mi as ToolDefinition, N as RequestPipeline, Ni as ToolInputSchema, O as ROUTER_META, P as ResponseValidationError, Pi as buildToolDefinitions, Pn as CompiledJob, Q as jobRouter, Qn as isCompiledJob, Qr as sortFlattenedRoutes, R as adapterContextOf, Ri as toolOptionsOf, S as HandlerContextOf, Sa as AccessCheckInput, Si as formatValidationError, T as MountArgsOf, Ta as withPermissions, U as defineAdapter, Un as JobHandlers, Ur as isGroupSet, Ut as PluginDefinition, V as boundJobKeys, Vt as PluginArgs, W as dispatchHandler, Wi as PathSegment, Wr as RawResponse, Wt as PluginExportValues, X as headersToObject, Xr as RouteMatch, Xt as PluginRoutesOf, Y as guardDenyFor, Yi as EncodeStreamOptions, Yr as MatchResult, Yt as PluginRoutes, Z as isGuardDenial, Zn as flattenJobs, Zr as matchRoute, _ as GuardDeny, a as AdapterRequest, aa as encodeStreamBody, an as pluginRouteTree, at as runHandler, b as HANDLER_ARG_KEYS, bi as allowedMethodsForPath, br as ScheduledJob, c as ApiBrand, cr as JobRunner, ct as ApiRouter, d as DISPATCH_ROUTE_KEY, di as RawInputs, dr as jobFnAt, dt as createApiReference, ea as StreamContext, ei as BrandedHandlerContext, en as ResolvedPlugin, er as jobAt, et as jobRunnerFrom, f as ErrorFormatter, fi as RequestContextValues, fr as JobDescriptor, ft as pluginExportsOf, g as GuardDenialBody, gi as RoutesWithHandlerContext, h as GuardDenial, hi as Router, hr as JobTransport, ht as resolvePlugins, i as AdapterDefinition, ii as GuardParams, in as definePlugin, ir as JobInputError, it as routerFromRoutes, j as RequestContextMap, k as RUN_ROUTE_KEY, l as ApiParts, lr as JobRunnerOptions, lt as ResponseError, m as GUARD_SCHEMA_META, mi as RouteHandler, mr as JobMessage, mt as pluginRoutesOf, n as API_META, ni as FlattenedRoute, nt as parseFetchBody, o as AdapterResult, ot as runRoute, p as GUARDS_META, pr as JobDispatchError, pt as pluginRouterOf, q as extractCredential, qi as parsePath, qn as Jobs, r as Adapter, rr as JobFnByKey, rt as renderJsonResult, s as AnyAdapter, si as GuardedParamNames, st as warnUnsupportedJobOptions, t as ADAPTER_CONTEXT, ti as ContextFromAuth, tr as JobErrorHandler, tt as parseBodyText, u as ApiWithRouter, ui as HandlersFromRoutes, ur as createJobRunner, ut as groupRoutes, v as GuardMap, vi as ValidationFailure, vr as JobWorker, vt as isStreamResponse, w as JobsMeta, wa as requiresDenial, wi as validateRequest, x as HandleArgs, xi as flattenRoutes, xr as defineJobTransport, y as GuardRun, yi as ValidationStage, yr as JobWorkerContext, z as assembleApi, zi as toolRefusal } from "./adapter-BdkB6ql9.mjs";
|
|
3
|
+
export { ADAPTER_CONTEXT, API_META, AUTO_GUARD_BRAND, AUTO_RESPONSES_BRAND, AccessCheckInput, Adapter, AdapterDefinition, AdapterRequest, AdapterResult, AnyAdapter, ApiBrand, ApiParts, ApiPlugins, ApiRouter, ApiWithRouter, AutoResponsesBrand, BrandedHandlerContext, CompiledJob, ContextFromAuth, DISPATCH_ROUTE_KEY, EncodeStreamOptions, ErrorFormatter, FlattenedJob, FlattenedRoute, GUARDS_META, GUARD_SCHEMA_META, GuardDenial, GuardDenialBody, GuardDeny, GuardMap, GuardParams, GuardRun, GuardedParamNames, HANDLER_ARG_KEYS, HANDLER_CONTEXT_BRAND, HandleArgs, HandlerContextBrand, HandlerContextOf, HandlersFromRoutes, JOBS_META, JobDescriptor, JobDispatchError, JobErrorHandler, JobFnByKey, JobHandler, JobHandlers, JobInputError, JobMessage, JobRunner, JobRunnerOptions, JobTransport, JobWorker, JobWorkerContext, Jobs, JobsMeta, MatchResult, Method, MountArgsOf, MountedOf, PathSegment, PluginArgs, PluginDeclaration, PluginDefinition, PluginExportValues, PluginExportsOf, PluginRoutes, PluginRoutesOf, ProblemDetails, REQUEST_CONTEXT_META, ROUTER_META, ROUTES_GROUP, RUN_ROUTE_KEY, RawInputs, RawResponse, RenderedResult, RequestContextMap, RequestContextRun, RequestContextValues, RequestPipeline, ResolvedPlugin, ResponseError, ResponseHeaders, ResponseValidationError, RouteDefinition, RouteHandler, RouteMatch, RouteMatcher, RoutePath, Router, Routes, RoutesWithHandlerContext, SCHEMES_META, ScheduledJob, ServerOptions, StreamContext, ToolDefinition, ToolInputSchema, ValidationFailure, ValidationStage, adapterContextOf, allowedMethodsForPath, assembleApi, authenticationChallenge, bearerChallenge, boundJobKeys, buildPath, buildToolDefinitions, buildToolInputSchema, contractOf, createApiReference, createJobRunner, defineAdapter, defineJobTransport, definePlugin, describeTool, dispatchHandler, dispatchRoute, encodeStreamBody, entriesToObject, extractCredential, flattenJobs, flattenRoutes, formatValidationError, getHeaderValue, groupRoutes, guardDenyFor, headersToObject, insufficientScope, isCompiledJob, isGroupSet, isGuardDenial, isRawResponse, isRouteDefinition, isStreamResponse, jobAt, jobFnAt, jobRouter, jobRoutes, jobRunnerFrom, matchRoute, parseBodyText, parseFetchBody, parsePath, pluginExportsOf, pluginRouteTree, pluginRouterOf, pluginRoutesOf, problemDetails, rawResponse, renderJsonResult, requiresDenial, resolvePlugins, resolveSecurityRequirements, routerFromRoutes, runHandler, runRoute, selectToolRoutes, sortFlattenedRoutes, toolOptionsOf, toolRefusal, validateRequest, warnUnsupportedJobOptions, withPermissions };
|