gemi 0.113.0 → 0.114.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/index.js +32 -32
- package/dist/ai/index.js.map +3 -5
- package/dist/app/App.d.ts.map +1 -1
- package/dist/app/index.js +1 -1
- package/dist/bin/gemi.js +8 -1
- package/dist/bin/gemi.js.map +3 -3
- package/dist/bun/plugin.js +1 -1
- package/dist/bun/preload.js +1 -1
- package/dist/chunk-0n9vs1ad.js +14 -0
- package/dist/{chunk-cqnfp0n9.js.map → chunk-0n9vs1ad.js.map} +4 -4
- package/dist/{chunk-68s1f5d5.js → chunk-1f9sqht5.js} +2 -2
- package/dist/{chunk-68s1f5d5.js.map → chunk-1f9sqht5.js.map} +1 -1
- package/dist/{chunk-qt8nvpqp.js → chunk-1p0dazvk.js} +2 -2
- package/dist/{chunk-qt8nvpqp.js.map → chunk-1p0dazvk.js.map} +1 -1
- package/dist/{chunk-3f1kq32g.js → chunk-2rphhsr7.js} +2 -2
- package/dist/{chunk-3f1kq32g.js.map → chunk-2rphhsr7.js.map} +1 -1
- package/dist/{chunk-qx87cdfg.js → chunk-2z1981d0.js} +2 -2
- package/dist/{chunk-qx87cdfg.js.map → chunk-2z1981d0.js.map} +1 -1
- package/dist/{chunk-zng3qexn.js → chunk-329ggbcw.js} +2 -2
- package/dist/{chunk-zng3qexn.js.map → chunk-329ggbcw.js.map} +1 -1
- package/dist/{chunk-v4gwmhtf.js → chunk-37qk5dh8.js} +2 -2
- package/dist/{chunk-v4gwmhtf.js.map → chunk-37qk5dh8.js.map} +1 -1
- package/dist/{chunk-7jnpnjth.js → chunk-3ma9m432.js} +2 -2
- package/dist/{chunk-7jnpnjth.js.map → chunk-3ma9m432.js.map} +1 -1
- package/dist/{chunk-fnkjmq94.js → chunk-4szjp84e.js} +2 -2
- package/dist/{chunk-fnkjmq94.js.map → chunk-4szjp84e.js.map} +1 -1
- package/dist/{chunk-fr0arqdj.js → chunk-56fgk5rq.js} +2 -2
- package/dist/{chunk-fr0arqdj.js.map → chunk-56fgk5rq.js.map} +1 -1
- package/dist/{chunk-y6v0x869.js → chunk-583vxa2v.js} +2 -2
- package/dist/{chunk-y6v0x869.js.map → chunk-583vxa2v.js.map} +1 -1
- package/dist/{chunk-vqa3agzw.js → chunk-5j76r5q8.js} +3 -3
- package/dist/{chunk-vqa3agzw.js.map → chunk-5j76r5q8.js.map} +1 -1
- package/dist/chunk-60nyk1w8.js +10 -0
- package/dist/chunk-60nyk1w8.js.map +38 -0
- package/dist/{chunk-vwprq300.js → chunk-6h9j3f1x.js} +2 -2
- package/dist/{chunk-vwprq300.js.map → chunk-6h9j3f1x.js.map} +1 -1
- package/dist/{chunk-r7b12dmm.js → chunk-75wk4jxd.js} +2 -2
- package/dist/{chunk-r7b12dmm.js.map → chunk-75wk4jxd.js.map} +1 -1
- package/dist/{chunk-de03dewf.js → chunk-7fwp7vwh.js} +2 -2
- package/dist/{chunk-de03dewf.js.map → chunk-7fwp7vwh.js.map} +1 -1
- package/dist/{chunk-9vsj0ksk.js → chunk-7rmjr8p7.js} +3 -3
- package/dist/{chunk-9vsj0ksk.js.map → chunk-7rmjr8p7.js.map} +1 -1
- package/dist/{chunk-atmzm0z3.js → chunk-7v8sgqen.js} +2 -2
- package/dist/{chunk-atmzm0z3.js.map → chunk-7v8sgqen.js.map} +1 -1
- package/dist/{chunk-4t1pbt9p.js → chunk-8c2fs0n0.js} +3 -3
- package/dist/{chunk-4t1pbt9p.js.map → chunk-8c2fs0n0.js.map} +1 -1
- package/dist/{chunk-vzf5pbx3.js → chunk-8h7dh2h2.js} +2 -2
- package/dist/{chunk-vzf5pbx3.js.map → chunk-8h7dh2h2.js.map} +1 -1
- package/dist/{chunk-c7mp2kyp.js → chunk-8k8534kg.js} +2 -2
- package/dist/{chunk-c7mp2kyp.js.map → chunk-8k8534kg.js.map} +1 -1
- package/dist/{chunk-g8kx549d.js → chunk-8rt4wx8z.js} +3 -3
- package/dist/{chunk-g8kx549d.js.map → chunk-8rt4wx8z.js.map} +1 -1
- package/dist/{chunk-bq5nqqeq.js → chunk-a5sbgffr.js} +1 -1
- package/dist/{chunk-szr1k584.js → chunk-ap5gek56.js} +2 -2
- package/dist/{chunk-szr1k584.js.map → chunk-ap5gek56.js.map} +1 -1
- package/dist/{chunk-4tp2cr02.js → chunk-awp3n119.js} +2 -2
- package/dist/{chunk-4tp2cr02.js.map → chunk-awp3n119.js.map} +1 -1
- package/dist/{chunk-5q4a7yqf.js → chunk-cna105t6.js} +2 -2
- package/dist/{chunk-5q4a7yqf.js.map → chunk-cna105t6.js.map} +1 -1
- package/dist/{chunk-rg4hhxj3.js → chunk-d4m4amy4.js} +2 -2
- package/dist/{chunk-rg4hhxj3.js.map → chunk-d4m4amy4.js.map} +1 -1
- package/dist/{chunk-8mbyyh8j.js → chunk-e6fp6dxx.js} +2 -2
- package/dist/{chunk-8mbyyh8j.js.map → chunk-e6fp6dxx.js.map} +1 -1
- package/dist/{chunk-1se4t9rg.js → chunk-e7axa0d5.js} +3 -3
- package/dist/{chunk-1se4t9rg.js.map → chunk-e7axa0d5.js.map} +1 -1
- package/dist/{chunk-9tpx9ag3.js → chunk-erxv1jz7.js} +2 -2
- package/dist/{chunk-9tpx9ag3.js.map → chunk-erxv1jz7.js.map} +1 -1
- package/dist/chunk-fakvf9wb.js +5 -0
- package/dist/{chunk-fsfbyg5e.js.map → chunk-fakvf9wb.js.map} +1 -1
- package/dist/{chunk-nysqgzp1.js → chunk-fv9mr1t4.js} +2 -2
- package/dist/{chunk-nysqgzp1.js.map → chunk-fv9mr1t4.js.map} +1 -1
- package/dist/{chunk-p3zmc8k8.js → chunk-gdmsn3f5.js} +2 -2
- package/dist/{chunk-p3zmc8k8.js.map → chunk-gdmsn3f5.js.map} +1 -1
- package/dist/{chunk-y6frz1vm.js → chunk-gv91vjeb.js} +1 -1
- package/dist/{chunk-5x0aacrn.js → chunk-h2r2rdhj.js} +2 -2
- package/dist/{chunk-5x0aacrn.js.map → chunk-h2r2rdhj.js.map} +1 -1
- package/dist/{chunk-1p85fdrk.js → chunk-h4pazcgg.js} +2 -2
- package/dist/{chunk-1p85fdrk.js.map → chunk-h4pazcgg.js.map} +1 -1
- package/dist/{chunk-mk0rtgd1.js → chunk-hrvzchxd.js} +2 -2
- package/dist/{chunk-mk0rtgd1.js.map → chunk-hrvzchxd.js.map} +1 -1
- package/dist/{chunk-w45agtch.js → chunk-hytt9qyj.js} +2 -2
- package/dist/{chunk-w45agtch.js.map → chunk-hytt9qyj.js.map} +1 -1
- package/dist/{chunk-5nqkwa2w.js → chunk-hz6yzzbz.js} +1 -1
- package/dist/{chunk-z5hrymvn.js → chunk-j3nr4cg0.js} +3 -3
- package/dist/{chunk-z5hrymvn.js.map → chunk-j3nr4cg0.js.map} +1 -1
- package/dist/{chunk-dbwhgyg3.js → chunk-jk97wv0q.js} +2 -2
- package/dist/{chunk-dbwhgyg3.js.map → chunk-jk97wv0q.js.map} +1 -1
- package/dist/{chunk-x5sert1k.js → chunk-jv4g8grc.js} +2 -2
- package/dist/{chunk-x5sert1k.js.map → chunk-jv4g8grc.js.map} +1 -1
- package/dist/{chunk-yyzexrnb.js → chunk-jyrsd1dn.js} +2 -2
- package/dist/{chunk-yyzexrnb.js.map → chunk-jyrsd1dn.js.map} +1 -1
- package/dist/{chunk-y596ghpz.js → chunk-jzp0fs6h.js} +2 -2
- package/dist/{chunk-y596ghpz.js.map → chunk-jzp0fs6h.js.map} +1 -1
- package/dist/{chunk-kz4yp5n7.js → chunk-kcx468qv.js} +2 -2
- package/dist/{chunk-kz4yp5n7.js.map → chunk-kcx468qv.js.map} +1 -1
- package/dist/{chunk-zyer1g7k.js → chunk-kg1nbxvm.js} +4 -4
- package/dist/{chunk-zyer1g7k.js.map → chunk-kg1nbxvm.js.map} +1 -1
- package/dist/{chunk-qpttgn4k.js → chunk-kqb4s1r0.js} +3 -3
- package/dist/{chunk-qpttgn4k.js.map → chunk-kqb4s1r0.js.map} +1 -1
- package/dist/{chunk-rh2fad7n.js → chunk-m17ktssc.js} +1 -1
- package/dist/{chunk-k2fh4r0p.js → chunk-m2yfvwrn.js} +2 -2
- package/dist/{chunk-k2fh4r0p.js.map → chunk-m2yfvwrn.js.map} +1 -1
- package/dist/{chunk-wr3e4sez.js → chunk-mqcy5vja.js} +2 -2
- package/dist/{chunk-wr3e4sez.js.map → chunk-mqcy5vja.js.map} +1 -1
- package/dist/{chunk-f1y8eggf.js → chunk-n672d4g8.js} +2 -2
- package/dist/{chunk-f1y8eggf.js.map → chunk-n672d4g8.js.map} +1 -1
- package/dist/{chunk-xqwdn9kb.js → chunk-nek1gzz2.js} +3 -3
- package/dist/{chunk-xqwdn9kb.js.map → chunk-nek1gzz2.js.map} +1 -1
- package/dist/{chunk-01qd6xx3.js → chunk-pmywkp1w.js} +3 -3
- package/dist/{chunk-01qd6xx3.js.map → chunk-pmywkp1w.js.map} +1 -1
- package/dist/chunk-q95k1ymq.js +4 -0
- package/dist/{chunk-kp7k4s5c.js.map → chunk-q95k1ymq.js.map} +3 -3
- package/dist/{chunk-vdwagp7y.js → chunk-r4namj39.js} +2 -2
- package/dist/{chunk-vdwagp7y.js.map → chunk-r4namj39.js.map} +1 -1
- package/dist/{chunk-571rvxe6.js → chunk-rrqr1dwq.js} +2 -2
- package/dist/{chunk-571rvxe6.js.map → chunk-rrqr1dwq.js.map} +1 -1
- package/dist/{chunk-sr18y2ck.js → chunk-tp3mzj4v.js} +2 -2
- package/dist/{chunk-sr18y2ck.js.map → chunk-tp3mzj4v.js.map} +1 -1
- package/dist/{chunk-6wymbbes.js → chunk-ty4aj41k.js} +3 -3
- package/dist/{chunk-6wymbbes.js.map → chunk-ty4aj41k.js.map} +1 -1
- package/dist/chunk-v9na3dny.js +46 -0
- package/dist/{chunk-6g20zec2.js.map → chunk-v9na3dny.js.map} +6 -6
- package/dist/{chunk-d04r0hdf.js → chunk-w2fpr99k.js} +2 -2
- package/dist/{chunk-d04r0hdf.js.map → chunk-w2fpr99k.js.map} +1 -1
- package/dist/{chunk-vc9phr57.js → chunk-wwmdqhzy.js} +2 -2
- package/dist/{chunk-vc9phr57.js.map → chunk-wwmdqhzy.js.map} +1 -1
- package/dist/chunk-wysm6qte.js +5 -0
- package/dist/chunk-wysm6qte.js.map +12 -0
- package/dist/{chunk-mepaedy5.js → chunk-x157wrgy.js} +2 -2
- package/dist/{chunk-mepaedy5.js.map → chunk-x157wrgy.js.map} +1 -1
- package/dist/{chunk-nksn6xcd.js → chunk-xrh6k13s.js} +2 -2
- package/dist/{chunk-nksn6xcd.js.map → chunk-xrh6k13s.js.map} +1 -1
- package/dist/{chunk-g8sc6scv.js → chunk-y0wx6w80.js} +2 -2
- package/dist/{chunk-g8sc6scv.js.map → chunk-y0wx6w80.js.map} +1 -1
- package/dist/{chunk-kexsfyjj.js → chunk-yp5979we.js} +2 -2
- package/dist/{chunk-kexsfyjj.js.map → chunk-yp5979we.js.map} +1 -1
- package/dist/{chunk-essqp1ek.js → chunk-z32xfe8c.js} +2 -2
- package/dist/{chunk-essqp1ek.js.map → chunk-z32xfe8c.js.map} +1 -1
- package/dist/{chunk-x5yq097b.js → chunk-zgn0p8qr.js} +3 -3
- package/dist/{chunk-x5yq097b.js.map → chunk-zgn0p8qr.js.map} +1 -1
- package/dist/{chunk-agw3anaf.js → chunk-zns7xcz9.js} +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/HttpRequest.d.ts +31 -0
- package/dist/http/HttpRequest.d.ts.map +1 -1
- package/dist/http/McpRouter.d.ts +54 -1
- package/dist/http/McpRouter.d.ts.map +1 -1
- package/dist/http/RateLimitMiddleware.d.ts +4 -1
- package/dist/http/RateLimitMiddleware.d.ts.map +1 -1
- package/dist/http/index.d.ts +1 -0
- 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/http/modelOriginated.d.ts +36 -2
- package/dist/http/modelOriginated.d.ts.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/Kernel.d.ts +3 -0
- package/dist/kernel/Kernel.d.ts.map +1 -1
- package/dist/kernel/index.js +3 -3
- package/dist/kernel/index.js.map +3 -3
- 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.d.ts +6 -1
- package/dist/services/index.d.ts.map +1 -1
- package/dist/services/index.js +44 -9
- package/dist/services/index.js.map +6 -3
- package/dist/services/mcp/McpRegistry.d.ts +190 -29
- package/dist/services/mcp/McpRegistry.d.ts.map +1 -1
- package/dist/services/mcp/http/McpHttpServer.d.ts +153 -0
- package/dist/services/mcp/http/McpHttpServer.d.ts.map +1 -0
- package/dist/services/mcp/http/callers.d.ts +131 -0
- package/dist/services/mcp/http/callers.d.ts.map +1 -0
- package/dist/services/mcp/http/limits.d.ts +11 -0
- package/dist/services/mcp/http/limits.d.ts.map +1 -0
- package/dist/services/mcp/http/oauth/McpOAuthServer.d.ts +150 -0
- package/dist/services/mcp/http/oauth/McpOAuthServer.d.ts.map +1 -0
- package/dist/services/mcp/http/oauth/consentPage.d.ts +14 -0
- package/dist/services/mcp/http/oauth/consentPage.d.ts.map +1 -0
- package/dist/services/mcp/http/oauth/store.d.ts +98 -0
- package/dist/services/mcp/http/oauth/store.d.ts.map +1 -0
- package/dist/services/mcp/http/protocol.d.ts +95 -0
- package/dist/services/mcp/http/protocol.d.ts.map +1 -0
- package/dist/services/mcp/http/signedState.d.ts +25 -0
- package/dist/services/mcp/http/signedState.d.ts.map +1 -0
- package/dist/services/queue/work.js +2 -2
- package/dist/services/queue/work.js.map +1 -1
- package/dist/services/router/ApiRouteDispatcher.d.ts +29 -0
- package/dist/services/router/ApiRouteDispatcher.d.ts.map +1 -1
- package/dist/services/router/RouteServiceProvider.d.ts +6 -0
- package/dist/services/router/RouteServiceProvider.d.ts.map +1 -1
- package/dist/services/router/config.d.ts +16 -0
- package/dist/services/router/config.d.ts.map +1 -1
- package/dist/stats/route-table.js +1 -1
- package/dist/support/index.js +2 -2
- package/dist/support/index.js.map +1 -1
- package/dist/vitest/index.js +1 -1
- package/package.json +1 -1
- package/dist/chunk-3z9vhjd7.js +0 -5
- package/dist/chunk-3z9vhjd7.js.map +0 -10
- package/dist/chunk-5zzhypmt.js +0 -5
- package/dist/chunk-5zzhypmt.js.map +0 -33
- package/dist/chunk-6g20zec2.js +0 -46
- package/dist/chunk-cqnfp0n9.js +0 -14
- package/dist/chunk-fsfbyg5e.js +0 -5
- package/dist/chunk-kp7k4s5c.js +0 -4
- /package/dist/{chunk-bq5nqqeq.js.map → chunk-a5sbgffr.js.map} +0 -0
- /package/dist/{chunk-y6frz1vm.js.map → chunk-gv91vjeb.js.map} +0 -0
- /package/dist/{chunk-5nqkwa2w.js.map → chunk-hz6yzzbz.js.map} +0 -0
- /package/dist/{chunk-rh2fad7n.js.map → chunk-m17ktssc.js.map} +0 -0
- /package/dist/{chunk-agw3anaf.js.map → chunk-zns7xcz9.js.map} +0 -0
package/dist/http/index.js
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
1
|
// @bun
|
|
2
|
-
import{
|
|
2
|
+
import{$c as H,Be as N,Ce as O,De as P,Ee as Q,Fe as R,Ge as S,He as T,Ie as U,Je as V,Ke as W,Le as X,Mc as n,Me as Y,Nc as o,Ne as Z,Oc as p,Oe as _,Pc as q,Pe as $,Qc as r,Qe as aa,Rc as y,Re as ba,Sc as z,Se as ca,Tc as A,Te as da,Uc as B,Ue as ea,Ve as fa,Wc as C,Xc as D,Yc as E,Zc as F,_c as G,ad as I,fd as J,gd as K,hd as L,he as M}from"../chunk-v9na3dny.js";import"../chunk-kqb4s1r0.js";import"../chunk-hytt9qyj.js";import{Xf as a,Yf as b,Zf as d,cg as e,dg as f,eg as g,fg as h,gg as i,hg as j,mg as k,ng as l,rg as m,sg as s,tg as t,ug as u,vg as v,wg as w,xg as x}from"../chunk-0n9vs1ad.js";import{Qg as c}from"../chunk-75wk4jxd.js";import"../chunk-jzp0fs6h.js";import"../chunk-8k8534kg.js";import"../chunk-583vxa2v.js";import"../chunk-8c2fs0n0.js";import"../chunk-6h9j3f1x.js";import"../chunk-erxv1jz7.js";import"../chunk-fv9mr1t4.js";import"../chunk-j3nr4cg0.js";import"../chunk-37qk5dh8.js";import"../chunk-wwmdqhzy.js";import"../chunk-56fgk5rq.js";import"../chunk-4szjp84e.js";import"../chunk-e6fp6dxx.js";export{g as toRangeHeaderValue,n as toMiddlewareList,fa as safeFetch,f as resolveRange,e as parseRangeHeader,h as parseContentRange,r as parseByteSize,I as middlewareConfigDefaults,D as httpError,d as getCookies,j as formatUnsatisfiedContentRange,i as formatContentRange,U as defineResourcePolicy,H as defineMiddlewareConfig,o as createUnsatisfiableResponse,p as createStreamResponse,E as createFileResponse,L as clientIp,V as classifyAddress,F as ViewRouter,k as ValidationError,ca as TooManyRedirectsError,aa as TooLargeError,$ as TimeoutError,ea as SafeResponse,W as SafeFetchError,T as ResourcePolicy,b as ResourceController,c as RequestBreakerError,K as RateLimitMiddleware,J as RateLimitExceededError,u as RangeNotSatisfiableError,R as PoliciesServiceProvider,S as Policies,q as PayloadTooLargeError,v as NotFoundError,da as NetworkError,G as Middleware,B as McpRouter,A as McpRouteDeclaration,z as McpModelParam,l as InvalidValidationRuleError,X as InvalidUrlError,t as InsufficientPermissionsError,C as HttpResponse,m as HttpRequest,w as FileNotFoundError,_ as DnsError,P as CorsMiddleware,a as Controller,ba as ContentTypeError,O as CacheMiddleware,Q as CSRFMiddleware,M as BodyLimitMiddleware,Y as BlockedHostError,Z as BlockedAddressError,s as AuthorizationError,N as AuthenticationMiddleware,x as AuthenticationError,y as ApiRouter};
|
|
3
3
|
|
|
4
|
-
//# debugId=
|
|
4
|
+
//# debugId=B934C75094AC118064756E2164756E21
|
package/dist/http/index.js.map
CHANGED
|
@@ -1,8 +1,42 @@
|
|
|
1
|
+
/** One progress report a route makes during a remote tool call. */
|
|
2
|
+
export type ProgressUpdate = {
|
|
3
|
+
/** How far along, in any unit; must grow with each report. */
|
|
4
|
+
progress: number;
|
|
5
|
+
/** The `progress` that means done, when it is known. */
|
|
6
|
+
total?: number;
|
|
7
|
+
/** A short line for the user: "Rendering page 3 of 8". */
|
|
8
|
+
message?: string;
|
|
9
|
+
};
|
|
10
|
+
export type ProgressSink = (update: ProgressUpdate) => void;
|
|
11
|
+
/**
|
|
12
|
+
* The credential a remote MCP caller's tool call was made under (#762): which
|
|
13
|
+
* resolver verified it, its id, the scopes it carries and the OAuth client it
|
|
14
|
+
* was issued to. Never the secret.
|
|
15
|
+
*
|
|
16
|
+
* Read by a route as `req.mcpGrant()`, to hold a tool call to a scope of its
|
|
17
|
+
* own — `req.mcpGrant()?.scopes.includes("billing")` — on top of the user's
|
|
18
|
+
* own permissions, which the route's middleware checks either way.
|
|
19
|
+
*/
|
|
20
|
+
export type McpGrant = {
|
|
21
|
+
readonly via: string;
|
|
22
|
+
readonly id: string;
|
|
23
|
+
readonly scopes: readonly string[];
|
|
24
|
+
readonly clientId?: string;
|
|
25
|
+
};
|
|
1
26
|
/**
|
|
2
27
|
* `clientAddress` is required so the one writer cannot mark a request without
|
|
3
|
-
* saying whose rate-limit budget it spends.
|
|
28
|
+
* saying whose rate-limit budget it spends. `grant` is set for a remote MCP
|
|
29
|
+
* caller's call, and only by `dispatchAs`, from a principal a resolver
|
|
30
|
+
* verified.
|
|
31
|
+
*/
|
|
32
|
+
export declare function markModelOriginated(req: Request, clientAddress: string, grant?: McpGrant, progress?: ProgressSink): void;
|
|
33
|
+
/**
|
|
34
|
+
* Where a dispatched request's progress reports go, when its caller listens
|
|
35
|
+
* for them: a remote MCP client that sent a `progressToken`.
|
|
4
36
|
*/
|
|
5
|
-
export declare function
|
|
37
|
+
export declare function dispatchedProgress(req: Request): ProgressSink | undefined;
|
|
38
|
+
/** The grant a remote MCP caller's tool call carries; `undefined` for any other request. */
|
|
39
|
+
export declare function dispatchedGrant(req: Request): McpGrant | undefined;
|
|
6
40
|
export declare function isModelOriginated(req: Request): boolean;
|
|
7
41
|
/**
|
|
8
42
|
* The client address `clientIp` resolved from the initiator, for a request the
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"modelOriginated.d.ts","sourceRoot":"","sources":["../../http/modelOriginated.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"modelOriginated.d.ts","sourceRoot":"","sources":["../../http/modelOriginated.ts"],"names":[],"mappings":"AA4BA,mEAAmE;AACnE,MAAM,MAAM,cAAc,GAAG;IAC3B,8DAA8D;IAC9D,QAAQ,EAAE,MAAM,CAAC;IACjB,wDAAwD;IACxD,KAAK,CAAC,EAAE,MAAM,CAAC;IACf,0DAA0D;IAC1D,OAAO,CAAC,EAAE,MAAM,CAAC;CAClB,CAAC;AAEF,MAAM,MAAM,YAAY,GAAG,CAAC,MAAM,EAAE,cAAc,KAAK,IAAI,CAAC;AAE5D;;;;;;;;GAQG;AACH,MAAM,MAAM,QAAQ,GAAG;IACrB,QAAQ,CAAC,GAAG,EAAE,MAAM,CAAC;IACrB,QAAQ,CAAC,EAAE,EAAE,MAAM,CAAC;IACpB,QAAQ,CAAC,MAAM,EAAE,SAAS,MAAM,EAAE,CAAC;IACnC,QAAQ,CAAC,QAAQ,CAAC,EAAE,MAAM,CAAC;CAC5B,CAAC;AAEF;;;;;GAKG;AACH,wBAAgB,mBAAmB,CACjC,GAAG,EAAE,OAAO,EACZ,aAAa,EAAE,MAAM,EACrB,KAAK,CAAC,EAAE,QAAQ,EAChB,QAAQ,CAAC,EAAE,YAAY,QAOxB;AAED;;;GAGG;AACH,wBAAgB,kBAAkB,CAAC,GAAG,EAAE,OAAO,GAAG,YAAY,GAAG,SAAS,CAEzE;AAED,4FAA4F;AAC5F,wBAAgB,eAAe,CAAC,GAAG,EAAE,OAAO,GAAG,QAAQ,GAAG,SAAS,CAElE;AAED,wBAAgB,iBAAiB,CAAC,GAAG,EAAE,OAAO,GAAG,OAAO,CAEvD;AAED;;;;;;;;;;;;GAYG;AACH,wBAAgB,uBAAuB,CAAC,GAAG,EAAE,OAAO,GAAG,MAAM,GAAG,SAAS,CAExE"}
|
|
@@ -1,4 +1,4 @@
|
|
|
1
1
|
// @bun
|
|
2
|
-
import{ba as y,ca as p}from"../chunk-
|
|
2
|
+
import{ba as y,ca as p}from"../chunk-h2r2rdhj.js";import{ta as c,ua as d,wa as l}from"../chunk-yer1r3t3.js";import{Fh as e,Gh as i,Ih as t,Jh as r,Kh as o,Lh as n,Mh as a,Nh as s}from"../chunk-erxv1jz7.js";import"../chunk-e6fp6dxx.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=B172ED693630131F64756E2164756E21
|
package/dist/i18n/index.js
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
1
|
// @bun
|
|
2
|
-
import{ba as w}from"../chunk-
|
|
2
|
+
import{ba as w}from"../chunk-h2r2rdhj.js";import"../chunk-yer1r3t3.js";import{eb as b}from"../chunk-fakvf9wb.js";import{Jc as R,Kc as S}from"../chunk-zgn0p8qr.js";import"../chunk-n672d4g8.js";import{ud as j}from"../chunk-v9na3dny.js";import"../chunk-kqb4s1r0.js";import"../chunk-hytt9qyj.js";import"../chunk-0n9vs1ad.js";import"../chunk-75wk4jxd.js";import"../chunk-jzp0fs6h.js";import"../chunk-8k8534kg.js";import"../chunk-583vxa2v.js";import"../chunk-8c2fs0n0.js";import"../chunk-6h9j3f1x.js";import"../chunk-erxv1jz7.js";import{Vh as X,Wh as E,Xh as V,Yh as L}from"../chunk-fv9mr1t4.js";import"../chunk-j3nr4cg0.js";import"../chunk-37qk5dh8.js";import"../chunk-wwmdqhzy.js";import"../chunk-56fgk5rq.js";import"../chunk-4szjp84e.js";import"../chunk-e6fp6dxx.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=0E8EB947444F11ED64756E2164756E21
|
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": ";02BAAA,mBAAS,SAAe,eAAU,SAO3B,IAAS,JAAgB,JAAC,HAAkB,HAAwB,JAEzE,DAAM,HAAS,EAAO,EAAO,JAAM,HAAE,AACnC,JAAC,DACC,EAAO,DAAU,OACjB,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,S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AW,GAAK,GAAS,GAAU,CAAC,CAAC,QAU7D,OAAoC,CAAC,EAAc,EAAiB,CACzE,OAAO,IAAI,EAAc,EAAM,CAAY,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": "0E8EB947444F11ED64756E2164756E21",
|
|
11
11
|
"names": []
|
|
12
12
|
}
|
package/dist/kernel/Kernel.d.ts
CHANGED
|
@@ -1,3 +1,4 @@
|
|
|
1
|
+
import { McpHttpServer } from "../services/mcp/http/McpHttpServer";
|
|
1
2
|
import { Application } from "../foundation/Application";
|
|
2
3
|
import type { ServiceProviderConstructor, ShutdownReport } from "../foundation/Application";
|
|
3
4
|
import type { ServiceToken } from "../container/Container";
|
|
@@ -114,6 +115,8 @@ export declare class Kernel {
|
|
|
114
115
|
viewRoutes(): ViewRouteDispatcher;
|
|
115
116
|
domains(): DomainRouter;
|
|
116
117
|
queue(): QueueManager;
|
|
118
|
+
/** The MCP endpoint, or `null` when `route.mcp.remote` is not enabled. */
|
|
119
|
+
mcpHttp(): McpHttpServer | null;
|
|
117
120
|
/** The `global` middleware list for one request. Call it inside `run`. */
|
|
118
121
|
globalMiddleware(req: Request): Promise<import("../services/router/globalMiddleware").GlobalMiddlewareOutcome>;
|
|
119
122
|
destroy(): void;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"Kernel.d.ts","sourceRoot":"","sources":["../../kernel/Kernel.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,WAAW,EAAE,MAAM,2BAA2B,CAAC;AACxD,OAAO,KAAK,EAAE,0BAA0B,EAAE,cAAc,EAAE,MAAM,2BAA2B,CAAC;AAC5F,OAAO,KAAK,EAAE,YAAY,EAAE,MAAM,wBAAwB,CAAC;AAC3D,OAAO,KAAK,EAAE,WAAW,EAAE,MAAM,uBAAuB,CAAC;AACzD,OAAO,KAAK,EAAE,OAAO,EAAE,kBAAkB,EAAE,MAAM,oBAAoB,CAAC;AAItE,OAAO,EAAE,YAAY,EAAE,MAAM,gCAAgC,CAAC;AAE9D,OAAO,EAAE,kBAAkB,EAAE,MAAM,uCAAuC,CAAC;AAC3E,OAAO,EAAE,mBAAmB,EAAE,MAAM,wCAAwC,CAAC;AAC7E,OAAO,EAAE,YAAY,EAAE,MAAM,iCAAiC,CAAC;AAK/D;;;;GAIG;AACH,qBAAa,MAAM;IACjB;;;;OAIG;IACH,SAAS,CAAC,MAAM,EAAE,WAAW,CAAM;IAEnC;;;OAGG;IACH,SAAS,CAAC,SAAS,EAAE,0BAA0B,EAAE,CAAM;IAEvD;;;;;;;;;;OAUG;IACH,SAAS,CAAC,QAAQ,EAAE,KAAK,CAAC,kBAAkB,GAAG,OAAO,CAAC,CAAM;IAE7D,OAAO,CAAC,gBAAgB,CAAiB;IACzC,OAAO,CAAC,aAAa,CAAqB;IAC1C,OAAO,CAAC,cAAc,CAAS;IAE/B;;;;;;;;;;;;;;;;;;;;;;;;;;;OA2BG;IACH,SAAS,CAAC,MAAM,EAAE,KAAK,CAAC,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,CAAC,CAAM;IAEtD,QAAQ,CAAC,GAAG,cA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bun
|
|
2
|
-
import{Ia as g}from"../chunk-
|
|
2
|
+
import{Ia as g}from"../chunk-3ma9m432.js";import{db as e}from"../chunk-h4pazcgg.js";import{eb as w}from"../chunk-fakvf9wb.js";import{Ab as S,Bb as h,Db as R,Eb as u,Fb as l,Gb as v,Jb as d,Kb as c,Nb as p,Qb as n,Rb as a,qb as r,rb as T,sb as D,tb as zj,ub as A,vb as y,wb as P}from"../chunk-60nyk1w8.js";import"../chunk-wysm6qte.js";import"../chunk-7rmjr8p7.js";import"../chunk-2z1981d0.js";import{Ec as jj}from"../chunk-8rt4wx8z.js";import"../chunk-zgn0p8qr.js";import"../chunk-n672d4g8.js";import{ie as x,md as Gj,nd as Nj,ne as I,oe as E,qd as Oj,rd as Hj,se as K,te as q,ue as t,ve as m,we as C,xe as Q,ye as o,ze as i}from"../chunk-v9na3dny.js";import{Ze as s}from"../chunk-kqb4s1r0.js";import{kf as V,pf as f}from"../chunk-hytt9qyj.js";import{rg as b}from"../chunk-0n9vs1ad.js";import{Pg as B}from"../chunk-75wk4jxd.js";import{Vg as L}from"../chunk-jzp0fs6h.js";import"../chunk-8k8534kg.js";import"../chunk-583vxa2v.js";import"../chunk-8c2fs0n0.js";import"../chunk-6h9j3f1x.js";import"../chunk-erxv1jz7.js";import"../chunk-5j76r5q8.js";import"../chunk-fv9mr1t4.js";import{$h as O,Zh as _,ai as F}from"../chunk-j3nr4cg0.js";import"../chunk-37qk5dh8.js";import"../chunk-wwmdqhzy.js";import"../chunk-56fgk5rq.js";import{ni as M}from"../chunk-4szjp84e.js";import"../chunk-e6fp6dxx.js";function Xj(j){let X=j.headers.get("Cache-Control")?.toLowerCase()??"";return/(^|[\s,])(public|s-maxage)\b/.test(X)}var Yj=new Set,Zj={refusal:null,apply:(j)=>j,carried:null};async function k(j){let X=F(x);if(X.config.global.length===0)return Zj;let{pathname:Z}=new URL(j.url),W=M(Z),z=new b(j,{},W?"api":"view","");return await L.run(z,async()=>{let $=L.getStore(),{headers:N,cookies:Wj}=$,Y=(J)=>{if(!Xj(J))return Q(J,N,Wj);let G=new Headers(N);return G.delete("Set-Cookie"),Q(J,G,Yj)};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 H=W?C(J.payload.api):G?q(J.payload.viewData??J.payload.api):K(J.payload.view);return{refusal:Y(H),apply:Y,carried:null}}if(V(J)&&(W||G))return{refusal:Y(m()),apply:Y,carried:null};if(f(J)){console.error(J);let H=W||G?I():K(E());return{refusal:Y(H),apply:Y,carried:null}}throw J}finally{$.destroy()}})}var U=[v,c,g,S,a,y,h,d,u,D,R,n,l,w,p,P,A];class Jj{config={};providers=[];services=[];serviceInstances=[];serviceTokens=new Set;servicesBooted=!1;models=[];app=new O;boot(){if(this.models.length>0)e(...this.models);else $j();this.app.config.merge(this.config),O.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 N=z;if(!j.has(z.token)&&this.app.bound(N))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(N,W),this.serviceInstances.push(W),this.serviceTokens.add(z.token)}}async waitForBoot(){await this.app.boot(),await this.bootServices(),zj(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(o)}viewRoutes(){return this.app.make(t)}domains(){return this.app.make(i)}queue(){return this.app.make(jj)}mcpHttp(){return this.app.config.get("route.mcp.remote.enabled")===!0?this.app.make(r):null}globalMiddleware(j){return k(j)}destroy(){if(this.app.resolved(T))this.app.make(T).stop();if(this.app.flush(),O.getInstance()===this.app)O.setInstance(void 0);_.disable()}}function $j(){if(Bun.env.NODE_ENV==="production")return;let j=s();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:
|
|
@@ -11,6 +11,6 @@ import{Ia as g}from"../chunk-7jnpnjth.js";import{db as r}from"../chunk-1p85fdrk.
|
|
|
11
11
|
models = [generated, models]
|
|
12
12
|
}
|
|
13
13
|
|
|
14
|
-
See docs/orm.md#your-model-class. Development only; this never prints in production.`)}export{
|
|
14
|
+
See docs/orm.md#your-model-class. Development only; this never prints in production.`)}export{Nj as oneTimeSecretMatches,Gj as hashOneTimeSecret,U as frameworkProviders,Hj as UserProvider,Oj as SESSION_SELECT,Jj as Kernel};
|
|
15
15
|
|
|
16
|
-
//# debugId=
|
|
16
|
+
//# debugId=D9DA50E00E2139D764756E2164756E21
|
package/dist/kernel/index.js.map
CHANGED
|
@@ -4,9 +4,9 @@
|
|
|
4
4
|
"sourcesContent": [
|
|
5
5
|
"import { app } from \"../../foundation/app\";\nimport { GEMI_REQUEST_BREAKER_ERROR } from \"../../http/Error\";\nimport { HttpRequest } from \"../../http/HttpRequest\";\nimport { type CarriedContext, RequestContext } from \"../../http/requestContext\";\nimport { isPolicyDeniedError, isRecordNotFoundError } from \"../../orm/errors\";\nimport { MiddlewareRegistry } from \"../middleware/MiddlewareRegistry\";\nimport { breakResponse, mergeContextIntoResponse } from \"./ApiRouteDispatcher\";\nimport { isApiPath } from \"./apiPath\";\nimport { notFoundResponse } from \"./notFound\";\nimport { policyDeniedResponse, policyDeniedView } from \"./policyDenied\";\nimport { viewBreakResponse, viewDataBreakResponse } from \"./ViewRouteDispatcher\";\n\nexport interface GlobalMiddlewareOutcome {\n /** The response that ends the request, when a global middleware refused it. */\n refusal: Response | null;\n /**\n * Puts the headers and cookies the global middleware set on the request\n * context onto the response the request ends with. The response's own\n * headers win; the context only fills gaps, as it does for route middleware.\n * Cookies are left off a response a shared cache may store (see\n * `sharedCacheable`).\n */\n apply(response: Response): Response;\n /**\n * The user the list left on its context, for the route's context to start\n * from. `null` when there is no list, or it refused.\n */\n carried: CarriedContext | null;\n}\n\n/**\n * Whether a shared cache may store this response: `public` or `s-maxage` in\n * its Cache-Control, as the static `dist/client` files carry\n * (`public, max-age=31536000`). A per-visitor cookie a global middleware set\n * would otherwise be stored with the asset, and a CDN that caches responses\n * with Set-Cookie would hand it to every visitor who gets that copy.\n */\nfunction sharedCacheable(response: Response) {\n const cacheControl = response.headers.get(\"Cache-Control\")?.toLowerCase() ?? \"\";\n return /(^|[\\s,])(public|s-maxage)\\b/.test(cacheControl);\n}\n\nconst noCookies = new Set<string>();\n\nconst passThrough: GlobalMiddlewareOutcome = {\n refusal: null,\n apply: (response) => response,\n carried: null,\n};\n\n/**\n * Runs the `global` middleware list for one incoming request, before anything\n * is routed and before a static file is served. Called from `App`, once per\n * request (see `App.withGlobalMiddleware`), inside the kernel scope.\n *\n * It opens a request scope of its own. The router has not run, so the\n * `HttpRequest` a global middleware gets has no params and an empty\n * `routePath`, and its `kind` is read off the url the way `App.fetch` picks a\n * dispatcher. The scope is not the one the route later runs in: the route's\n * dispatcher opens a fresh one, as it always has. Two things cross over.\n * Headers and cookies reach the response through `apply`, and the user is\n * `carried` into the route's context, so a gate that looked the user up does\n * not make `auth` or `Auth.user()` look them up again. Both trust a user they\n * find on the context without checking it against a session or asking for a\n * token, so whatever a global middleware sets is treated as authenticated by\n * the route — which is what lets one sign a user in by SSO header or API key\n * (#577), and why it must set only a user it has verified. The rest stays\n * behind:\n * the locale, because the dispatchers decide it for the route, from its url,\n * and the feature evaluations, made against a request with no route and maybe\n * before a user was known.\n *\n * A break answers the way the same break from a route middleware would for\n * that url: the api's JSON for `/api`, the `.json` navigation's body for view\n * data, and the page response otherwise, static files included. A policy\n * denial is the same 403 the dispatchers give. Anything else is thrown, and\n * the caller answers it as the server's 500.\n */\nexport async function runGlobalMiddleware(req: Request): Promise<GlobalMiddlewareOutcome> {\n const registry = app(MiddlewareRegistry);\n if (registry.config.global.length === 0) {\n return passThrough;\n }\n\n const { pathname } = new URL(req.url);\n const isApi = isApiPath(pathname);\n const httpRequest = new HttpRequest(req, {}, isApi ? \"api\" : \"view\", \"\");\n\n return await RequestContext.run(httpRequest, async () => {\n const ctx = RequestContext.getStore();\n // Held past `destroy()` below, which only drops the store's references.\n const { headers, cookies } = ctx;\n const apply = (response: Response) => {\n if (!sharedCacheable(response)) {\n return mergeContextIntoResponse(response, headers, cookies);\n }\n const withoutCookies = new Headers(headers);\n withoutCookies.delete(\"Set-Cookie\");\n return mergeContextIntoResponse(response, withoutCookies, noCookies);\n };\n\n try {\n await registry.runGlobalMiddleware();\n return { refusal: null, apply, carried: { user: ctx.user } };\n } catch (err) {\n const isViewData = !isApi && pathname.endsWith(\".json\");\n if (err?.kind === GEMI_REQUEST_BREAKER_ERROR) {\n const refusal = isApi\n ? breakResponse(err.payload.api)\n : isViewData\n ? viewDataBreakResponse(err.payload.viewData ?? err.payload.api)\n : viewBreakResponse(err.payload.view);\n return { refusal: apply(refusal), apply, carried: null };\n }\n // A global middleware that resolves the request's tenant or workspace by\n // an id from the url asks the same question a route handler does, and a\n // miss is the same 404. Only for the two json-shaped requests here: a\n // full page load should render the application's `404` view rather than\n // a bare body, and that is #614's to do.\n if (isRecordNotFoundError(err) && (isApi || isViewData)) {\n return { refusal: apply(notFoundResponse()), apply, carried: null };\n }\n if (isPolicyDeniedError(err)) {\n console.error(err);\n const refusal =\n isApi || isViewData ? policyDeniedResponse() : viewBreakResponse(policyDeniedView());\n return { refusal: apply(refusal), apply, carried: null };\n }\n throw err;\n } finally {\n ctx.destroy();\n }\n });\n}\n",
|
|
6
6
|
"import type { ServiceProviderConstructor } from \"../foundation/Application\";\nimport { ChangeFeedServiceProvider } from \"../services/change-feed/ChangeFeedServiceProvider\";\nimport { AuthServiceProvider } from \"../auth/AuthServiceProvider\";\nimport { DatabaseServiceProvider } from \"../database/DatabaseServiceProvider\";\nimport { TranslationServiceProvider } from \"../i18n/TranslationServiceProvider\";\nimport { ScheduleServiceProvider } from \"../services/cron/ScheduleServiceProvider\";\nimport { FeaturesServiceProvider } from \"../services/features/FeaturesServiceProvider\";\nimport { MailServiceProvider } from \"../services/email/MailServiceProvider\";\nimport { EventServiceProvider } from \"../services/events/EventServiceProvider\";\nimport { FilesystemServiceProvider } from \"../services/file-storage/FilesystemServiceProvider\";\nimport { ImageServiceProvider } from \"../services/image-optimization/ImageServiceProvider\";\nimport { KernelIdServiceProvider } from \"../services/kernel-id/KernelIdServiceProvider\";\nimport { LogServiceProvider } from \"../services/logging/LogServiceProvider\";\nimport { MiddlewareServiceProvider } from \"../services/middleware/MiddlewareServiceProvider\";\nimport { QueueServiceProvider } from \"../services/queue/QueueServiceProvider\";\nimport { RateLimiterServiceProvider } from \"../services/rate-limiter/RateLimiterServiceProvider\";\nimport { RedisServiceProvider } from \"../services/redis/RedisServiceProvider\";\nimport { RouteServiceProvider } from \"../services/router/RouteServiceProvider\";\n\n/**\n * The providers every gemi app boots with, in registration order. Seventeen\n * providers for eighteen services — `RouteServiceProvider` owns both the api\n * and the view dispatcher, the way Laravel's does.\n *\n * Order only matters for `boot()`; `register()` binds factories and resolves\n * nothing, so no provider here depends on an earlier one having run — with one\n * exception, which is the reason to read this before reordering anything.\n *\n * **`EventServiceProvider` must stay after `QueueServiceProvider`.** A queued\n * listener is registered with the queue as a synthetic job, and\n * `EventServiceProvider.boot()` is what hands those over. `QueueManager.useJobs`\n * — which `QueueServiceProvider.boot()` calls with whatever it discovered under\n * `app/jobs` — *replaces* the registry (`this.jobs = {}`). Move the events\n * provider up and the two boots run in the order that discards: every\n * `listener:*` entry is registered and then thrown away. Nothing errors, boot\n * succeeds, and each queued dispatch afterwards lands on `next()`'s \"Dropped a\n * queued job: nothing is registered under the name listener:SendWelcomeEmail\",\n * long after `dispatch` returned to a caller that cannot hear it.\n */\nexport const frameworkProviders: ServiceProviderConstructor[] = [\n KernelIdServiceProvider,\n MiddlewareServiceProvider,\n DatabaseServiceProvider,\n // After the database, whose `boot()` its cache warm-up depends on, and before\n // the route dispatchers, which evaluate flags on every view request.\n FeaturesServiceProvider,\n RouteServiceProvider,\n AuthServiceProvider,\n MailServiceProvider,\n LogServiceProvider,\n FilesystemServiceProvider,\n QueueServiceProvider,\n EventServiceProvider,\n RedisServiceProvider,\n ImageServiceProvider,\n TranslationServiceProvider,\n RateLimiterServiceProvider,\n ScheduleServiceProvider,\n ChangeFeedServiceProvider,\n];\n",
|
|
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"
|
|
7
|
+
"import { McpHttpServer } from \"../services/mcp/http/McpHttpServer\";\nimport { 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 MCP endpoint, or `null` when `route.mcp.remote` is not enabled. */\n mcpHttp(): McpHttpServer | null {\n return this.app.config.get(\"route.mcp.remote.enabled\") === true\n ? this.app.make(McpHttpServer)\n : null;\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
|
-
"mappings": ";
|
|
10
|
-
"debugId": "
|
|
9
|
+
"mappings": ";o5CAqCA,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,AACT,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,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