kizunajs 2.0.0-beta.14 → 2.0.0-beta.15

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 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
- [![npm](https://img.shields.io/npm/v/kizunajs/beta?color=blue&label=npm)](https://www.npmjs.com/package/kizunajs/v/2.0.0-beta.14)
7
+ [![npm](https://img.shields.io/npm/v/kizunajs/beta?color=blue&label=npm)](https://www.npmjs.com/package/kizunajs/v/2.0.0-beta.15)
8
8
  ![license](https://img.shields.io/badge/license-MIT-blue)
9
9
 
10
10
  [Documentation](https://kizunajs.com)
@@ -1,6 +1,6 @@
1
1
  const require_plugin = require("./plugin-D_WJ2GBf.cjs");
2
2
  const require_error_response = require("./error-response-C9ymqSU4.cjs");
3
- const require_plugin_server = require("./plugin-server-DrDIPl6R.cjs");
3
+ const require_plugin_server = require("./plugin-server-CIC64cSM.cjs");
4
4
  const require_schemas = require("./schemas-7y2XV1if.cjs");
5
5
  let zod = require("zod");
6
6
  //#region src/tags.ts
@@ -1351,12 +1351,12 @@ const assembleApi = (contract, parts) => {
1351
1351
  };
1352
1352
  /**
1353
1353
  * The endpoints jobs are served on, in the {@link Routes} shape the request
1354
- * pipeline takes.
1354
+ * pipeline takes. None when the jobs run in process.
1355
1355
  */
1356
- const jobRoutes = (meta) => ({
1356
+ const jobRoutes = (meta) => meta.config?.mode === "in-process" ? {} : {
1357
1357
  [DISPATCH_ROUTE_KEY]: dispatchRoute(meta),
1358
1358
  [RUN_ROUTE_KEY]: runRoute(meta)
1359
- });
1359
+ };
1360
1360
  /**
1361
1361
  * Their handlers, in the {@link Router} shape the request pipeline takes.
1362
1362
  */
@@ -1,6 +1,6 @@
1
1
  import { g as ROUTES_TAG, n as PLUGIN_SERVERS_META_KEY, o as pluginRouteTree, p as HANDLER, t as PLUGIN_ROUTES_META_KEY } from "./plugin-CFpv8XTz.mjs";
2
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 { A as EVENT_STREAM_MEDIA_TYPE, H as isStreamResponse, I as streamContentType, J as resolveResponseCache, M as encodeStreamBody, O as deriveToolNames, P as routeStreams, R as streamSchemas, U as isSuccessStatus, V as isJsonMediaType, W as isZodSchema, X as resolveResponseEtag, Y as resolveResponseContentType, c as cacheHeaders, ct as flattenRoutes, dt as validateRequest, ft as resolveCoercionPlans, g as jobAt, j as assertValidStreams, lt as formatValidationError, m as isCompiledJob, ot as parsePath, p as flattenJobs, q as resolveResponseBody, st as allowedMethodsForPath, u as deprecationHeaders, ut as isRouteDefinition, v as toJobResponse, x as dueSchedules } from "./plugin-server-C0CyVED-.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-C9i5kuJN.mjs";
4
4
  import { l as authenticationChallenge, p as resolveSecurityRequirements } from "./schemas-_W2cLAVl.mjs";
5
5
  import { z } from "zod";
6
6
  //#region src/tags.ts
@@ -1351,12 +1351,12 @@ const assembleApi = (contract, parts) => {
1351
1351
  };
1352
1352
  /**
1353
1353
  * The endpoints jobs are served on, in the {@link Routes} shape the request
1354
- * pipeline takes.
1354
+ * pipeline takes. None when the jobs run in process.
1355
1355
  */
1356
- const jobRoutes = (meta) => ({
1356
+ const jobRoutes = (meta) => meta.config?.mode === "in-process" ? {} : {
1357
1357
  [DISPATCH_ROUTE_KEY]: dispatchRoute(meta),
1358
1358
  [RUN_ROUTE_KEY]: runRoute(meta)
1359
- });
1359
+ };
1360
1360
  /**
1361
1361
  * Their handlers, in the {@link Router} shape the request pipeline takes.
1362
1362
  */
@@ -1360,10 +1360,21 @@ declare const createJobRunner: <Jobs_ extends Jobs>(source: Jobs_ | {
1360
1360
  //#endregion
1361
1361
  //#region src/jobs.d.ts
1362
1362
  /**
1363
- * Settings shared by every job, named in `defineConfig` under `jobsConfig`. The jobs
1363
+ * Settings shared by every job, named in `defineConfig` under `jobRunner`. The jobs
1364
1364
  * themselves are declared with `k.jobs`.
1365
1365
  */
1366
- interface JobsConfig {
1366
+ type JobsConfig = HttpJobsConfig | InProcessJobsConfig;
1367
+ /**
1368
+ * Jobs triggered over HTTP, by platform cron ticking `/jobs/dispatch` or a
1369
+ * transport delivering to `/jobs/run`.
1370
+ */
1371
+ interface HttpJobsConfig {
1372
+ /**
1373
+ * `'http'` serves `/jobs/dispatch` and `/jobs/run`, guarded by the jobs'
1374
+ * identity. `'in-process'` is for a long-running server whose schedules
1375
+ * `startJobs` ticks, and serves neither.
1376
+ */
1377
+ mode: 'http';
1367
1378
  /**
1368
1379
  * The namespace both job endpoints are mounted under, `dispatch` and `run`
1369
1380
  * beneath it. Nothing is served on the namespace itself.
@@ -1394,11 +1405,28 @@ interface JobsConfig {
1394
1405
  exclude?: readonly string[];
1395
1406
  }
1396
1407
  /**
1397
- * How a deployment runs the jobs it declares: where the two endpoints sit, what
1408
+ * Jobs a long-running server runs itself, its schedules ticked by `startJobs`.
1409
+ * No job endpoint is served, so the jobs need no identity.
1410
+ */
1411
+ interface InProcessJobsConfig {
1412
+ mode: 'in-process';
1413
+ path?: never;
1414
+ method?: never;
1415
+ windowMs?: never;
1416
+ only?: never;
1417
+ exclude?: never;
1418
+ }
1419
+ /**
1420
+ * How a deployment runs the jobs it declares: how they are triggered, what
1398
1421
  * carries queued work out of the process, and where a failure that happened
1399
1422
  * after the response went out is reported.
1400
1423
  */
1401
- interface JobRunnerConfig extends JobsConfig {
1424
+ type JobRunnerConfig = JobsConfig & JobDeliveryConfig;
1425
+ /**
1426
+ * Where queued work goes and where a late failure is reported, whichever way
1427
+ * the jobs are triggered.
1428
+ */
1429
+ interface JobDeliveryConfig {
1402
1430
  /**
1403
1431
  * Carries a queued job to whatever runs it. Without one, `queue` runs the
1404
1432
  * job in this process and it is lost on a crash.
@@ -1598,7 +1626,7 @@ interface ApiDefinition<Routes_ extends Routes = Routes, Tags extends Record<str
1598
1626
  */
1599
1627
  jobs?: Jobs_;
1600
1628
  /**
1601
- * The job settings named in `defineConfig` under `jobsConfig`.
1629
+ * The job settings named in `defineConfig` under `jobRunner`.
1602
1630
  */
1603
1631
  jobsConfig?: JobsConfig;
1604
1632
  /**
@@ -2348,7 +2376,7 @@ declare const assembleApi: <const R extends Routes>(contract: {
2348
2376
  }, parts: ApiParts) => ApiWithRouter<R>;
2349
2377
  /**
2350
2378
  * The endpoints jobs are served on, in the {@link Routes} shape the request
2351
- * pipeline takes.
2379
+ * pipeline takes. None when the jobs run in process.
2352
2380
  */
2353
2381
  declare const jobRoutes: (meta: JobsMeta) => Routes;
2354
2382
  /**
@@ -2683,4 +2711,4 @@ declare const parseBodyText: (text: string, route: RouteDefinition) => unknown;
2683
2711
  declare const parseFetchBody: (request: Request, route: RouteDefinition) => Promise<unknown>;
2684
2712
  declare const headersToObject: (headers: Headers) => ResponseHeaders;
2685
2713
  //#endregion
2686
- export { jobRunnerFrom as $, StreamMode as $i, JobFn as $n, GuardAnswer as $r, ResolvedPlugin as $t, RenderedResult as A, CustomConfig as Aa, buildToolDefinitions as Ai, SchemesOf as An, RequestContextConfig as Ar, shortTypeName as At, bearerChallenge as B, RolesOf as Ba, PathSegment as Bi, JobHandlers as Bn, RawResponse as Br, PluginArgs as Bt, JOBS_META as C, ApiKeyCredential as Ca, ToolAnswer as Ci, apiEntries as Cn, dueSchedules as Cr, resolveResponseCache as Ct, REQUEST_CONTEXT_META as D, BearerCredential as Da, ToolRunResult as Di, JobsOf as Dn, parseCron as Dr, resolveResponseStream as Dt, MountedOf as E, BearerConfig as Ea, ToolRunOptions as Ei, GuardSchemaOf as En, nextRuns as Er, resolveResponseHeaders as Et, RouteMatcher as F, IdentityRole as Fa, toolRefusal as Fi, FlattenedJob as Fn, TagKeysOf as Fr, ApiPlugins as Ft, dispatchRoute as G, EncodeStreamOptions as Gi, JobsArg as Gn, MatchResult as Gr, PluginFactory as Gt, contractOf as H, buildPath as Hi, JobRunnerConfig as Hn, rawResponse as Hr, PluginDefinition as Ht, SCHEMES_META as I, NoCredential as Ia, ExtractPathParams as Ii, JobDefinition as In, TagOptions as Ir, InstallOptions as It, guardDenyFor as J, StreamChunk as Ji, flattenJobs as Jn, sortFlattenedRoutes as Jr, PluginRoutes as Jt, extractCredential as K, StreamBody as Ki, JobsConfig as Kn, RouteMatch as Kr, PluginList as Kt, ServerOptions as L, OAuth2Config as La, HasPathParams as Li, JobHandler as Ln, TagSet as Lr, PLUGIN_ROUTES_META_KEY as Lt, RequestContextRun as M, GuardHoldings as Ma, describeTool as Mi, AuthoredJobs as Mn, RequestContextHeaderValues as Mr, toCamelCase as Mt, RequestPipeline as N, Identity as Na, selectToolRoutes as Ni, CompiledJob as Nn, RequestContextSchema as Nr, toPascalCase as Nt, ROUTER_META as O, Credential as Oa, ToolDefinition as Oi, RequestContextOf as On, scheduleExpression as Or, sanitizeFieldName as Ot, ResponseValidationError as P, IdentityParamsOf as Pa, toolOptionsOf as Pi, CompiledJobs as Pn, NormalizeTags as Pr, AnyPlugin as Pt, jobRoutes as Q, StreamMessageOf as Qi, JobErrorHandler as Qn, FlattenedRoute as Qr, PluginsBySlug as Qt, adapterContextOf as R, OpenIdConnectConfig as Ra, PathParamName as Ri, JobHandlerArgs as Rn, createTags as Rr, PLUGIN_SERVERS_META_KEY as Rt, HandlerContextOf as S, ApiKeyConfig as Sa, StreamTools as Si, GeneratedFile as Sn, cron as Sr, resolveResponseBody as St, MountArgsOf as T, BasicCredential as Ta, ToolRunCall as Ti, ApiPluginsOf as Tn, nextRun as Tr, resolveResponseEtag as Tt, defineAdapter as U, parsePath as Ui, JobVoidReturn as Un, RouteBuilder as Ur, PluginExportValues as Ut, boundJobKeys as V, RoutePathParamsCheck as Vi, JobResponses as Vn, isRawResponse as Vr, PluginDeclaration as Vt, dispatchHandler as W, EVENT_STREAM_MEDIA_TYPE as Wi, Jobs as Wn, RouteWithHandler as Wr, PluginExportsOf as Wt, isGuardDenial as X, StreamContext as Xi, isJobDefinition as Xn, BrandedHandlerContext as Xr, PluginSetup as Xt, headersToObject as Y, StreamComment as Yi, isCompiledJob as Yn, AuthContextOf as Yr, PluginRoutesOf as Yt, jobRouter as Z, StreamMessage as Zi, jobAt as Zn, ContextFromAuth as Zr, PluginSetupContext as Zt, GuardDeny as _, toolEvents as _a, flattenRoutes as _i, JobFnOf as _n, ScheduledJob as _r, isStreamResponse as _t, AdapterRequest as a, streamContentType as aa, HandlerReturn as ai, route as an, JobRunner as ar, runRoute as at, HANDLER_ARG_KEYS as b, requiresDenial as ba, validateRequest as bi, ApiEntry as bn, ParsedCron as br, localTypeName as bt, ApiBrand as c, streamStatuses as ca, RequestContextValues as ci, ConfiguredAdapterValue as cn, jobFnAt as cr, ResponseError as ct, DISPATCH_ROUTE_KEY as d, ToolCall as da, Router as di, ConfiguredIdentities as dn, JobMessage as dr, pluginExportsOf as dt, StreamYield as ea, GuardParams as ei, RouteAuthSchema as en, JobFnByKey as er, parseBodyText as et, ErrorFormatter as f, ToolError as fa, RoutesWithHandlerContext as fi, ConfiguredJobs as fn, JobTransport as fr, pluginRouterOf as ft, GuardDenialBody as g, expandStreamTools as ga, allowedMethodsForPath as gi, ConfiguredTags as gn, JobWorkerContext as gr, isJsonMediaType as gt, GuardDenial as h, ToolResult as ha, ValidationStage as hi, ConfiguredRequestContextSchemas as hn, JobWorker as hr, isHintPrefix as ht, AdapterDefinition as i, soleStreamResponse as ia, HandlerArgs as ii, pluginRouteTree as in, JobRunArgs as ir, runHandler as it, RequestContextMap as j, GrantsOf as ja, buildToolInputSchema as ji, AuthoredJobDefinition as jn, RequestContextHeaderInputs as jr, statusToCamelCase as jt, RUN_ROUTE_KEY as k, CredentialOf as ka, ToolInputSchema as ki, RoutesOf as kn, scheduleTimezone as kr, sanitizeIdentifier as kt, ApiParts as l, StreamWithTools as la, RouteGuardBrandOf as li, ConfiguredCodes as ln, JobDescriptor as lr, tagRoutes as lt, GUARD_SCHEMA_META as m, ToolKeys as ma, ValidationFailure as mi, ConfiguredRequestContext as mn, JobTransportSupports as mr, resolvePlugins as mt, API_META as n, isNamedStream as na, GuardSuccess as ni, SlugOption as nn, JobQueueArgs as nr, renderJsonResult as nt, AdapterResult as o, streamMode as oa, HandlersFromRoutes as oi, ApiContext as on, JobRunnerOptions as or, warnUnsupportedJobOptions as ot, GUARDS_META as p, ToolEvents as pa, ThrowableReturn as pi, ConfiguredPlugins as pn, JobTransportDefinition as pr, pluginRoutesOf as pt, getHeaderValue as q, StreamBodyOf as qi, NoJobs as qn, matchRoute as qr, PluginRouteBuilder as qt, Adapter as r, routeStreams as ra, GuardedParamNames as ri, definePlugin as rn, JobQueueOptions as rr, routerFromRoutes as rt, AnyAdapter as s, streamSchemas as sa, RawInputs as si, ConfiguredAdapterContext as sn, createJobRunner as sr, ApiRouter as st, ADAPTER_CONTEXT as t, encodeStreamBody as ta, GuardReturn as ti, RoutePathSchema as tn, JobInputError as tr, parseFetchBody as tt, ApiWithRouter as u, ToolAt as ua, RouteHandler as ui, ConfiguredGuardSchema as un, JobDispatchError as ur, createApiReference as ut, GuardMap as v, AccessCheckInput as va, formatValidationError as vi, JobsOfTree as vn, defineJobTransport as vr, isSuccessStatus as vt, JobsMeta as w, BasicConfig as wa, ToolEventYield as wi, ApiDefinition as wn, firesBetween as wr, resolveResponseContentType as wt, HandleArgs as x, withPermissions as xa, ModelToolCall as xi, DiffSettings as xn, assertValidSchedule as xr, mergeHeaderFields as xt, GuardRun as y, insufficientScope as ya, isRouteDefinition as yi, KizunaConfigShape as yn, JobSchedule as yr, isZodSchema as yt, assembleApi as z, RoleOf as za, PathParamsCheck as zi, JobHandlerReturn as zn, isTagSet as zr, PluginApi as zt };
2714
+ export { jobRunnerFrom as $, StreamMessage as $i, jobAt as $n, ContextFromAuth as $r, ResolvedPlugin as $t, RenderedResult as A, Credential as Aa, ToolDefinition as Ai, SchemesOf as An, scheduleExpression as Ar, shortTypeName as At, bearerChallenge as B, OpenIdConnectConfig as Ba, PathParamName as Bi, JobHandlerArgs as Bn, createTags as Br, PluginArgs as Bt, JOBS_META as C, withPermissions as Ca, ModelToolCall as Ci, apiEntries as Cn, assertValidSchedule as Cr, resolveResponseCache as Ct, REQUEST_CONTEXT_META as D, BasicCredential as Da, ToolRunCall as Di, JobsOf as Dn, nextRun as Dr, resolveResponseStream as Dt, MountedOf as E, BasicConfig as Ea, ToolEventYield as Ei, GuardSchemaOf as En, firesBetween as Er, resolveResponseHeaders as Et, RouteMatcher as F, Identity as Fa, selectToolRoutes as Fi, FlattenedJob as Fn, RequestContextSchema as Fr, ApiPlugins as Ft, dispatchRoute as G, parsePath as Gi, JobVoidReturn as Gn, RouteBuilder as Gr, PluginFactory as Gt, contractOf as H, RolesOf as Ha, PathSegment as Hi, JobHandlers as Hn, RawResponse as Hr, PluginDefinition as Ht, SCHEMES_META as I, IdentityParamsOf as Ia, toolOptionsOf as Ii, HttpJobsConfig as In, NormalizeTags as Ir, InstallOptions as It, guardDenyFor as J, StreamBody as Ji, JobsConfig as Jn, RouteMatch as Jr, PluginRoutes as Jt, extractCredential as K, EVENT_STREAM_MEDIA_TYPE as Ki, Jobs as Kn, RouteWithHandler as Kr, PluginList as Kt, ServerOptions as L, IdentityRole as La, toolRefusal as Li, InProcessJobsConfig as Ln, TagKeysOf as Lr, PLUGIN_ROUTES_META_KEY as Lt, RequestContextRun as M, CustomConfig as Ma, buildToolDefinitions as Mi, AuthoredJobs as Mn, RequestContextConfig as Mr, toCamelCase as Mt, RequestPipeline as N, GrantsOf as Na, buildToolInputSchema as Ni, CompiledJob as Nn, RequestContextHeaderInputs as Nr, toPascalCase as Nt, ROUTER_META as O, BearerConfig as Oa, ToolRunOptions as Oi, RequestContextOf as On, nextRuns as Or, sanitizeFieldName as Ot, ResponseValidationError as P, GuardHoldings as Pa, describeTool as Pi, CompiledJobs as Pn, RequestContextHeaderValues as Pr, AnyPlugin as Pt, jobRoutes as Q, StreamContext as Qi, isJobDefinition as Qn, BrandedHandlerContext as Qr, PluginsBySlug as Qt, adapterContextOf as R, NoCredential as Ra, ExtractPathParams as Ri, JobDefinition as Rn, TagOptions as Rr, PLUGIN_SERVERS_META_KEY as Rt, HandlerContextOf as S, requiresDenial as Sa, validateRequest as Si, GeneratedFile as Sn, ParsedCron as Sr, resolveResponseBody as St, MountArgsOf as T, ApiKeyCredential as Ta, ToolAnswer as Ti, ApiPluginsOf as Tn, dueSchedules as Tr, resolveResponseEtag as Tt, defineAdapter as U, RoutePathParamsCheck as Ui, JobResponses as Un, isRawResponse as Ur, PluginExportValues as Ut, boundJobKeys as V, RoleOf as Va, PathParamsCheck as Vi, JobHandlerReturn as Vn, isTagSet as Vr, PluginDeclaration as Vt, dispatchHandler as W, buildPath as Wi, JobRunnerConfig as Wn, rawResponse as Wr, PluginExportsOf as Wt, isGuardDenial as X, StreamChunk as Xi, flattenJobs as Xn, sortFlattenedRoutes as Xr, PluginSetup as Xt, headersToObject as Y, StreamBodyOf as Yi, NoJobs as Yn, matchRoute as Yr, PluginRoutesOf as Yt, jobRouter as Z, StreamComment as Zi, isCompiledJob as Zn, AuthContextOf as Zr, PluginSetupContext as Zt, GuardDeny as _, ToolResult as _a, ValidationStage as _i, JobFnOf as _n, JobWorker as _r, isStreamResponse as _t, AdapterRequest as a, routeStreams as aa, GuardedParamNames as ai, route as an, JobQueueOptions as ar, runRoute as at, HANDLER_ARG_KEYS as b, AccessCheckInput as ba, formatValidationError as bi, ApiEntry as bn, defineJobTransport as br, localTypeName as bt, ApiBrand as c, streamMode as ca, HandlersFromRoutes as ci, ConfiguredAdapterValue as cn, JobRunnerOptions as cr, ResponseError as ct, DISPATCH_ROUTE_KEY as d, StreamWithTools as da, RouteGuardBrandOf as di, ConfiguredIdentities as dn, JobDescriptor as dr, pluginExportsOf as dt, StreamMessageOf as ea, FlattenedRoute as ei, RouteAuthSchema as en, JobErrorHandler as er, parseBodyText as et, ErrorFormatter as f, ToolAt as fa, RouteHandler as fi, ConfiguredJobs as fn, JobDispatchError as fr, pluginRouterOf as ft, GuardDenialBody as g, ToolKeys as ga, ValidationFailure as gi, ConfiguredTags as gn, JobTransportSupports as gr, isJsonMediaType as gt, GuardDenial as h, ToolEvents as ha, ThrowableReturn as hi, ConfiguredRequestContextSchemas as hn, JobTransportDefinition as hr, isHintPrefix as ht, AdapterDefinition as i, isNamedStream as ia, GuardSuccess as ii, pluginRouteTree as in, JobQueueArgs as ir, runHandler as it, RequestContextMap as j, CredentialOf as ja, ToolInputSchema as ji, AuthoredJobDefinition as jn, scheduleTimezone as jr, statusToCamelCase as jt, RUN_ROUTE_KEY as k, BearerCredential as ka, ToolRunResult as ki, RoutesOf as kn, parseCron as kr, sanitizeIdentifier as kt, ApiParts as l, streamSchemas as la, RawInputs as li, ConfiguredCodes as ln, createJobRunner as lr, tagRoutes as lt, GUARD_SCHEMA_META as m, ToolError as ma, RoutesWithHandlerContext as mi, ConfiguredRequestContext as mn, JobTransport as mr, resolvePlugins as mt, API_META as n, StreamYield as na, GuardParams as ni, SlugOption as nn, JobFnByKey as nr, renderJsonResult as nt, AdapterResult as o, soleStreamResponse as oa, HandlerArgs as oi, ApiContext as on, JobRunArgs as or, warnUnsupportedJobOptions as ot, GUARDS_META as p, ToolCall as pa, Router as pi, ConfiguredPlugins as pn, JobMessage as pr, pluginRoutesOf as pt, getHeaderValue as q, EncodeStreamOptions as qi, JobsArg as qn, MatchResult as qr, PluginRouteBuilder as qt, Adapter as r, encodeStreamBody as ra, GuardReturn as ri, definePlugin as rn, JobInputError as rr, routerFromRoutes as rt, AnyAdapter as s, streamContentType as sa, HandlerReturn as si, ConfiguredAdapterContext as sn, JobRunner as sr, ApiRouter as st, ADAPTER_CONTEXT as t, StreamMode as ta, GuardAnswer as ti, RoutePathSchema as tn, JobFn as tr, parseFetchBody as tt, ApiWithRouter as u, streamStatuses as ua, RequestContextValues as ui, ConfiguredGuardSchema as un, jobFnAt as ur, createApiReference as ut, GuardMap as v, expandStreamTools as va, allowedMethodsForPath as vi, JobsOfTree as vn, JobWorkerContext as vr, isSuccessStatus as vt, JobsMeta as w, ApiKeyConfig as wa, StreamTools as wi, ApiDefinition as wn, cron as wr, resolveResponseContentType as wt, HandleArgs as x, insufficientScope as xa, isRouteDefinition as xi, DiffSettings as xn, JobSchedule as xr, mergeHeaderFields as xt, GuardRun as y, toolEvents as ya, flattenRoutes as yi, KizunaConfigShape as yn, ScheduledJob as yr, isZodSchema as yt, assembleApi as z, OAuth2Config as za, HasPathParams as zi, JobHandler as zn, TagSet as zr, PluginApi as zt };
@@ -1360,10 +1360,21 @@ declare const createJobRunner: <Jobs_ extends Jobs>(source: Jobs_ | {
1360
1360
  //#endregion
1361
1361
  //#region src/jobs.d.ts
1362
1362
  /**
1363
- * Settings shared by every job, named in `defineConfig` under `jobsConfig`. The jobs
1363
+ * Settings shared by every job, named in `defineConfig` under `jobRunner`. The jobs
1364
1364
  * themselves are declared with `k.jobs`.
1365
1365
  */
1366
- interface JobsConfig {
1366
+ type JobsConfig = HttpJobsConfig | InProcessJobsConfig;
1367
+ /**
1368
+ * Jobs triggered over HTTP, by platform cron ticking `/jobs/dispatch` or a
1369
+ * transport delivering to `/jobs/run`.
1370
+ */
1371
+ interface HttpJobsConfig {
1372
+ /**
1373
+ * `'http'` serves `/jobs/dispatch` and `/jobs/run`, guarded by the jobs'
1374
+ * identity. `'in-process'` is for a long-running server whose schedules
1375
+ * `startJobs` ticks, and serves neither.
1376
+ */
1377
+ mode: 'http';
1367
1378
  /**
1368
1379
  * The namespace both job endpoints are mounted under, `dispatch` and `run`
1369
1380
  * beneath it. Nothing is served on the namespace itself.
@@ -1394,11 +1405,28 @@ interface JobsConfig {
1394
1405
  exclude?: readonly string[];
1395
1406
  }
1396
1407
  /**
1397
- * How a deployment runs the jobs it declares: where the two endpoints sit, what
1408
+ * Jobs a long-running server runs itself, its schedules ticked by `startJobs`.
1409
+ * No job endpoint is served, so the jobs need no identity.
1410
+ */
1411
+ interface InProcessJobsConfig {
1412
+ mode: 'in-process';
1413
+ path?: never;
1414
+ method?: never;
1415
+ windowMs?: never;
1416
+ only?: never;
1417
+ exclude?: never;
1418
+ }
1419
+ /**
1420
+ * How a deployment runs the jobs it declares: how they are triggered, what
1398
1421
  * carries queued work out of the process, and where a failure that happened
1399
1422
  * after the response went out is reported.
1400
1423
  */
1401
- interface JobRunnerConfig extends JobsConfig {
1424
+ type JobRunnerConfig = JobsConfig & JobDeliveryConfig;
1425
+ /**
1426
+ * Where queued work goes and where a late failure is reported, whichever way
1427
+ * the jobs are triggered.
1428
+ */
1429
+ interface JobDeliveryConfig {
1402
1430
  /**
1403
1431
  * Carries a queued job to whatever runs it. Without one, `queue` runs the
1404
1432
  * job in this process and it is lost on a crash.
@@ -1598,7 +1626,7 @@ interface ApiDefinition<Routes_ extends Routes = Routes, Tags extends Record<str
1598
1626
  */
1599
1627
  jobs?: Jobs_;
1600
1628
  /**
1601
- * The job settings named in `defineConfig` under `jobsConfig`.
1629
+ * The job settings named in `defineConfig` under `jobRunner`.
1602
1630
  */
1603
1631
  jobsConfig?: JobsConfig;
1604
1632
  /**
@@ -2348,7 +2376,7 @@ declare const assembleApi: <const R extends Routes>(contract: {
2348
2376
  }, parts: ApiParts) => ApiWithRouter<R>;
2349
2377
  /**
2350
2378
  * The endpoints jobs are served on, in the {@link Routes} shape the request
2351
- * pipeline takes.
2379
+ * pipeline takes. None when the jobs run in process.
2352
2380
  */
2353
2381
  declare const jobRoutes: (meta: JobsMeta) => Routes;
2354
2382
  /**
@@ -2683,4 +2711,4 @@ declare const parseBodyText: (text: string, route: RouteDefinition) => unknown;
2683
2711
  declare const parseFetchBody: (request: Request, route: RouteDefinition) => Promise<unknown>;
2684
2712
  declare const headersToObject: (headers: Headers) => ResponseHeaders;
2685
2713
  //#endregion
2686
- export { jobRunnerFrom as $, StreamMode as $i, JobFn as $n, GuardAnswer as $r, ResolvedPlugin as $t, RenderedResult as A, CustomConfig as Aa, buildToolDefinitions as Ai, SchemesOf as An, RequestContextConfig as Ar, shortTypeName as At, bearerChallenge as B, RolesOf as Ba, PathSegment as Bi, JobHandlers as Bn, RawResponse as Br, PluginArgs as Bt, JOBS_META as C, ApiKeyCredential as Ca, ToolAnswer as Ci, apiEntries as Cn, dueSchedules as Cr, resolveResponseCache as Ct, REQUEST_CONTEXT_META as D, BearerCredential as Da, ToolRunResult as Di, JobsOf as Dn, parseCron as Dr, resolveResponseStream as Dt, MountedOf as E, BearerConfig as Ea, ToolRunOptions as Ei, GuardSchemaOf as En, nextRuns as Er, resolveResponseHeaders as Et, RouteMatcher as F, IdentityRole as Fa, toolRefusal as Fi, FlattenedJob as Fn, TagKeysOf as Fr, ApiPlugins as Ft, dispatchRoute as G, EncodeStreamOptions as Gi, JobsArg as Gn, MatchResult as Gr, PluginFactory as Gt, contractOf as H, buildPath as Hi, JobRunnerConfig as Hn, rawResponse as Hr, PluginDefinition as Ht, SCHEMES_META as I, NoCredential as Ia, ExtractPathParams as Ii, JobDefinition as In, TagOptions as Ir, InstallOptions as It, guardDenyFor as J, StreamChunk as Ji, flattenJobs as Jn, sortFlattenedRoutes as Jr, PluginRoutes as Jt, extractCredential as K, StreamBody as Ki, JobsConfig as Kn, RouteMatch as Kr, PluginList as Kt, ServerOptions as L, OAuth2Config as La, HasPathParams as Li, JobHandler as Ln, TagSet as Lr, PLUGIN_ROUTES_META_KEY as Lt, RequestContextRun as M, GuardHoldings as Ma, describeTool as Mi, AuthoredJobs as Mn, RequestContextHeaderValues as Mr, toCamelCase as Mt, RequestPipeline as N, Identity as Na, selectToolRoutes as Ni, CompiledJob as Nn, RequestContextSchema as Nr, toPascalCase as Nt, ROUTER_META as O, Credential as Oa, ToolDefinition as Oi, RequestContextOf as On, scheduleExpression as Or, sanitizeFieldName as Ot, ResponseValidationError as P, IdentityParamsOf as Pa, toolOptionsOf as Pi, CompiledJobs as Pn, NormalizeTags as Pr, AnyPlugin as Pt, jobRoutes as Q, StreamMessageOf as Qi, JobErrorHandler as Qn, FlattenedRoute as Qr, PluginsBySlug as Qt, adapterContextOf as R, OpenIdConnectConfig as Ra, PathParamName as Ri, JobHandlerArgs as Rn, createTags as Rr, PLUGIN_SERVERS_META_KEY as Rt, HandlerContextOf as S, ApiKeyConfig as Sa, StreamTools as Si, GeneratedFile as Sn, cron as Sr, resolveResponseBody as St, MountArgsOf as T, BasicCredential as Ta, ToolRunCall as Ti, ApiPluginsOf as Tn, nextRun as Tr, resolveResponseEtag as Tt, defineAdapter as U, parsePath as Ui, JobVoidReturn as Un, RouteBuilder as Ur, PluginExportValues as Ut, boundJobKeys as V, RoutePathParamsCheck as Vi, JobResponses as Vn, isRawResponse as Vr, PluginDeclaration as Vt, dispatchHandler as W, EVENT_STREAM_MEDIA_TYPE as Wi, Jobs as Wn, RouteWithHandler as Wr, PluginExportsOf as Wt, isGuardDenial as X, StreamContext as Xi, isJobDefinition as Xn, BrandedHandlerContext as Xr, PluginSetup as Xt, headersToObject as Y, StreamComment as Yi, isCompiledJob as Yn, AuthContextOf as Yr, PluginRoutesOf as Yt, jobRouter as Z, StreamMessage as Zi, jobAt as Zn, ContextFromAuth as Zr, PluginSetupContext as Zt, GuardDeny as _, toolEvents as _a, flattenRoutes as _i, JobFnOf as _n, ScheduledJob as _r, isStreamResponse as _t, AdapterRequest as a, streamContentType as aa, HandlerReturn as ai, route as an, JobRunner as ar, runRoute as at, HANDLER_ARG_KEYS as b, requiresDenial as ba, validateRequest as bi, ApiEntry as bn, ParsedCron as br, localTypeName as bt, ApiBrand as c, streamStatuses as ca, RequestContextValues as ci, ConfiguredAdapterValue as cn, jobFnAt as cr, ResponseError as ct, DISPATCH_ROUTE_KEY as d, ToolCall as da, Router as di, ConfiguredIdentities as dn, JobMessage as dr, pluginExportsOf as dt, StreamYield as ea, GuardParams as ei, RouteAuthSchema as en, JobFnByKey as er, parseBodyText as et, ErrorFormatter as f, ToolError as fa, RoutesWithHandlerContext as fi, ConfiguredJobs as fn, JobTransport as fr, pluginRouterOf as ft, GuardDenialBody as g, expandStreamTools as ga, allowedMethodsForPath as gi, ConfiguredTags as gn, JobWorkerContext as gr, isJsonMediaType as gt, GuardDenial as h, ToolResult as ha, ValidationStage as hi, ConfiguredRequestContextSchemas as hn, JobWorker as hr, isHintPrefix as ht, AdapterDefinition as i, soleStreamResponse as ia, HandlerArgs as ii, pluginRouteTree as in, JobRunArgs as ir, runHandler as it, RequestContextMap as j, GrantsOf as ja, buildToolInputSchema as ji, AuthoredJobDefinition as jn, RequestContextHeaderInputs as jr, statusToCamelCase as jt, RUN_ROUTE_KEY as k, CredentialOf as ka, ToolInputSchema as ki, RoutesOf as kn, scheduleTimezone as kr, sanitizeIdentifier as kt, ApiParts as l, StreamWithTools as la, RouteGuardBrandOf as li, ConfiguredCodes as ln, JobDescriptor as lr, tagRoutes as lt, GUARD_SCHEMA_META as m, ToolKeys as ma, ValidationFailure as mi, ConfiguredRequestContext as mn, JobTransportSupports as mr, resolvePlugins as mt, API_META as n, isNamedStream as na, GuardSuccess as ni, SlugOption as nn, JobQueueArgs as nr, renderJsonResult as nt, AdapterResult as o, streamMode as oa, HandlersFromRoutes as oi, ApiContext as on, JobRunnerOptions as or, warnUnsupportedJobOptions as ot, GUARDS_META as p, ToolEvents as pa, ThrowableReturn as pi, ConfiguredPlugins as pn, JobTransportDefinition as pr, pluginRoutesOf as pt, getHeaderValue as q, StreamBodyOf as qi, NoJobs as qn, matchRoute as qr, PluginRouteBuilder as qt, Adapter as r, routeStreams as ra, GuardedParamNames as ri, definePlugin as rn, JobQueueOptions as rr, routerFromRoutes as rt, AnyAdapter as s, streamSchemas as sa, RawInputs as si, ConfiguredAdapterContext as sn, createJobRunner as sr, ApiRouter as st, ADAPTER_CONTEXT as t, encodeStreamBody as ta, GuardReturn as ti, RoutePathSchema as tn, JobInputError as tr, parseFetchBody as tt, ApiWithRouter as u, ToolAt as ua, RouteHandler as ui, ConfiguredGuardSchema as un, JobDispatchError as ur, createApiReference as ut, GuardMap as v, AccessCheckInput as va, formatValidationError as vi, JobsOfTree as vn, defineJobTransport as vr, isSuccessStatus as vt, JobsMeta as w, BasicConfig as wa, ToolEventYield as wi, ApiDefinition as wn, firesBetween as wr, resolveResponseContentType as wt, HandleArgs as x, withPermissions as xa, ModelToolCall as xi, DiffSettings as xn, assertValidSchedule as xr, mergeHeaderFields as xt, GuardRun as y, insufficientScope as ya, isRouteDefinition as yi, KizunaConfigShape as yn, JobSchedule as yr, isZodSchema as yt, assembleApi as z, RoleOf as za, PathParamsCheck as zi, JobHandlerReturn as zn, isTagSet as zr, PluginApi as zt };
2714
+ export { jobRunnerFrom as $, StreamMessage as $i, jobAt as $n, ContextFromAuth as $r, ResolvedPlugin as $t, RenderedResult as A, Credential as Aa, ToolDefinition as Ai, SchemesOf as An, scheduleExpression as Ar, shortTypeName as At, bearerChallenge as B, OpenIdConnectConfig as Ba, PathParamName as Bi, JobHandlerArgs as Bn, createTags as Br, PluginArgs as Bt, JOBS_META as C, withPermissions as Ca, ModelToolCall as Ci, apiEntries as Cn, assertValidSchedule as Cr, resolveResponseCache as Ct, REQUEST_CONTEXT_META as D, BasicCredential as Da, ToolRunCall as Di, JobsOf as Dn, nextRun as Dr, resolveResponseStream as Dt, MountedOf as E, BasicConfig as Ea, ToolEventYield as Ei, GuardSchemaOf as En, firesBetween as Er, resolveResponseHeaders as Et, RouteMatcher as F, Identity as Fa, selectToolRoutes as Fi, FlattenedJob as Fn, RequestContextSchema as Fr, ApiPlugins as Ft, dispatchRoute as G, parsePath as Gi, JobVoidReturn as Gn, RouteBuilder as Gr, PluginFactory as Gt, contractOf as H, RolesOf as Ha, PathSegment as Hi, JobHandlers as Hn, RawResponse as Hr, PluginDefinition as Ht, SCHEMES_META as I, IdentityParamsOf as Ia, toolOptionsOf as Ii, HttpJobsConfig as In, NormalizeTags as Ir, InstallOptions as It, guardDenyFor as J, StreamBody as Ji, JobsConfig as Jn, RouteMatch as Jr, PluginRoutes as Jt, extractCredential as K, EVENT_STREAM_MEDIA_TYPE as Ki, Jobs as Kn, RouteWithHandler as Kr, PluginList as Kt, ServerOptions as L, IdentityRole as La, toolRefusal as Li, InProcessJobsConfig as Ln, TagKeysOf as Lr, PLUGIN_ROUTES_META_KEY as Lt, RequestContextRun as M, CustomConfig as Ma, buildToolDefinitions as Mi, AuthoredJobs as Mn, RequestContextConfig as Mr, toCamelCase as Mt, RequestPipeline as N, GrantsOf as Na, buildToolInputSchema as Ni, CompiledJob as Nn, RequestContextHeaderInputs as Nr, toPascalCase as Nt, ROUTER_META as O, BearerConfig as Oa, ToolRunOptions as Oi, RequestContextOf as On, nextRuns as Or, sanitizeFieldName as Ot, ResponseValidationError as P, GuardHoldings as Pa, describeTool as Pi, CompiledJobs as Pn, RequestContextHeaderValues as Pr, AnyPlugin as Pt, jobRoutes as Q, StreamContext as Qi, isJobDefinition as Qn, BrandedHandlerContext as Qr, PluginsBySlug as Qt, adapterContextOf as R, NoCredential as Ra, ExtractPathParams as Ri, JobDefinition as Rn, TagOptions as Rr, PLUGIN_SERVERS_META_KEY as Rt, HandlerContextOf as S, requiresDenial as Sa, validateRequest as Si, GeneratedFile as Sn, ParsedCron as Sr, resolveResponseBody as St, MountArgsOf as T, ApiKeyCredential as Ta, ToolAnswer as Ti, ApiPluginsOf as Tn, dueSchedules as Tr, resolveResponseEtag as Tt, defineAdapter as U, RoutePathParamsCheck as Ui, JobResponses as Un, isRawResponse as Ur, PluginExportValues as Ut, boundJobKeys as V, RoleOf as Va, PathParamsCheck as Vi, JobHandlerReturn as Vn, isTagSet as Vr, PluginDeclaration as Vt, dispatchHandler as W, buildPath as Wi, JobRunnerConfig as Wn, rawResponse as Wr, PluginExportsOf as Wt, isGuardDenial as X, StreamChunk as Xi, flattenJobs as Xn, sortFlattenedRoutes as Xr, PluginSetup as Xt, headersToObject as Y, StreamBodyOf as Yi, NoJobs as Yn, matchRoute as Yr, PluginRoutesOf as Yt, jobRouter as Z, StreamComment as Zi, isCompiledJob as Zn, AuthContextOf as Zr, PluginSetupContext as Zt, GuardDeny as _, ToolResult as _a, ValidationStage as _i, JobFnOf as _n, JobWorker as _r, isStreamResponse as _t, AdapterRequest as a, routeStreams as aa, GuardedParamNames as ai, route as an, JobQueueOptions as ar, runRoute as at, HANDLER_ARG_KEYS as b, AccessCheckInput as ba, formatValidationError as bi, ApiEntry as bn, defineJobTransport as br, localTypeName as bt, ApiBrand as c, streamMode as ca, HandlersFromRoutes as ci, ConfiguredAdapterValue as cn, JobRunnerOptions as cr, ResponseError as ct, DISPATCH_ROUTE_KEY as d, StreamWithTools as da, RouteGuardBrandOf as di, ConfiguredIdentities as dn, JobDescriptor as dr, pluginExportsOf as dt, StreamMessageOf as ea, FlattenedRoute as ei, RouteAuthSchema as en, JobErrorHandler as er, parseBodyText as et, ErrorFormatter as f, ToolAt as fa, RouteHandler as fi, ConfiguredJobs as fn, JobDispatchError as fr, pluginRouterOf as ft, GuardDenialBody as g, ToolKeys as ga, ValidationFailure as gi, ConfiguredTags as gn, JobTransportSupports as gr, isJsonMediaType as gt, GuardDenial as h, ToolEvents as ha, ThrowableReturn as hi, ConfiguredRequestContextSchemas as hn, JobTransportDefinition as hr, isHintPrefix as ht, AdapterDefinition as i, isNamedStream as ia, GuardSuccess as ii, pluginRouteTree as in, JobQueueArgs as ir, runHandler as it, RequestContextMap as j, CredentialOf as ja, ToolInputSchema as ji, AuthoredJobDefinition as jn, scheduleTimezone as jr, statusToCamelCase as jt, RUN_ROUTE_KEY as k, BearerCredential as ka, ToolRunResult as ki, RoutesOf as kn, parseCron as kr, sanitizeIdentifier as kt, ApiParts as l, streamSchemas as la, RawInputs as li, ConfiguredCodes as ln, createJobRunner as lr, tagRoutes as lt, GUARD_SCHEMA_META as m, ToolError as ma, RoutesWithHandlerContext as mi, ConfiguredRequestContext as mn, JobTransport as mr, resolvePlugins as mt, API_META as n, StreamYield as na, GuardParams as ni, SlugOption as nn, JobFnByKey as nr, renderJsonResult as nt, AdapterResult as o, soleStreamResponse as oa, HandlerArgs as oi, ApiContext as on, JobRunArgs as or, warnUnsupportedJobOptions as ot, GUARDS_META as p, ToolCall as pa, Router as pi, ConfiguredPlugins as pn, JobMessage as pr, pluginRoutesOf as pt, getHeaderValue as q, EncodeStreamOptions as qi, JobsArg as qn, MatchResult as qr, PluginRouteBuilder as qt, Adapter as r, encodeStreamBody as ra, GuardReturn as ri, definePlugin as rn, JobInputError as rr, routerFromRoutes as rt, AnyAdapter as s, streamContentType as sa, HandlerReturn as si, ConfiguredAdapterContext as sn, JobRunner as sr, ApiRouter as st, ADAPTER_CONTEXT as t, StreamMode as ta, GuardAnswer as ti, RoutePathSchema as tn, JobFn as tr, parseFetchBody as tt, ApiWithRouter as u, streamStatuses as ua, RequestContextValues as ui, ConfiguredGuardSchema as un, jobFnAt as ur, createApiReference as ut, GuardMap as v, expandStreamTools as va, allowedMethodsForPath as vi, JobsOfTree as vn, JobWorkerContext as vr, isSuccessStatus as vt, JobsMeta as w, ApiKeyConfig as wa, StreamTools as wi, ApiDefinition as wn, cron as wr, resolveResponseContentType as wt, HandleArgs as x, insufficientScope as xa, isRouteDefinition as xi, DiffSettings as xn, JobSchedule as xr, mergeHeaderFields as xt, GuardRun as y, toolEvents as ya, flattenRoutes as yi, KizunaConfigShape as yn, ScheduledJob as yr, isZodSchema as yt, assembleApi as z, OAuth2Config as za, HasPathParams as zi, JobHandler as zn, TagSet as zr, PluginApi as zt };
package/dist/adapter.cjs CHANGED
@@ -1,7 +1,7 @@
1
1
  Object.defineProperty(exports, Symbol.toStringTag, { value: "Module" });
2
2
  const require_plugin = require("./plugin-D_WJ2GBf.cjs");
3
- const require_plugin_server = require("./plugin-server-DrDIPl6R.cjs");
4
- const require_adapter = require("./adapter-CGKgrfQy.cjs");
3
+ const require_plugin_server = require("./plugin-server-CIC64cSM.cjs");
4
+ const require_adapter = require("./adapter-B75LpzDv.cjs");
5
5
  const require_schemas = require("./schemas-7y2XV1if.cjs");
6
6
  exports.API_META = require_adapter.API_META;
7
7
  exports.AUTO_GUARD_BRAND = require_plugin.AUTO_GUARD_BRAND;
@@ -1,3 +1,3 @@
1
1
  import { A as AutoResponsesBrand, B as ROUTES_TAG, 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-Da3XXloD.cjs";
2
- import { $ as jobRunnerFrom, $t as ResolvedPlugin, A as RenderedResult, Ai as buildToolDefinitions, B as bearerChallenge, Bi as PathSegment, Bn as JobHandlers, Br as RawResponse, Bt as PluginArgs, C as JOBS_META, D as REQUEST_CONTEXT_META, E as MountedOf, F as RouteMatcher, Fi as toolRefusal, Fn as FlattenedJob, Ft as ApiPlugins, G as dispatchRoute, Gi as EncodeStreamOptions, Gr as MatchResult, H as contractOf, Hi as buildPath, Hr as rawResponse, Ht as PluginDefinition, I as SCHEMES_META, J as guardDenyFor, Jn as flattenJobs, Jr as sortFlattenedRoutes, Jt as PluginRoutes, K as extractCredential, Kr as RouteMatch, L as ServerOptions, Ln as JobHandler, M as RequestContextRun, Mi as describeTool, N as RequestPipeline, Ni as selectToolRoutes, Nn as CompiledJob, O as ROUTER_META, Oi as ToolDefinition, P as ResponseValidationError, Pi as toolOptionsOf, Pr as NormalizeTags, Q as jobRoutes, Qn as JobErrorHandler, Qr as FlattenedRoute, R as adapterContextOf, S as HandlerContextOf, T as MountArgsOf, U as defineAdapter, Ui as parsePath, Ut as PluginExportValues, V as boundJobKeys, Vr as isRawResponse, Vt as PluginDeclaration, W as dispatchHandler, Wn as Jobs, Wt as PluginExportsOf, X as isGuardDenial, Xi as StreamContext, Xr as BrandedHandlerContext, Y as headersToObject, Yn as isCompiledJob, Yt as PluginRoutesOf, Z as jobRouter, Zn as jobAt, Zr as ContextFromAuth, _ as GuardDeny, _i as flattenRoutes, _r as ScheduledJob, _t as isStreamResponse, a as AdapterRequest, ar as JobRunner, at as runRoute, b as HANDLER_ARG_KEYS, ba as requiresDenial, bi as validateRequest, c as ApiBrand, ci as RequestContextValues, cr as jobFnAt, ct as ResponseError, d as DISPATCH_ROUTE_KEY, di as Router, dr as JobMessage, dt as pluginExportsOf, ei as GuardParams, er as JobFnByKey, et as parseBodyText, f as ErrorFormatter, fi as RoutesWithHandlerContext, fr as JobTransport, ft as pluginRouterOf, g as GuardDenialBody, gi as allowedMethodsForPath, gr as JobWorkerContext, h as GuardDenial, hi as ValidationStage, hr as JobWorker, i as AdapterDefinition, in as pluginRouteTree, it as runHandler, j as RequestContextMap, ji as buildToolInputSchema, k as RUN_ROUTE_KEY, ki as ToolInputSchema, l as ApiParts, lr as JobDescriptor, lt as tagRoutes, m as GUARD_SCHEMA_META, mi as ValidationFailure, mt as resolvePlugins, n as API_META, nt as renderJsonResult, o as AdapterResult, oi as HandlersFromRoutes, or as JobRunnerOptions, ot as warnUnsupportedJobOptions, p as GUARDS_META, pt as pluginRoutesOf, q as getHeaderValue, qr as matchRoute, r as Adapter, ri as GuardedParamNames, rn as definePlugin, rt as routerFromRoutes, s as AnyAdapter, si as RawInputs, sr as createJobRunner, st as ApiRouter, t as ADAPTER_CONTEXT, ta as encodeStreamBody, tr as JobInputError, tt as parseFetchBody, u as ApiWithRouter, ui as RouteHandler, ur as JobDispatchError, ut as createApiReference, v as GuardMap, va as AccessCheckInput, vi as formatValidationError, vr as defineJobTransport, w as JobsMeta, x as HandleArgs, xa as withPermissions, y as GuardRun, ya as insufficientScope, yi as isRouteDefinition, z as assembleApi, zr as isTagSet } from "./adapter-Ca2YCENa.cjs";
2
+ import { $ as jobRunnerFrom, $n as jobAt, $r as ContextFromAuth, $t as ResolvedPlugin, A as RenderedResult, Ai as ToolDefinition, B as bearerChallenge, Bt as PluginArgs, C as JOBS_META, Ca as withPermissions, D as REQUEST_CONTEXT_META, E as MountedOf, F as RouteMatcher, Fi as selectToolRoutes, Fn as FlattenedJob, Ft as ApiPlugins, G as dispatchRoute, Gi as parsePath, H as contractOf, Hi as PathSegment, Hn as JobHandlers, Hr as RawResponse, Ht as PluginDefinition, I as SCHEMES_META, Ii as toolOptionsOf, Ir as NormalizeTags, J as guardDenyFor, Jr as RouteMatch, Jt as PluginRoutes, K as extractCredential, Kn as Jobs, L as ServerOptions, Li as toolRefusal, M as RequestContextRun, Mi as buildToolDefinitions, N as RequestPipeline, Ni as buildToolInputSchema, Nn as CompiledJob, O as ROUTER_META, P as ResponseValidationError, Pi as describeTool, Q as jobRoutes, Qi as StreamContext, Qr as BrandedHandlerContext, R as adapterContextOf, S as HandlerContextOf, Sa as requiresDenial, Si as validateRequest, T as MountArgsOf, U as defineAdapter, Ur as isRawResponse, Ut as PluginExportValues, V as boundJobKeys, Vr as isTagSet, Vt as PluginDeclaration, W as dispatchHandler, Wi as buildPath, Wr as rawResponse, Wt as PluginExportsOf, X as isGuardDenial, Xn as flattenJobs, Xr as sortFlattenedRoutes, Y as headersToObject, Yr as matchRoute, Yt as PluginRoutesOf, Z as jobRouter, Zn as isCompiledJob, _ as GuardDeny, _i as ValidationStage, _r as JobWorker, _t as isStreamResponse, a as AdapterRequest, ai as GuardedParamNames, at as runRoute, b as HANDLER_ARG_KEYS, ba as AccessCheckInput, bi as formatValidationError, br as defineJobTransport, c as ApiBrand, ci as HandlersFromRoutes, cr as JobRunnerOptions, ct as ResponseError, d as DISPATCH_ROUTE_KEY, dr as JobDescriptor, dt as pluginExportsOf, ei as FlattenedRoute, er as JobErrorHandler, et as parseBodyText, f as ErrorFormatter, fi as RouteHandler, fr as JobDispatchError, ft as pluginRouterOf, g as GuardDenialBody, gi as ValidationFailure, h as GuardDenial, i as AdapterDefinition, in as pluginRouteTree, it as runHandler, j as RequestContextMap, ji as ToolInputSchema, k as RUN_ROUTE_KEY, l as ApiParts, li as RawInputs, lr as createJobRunner, lt as tagRoutes, m as GUARD_SCHEMA_META, mi as RoutesWithHandlerContext, mr as JobTransport, mt as resolvePlugins, n as API_META, ni as GuardParams, nr as JobFnByKey, nt as renderJsonResult, o as AdapterResult, ot as warnUnsupportedJobOptions, p as GUARDS_META, pi as Router, pr as JobMessage, pt as pluginRoutesOf, q as getHeaderValue, qi as EncodeStreamOptions, qr as MatchResult, r as Adapter, ra as encodeStreamBody, rn as definePlugin, rr as JobInputError, rt as routerFromRoutes, s as AnyAdapter, sr as JobRunner, st as ApiRouter, t as ADAPTER_CONTEXT, tt as parseFetchBody, u as ApiWithRouter, ui as RequestContextValues, ur as jobFnAt, ut as createApiReference, v as GuardMap, vi as allowedMethodsForPath, vr as JobWorkerContext, w as JobsMeta, x as HandleArgs, xa as insufficientScope, xi as isRouteDefinition, y as GuardRun, yi as flattenRoutes, yr as ScheduledJob, z as assembleApi, zn as JobHandler } from "./adapter-O2unN9bH.cjs";
3
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, NormalizeTags, PathSegment, PluginArgs, PluginDeclaration, PluginDefinition, PluginExportValues, PluginExportsOf, PluginRoutes, PluginRoutesOf, ProblemDetails, REQUEST_CONTEXT_META, ROUTER_META, ROUTES_TAG, 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, guardDenyFor, headersToObject, insufficientScope, isCompiledJob, isGuardDenial, isRawResponse, isRouteDefinition, isStreamResponse, isTagSet, jobAt, jobFnAt, jobRouter, jobRoutes, jobRunnerFrom, matchRoute, parseBodyText, parseFetchBody, parsePath, pluginExportsOf, pluginRouteTree, pluginRouterOf, pluginRoutesOf, problemDetails, rawResponse, renderJsonResult, requiresDenial, resolvePlugins, resolveSecurityRequirements, routerFromRoutes, runHandler, runRoute, selectToolRoutes, sortFlattenedRoutes, tagRoutes, toolOptionsOf, toolRefusal, validateRequest, warnUnsupportedJobOptions, withPermissions };
@@ -1,3 +1,3 @@
1
1
  import { A as AutoResponsesBrand, B as ROUTES_TAG, 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-D2bAIpNd.mjs";
2
- import { $ as jobRunnerFrom, $t as ResolvedPlugin, A as RenderedResult, Ai as buildToolDefinitions, B as bearerChallenge, Bi as PathSegment, Bn as JobHandlers, Br as RawResponse, Bt as PluginArgs, C as JOBS_META, D as REQUEST_CONTEXT_META, E as MountedOf, F as RouteMatcher, Fi as toolRefusal, Fn as FlattenedJob, Ft as ApiPlugins, G as dispatchRoute, Gi as EncodeStreamOptions, Gr as MatchResult, H as contractOf, Hi as buildPath, Hr as rawResponse, Ht as PluginDefinition, I as SCHEMES_META, J as guardDenyFor, Jn as flattenJobs, Jr as sortFlattenedRoutes, Jt as PluginRoutes, K as extractCredential, Kr as RouteMatch, L as ServerOptions, Ln as JobHandler, M as RequestContextRun, Mi as describeTool, N as RequestPipeline, Ni as selectToolRoutes, Nn as CompiledJob, O as ROUTER_META, Oi as ToolDefinition, P as ResponseValidationError, Pi as toolOptionsOf, Pr as NormalizeTags, Q as jobRoutes, Qn as JobErrorHandler, Qr as FlattenedRoute, R as adapterContextOf, S as HandlerContextOf, T as MountArgsOf, U as defineAdapter, Ui as parsePath, Ut as PluginExportValues, V as boundJobKeys, Vr as isRawResponse, Vt as PluginDeclaration, W as dispatchHandler, Wn as Jobs, Wt as PluginExportsOf, X as isGuardDenial, Xi as StreamContext, Xr as BrandedHandlerContext, Y as headersToObject, Yn as isCompiledJob, Yt as PluginRoutesOf, Z as jobRouter, Zn as jobAt, Zr as ContextFromAuth, _ as GuardDeny, _i as flattenRoutes, _r as ScheduledJob, _t as isStreamResponse, a as AdapterRequest, ar as JobRunner, at as runRoute, b as HANDLER_ARG_KEYS, ba as requiresDenial, bi as validateRequest, c as ApiBrand, ci as RequestContextValues, cr as jobFnAt, ct as ResponseError, d as DISPATCH_ROUTE_KEY, di as Router, dr as JobMessage, dt as pluginExportsOf, ei as GuardParams, er as JobFnByKey, et as parseBodyText, f as ErrorFormatter, fi as RoutesWithHandlerContext, fr as JobTransport, ft as pluginRouterOf, g as GuardDenialBody, gi as allowedMethodsForPath, gr as JobWorkerContext, h as GuardDenial, hi as ValidationStage, hr as JobWorker, i as AdapterDefinition, in as pluginRouteTree, it as runHandler, j as RequestContextMap, ji as buildToolInputSchema, k as RUN_ROUTE_KEY, ki as ToolInputSchema, l as ApiParts, lr as JobDescriptor, lt as tagRoutes, m as GUARD_SCHEMA_META, mi as ValidationFailure, mt as resolvePlugins, n as API_META, nt as renderJsonResult, o as AdapterResult, oi as HandlersFromRoutes, or as JobRunnerOptions, ot as warnUnsupportedJobOptions, p as GUARDS_META, pt as pluginRoutesOf, q as getHeaderValue, qr as matchRoute, r as Adapter, ri as GuardedParamNames, rn as definePlugin, rt as routerFromRoutes, s as AnyAdapter, si as RawInputs, sr as createJobRunner, st as ApiRouter, t as ADAPTER_CONTEXT, ta as encodeStreamBody, tr as JobInputError, tt as parseFetchBody, u as ApiWithRouter, ui as RouteHandler, ur as JobDispatchError, ut as createApiReference, v as GuardMap, va as AccessCheckInput, vi as formatValidationError, vr as defineJobTransport, w as JobsMeta, x as HandleArgs, xa as withPermissions, y as GuardRun, ya as insufficientScope, yi as isRouteDefinition, z as assembleApi, zr as isTagSet } from "./adapter-BiPct09t.mjs";
2
+ import { $ as jobRunnerFrom, $n as jobAt, $r as ContextFromAuth, $t as ResolvedPlugin, A as RenderedResult, Ai as ToolDefinition, B as bearerChallenge, Bt as PluginArgs, C as JOBS_META, Ca as withPermissions, D as REQUEST_CONTEXT_META, E as MountedOf, F as RouteMatcher, Fi as selectToolRoutes, Fn as FlattenedJob, Ft as ApiPlugins, G as dispatchRoute, Gi as parsePath, H as contractOf, Hi as PathSegment, Hn as JobHandlers, Hr as RawResponse, Ht as PluginDefinition, I as SCHEMES_META, Ii as toolOptionsOf, Ir as NormalizeTags, J as guardDenyFor, Jr as RouteMatch, Jt as PluginRoutes, K as extractCredential, Kn as Jobs, L as ServerOptions, Li as toolRefusal, M as RequestContextRun, Mi as buildToolDefinitions, N as RequestPipeline, Ni as buildToolInputSchema, Nn as CompiledJob, O as ROUTER_META, P as ResponseValidationError, Pi as describeTool, Q as jobRoutes, Qi as StreamContext, Qr as BrandedHandlerContext, R as adapterContextOf, S as HandlerContextOf, Sa as requiresDenial, Si as validateRequest, T as MountArgsOf, U as defineAdapter, Ur as isRawResponse, Ut as PluginExportValues, V as boundJobKeys, Vr as isTagSet, Vt as PluginDeclaration, W as dispatchHandler, Wi as buildPath, Wr as rawResponse, Wt as PluginExportsOf, X as isGuardDenial, Xn as flattenJobs, Xr as sortFlattenedRoutes, Y as headersToObject, Yr as matchRoute, Yt as PluginRoutesOf, Z as jobRouter, Zn as isCompiledJob, _ as GuardDeny, _i as ValidationStage, _r as JobWorker, _t as isStreamResponse, a as AdapterRequest, ai as GuardedParamNames, at as runRoute, b as HANDLER_ARG_KEYS, ba as AccessCheckInput, bi as formatValidationError, br as defineJobTransport, c as ApiBrand, ci as HandlersFromRoutes, cr as JobRunnerOptions, ct as ResponseError, d as DISPATCH_ROUTE_KEY, dr as JobDescriptor, dt as pluginExportsOf, ei as FlattenedRoute, er as JobErrorHandler, et as parseBodyText, f as ErrorFormatter, fi as RouteHandler, fr as JobDispatchError, ft as pluginRouterOf, g as GuardDenialBody, gi as ValidationFailure, h as GuardDenial, i as AdapterDefinition, in as pluginRouteTree, it as runHandler, j as RequestContextMap, ji as ToolInputSchema, k as RUN_ROUTE_KEY, l as ApiParts, li as RawInputs, lr as createJobRunner, lt as tagRoutes, m as GUARD_SCHEMA_META, mi as RoutesWithHandlerContext, mr as JobTransport, mt as resolvePlugins, n as API_META, ni as GuardParams, nr as JobFnByKey, nt as renderJsonResult, o as AdapterResult, ot as warnUnsupportedJobOptions, p as GUARDS_META, pi as Router, pr as JobMessage, pt as pluginRoutesOf, q as getHeaderValue, qi as EncodeStreamOptions, qr as MatchResult, r as Adapter, ra as encodeStreamBody, rn as definePlugin, rr as JobInputError, rt as routerFromRoutes, s as AnyAdapter, sr as JobRunner, st as ApiRouter, t as ADAPTER_CONTEXT, tt as parseFetchBody, u as ApiWithRouter, ui as RequestContextValues, ur as jobFnAt, ut as createApiReference, v as GuardMap, vi as allowedMethodsForPath, vr as JobWorkerContext, w as JobsMeta, x as HandleArgs, xa as insufficientScope, xi as isRouteDefinition, y as GuardRun, yi as flattenRoutes, yr as ScheduledJob, z as assembleApi, zn as JobHandler } from "./adapter-Do23zdY1.mjs";
3
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, NormalizeTags, PathSegment, PluginArgs, PluginDeclaration, PluginDefinition, PluginExportValues, PluginExportsOf, PluginRoutes, PluginRoutesOf, ProblemDetails, REQUEST_CONTEXT_META, ROUTER_META, ROUTES_TAG, 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, guardDenyFor, headersToObject, insufficientScope, isCompiledJob, isGuardDenial, isRawResponse, isRouteDefinition, isStreamResponse, isTagSet, jobAt, jobFnAt, jobRouter, jobRoutes, jobRunnerFrom, matchRoute, parseBodyText, parseFetchBody, parsePath, pluginExportsOf, pluginRouteTree, pluginRouterOf, pluginRoutesOf, problemDetails, rawResponse, renderJsonResult, requiresDenial, resolvePlugins, resolveSecurityRequirements, routerFromRoutes, runHandler, runRoute, selectToolRoutes, sortFlattenedRoutes, tagRoutes, toolOptionsOf, toolRefusal, validateRequest, warnUnsupportedJobOptions, withPermissions };
package/dist/adapter.mjs CHANGED
@@ -1,5 +1,5 @@
1
1
  import { a as definePlugin, d as AUTO_RESPONSES_BRAND, g as ROUTES_TAG, l as AUTO_GUARD_BRAND, m as HANDLER_CONTEXT_BRAND, o as pluginRouteTree } from "./plugin-CFpv8XTz.mjs";
2
- import { H as isStreamResponse, M as encodeStreamBody, a as pluginRoutesOf, at as buildPath, ct as flattenRoutes, dt as validateRequest, g as jobAt, i as pluginRouterOf, lt as formatValidationError, m as isCompiledJob, o as resolvePlugins, ot as parsePath, p as flattenJobs, r as pluginExportsOf, st as allowedMethodsForPath, t as createApiReference, ut as isRouteDefinition } from "./plugin-server-C0CyVED-.mjs";
3
- import { A as renderJsonResult, B as sortFlattenedRoutes, C as headersToObject, D as jobRunnerFrom, E as jobRoutes, F as isRawResponse, G as defineJobTransport, H as requiresDenial, I as rawResponse, J as jobFnAt, K as JobInputError, M as runHandler, N as runRoute, O as parseBodyText, P as warnUnsupportedJobOptions, S as guardDenyFor, T as jobRouter, U as withPermissions, V as insufficientScope, W as JobDispatchError, Y as ResponseError, _ as defineAdapter, _t as selectToolRoutes, a as HANDLER_ARG_KEYS, b as extractCredential, c as ROUTER_META, d as SCHEMES_META, dt as tagRoutes, f as adapterContextOf, g as contractOf, gt as describeTool, h as boundJobKeys, ht as buildToolInputSchema, i as GUARD_SCHEMA_META, j as routerFromRoutes, k as parseFetchBody, l as RUN_ROUTE_KEY, m as bearerChallenge, mt as buildToolDefinitions, n as DISPATCH_ROUTE_KEY, nt as problemDetails, o as JOBS_META, p as assembleApi, q as createJobRunner, r as GUARDS_META, s as REQUEST_CONTEXT_META, t as API_META, u as ResponseValidationError, v as dispatchHandler, vt as toolOptionsOf, w as isGuardDenial, x as getHeaderValue, xt as isTagSet, y as dispatchRoute, yt as toolRefusal, z as matchRoute } from "./adapter-Bp3CIsRc.mjs";
2
+ import { N as encodeStreamBody, U as isStreamResponse, _ as jobAt, a as pluginRoutesOf, ct as allowedMethodsForPath, dt as isRouteDefinition, ft as validateRequest, h as isCompiledJob, i as pluginRouterOf, lt as flattenRoutes, m as flattenJobs, o as resolvePlugins, ot as buildPath, r as pluginExportsOf, st as parsePath, t as createApiReference, ut as formatValidationError } from "./plugin-server-C9i5kuJN.mjs";
3
+ import { A as renderJsonResult, B as sortFlattenedRoutes, C as headersToObject, D as jobRunnerFrom, E as jobRoutes, F as isRawResponse, G as defineJobTransport, H as requiresDenial, I as rawResponse, J as jobFnAt, K as JobInputError, M as runHandler, N as runRoute, O as parseBodyText, P as warnUnsupportedJobOptions, S as guardDenyFor, T as jobRouter, U as withPermissions, V as insufficientScope, W as JobDispatchError, Y as ResponseError, _ as defineAdapter, _t as selectToolRoutes, a as HANDLER_ARG_KEYS, b as extractCredential, c as ROUTER_META, d as SCHEMES_META, dt as tagRoutes, f as adapterContextOf, g as contractOf, gt as describeTool, h as boundJobKeys, ht as buildToolInputSchema, i as GUARD_SCHEMA_META, j as routerFromRoutes, k as parseFetchBody, l as RUN_ROUTE_KEY, m as bearerChallenge, mt as buildToolDefinitions, n as DISPATCH_ROUTE_KEY, nt as problemDetails, o as JOBS_META, p as assembleApi, q as createJobRunner, r as GUARDS_META, s as REQUEST_CONTEXT_META, t as API_META, u as ResponseValidationError, v as dispatchHandler, vt as toolOptionsOf, w as isGuardDenial, x as getHeaderValue, xt as isTagSet, y as dispatchRoute, yt as toolRefusal, z as matchRoute } from "./adapter-BcwpTn32.mjs";
4
4
  import { l as authenticationChallenge, p as resolveSecurityRequirements } from "./schemas-_W2cLAVl.mjs";
5
5
  export { API_META, AUTO_GUARD_BRAND, AUTO_RESPONSES_BRAND, DISPATCH_ROUTE_KEY, GUARDS_META, GUARD_SCHEMA_META, HANDLER_ARG_KEYS, HANDLER_CONTEXT_BRAND, JOBS_META, JobDispatchError, JobInputError, REQUEST_CONTEXT_META, ROUTER_META, ROUTES_TAG, RUN_ROUTE_KEY, ResponseError, ResponseValidationError, SCHEMES_META, adapterContextOf, allowedMethodsForPath, assembleApi, authenticationChallenge, bearerChallenge, boundJobKeys, buildPath, buildToolDefinitions, buildToolInputSchema, contractOf, createApiReference, createJobRunner, defineAdapter, defineJobTransport, definePlugin, describeTool, dispatchHandler, dispatchRoute, encodeStreamBody, extractCredential, flattenJobs, flattenRoutes, formatValidationError, getHeaderValue, guardDenyFor, headersToObject, insufficientScope, isCompiledJob, isGuardDenial, isRawResponse, isRouteDefinition, isStreamResponse, isTagSet, jobAt, jobFnAt, jobRouter, jobRoutes, jobRunnerFrom, matchRoute, parseBodyText, parseFetchBody, parsePath, pluginExportsOf, pluginRouteTree, pluginRouterOf, pluginRoutesOf, problemDetails, rawResponse, renderJsonResult, requiresDenial, resolvePlugins, resolveSecurityRequirements, routerFromRoutes, runHandler, runRoute, selectToolRoutes, sortFlattenedRoutes, tagRoutes, toolOptionsOf, toolRefusal, validateRequest, warnUnsupportedJobOptions, withPermissions };
@@ -1,6 +1,6 @@
1
1
  Object.defineProperty(exports, Symbol.toStringTag, { value: "Module" });
2
2
  const require_error_response = require("./error-response-C9ymqSU4.cjs");
3
- const require_plugin_server = require("./plugin-server-DrDIPl6R.cjs");
3
+ const require_plugin_server = require("./plugin-server-CIC64cSM.cjs");
4
4
  //#region src/generator.ts
5
5
  /**
6
6
  * Every route the api serves, the app's and the plugins' under their slugs,
@@ -1,5 +1,5 @@
1
1
  import { K as RouteDefinition, W as ResponseHeaders, Z as Routes, j as CachePolicy } from "./error-response-Da3XXloD.cjs";
2
- import { $i as StreamMode, At as shortTypeName, Ct as resolveResponseCache, Dt as resolveResponseStream, Et as resolveResponseHeaders, Fn as FlattenedJob, Jn as flattenJobs, Mt as toCamelCase, Nn as CompiledJob, Nt as toPascalCase, Ot as sanitizeFieldName, Sn as GeneratedFile, St as resolveResponseBody, Tt as resolveResponseEtag, Ui as parsePath, Wi as EVENT_STREAM_MEDIA_TYPE, Wn as Jobs, Yn as isCompiledJob, Zn as jobAt, _t as isStreamResponse, aa as streamContentType, bt as localTypeName, ca as streamStatuses, gt as isJsonMediaType, ht as isHintPrefix, ia as soleStreamResponse, jt as statusToCamelCase, kt as sanitizeIdentifier, na as isNamedStream, oa as streamMode, ra as routeStreams, sa as streamSchemas, vt as isSuccessStatus, wn as ApiDefinition, wt as resolveResponseContentType, xt as mergeHeaderFields, yt as isZodSchema } from "./adapter-Ca2YCENa.cjs";
2
+ import { $n as jobAt, At as shortTypeName, Ct as resolveResponseCache, Dt as resolveResponseStream, Et as resolveResponseHeaders, Fn as FlattenedJob, Gi as parsePath, Ki as EVENT_STREAM_MEDIA_TYPE, Kn as Jobs, Mt as toCamelCase, Nn as CompiledJob, Nt as toPascalCase, Ot as sanitizeFieldName, Sn as GeneratedFile, St as resolveResponseBody, Tt as resolveResponseEtag, Xn as flattenJobs, Zn as isCompiledJob, _t as isStreamResponse, aa as routeStreams, bt as localTypeName, ca as streamMode, gt as isJsonMediaType, ht as isHintPrefix, ia as isNamedStream, jt as statusToCamelCase, kt as sanitizeIdentifier, la as streamSchemas, oa as soleStreamResponse, sa as streamContentType, ta as StreamMode, ua as streamStatuses, vt as isSuccessStatus, wn as ApiDefinition, wt as resolveResponseContentType, xt as mergeHeaderFields, yt as isZodSchema } from "./adapter-O2unN9bH.cjs";
3
3
  import { z } from "zod";
4
4
 
5
5
  //#region src/zod-internals.d.ts
@@ -1,5 +1,5 @@
1
1
  import { K as RouteDefinition, W as ResponseHeaders, Z as Routes, j as CachePolicy } from "./error-response-D2bAIpNd.mjs";
2
- import { $i as StreamMode, At as shortTypeName, Ct as resolveResponseCache, Dt as resolveResponseStream, Et as resolveResponseHeaders, Fn as FlattenedJob, Jn as flattenJobs, Mt as toCamelCase, Nn as CompiledJob, Nt as toPascalCase, Ot as sanitizeFieldName, Sn as GeneratedFile, St as resolveResponseBody, Tt as resolveResponseEtag, Ui as parsePath, Wi as EVENT_STREAM_MEDIA_TYPE, Wn as Jobs, Yn as isCompiledJob, Zn as jobAt, _t as isStreamResponse, aa as streamContentType, bt as localTypeName, ca as streamStatuses, gt as isJsonMediaType, ht as isHintPrefix, ia as soleStreamResponse, jt as statusToCamelCase, kt as sanitizeIdentifier, na as isNamedStream, oa as streamMode, ra as routeStreams, sa as streamSchemas, vt as isSuccessStatus, wn as ApiDefinition, wt as resolveResponseContentType, xt as mergeHeaderFields, yt as isZodSchema } from "./adapter-BiPct09t.mjs";
2
+ import { $n as jobAt, At as shortTypeName, Ct as resolveResponseCache, Dt as resolveResponseStream, Et as resolveResponseHeaders, Fn as FlattenedJob, Gi as parsePath, Ki as EVENT_STREAM_MEDIA_TYPE, Kn as Jobs, Mt as toCamelCase, Nn as CompiledJob, Nt as toPascalCase, Ot as sanitizeFieldName, Sn as GeneratedFile, St as resolveResponseBody, Tt as resolveResponseEtag, Xn as flattenJobs, Zn as isCompiledJob, _t as isStreamResponse, aa as routeStreams, bt as localTypeName, ca as streamMode, gt as isJsonMediaType, ht as isHintPrefix, ia as isNamedStream, jt as statusToCamelCase, kt as sanitizeIdentifier, la as streamSchemas, oa as soleStreamResponse, sa as streamContentType, ta as StreamMode, ua as streamStatuses, vt as isSuccessStatus, wn as ApiDefinition, wt as resolveResponseContentType, xt as mergeHeaderFields, yt as isZodSchema } from "./adapter-Do23zdY1.mjs";
3
3
  import { z } from "zod";
4
4
 
5
5
  //#region src/zod-internals.d.ts
@@ -1,5 +1,5 @@
1
1
  import { C as readMetaExamples, D as unwrapOptionalWrappers, S as readMetaDescription, T as readObjectShape, _ as readDiscriminatedUnion, b as readMeta, c as isBinarySchema, d as isIntegerSchema, f as isObjectSchema, g as readDeprecation, h as readDefType, i as FILE_PROBE, l as isDiscriminatedUnionSchema, m as readDef, p as isVoidSchema, s as globalRegistrySchemas, u as isFileSchema, v as readDiscriminatorLiteral, w as readMetaId, x as readMetaBrand, y as readDiscriminatorStringLiteral } from "./error-response-CNQaKVYd.mjs";
2
- import { $ as sanitizeFieldName, A as EVENT_STREAM_MEDIA_TYPE, B as isHintPrefix, F as soleStreamResponse, G as localTypeName, H as isStreamResponse, I as streamContentType, J as resolveResponseCache, K as mergeHeaderFields, L as streamMode, N as isNamedStream, O as deriveToolNames, P as routeStreams, Q as resolveResponseStream, R as streamSchemas, U as isSuccessStatus, V as isJsonMediaType, W as isZodSchema, X as resolveResponseEtag, Y as resolveResponseContentType, Z as resolveResponseHeaders, a as pluginRoutesOf, c as cacheHeaders, ct as flattenRoutes, et as sanitizeIdentifier, g as jobAt, it as toPascalCase, k as toToolName, m as isCompiledJob, n as describeIssue, nt as statusToCamelCase, ot as parsePath, p as flattenJobs, q as resolveResponseBody, rt as toCamelCase, tt as shortTypeName, u as deprecationHeaders, ut as isRouteDefinition, z as streamStatuses } from "./plugin-server-C0CyVED-.mjs";
2
+ import { $ as resolveResponseStream, A as toToolName, B as streamStatuses, F as routeStreams, G as isZodSchema, H as isJsonMediaType, I as soleStreamResponse, J as resolveResponseBody, K as localTypeName, L as streamContentType, P as isNamedStream, Q as resolveResponseHeaders, R as streamMode, U as isStreamResponse, V as isHintPrefix, W as isSuccessStatus, X as resolveResponseContentType, Y as resolveResponseCache, Z as resolveResponseEtag, _ as jobAt, a as pluginRoutesOf, at as toPascalCase, c as cacheHeaders, dt as isRouteDefinition, et as sanitizeFieldName, h as isCompiledJob, it as toCamelCase, j as EVENT_STREAM_MEDIA_TYPE, k as deriveToolNames, lt as flattenRoutes, m as flattenJobs, n as describeIssue, nt as shortTypeName, q as mergeHeaderFields, rt as statusToCamelCase, st as parsePath, tt as sanitizeIdentifier, u as deprecationHeaders, z as streamSchemas } from "./plugin-server-C9i5kuJN.mjs";
3
3
  //#region src/generator.ts
4
4
  /**
5
5
  * Every route the api serves, the app's and the plugins' under their slugs,
package/dist/index.cjs CHANGED
@@ -1,8 +1,8 @@
1
1
  Object.defineProperty(exports, Symbol.toStringTag, { value: "Module" });
2
2
  const require_plugin = require("./plugin-D_WJ2GBf.cjs");
3
3
  const require_error_response = require("./error-response-C9ymqSU4.cjs");
4
- const require_plugin_server = require("./plugin-server-DrDIPl6R.cjs");
5
- const require_adapter = require("./adapter-CGKgrfQy.cjs");
4
+ const require_plugin_server = require("./plugin-server-CIC64cSM.cjs");
5
+ const require_adapter = require("./adapter-B75LpzDv.cjs");
6
6
  const require_schemas = require("./schemas-7y2XV1if.cjs");
7
7
  let zod = require("zod");
8
8
  //#region src/coded-issue.ts
@@ -561,6 +561,7 @@ const defineConfig = (options) => {
561
561
  ...require_adapter.routeClaims(pluginRoutes, "Plugin route"),
562
562
  ...require_plugin_server.jobClaims(jobs, options.jobRunner)
563
563
  ]);
564
+ require_plugin_server.assertJobRunner(jobs, options.jobRunner);
564
565
  require_plugin_server.assertValidDeprecationDates(routes);
565
566
  require_plugin_server.assertValidDeprecationDates(pluginRoutes);
566
567
  for (const { route, routeKey } of require_plugin_server.flattenRoutes(pluginRoutes)) {
package/dist/index.d.cts CHANGED
@@ -1,5 +1,5 @@
1
1
  import { $ as SecurityRequirement, A as AutoResponsesBrand, C as isPermissions, D as AUTO_RESPONSES_BRAND, E as AUTO_GUARD_WRITTEN_BRAND, F as HANDLER, G as RouteAuth, H as ResponseContentType, I as HANDLER_CONTEXT_BRAND, J as RouteHiddenToolCheck, K as RouteDefinition, L as HandlerContextBrand, M as DECLARATION, N as DeclarationKind, O as AuthoredRouteDefinition, P as GuardStatus, Q as SchemeNameOf, R as METHODS, S as createRoles, T as AUTO_GUARD_BRAND, U as ResponseDefinition, V as RequiredPermissions, X as RouteToolOptions, Y as RoutePath, Z as Routes, _ as PermissionSet, a as OAuthFlows, at as ProblemDetails, b as RoleNamesOf, ct as problemFromBody, d as isSecurityScheme, et as StreamDefinition, g as PermissionName, h as PermissionCatalog, i as OAuthFlow, it as GuardSchemaCheck, j as CachePolicy, k as AuthoredRoutes, l as authorizationServerIssuer, lt as STATUS_TITLES, m as GrantNamesOf, n as isProblemDetails, nt as GuardBody, o as OpenApiSecuritySchemeObject, ot as StripProblemEnvelope, p as CatalogOf, q as RouteHandlerFunction, r as ContextOf, rt as GuardOutput, s as SecurityScheme, st as problemDetails, tt as StreamResponseDefinition, u as declaredScopes, ut as getStatusText, v as Permissions, w as isRoles, x as Roles, y as RoleDefinition, z as Method } from "./error-response-Da3XXloD.cjs";
2
- import { $i as StreamMode, $n as JobFn, $r as GuardAnswer, Aa as CustomConfig, An as SchemesOf, Ar as RequestContextConfig, Ba as RolesOf, Bn as JobHandlers, Bt as PluginArgs, Ca as ApiKeyCredential, Ci as ToolAnswer, Cn as apiEntries, Cr as dueSchedules, Da as BearerCredential, Di as ToolRunResult, Dn as JobsOf, Dr as parseCron, E as MountedOf, Ea as BearerConfig, Ei as ToolRunOptions, En as GuardSchemaOf, Er as nextRuns, Fa as IdentityRole, Fn as FlattenedJob, Fr as TagKeysOf, Ft as ApiPlugins, Gn as JobsArg, Gt as PluginFactory, Hi as buildPath, Hn as JobRunnerConfig, Ht as PluginDefinition, Ia as NoCredential, Ii as ExtractPathParams, In as JobDefinition, Ir as TagOptions, Ji as StreamChunk, Jn as flattenJobs, Jt as PluginRoutes, Ki as StreamBody, Kn as JobsConfig, Kt as PluginList, La as OAuth2Config, Li as HasPathParams, Ln as JobHandler, Lr as TagSet, Ma as GuardHoldings, Mn as AuthoredJobs, Mr as RequestContextHeaderValues, Na as Identity, Nn as CompiledJob, Nr as RequestContextSchema, Oa as Credential, Oi as ToolDefinition, On as RequestContextOf, Or as scheduleExpression, Pa as IdentityParamsOf, Pn as CompiledJobs, Pr as NormalizeTags, Pt as AnyPlugin, Qi as StreamMessageOf, Qn as JobErrorHandler, Qt as PluginsBySlug, Ra as OpenIdConnectConfig, Ri as PathParamName, Rn as JobHandlerArgs, Rr as createTags, Sa as ApiKeyConfig, Si as StreamTools, Sn as GeneratedFile, Sr as cron, T as MountArgsOf, Ta as BasicCredential, Ti as ToolRunCall, Tn as ApiPluginsOf, Tr as nextRun, Ui as parsePath, Un as JobVoidReturn, Ur as RouteBuilder, Ut as PluginExportValues, Vi as RoutePathParamsCheck, Vn as JobResponses, Vt as PluginDeclaration, Wi as EVENT_STREAM_MEDIA_TYPE, Wn as Jobs, Wr as RouteWithHandler, Wt as PluginExportsOf, Xi as StreamContext, Xn as isJobDefinition, Xr as BrandedHandlerContext, Xt as PluginSetup, Yi as StreamComment, Yn as isCompiledJob, Yr as AuthContextOf, Yt as PluginRoutesOf, Zi as StreamMessage, Zn as jobAt, Zr as ContextFromAuth, Zt as PluginSetupContext, _ as GuardDeny, _a as toolEvents, _n as JobFnOf, _r as ScheduledJob, _t as isStreamResponse, aa as streamContentType, ai as HandlerReturn, ar as JobRunner, bn as ApiEntry, br as ParsedCron, ca as streamStatuses, cn as ConfiguredAdapterValue, cr as jobFnAt, ct as ResponseError, da as ToolCall, dn as ConfiguredIdentities, dr as JobMessage, ea as StreamYield, er as JobFnByKey, fa as ToolError, fi as RoutesWithHandlerContext, fn as ConfiguredJobs, fr as JobTransport, ga as expandStreamTools, gn as ConfiguredTags, gr as JobWorkerContext, h as GuardDenial, ha as ToolResult, hn as ConfiguredRequestContextSchemas, hr as JobWorker, ia as soleStreamResponse, ii as HandlerArgs, ir as JobRunArgs, ja as GrantsOf, jn as AuthoredJobDefinition, jr as RequestContextHeaderInputs, ka as CredentialOf, kn as RoutesOf, kr as scheduleTimezone, la as StreamWithTools, li as RouteGuardBrandOf, ln as ConfiguredCodes, lr as JobDescriptor, ma as ToolKeys, mn as ConfiguredRequestContext, mr as JobTransportSupports, na as isNamedStream, ni as GuardSuccess, nr as JobQueueArgs, oa as streamMode, or as JobRunnerOptions, pa as ToolEvents, pi as ThrowableReturn, pn as ConfiguredPlugins, pr as JobTransportDefinition, q as getHeaderValue, qi as StreamBodyOf, qn as NoJobs, ra as routeStreams, rn as definePlugin, rr as JobQueueOptions, s as AnyAdapter, sn as ConfiguredAdapterContext, sr as createJobRunner, ti as GuardReturn, tr as JobInputError, u as ApiWithRouter, ua as ToolAt, un as ConfiguredGuardSchema, ur as JobDispatchError, vn as JobsOfTree, vr as defineJobTransport, wa as BasicConfig, wi as ToolEventYield, wn as ApiDefinition, wr as firesBetween, xi as ModelToolCall, xn as DiffSettings, xr as assertValidSchedule, yi as isRouteDefinition, yn as KizunaConfigShape, yr as JobSchedule, yt as isZodSchema, za as RoleOf, zi as PathParamsCheck, zn as JobHandlerReturn, zt as PluginApi } from "./adapter-Ca2YCENa.cjs";
2
+ import { $i as StreamMessage, $n as jobAt, $r as ContextFromAuth, Aa as Credential, Ai as ToolDefinition, An as SchemesOf, Ar as scheduleExpression, Ba as OpenIdConnectConfig, Bi as PathParamName, Bn as JobHandlerArgs, Br as createTags, Bt as PluginArgs, Ci as ModelToolCall, Cn as apiEntries, Cr as assertValidSchedule, Da as BasicCredential, Di as ToolRunCall, Dn as JobsOf, Dr as nextRun, E as MountedOf, Ea as BasicConfig, Ei as ToolEventYield, En as GuardSchemaOf, Er as firesBetween, Fa as Identity, Fn as FlattenedJob, Fr as RequestContextSchema, Ft as ApiPlugins, Gi as parsePath, Gn as JobVoidReturn, Gr as RouteBuilder, Gt as PluginFactory, Ha as RolesOf, Hn as JobHandlers, Ht as PluginDefinition, Ia as IdentityParamsOf, In as HttpJobsConfig, Ir as NormalizeTags, Ji as StreamBody, Jn as JobsConfig, Jt as PluginRoutes, Ki as EVENT_STREAM_MEDIA_TYPE, Kn as Jobs, Kr as RouteWithHandler, Kt as PluginList, La as IdentityRole, Ln as InProcessJobsConfig, Lr as TagKeysOf, Ma as CustomConfig, Mn as AuthoredJobs, Mr as RequestContextConfig, Na as GrantsOf, Nn as CompiledJob, Nr as RequestContextHeaderInputs, Oa as BearerConfig, Oi as ToolRunOptions, On as RequestContextOf, Or as nextRuns, Pa as GuardHoldings, Pn as CompiledJobs, Pr as RequestContextHeaderValues, Pt as AnyPlugin, Qi as StreamContext, Qn as isJobDefinition, Qr as BrandedHandlerContext, Qt as PluginsBySlug, Ra as NoCredential, Ri as ExtractPathParams, Rn as JobDefinition, Rr as TagOptions, Sn as GeneratedFile, Sr as ParsedCron, T as MountArgsOf, Ta as ApiKeyCredential, Ti as ToolAnswer, Tn as ApiPluginsOf, Tr as dueSchedules, Ui as RoutePathParamsCheck, Un as JobResponses, Ut as PluginExportValues, Va as RoleOf, Vi as PathParamsCheck, Vn as JobHandlerReturn, Vt as PluginDeclaration, Wi as buildPath, Wn as JobRunnerConfig, Wt as PluginExportsOf, Xi as StreamChunk, Xn as flattenJobs, Xt as PluginSetup, Yi as StreamBodyOf, Yn as NoJobs, Yt as PluginRoutesOf, Zi as StreamComment, Zn as isCompiledJob, Zr as AuthContextOf, Zt as PluginSetupContext, _ as GuardDeny, _a as ToolResult, _n as JobFnOf, _r as JobWorker, _t as isStreamResponse, aa as routeStreams, ar as JobQueueOptions, bn as ApiEntry, br as defineJobTransport, ca as streamMode, cn as ConfiguredAdapterValue, cr as JobRunnerOptions, ct as ResponseError, da as StreamWithTools, di as RouteGuardBrandOf, dn as ConfiguredIdentities, dr as JobDescriptor, ea as StreamMessageOf, er as JobErrorHandler, fa as ToolAt, fn as ConfiguredJobs, fr as JobDispatchError, ga as ToolKeys, gn as ConfiguredTags, gr as JobTransportSupports, h as GuardDenial, ha as ToolEvents, hi as ThrowableReturn, hn as ConfiguredRequestContextSchemas, hr as JobTransportDefinition, ia as isNamedStream, ii as GuardSuccess, ir as JobQueueArgs, ja as CredentialOf, jn as AuthoredJobDefinition, jr as scheduleTimezone, ka as BearerCredential, ki as ToolRunResult, kn as RoutesOf, kr as parseCron, ln as ConfiguredCodes, lr as createJobRunner, ma as ToolError, mi as RoutesWithHandlerContext, mn as ConfiguredRequestContext, mr as JobTransport, na as StreamYield, nr as JobFnByKey, oa as soleStreamResponse, oi as HandlerArgs, or as JobRunArgs, pa as ToolCall, pn as ConfiguredPlugins, pr as JobMessage, q as getHeaderValue, qn as JobsArg, ri as GuardReturn, rn as definePlugin, rr as JobInputError, s as AnyAdapter, sa as streamContentType, si as HandlerReturn, sn as ConfiguredAdapterContext, sr as JobRunner, ta as StreamMode, ti as GuardAnswer, tr as JobFn, u as ApiWithRouter, ua as streamStatuses, un as ConfiguredGuardSchema, ur as jobFnAt, va as expandStreamTools, vn as JobsOfTree, vr as JobWorkerContext, wa as ApiKeyConfig, wi as StreamTools, wn as ApiDefinition, wr as cron, xi as isRouteDefinition, xn as DiffSettings, xr as JobSchedule, ya as toolEvents, yn as KizunaConfigShape, yr as ScheduledJob, yt as isZodSchema, za as OAuth2Config, zi as HasPathParams, zn as JobHandler, zr as TagSet, zt as PluginApi } from "./adapter-O2unN9bH.cjs";
3
3
  import { a as buildProtectedResourceMetadata, c as ValidationErrorFor, d as isValidationError, i as assertCanonicalResourceUri, n as ProtectedResourceMetadata, o as BuiltinIssueCode, s as ValidationError, t as ProtectedResourceConfig, u as ValidationIssueCode } from "./protected-resource-metadata-03dcSdwj.cjs";
4
4
  import { z } from "zod";
5
5
  import { $input, $output } from "zod/v4/core";
@@ -809,13 +809,6 @@ type KizunaConfigInput<R extends Routes, J extends Jobs, P extends PluginList, T
809
809
  */
810
810
  issueCodes?: readonly Codes[];
811
811
  };
812
- /**
813
- * How this deployment runs the jobs it declares: where the two endpoints
814
- * sit, what carries queued work out of the process, and where a failure is
815
- * reported. The jobs themselves are declared with `k.jobs` and go under
816
- * `jobs`.
817
- */
818
- jobRunner?: JobRunnerConfig;
819
812
  /**
820
813
  * What `kizuna generate` writes the `Config` to.
821
814
  *
@@ -848,6 +841,20 @@ type KizunaConfigInput<R extends Routes, J extends Jobs, P extends PluginList, T
848
841
  * }
849
842
  */
850
843
  diff?: DiffSettings;
844
+ } & JobRunnerInput<J>;
845
+ /**
846
+ * `jobRunner`, required once `jobs` declares one.
847
+ */
848
+ type JobRunnerInput<J extends Jobs> = string extends keyof J ? {
849
+ jobRunner?: JobRunnerConfig;
850
+ } : {
851
+ /**
852
+ * How this deployment runs the jobs it declares: over HTTP or in
853
+ * process, what carries queued work out of the process, and where a
854
+ * failure is reported. The jobs themselves are declared with
855
+ * `k.jobs` and go under `jobs`.
856
+ */
857
+ jobRunner: JobRunnerConfig;
851
858
  };
852
859
  /**
853
860
  * The api `defineConfig` assembles: the routes it declares, and the `mount`
@@ -881,4 +888,4 @@ declare const defineConfig: <const R extends Routes = Record<string, never>, con
881
888
  diff: DiffSettings | undefined;
882
889
  };
883
890
  //#endregion
884
- export { AUTO_GUARD_BRAND, AUTO_GUARD_WRITTEN_BRAND, AUTO_RESPONSES_BRAND, type AnyPlugin, type Api, type ApiDefinition, type ApiEntry, type ApiImplementations, type ApiKeyCredential, type ApiPlugins, type ApiPluginsOf, type AuthCheck, type AuthContextOf, type AuthoredJobs, type AuthoredRouteDefinition, type AuthoredRoutes, type AutoResponsesBrand, type BasicCredential, type BearerCredential, type BrandedHandlerContext, type BuiltinIssueCode, type CachePolicy, type CatalogOf, type CodedIssue, type CompiledJob, type CompiledJobs, type ConfiguredApi, type ContextFromAuth, type ContextOf, type Credential, type CredentialOf, DECLARATION, type DeclarationKind, type DiffSettings, DispatchFailedSchema, type DispatchOptions, type DispatchOutcome, type DispatchResult, DispatchResultSchema, EVENT_STREAM_MEDIA_TYPE, type ExtractPathParams, type FlattenedJob, GUARD, type GeneratedFile, type GrantNamesOf, type GrantsOf, type GuardAnswer, type GuardBody, type GuardFor, type GuardHoldings, type GuardOutput, type GuardReturn, type GuardSchemaOf, type GuardStatus, type GuardSuccess, HANDLER_CONTEXT_BRAND, type HandlerArgs, type HandlerContextBrand, type HandlerReturn, type HasPathParams, type Identity, type IdentityBuilder, type IdentityFactories, type IdentityNamesOf, type IdentityParamsOf, type IdentityRole, type IdentityWithGuard, type JobBuilder, type JobDefinition, type JobDescriptor, JobDispatchError, type JobErrorHandler, type JobFn, type JobFnByKey, type JobFnOf, type JobHandler, type JobHandlerArgs, type JobHandlerFor, type JobHandlerReturn, type JobHandlers, JobInputError, type JobMessage, type JobQueueArgs, type JobQueueOptions, type JobResponses, type JobRunArgs, type JobRunner, type JobRunnerOptions, type JobSchedule, type JobTransport, type JobTransportDefinition, type JobTransportSupports, type JobWithHandler, type JobWorker, type JobWorkerContext, type Jobs, type JobsArg, type JobsConfig, type JobsOf, type JobsOfTree, type K, Kizuna, type KizunaConfigInput, type KizunaConfigShape, type KizunaSpec, METHODS, type Method, type ModelOptions, type ModelToolCall, type NoCredential, type NoJobs, type NormalizeTags, type OAuthFlow, type OAuthFlows, type OpenApiSecuritySchemeObject, type ParsedCron, type PathParamName, type PermissionCatalog, type PermissionName, type PermissionSet, type Permissions, type PluginApi, type PluginArgs, type PluginDeclaration, type PluginDefinition, type PluginExportValues, type PluginExportsOf, type PluginFactory, type PluginList, type PluginRoutes, type PluginRoutesOf, type PluginSetup, type PluginSetupContext, type PluginsBySlug, type ProblemDetails, type ProtectedResourceConfig, type ProtectedResourceMetadata, RESOLVER, type RegisteredIssue, type RequestContextBuilder, type RequestContextHeaderInputs, type RequestContextHeaderValues, type RequestContextOf, type RequestContextSchema, type RequestContextWithHandler, type RequiredPermissions, type ResponseContentType, type ResponseDefinition, ResponseError, type RoleDefinition, type RoleNamesOf, type RoleOf, type Roles, type RolesOf, type RouteAuth, type RouteAuthCheck, type RouteAuthRule, type RouteAuthValue, type RouteBuilder, type RouteDefinition, type RouteHandlerFunction, type RoutePath, type RouteToolOptions, type RouteWithHandler, type Routes, type RoutesOf, type RoutesWithHandlerContext, STATUS_TITLES, type ScheduledJob, type SchemeNameOf, type SchemesOf, type SecurityRequirement, type SecurityScheme, type StreamBody, type StreamBodyOf, type StreamChunk, type StreamComment, type StreamContext, type StreamDefinition, type StreamMessage, type StreamMessageOf, type StreamMode, type StreamResponseDefinition, type StreamTools, type StreamWithTools, type StreamYield, type StripProblemEnvelope, type TagKeysOf, type TagNamesOf, type TagOptions, type TagSet, type ThrowableReturn, type ToolAnswer, type ToolAt, type ToolCall, type ToolCallMessage, type ToolCallRecord, type ToolCallState, type ToolDefinition, type ToolError, type ToolEventYield, type ToolEvents, type ToolKeys, type ToolResult, type ToolRunCall, type ToolRunOptions, type ToolRunResult, type ValidationError, type ValidationErrorFor, type ValidationIssueCode, apiEntries, assertCanonicalResourceUri, assertValidSchedule, authorizationServerIssuer, buildPath, buildProtectedResourceMetadata, createJobRunner, cron, declaredScopes, defineConfig, defineJobTransport, definePlugin, dispatchDueJobs, dispatchSucceeded, dueJobs, dueSchedules, expandStreamTools, failedJobs, firesBetween, flattenJobs, getHeaderValue, getStatusText, isCompiledJob, isJobDefinition, isNamedStream, isPermissions, isProblemDetails, isRoles, isRouteDefinition, isSecurityScheme, isStreamResponse, isValidationError, isZodSchema, jobAt, jobFnAt, nextRun, nextRuns, parseCron, parsePath, problemDetails, problemFromBody, readToolCalls, routeStreams, scheduleExpression, scheduleTimezone, soleStreamResponse, streamContentType, streamMode, streamStatuses, toolEvents };
891
+ export { AUTO_GUARD_BRAND, AUTO_GUARD_WRITTEN_BRAND, AUTO_RESPONSES_BRAND, type AnyPlugin, type Api, type ApiDefinition, type ApiEntry, type ApiImplementations, type ApiKeyCredential, type ApiPlugins, type ApiPluginsOf, type AuthCheck, type AuthContextOf, type AuthoredJobs, type AuthoredRouteDefinition, type AuthoredRoutes, type AutoResponsesBrand, type BasicCredential, type BearerCredential, type BrandedHandlerContext, type BuiltinIssueCode, type CachePolicy, type CatalogOf, type CodedIssue, type CompiledJob, type CompiledJobs, type ConfiguredApi, type ContextFromAuth, type ContextOf, type Credential, type CredentialOf, DECLARATION, type DeclarationKind, type DiffSettings, DispatchFailedSchema, type DispatchOptions, type DispatchOutcome, type DispatchResult, DispatchResultSchema, EVENT_STREAM_MEDIA_TYPE, type ExtractPathParams, type FlattenedJob, GUARD, type GeneratedFile, type GrantNamesOf, type GrantsOf, type GuardAnswer, type GuardBody, type GuardFor, type GuardHoldings, type GuardOutput, type GuardReturn, type GuardSchemaOf, type GuardStatus, type GuardSuccess, HANDLER_CONTEXT_BRAND, type HandlerArgs, type HandlerContextBrand, type HandlerReturn, type HasPathParams, type HttpJobsConfig, type Identity, type IdentityBuilder, type IdentityFactories, type IdentityNamesOf, type IdentityParamsOf, type IdentityRole, type IdentityWithGuard, type InProcessJobsConfig, type JobBuilder, type JobDefinition, type JobDescriptor, JobDispatchError, type JobErrorHandler, type JobFn, type JobFnByKey, type JobFnOf, type JobHandler, type JobHandlerArgs, type JobHandlerFor, type JobHandlerReturn, type JobHandlers, JobInputError, type JobMessage, type JobQueueArgs, type JobQueueOptions, type JobResponses, type JobRunArgs, type JobRunner, type JobRunnerOptions, type JobSchedule, type JobTransport, type JobTransportDefinition, type JobTransportSupports, type JobWithHandler, type JobWorker, type JobWorkerContext, type Jobs, type JobsArg, type JobsConfig, type JobsOf, type JobsOfTree, type K, Kizuna, type KizunaConfigInput, type KizunaConfigShape, type KizunaSpec, METHODS, type Method, type ModelOptions, type ModelToolCall, type NoCredential, type NoJobs, type NormalizeTags, type OAuthFlow, type OAuthFlows, type OpenApiSecuritySchemeObject, type ParsedCron, type PathParamName, type PermissionCatalog, type PermissionName, type PermissionSet, type Permissions, type PluginApi, type PluginArgs, type PluginDeclaration, type PluginDefinition, type PluginExportValues, type PluginExportsOf, type PluginFactory, type PluginList, type PluginRoutes, type PluginRoutesOf, type PluginSetup, type PluginSetupContext, type PluginsBySlug, type ProblemDetails, type ProtectedResourceConfig, type ProtectedResourceMetadata, RESOLVER, type RegisteredIssue, type RequestContextBuilder, type RequestContextHeaderInputs, type RequestContextHeaderValues, type RequestContextOf, type RequestContextSchema, type RequestContextWithHandler, type RequiredPermissions, type ResponseContentType, type ResponseDefinition, ResponseError, type RoleDefinition, type RoleNamesOf, type RoleOf, type Roles, type RolesOf, type RouteAuth, type RouteAuthCheck, type RouteAuthRule, type RouteAuthValue, type RouteBuilder, type RouteDefinition, type RouteHandlerFunction, type RoutePath, type RouteToolOptions, type RouteWithHandler, type Routes, type RoutesOf, type RoutesWithHandlerContext, STATUS_TITLES, type ScheduledJob, type SchemeNameOf, type SchemesOf, type SecurityRequirement, type SecurityScheme, type StreamBody, type StreamBodyOf, type StreamChunk, type StreamComment, type StreamContext, type StreamDefinition, type StreamMessage, type StreamMessageOf, type StreamMode, type StreamResponseDefinition, type StreamTools, type StreamWithTools, type StreamYield, type StripProblemEnvelope, type TagKeysOf, type TagNamesOf, type TagOptions, type TagSet, type ThrowableReturn, type ToolAnswer, type ToolAt, type ToolCall, type ToolCallMessage, type ToolCallRecord, type ToolCallState, type ToolDefinition, type ToolError, type ToolEventYield, type ToolEvents, type ToolKeys, type ToolResult, type ToolRunCall, type ToolRunOptions, type ToolRunResult, type ValidationError, type ValidationErrorFor, type ValidationIssueCode, apiEntries, assertCanonicalResourceUri, assertValidSchedule, authorizationServerIssuer, buildPath, buildProtectedResourceMetadata, createJobRunner, cron, declaredScopes, defineConfig, defineJobTransport, definePlugin, dispatchDueJobs, dispatchSucceeded, dueJobs, dueSchedules, expandStreamTools, failedJobs, firesBetween, flattenJobs, getHeaderValue, getStatusText, isCompiledJob, isJobDefinition, isNamedStream, isPermissions, isProblemDetails, isRoles, isRouteDefinition, isSecurityScheme, isStreamResponse, isValidationError, isZodSchema, jobAt, jobFnAt, nextRun, nextRuns, parseCron, parsePath, problemDetails, problemFromBody, readToolCalls, routeStreams, scheduleExpression, scheduleTimezone, soleStreamResponse, streamContentType, streamMode, streamStatuses, toolEvents };
package/dist/index.d.mts CHANGED
@@ -1,5 +1,5 @@
1
1
  import { $ as SecurityRequirement, A as AutoResponsesBrand, C as isPermissions, D as AUTO_RESPONSES_BRAND, E as AUTO_GUARD_WRITTEN_BRAND, F as HANDLER, G as RouteAuth, H as ResponseContentType, I as HANDLER_CONTEXT_BRAND, J as RouteHiddenToolCheck, K as RouteDefinition, L as HandlerContextBrand, M as DECLARATION, N as DeclarationKind, O as AuthoredRouteDefinition, P as GuardStatus, Q as SchemeNameOf, R as METHODS, S as createRoles, T as AUTO_GUARD_BRAND, U as ResponseDefinition, V as RequiredPermissions, X as RouteToolOptions, Y as RoutePath, Z as Routes, _ as PermissionSet, a as OAuthFlows, at as ProblemDetails, b as RoleNamesOf, ct as problemFromBody, d as isSecurityScheme, et as StreamDefinition, g as PermissionName, h as PermissionCatalog, i as OAuthFlow, it as GuardSchemaCheck, j as CachePolicy, k as AuthoredRoutes, l as authorizationServerIssuer, lt as STATUS_TITLES, m as GrantNamesOf, n as isProblemDetails, nt as GuardBody, o as OpenApiSecuritySchemeObject, ot as StripProblemEnvelope, p as CatalogOf, q as RouteHandlerFunction, r as ContextOf, rt as GuardOutput, s as SecurityScheme, st as problemDetails, tt as StreamResponseDefinition, u as declaredScopes, ut as getStatusText, v as Permissions, w as isRoles, x as Roles, y as RoleDefinition, z as Method } from "./error-response-D2bAIpNd.mjs";
2
- import { $i as StreamMode, $n as JobFn, $r as GuardAnswer, Aa as CustomConfig, An as SchemesOf, Ar as RequestContextConfig, Ba as RolesOf, Bn as JobHandlers, Bt as PluginArgs, Ca as ApiKeyCredential, Ci as ToolAnswer, Cn as apiEntries, Cr as dueSchedules, Da as BearerCredential, Di as ToolRunResult, Dn as JobsOf, Dr as parseCron, E as MountedOf, Ea as BearerConfig, Ei as ToolRunOptions, En as GuardSchemaOf, Er as nextRuns, Fa as IdentityRole, Fn as FlattenedJob, Fr as TagKeysOf, Ft as ApiPlugins, Gn as JobsArg, Gt as PluginFactory, Hi as buildPath, Hn as JobRunnerConfig, Ht as PluginDefinition, Ia as NoCredential, Ii as ExtractPathParams, In as JobDefinition, Ir as TagOptions, Ji as StreamChunk, Jn as flattenJobs, Jt as PluginRoutes, Ki as StreamBody, Kn as JobsConfig, Kt as PluginList, La as OAuth2Config, Li as HasPathParams, Ln as JobHandler, Lr as TagSet, Ma as GuardHoldings, Mn as AuthoredJobs, Mr as RequestContextHeaderValues, Na as Identity, Nn as CompiledJob, Nr as RequestContextSchema, Oa as Credential, Oi as ToolDefinition, On as RequestContextOf, Or as scheduleExpression, Pa as IdentityParamsOf, Pn as CompiledJobs, Pr as NormalizeTags, Pt as AnyPlugin, Qi as StreamMessageOf, Qn as JobErrorHandler, Qt as PluginsBySlug, Ra as OpenIdConnectConfig, Ri as PathParamName, Rn as JobHandlerArgs, Rr as createTags, Sa as ApiKeyConfig, Si as StreamTools, Sn as GeneratedFile, Sr as cron, T as MountArgsOf, Ta as BasicCredential, Ti as ToolRunCall, Tn as ApiPluginsOf, Tr as nextRun, Ui as parsePath, Un as JobVoidReturn, Ur as RouteBuilder, Ut as PluginExportValues, Vi as RoutePathParamsCheck, Vn as JobResponses, Vt as PluginDeclaration, Wi as EVENT_STREAM_MEDIA_TYPE, Wn as Jobs, Wr as RouteWithHandler, Wt as PluginExportsOf, Xi as StreamContext, Xn as isJobDefinition, Xr as BrandedHandlerContext, Xt as PluginSetup, Yi as StreamComment, Yn as isCompiledJob, Yr as AuthContextOf, Yt as PluginRoutesOf, Zi as StreamMessage, Zn as jobAt, Zr as ContextFromAuth, Zt as PluginSetupContext, _ as GuardDeny, _a as toolEvents, _n as JobFnOf, _r as ScheduledJob, _t as isStreamResponse, aa as streamContentType, ai as HandlerReturn, ar as JobRunner, bn as ApiEntry, br as ParsedCron, ca as streamStatuses, cn as ConfiguredAdapterValue, cr as jobFnAt, ct as ResponseError, da as ToolCall, dn as ConfiguredIdentities, dr as JobMessage, ea as StreamYield, er as JobFnByKey, fa as ToolError, fi as RoutesWithHandlerContext, fn as ConfiguredJobs, fr as JobTransport, ga as expandStreamTools, gn as ConfiguredTags, gr as JobWorkerContext, h as GuardDenial, ha as ToolResult, hn as ConfiguredRequestContextSchemas, hr as JobWorker, ia as soleStreamResponse, ii as HandlerArgs, ir as JobRunArgs, ja as GrantsOf, jn as AuthoredJobDefinition, jr as RequestContextHeaderInputs, ka as CredentialOf, kn as RoutesOf, kr as scheduleTimezone, la as StreamWithTools, li as RouteGuardBrandOf, ln as ConfiguredCodes, lr as JobDescriptor, ma as ToolKeys, mn as ConfiguredRequestContext, mr as JobTransportSupports, na as isNamedStream, ni as GuardSuccess, nr as JobQueueArgs, oa as streamMode, or as JobRunnerOptions, pa as ToolEvents, pi as ThrowableReturn, pn as ConfiguredPlugins, pr as JobTransportDefinition, q as getHeaderValue, qi as StreamBodyOf, qn as NoJobs, ra as routeStreams, rn as definePlugin, rr as JobQueueOptions, s as AnyAdapter, sn as ConfiguredAdapterContext, sr as createJobRunner, ti as GuardReturn, tr as JobInputError, u as ApiWithRouter, ua as ToolAt, un as ConfiguredGuardSchema, ur as JobDispatchError, vn as JobsOfTree, vr as defineJobTransport, wa as BasicConfig, wi as ToolEventYield, wn as ApiDefinition, wr as firesBetween, xi as ModelToolCall, xn as DiffSettings, xr as assertValidSchedule, yi as isRouteDefinition, yn as KizunaConfigShape, yr as JobSchedule, yt as isZodSchema, za as RoleOf, zi as PathParamsCheck, zn as JobHandlerReturn, zt as PluginApi } from "./adapter-BiPct09t.mjs";
2
+ import { $i as StreamMessage, $n as jobAt, $r as ContextFromAuth, Aa as Credential, Ai as ToolDefinition, An as SchemesOf, Ar as scheduleExpression, Ba as OpenIdConnectConfig, Bi as PathParamName, Bn as JobHandlerArgs, Br as createTags, Bt as PluginArgs, Ci as ModelToolCall, Cn as apiEntries, Cr as assertValidSchedule, Da as BasicCredential, Di as ToolRunCall, Dn as JobsOf, Dr as nextRun, E as MountedOf, Ea as BasicConfig, Ei as ToolEventYield, En as GuardSchemaOf, Er as firesBetween, Fa as Identity, Fn as FlattenedJob, Fr as RequestContextSchema, Ft as ApiPlugins, Gi as parsePath, Gn as JobVoidReturn, Gr as RouteBuilder, Gt as PluginFactory, Ha as RolesOf, Hn as JobHandlers, Ht as PluginDefinition, Ia as IdentityParamsOf, In as HttpJobsConfig, Ir as NormalizeTags, Ji as StreamBody, Jn as JobsConfig, Jt as PluginRoutes, Ki as EVENT_STREAM_MEDIA_TYPE, Kn as Jobs, Kr as RouteWithHandler, Kt as PluginList, La as IdentityRole, Ln as InProcessJobsConfig, Lr as TagKeysOf, Ma as CustomConfig, Mn as AuthoredJobs, Mr as RequestContextConfig, Na as GrantsOf, Nn as CompiledJob, Nr as RequestContextHeaderInputs, Oa as BearerConfig, Oi as ToolRunOptions, On as RequestContextOf, Or as nextRuns, Pa as GuardHoldings, Pn as CompiledJobs, Pr as RequestContextHeaderValues, Pt as AnyPlugin, Qi as StreamContext, Qn as isJobDefinition, Qr as BrandedHandlerContext, Qt as PluginsBySlug, Ra as NoCredential, Ri as ExtractPathParams, Rn as JobDefinition, Rr as TagOptions, Sn as GeneratedFile, Sr as ParsedCron, T as MountArgsOf, Ta as ApiKeyCredential, Ti as ToolAnswer, Tn as ApiPluginsOf, Tr as dueSchedules, Ui as RoutePathParamsCheck, Un as JobResponses, Ut as PluginExportValues, Va as RoleOf, Vi as PathParamsCheck, Vn as JobHandlerReturn, Vt as PluginDeclaration, Wi as buildPath, Wn as JobRunnerConfig, Wt as PluginExportsOf, Xi as StreamChunk, Xn as flattenJobs, Xt as PluginSetup, Yi as StreamBodyOf, Yn as NoJobs, Yt as PluginRoutesOf, Zi as StreamComment, Zn as isCompiledJob, Zr as AuthContextOf, Zt as PluginSetupContext, _ as GuardDeny, _a as ToolResult, _n as JobFnOf, _r as JobWorker, _t as isStreamResponse, aa as routeStreams, ar as JobQueueOptions, bn as ApiEntry, br as defineJobTransport, ca as streamMode, cn as ConfiguredAdapterValue, cr as JobRunnerOptions, ct as ResponseError, da as StreamWithTools, di as RouteGuardBrandOf, dn as ConfiguredIdentities, dr as JobDescriptor, ea as StreamMessageOf, er as JobErrorHandler, fa as ToolAt, fn as ConfiguredJobs, fr as JobDispatchError, ga as ToolKeys, gn as ConfiguredTags, gr as JobTransportSupports, h as GuardDenial, ha as ToolEvents, hi as ThrowableReturn, hn as ConfiguredRequestContextSchemas, hr as JobTransportDefinition, ia as isNamedStream, ii as GuardSuccess, ir as JobQueueArgs, ja as CredentialOf, jn as AuthoredJobDefinition, jr as scheduleTimezone, ka as BearerCredential, ki as ToolRunResult, kn as RoutesOf, kr as parseCron, ln as ConfiguredCodes, lr as createJobRunner, ma as ToolError, mi as RoutesWithHandlerContext, mn as ConfiguredRequestContext, mr as JobTransport, na as StreamYield, nr as JobFnByKey, oa as soleStreamResponse, oi as HandlerArgs, or as JobRunArgs, pa as ToolCall, pn as ConfiguredPlugins, pr as JobMessage, q as getHeaderValue, qn as JobsArg, ri as GuardReturn, rn as definePlugin, rr as JobInputError, s as AnyAdapter, sa as streamContentType, si as HandlerReturn, sn as ConfiguredAdapterContext, sr as JobRunner, ta as StreamMode, ti as GuardAnswer, tr as JobFn, u as ApiWithRouter, ua as streamStatuses, un as ConfiguredGuardSchema, ur as jobFnAt, va as expandStreamTools, vn as JobsOfTree, vr as JobWorkerContext, wa as ApiKeyConfig, wi as StreamTools, wn as ApiDefinition, wr as cron, xi as isRouteDefinition, xn as DiffSettings, xr as JobSchedule, ya as toolEvents, yn as KizunaConfigShape, yr as ScheduledJob, yt as isZodSchema, za as OAuth2Config, zi as HasPathParams, zn as JobHandler, zr as TagSet, zt as PluginApi } from "./adapter-Do23zdY1.mjs";
3
3
  import { a as buildProtectedResourceMetadata, c as ValidationErrorFor, d as isValidationError, i as assertCanonicalResourceUri, n as ProtectedResourceMetadata, o as BuiltinIssueCode, s as ValidationError, t as ProtectedResourceConfig, u as ValidationIssueCode } from "./protected-resource-metadata-By4Un6Oc.mjs";
4
4
  import { z } from "zod";
5
5
  import { $input, $output } from "zod/v4/core";
@@ -809,13 +809,6 @@ type KizunaConfigInput<R extends Routes, J extends Jobs, P extends PluginList, T
809
809
  */
810
810
  issueCodes?: readonly Codes[];
811
811
  };
812
- /**
813
- * How this deployment runs the jobs it declares: where the two endpoints
814
- * sit, what carries queued work out of the process, and where a failure is
815
- * reported. The jobs themselves are declared with `k.jobs` and go under
816
- * `jobs`.
817
- */
818
- jobRunner?: JobRunnerConfig;
819
812
  /**
820
813
  * What `kizuna generate` writes the `Config` to.
821
814
  *
@@ -848,6 +841,20 @@ type KizunaConfigInput<R extends Routes, J extends Jobs, P extends PluginList, T
848
841
  * }
849
842
  */
850
843
  diff?: DiffSettings;
844
+ } & JobRunnerInput<J>;
845
+ /**
846
+ * `jobRunner`, required once `jobs` declares one.
847
+ */
848
+ type JobRunnerInput<J extends Jobs> = string extends keyof J ? {
849
+ jobRunner?: JobRunnerConfig;
850
+ } : {
851
+ /**
852
+ * How this deployment runs the jobs it declares: over HTTP or in
853
+ * process, what carries queued work out of the process, and where a
854
+ * failure is reported. The jobs themselves are declared with
855
+ * `k.jobs` and go under `jobs`.
856
+ */
857
+ jobRunner: JobRunnerConfig;
851
858
  };
852
859
  /**
853
860
  * The api `defineConfig` assembles: the routes it declares, and the `mount`
@@ -881,4 +888,4 @@ declare const defineConfig: <const R extends Routes = Record<string, never>, con
881
888
  diff: DiffSettings | undefined;
882
889
  };
883
890
  //#endregion
884
- export { AUTO_GUARD_BRAND, AUTO_GUARD_WRITTEN_BRAND, AUTO_RESPONSES_BRAND, type AnyPlugin, type Api, type ApiDefinition, type ApiEntry, type ApiImplementations, type ApiKeyCredential, type ApiPlugins, type ApiPluginsOf, type AuthCheck, type AuthContextOf, type AuthoredJobs, type AuthoredRouteDefinition, type AuthoredRoutes, type AutoResponsesBrand, type BasicCredential, type BearerCredential, type BrandedHandlerContext, type BuiltinIssueCode, type CachePolicy, type CatalogOf, type CodedIssue, type CompiledJob, type CompiledJobs, type ConfiguredApi, type ContextFromAuth, type ContextOf, type Credential, type CredentialOf, DECLARATION, type DeclarationKind, type DiffSettings, DispatchFailedSchema, type DispatchOptions, type DispatchOutcome, type DispatchResult, DispatchResultSchema, EVENT_STREAM_MEDIA_TYPE, type ExtractPathParams, type FlattenedJob, GUARD, type GeneratedFile, type GrantNamesOf, type GrantsOf, type GuardAnswer, type GuardBody, type GuardFor, type GuardHoldings, type GuardOutput, type GuardReturn, type GuardSchemaOf, type GuardStatus, type GuardSuccess, HANDLER_CONTEXT_BRAND, type HandlerArgs, type HandlerContextBrand, type HandlerReturn, type HasPathParams, type Identity, type IdentityBuilder, type IdentityFactories, type IdentityNamesOf, type IdentityParamsOf, type IdentityRole, type IdentityWithGuard, type JobBuilder, type JobDefinition, type JobDescriptor, JobDispatchError, type JobErrorHandler, type JobFn, type JobFnByKey, type JobFnOf, type JobHandler, type JobHandlerArgs, type JobHandlerFor, type JobHandlerReturn, type JobHandlers, JobInputError, type JobMessage, type JobQueueArgs, type JobQueueOptions, type JobResponses, type JobRunArgs, type JobRunner, type JobRunnerOptions, type JobSchedule, type JobTransport, type JobTransportDefinition, type JobTransportSupports, type JobWithHandler, type JobWorker, type JobWorkerContext, type Jobs, type JobsArg, type JobsConfig, type JobsOf, type JobsOfTree, type K, Kizuna, type KizunaConfigInput, type KizunaConfigShape, type KizunaSpec, METHODS, type Method, type ModelOptions, type ModelToolCall, type NoCredential, type NoJobs, type NormalizeTags, type OAuthFlow, type OAuthFlows, type OpenApiSecuritySchemeObject, type ParsedCron, type PathParamName, type PermissionCatalog, type PermissionName, type PermissionSet, type Permissions, type PluginApi, type PluginArgs, type PluginDeclaration, type PluginDefinition, type PluginExportValues, type PluginExportsOf, type PluginFactory, type PluginList, type PluginRoutes, type PluginRoutesOf, type PluginSetup, type PluginSetupContext, type PluginsBySlug, type ProblemDetails, type ProtectedResourceConfig, type ProtectedResourceMetadata, RESOLVER, type RegisteredIssue, type RequestContextBuilder, type RequestContextHeaderInputs, type RequestContextHeaderValues, type RequestContextOf, type RequestContextSchema, type RequestContextWithHandler, type RequiredPermissions, type ResponseContentType, type ResponseDefinition, ResponseError, type RoleDefinition, type RoleNamesOf, type RoleOf, type Roles, type RolesOf, type RouteAuth, type RouteAuthCheck, type RouteAuthRule, type RouteAuthValue, type RouteBuilder, type RouteDefinition, type RouteHandlerFunction, type RoutePath, type RouteToolOptions, type RouteWithHandler, type Routes, type RoutesOf, type RoutesWithHandlerContext, STATUS_TITLES, type ScheduledJob, type SchemeNameOf, type SchemesOf, type SecurityRequirement, type SecurityScheme, type StreamBody, type StreamBodyOf, type StreamChunk, type StreamComment, type StreamContext, type StreamDefinition, type StreamMessage, type StreamMessageOf, type StreamMode, type StreamResponseDefinition, type StreamTools, type StreamWithTools, type StreamYield, type StripProblemEnvelope, type TagKeysOf, type TagNamesOf, type TagOptions, type TagSet, type ThrowableReturn, type ToolAnswer, type ToolAt, type ToolCall, type ToolCallMessage, type ToolCallRecord, type ToolCallState, type ToolDefinition, type ToolError, type ToolEventYield, type ToolEvents, type ToolKeys, type ToolResult, type ToolRunCall, type ToolRunOptions, type ToolRunResult, type ValidationError, type ValidationErrorFor, type ValidationIssueCode, apiEntries, assertCanonicalResourceUri, assertValidSchedule, authorizationServerIssuer, buildPath, buildProtectedResourceMetadata, createJobRunner, cron, declaredScopes, defineConfig, defineJobTransport, definePlugin, dispatchDueJobs, dispatchSucceeded, dueJobs, dueSchedules, expandStreamTools, failedJobs, firesBetween, flattenJobs, getHeaderValue, getStatusText, isCompiledJob, isJobDefinition, isNamedStream, isPermissions, isProblemDetails, isRoles, isRouteDefinition, isSecurityScheme, isStreamResponse, isValidationError, isZodSchema, jobAt, jobFnAt, nextRun, nextRuns, parseCron, parsePath, problemDetails, problemFromBody, readToolCalls, routeStreams, scheduleExpression, scheduleTimezone, soleStreamResponse, streamContentType, streamMode, streamStatuses, toolEvents };
891
+ export { AUTO_GUARD_BRAND, AUTO_GUARD_WRITTEN_BRAND, AUTO_RESPONSES_BRAND, type AnyPlugin, type Api, type ApiDefinition, type ApiEntry, type ApiImplementations, type ApiKeyCredential, type ApiPlugins, type ApiPluginsOf, type AuthCheck, type AuthContextOf, type AuthoredJobs, type AuthoredRouteDefinition, type AuthoredRoutes, type AutoResponsesBrand, type BasicCredential, type BearerCredential, type BrandedHandlerContext, type BuiltinIssueCode, type CachePolicy, type CatalogOf, type CodedIssue, type CompiledJob, type CompiledJobs, type ConfiguredApi, type ContextFromAuth, type ContextOf, type Credential, type CredentialOf, DECLARATION, type DeclarationKind, type DiffSettings, DispatchFailedSchema, type DispatchOptions, type DispatchOutcome, type DispatchResult, DispatchResultSchema, EVENT_STREAM_MEDIA_TYPE, type ExtractPathParams, type FlattenedJob, GUARD, type GeneratedFile, type GrantNamesOf, type GrantsOf, type GuardAnswer, type GuardBody, type GuardFor, type GuardHoldings, type GuardOutput, type GuardReturn, type GuardSchemaOf, type GuardStatus, type GuardSuccess, HANDLER_CONTEXT_BRAND, type HandlerArgs, type HandlerContextBrand, type HandlerReturn, type HasPathParams, type HttpJobsConfig, type Identity, type IdentityBuilder, type IdentityFactories, type IdentityNamesOf, type IdentityParamsOf, type IdentityRole, type IdentityWithGuard, type InProcessJobsConfig, type JobBuilder, type JobDefinition, type JobDescriptor, JobDispatchError, type JobErrorHandler, type JobFn, type JobFnByKey, type JobFnOf, type JobHandler, type JobHandlerArgs, type JobHandlerFor, type JobHandlerReturn, type JobHandlers, JobInputError, type JobMessage, type JobQueueArgs, type JobQueueOptions, type JobResponses, type JobRunArgs, type JobRunner, type JobRunnerOptions, type JobSchedule, type JobTransport, type JobTransportDefinition, type JobTransportSupports, type JobWithHandler, type JobWorker, type JobWorkerContext, type Jobs, type JobsArg, type JobsConfig, type JobsOf, type JobsOfTree, type K, Kizuna, type KizunaConfigInput, type KizunaConfigShape, type KizunaSpec, METHODS, type Method, type ModelOptions, type ModelToolCall, type NoCredential, type NoJobs, type NormalizeTags, type OAuthFlow, type OAuthFlows, type OpenApiSecuritySchemeObject, type ParsedCron, type PathParamName, type PermissionCatalog, type PermissionName, type PermissionSet, type Permissions, type PluginApi, type PluginArgs, type PluginDeclaration, type PluginDefinition, type PluginExportValues, type PluginExportsOf, type PluginFactory, type PluginList, type PluginRoutes, type PluginRoutesOf, type PluginSetup, type PluginSetupContext, type PluginsBySlug, type ProblemDetails, type ProtectedResourceConfig, type ProtectedResourceMetadata, RESOLVER, type RegisteredIssue, type RequestContextBuilder, type RequestContextHeaderInputs, type RequestContextHeaderValues, type RequestContextOf, type RequestContextSchema, type RequestContextWithHandler, type RequiredPermissions, type ResponseContentType, type ResponseDefinition, ResponseError, type RoleDefinition, type RoleNamesOf, type RoleOf, type Roles, type RolesOf, type RouteAuth, type RouteAuthCheck, type RouteAuthRule, type RouteAuthValue, type RouteBuilder, type RouteDefinition, type RouteHandlerFunction, type RoutePath, type RouteToolOptions, type RouteWithHandler, type Routes, type RoutesOf, type RoutesWithHandlerContext, STATUS_TITLES, type ScheduledJob, type SchemeNameOf, type SchemesOf, type SecurityRequirement, type SecurityScheme, type StreamBody, type StreamBodyOf, type StreamChunk, type StreamComment, type StreamContext, type StreamDefinition, type StreamMessage, type StreamMessageOf, type StreamMode, type StreamResponseDefinition, type StreamTools, type StreamWithTools, type StreamYield, type StripProblemEnvelope, type TagKeysOf, type TagNamesOf, type TagOptions, type TagSet, type ThrowableReturn, type ToolAnswer, type ToolAt, type ToolCall, type ToolCallMessage, type ToolCallRecord, type ToolCallState, type ToolDefinition, type ToolError, type ToolEventYield, type ToolEvents, type ToolKeys, type ToolResult, type ToolRunCall, type ToolRunOptions, type ToolRunResult, type ValidationError, type ValidationErrorFor, type ValidationIssueCode, apiEntries, assertCanonicalResourceUri, assertValidSchedule, authorizationServerIssuer, buildPath, buildProtectedResourceMetadata, createJobRunner, cron, declaredScopes, defineConfig, defineJobTransport, definePlugin, dispatchDueJobs, dispatchSucceeded, dueJobs, dueSchedules, expandStreamTools, failedJobs, firesBetween, flattenJobs, getHeaderValue, getStatusText, isCompiledJob, isJobDefinition, isNamedStream, isPermissions, isProblemDetails, isRoles, isRouteDefinition, isSecurityScheme, isStreamResponse, isValidationError, isZodSchema, jobAt, jobFnAt, nextRun, nextRuns, parseCron, parsePath, problemDetails, problemFromBody, readToolCalls, routeStreams, scheduleExpression, scheduleTimezone, soleStreamResponse, streamContentType, streamMode, streamStatuses, toolEvents };
package/dist/index.mjs CHANGED
@@ -1,7 +1,7 @@
1
1
  import { a as definePlugin, c as createRoute, d as AUTO_RESPONSES_BRAND, f as DECLARATION, h as METHODS, l as AUTO_GUARD_BRAND, m as HANDLER_CONTEXT_BRAND, o as pluginRouteTree, p as HANDLER, u as AUTO_GUARD_WRITTEN_BRAND } from "./plugin-CFpv8XTz.mjs";
2
2
  import { T as readObjectShape, m as readDef, n as isProblemDetails, r as createModel, t as ProblemDetailsSchema } from "./error-response-CNQaKVYd.mjs";
3
- import { A as EVENT_STREAM_MEDIA_TYPE, C as nextRun, D as scheduleTimezone, E as scheduleExpression, F as soleStreamResponse, H as isStreamResponse, I as streamContentType, L as streamMode, N as isNamedStream, P as routeStreams, S as firesBetween, T as parseCron, W as isZodSchema, _ as jobClaims, at as buildPath, b as cron, ct as flattenRoutes, f as buildJobs, g as jobAt, h as isJobDefinition, l as assertValidDeprecationDates, m as isCompiledJob, o as resolvePlugins, ot as parsePath, p as flattenJobs, q as resolveResponseBody, r as pluginExportsOf, s as assertValidCache, t as createApiReference, ut as isRouteDefinition, w as nextRuns, x as dueSchedules, y as assertValidSchedule, z as streamStatuses } from "./plugin-server-C0CyVED-.mjs";
4
- import { $ as dispatchSucceeded, G as defineJobTransport, J as jobFnAt, K as JobInputError, L as assertNoPathCollisions, P as warnUnsupportedJobOptions, Q as dispatchDueJobs, R as routeClaims, W as JobDispatchError, X as DispatchFailedSchema, Y as ResponseError, Z as DispatchResultSchema, at as getStatusText, bt as createTags, ct as isPermissions, dt as tagRoutes, et as dueJobs, ft as expandStreamTools, it as STATUS_TITLES, j as routerFromRoutes, lt as isRoles, nt as problemDetails, o as JOBS_META, ot as createPermissions, p as assembleApi, pt as toolEvents, q as createJobRunner, rt as problemFromBody, st as createRoles, tt as failedJobs, ut as permissionNames, x as getHeaderValue } from "./adapter-Bp3CIsRc.mjs";
3
+ import { B as streamStatuses, C as firesBetween, D as scheduleExpression, E as parseCron, F as routeStreams, G as isZodSchema, I as soleStreamResponse, J as resolveResponseBody, L as streamContentType, O as scheduleTimezone, P as isNamedStream, R as streamMode, S as dueSchedules, T as nextRuns, U as isStreamResponse, _ as jobAt, b as assertValidSchedule, dt as isRouteDefinition, f as assertJobRunner, g as isJobDefinition, h as isCompiledJob, j as EVENT_STREAM_MEDIA_TYPE, l as assertValidDeprecationDates, lt as flattenRoutes, m as flattenJobs, o as resolvePlugins, ot as buildPath, p as buildJobs, r as pluginExportsOf, s as assertValidCache, st as parsePath, t as createApiReference, v as jobClaims, w as nextRun, x as cron } from "./plugin-server-C9i5kuJN.mjs";
4
+ import { $ as dispatchSucceeded, G as defineJobTransport, J as jobFnAt, K as JobInputError, L as assertNoPathCollisions, P as warnUnsupportedJobOptions, Q as dispatchDueJobs, R as routeClaims, W as JobDispatchError, X as DispatchFailedSchema, Y as ResponseError, Z as DispatchResultSchema, at as getStatusText, bt as createTags, ct as isPermissions, dt as tagRoutes, et as dueJobs, ft as expandStreamTools, it as STATUS_TITLES, j as routerFromRoutes, lt as isRoles, nt as problemDetails, o as JOBS_META, ot as createPermissions, p as assembleApi, pt as toolEvents, q as createJobRunner, rt as problemFromBody, st as createRoles, tt as failedJobs, ut as permissionNames, x as getHeaderValue } from "./adapter-BcwpTn32.mjs";
5
5
  import { a as assertCanonicalResourceUri, c as isValidationError, d as declaredScopes, f as isSecurityScheme, l as authenticationChallenge, o as buildProtectedResourceMetadata, p as resolveSecurityRequirements, u as authorizationServerIssuer } from "./schemas-_W2cLAVl.mjs";
6
6
  import { z } from "zod";
7
7
  //#region src/coded-issue.ts
@@ -560,6 +560,7 @@ const defineConfig = (options) => {
560
560
  ...routeClaims(pluginRoutes, "Plugin route"),
561
561
  ...jobClaims(jobs, options.jobRunner)
562
562
  ]);
563
+ assertJobRunner(jobs, options.jobRunner);
563
564
  assertValidDeprecationDates(routes);
564
565
  assertValidDeprecationDates(pluginRoutes);
565
566
  for (const { route, routeKey } of flattenRoutes(pluginRoutes)) {
@@ -1,6 +1,6 @@
1
1
  Object.defineProperty(exports, Symbol.toStringTag, { value: "Module" });
2
- const require_plugin_server = require("./plugin-server-DrDIPl6R.cjs");
3
- const require_adapter = require("./adapter-CGKgrfQy.cjs");
2
+ const require_plugin_server = require("./plugin-server-CIC64cSM.cjs");
3
+ const require_adapter = require("./adapter-B75LpzDv.cjs");
4
4
  //#region src/start-jobs.ts
5
5
  /**
6
6
  * The dedupe key an occurrence gets. Every instance ticking the same minute
@@ -151,6 +151,7 @@ const stripTrailingSlash = (url) => url.endsWith("/") ? url.slice(0, -1) : url;
151
151
  const startJobsDevRunner = (contract, options) => {
152
152
  const logger = options.logger ?? console;
153
153
  if (process.env.NODE_ENV === "production") logger.warn("[kizuna/schedule] startJobsDevRunner is running with NODE_ENV=production. It ticks on an interval held in memory, so any tick during a restart or deploy is missed silently. Use your platform scheduler in production.");
154
+ if (contract.jobsConfig?.mode === "in-process") throw new Error("[kizuna/schedule] startJobsDevRunner ticks the dispatch endpoint, which `mode: 'in-process'` does not serve. Run the schedules in this process with `startJobs` instead.");
154
155
  const method = contract.jobsConfig?.method ?? "POST";
155
156
  const path = `${options.basePath ?? ""}${contract.jobsConfig?.path ?? "/jobs"}/dispatch`;
156
157
  const url = `${stripTrailingSlash(options.baseUrl)}${path}`;
@@ -1,4 +1,4 @@
1
- import { hr as JobWorker, wn as ApiDefinition } from "./adapter-Ca2YCENa.cjs";
1
+ import { _r as JobWorker, wn as ApiDefinition } from "./adapter-O2unN9bH.cjs";
2
2
 
3
3
  //#region src/start-jobs.d.ts
4
4
  interface StartJobsOptions {
@@ -1,4 +1,4 @@
1
- import { hr as JobWorker, wn as ApiDefinition } from "./adapter-BiPct09t.mjs";
1
+ import { _r as JobWorker, wn as ApiDefinition } from "./adapter-Do23zdY1.mjs";
2
2
 
3
3
  //#region src/start-jobs.d.ts
4
4
  interface StartJobsOptions {
@@ -1,5 +1,5 @@
1
- import { C as nextRun, D as scheduleTimezone, E as scheduleExpression, p as flattenJobs } from "./plugin-server-C0CyVED-.mjs";
2
- import { D as jobRunnerFrom, J as jobFnAt, h as boundJobKeys, o as JOBS_META } from "./adapter-Bp3CIsRc.mjs";
1
+ import { D as scheduleExpression, O as scheduleTimezone, m as flattenJobs, w as nextRun } from "./plugin-server-C9i5kuJN.mjs";
2
+ import { D as jobRunnerFrom, J as jobFnAt, h as boundJobKeys, o as JOBS_META } from "./adapter-BcwpTn32.mjs";
3
3
  //#region src/start-jobs.ts
4
4
  /**
5
5
  * The dedupe key an occurrence gets. Every instance ticking the same minute
@@ -150,6 +150,7 @@ const stripTrailingSlash = (url) => url.endsWith("/") ? url.slice(0, -1) : url;
150
150
  const startJobsDevRunner = (contract, options) => {
151
151
  const logger = options.logger ?? console;
152
152
  if (process.env.NODE_ENV === "production") logger.warn("[kizuna/schedule] startJobsDevRunner is running with NODE_ENV=production. It ticks on an interval held in memory, so any tick during a restart or deploy is missed silently. Use your platform scheduler in production.");
153
+ if (contract.jobsConfig?.mode === "in-process") throw new Error("[kizuna/schedule] startJobsDevRunner ticks the dispatch endpoint, which `mode: 'in-process'` does not serve. Run the schedules in this process with `startJobs` instead.");
153
154
  const method = contract.jobsConfig?.method ?? "POST";
154
155
  const path = `${options.basePath ?? ""}${contract.jobsConfig?.path ?? "/jobs"}/dispatch`;
155
156
  const url = `${stripTrailingSlash(options.baseUrl)}${path}`;
@@ -927,7 +927,7 @@ const cron = {
927
927
  //#endregion
928
928
  //#region src/jobs.ts
929
929
  /**
930
- * The namespace the job endpoints are mounted under when `jobs.path` says
930
+ * The namespace the job endpoints are mounted under when `jobRunner.path` says
931
931
  * nothing.
932
932
  */
933
933
  const DEFAULT_JOBS_PATH = "/jobs";
@@ -1053,8 +1053,20 @@ const isCompiledJob = (value) => {
1053
1053
  * Throws when either job endpoint lands on a path an API route already serves.
1054
1054
  * Called by `defineConfig`, the one place that sees both.
1055
1055
  */
1056
+ /**
1057
+ * Throw when declared jobs do not say how they run, or when the job endpoints
1058
+ * would be served with no identity guarding them.
1059
+ */
1060
+ const assertJobRunner = (jobs, config) => {
1061
+ const flattened = jobs ? flattenJobs(jobs) : [];
1062
+ if (flattened.length === 0) return;
1063
+ if (config?.mode === void 0) throw new Error("The jobs do not say how they run. Set `jobRunner: { mode: 'http' }` to serve `/jobs/dispatch` and `/jobs/run`, or `jobRunner: { mode: 'in-process' }` when `startJobs` ticks them in this process.");
1064
+ if (config.mode === "in-process" || flattened.some(({ job }) => job.identity !== void 0)) return;
1065
+ const base = config.path ?? "/jobs";
1066
+ throw new Error(`The jobs declare no identity, so \`${base}/dispatch\` and \`${base}/run\` would let anyone trigger them. Pass an identity to \`k.jobs\`, or set \`jobRunner: { mode: 'in-process' }\` when the jobs run in this process with \`startJobs\`.`);
1067
+ };
1056
1068
  const jobClaims = (jobs, config) => {
1057
- if (!jobs || flattenJobs(jobs).length === 0) return [];
1069
+ if (!jobs || config?.mode === "in-process" || flattenJobs(jobs).length === 0) return [];
1058
1070
  const base = config?.path ?? "/jobs";
1059
1071
  return [{
1060
1072
  method: config?.method ?? "POST",
@@ -1293,4 +1305,4 @@ const createApiReference = () => {
1293
1305
  };
1294
1306
  };
1295
1307
  //#endregion
1296
- export { sanitizeFieldName as $, EVENT_STREAM_MEDIA_TYPE as A, isHintPrefix as B, nextRun as C, scheduleTimezone as D, scheduleExpression as E, soleStreamResponse as F, localTypeName as G, isStreamResponse as H, streamContentType as I, resolveResponseCache as J, mergeHeaderFields as K, streamMode as L, encodeStreamBody as M, isNamedStream as N, deriveToolNames as O, routeStreams as P, resolveResponseStream as Q, streamSchemas as R, firesBetween as S, parseCron as T, isSuccessStatus as U, isJsonMediaType as V, isZodSchema as W, resolveResponseEtag as X, resolveResponseContentType as Y, resolveResponseHeaders as Z, jobClaims as _, pluginRoutesOf as a, buildPath as at, cron as b, cacheHeaders as c, flattenRoutes as ct, DEFAULT_JOBS_PATH as d, validateRequest as dt, sanitizeIdentifier as et, buildJobs as f, resolveCoercionPlans as ft, jobAt as g, isJobDefinition as h, pluginRouterOf as i, toPascalCase as it, assertValidStreams as j, toToolName as k, assertValidDeprecationDates as l, formatValidationError as lt, isCompiledJob as m, describeIssue as n, statusToCamelCase as nt, resolvePlugins as o, parsePath as ot, flattenJobs as p, resolveResponseBody as q, pluginExportsOf as r, toCamelCase as rt, assertValidCache as s, allowedMethodsForPath as st, createApiReference as t, shortTypeName as tt, deprecationHeaders as u, isRouteDefinition as ut, toJobResponse as v, nextRuns as w, dueSchedules as x, assertValidSchedule as y, streamStatuses as z };
1308
+ export { resolveResponseStream as $, toToolName as A, streamStatuses as B, firesBetween as C, scheduleExpression as D, parseCron as E, routeStreams as F, isZodSchema as G, isJsonMediaType as H, soleStreamResponse as I, resolveResponseBody as J, localTypeName as K, streamContentType as L, assertValidStreams as M, encodeStreamBody as N, scheduleTimezone as O, isNamedStream as P, resolveResponseHeaders as Q, streamMode as R, dueSchedules as S, nextRuns as T, isStreamResponse as U, isHintPrefix as V, isSuccessStatus as W, resolveResponseContentType as X, resolveResponseCache as Y, resolveResponseEtag as Z, jobAt as _, pluginRoutesOf as a, toPascalCase as at, assertValidSchedule as b, cacheHeaders as c, allowedMethodsForPath as ct, DEFAULT_JOBS_PATH as d, isRouteDefinition as dt, sanitizeFieldName as et, assertJobRunner as f, validateRequest as ft, isJobDefinition as g, isCompiledJob as h, pluginRouterOf as i, toCamelCase as it, EVENT_STREAM_MEDIA_TYPE as j, deriveToolNames as k, assertValidDeprecationDates as l, flattenRoutes as lt, flattenJobs as m, describeIssue as n, shortTypeName as nt, resolvePlugins as o, buildPath as ot, buildJobs as p, resolveCoercionPlans as pt, mergeHeaderFields as q, pluginExportsOf as r, statusToCamelCase as rt, assertValidCache as s, parsePath as st, createApiReference as t, sanitizeIdentifier as tt, deprecationHeaders as u, formatValidationError as ut, jobClaims as v, nextRun as w, cron as x, toJobResponse as y, streamSchemas as z };
@@ -927,7 +927,7 @@ const cron = {
927
927
  //#endregion
928
928
  //#region src/jobs.ts
929
929
  /**
930
- * The namespace the job endpoints are mounted under when `jobs.path` says
930
+ * The namespace the job endpoints are mounted under when `jobRunner.path` says
931
931
  * nothing.
932
932
  */
933
933
  const DEFAULT_JOBS_PATH = "/jobs";
@@ -1053,8 +1053,20 @@ const isCompiledJob = (value) => {
1053
1053
  * Throws when either job endpoint lands on a path an API route already serves.
1054
1054
  * Called by `defineConfig`, the one place that sees both.
1055
1055
  */
1056
+ /**
1057
+ * Throw when declared jobs do not say how they run, or when the job endpoints
1058
+ * would be served with no identity guarding them.
1059
+ */
1060
+ const assertJobRunner = (jobs, config) => {
1061
+ const flattened = jobs ? flattenJobs(jobs) : [];
1062
+ if (flattened.length === 0) return;
1063
+ if (config?.mode === void 0) throw new Error("The jobs do not say how they run. Set `jobRunner: { mode: 'http' }` to serve `/jobs/dispatch` and `/jobs/run`, or `jobRunner: { mode: 'in-process' }` when `startJobs` ticks them in this process.");
1064
+ if (config.mode === "in-process" || flattened.some(({ job }) => job.identity !== void 0)) return;
1065
+ const base = config.path ?? "/jobs";
1066
+ throw new Error(`The jobs declare no identity, so \`${base}/dispatch\` and \`${base}/run\` would let anyone trigger them. Pass an identity to \`k.jobs\`, or set \`jobRunner: { mode: 'in-process' }\` when the jobs run in this process with \`startJobs\`.`);
1067
+ };
1056
1068
  const jobClaims = (jobs, config) => {
1057
- if (!jobs || flattenJobs(jobs).length === 0) return [];
1069
+ if (!jobs || config?.mode === "in-process" || flattenJobs(jobs).length === 0) return [];
1058
1070
  const base = config?.path ?? "/jobs";
1059
1071
  return [{
1060
1072
  method: config?.method ?? "POST",
@@ -1311,6 +1323,12 @@ Object.defineProperty(exports, "allowedMethodsForPath", {
1311
1323
  return allowedMethodsForPath;
1312
1324
  }
1313
1325
  });
1326
+ Object.defineProperty(exports, "assertJobRunner", {
1327
+ enumerable: true,
1328
+ get: function() {
1329
+ return assertJobRunner;
1330
+ }
1331
+ });
1314
1332
  Object.defineProperty(exports, "assertValidCache", {
1315
1333
  enumerable: true,
1316
1334
  get: function() {
package/dist/plugin.d.cts CHANGED
@@ -1,3 +1,3 @@
1
1
  import { Y as RoutePath } from "./error-response-Da3XXloD.cjs";
2
- import { $t as ResolvedPlugin, Bt as PluginArgs, Ft as ApiPlugins, Gt as PluginFactory, Ht as PluginDefinition, It as InstallOptions, Jt as PluginRoutes, Kt as PluginList, Lt as PLUGIN_ROUTES_META_KEY, Pt as AnyPlugin, Qt as PluginsBySlug, Rt as PLUGIN_SERVERS_META_KEY, Ut as PluginExportValues, Vt as PluginDeclaration, Wt as PluginExportsOf, Xt as PluginSetup, Yt as PluginRoutesOf, Zt as PluginSetupContext, an as route, en as RouteAuthSchema, in as pluginRouteTree, nn as SlugOption, on as ApiContext, qt as PluginRouteBuilder, rn as definePlugin, tn as RoutePathSchema, zt as PluginApi } from "./adapter-Ca2YCENa.cjs";
2
+ import { $t as ResolvedPlugin, Bt as PluginArgs, Ft as ApiPlugins, Gt as PluginFactory, Ht as PluginDefinition, It as InstallOptions, Jt as PluginRoutes, Kt as PluginList, Lt as PLUGIN_ROUTES_META_KEY, Pt as AnyPlugin, Qt as PluginsBySlug, Rt as PLUGIN_SERVERS_META_KEY, Ut as PluginExportValues, Vt as PluginDeclaration, Wt as PluginExportsOf, Xt as PluginSetup, Yt as PluginRoutesOf, Zt as PluginSetupContext, an as route, en as RouteAuthSchema, in as pluginRouteTree, nn as SlugOption, on as ApiContext, qt as PluginRouteBuilder, rn as definePlugin, tn as RoutePathSchema, zt as PluginApi } from "./adapter-O2unN9bH.cjs";
3
3
  export { AnyPlugin, ApiContext, ApiPlugins, InstallOptions, PLUGIN_ROUTES_META_KEY, PLUGIN_SERVERS_META_KEY, PluginApi, PluginArgs, PluginDeclaration, PluginDefinition, PluginExportValues, PluginExportsOf, PluginFactory, PluginList, PluginRouteBuilder, PluginRoutes, PluginRoutesOf, PluginSetup, PluginSetupContext, PluginsBySlug, ResolvedPlugin, RouteAuthSchema, RoutePath, RoutePathSchema, SlugOption, definePlugin, pluginRouteTree, route };
package/dist/plugin.d.mts CHANGED
@@ -1,3 +1,3 @@
1
1
  import { Y as RoutePath } from "./error-response-D2bAIpNd.mjs";
2
- import { $t as ResolvedPlugin, Bt as PluginArgs, Ft as ApiPlugins, Gt as PluginFactory, Ht as PluginDefinition, It as InstallOptions, Jt as PluginRoutes, Kt as PluginList, Lt as PLUGIN_ROUTES_META_KEY, Pt as AnyPlugin, Qt as PluginsBySlug, Rt as PLUGIN_SERVERS_META_KEY, Ut as PluginExportValues, Vt as PluginDeclaration, Wt as PluginExportsOf, Xt as PluginSetup, Yt as PluginRoutesOf, Zt as PluginSetupContext, an as route, en as RouteAuthSchema, in as pluginRouteTree, nn as SlugOption, on as ApiContext, qt as PluginRouteBuilder, rn as definePlugin, tn as RoutePathSchema, zt as PluginApi } from "./adapter-BiPct09t.mjs";
2
+ import { $t as ResolvedPlugin, Bt as PluginArgs, Ft as ApiPlugins, Gt as PluginFactory, Ht as PluginDefinition, It as InstallOptions, Jt as PluginRoutes, Kt as PluginList, Lt as PLUGIN_ROUTES_META_KEY, Pt as AnyPlugin, Qt as PluginsBySlug, Rt as PLUGIN_SERVERS_META_KEY, Ut as PluginExportValues, Vt as PluginDeclaration, Wt as PluginExportsOf, Xt as PluginSetup, Yt as PluginRoutesOf, Zt as PluginSetupContext, an as route, en as RouteAuthSchema, in as pluginRouteTree, nn as SlugOption, on as ApiContext, qt as PluginRouteBuilder, rn as definePlugin, tn as RoutePathSchema, zt as PluginApi } from "./adapter-Do23zdY1.mjs";
3
3
  export { AnyPlugin, ApiContext, ApiPlugins, InstallOptions, PLUGIN_ROUTES_META_KEY, PLUGIN_SERVERS_META_KEY, PluginApi, PluginArgs, PluginDeclaration, PluginDefinition, PluginExportValues, PluginExportsOf, PluginFactory, PluginList, PluginRouteBuilder, PluginRoutes, PluginRoutesOf, PluginSetup, PluginSetupContext, PluginsBySlug, ResolvedPlugin, RouteAuthSchema, RoutePath, RoutePathSchema, SlugOption, definePlugin, pluginRouteTree, route };
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "kizunajs",
3
- "version": "2.0.0-beta.14",
3
+ "version": "2.0.0-beta.15",
4
4
  "description": "Route declaration, validation, and the adapter API for Kizuna.js",
5
5
  "keywords": [
6
6
  "kizunajs",
package/src/adapter.ts CHANGED
@@ -354,12 +354,15 @@ export const assembleApi = <const R extends Routes>(
354
354
 
355
355
  /**
356
356
  * The endpoints jobs are served on, in the {@link Routes} shape the request
357
- * pipeline takes.
357
+ * pipeline takes. None when the jobs run in process.
358
358
  */
359
- export const jobRoutes = (meta: JobsMeta): Routes => ({
360
- [DISPATCH_ROUTE_KEY]: dispatchRoute(meta),
361
- [RUN_ROUTE_KEY]: runRoute(meta),
362
- });
359
+ export const jobRoutes = (meta: JobsMeta): Routes =>
360
+ meta.config?.mode === 'in-process'
361
+ ? {}
362
+ : {
363
+ [DISPATCH_ROUTE_KEY]: dispatchRoute(meta),
364
+ [RUN_ROUTE_KEY]: runRoute(meta),
365
+ };
363
366
 
364
367
  /**
365
368
  * Their handlers, in the {@link Router} shape the request pipeline takes.
@@ -42,7 +42,7 @@ export interface ApiDefinition<
42
42
  */
43
43
  jobs?: Jobs_;
44
44
  /**
45
- * The job settings named in `defineConfig` under `jobsConfig`.
45
+ * The job settings named in `defineConfig` under `jobRunner`.
46
46
  */
47
47
  jobsConfig?: JobsConfig;
48
48
  /**
@@ -7,7 +7,7 @@ import { assertValidDeprecationDates } from './deprecation.js';
7
7
  import { assertValidCache } from './cache.js';
8
8
  import { injectGuardResponses } from './guard-responses.js';
9
9
  import { flattenRoutes, type RoutesWithHandlerContext } from './handler-pipeline.js';
10
- import { jobClaims, type Jobs, type JobsArg, type JobRunnerConfig } from './jobs.js';
10
+ import { assertJobRunner, jobClaims, type Jobs, type JobsArg, type JobRunnerConfig } from './jobs.js';
11
11
  import type { TagOptions, TagSet } from './tags.js';
12
12
  import { problemDetails, type GuardBody, type GuardOutput, type GuardSchemaCheck } from './problem-details.js';
13
13
  import { readObjectShape } from './zod-internals.js';
@@ -222,13 +222,6 @@ export type KizunaConfigInput<
222
222
  */
223
223
  issueCodes?: readonly Codes[];
224
224
  };
225
- /**
226
- * How this deployment runs the jobs it declares: where the two endpoints
227
- * sit, what carries queued work out of the process, and where a failure is
228
- * reported. The jobs themselves are declared with `k.jobs` and go under
229
- * `jobs`.
230
- */
231
- jobRunner?: JobRunnerConfig;
232
225
  /**
233
226
  * What `kizuna generate` writes the `Config` to.
234
227
  *
@@ -261,7 +254,24 @@ export type KizunaConfigInput<
261
254
  * }
262
255
  */
263
256
  diff?: DiffSettings;
264
- };
257
+ } & JobRunnerInput<J>;
258
+
259
+ /**
260
+ * `jobRunner`, required once `jobs` declares one.
261
+ */
262
+ type JobRunnerInput<J extends Jobs> = string extends keyof J
263
+ ? {
264
+ jobRunner?: JobRunnerConfig;
265
+ }
266
+ : {
267
+ /**
268
+ * How this deployment runs the jobs it declares: over HTTP or in
269
+ * process, what carries queued work out of the process, and where a
270
+ * failure is reported. The jobs themselves are declared with
271
+ * `k.jobs` and go under `jobs`.
272
+ */
273
+ jobRunner: JobRunnerConfig;
274
+ };
265
275
 
266
276
  /**
267
277
  * The api `defineConfig` assembles: the routes it declares, and the `mount`
@@ -345,6 +355,7 @@ export const defineConfig = <
345
355
  const pluginRoutes = pluginRouteTree(plugins);
346
356
 
347
357
  assertNoPathCollisions([...routeClaims(routes), ...routeClaims(pluginRoutes, 'Plugin route'), ...jobClaims(jobs, options.jobRunner)]);
358
+ assertJobRunner(jobs, options.jobRunner);
348
359
  assertValidDeprecationDates(routes);
349
360
  assertValidDeprecationDates(pluginRoutes);
350
361
 
package/src/index.ts CHANGED
@@ -95,6 +95,8 @@ export {
95
95
  type JobHandlerReturn,
96
96
  type JobsArg,
97
97
  type JobsConfig,
98
+ type HttpJobsConfig,
99
+ type InProcessJobsConfig,
98
100
  type CompiledJobs,
99
101
  type FlattenedJob,
100
102
  type NoJobs,
@@ -70,6 +70,12 @@ export const startJobsDevRunner = (contract: ApiDefinition, options: JobsDevRunn
70
70
  );
71
71
  }
72
72
 
73
+ if (contract.jobsConfig?.mode === 'in-process') {
74
+ throw new Error(
75
+ "[kizuna/schedule] startJobsDevRunner ticks the dispatch endpoint, which `mode: 'in-process'` does not serve. " +
76
+ 'Run the schedules in this process with `startJobs` instead.'
77
+ );
78
+ }
73
79
  const method = contract.jobsConfig?.method ?? 'POST';
74
80
  const path = `${options.basePath ?? ''}${contract.jobsConfig?.path ?? DEFAULT_JOBS_PATH}/dispatch`;
75
81
  const url = `${stripTrailingSlash(options.baseUrl)}${path}`;
package/src/jobs.ts CHANGED
@@ -8,16 +8,28 @@ import type { JobTransport } from './job-transport.js';
8
8
  import type { PathClaim } from './path-claims.js';
9
9
 
10
10
  /**
11
- * The namespace the job endpoints are mounted under when `jobs.path` says
11
+ * The namespace the job endpoints are mounted under when `jobRunner.path` says
12
12
  * nothing.
13
13
  */
14
14
  export const DEFAULT_JOBS_PATH = '/jobs';
15
15
 
16
16
  /**
17
- * Settings shared by every job, named in `defineConfig` under `jobsConfig`. The jobs
17
+ * Settings shared by every job, named in `defineConfig` under `jobRunner`. The jobs
18
18
  * themselves are declared with `k.jobs`.
19
19
  */
20
- export interface JobsConfig {
20
+ export type JobsConfig = HttpJobsConfig | InProcessJobsConfig;
21
+
22
+ /**
23
+ * Jobs triggered over HTTP, by platform cron ticking `/jobs/dispatch` or a
24
+ * transport delivering to `/jobs/run`.
25
+ */
26
+ export interface HttpJobsConfig {
27
+ /**
28
+ * `'http'` serves `/jobs/dispatch` and `/jobs/run`, guarded by the jobs'
29
+ * identity. `'in-process'` is for a long-running server whose schedules
30
+ * `startJobs` ticks, and serves neither.
31
+ */
32
+ mode: 'http';
21
33
  /**
22
34
  * The namespace both job endpoints are mounted under, `dispatch` and `run`
23
35
  * beneath it. Nothing is served on the namespace itself.
@@ -49,11 +61,30 @@ export interface JobsConfig {
49
61
  }
50
62
 
51
63
  /**
52
- * How a deployment runs the jobs it declares: where the two endpoints sit, what
64
+ * Jobs a long-running server runs itself, its schedules ticked by `startJobs`.
65
+ * No job endpoint is served, so the jobs need no identity.
66
+ */
67
+ export interface InProcessJobsConfig {
68
+ mode: 'in-process';
69
+ path?: never;
70
+ method?: never;
71
+ windowMs?: never;
72
+ only?: never;
73
+ exclude?: never;
74
+ }
75
+
76
+ /**
77
+ * How a deployment runs the jobs it declares: how they are triggered, what
53
78
  * carries queued work out of the process, and where a failure that happened
54
79
  * after the response went out is reported.
55
80
  */
56
- export interface JobRunnerConfig extends JobsConfig {
81
+ export type JobRunnerConfig = JobsConfig & JobDeliveryConfig;
82
+
83
+ /**
84
+ * Where queued work goes and where a late failure is reported, whichever way
85
+ * the jobs are triggered.
86
+ */
87
+ export interface JobDeliveryConfig {
57
88
  /**
58
89
  * Carries a queued job to whatever runs it. Without one, `queue` runs the
59
90
  * job in this process and it is lost on a crash.
@@ -403,8 +434,29 @@ export const isCompiledJob = (value: unknown): value is CompiledJob => {
403
434
  * Throws when either job endpoint lands on a path an API route already serves.
404
435
  * Called by `defineConfig`, the one place that sees both.
405
436
  */
437
+ /**
438
+ * Throw when declared jobs do not say how they run, or when the job endpoints
439
+ * would be served with no identity guarding them.
440
+ */
441
+ export const assertJobRunner = (jobs: Jobs | undefined, config: JobsConfig | undefined): void => {
442
+ const flattened = jobs ? flattenJobs(jobs) : [];
443
+ if (flattened.length === 0) return;
444
+ if (config?.mode === undefined) {
445
+ throw new Error(
446
+ "The jobs do not say how they run. Set `jobRunner: { mode: 'http' }` to serve `/jobs/dispatch` and `/jobs/run`, " +
447
+ "or `jobRunner: { mode: 'in-process' }` when `startJobs` ticks them in this process."
448
+ );
449
+ }
450
+ if (config.mode === 'in-process' || flattened.some(({ job }) => job.identity !== undefined)) return;
451
+ const base = config.path ?? DEFAULT_JOBS_PATH;
452
+ throw new Error(
453
+ `The jobs declare no identity, so \`${base}/dispatch\` and \`${base}/run\` would let anyone trigger them. ` +
454
+ "Pass an identity to `k.jobs`, or set `jobRunner: { mode: 'in-process' }` when the jobs run in this process with `startJobs`."
455
+ );
456
+ };
457
+
406
458
  export const jobClaims = (jobs: Jobs | undefined, config: JobsConfig | undefined): PathClaim[] => {
407
- if (!jobs || flattenJobs(jobs).length === 0) return [];
459
+ if (!jobs || config?.mode === 'in-process' || flattenJobs(jobs).length === 0) return [];
408
460
  const base = config?.path ?? DEFAULT_JOBS_PATH;
409
461
  return [
410
462
  {