@relkit/runtime-hono 0.7.10 → 0.8.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/agent-control-admission.d.ts +1 -1
- package/dist/agent-control-admission.d.ts.map +1 -1
- package/dist/agent-control-application.d.ts +1 -1
- package/dist/agent-control-worker.d.ts +1 -1
- package/dist/agent-follow-up.d.ts +2 -2
- package/dist/agent-journal.d.ts +5 -5
- package/dist/agent-reads.d.ts +5 -5
- package/dist/agent-reads.d.ts.map +1 -1
- package/dist/agent-rpc-read.d.ts +5 -5
- package/dist/agent-rpc-read.d.ts.map +1 -1
- package/dist/agent-rpc-resume-admission.d.ts +2 -2
- package/dist/agent-rpc-resume-admission.d.ts.map +1 -1
- package/dist/agent-rpc-resume-admission.js +1 -1
- package/dist/agent-rpc-resume-admission.js.map +1 -1
- package/dist/agent-rpc-resume.d.ts +1 -1
- package/dist/agent-rpc-resume.d.ts.map +1 -1
- package/dist/agent-rpc-support.d.ts +2 -2
- package/dist/agent-rpc-worker.d.ts +1 -1
- package/dist/agent-rpc-write.d.ts +2 -2
- package/dist/agent-rpc-write.d.ts.map +1 -1
- package/dist/agent-run-admission.d.ts +1 -1
- package/dist/agent-run-admission.d.ts.map +1 -1
- package/dist/api-docs.d.ts +1 -1
- package/dist/api-docs.d.ts.map +1 -1
- package/dist/api-docs.js +12 -8
- package/dist/api-docs.js.map +1 -1
- package/dist/api-docs.types.d.ts +18 -0
- package/dist/api-docs.types.d.ts.map +1 -1
- package/dist/core-endpoints.d.ts +9 -0
- package/dist/core-endpoints.d.ts.map +1 -0
- package/dist/core-endpoints.js +33 -0
- package/dist/core-endpoints.js.map +1 -0
- package/dist/create-app.d.ts +2 -2
- package/dist/create-app.d.ts.map +1 -1
- package/dist/create-app.js +24 -3
- package/dist/create-app.js.map +1 -1
- package/dist/create-app.types.d.ts +10 -1
- package/dist/create-app.types.d.ts.map +1 -1
- package/dist/create-inspection-app.d.ts +7 -0
- package/dist/create-inspection-app.d.ts.map +1 -0
- package/dist/create-inspection-app.js +22 -0
- package/dist/create-inspection-app.js.map +1 -0
- package/dist/create-rest-app.d.ts.map +1 -1
- package/dist/create-rest-app.js +8 -1
- package/dist/create-rest-app.js.map +1 -1
- package/dist/index.d.ts +5 -2
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +5 -2
- package/dist/index.js.map +1 -1
- package/dist/internal-endpoints-utils.d.ts +1 -0
- package/dist/internal-endpoints-utils.d.ts.map +1 -1
- package/dist/internal-endpoints-utils.js +2 -1
- package/dist/internal-endpoints-utils.js.map +1 -1
- package/dist/internal-endpoints.types.d.ts +6 -1
- package/dist/internal-endpoints.types.d.ts.map +1 -1
- package/dist/materialize-routes.d.ts +2 -2
- package/dist/materialize-routes.d.ts.map +1 -1
- package/dist/materialize-routes.js +1 -3
- package/dist/materialize-routes.js.map +1 -1
- package/dist/materialize-routes.types.d.ts +2 -1
- package/dist/materialize-routes.types.d.ts.map +1 -1
- package/dist/mcp.d.ts +1 -1
- package/dist/mcp.d.ts.map +1 -1
- package/dist/mcp.js +5 -0
- package/dist/mcp.js.map +1 -1
- package/dist/optional-transports.types.d.ts +21 -0
- package/dist/optional-transports.types.d.ts.map +1 -0
- package/dist/optional-transports.types.js +2 -0
- package/dist/optional-transports.types.js.map +1 -0
- package/dist/prepared-app.d.ts +2 -1
- package/dist/prepared-app.d.ts.map +1 -1
- package/dist/prepared-app.js +19 -9
- package/dist/prepared-app.js.map +1 -1
- package/dist/prepared-transports.service.d.ts +3 -2
- package/dist/prepared-transports.service.d.ts.map +1 -1
- package/dist/prepared-transports.service.js +35 -13
- package/dist/prepared-transports.service.js.map +1 -1
- package/dist/prepared-transports.types.d.ts +10 -3
- package/dist/prepared-transports.types.d.ts.map +1 -1
- package/dist/request-mapping-body.d.ts.map +1 -1
- package/dist/request-mapping-body.js +2 -6
- package/dist/request-mapping-body.js.map +1 -1
- package/dist/request-multipart.d.ts +3 -0
- package/dist/request-multipart.d.ts.map +1 -0
- package/dist/request-multipart.js +38 -0
- package/dist/request-multipart.js.map +1 -0
- package/dist/scalar.d.ts +16 -0
- package/dist/scalar.d.ts.map +1 -0
- package/dist/scalar.js +22 -0
- package/dist/scalar.js.map +1 -0
- package/dist/selected-transports.d.ts +16 -0
- package/dist/selected-transports.d.ts.map +1 -0
- package/dist/selected-transports.js +41 -0
- package/dist/selected-transports.js.map +1 -0
- package/dist/selected-transports.service.d.ts +22 -0
- package/dist/selected-transports.service.d.ts.map +1 -0
- package/dist/selected-transports.service.js +73 -0
- package/dist/selected-transports.service.js.map +1 -0
- package/package.json +54 -18
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"prepared-transports.service.d.ts","sourceRoot":"","sources":["../src/prepared-transports.service.ts"],"names":[],"mappings":"AAAA;;;;;GAKG;AACH,OAAO,EAAE,OAAO,EAAE,MAAM,EAAS,KAAK,EAAE,KAAK,EAAE,MAAM,QAAQ,CAAC;AAC9D,OAAO,KAAK,EAAE,gBAAgB,EAAE,MAAM,uBAAuB,CAAC;
|
|
1
|
+
{"version":3,"file":"prepared-transports.service.d.ts","sourceRoot":"","sources":["../src/prepared-transports.service.ts"],"names":[],"mappings":"AAAA;;;;;GAKG;AACH,OAAO,EAAE,OAAO,EAAE,MAAM,EAAS,KAAK,EAAE,KAAK,EAAE,MAAM,QAAQ,CAAC;AAC9D,OAAO,KAAK,EAAE,gBAAgB,EAAE,MAAM,uBAAuB,CAAC;AAI9D,OAAO,EACL,sBAAsB,EAEvB,MAAM,kCAAkC,CAAC;AAC1C,OAAO,KAAK,EACV,sBAAsB,EACtB,iCAAiC,EACjC,2BAA2B,EAC5B,MAAM,gCAAgC,CAAC;;AA6BxC,kFAAkF;AAClF,qBAAa,uBAAwB,SAAQ,4BAGH;IACxC;;OAEG;IACH,MAAM,CAAC,QAAQ,CAAC,IAAI,kFASjB;CACJ;AAED,wEAAwE;AACxE,eAAO,MAAM,2BAA2B,oDAGS,CAAC;;AAElD,oFAAoF;AACpF,qBAAa,kBAAmB,SAAQ,uBAGH;IACnC;;;OAGG;IACH,MAAM,CAAC,QAAQ,CAAC,IAAI,GAAI,SAAS,gBAAgB,EAAE,aAAa,sBAAsB,iSA6BjF;CACN"}
|
|
@@ -5,22 +5,40 @@
|
|
|
5
5
|
* retirement therefore joins it before releasing the generation's files.
|
|
6
6
|
*/
|
|
7
7
|
import { Context, Effect, Fiber, Layer, Scope } from "effect";
|
|
8
|
-
import {
|
|
8
|
+
import { createApp } from "./create-app.js";
|
|
9
|
+
import { createInspectionApp } from "./create-inspection-app.js";
|
|
9
10
|
import { httpBoundary, observeHttp } from "./http-effect.js";
|
|
11
|
+
import { SelectedHttpTransports, SelectedHttpTransportsLive, } from "./selected-transports.service.js";
|
|
12
|
+
/** Registers joined disposal for resources installed by the legacy initializer.
|
|
13
|
+
* @param app - Newly created router that has not served requests.
|
|
14
|
+
* @param initialize - Optional generation-owned endpoint acquisition.
|
|
15
|
+
* @param scope - Generation scope whose closure joins imports and endpoint owners.
|
|
16
|
+
* @returns Lazy initialization; finalization rejection remains visible as a defect.
|
|
17
|
+
*/
|
|
18
|
+
function initializeGeneration(app, initialize, scope) {
|
|
19
|
+
if (initialize === undefined)
|
|
20
|
+
return Effect.void;
|
|
21
|
+
return httpBoundary("prepared.endpoints.initialize", () => initialize(app)).pipe(Effect.flatMap((dispose) => dispose === undefined
|
|
22
|
+
? Effect.void
|
|
23
|
+
: Scope.addFinalizer(scope, observeHttp("prepared.endpoints.dispose", httpBoundary("prepared.endpoints.dispose", dispose)).pipe(Effect.orDie))));
|
|
24
|
+
}
|
|
10
25
|
/** Substitutable physical initialization used by live imports and test Layers. */
|
|
11
26
|
export class PreparedTransportLoader extends Context.Service()("relkit/http/PreparedTransportLoader") {
|
|
12
27
|
/** Constructs the native import adapter without loading optional transports.
|
|
13
28
|
* @returns Lazy adapter acquisition; load failures retain their native cause.
|
|
14
29
|
*/
|
|
15
|
-
static make = Effect.
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
30
|
+
static make = Effect.gen(function* () {
|
|
31
|
+
const selected = yield* SelectedHttpTransports;
|
|
32
|
+
return PreparedTransportLoader.of({
|
|
33
|
+
prepare: selected.prepare,
|
|
34
|
+
load: (options) => httpBoundary("prepared.transports.import", async () => {
|
|
35
|
+
return createInspectionApp(options);
|
|
36
|
+
}),
|
|
37
|
+
});
|
|
38
|
+
});
|
|
21
39
|
}
|
|
22
40
|
/** Named adapter Layer leaves the transport implementation unloaded. */
|
|
23
|
-
export const PreparedTransportLoaderLive = Layer.effect(PreparedTransportLoader, PreparedTransportLoader.make);
|
|
41
|
+
export const PreparedTransportLoaderLive = Layer.effect(PreparedTransportLoader, PreparedTransportLoader.make).pipe(Layer.provide(SelectedHttpTransportsLive));
|
|
24
42
|
/** Generation-owned REST application and single-flight deferred transport state. */
|
|
25
43
|
export class PreparedTransports extends Context.Service()("relkit/http/PreparedTransports") {
|
|
26
44
|
/** Acquires one generation's shared REST policy and deferred loader.
|
|
@@ -30,14 +48,18 @@ export class PreparedTransports extends Context.Service()("relkit/http/PreparedT
|
|
|
30
48
|
static make = (options, initialize) => Effect.gen(function* () {
|
|
31
49
|
const loader = yield* PreparedTransportLoader;
|
|
32
50
|
const scope = yield* Scope.Scope;
|
|
33
|
-
const
|
|
51
|
+
const configured = loader.prepare === undefined
|
|
52
|
+
? options
|
|
53
|
+
: yield* loader.prepare(options).pipe(Effect.uninterruptible);
|
|
54
|
+
const app = createApp(configured);
|
|
55
|
+
const generationContext = yield* Effect.context();
|
|
34
56
|
// Cache the fiber, not a request-owned join. A cancelled first request must
|
|
35
57
|
// never abandon an uncancellable import and start a duplicate evaluation.
|
|
36
58
|
const start = yield* Effect.cached(Effect.forkIn(observeHttp("prepared.transports.initialize", loader
|
|
37
|
-
.load(
|
|
38
|
-
.pipe(Effect.tap((loaded) => initialize
|
|
39
|
-
|
|
40
|
-
|
|
59
|
+
.load(configured)
|
|
60
|
+
.pipe(Effect.tap((loaded) => initializeGeneration(loaded, initialize, scope)))
|
|
61
|
+
// Replacing, rather than merging, excludes the first waiter's request services.
|
|
62
|
+
.pipe(Effect.setContext(generationContext))).pipe(Effect.uninterruptible), scope));
|
|
41
63
|
const load = Effect.fn("PreparedTransports.load")(() => observeHttp("prepared.transports.load", start.pipe(Effect.flatMap(Fiber.join))));
|
|
42
64
|
return PreparedTransports.of({ app, load });
|
|
43
65
|
});
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"prepared-transports.service.js","sourceRoot":"","sources":["../src/prepared-transports.service.ts"],"names":[],"mappings":"AAAA;;;;;GAKG;AACH,OAAO,EAAE,OAAO,EAAE,MAAM,EAAE,KAAK,EAAE,KAAK,EAAE,KAAK,EAAE,MAAM,QAAQ,CAAC;AAE9D,OAAO,EAAE,
|
|
1
|
+
{"version":3,"file":"prepared-transports.service.js","sourceRoot":"","sources":["../src/prepared-transports.service.ts"],"names":[],"mappings":"AAAA;;;;;GAKG;AACH,OAAO,EAAE,OAAO,EAAE,MAAM,EAAE,KAAK,EAAE,KAAK,EAAE,KAAK,EAAE,MAAM,QAAQ,CAAC;AAE9D,OAAO,EAAE,SAAS,EAAE,MAAM,iBAAiB,CAAC;AAC5C,OAAO,EAAE,mBAAmB,EAAE,MAAM,4BAA4B,CAAC;AACjE,OAAO,EAAE,YAAY,EAAE,WAAW,EAAE,MAAM,kBAAkB,CAAC;AAC7D,OAAO,EACL,sBAAsB,EACtB,0BAA0B,GAC3B,MAAM,kCAAkC,CAAC;AAO1C;;;;;GAKG;AACH,SAAS,oBAAoB,CAC3B,GAAwB,EACxB,UAA8C,EAC9C,KAAkB;IAElB,IAAI,UAAU,KAAK,SAAS;QAAE,OAAO,MAAM,CAAC,IAAI,CAAC;IACjD,OAAO,YAAY,CAAC,+BAA+B,EAAE,GAAG,EAAE,CAAC,UAAU,CAAC,GAAG,CAAC,CAAC,CAAC,IAAI,CAC9E,MAAM,CAAC,OAAO,CAAC,CAAC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} from "hono/bun";
|
|
|
9
9
|
import type { Server } from "bun";
|
|
10
10
|
import type { CreateAppOptions } from "./create-app.types.js";
|
|
11
11
|
import type { HttpBoundaryError } from "./http-effect.js";
|
|
12
|
+
import type { SelectedHttpTransports } from "./selected-transports.service.js";
|
|
12
13
|
/**
|
|
13
14
|
* Installs optional generation endpoints before the deferred app handles requests.
|
|
14
|
-
* @param app -
|
|
15
|
-
* @returns
|
|
15
|
+
* @param app - Unused inspection router owned by the same generation as the core app.
|
|
16
|
+
* @returns Initialization settlement and an optional disposer joined at retirement.
|
|
16
17
|
*/
|
|
17
|
-
export type PreparedAppInitializer = (app: Hono) => Promise<void>;
|
|
18
|
+
export type PreparedAppInitializer = (app: Hono) => Promise<void | PreparedAppDisposer>;
|
|
19
|
+
/** Physically releases resources installed by the generation initializer. */
|
|
20
|
+
export type PreparedAppDisposer = () => Promise<void>;
|
|
18
21
|
/** Injectable physical transport initialization; it never captures a request. */
|
|
19
22
|
export interface PreparedTransportLoaderOperations {
|
|
23
|
+
readonly prepare?: ContextServicePrepare;
|
|
20
24
|
readonly load: (options: CreateAppOptions) => Effect.Effect<Hono, HttpBoundaryError>;
|
|
21
25
|
}
|
|
26
|
+
/** Native preparation contract inferred from its owning implementation. */
|
|
27
|
+
type ContextServicePrepare = typeof SelectedHttpTransports.Service.prepare;
|
|
22
28
|
/** A generation owns one eager REST application and one deferred rich initialization. */
|
|
23
29
|
export interface PreparedTransportOperations {
|
|
24
30
|
readonly app: Hono;
|
|
@@ -30,4 +36,5 @@ export interface PreparedHttpApplication {
|
|
|
30
36
|
readonly fetch: (request: Request, server?: Server<BunWebSocketData>) => Response | Promise<Response>;
|
|
31
37
|
readonly close: () => Promise<void>;
|
|
32
38
|
}
|
|
39
|
+
export {};
|
|
33
40
|
//# sourceMappingURL=prepared-transports.types.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"prepared-transports.types.d.ts","sourceRoot":"","sources":["../src/prepared-transports.types.ts"],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AK,MAAM,CAAC,MAAM,CAAC,IAAI,EAAE,iBAAiB,CAAC,CAAC;CACtF;AAED,2EAA2E;AAC3E,KAAK,qBAAqB,GAAG,OAAO,sBAAsB,CAAC,OAAO,CAAC,OAAO,CAAC;AAE3E,yFAAyF;AACzF,MAAM,WAAW,2BAA2B;IAC1C,QAAQ,CAAC,GAAG,EAAE,IAAI,CAAC;IACnB,QAAQ,CAAC,IAAI,EAAE,MAAM,MAAM,CAAC,MAAM,CAAC,IAAI,EAAE,iBAAiB,CAAC,CAAC;CAC7D;AAED,mFAAmF;AACnF,MAAM,WAAW,uBAAuB;IACtC,QAAQ,CAAC,GAAG,EAAE,IAAI,CAAC;IACnB,QAAQ,CAAC,KAAK,EAAE,CACd,OAAO,EAAE,OAAO,EAChB,MAAM,CAAC,EAAE,MAAM,CAAC,gBAAgB,CAAC,KAC9B,QAAQ,GAAG,OAAO,CAAC,QAAQ,CAAC,CAAC;IAClC,QAAQ,CAAC,KAAK,EAAE,MAAM,OAAO,CAAC,IAAI,CAAC,CAAC;CACrC"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"request-mapping-body.d.ts","sourceRoot":"","sources":["../src/request-mapping-body.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"request-mapping-body.d.ts","sourceRoot":"","sources":["../src/request-mapping-body.ts"],"names":[],"mappings":"AAIA,OAAO,KAAK,EAEV,SAAS,EACT,SAAS,EACT,YAAY,EACb,MAAM,iCAAiC,CAAC;AACzC,YAAY,EACV,SAAS,EACT,aAAa,EACb,SAAS,EACT,SAAS,EACT,YAAY,EACZ,OAAO,GACR,MAAM,iCAAiC,CAAC;AAEzC,eAAO,MAAM,OAAO,eAAmC,CAAC;AAExD;;;GAGG;AACH,wBAAsB,SAAS,CAAC,KAAK,EAAE,SAAS,GAAG,OAAO,CAAC,SAAS,CAAC,OAAO,CAAC,CAAC,CAG7E;AAED;;;GAGG;AACH,wBAAsB,SAAS,CAAC,KAAK,EAAE,SAAS,GAAG,OAAO,CAAC,SAAS,CAAC,YAAY,CAAC,CAAC,CAGlF"}
|
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
import { Effect } from "effect";
|
|
2
2
|
import { runHttp } from "./http-effect.js";
|
|
3
3
|
import { RequestBodyReader, RequestBodyReaderLive } from "./request-body-service.js";
|
|
4
|
+
import { parseMultipart } from "./request-multipart.js";
|
|
4
5
|
export const MISSING = Symbol("relkit.mapping.missing");
|
|
5
6
|
/** Shares the request body's first JSON parse among all mapping fields.
|
|
6
7
|
* @param state - State owned by the current request or operation.
|
|
@@ -62,12 +63,7 @@ async function parseFormBody(state) {
|
|
|
62
63
|
issue: { code: "content-type", message: "Request content type must be multipart/form-data" },
|
|
63
64
|
};
|
|
64
65
|
try {
|
|
65
|
-
|
|
66
|
-
method: "POST",
|
|
67
|
-
headers: state.request.headers,
|
|
68
|
-
body: new Uint8Array(body.bytes),
|
|
69
|
-
});
|
|
70
|
-
return { value: await request.formData() };
|
|
66
|
+
return { value: parseMultipart(state.request.headers, body.bytes) };
|
|
71
67
|
}
|
|
72
68
|
catch {
|
|
73
69
|
return {
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"request-mapping-body.js","sourceRoot":"","sources":["../src/request-mapping-body.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,MAAM,EAAE,MAAM,QAAQ,CAAC;AAChC,OAAO,EAAE,OAAO,EAAE,MAAM,kBAAkB,CAAC;AAC3C,OAAO,EAAE,iBAAiB,EAAE,qBAAqB,EAAE,MAAM,2BAA2B,CAAC;
|
|
1
|
+
{"version":3,"file":"request-mapping-body.js","sourceRoot":"","sources":["../src/request-mapping-body.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,MAAM,EAAE,MAAM,QAAQ,CAAC;AAChC,OAAO,EAAE,OAAO,EAAE,MAAM,kBAAkB,CAAC;AAC3C,OAAO,EAAE,iBAAiB,EAAE,qBAAqB,EAAE,MAAM,2BAA2B,CAAC;AACrF,O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AAQ,CACrB,KAAgB;IAEhB,IAAI,KAAK,CAAC,IAAI,KAAK,SAAS;QAAE,OAAO,KAAK,CAAC,IAAI,CAAC;IAChD,KAAK,CAAC,IAAI,GAAG,aAAa,CAAC,KAAK,CAAC,OAAO,EAAE,KAAK,CAAC,YAAY,CAAC,CAAC;IAC9D,OAAO,KAAK,CAAC,IAAI,CAAC;AACpB,CAAC;AAED;;;;GAIG;AACH,KAAK,UAAU,aAAa,CAC1B,OAAgB,EAChB,QAAgB;IAEhB,OAAO,OAAO,CACZ,MAAM,CAAC,GAAG,CAAC,QAAQ,CAAC;QAClB,MAAM,IAAI,GAAG,KAAK,CAAC,CAAC,iBAAiB,CAAC;QACtC,OAAO,KAAK,CAAC,CAAC,IAAI,CAAC,IAAI,CAAC,OAAO,EAAE,QAAQ,CAAC,CAAC;IAC7C,CAAC,CAAC,CAAC,IAAI,CAAC,MAAM,CAAC,OAAO,CAAC,qBAAqB,CAAC,CAAC,EAC9C,OAAO,CAAC,MAAM,CACf,CAAC;AACJ,CAAC;AAED;;;GAGG;AACH,SAAS,SAAS,CAAC,KAAoB;IACrC,OAAO,KAAK,EAAE,KAAK,CAAC,GAAG,EAAE,CAAC,CAAC,CAAC,CAAC,CAAC,EAAE,IAAI,EAAE,CAAC,WAAW,EAAE,IAAI,EAAE,CAAC;AAC7D,CAAC"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"request-multipart.d.ts","sourceRoot":"","sources":["../src/request-multipart.ts"],"names":[],"mappings":"AAEA,gFAAgF;AAChF,wBAAgB,cAAc,CAAC,OAAO,EAAE,OAAO,EAAE,KAAK,EAAE,UAAU,GAAG,QAAQ,CAoC5E"}
|
|
@@ -0,0 +1,38 @@
|
|
|
1
|
+
import * as MultipartParser from "effect/http/MultipartParser";
|
|
2
|
+
/** Parses already bounded bytes without Bun's filename-based MIME inference. */
|
|
3
|
+
export function parseMultipart(headers, bytes) {
|
|
4
|
+
const form = new FormData();
|
|
5
|
+
let complete = false;
|
|
6
|
+
const parser = MultipartParser.make({
|
|
7
|
+
headers: Object.fromEntries(headers),
|
|
8
|
+
maxTotalSize: bytes.byteLength,
|
|
9
|
+
maxFieldSize: bytes.byteLength,
|
|
10
|
+
isFile: (info) => info.filename !== undefined,
|
|
11
|
+
onField: (info, value) => form.append(info.name, MultipartParser.decodeField(info, value)),
|
|
12
|
+
onFile: (info) => {
|
|
13
|
+
const chunks = [];
|
|
14
|
+
return (chunk) => {
|
|
15
|
+
if (chunk !== null)
|
|
16
|
+
chunks.push(new Uint8Array(chunk));
|
|
17
|
+
else
|
|
18
|
+
form.append(info.name, new File(chunks, info.filename ?? "blob", {
|
|
19
|
+
type: typeof info.headers["content-type"] === "string"
|
|
20
|
+
? info.headers["content-type"]
|
|
21
|
+
: info.contentType,
|
|
22
|
+
}));
|
|
23
|
+
};
|
|
24
|
+
},
|
|
25
|
+
onError: (error) => {
|
|
26
|
+
throw new Error("Invalid multipart body", { cause: error });
|
|
27
|
+
},
|
|
28
|
+
onDone: () => {
|
|
29
|
+
complete = true;
|
|
30
|
+
},
|
|
31
|
+
});
|
|
32
|
+
parser.write(bytes);
|
|
33
|
+
parser.end();
|
|
34
|
+
if (!complete)
|
|
35
|
+
throw new Error("Incomplete multipart body");
|
|
36
|
+
return form;
|
|
37
|
+
}
|
|
38
|
+
//# sourceMappingURL=request-multipart.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"request-multipart.js","sourceRoot":"","sources":["../src/request-multipart.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,eAAe,MAAM,6BAA6B,CAAC;AAE/D,gFAAgF;AAChF,MAAM,UAAU,cAAc,CAAC,OAAgB,EAAE,KAAiB;IAChE,MAAM,IAAI,GAAG,IAAI,QAAQ,EAAE,CAAC;IAC5B,IAAI,QAAQ,GAAG,KAAK,CAAC;IACrB,MAAM,MAAM,GAAG,eAAe,CAAC,IAAI,CAAC;QAClC,OAAO,EAAE,MAAM,CAAC,WA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AAQ;QAAE,MAAM,IAAI,KAAK,CAAC,2BAA2B,CAAC,CAAC;IAC5D,OAAO,IAAI,CAAC;AACd,CAAC"}
|
package/dist/scalar.d.ts
ADDED
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
import type { Hono } from "hono";
|
|
2
|
+
import type { RegistrationPlan } from "@relkit/graph";
|
|
3
|
+
import type { ApiDocsOptions, ApiReferenceFactory } from "./api-docs.types.js";
|
|
4
|
+
/** Builds Scalar's native handler from authorized URL or embedded document input.
|
|
5
|
+
* @param configuration - Prepared title and document representation.
|
|
6
|
+
* @returns The native Scalar Hono middleware.
|
|
7
|
+
*/
|
|
8
|
+
export declare const scalarReference: ApiReferenceFactory;
|
|
9
|
+
/** Installs OpenAPI and the optional Scalar UI behind their shared authorization.
|
|
10
|
+
* @param app - Application whose common middleware is already installed.
|
|
11
|
+
* @param plan - Verified registration plan used for document generation.
|
|
12
|
+
* @param options - Existing document exposure and authorization settings.
|
|
13
|
+
* @returns Nothing; invalid configuration rejects before route publication.
|
|
14
|
+
*/
|
|
15
|
+
export declare function installScalarApiDocs(app: Hono, plan: RegistrationPlan, options?: ApiDocsOptions): void;
|
|
16
|
+
//# sourceMappingURL=scalar.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"scalar.d.ts","sourceRoot":"","sources":["../src/scalar.ts"],"names":[],"mappings":"AAMA,OAAO,KAAK,EAAE,IAAI,EAAE,MAAM,MAAM,CAAC;AACjC,OAAO,KAAK,EAAE,gBAAgB,EAAE,MAAM,eAAe,CAAC;AAEtD,OAAO,KAAK,EAAE,cAAc,EAAE,mBAAmB,EAAE,MAAM,qBAAqB,CAAC;AAE/E;;;GAGG;AACH,eAAO,MAAM,eAAe,EAAE,mBAA8D,CAAC;AAE7F;;;;;GAKG;AACH,wBAAgB,oBAAoB,CAClC,GAAG,EAAE,IAAI,EACT,IAAI,EAAE,gBAAgB,EACtB,OAAO,GAAE,cAAmB,GAC3B,IAAI,CAEN"}
|
package/dist/scalar.js
ADDED
|
@@ -0,0 +1,22 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Owns the optional Scalar renderer. Importing this explicit entrypoint requires
|
|
3
|
+
* @scalar/hono-api-reference@0.12.9; core OpenAPI generation imports no UI SDK.
|
|
4
|
+
* Prepared applications select the same renderer with apiDocs.ui = "scalar".
|
|
5
|
+
*/
|
|
6
|
+
import { Scalar } from "@scalar/hono-api-reference";
|
|
7
|
+
import { installApiDocs } from "./api-docs.js";
|
|
8
|
+
/** Builds Scalar's native handler from authorized URL or embedded document input.
|
|
9
|
+
* @param configuration - Prepared title and document representation.
|
|
10
|
+
* @returns The native Scalar Hono middleware.
|
|
11
|
+
*/
|
|
12
|
+
export const scalarReference = (configuration) => Scalar(configuration);
|
|
13
|
+
/** Installs OpenAPI and the optional Scalar UI behind their shared authorization.
|
|
14
|
+
* @param app - Application whose common middleware is already installed.
|
|
15
|
+
* @param plan - Verified registration plan used for document generation.
|
|
16
|
+
* @param options - Existing document exposure and authorization settings.
|
|
17
|
+
* @returns Nothing; invalid configuration rejects before route publication.
|
|
18
|
+
*/
|
|
19
|
+
export function installScalarApiDocs(app, plan, options = {}) {
|
|
20
|
+
installApiDocs(app, plan, { ...options, ui: "scalar", reference: scalarReference });
|
|
21
|
+
}
|
|
22
|
+
//# sourceMappingURL=scalar.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"scalar.js","sourceRoot":"","sources":["../src/scalar.ts"],"names":[],"mappings":"AAAA;;;;GAIG;AACH,OAAO,EAAE,MAAM,EAAE,MAAM,4BAA4B,CAAC;AAGpD,OAAO,EAAE,cAAc,EAAE,MAAM,eAAe,CAAC;AAG/C;;;GAGG;AACH,MAAM,CAAC,MAAM,eAAe,GAAwB,CAAC,aAAa,EAAE,EAAE,CAAC,MAAM,CAAC,aAAa,CAAC,CAAC;AAE7F;;;;;GAKG;AACH,MAAM,UAAU,oBAAoB,CAClC,GAAS,EACT,IAAsB,EACtB,UAA0B,EAAE;IAE5B,cAAc,CAAC,GAAG,EAAE,IAAI,EAAE,EAAE,GAAG,OAAO,EAAE,EAAE,EAAE,QAAQ,EAAE,SAAS,EAAE,eAAe,EAAE,CAAC,CAAC;AACtF,CAAC"}
|
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Selects optional HTTP SDK requirements from application options. These concrete
|
|
3
|
+
* versions mirror optional peer declarations and are checked by packaging tests;
|
|
4
|
+
* ordinary REST/RPC and OpenAPI select no optional SDK requirements.
|
|
5
|
+
*/
|
|
6
|
+
import type { IntegrationDependencyRequirement } from "@relkit/contracts";
|
|
7
|
+
import type { CreateAppOptions } from "./create-app.types.js";
|
|
8
|
+
import type { OptionalHttpCapability } from "./optional-transports.types.js";
|
|
9
|
+
/** Runtime-owned SDK metadata consumed by the shared selected-dependency checker. */
|
|
10
|
+
export declare const HTTP_TRANSPORT_REQUIREMENTS: readonly IntegrationDependencyRequirement[];
|
|
11
|
+
/** Selects explicit protocol/UI capabilities without reading request state.
|
|
12
|
+
* @param options - Validated generation configuration.
|
|
13
|
+
* @returns Deterministic independently initialized SDK capability names.
|
|
14
|
+
*/
|
|
15
|
+
export declare function selectedHttpCapabilities(options: Pick<CreateAppOptions, "mcp" | "agUi" | "apiDocs">): OptionalHttpCapability[];
|
|
16
|
+
//# sourceMappingURL=selected-transports.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"selected-transports.d.ts","sourceRoot":"","sources":["../src/selected-transports.ts"],"names":[],"mappings":"AAAA;;;;GAIG;AACH,OAAO,KAAK,EAAE,gCAAgC,EAAE,MAAM,mBAAmB,CAAC;AAC1E,OAAO,KAAK,EAAE,gBAAgB,EAAE,MAAM,uBAAuB,CAAC;AAC9D,OAAO,KAAK,EAAE,sBAAsB,EAAE,MAAM,gCAAgC,CAAC;AAE7E,qFAAqF;AACrF,eAAO,MAAM,2BAA2B,EAAE,SAAS,gCAAgC,EAsBlF,CAAC;AAEF;;;GAGG;AACH,wBAAgB,wBAAwB,CACtC,OAAO,EAAE,IAAI,CAAC,gBAAgB,EAAE,KAAK,GAAG,MAAM,GAAG,SAAS,CAAC,GAC1D,sBAAsB,EAAE,CAS1B"}
|
|
@@ -0,0 +1,41 @@
|
|
|
1
|
+
/** Runtime-owned SDK metadata consumed by the shared selected-dependency checker. */
|
|
2
|
+
export const HTTP_TRANSPORT_REQUIREMENTS = [
|
|
3
|
+
{
|
|
4
|
+
package: "@modelcontextprotocol/server",
|
|
5
|
+
supportedRange: "2.3.0",
|
|
6
|
+
installSection: "dependencies",
|
|
7
|
+
capabilities: ["mcp"],
|
|
8
|
+
phases: ["runtime"],
|
|
9
|
+
},
|
|
10
|
+
{
|
|
11
|
+
package: "@ag-ui/core",
|
|
12
|
+
supportedRange: "0.0.59",
|
|
13
|
+
installSection: "dependencies",
|
|
14
|
+
capabilities: ["ag-ui"],
|
|
15
|
+
phases: ["runtime"],
|
|
16
|
+
},
|
|
17
|
+
{
|
|
18
|
+
package: "@scalar/hono-api-reference",
|
|
19
|
+
supportedRange: "0.12.9",
|
|
20
|
+
installSection: "dependencies",
|
|
21
|
+
capabilities: ["scalar"],
|
|
22
|
+
phases: ["runtime"],
|
|
23
|
+
},
|
|
24
|
+
];
|
|
25
|
+
/** Selects explicit protocol/UI capabilities without reading request state.
|
|
26
|
+
* @param options - Validated generation configuration.
|
|
27
|
+
* @returns Deterministic independently initialized SDK capability names.
|
|
28
|
+
*/
|
|
29
|
+
export function selectedHttpCapabilities(options) {
|
|
30
|
+
const capabilities = [];
|
|
31
|
+
if (options.mcp?.enabled === true)
|
|
32
|
+
capabilities.push("mcp");
|
|
33
|
+
if (options.agUi === true)
|
|
34
|
+
capabilities.push("ag-ui");
|
|
35
|
+
const docs = options.apiDocs;
|
|
36
|
+
const docsEnabled = docs?.mode === "production" ? docs.enabledInProduction === true : docs?.enabled !== false;
|
|
37
|
+
if (docsEnabled && docs?.ui === "scalar")
|
|
38
|
+
capabilities.push("scalar");
|
|
39
|
+
return capabilities;
|
|
40
|
+
}
|
|
41
|
+
//# sourceMappingURL=selected-transports.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"selected-transports.js","sourceRoot":"","sources":["../src/selected-transports.ts"],"names":[],"mappings":"AASA,qFAAqF;AACrF,MAAM,CAAC,MAAM,2BAA2B,GAAgD;IACtF;QACE,OAAO,EAAE,8BAA8B;QACvC,cAAc,EAAE,OAAO;QACvB,cAAc,EAAE,cAAc;QAC9B,YAAY,EAAE,CAAC,KAAK,CAAC;QACrB,MAAM,EAAE,CAAC,SAAS,CAAC;KACpB;IACD;QACE,OAAO,EAAE,aAAa;QACtB,cAAc,EAAE,QAAQ;QACxB,cAAc,EAAE,cAAc;QAC9B,YAAY,EAAE,CAAC,OAAO,CAAC;QACvB,MAAM,EAAE,CAAC,SAAS,CAAC;KACpB;IACD;QACE,OAAO,EAAE,4BAA4B;QACrC,cAAc,EAAE,QAAQ;QACxB,cAAc,EAAE,cAAc;QAC9B,YAAY,EAAE,CAAC,QAAQ,CAAC;QACxB,MAAM,EAAE,CAAC,SAAS,CAAC;KACpB;CACF,CAAC;AAEF;;;GAGG;AACH,MAAM,UAAU,wBAAwB,CACtC,OAA2D;IAE3D,MAAM,YAAY,GAA6B,EAAE,CAAC;IAClD,IAAI,OAAO,CAAC,GAAG,EAAE,OAAO,KAAK,IAAI;QAAE,YAAY,CAAC,IAAI,CAAC,KAAK,CAAC,CAAC;IAC5D,IAAI,OAAO,CAAC,IAAI,KAAK,IAAI;QAAE,YAAY,CAAC,IAAI,CAAC,OAAO,CAAC,CAAC;IACtD,MAAM,IAAI,GAAG,OAAO,CAAC,OAAO,CAAC;IAC7B,MAAM,WAAW,GACf,IAAI,EAAE,IAAI,KAAK,YAAY,CAAC,CAAC,CAAC,IAAI,CAAC,mBAAmB,KAAK,IAAI,CAAC,CAAC,CAAC,IAAI,EAAE,OAAO,KAAK,KAAK,CAAC;IAC5F,IAAI,WAAW,IAAI,IAAI,EAAE,EAAE,KAAK,QAAQ;QAAE,YAAY,CAAC,IAAI,CAAC,QAAQ,CAAC,CAAC;IACtE,OAAO,YAAY,CAAC;AACtB,CAAC"}
|
|
@@ -0,0 +1,22 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Validates selected HTTP peers through the shared dependency checker, then loads
|
|
3
|
+
* only their narrow entrypoints. Preparation happens inside the generation owner
|
|
4
|
+
* before readiness; no request context or cancellation authority is captured.
|
|
5
|
+
*/
|
|
6
|
+
import { Context, Effect, Layer } from "effect";
|
|
7
|
+
import { SelectedDependencies } from "@relkit/provider/internal/dependencies";
|
|
8
|
+
import type { CreateAppOptions } from "./create-app.types.js";
|
|
9
|
+
declare const SelectedHttpTransports_base: Context.ServiceClass<SelectedHttpTransports, "relkit/http/SelectedHttpTransports", {
|
|
10
|
+
prepare: (options: CreateAppOptions) => Effect.Effect<CreateAppOptions, import("./http-effect.js").HttpBoundaryError | import("@relkit/provider/internal/dependencies").DependencyResolutionFailure | import("@relkit/provider/internal/dependencies").SelectedDependencyFailure, never>;
|
|
11
|
+
}> & {
|
|
12
|
+
readonly make: Effect.Effect<{
|
|
13
|
+
prepare: (options: CreateAppOptions) => Effect.Effect<CreateAppOptions, import("./http-effect.js").HttpBoundaryError | import("@relkit/provider/internal/dependencies").DependencyResolutionFailure | import("@relkit/provider/internal/dependencies").SelectedDependencyFailure, never>;
|
|
14
|
+
}, never, SelectedDependencies>;
|
|
15
|
+
};
|
|
16
|
+
/** Shared SDK selection is replaceable through the provider checker Layer in tests. */
|
|
17
|
+
export declare class SelectedHttpTransports extends SelectedHttpTransports_base {
|
|
18
|
+
}
|
|
19
|
+
/** Live composition resolves peer metadata without loading unrelated integrations. */
|
|
20
|
+
export declare const SelectedHttpTransportsLive: Layer.Layer<SelectedHttpTransports, never, never>;
|
|
21
|
+
export {};
|
|
22
|
+
//# sourceMappingURL=selected-transports.service.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"selected-transports.service.d.ts","sourceRoot":"","sources":["../src/selected-transports.service.ts"],"names":[],"mappings":"AAAA;;;;GAIG;AACH,OAAO,EAAE,OAAO,EAAE,MAAM,EAAE,KAAK,EAAE,MAAM,QAAQ,CAAC;AAEhD,OAAO,EACL,oBAAoB,EAErB,MAAM,wCAAwC,CAAC;AAChD,OAAO,KAAK,EAAE,gBAAgB,EAAE,MAAM,uBAAuB,CAAC;;;;;;;;AAsC9D,uFAAuF;AACvF,qBAAa,sBAAuB,SAAQ,2BA+B3C;CAAG;AAEJ,sFAAsF;AACtF,eAAO,MAAM,0BAA0B,mDAGQ,CAAC"}
|
|
@@ -0,0 +1,73 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Validates selected HTTP peers through the shared dependency checker, then loads
|
|
3
|
+
* only their narrow entrypoints. Preparation happens inside the generation owner
|
|
4
|
+
* before readiness; no request context or cancellation authority is captured.
|
|
5
|
+
*/
|
|
6
|
+
import { Context, Effect, Layer } from "effect";
|
|
7
|
+
import { fileURLToPath } from "node:url";
|
|
8
|
+
import { SelectedDependencies, SelectedDependenciesLive, } from "@relkit/provider/internal/dependencies";
|
|
9
|
+
import { httpBoundary, observeHttp } from "./http-effect.js";
|
|
10
|
+
import { HTTP_TRANSPORT_REQUIREMENTS, selectedHttpCapabilities } from "./selected-transports.js";
|
|
11
|
+
/** Loads exactly one native installer after its requirement has been validated.
|
|
12
|
+
* @param capability - Explicit selected HTTP capability.
|
|
13
|
+
* @param options - Generation options accumulated from prior independent selections.
|
|
14
|
+
* @returns Options enriched only with the selected capability's native installer.
|
|
15
|
+
*/
|
|
16
|
+
function loadSelected(capability, options) {
|
|
17
|
+
return httpBoundary(`http.${capability}.initialize`, async () => {
|
|
18
|
+
switch (capability) {
|
|
19
|
+
case "mcp": {
|
|
20
|
+
const { installMcp } = await import("@relkit/runtime-hono/mcp");
|
|
21
|
+
return {
|
|
22
|
+
...options,
|
|
23
|
+
optionalTransports: { ...options.optionalTransports, mcp: installMcp },
|
|
24
|
+
};
|
|
25
|
+
}
|
|
26
|
+
case "ag-ui": {
|
|
27
|
+
const { installAgentProtocolEndpoints } = await import("@relkit/runtime-hono/ag-ui");
|
|
28
|
+
return {
|
|
29
|
+
...options,
|
|
30
|
+
optionalTransports: {
|
|
31
|
+
...options.optionalTransports,
|
|
32
|
+
agUi: installAgentProtocolEndpoints,
|
|
33
|
+
},
|
|
34
|
+
};
|
|
35
|
+
}
|
|
36
|
+
case "scalar": {
|
|
37
|
+
const { scalarReference } = await import("@relkit/runtime-hono/scalar");
|
|
38
|
+
return { ...options, apiDocs: { ...options.apiDocs, reference: scalarReference } };
|
|
39
|
+
}
|
|
40
|
+
}
|
|
41
|
+
});
|
|
42
|
+
}
|
|
43
|
+
/** Shared SDK selection is replaceable through the provider checker Layer in tests. */
|
|
44
|
+
export class SelectedHttpTransports extends Context.Service()("relkit/http/SelectedHttpTransports", {
|
|
45
|
+
make: Effect.gen(function* () {
|
|
46
|
+
const checker = yield* SelectedDependencies;
|
|
47
|
+
/** Validates and initializes selected SDKs once during generation acquisition.
|
|
48
|
+
* @param options - Accepted generation options and actual consumer root.
|
|
49
|
+
* @returns Enriched options or actionable dependency/native initialization failure.
|
|
50
|
+
*/
|
|
51
|
+
const prepare = Effect.fn("SelectedHttpTransports.prepare")(function* (options) {
|
|
52
|
+
const capabilities = selectedHttpCapabilities(options);
|
|
53
|
+
yield* checker.check({
|
|
54
|
+
projectRoot: options.dependencyProjectRoot ?? process.cwd(),
|
|
55
|
+
adapter: "@relkit/runtime-hono",
|
|
56
|
+
adapterRoot: fileURLToPath(new URL("../", import.meta.url)),
|
|
57
|
+
capabilities,
|
|
58
|
+
requirements: HTTP_TRANSPORT_REQUIREMENTS,
|
|
59
|
+
phase: "runtime",
|
|
60
|
+
...(options.packageManager === undefined ? {} : { manager: options.packageManager }),
|
|
61
|
+
});
|
|
62
|
+
let configured = options;
|
|
63
|
+
for (const capability of capabilities)
|
|
64
|
+
configured = yield* loadSelected(capability, configured);
|
|
65
|
+
return configured;
|
|
66
|
+
}, (effect) => observeHttp("transports.prepare", effect));
|
|
67
|
+
return { prepare };
|
|
68
|
+
}),
|
|
69
|
+
}) {
|
|
70
|
+
}
|
|
71
|
+
/** Live composition resolves peer metadata without loading unrelated integrations. */
|
|
72
|
+
export const SelectedHttpTransportsLive = Layer.effect(SelectedHttpTransports, SelectedHttpTransports.make).pipe(Layer.provide(SelectedDependenciesLive));
|
|
73
|
+
//# sourceMappingURL=selected-transports.service.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"selected-transports.service.js","sourceRoot":"","sources":["../src/selected-transports.service.ts"],"names":[],"mappings":"AAAA;;;;GAIG;AACH,OAAO,EAAE,OAAO,EAAE,MAAM,EAAE,KAAK,EAAE,MAAM,QAAQ,CAAC;AAChD,OAAO,EAAE,aAAa,EAAE,MAAM,UAAU,CAAC;AACzC,OAAO,EACL,oBAAoB,EACpB,wBAAwB,GACzB,MAAM,wCAAwC,CAAC;AAEhD,OAAO,EAAE,YAAY,EAAE,WAAW,EAAE,MAAM,kBAAkB,CAAC;AAE7D,OAAO,EAAE,2BAA2B,EAAE,wBAAwB,EAAE,MAAM,0BAA0B,CAAC;AAEjG;;;;GAIG;AACH,SAAS,YAAY,CAAC,UAAkC,EAAE,OAAyB;IACjF,OAAO,YAAY,CAAC,QAAQ,UAAU,aAAa,EAAE,KAAK,IAA+B,EAAE;QACzF,QAAQ,UAAU,EAAE,CAAC;YACnB,KAAK,KAAK,CAAC,CAAC,CAAC;gBACX,MAAM,EAAE,UAAU,EAAE,GAAG,MAAM,MAAM,CAAC,0BAA0B,CAAC,CAAC;gBAChE,OAAO;oBACL,GAAG,OAAO;oBACV,kBAAkB,EAAE,EAAE,GAAG,OAAO,CAAC,kBAAkB,EAAE,GAAG,EAAE,UAAU,EAAE;iBACvE,CAAC;YACJ,CAAC;YACD,KAAK,OAAO,CAAC,CAAC,CAAC;gBACb,MAAM,EAAE,6BAA6B,EAAE,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C,EAAE,CAAC,CAAC,CAAC,EAAE,OAAO,EAAE,OAAO,CAAC,cAAc,EAAE,CAAC;aACrF,CAAC,CAAC;YACH,IAAI,UAAU,GAAG,OAAO,CAAC;YACzB,KAAK,MAAM,UAAU,IAAI,YAAY;gBACnC,UAAU,GAAG,KAAK,CAAC,CAAC,YAAY,CAAC,UAAU,EAAE,UAAU,CAAC,CAAC;YAC3D,OAAO,UAAU,CAAC;QACpB,CAAC,EACD,CAAC,MAAM,EAAE,EAAE,CAAC,WAAW,CAAC,oBAAoB,EAAE,MAAM,CAAC,CACtD,CAAC;QACF,OAAO,EAAE,OAAO,EAAE,CAAC;IACrB,CAAC,CAAC;CACH,CACF;CAAG;AAEJ,sFAAsF;AACtF,MAAM,CAAC,MAAM,0BAA0B,GAAG,KAAK,CAAC,MAAM,CACpD,sBAAsB,EACtB,sBAAsB,CAAC,IAAI,CAC5B,CAAC,IAAI,CAAC,KAAK,CAAC,OAAO,CAAC,wBAAwB,CAAC,CAAC,CAAC"}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@relkit/runtime-hono",
|
|
3
|
-
"version": "0.
|
|
3
|
+
"version": "0.8.1",
|
|
4
4
|
"description": "Unsupported internal Hono runtime for RELKIT; use @relkit/app.",
|
|
5
5
|
"license": "MIT",
|
|
6
6
|
"repository": {
|
|
@@ -31,41 +31,77 @@
|
|
|
31
31
|
"types": "./dist/prepared-app.d.ts",
|
|
32
32
|
"import": "./dist/prepared-app.js"
|
|
33
33
|
},
|
|
34
|
+
"./mcp": {
|
|
35
|
+
"types": "./dist/mcp.d.ts",
|
|
36
|
+
"import": "./dist/mcp.js"
|
|
37
|
+
},
|
|
38
|
+
"./ag-ui": {
|
|
39
|
+
"types": "./dist/agent-protocol.d.ts",
|
|
40
|
+
"import": "./dist/agent-protocol.js"
|
|
41
|
+
},
|
|
42
|
+
"./scalar": {
|
|
43
|
+
"types": "./dist/scalar.d.ts",
|
|
44
|
+
"import": "./dist/scalar.js"
|
|
45
|
+
},
|
|
34
46
|
"./bun": {
|
|
35
47
|
"types": "./dist/bun.d.ts",
|
|
36
48
|
"import": "./dist/bun.js"
|
|
37
49
|
}
|
|
38
50
|
},
|
|
39
51
|
"dependencies": {
|
|
40
|
-
"@
|
|
41
|
-
"@ag-ui/core": "0.0.59",
|
|
52
|
+
"@opentelemetry/api": "1.9.1",
|
|
42
53
|
"@orpc/contract": "2.0.0-beta.31",
|
|
43
54
|
"@orpc/server": "2.0.0-beta.31",
|
|
44
|
-
"@
|
|
45
|
-
"@relkit/
|
|
46
|
-
"@relkit/
|
|
47
|
-
"@relkit/
|
|
48
|
-
"@relkit/
|
|
49
|
-
"@relkit/
|
|
50
|
-
"@relkit/
|
|
51
|
-
"@relkit/
|
|
52
|
-
"@relkit/openapi": "0.7.
|
|
53
|
-
"@relkit/runtime-effect": "0.7.
|
|
54
|
-
"@relkit/routes": "0.7.
|
|
55
|
-
"@relkit/realtime": "0.7.
|
|
56
|
-
"@relkit/schema": "0.7.
|
|
55
|
+
"@relkit/contracts": "0.8.1",
|
|
56
|
+
"@relkit/agents": "0.8.1",
|
|
57
|
+
"@relkit/engine": "0.8.1",
|
|
58
|
+
"@relkit/graph": "0.7.12",
|
|
59
|
+
"@relkit/invocation": "0.7.12",
|
|
60
|
+
"@relkit/jobs": "0.7.12",
|
|
61
|
+
"@relkit/observability": "0.8.1",
|
|
62
|
+
"@relkit/provider": "0.8.1",
|
|
63
|
+
"@relkit/openapi": "0.7.12",
|
|
64
|
+
"@relkit/runtime-effect": "0.7.12",
|
|
65
|
+
"@relkit/routes": "0.7.12",
|
|
66
|
+
"@relkit/realtime": "0.7.12",
|
|
67
|
+
"@relkit/schema": "0.7.12",
|
|
57
68
|
"effect": "4.0.1",
|
|
58
69
|
"hono": "4.13.7",
|
|
59
70
|
"hono-rate-limiter": "0.5.4"
|
|
60
71
|
},
|
|
72
|
+
"peerDependencies": {
|
|
73
|
+
"@relkit/langchain": "0.7.12",
|
|
74
|
+
"@ag-ui/core": "0.0.59",
|
|
75
|
+
"@modelcontextprotocol/server": "2.3.0",
|
|
76
|
+
"@scalar/hono-api-reference": "0.12.9"
|
|
77
|
+
},
|
|
78
|
+
"peerDependenciesMeta": {
|
|
79
|
+
"@relkit/langchain": {
|
|
80
|
+
"optional": true
|
|
81
|
+
},
|
|
82
|
+
"@ag-ui/core": {
|
|
83
|
+
"optional": true
|
|
84
|
+
},
|
|
85
|
+
"@modelcontextprotocol/server": {
|
|
86
|
+
"optional": true
|
|
87
|
+
},
|
|
88
|
+
"@scalar/hono-api-reference": {
|
|
89
|
+
"optional": true
|
|
90
|
+
}
|
|
91
|
+
},
|
|
61
92
|
"devDependencies": {
|
|
93
|
+
"typescript": "5.9.3",
|
|
94
|
+
"@relkit/langchain": "0.7.12",
|
|
95
|
+
"@ag-ui/core": "0.0.59",
|
|
96
|
+
"@modelcontextprotocol/server": "2.3.0",
|
|
97
|
+
"@scalar/hono-api-reference": "0.12.9",
|
|
62
98
|
"@effect/vitest": "4.0.1",
|
|
63
99
|
"@langchain/core": "1.2.9",
|
|
64
100
|
"@langchain/langgraph": "1.4.14",
|
|
65
101
|
"@modelcontextprotocol/client": "2.3.0",
|
|
66
102
|
"@orpc/client": "2.0.0-beta.31",
|
|
67
|
-
"@relkit/client": "0.
|
|
68
|
-
"@relkit/providers-local": "0.
|
|
103
|
+
"@relkit/client": "0.8.1",
|
|
104
|
+
"@relkit/providers-local": "0.8.1",
|
|
69
105
|
"langchain": "1.5.10",
|
|
70
106
|
"vitest": "5.0.1"
|
|
71
107
|
},
|