gemi 0.102.0 → 0.104.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/ai/Agent.d.ts +13 -2
- package/dist/ai/Agent.d.ts.map +1 -1
- package/dist/ai/index.d.ts +1 -1
- package/dist/ai/index.d.ts.map +1 -1
- package/dist/ai/index.js +2 -2
- package/dist/ai/index.js.map +4 -4
- package/dist/app/index.js +1 -1
- package/dist/bun/plugin.js +1 -1
- package/dist/bun/preload.js +1 -1
- package/dist/{chunk-f6s7ddjz.js → chunk-0fney17e.js} +2 -2
- package/dist/{chunk-f6s7ddjz.js.map → chunk-0fney17e.js.map} +1 -1
- package/dist/{chunk-z8jf7jwg.js → chunk-18aqqrev.js} +2 -2
- package/dist/{chunk-z8jf7jwg.js.map → chunk-18aqqrev.js.map} +1 -1
- package/dist/{chunk-68zf43ah.js → chunk-1xzdexbq.js} +2 -2
- package/dist/{chunk-68zf43ah.js.map → chunk-1xzdexbq.js.map} +1 -1
- package/dist/{chunk-99wzvsz5.js → chunk-214av8am.js} +4 -4
- package/dist/{chunk-99wzvsz5.js.map → chunk-214av8am.js.map} +1 -1
- package/dist/{chunk-adm5g1v8.js → chunk-22k4b395.js} +2 -2
- package/dist/{chunk-adm5g1v8.js.map → chunk-22k4b395.js.map} +1 -1
- package/dist/{chunk-nffk2cj3.js → chunk-2baxmae9.js} +2 -2
- package/dist/{chunk-nffk2cj3.js.map → chunk-2baxmae9.js.map} +1 -1
- package/dist/{chunk-hr0m35tr.js → chunk-2p1wc6g8.js} +2 -2
- package/dist/{chunk-hr0m35tr.js.map → chunk-2p1wc6g8.js.map} +1 -1
- package/dist/{chunk-4x41cmg3.js → chunk-3cxbvrts.js} +3 -3
- package/dist/{chunk-4x41cmg3.js.map → chunk-3cxbvrts.js.map} +1 -1
- package/dist/{chunk-2tm56xq1.js → chunk-3m93v7bt.js} +2 -2
- package/dist/{chunk-2tm56xq1.js.map → chunk-3m93v7bt.js.map} +1 -1
- package/dist/{chunk-63cp4s8g.js → chunk-47dqttnk.js} +2 -2
- package/dist/{chunk-63cp4s8g.js.map → chunk-47dqttnk.js.map} +1 -1
- package/dist/{chunk-qttatc7h.js → chunk-4f7n1r02.js} +2 -2
- package/dist/{chunk-qttatc7h.js.map → chunk-4f7n1r02.js.map} +1 -1
- package/dist/{chunk-6397mbr2.js → chunk-4p752vk2.js} +3 -3
- package/dist/{chunk-6397mbr2.js.map → chunk-4p752vk2.js.map} +1 -1
- package/dist/{chunk-br9p390p.js → chunk-5dwtmkk8.js} +2 -2
- package/dist/{chunk-br9p390p.js.map → chunk-5dwtmkk8.js.map} +1 -1
- package/dist/{chunk-a9nxjfdy.js → chunk-5k3rm4b6.js} +2 -2
- package/dist/{chunk-a9nxjfdy.js.map → chunk-5k3rm4b6.js.map} +1 -1
- package/dist/{chunk-bvsevtpp.js → chunk-5ngv175h.js} +1 -1
- package/dist/{chunk-jhaeemjf.js → chunk-62cv9vjt.js} +2 -2
- package/dist/{chunk-jhaeemjf.js.map → chunk-62cv9vjt.js.map} +1 -1
- package/dist/{chunk-msg6re1f.js → chunk-63hvh35x.js} +2 -2
- package/dist/{chunk-msg6re1f.js.map → chunk-63hvh35x.js.map} +1 -1
- package/dist/chunk-7y2y8rxx.js +5 -0
- package/dist/{chunk-23mpa8t7.js.map → chunk-7y2y8rxx.js.map} +3 -3
- package/dist/{chunk-69yw2pb1.js → chunk-8nkdvgd9.js} +2 -2
- package/dist/{chunk-69yw2pb1.js.map → chunk-8nkdvgd9.js.map} +1 -1
- package/dist/{chunk-mb8chren.js → chunk-ag8mk3p3.js} +2 -2
- package/dist/{chunk-mb8chren.js.map → chunk-ag8mk3p3.js.map} +1 -1
- package/dist/{chunk-eqtsfvvd.js → chunk-ayss2f8c.js} +2 -2
- package/dist/{chunk-eqtsfvvd.js.map → chunk-ayss2f8c.js.map} +1 -1
- package/dist/{chunk-bf1q3m7a.js → chunk-b0jpvp5t.js} +3 -3
- package/dist/{chunk-bf1q3m7a.js.map → chunk-b0jpvp5t.js.map} +1 -1
- package/dist/{chunk-3tn480wt.js → chunk-b1dqx3b9.js} +2 -2
- package/dist/{chunk-3tn480wt.js.map → chunk-b1dqx3b9.js.map} +1 -1
- package/dist/{chunk-pjg7gqnh.js → chunk-bsq80942.js} +2 -2
- package/dist/{chunk-pjg7gqnh.js.map → chunk-bsq80942.js.map} +1 -1
- package/dist/{chunk-aa13sgs2.js → chunk-cbywzv21.js} +1 -1
- package/dist/{chunk-snz7nze3.js → chunk-cw7qfcvt.js} +2 -2
- package/dist/{chunk-snz7nze3.js.map → chunk-cw7qfcvt.js.map} +1 -1
- package/dist/{chunk-4rns9cnb.js → chunk-dtybftkq.js} +2 -2
- package/dist/{chunk-4rns9cnb.js.map → chunk-dtybftkq.js.map} +1 -1
- package/dist/{chunk-8ma08vxq.js → chunk-dyew1yf7.js} +2 -2
- package/dist/{chunk-8ma08vxq.js.map → chunk-dyew1yf7.js.map} +1 -1
- package/dist/{chunk-cp8gxeqs.js → chunk-ee92kx8s.js} +2 -2
- package/dist/{chunk-cp8gxeqs.js.map → chunk-ee92kx8s.js.map} +1 -1
- package/dist/chunk-f2n21fef.js +5 -0
- package/dist/{chunk-yhkffean.js.map → chunk-f2n21fef.js.map} +1 -1
- package/dist/{chunk-ghz3e8b7.js → chunk-fcsq613t.js} +2 -2
- package/dist/{chunk-ghz3e8b7.js.map → chunk-fcsq613t.js.map} +1 -1
- package/dist/{chunk-c9vga0sk.js → chunk-gvv2trvz.js} +3 -3
- package/dist/{chunk-c9vga0sk.js.map → chunk-gvv2trvz.js.map} +1 -1
- package/dist/{chunk-4qjy1bts.js → chunk-gy6d6jeg.js} +2 -2
- package/dist/{chunk-4qjy1bts.js.map → chunk-gy6d6jeg.js.map} +1 -1
- package/dist/{chunk-64j3yef2.js → chunk-gyareq03.js} +2 -2
- package/dist/{chunk-64j3yef2.js.map → chunk-gyareq03.js.map} +1 -1
- package/dist/{chunk-5wgx5n2q.js → chunk-h945tg0r.js} +2 -2
- package/dist/{chunk-5wgx5n2q.js.map → chunk-h945tg0r.js.map} +1 -1
- package/dist/{chunk-hsec03gh.js → chunk-hwc8gt4n.js} +2 -2
- package/dist/{chunk-hsec03gh.js.map → chunk-hwc8gt4n.js.map} +1 -1
- package/dist/{chunk-gykbgtvg.js → chunk-hzmnqe4x.js} +2 -2
- package/dist/{chunk-gykbgtvg.js.map → chunk-hzmnqe4x.js.map} +1 -1
- package/dist/{chunk-shb51m4y.js → chunk-j041a7ej.js} +2 -2
- package/dist/{chunk-shb51m4y.js.map → chunk-j041a7ej.js.map} +1 -1
- package/dist/{chunk-xf9axxzx.js → chunk-j6e99sra.js} +3 -3
- package/dist/{chunk-xf9axxzx.js.map → chunk-j6e99sra.js.map} +1 -1
- package/dist/{chunk-9xf2fx98.js → chunk-j9deswmn.js} +2 -2
- package/dist/{chunk-9xf2fx98.js.map → chunk-j9deswmn.js.map} +1 -1
- package/dist/{chunk-epwaxctc.js → chunk-jfnhzza6.js} +2 -2
- package/dist/{chunk-epwaxctc.js.map → chunk-jfnhzza6.js.map} +1 -1
- package/dist/{chunk-prg5k57m.js → chunk-kwkbzswm.js} +2 -2
- package/dist/{chunk-prg5k57m.js.map → chunk-kwkbzswm.js.map} +1 -1
- package/dist/{chunk-n63xjrck.js → chunk-ma5rmcbe.js} +2 -2
- package/dist/{chunk-n63xjrck.js.map → chunk-ma5rmcbe.js.map} +1 -1
- package/dist/{chunk-6abjjfjr.js → chunk-mnctdd8r.js} +2 -2
- package/dist/{chunk-6abjjfjr.js.map → chunk-mnctdd8r.js.map} +1 -1
- package/dist/chunk-mp3sxvcv.js +17 -0
- package/dist/{chunk-9hs7prvj.js.map → chunk-mp3sxvcv.js.map} +3 -3
- package/dist/{chunk-y4fp0eg9.js → chunk-p2jn4bnx.js} +2 -2
- package/dist/{chunk-y4fp0eg9.js.map → chunk-p2jn4bnx.js.map} +1 -1
- package/dist/{chunk-xp6nr441.js → chunk-pfjr510h.js} +2 -2
- package/dist/{chunk-xp6nr441.js.map → chunk-pfjr510h.js.map} +1 -1
- package/dist/{chunk-dn2mw39y.js → chunk-q8r9mvzx.js} +2 -2
- package/dist/{chunk-dn2mw39y.js.map → chunk-q8r9mvzx.js.map} +1 -1
- package/dist/{chunk-1vs4xhcg.js → chunk-r5pnz4nn.js} +2 -2
- package/dist/{chunk-1vs4xhcg.js.map → chunk-r5pnz4nn.js.map} +1 -1
- package/dist/{chunk-yk2mtcwv.js → chunk-rjcmbwcc.js} +2 -2
- package/dist/{chunk-yk2mtcwv.js.map → chunk-rjcmbwcc.js.map} +1 -1
- package/dist/{chunk-80t4tfke.js → chunk-rkre6bqc.js} +1 -1
- package/dist/{chunk-mekw2ap4.js → chunk-sedwjgvf.js} +2 -2
- package/dist/{chunk-mekw2ap4.js.map → chunk-sedwjgvf.js.map} +1 -1
- package/dist/{chunk-md8hmejq.js → chunk-sryxt8df.js} +2 -2
- package/dist/{chunk-md8hmejq.js.map → chunk-sryxt8df.js.map} +1 -1
- package/dist/{chunk-3fr22rtg.js → chunk-st0d3ndv.js} +2 -2
- package/dist/{chunk-3fr22rtg.js.map → chunk-st0d3ndv.js.map} +1 -1
- package/dist/{chunk-tymhsmgq.js → chunk-szrgwggb.js} +3 -3
- package/dist/{chunk-tymhsmgq.js.map → chunk-szrgwggb.js.map} +1 -1
- package/dist/{chunk-7vjbebst.js → chunk-v4exgqbp.js} +2 -2
- package/dist/{chunk-7vjbebst.js.map → chunk-v4exgqbp.js.map} +1 -1
- package/dist/{chunk-7fn3wwyq.js → chunk-vh1hxm9y.js} +2 -2
- package/dist/{chunk-7fn3wwyq.js.map → chunk-vh1hxm9y.js.map} +1 -1
- package/dist/{chunk-1pbwrzwp.js → chunk-vqvdptx4.js} +2 -2
- package/dist/{chunk-1pbwrzwp.js.map → chunk-vqvdptx4.js.map} +1 -1
- package/dist/{chunk-48dek9s7.js → chunk-xnggfm0s.js} +3 -3
- package/dist/{chunk-48dek9s7.js.map → chunk-xnggfm0s.js.map} +1 -1
- package/dist/{chunk-n4807648.js → chunk-xxkk60aw.js} +3 -3
- package/dist/{chunk-n4807648.js.map → chunk-xxkk60aw.js.map} +1 -1
- package/dist/{chunk-xmjhensy.js → chunk-yxh4xs3k.js} +2 -2
- package/dist/{chunk-xmjhensy.js.map → chunk-yxh4xs3k.js.map} +1 -1
- package/dist/{chunk-77kw61f4.js → chunk-zhk3z9zk.js} +3 -3
- package/dist/{chunk-77kw61f4.js.map → chunk-zhk3z9zk.js.map} +1 -1
- package/dist/{chunk-f9t39vwk.js → chunk-zm00crsx.js} +2 -2
- package/dist/{chunk-f9t39vwk.js.map → chunk-zm00crsx.js.map} +1 -1
- package/dist/{chunk-np5b3cd7.js → chunk-zmag8k0z.js} +2 -2
- package/dist/{chunk-np5b3cd7.js.map → chunk-zmag8k0z.js.map} +1 -1
- package/dist/config/index.js +1 -1
- package/dist/console/run.js +2 -2
- package/dist/console/run.js.map +1 -1
- package/dist/container/index.js +2 -2
- package/dist/container/index.js.map +1 -1
- package/dist/database/index.js +2 -2
- package/dist/database/index.js.map +1 -1
- package/dist/email/index.js +2 -2
- package/dist/email/index.js.map +1 -1
- package/dist/facades/index.js +2 -2
- package/dist/facades/index.js.map +1 -1
- package/dist/foundation/index.js +2 -2
- package/dist/foundation/index.js.map +1 -1
- package/dist/http/McpRouter.d.ts +160 -22
- package/dist/http/McpRouter.d.ts.map +1 -1
- package/dist/http/index.d.ts +1 -1
- package/dist/http/index.d.ts.map +1 -1
- package/dist/http/index.js +2 -2
- package/dist/http/index.js.map +1 -1
- package/dist/i18n/dictionaryRuntime.js +2 -2
- package/dist/i18n/dictionaryRuntime.js.map +1 -1
- package/dist/i18n/index.js +2 -2
- package/dist/i18n/index.js.map +1 -1
- package/dist/kernel/index.js +2 -2
- package/dist/kernel/index.js.map +1 -1
- package/dist/orm/index.js +2 -2
- package/dist/orm/index.js.map +1 -1
- package/dist/server/index.js +2 -2
- package/dist/server/index.js.map +1 -1
- package/dist/services/index.js +2 -2
- package/dist/services/index.js.map +1 -1
- package/dist/services/mcp/McpRegistry.d.ts +19 -3
- package/dist/services/mcp/McpRegistry.d.ts.map +1 -1
- package/dist/services/mcp/toAgentTools.d.ts +60 -7
- package/dist/services/mcp/toAgentTools.d.ts.map +1 -1
- package/dist/services/queue/work.js +2 -2
- package/dist/services/queue/work.js.map +1 -1
- package/dist/support/index.js +2 -2
- package/dist/support/index.js.map +1 -1
- package/package.json +1 -1
- package/dist/chunk-23mpa8t7.js +0 -5
- package/dist/chunk-9hs7prvj.js +0 -17
- package/dist/chunk-yhkffean.js +0 -5
- /package/dist/{chunk-bvsevtpp.js.map → chunk-5ngv175h.js.map} +0 -0
- /package/dist/{chunk-aa13sgs2.js.map → chunk-cbywzv21.js.map} +0 -0
- /package/dist/{chunk-80t4tfke.js.map → chunk-rkre6bqc.js.map} +0 -0
package/dist/http/McpRouter.d.ts
CHANGED
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
import type { ToolContext } from "../ai/Agent";
|
|
2
2
|
import type { AnySchema, Infer, Schema } from "../ai/Schema";
|
|
3
3
|
import type { UrlParser } from "../client/types";
|
|
4
|
+
import type { Prettify } from "../utils/type";
|
|
4
5
|
import type { McpCallContext, McpCredentials } from "../services/mcp/McpRegistry";
|
|
5
6
|
import type { ApiRouterHandler } from "./ApiRouter";
|
|
6
7
|
import type { HttpRequest } from "./HttpRequest";
|
|
@@ -45,6 +46,66 @@ export type McpMethod = "GET" | "POST" | "PUT" | "PATCH" | "DELETE";
|
|
|
45
46
|
* only what the route's own middleware checks anyway.
|
|
46
47
|
*/
|
|
47
48
|
export type McpParamBinder = (req: HttpRequest<any, any>, call: McpCallContext) => string | number | Promise<string | number>;
|
|
49
|
+
/**
|
|
50
|
+
* A path param the model names in its own terms, and the app translates (#767).
|
|
51
|
+
*
|
|
52
|
+
* A bound param leaves the model no say, and an `"input"` one makes it send
|
|
53
|
+
* the raw segment — an id it would have to copy around. This is the third
|
|
54
|
+
* mode: the tool's input schema carries a field in the model's vocabulary
|
|
55
|
+
* (`page: "/about"`), and `bind` turns what the model sent into the segment
|
|
56
|
+
* (`:pageId`) before the url is built.
|
|
57
|
+
*
|
|
58
|
+
* Built with `McpRouter.param`, which is what types `bind`'s `value` from
|
|
59
|
+
* `input`. See `McpModelParamOptions`.
|
|
60
|
+
*/
|
|
61
|
+
export declare class McpModelParam<V = unknown, As extends string | undefined = string | undefined> {
|
|
62
|
+
/**
|
|
63
|
+
* The key in the tool's input schema, or `undefined` for the param's own
|
|
64
|
+
* name. Kept as a literal in the type, which is what names the field in
|
|
65
|
+
* the tool's typed input (`McpToolInput`, #771).
|
|
66
|
+
*/
|
|
67
|
+
readonly as: As;
|
|
68
|
+
readonly input: AnySchema;
|
|
69
|
+
readonly bind: McpModelParamResolver<V>;
|
|
70
|
+
readonly __internal_brand = "McpModelParam";
|
|
71
|
+
constructor(
|
|
72
|
+
/**
|
|
73
|
+
* The key in the tool's input schema, or `undefined` for the param's own
|
|
74
|
+
* name. Kept as a literal in the type, which is what names the field in
|
|
75
|
+
* the tool's typed input (`McpToolInput`, #771).
|
|
76
|
+
*/
|
|
77
|
+
as: As, input: AnySchema, bind: McpModelParamResolver<V>);
|
|
78
|
+
}
|
|
79
|
+
/**
|
|
80
|
+
* Turns what the model sent for a model-facing param into the url segment.
|
|
81
|
+
*
|
|
82
|
+
* `value` is the model's field, parsed by its schema. `req` and `call` are what
|
|
83
|
+
* a binder gets, so a resolver can look the value up within the resource the
|
|
84
|
+
* run is about (`call.ctx`).
|
|
85
|
+
*
|
|
86
|
+
* To refuse, throw an `McpToolError` (or any `ToolError`): its message reaches
|
|
87
|
+
* the model, which can correct the call — `There is no page "/abuot"`. Any
|
|
88
|
+
* other throw, or an empty answer, is the server's failure: logged, and the
|
|
89
|
+
* model reads only that the tool failed.
|
|
90
|
+
*/
|
|
91
|
+
export type McpModelParamResolver<V> = (value: V, req: HttpRequest<any, any>, call: McpCallContext) => string | number | Promise<string | number>;
|
|
92
|
+
/** What `McpRouter.param` takes. */
|
|
93
|
+
export type McpModelParamOptions<S extends AnySchema, As extends string | undefined = string | undefined> = {
|
|
94
|
+
/**
|
|
95
|
+
* The field's name in the tool's input schema. Defaults to the param's own
|
|
96
|
+
* name. It is never sent to the route, in the body or the query: it only
|
|
97
|
+
* reaches `bind`, and `call.input`.
|
|
98
|
+
*/
|
|
99
|
+
as?: As;
|
|
100
|
+
/**
|
|
101
|
+
* The field's schema, as the model sees it. Describe it here — it is the
|
|
102
|
+
* only thing the model reads about the field:
|
|
103
|
+
* `s.string().nullable().describe("A page path, like /about, or null for this chat's page")`.
|
|
104
|
+
*/
|
|
105
|
+
input: S;
|
|
106
|
+
/** Maps the model's value to the segment. See `McpModelParamResolver`. */
|
|
107
|
+
bind: McpModelParamResolver<Infer<S>>;
|
|
108
|
+
};
|
|
48
109
|
/**
|
|
49
110
|
* Picks the attachment a bound file field sends, usually out of `ctx.turn`.
|
|
50
111
|
* The id still resolves through `ctx.attachments`, so a binder can narrow which
|
|
@@ -66,8 +127,16 @@ type BodyOf<H> = H extends ApiRouterHandler<infer T, any, any> ? T : never;
|
|
|
66
127
|
* What the route answers on success, as `useQuery` reads it. The registry
|
|
67
128
|
* hands `result` the parsed JSON, so a `Date` in a handler's return arrives as
|
|
68
129
|
* the string it was serialised to.
|
|
130
|
+
*
|
|
131
|
+
* Read off the return type alone. Matching `ApiRouterHandler<any, infer O,
|
|
132
|
+
* any, any>` instead goes through its `__error?: [Error]` parameter, which
|
|
133
|
+
* `strictFunctionTypes` checks contravariantly: `[any]` is not assignable to a
|
|
134
|
+
* route's `[never]`, so under `strict: true` no route matched and every
|
|
135
|
+
* `result` got `unknown` (#769). The RPC entry's return is already
|
|
136
|
+
* `ResponseData`, so an `HttpResponse` in it is unwrapped by the time it gets
|
|
137
|
+
* here. See `McpRouter.strict.test.ts`.
|
|
69
138
|
*/
|
|
70
|
-
export type DataOf<H> = H extends
|
|
139
|
+
export type DataOf<H> = H extends (...args: any[]) => infer O ? Awaited<O> : unknown;
|
|
71
140
|
/**
|
|
72
141
|
* A body there is nothing to check against: a handler that never names its
|
|
73
142
|
* request (`async list() {}` infers `unknown`), or one typed `any`. The meta
|
|
@@ -112,38 +181,55 @@ type InputCheck<I, B> = IsLoose<B> extends true ? unknown : I extends AnySchema
|
|
|
112
181
|
"input has fields the route's body does not": Exclude<keyof Infer<I>, keyof JsonBody<B>>;
|
|
113
182
|
} : unknown;
|
|
114
183
|
type ParamsOf<K> = UrlParser<`${K & string}`>;
|
|
184
|
+
/** One path param's declaration: bound, the model's raw segment, or the model's in its own terms. */
|
|
185
|
+
export type McpParamDeclaration = McpParamBinder | "input" | McpModelParam<any, any>;
|
|
115
186
|
/**
|
|
116
|
-
* Every path param is
|
|
117
|
-
* param left for the model by omission is exactly the
|
|
118
|
-
* this field exists to prevent, so omitting one is a
|
|
187
|
+
* Every path param is bound, `"input"` or a `this.param(...)`, and there is no
|
|
188
|
+
* default: a param left for the model by omission is exactly the
|
|
189
|
+
* tenant-isolation bug this field exists to prevent, so omitting one is a
|
|
190
|
+
* compile error.
|
|
119
191
|
*/
|
|
120
|
-
type ParamsMeta<K> = string extends keyof ParamsOf<K> ? {
|
|
192
|
+
type ParamsMeta<K, P> = string extends keyof ParamsOf<K> ? {
|
|
121
193
|
params?: never;
|
|
122
194
|
} : [keyof ParamsOf<K>] extends [never] ? {
|
|
123
195
|
params?: never;
|
|
124
196
|
} : {
|
|
125
|
-
params:
|
|
126
|
-
|
|
127
|
-
|
|
197
|
+
params: P & NoInfer<ParamsCheck<K, P>>;
|
|
198
|
+
};
|
|
199
|
+
/**
|
|
200
|
+
* `params` is inferred as `P`, so the tool's input type can tell `"input"` and
|
|
201
|
+
* `this.param(...)` apart from a binder (#771), and checked here: every param
|
|
202
|
+
* of the url declared, and nothing else.
|
|
203
|
+
*/
|
|
204
|
+
type ParamsCheck<K, P> = {
|
|
205
|
+
[X in keyof ParamsOf<K>]-?: McpParamDeclaration;
|
|
206
|
+
} & {
|
|
207
|
+
[X in Exclude<keyof P, keyof ParamsOf<K>>]: never;
|
|
128
208
|
};
|
|
129
209
|
/**
|
|
130
210
|
* Required for every binary field, and refused on a route that has none. For
|
|
131
211
|
* a loose body the fields cannot be known, so any are accepted.
|
|
132
212
|
*/
|
|
133
|
-
type FilesMeta<B> = IsLoose<B> extends true ? {
|
|
134
|
-
files?:
|
|
213
|
+
type FilesMeta<B, F> = IsLoose<B> extends true ? {
|
|
214
|
+
files?: F;
|
|
135
215
|
} : [BinaryKeys<B>] extends [never] ? {
|
|
136
216
|
files?: never;
|
|
137
217
|
} : {
|
|
138
|
-
files: {
|
|
139
|
-
[
|
|
140
|
-
}
|
|
218
|
+
files: F & NoInfer<{
|
|
219
|
+
[X in BinaryKeys<B>]: McpFileBinder | "input";
|
|
220
|
+
} & {
|
|
221
|
+
[X in Exclude<keyof F, BinaryKeys<B>>]: never;
|
|
222
|
+
}>;
|
|
141
223
|
};
|
|
142
|
-
type MetaBase = {
|
|
224
|
+
type MetaBase<T> = {
|
|
143
225
|
/** The only prose the model gets about this tool. */
|
|
144
226
|
description: string;
|
|
145
|
-
/**
|
|
146
|
-
|
|
227
|
+
/**
|
|
228
|
+
* For `McpRegistry.descriptors`' and `toAgentTools`' filter. Kept as
|
|
229
|
+
* literals in the type, so a typed `toAgentTools` filtered by tag answers
|
|
230
|
+
* only the tools carrying it (#771).
|
|
231
|
+
*/
|
|
232
|
+
tags?: T;
|
|
147
233
|
/**
|
|
148
234
|
* Asks the user before an in-process agent runs this tool, as
|
|
149
235
|
* `AgentTool.requiresApproval` does. Never set from the verb: a DELETE of a
|
|
@@ -201,7 +287,7 @@ type ResultReturn<O> = O extends AnySchema ? Infer<O> | Promise<Infer<O>> : unkn
|
|
|
201
287
|
* it would have to be inferred from a context-sensitive function, and any
|
|
202
288
|
* check that mentioned it beside `output` fixed it to its default first.
|
|
203
289
|
*/
|
|
204
|
-
type ResultMeta<H, O> = {
|
|
290
|
+
type ResultMeta<H, O, RR> = {
|
|
205
291
|
/**
|
|
206
292
|
* Trims or reshapes the route's 2xx JSON before the model sees it.
|
|
207
293
|
* Routes are written for a UI and answer whole records; a model needs a
|
|
@@ -215,7 +301,7 @@ type ResultMeta<H, O> = {
|
|
|
215
301
|
* route wrote it. A throw is the server's failure, logged, and the model
|
|
216
302
|
* is told only that the tool failed.
|
|
217
303
|
*/
|
|
218
|
-
result: (data: DataOf<H>, call: McpResultContext) => ResultReturn<O>;
|
|
304
|
+
result: (data: DataOf<H>, call: McpResultContext) => [O] extends [undefined] ? RR : ResultReturn<O>;
|
|
219
305
|
/**
|
|
220
306
|
* The shape of what `result` returns. The return is parsed with it,
|
|
221
307
|
* which drops every field it does not declare. It is the descriptor's
|
|
@@ -235,14 +321,33 @@ type ResultMeta<H, O> = {
|
|
|
235
321
|
*/
|
|
236
322
|
output?: O & NoInfer<OutputCheck<O, DataOf<H>>>;
|
|
237
323
|
};
|
|
238
|
-
export type McpRouteMeta<H, K, I, O = undefined> = MetaBase & InputMeta<BodyOf<H>, I> & ParamsMeta<K> & FilesMeta<BodyOf<H
|
|
324
|
+
export type McpRouteMeta<H, K, I, O = undefined, P = {}, F = {}, T = readonly string[], RR = never> = MetaBase<T> & InputMeta<BodyOf<H>, I> & ParamsMeta<K, P> & FilesMeta<BodyOf<H>, F> & ResultMeta<H, O, RR>;
|
|
325
|
+
/**
|
|
326
|
+
* What the model sends a tool, as the registry builds its `inputSchema`: the
|
|
327
|
+
* `input` schema's fields, a string for every `"input"` path param (optional
|
|
328
|
+
* when the url makes it optional) and every `"input"` file field, and the
|
|
329
|
+
* model-facing field of every `this.param(...)`, under its `as` or the param's
|
|
330
|
+
* own name. Bound params and files are not in it.
|
|
331
|
+
*/
|
|
332
|
+
export type McpToolInput<I, K, P, F> = Prettify<([I] extends [undefined] ? {} : I extends AnySchema ? Infer<I> : {}) & {
|
|
333
|
+
[X in keyof ParamsOf<K> as X extends keyof P ? P[X] extends "input" ? X : never : never]: string;
|
|
334
|
+
} & {
|
|
335
|
+
-readonly [X in keyof P as P[X] extends McpModelParam<any, infer As> ? As extends undefined ? X : As : never]-?: P[X] extends McpModelParam<infer V, any> ? V : never;
|
|
336
|
+
} & {
|
|
337
|
+
-readonly [X in keyof F as F[X] extends "input" ? X : never]-?: string;
|
|
338
|
+
}>;
|
|
339
|
+
/**
|
|
340
|
+
* What a tool answers: what `output` describes when it is set, else what
|
|
341
|
+
* `result` returns when there is one, else the route's own answer.
|
|
342
|
+
*/
|
|
343
|
+
export type McpToolOutput<H, O, RR> = [O] extends [undefined] ? [RR] extends [never] ? DataOf<H> : Awaited<RR> : O extends AnySchema ? Infer<O> : unknown;
|
|
239
344
|
/** The runtime shape of a meta, generics erased. */
|
|
240
345
|
export type McpRouteMetaRuntime = {
|
|
241
346
|
description: string;
|
|
242
347
|
input?: AnySchema;
|
|
243
348
|
tags?: readonly string[];
|
|
244
349
|
requiresApproval?: boolean;
|
|
245
|
-
params?: Record<string,
|
|
350
|
+
params?: Record<string, McpParamDeclaration>;
|
|
246
351
|
files?: Record<string, McpFileBinder | "input">;
|
|
247
352
|
result?: McpResultProjection;
|
|
248
353
|
output?: AnySchema;
|
|
@@ -252,11 +357,20 @@ export type McpRouteMetaRuntime = {
|
|
|
252
357
|
* data; the registry turns it into a tool descriptor once it can see the
|
|
253
358
|
* route table.
|
|
254
359
|
*/
|
|
255
|
-
export declare class McpRouteDeclaration<M extends McpMethod = McpMethod, K extends string = string> {
|
|
360
|
+
export declare class McpRouteDeclaration<M extends McpMethod = McpMethod, K extends string = string, Input = unknown, Output = unknown, Tags extends readonly string[] = readonly string[]> {
|
|
256
361
|
readonly method: M;
|
|
257
362
|
readonly url: K;
|
|
258
363
|
readonly meta: McpRouteMetaRuntime;
|
|
259
364
|
readonly __internal_brand = "McpRoute";
|
|
365
|
+
/**
|
|
366
|
+
* Types only, never set: the tool's input, output and tags, which
|
|
367
|
+
* `toAgentTools` reads off a typed router to type its `AgentTool`s (#771).
|
|
368
|
+
*/
|
|
369
|
+
readonly __tool?: {
|
|
370
|
+
input: Input;
|
|
371
|
+
output: Output;
|
|
372
|
+
tags: Tags;
|
|
373
|
+
};
|
|
260
374
|
constructor(method: M, url: K, meta: McpRouteMetaRuntime);
|
|
261
375
|
}
|
|
262
376
|
/**
|
|
@@ -316,7 +430,31 @@ export declare class McpRouter<R = McpRoutes> {
|
|
|
316
430
|
* can reach nothing a direct request carrying the same values could not.
|
|
317
431
|
*/
|
|
318
432
|
credentials?(call: McpCallContext): McpCredentials | undefined | Promise<McpCredentials | undefined>;
|
|
319
|
-
|
|
433
|
+
/**
|
|
434
|
+
* A path param the model names in its own terms, for `params` (#767).
|
|
435
|
+
*
|
|
436
|
+
* ```ts
|
|
437
|
+
* params: {
|
|
438
|
+
* pageId: this.param({
|
|
439
|
+
* as: "page",
|
|
440
|
+
* input: s.string().nullable().describe("A page path, like /about, or null for this chat's page"),
|
|
441
|
+
* bind: (path, _req, { ctx }) => pageIdFor(ctx, path),
|
|
442
|
+
* }),
|
|
443
|
+
* }
|
|
444
|
+
* ```
|
|
445
|
+
*
|
|
446
|
+
* The tool's input schema has `page`, described as written, and no `pageId`.
|
|
447
|
+
* `bind` gets the model's value, parsed and typed by `input`, and answers the
|
|
448
|
+
* segment; a `McpToolError` it throws reaches the model. The answer is then
|
|
449
|
+
* treated exactly as a model-supplied segment would be: encoded as one
|
|
450
|
+
* segment and dispatched through the route's own middleware, which decides
|
|
451
|
+
* whether the caller may reach it.
|
|
452
|
+
*
|
|
453
|
+
* The result is plain data and can be shared by several tools: declare it as
|
|
454
|
+
* a field above `routes` and use it in each.
|
|
455
|
+
*/
|
|
456
|
+
param<S extends AnySchema, const As extends string | undefined = undefined>(options: McpModelParamOptions<S, As>): McpModelParam<Infer<S>, As>;
|
|
457
|
+
fromApiRoute<M extends McpMethod, K extends keyof RoutesOf<R>[M] & string, I extends AnySchema | undefined = undefined, O extends AnySchema | undefined = undefined, const P extends Record<string, McpParamDeclaration> = {}, const F extends Record<string, McpFileBinder | "input"> = {}, const T extends readonly string[] = readonly [], RR = never>(method: M, url: K, meta: McpRouteMeta<RoutesOf<R>[M][K], K, I, O, P, F, T, RR>): McpRouteDeclaration<M, K, McpToolInput<I, K, P, F>, McpToolOutput<RoutesOf<R>[M][K], O, RR>, T>;
|
|
320
458
|
}
|
|
321
459
|
export {};
|
|
322
460
|
//# sourceMappingURL=McpRouter.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"McpRouter.d.ts","sourceRoot":"","sources":["../../http/McpRouter.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,WAAW,EAAE,MAAM,aAAa,CAAC;AAC/C,OAAO,KAAK,EAAE,SAAS,EAAE,KAAK,EAAE,MAAM,EAAE,MAAM,cAAc,CAAC;AAC7D,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,iBAAiB,CAAC;AACjD,OAAO,KAAK,EAAE,cAAc,EAAE,cAAc,EAAE,MAAM,6BAA6B,CAAC;AAClF,OAAO,KAAK,EAAE,gBAAgB,EAAE,MAAM,aAAa,CAAC;AACpD,OAAO,KAAK,EAAE,WAAW,EAAE,MAAM,eAAe,CAAC;AAEjD;;;;;;;;;;GAUG;AACH,MAAM,WAAW,SAAS;CAAG;AAE7B,sFAAsF;AACtF,MAAM,MAAM,SAAS,GAAG,KAAK,GAAG,MAAM,GAAG,KAAK,GAAG,OAAO,GAAG,QAAQ,CAAC;AAEpE;;;;;;;;;;;;;;;;;;;;;;;;GAwBG;AACH,MAAM,MAAM,cAAc,GAAG,CAC3B,GAAG,EAAE,WAAW,CAAC,GAAG,EAAE,GAAG,CAAC,EAC1B,IAAI,EAAE,cAAc,KACjB,MAAM,GAAG,MAAM,GAAG,OAAO,CAAC,MAAM,GAAG,MAAM,CAAC,CAAC;AAEhD;;;;;;;GAOG;AACH,MAAM,MAAM,aAAa,GAAG,CAC1B,GAAG,EAAE,WAAW,EAChB,IAAI,EAAE,cAAc,KACjB,MAAM,GAAG,SAAS,GAAG,OAAO,CAAC,M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;IAI9B,YAAY,CACV,CAAC,SAAS,SAAS,EACnB,CAAC,SAAS,MAAM,QAAQ,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,GAAG,MAAM,EACvC,CAAC,SAAS,SAAS,GAAG,SAAS,GAAG,SAAS,EAC3C,CAAC,SAAS,SAAS,GAAG,SAAS,GAAG,SAAS,EAC3C,KAAK,CAAC,CAAC,SAAS,MAAM,CAAC,MAAM,EAAE,mBAAmB,CAAC,GAAG,EAAE,EACxD,KAAK,CAAC,CAAC,SAAS,MAAM,CAAC,MAAM,EAAE,aAAa,GAAG,OAAO,CAAC,GAAG,EAAE,EAC5D,KAAK,CAAC,CAAC,SAAS,SAAS,MAAM,EAAE,GAAG,SAAS,EAAE,EAC/C,EAAE,GAAG,KAAK,EAEV,MAAM,EAAE,CAAC,EACT,GAAG,EAAE,CAAC,EACN,IAAI,EAAE,YAAY,CAAC,QAAQ,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,EAAE,CAAC,EAAE,CAAC,EAAE,CAAC,EAAE,CAAC,EAAE,CAAC,EAAE,CAAC,EAAE,EAAE,CAAC,GAC1D,mBAAmB,CACpB,CAAC,EACD,CAAC,EACD,YAAY,CAAC,CAAC,EAAE,CAAC,EAAE,CAAC,EAAE,CAAC,CAAC,EACxB,aAAa,CAAC,QAAQ,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,EAAE,CAAC,EAAE,EAAE,CAAC,EACvC,CAAC,CACF;CAGF"}
|
package/dist/http/index.d.ts
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
export { Controller, ResourceController } from "./Controller";
|
|
2
2
|
export { ApiRouter, type CreateRPC } from "./ApiRouter";
|
|
3
|
-
export { McpRouter, McpRouteDeclaration, type McpFileBinder, type McpMethod, type McpParamBinder, type McpRouteMeta, type McpRoutes, } from "./McpRouter";
|
|
3
|
+
export { McpRouter, McpRouteDeclaration, type McpFileBinder, type McpMethod, McpModelParam, type McpModelParamOptions, type McpModelParamResolver, type McpParamBinder, type McpParamDeclaration, type McpRouteMeta, type McpRoutes, type McpToolInput, type McpToolOutput, } from "./McpRouter";
|
|
4
4
|
export { createFileResponse, ViewRouter, type CreateViewRPC, type FileOutput, type ViewHandler, } from "./ViewRouter";
|
|
5
5
|
export { toMiddlewareList, type MiddlewareInput } from "./middlewareList";
|
|
6
6
|
export { createStreamResponse, createUnsatisfiableResponse, type StreamOutput, type StreamDescriptor, type StreamReadResult, } from "./createStreamResponse";
|
package/dist/http/index.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../http/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,UAAU,EAAE,kBAAkB,EAAE,MAAM,cAAc,CAAC;AAC9D,OAAO,EAAE,SAAS,EAAE,KAAK,SAAS,EAAE,MAAM,aAAa,CAAC;AACxD,OAAO,EACL,SAAS,EACT,mBAAmB,EACnB,KAAK,aAAa,EAClB,KAAK,SAAS,EACd,KAAK,cAAc,EACnB,KAAK,YAAY,EACjB,KAAK,SAAS,
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../http/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,UAAU,EAAE,kBAAkB,EAAE,MAAM,cAAc,CAAC;AAC9D,OAAO,EAAE,SAAS,EAAE,KAAK,SAAS,EAAE,MAAM,aAAa,CAAC;AACxD,OAAO,EACL,SAAS,EACT,mBAAmB,EACnB,KAAK,aAAa,EAClB,KAAK,SAAS,EACd,aAAa,EACb,KAAK,oBAAoB,EACzB,KAAK,qBAAqB,EAC1B,KAAK,cAAc,EACnB,KAAK,mBAAmB,EACxB,KAAK,YAAY,EACjB,KAAK,SAAS,EACd,KAAK,YAAY,EACjB,KAAK,aAAa,GACnB,MAAM,aAAa,CAAC;AACrB,OAAO,EACL,kBAAkB,EAClB,UAAU,EACV,KAAK,aAAa,EAClB,KAAK,U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CAAC;AAC/B,OAAO,EAAE,cAAc,EAAE,MAAM,kBAAkB,CAAC;AAElD,OAAO,EAAE,uBAAuB,EAAE,MAAM,2BAA2B,CAAC;AACpE,OAAO,EAAE,QAAQ,EAAE,MAAM,UAAU,CAAC;AAEpC,OAAO,EACL,mBAAmB,EACnB,kBAAkB,EAClB,iBAAiB,EACjB,4BAA4B,EAC5B,wBAAwB,GACzB,MAAM,UAAU,CAAC"}
|
package/dist/http/index.js
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
1
|
// @bun
|
|
2
|
-
import{Ac as H,
|
|
2
|
+
import{Ac as H,Bc as I,Gd as J,Hd as K,Id as L,Jd as M,Kd as N,Ld as O,gc as n,hc as o,ic as p,jc as v,kc as w,lc as x,mc as y,oc as z,pc as A,qc as B,rc as C,sc as D,tc as E,uc as F,zc as G}from"../chunk-mp3sxvcv.js";import"../chunk-b0jpvp5t.js";import"../chunk-22k4b395.js";import{Ne as a,Oe as b,Pe as d,Te as e,Ue as f,Ve as g,We as h,Xe as i,Ye as j,bf as k,cf as l,gf as m,hf as q,if as r,jf as s,kf as t,lf as u}from"../chunk-3cxbvrts.js";import{Af as c}from"../chunk-j9deswmn.js";import"../chunk-ayss2f8c.js";import"../chunk-5dwtmkk8.js";import"../chunk-xxkk60aw.js";import"../chunk-fcsq613t.js";import"../chunk-v4exgqbp.js";import"../chunk-st0d3ndv.js";import"../chunk-4f7n1r02.js";import"../chunk-xnggfm0s.js";import"../chunk-0fney17e.js";import"../chunk-ma5rmcbe.js";import"../chunk-3m93v7bt.js";import"../chunk-1xzdexbq.js";export{g as toRangeHeaderValue,n as toMiddlewareList,f as resolveRange,e as parseRangeHeader,h as parseContentRange,F as middlewareConfigDefaults,A as httpError,d as getCookies,j as formatUnsatisfiedContentRange,i as formatContentRange,E as defineMiddlewareConfig,o as createUnsatisfiableResponse,p as createStreamResponse,B as createFileResponse,I as clientIp,C as ViewRouter,k as ValidationError,b as ResourceController,c as RequestBreakerError,H as RateLimitMiddleware,G as RateLimitExceededError,s as RangeNotSatisfiableError,N as PoliciesServiceProvider,O as Policies,D as Middleware,y as McpRouter,x as McpRouteDeclaration,w as McpModelParam,l as InvalidValidationRuleError,r as InsufficientPermissionsError,z as HttpResponse,m as HttpRequest,t as FileNotFoundError,L as CorsMiddleware,a as Controller,K as CacheMiddleware,M as CSRFMiddleware,q as AuthorizationError,J as AuthenticationMiddleware,u as AuthenticationError,v as ApiRouter};
|
|
3
3
|
|
|
4
|
-
//# debugId=
|
|
4
|
+
//# debugId=4F2BECB707D07B5C64756E2164756E21
|
package/dist/http/index.js.map
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
1
|
// @bun
|
|
2
|
-
import{aa as y,ba as p}from"../chunk-
|
|
2
|
+
import{aa as y,ba as p}from"../chunk-sedwjgvf.js";import{qa as c,ra as d,ta as l}from"../chunk-9a8qz3s7.js";import{ng as e,og as i,qg as t,rg as r,sg as o,tg as n,ug as a,vg as s}from"../chunk-v4exgqbp.js";import"../chunk-1xzdexbq.js";export{o as setActiveLocale,r as seedDictionaries,t as preloadDictionaries,d as localeStrings,i as loadDictionary,n as getActiveLocale,e as dictionaryRegistrationMark,c as dictionaryLocales,l as dictionaryId,y as defineDictionary,s as createDictionarySink,a as __resetDictionaryRegistry,p as __gemi_dict__};
|
|
3
3
|
|
|
4
|
-
//# debugId=
|
|
4
|
+
//# debugId=A01D4EB3CAF77D8864756E2164756E21
|
package/dist/i18n/index.js
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
1
|
// @bun
|
|
2
|
-
import{aa as w}from"../chunk-
|
|
2
|
+
import{aa as w}from"../chunk-sedwjgvf.js";import"../chunk-9a8qz3s7.js";import{Wa as b}from"../chunk-f2n21fef.js";import{dc as R,ec as S}from"../chunk-zm00crsx.js";import"../chunk-7kedxtbp.js";import{Nc as j}from"../chunk-mp3sxvcv.js";import"../chunk-b0jpvp5t.js";import"../chunk-22k4b395.js";import"../chunk-3cxbvrts.js";import"../chunk-j9deswmn.js";import"../chunk-ayss2f8c.js";import"../chunk-5dwtmkk8.js";import"../chunk-xxkk60aw.js";import"../chunk-fcsq613t.js";import"../chunk-v4exgqbp.js";import"../chunk-st0d3ndv.js";import{Eg as X,Fg as E,Gg as V,Hg as L}from"../chunk-4f7n1r02.js";import"../chunk-xnggfm0s.js";import"../chunk-0fney17e.js";import"../chunk-ma5rmcbe.js";import"../chunk-3m93v7bt.js";import"../chunk-1xzdexbq.js";import{createElement as J,Fragment as M,isValidElement as U}from"react";function $(q,B){let G=Object.values(B).some((z)=>typeof z==="function"&&U(z(""))),Q=/{{([^{}]+?)(?::([^{}\[\]]+?))?(?:\[(.*?)\])?}}/g;if(!G)return q.replace(Q,(W,O,_,Z)=>{let C=O.includes(":")?O.split(":")[0]:O,H=B[C];if(H===void 0)return W;if(typeof H==="function"){let K=H(Z!==void 0?Z:"");if(U(K))throw Error("JSX returned in string context");return String(K)}if(_)switch(_.toLowerCase()){case"number":return Number(H).toString();case"string":return String(H);case"boolean":return Boolean(H).toString();default:return String(H)}return String(H)});else{let z=[],W=0,O=null;while((O=Q.exec(q))!==null){let[_,Z,C,H]=O,F=O.index,K=Z.includes(":")?Z.split(":")[0]:Z;if(F>W)z.push(q.substring(W,F));let Y=B[K];if(Y===void 0)z.push(_);else if(typeof Y==="function"){let A=Y(H!==void 0?H:"");z.push(A)}else if(C)switch(C.toLowerCase()){case"number":z.push(Number(Y).toString());break;case"string":z.push(String(Y));break;case"boolean":z.push(Boolean(Y).toString());break;default:z.push(String(Y))}else z.push(String(Y));W=F+_.length}if(W<q.length)z.push(q.substring(W));return J(M,{},...z)}}class P{name;dictionary;constructor(q,B){this.name=q;this.dictionary=B}reference(q){if(typeof window<"u")throw Error("Cannot use reference in the browser");if(!this.dictionary?.[q])throw Error(`Translation not found for ${String(q)}`);return this.dictionary[q]}render(q,...B){let{locale:G=j.locale(),params:Q}={params:{},...B[0]};if(typeof window<"u")throw Error("Cannot use render in the browser");if(!this.dictionary?.[q]?.[G])throw Error(`Translation not found for ${String(q)} in ${String(G)}`);return $(this.dictionary[q][G],Q??{})}static create(q,B){return new P(q,B)}static text(q,...B){let{locale:G=j.locale(),params:Q}={params:{},...B?.[0]};if(!q?.[G])throw Error(`Translation not found for ${String(G)}`);return $(q[G],Q??{})}}async function N(q,B,...G){let{locale:Q=j.locale(),params:z}={params:{},...G[0]},O=(await q.load(String(Q)))[B];if(typeof O!=="string")throw Error(`Translation not found for "${B}" in "${String(Q)}" (dictionary ${q.id})`);return $(O,z??{})}export{S as translationConfigDefaults,N as translate,E as isValidTimeZone,R as defineTranslationConfig,w as defineDictionary,V as createFormatter,L as Translator,b as TranslationServiceProvider,P as Dictionary,X as DEFAULT_TIME_ZONE};
|
|
3
3
|
|
|
4
|
-
//# debugId=
|
|
4
|
+
//# debugId=6EBD0BD09D520AA564756E2164756E21
|
package/dist/i18n/index.js.map
CHANGED
|
@@ -7,6 +7,6 @@
|
|
|
7
7
|
"import { Lang } from \"../facades\";\nimport { parseTranslation } from \"../utils/parseTranslation\";\nimport type { ParseTranslationParamsServer, Prettify } from \"../utils/type\";\nimport type { DictionaryHandle } from \"./defineDictionary\";\nimport type { DictionaryTranslations } from \"./dictionaryShape\";\n\n/**\n * Read one string from a `defineDictionary` dictionary outside React — a\n * controller, a job, an email template.\n *\n * Async because a bundled dictionary loads its locale on demand. Server code\n * does not go through the bundler, so in practice this resolves without ever\n * yielding; the `await` is what makes the same call work either way.\n *\n * Kept out of `defineDictionary.ts` on purpose: that module is imported by\n * components and has to stay free of the server facades this one needs.\n */\nexport async function translate<\n T extends DictionaryTranslations,\n K extends keyof T & string,\n U extends keyof T[K],\n R = Prettify<ParseTranslationParamsServer<T[K][U] & string>>,\n>(\n dictionary: DictionaryHandle<T>,\n key: K,\n ...args: R extends Record<string, never>\n ? [args?: { locale?: U | (string & {}) }]\n : [args: { locale?: U | (string & {}); params: R }]\n): Promise<string> {\n const { locale = Lang.locale(), params } = { params: {}, ...args[0] };\n const strings = await dictionary.load(String(locale));\n const template = strings[key];\n\n if (typeof template !== \"string\") {\n throw new Error(\n `Translation not found for \"${key}\" in \"${String(locale)}\" (dictionary ${dictionary.id})`,\n );\n }\n\n return parseTranslation(template, (params ?? {}) as any) as string;\n}\n"
|
|
8
8
|
],
|
|
9
9
|
"mappings": ";w0BAAA,mBAAS,SAAe,eAAU,SAO3B,IAAS,JAAgB,JAAC,HAAkB,HAAwB,JAEzE,DAAM,HAAS,EAAO,EAAO,JAAM,HAAE,AACnC,JAAC,DACC,EAAO,DAAU,YACjB,EAAgB,EAAkC,EAAE,CAAC,CACzD,EAMM,EAAQ,kDAEd,GAAI,CAAC,EAqCH,OAnCe,EAAS,QAAQ,EAAO,CAAC,EAAO,EAAM,EAAM,IAAY,CAErE,IAAM,EAAY,EAAK,SAAS,GAAG,EAAI,EAAK,MAAM,GAAG,EAAE,GAAK,EAEtD,EAAQ,EAAO,GACrB,GAAI,IAAU,OACZ,OAAO,EAGT,GAAI,OAAO,IAAU,WAAY,CAG/B,IAAM,EAAiB,EADD,IAAY,OAAY,EAAU,EACd,EAE1C,GAAI,EAAe,CAAc,EAC/B,MAAU,MAAM,gCAAgC,EAElD,OAAO,OAAO,CAAc,EAI9B,GAAI,EACF,OAAQ,EAAK,YAAY,OAClB,SACH,OAAO,OAAO,CAAK,EAAE,SAAS,MAC3B,SACH,OAAO,OAAO,CAAK,MAChB,UACH,OAAO,QAAQ,CAAK,EAAE,SAAS,UAE/B,OAAO,OAAO,CAAK,EAGzB,OAAO,OAAO,CAAK,EACpB,EAEI,KAEL,IAAM,EAAqC,CAAC,EACxC,EAAY,EACZ,EAAgC,KAEpC,OAAQ,EAAQ,EAAM,KAAK,CAAQ,KAAO,KAAM,CAC9C,IAAO,EAAW,EAAM,EAAM,GAAW,EACnC,EAAa,EAAM,MAGnB,EAAY,EAAK,SAAS,GAAG,EAAI,EAAK,MAAM,GAAG,EAAE,GAAK,EAG5D,GAAI,EAAa,EACf,EAAM,KAAK,EAAS,UAAU,EAAW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AY,QAGtC,KAA+D,CACpE,KACG,EAWK,CACR,IAAQ,SAAS,EAAK,OAAO,EAAG,UAAW,CAAE,OAAQ,CAAC,KAAM,IAAO,EAAG,EAEtE,GAAI,CAAC,IAAU,GACb,MAAU,MAAM,6BAA6B,OAAO,CAAM,GAAG,EAG/D,OAAO,EAAiB,EAAQ,GAAS,GAAU,CAAC,CAAC,EAEzD,CC7EA,eAAsB,CAKrB,CACC,EACA,KACG,EAGc,CACjB,IAAQ,SAAS,EAAK,OAAO,EAAG,UAAW,CAAE,OAAQ,CAAC,KAAM,EAAK,EAAG,EAE9D,GADU,MAAM,EAAW,KAAK,OAAO,CAAM,CAAC,GAC3B,GAEzB,GAAI,OAAO,IAAa,SACtB,MAAU,MACR,8BAA8B,UAAY,OAAO,CAAM,kBAAkB,EAAW,KACtF,EAGF,OAAO,EAAiB,EAAW,GAAU,CAAC,CAAS",
|
|
10
|
-
"debugId": "
|
|
10
|
+
"debugId": "6EBD0BD09D520AA564756E2164756E21",
|
|
11
11
|
"names": []
|
|
12
12
|
}
|
package/dist/kernel/index.js
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
// @bun
|
|
2
|
-
import{ya as y}from"../chunk-
|
|
2
|
+
import{ya as y}from"../chunk-jfnhzza6.js";import{Va as i}from"../chunk-bsq80942.js";import{Wa as g}from"../chunk-f2n21fef.js";import{$a as e,Za as T,_a as D,ab as A,bb as w,fb as P,gb as S,ib as h,jb as R,kb as u,lb as l,ob as v,pb as d,sb as c,vb as p,yb as n}from"../chunk-7y2y8rxx.js";import"../chunk-wc46df4w.js";import"../chunk-b1dqx3b9.js";import{_b as r}from"../chunk-18aqqrev.js";import"../chunk-zm00crsx.js";import"../chunk-7kedxtbp.js";import{Ad as C,Bd as m,Cd as Q,Dd as t,Ed as o,Gc as Zj,Hc as $j,Kc as Gj,Lc as Hj,od as x,td as I,ud as E,xd as K,yd as M,zd as s}from"../chunk-mp3sxvcv.js";import{Pd as a}from"../chunk-b0jpvp5t.js";import{ae as V,fe as f}from"../chunk-22k4b395.js";import{gf as F}from"../chunk-3cxbvrts.js";import{zf as B}from"../chunk-j9deswmn.js";import{Ff as L}from"../chunk-ayss2f8c.js";import"../chunk-5dwtmkk8.js";import"../chunk-xxkk60aw.js";import"../chunk-fcsq613t.js";import"../chunk-v4exgqbp.js";import"../chunk-st0d3ndv.js";import"../chunk-zhk3z9zk.js";import"../chunk-4f7n1r02.js";import{Ig as _,Kg as N,Lg as b}from"../chunk-xnggfm0s.js";import"../chunk-0fney17e.js";import"../chunk-yxh4xs3k.js";import"../chunk-ma5rmcbe.js";import{Yg as q}from"../chunk-3m93v7bt.js";import"../chunk-1xzdexbq.js";function Jj(j){let X=j.headers.get("Cache-Control")?.toLowerCase()??"";return/(^|[\s,])(public|s-maxage)\b/.test(X)}var Wj=new Set,Xj={refusal:null,apply:(j)=>j,carried:null};async function k(j){let X=b(x);if(X.config.global.length===0)return Xj;let{pathname:Z}=new URL(j.url),W=q(Z),z=new F(j,{},W?"api":"view","");return await L.run(z,async()=>{let $=L.getStore(),{headers:H,cookies:zj}=$,Y=(J)=>{if(!Jj(J))return Q(J,H,zj);let G=new Headers(H);return G.delete("Set-Cookie"),Q(J,G,Wj)};try{return await X.runGlobalMiddleware(),{refusal:null,apply:Y,carried:{user:$.user}}}catch(J){let G=!W&&Z.endsWith(".json");if(J?.kind===B){let O=W?m(J.payload.api):G?M(J.payload.viewData??J.payload.api):K(J.payload.view);return{refusal:Y(O),apply:Y,carried:null}}if(V(J)&&(W||G))return{refusal:Y(C()),apply:Y,carried:null};if(f(J)){console.error(J);let O=W||G?I():K(E());return{refusal:Y(O),apply:Y,carried:null}}throw J}finally{$.destroy()}})}var U=[l,d,y,P,n,A,S,v,R,D,h,p,u,g,c,w];class jj{config={};providers=[];services=[];serviceInstances=[];serviceTokens=new Set;servicesBooted=!1;models=[];app=new N;boot(){if(this.models.length>0)i(...this.models);else Yj();this.app.config.merge(this.config),N.setInstance(this.app),this.app.registerMany([...U,...this.providers]),this.registerServices()}registerServices(){let j=this.serviceTokens;this.serviceInstances=[],this.serviceTokens=new Set,this.servicesBooted=!1;let X=new Map;for(let Z of this.services){let W=typeof Z==="function"?new Z:Z,z=W.constructor;if(!z.token)throw Error(`Service [${z.name}] is listed in \`services\` but does not declare a \`static token\`.`);let $=X.get(z.token);if($)throw Error(`Services [${$}] and [${z.name}] both declare the token "${z.token}". Tokens are the container's keys, so they must be unique.`);X.set(z.token,z.name);let H=z;if(!j.has(z.token)&&this.app.bound(H))throw Error(`Service [${z.name}] declares the token "${z.token}", which is already bound in the container by the framework or a provider. Binding it would replace that service everywhere, so pick a token nothing else owns.`);this.app.instance(H,W),this.serviceInstances.push(W),this.serviceTokens.add(z.token)}}async waitForBoot(){await this.app.boot(),await this.bootServices(),e(this.app)}async bootServices(){if(this.servicesBooted)return;for(let j of this.serviceInstances)await j.boot();this.servicesBooted=!0}shutdown(j){return this.run(()=>this.app.shutdown(j))}run(j){return _.run(this.app,j)}resolve(j){return this.app.make(j)}apiRoutes(){return this.app.make(t)}viewRoutes(){return this.app.make(s)}domains(){return this.app.make(o)}queue(){return this.app.make(r)}globalMiddleware(j){return k(j)}destroy(){if(this.app.resolved(T))this.app.make(T).stop();if(this.app.flush(),N.getInstance()===this.app)N.setInstance(void 0);_.disable()}}function Yj(){if(Bun.env.NODE_ENV==="production")return;let j=a();if(j.length===0)return;console.warn(`[gemi] ${j.length} model${j.length===1?" is":"s are"} registered, but Kernel.models is empty.
|
|
3
3
|
Nested relation reads resolve a model by name, so a policy on a subclass that does not own its
|
|
4
4
|
`+" name is skipped inside every include \u2014 scoped at the root, "+`unscoped in an include, with nothing
|
|
5
5
|
to notice it. Declaring the modules registers each class under its own name and audits the set:
|
|
@@ -13,4 +13,4 @@ import{ya as y}from"../chunk-epwaxctc.js";import{Va as i}from"../chunk-pjg7gqnh.
|
|
|
13
13
|
|
|
14
14
|
See docs/orm.md#your-model-class. Development only; this never prints in production.`)}export{$j as oneTimeSecretMatches,Zj as hashOneTimeSecret,U as frameworkProviders,Hj as UserProvider,Gj as SESSION_SELECT,jj as Kernel};
|
|
15
15
|
|
|
16
|
-
//# debugId=
|
|
16
|
+
//# debugId=6D1A9BD62F3E579364756E2164756E21
|
package/dist/kernel/index.js.map
CHANGED
|
@@ -7,6 +7,6 @@
|
|
|
7
7
|
"import { Application } from \"../foundation/Application\";\nimport type { ServiceProviderConstructor, ShutdownReport } from \"../foundation/Application\";\nimport type { ServiceToken } from \"../container/Container\";\nimport type { ConfigItems } from \"../support/Repository\";\nimport type { Service, ServiceConstructor } from \"../support/Service\";\nimport { registerModels } from \"../orm/registration\";\nimport { registeredNames } from \"../orm/registry\";\nimport { Scheduler } from \"../services/cron/Scheduler\";\nimport { QueueManager } from \"../services/queue/QueueManager\";\nimport { startClaimingIfServing } from \"../services/queue/QueueServiceProvider\";\nimport { ApiRouteDispatcher } from \"../services/router/ApiRouteDispatcher\";\nimport { ViewRouteDispatcher } from \"../services/router/ViewRouteDispatcher\";\nimport { DomainRouter } from \"../services/router/DomainRouter\";\nimport { runGlobalMiddleware } from \"../services/router/globalMiddleware\";\nimport { kernelContext } from \"./context\";\nimport { frameworkProviders } from \"./providers\";\n\n/**\n * The app's entry point into the framework. A Kernel subclass declares what the\n * app adds — its `config` slices and any extra `providers` — and everything\n * else lives in the Application container it owns.\n */\nexport class Kernel {\n /**\n * App-level config, merged over the framework defaults. Each key is a config\n * slice: `{ mail: { ... }, route: { ... } }`, normally the modules under\n * `app/config`.\n */\n protected config: ConfigItems = {};\n\n /**\n * App-level providers, registered after the framework's own so they can\n * rebind anything the framework bound.\n */\n protected providers: ServiceProviderConstructor[] = [];\n\n /**\n * The app's own singleton services. Each is constructed during the\n * synchronous boot phase and its `boot()` awaited during the asynchronous\n * one, in the order listed — so a service whose `boot()` depends on another\n * goes after it.\n *\n * An entry is either the class itself or a configured instance from\n * `Service.with({ ... })`. Listing is explicit rather than discovered because\n * the order is load-bearing here, and because a service is always imported by\n * whatever injects it — there is no file the import graph would miss.\n */\n protected services: Array<ServiceConstructor | Service> = [];\n\n private serviceInstances: Service[] = [];\n private serviceTokens = new Set<string>();\n private servicesBooted = false;\n\n /**\n * The modules holding the app's model classes — normally\n * `[generated, models]`, the generated namespace and the barrel of subclasses\n * written over it. Every model class they export is registered under the name\n * its schema carries, later modules winning, and the whole set is audited\n * before anything else boots.\n *\n * ### Why this is a Kernel field and not a line in a file somewhere\n *\n * Registration used to be `register(\"User\", User)` next to each subclass, and\n * the failure mode of forgetting it is an authorization hole that nothing\n * reports: a relation read resolves its target by name, so an unregistered\n * policied subclass leaves the generated base owning the name and every\n * nested `include` of that model comes back unscoped. No error at the root\n * either, because `$exec`'s divergence guard begins `registered !== this` and\n * the base it is running on *is* the registered one. A model only ever read\n * through an include — a membership, a pivot, the kind that carries a tenant\n * scope — never trips anything.\n *\n * Listing the modules here says it once, in the same place the app already\n * declares its config slices and providers, and turns the mistake into a\n * failure to boot rather than a quiet cross-tenant read.\n *\n * It sees the modules it is given, so a model class in a file that no barrel\n * re-exports is still invisible. That is the residual, and it is a smaller\n * one: a barrel is a place to notice an omission, and thirteen `register`\n * lines scattered across thirteen files is not.\n */\n protected models: Array<Record<string, unknown>> = [];\n\n readonly app = new Application();\n\n /**\n * Phase one, synchronous: every provider is constructed and its `register()`\n * runs. Only bindings are recorded here — no service is instantiated, so this\n * is safe to call from a synchronous constructor (`new App({ kernel })`).\n * Phase two is `waitForBoot()`.\n */\n boot() {\n // Before the container, deliberately. This throws on a model whose policies\n // would be skipped, and the useful moment for that is the one where nothing\n // has been constructed and no request can be in flight.\n if (this.models.length > 0) registerModels(...this.models);\n else warnIfModelsAreRegisteredButUndeclared();\n\n this.app.config.merge(this.config);\n Application.setInstance(this.app);\n this.app.registerMany([...frameworkProviders, ...this.providers]);\n this.registerServices();\n }\n\n /**\n * Constructs every listed service and binds it into the container. Runs after\n * the providers have registered, so a provider's `boot()` can `inject()` one;\n * a `Service` constructor does no I/O, so doing this synchronously costs\n * nothing beyond the field initializers.\n */\n private registerServices() {\n // What a previous pass bound, so re-running this on the same kernel is not\n // mistaken for a collision with something else.\n const ours = this.serviceTokens;\n\n this.serviceInstances = [];\n this.serviceTokens = new Set();\n this.servicesBooted = false;\n\n const owners = new Map<string, string>();\n\n for (const declaration of this.services) {\n const instance =\n typeof declaration === \"function\" ? new declaration() : declaration;\n const ctor = instance.constructor as ServiceConstructor;\n\n if (!ctor.token) {\n throw new Error(\n `Service [${ctor.name}] is listed in \\`services\\` but does not declare a \\`static token\\`.`,\n );\n }\n\n // Two services under one token is the failure this refuses to have\n // silently: the second would replace the first in the container, and\n // every `inject()` written against either would hand back whichever was\n // listed last.\n const owner = owners.get(ctor.token);\n if (owner) {\n throw new Error(\n `Services [${owner}] and [${ctor.name}] both declare the token \"${ctor.token}\". Tokens are the container's keys, so they must be unique.`,\n );\n }\n owners.set(ctor.token, ctor.name);\n\n // The same failure one level out. `Container.instance()` writes into\n // `instances`, which `make()` consults before `bindings`, so a token that\n // is already spoken for is not shared with its owner — it replaces it, for\n // every `app()` and `inject()` in the process. An app service that named\n // itself \"mail\" would leave `Mail.send()` resolving to an object with no\n // `send`, and the boot that caused it would report nothing. Providers have\n // all registered by now, so anything bound here belongs to somebody else.\n const token = ctor as unknown as ServiceToken<Service>;\n if (!ours.has(ctor.token) && this.app.bound(token)) {\n throw new Error(\n `Service [${ctor.name}] declares the token \"${ctor.token}\", which is already bound in the container by the framework or a provider. Binding it would replace that service everywhere, so pick a token nothing else owns.`,\n );\n }\n\n this.app.instance(token, instance);\n this.serviceInstances.push(instance);\n this.serviceTokens.add(ctor.token);\n }\n }\n\n /**\n * Phase two, asynchronous: every provider's `boot()` runs, in registration\n * order, after all of them have registered. Idempotent.\n */\n async waitForBoot() {\n await this.app.boot();\n await this.bootServices();\n // Last, once every job — queued listeners included — is registered.\n startClaimingIfServing(this.app);\n }\n\n /**\n * Phase two for services, after every provider's `boot()` — so a service may\n * use the facades and anything else a provider owns. Idempotent, like the\n * provider phase it follows.\n */\n private async bootServices() {\n if (this.servicesBooted) {\n return;\n }\n for (const service of this.serviceInstances) {\n await service.boot();\n }\n this.servicesBooted = true;\n }\n\n /**\n * Every provider's `shutdown()`, in reverse registration order, inside the\n * application context — so a hook may use the facades, as a cron tick or a\n * request would. See `Application.shutdown` for the deadline and the\n * report. Idempotent.\n */\n shutdown(options?: { timeoutMs?: number }): Promise<ShutdownReport> {\n return this.run(() => this.app.shutdown(options));\n }\n\n run<T>(cb: () => T) {\n return kernelContext.run(this.app, cb);\n }\n\n /**\n * Resolve a service by token. Callers outside this module should prefer the\n * named accessors below or `app()`; this exists for tooling that holds a\n * Kernel but no ambient context.\n */\n resolve<T>(token: ServiceToken<T>): T {\n return this.app.make(token);\n }\n\n // Named accessors. `app/App.ts` goes through these rather than importing the\n // service classes itself — see the note in that file about the two copies of\n // gemi that coexist at build time.\n apiRoutes(): ApiRouteDispatcher {\n return this.app.make(ApiRouteDispatcher);\n }\n\n viewRoutes(): ViewRouteDispatcher {\n return this.app.make(ViewRouteDispatcher);\n }\n\n domains(): DomainRouter {\n return this.app.make(DomainRouter);\n }\n\n queue(): QueueManager {\n return this.app.make(QueueManager);\n }\n\n /** The `global` middleware list for one request. Call it inside `run`. */\n globalMiddleware(req: Request) {\n return runGlobalMiddleware(req);\n }\n\n destroy() {\n // Only touch services that were actually resolved — resolving one here\n // would construct it purely to tear it down.\n if (this.app.resolved(Scheduler)) {\n this.app.make(Scheduler).stop();\n }\n\n this.app.flush();\n\n if (Application.getInstance() === this.app) {\n Application.setInstance(undefined);\n }\n\n kernelContext.disable();\n }\n}\n\n/**\n * Says something to an application that has models and has not declared them.\n *\n * Without this the fix for #316 defaults to off. `models` is `[]`, `boot()`\n * no-ops, and an app upgrading from 0.48 is in exactly the state the issue\n * describes until somebody edits their Kernel by hand — while the only place\n * that says to is the **Setup** section of `docs/orm.md`, which an existing app\n * read once and will not read again. #316 was filed by an app mid-migration\n * with a 79-model schema, which is precisely the reader who never sees it.\n *\n * The condition is what makes this worth printing. A populated registry with an\n * empty `models` means the generated `index.ts` was imported and its bases are\n * what every nested read resolves to — so if any policy lives on a subclass, it\n * is being skipped inside includes right now. A Kernel with no ORM at all has\n * an empty registry and hears nothing.\n *\n * Development only, and a warning rather than a throw: an app in this state is\n * running today, and turning a working deploy into a failure to start over an\n * arrangement that *might* be fine is not a patch-level thing to do. The\n * failure it points at is silent, so the fix for it has to be noisy somewhere,\n * and the terminal an author is already looking at is the cheapest somewhere\n * there is.\n */\nfunction warnIfModelsAreRegisteredButUndeclared(): void {\n if (process.env.NODE_ENV === \"production\") return;\n\n const registered = registeredNames();\n if (registered.length === 0) return;\n\n console.warn(\n `[gemi] ${registered.length} model${registered.length === 1 ? \" is\" : \"s are\"} ` +\n `registered, but Kernel.models is empty.\\n` +\n ` Nested relation reads resolve a model by name, so a policy on a ` +\n `subclass that does not own its\\n` +\n ` name is skipped inside every include — scoped at the root, ` +\n `unscoped in an include, with nothing\\n` +\n ` to notice it. Declaring the modules registers each class under ` +\n `its own name and audits the set:\\n\\n` +\n ` import * as generated from \"../models/generated\"\\n` +\n ` import * as models from \"../models\"\\n\\n` +\n ` export default class extends Kernel {\\n` +\n ` models = [generated, models]\\n` +\n ` }\\n\\n` +\n ` See docs/orm.md#your-model-class. Development only; this never ` +\n `prints in production.`,\n );\n}\n"
|
|
8
8
|
],
|
|
9
9
|
"mappings": ";g2CAqCA,IAAS,HAAe,JAAC,HAAoB,JAC3C,DAAM,HAAe,HAAS,GAAQ,DAAI,UAAe,FAAG,OAAY,FAAK,FAC7E,CAAO,0BAA+B,AAAK,JAAY,HAGzD,DAAM,FAAY,DAAI,DAEhB,FAAuC,JAC3C,GAAS,KACT,MAAO,CAAC,IAAa,EACrB,QAAS,IACX,EA8BA,eAAsB,CAAmB,CAAC,EAAgD,CACxF,IAAM,EAAW,EAAI,CAAkB,EACvC,GAAI,EAAS,OAAO,OAAO,SAAW,EACpC,OAAO,GAGT,IAAQ,YAAa,IAAI,IAAI,EAAI,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