gemi 0.84.1 → 0.85.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 +41 -3
- package/dist/ai/Agent.d.ts.map +1 -1
- package/dist/ai/AgentController.d.ts +238 -0
- package/dist/ai/AgentController.d.ts.map +1 -1
- package/dist/ai/AgentProvider.d.ts +15 -0
- package/dist/ai/AgentProvider.d.ts.map +1 -1
- package/dist/ai/client/index.d.ts +2 -2
- package/dist/ai/client/index.d.ts.map +1 -1
- package/dist/ai/client/index.js +138 -35
- package/dist/ai/client/index.js.map +1 -1
- package/dist/ai/client/reducer.d.ts +7 -1
- package/dist/ai/client/reducer.d.ts.map +1 -1
- package/dist/ai/generate.d.ts.map +1 -1
- package/dist/ai/index.d.ts +4 -2
- package/dist/ai/index.d.ts.map +1 -1
- package/dist/ai/index.js +12 -12
- package/dist/ai/index.js.map +19 -16
- package/dist/ai/providers/call.d.ts +4 -0
- package/dist/ai/providers/call.d.ts.map +1 -1
- package/dist/ai/providers/fileRejection.d.ts +84 -0
- package/dist/ai/providers/fileRejection.d.ts.map +1 -0
- package/dist/ai/providers/request.d.ts.map +1 -1
- package/dist/ai/redact.d.ts +70 -0
- package/dist/ai/redact.d.ts.map +1 -0
- package/dist/ai/signing.d.ts +33 -4
- package/dist/ai/signing.d.ts.map +1 -1
- package/dist/ai/store/Attachments.d.ts +5 -3
- package/dist/ai/store/Attachments.d.ts.map +1 -1
- package/dist/ai/store/FileOwners.d.ts +59 -0
- package/dist/ai/store/FileOwners.d.ts.map +1 -0
- package/dist/ai/store/LiveRuns.d.ts +25 -0
- package/dist/ai/store/LiveRuns.d.ts.map +1 -1
- package/dist/ai/store/MemoryAgentStore.d.ts +1 -0
- package/dist/ai/store/MemoryAgentStore.d.ts.map +1 -1
- package/dist/ai/store/Nonces.d.ts +109 -0
- package/dist/ai/store/Nonces.d.ts.map +1 -0
- package/dist/ai/store/index.d.ts +2 -0
- package/dist/ai/store/index.d.ts.map +1 -1
- package/dist/ai/types.d.ts +30 -1
- package/dist/ai/types.d.ts.map +1 -1
- package/dist/ai/useChat.d.ts +62 -3
- package/dist/ai/useChat.d.ts.map +1 -1
- package/dist/app/index.js +1 -1
- package/dist/bun/plugin.js +1 -1
- package/dist/bun/preload.js +1 -1
- package/dist/{chunk-82nn71zs.js → chunk-09sr33ff.js} +2 -2
- package/dist/{chunk-82nn71zs.js.map → chunk-09sr33ff.js.map} +1 -1
- package/dist/chunk-174jkg6d.js +7 -0
- package/dist/{chunk-302mkqeq.js.map → chunk-174jkg6d.js.map} +9 -8
- package/dist/{chunk-87x692j7.js → chunk-1b5s4w5f.js} +2 -2
- package/dist/{chunk-87x692j7.js.map → chunk-1b5s4w5f.js.map} +1 -1
- package/dist/{chunk-rmv1jp9p.js → chunk-1jcp8m8h.js} +2 -2
- package/dist/{chunk-rmv1jp9p.js.map → chunk-1jcp8m8h.js.map} +1 -1
- package/dist/{chunk-g6qe6wyb.js → chunk-1w5a11cd.js} +2 -2
- package/dist/{chunk-g6qe6wyb.js.map → chunk-1w5a11cd.js.map} +1 -1
- package/dist/chunk-1wby1sr2.js +5 -0
- package/dist/{chunk-e43drft2.js.map → chunk-1wby1sr2.js.map} +3 -3
- package/dist/{chunk-vmpzg4z5.js → chunk-1yq1e6sb.js} +3 -3
- package/dist/{chunk-vmpzg4z5.js.map → chunk-1yq1e6sb.js.map} +1 -1
- package/dist/chunk-1yzdxv2a.js +5 -0
- package/dist/{chunk-tmwsvf02.js.map → chunk-1yzdxv2a.js.map} +1 -1
- package/dist/{chunk-ah9ajys0.js → chunk-2gdhcswa.js} +1 -1
- package/dist/chunk-2k5kyk0h.js +24 -0
- package/dist/chunk-2k5kyk0h.js.map +17 -0
- package/dist/{chunk-1evk2pma.js → chunk-2yw23zhn.js} +4 -4
- package/dist/{chunk-1evk2pma.js.map → chunk-2yw23zhn.js.map} +1 -1
- package/dist/{chunk-3z6wkvwj.js → chunk-4ysar3ev.js} +2 -2
- package/dist/{chunk-3z6wkvwj.js.map → chunk-4ysar3ev.js.map} +1 -1
- package/dist/{chunk-z409rk5j.js → chunk-4zj05vry.js} +2 -2
- package/dist/{chunk-z409rk5j.js.map → chunk-4zj05vry.js.map} +1 -1
- package/dist/{chunk-1cebv3h8.js → chunk-55x9kkdt.js} +2 -2
- package/dist/{chunk-1cebv3h8.js.map → chunk-55x9kkdt.js.map} +1 -1
- package/dist/{chunk-0agfx93f.js → chunk-5ktfpty1.js} +2 -2
- package/dist/{chunk-0agfx93f.js.map → chunk-5ktfpty1.js.map} +1 -1
- package/dist/chunk-6k2czkkh.js +55 -0
- package/dist/{chunk-rp5j1mgk.js.map → chunk-6k2czkkh.js.map} +3 -3
- package/dist/{chunk-3zb2ycxj.js → chunk-7c33ngqs.js} +2 -2
- package/dist/{chunk-3zb2ycxj.js.map → chunk-7c33ngqs.js.map} +1 -1
- package/dist/{chunk-en3mtnsg.js → chunk-7n5775qx.js} +2 -2
- package/dist/{chunk-en3mtnsg.js.map → chunk-7n5775qx.js.map} +1 -1
- package/dist/{chunk-bn9pzgww.js → chunk-7nj2t2gm.js} +2 -2
- package/dist/{chunk-bn9pzgww.js.map → chunk-7nj2t2gm.js.map} +1 -1
- package/dist/{chunk-kfavcgv2.js → chunk-81k26w39.js} +2 -2
- package/dist/{chunk-kfavcgv2.js.map → chunk-81k26w39.js.map} +1 -1
- package/dist/{chunk-cg4k40zy.js → chunk-81v4c4b1.js} +2 -2
- package/dist/{chunk-cg4k40zy.js.map → chunk-81v4c4b1.js.map} +1 -1
- package/dist/{chunk-wh728wd6.js → chunk-8gexb1gt.js} +2 -2
- package/dist/{chunk-wh728wd6.js.map → chunk-8gexb1gt.js.map} +1 -1
- package/dist/{chunk-zfch4da5.js → chunk-9tsw1bmt.js} +2 -2
- package/dist/{chunk-8mmfpqgs.js.map → chunk-9tsw1bmt.js.map} +1 -1
- package/dist/{chunk-m0zba09s.js → chunk-9tv5j3b2.js} +3 -3
- package/dist/{chunk-m0zba09s.js.map → chunk-9tv5j3b2.js.map} +1 -1
- package/dist/{chunk-jg9eqd3r.js → chunk-c3gzpjba.js} +1 -1
- package/dist/{chunk-r5e4vpa1.js → chunk-cbycz5z3.js} +2 -2
- package/dist/{chunk-r5e4vpa1.js.map → chunk-cbycz5z3.js.map} +1 -1
- package/dist/{chunk-cfvq30n4.js → chunk-cfykfnqx.js} +2 -2
- package/dist/{chunk-cfvq30n4.js.map → chunk-cfykfnqx.js.map} +1 -1
- package/dist/{chunk-eysexnqb.js → chunk-ct7wxm98.js} +2 -2
- package/dist/{chunk-eysexnqb.js.map → chunk-ct7wxm98.js.map} +1 -1
- package/dist/{chunk-v27a4se1.js → chunk-d3jkypc7.js} +3 -3
- package/dist/{chunk-v27a4se1.js.map → chunk-d3jkypc7.js.map} +1 -1
- package/dist/{chunk-vfrrzr10.js → chunk-dadygfkf.js} +2 -2
- package/dist/{chunk-vfrrzr10.js.map → chunk-dadygfkf.js.map} +1 -1
- package/dist/{chunk-m4xw99vm.js → chunk-dwqh79e5.js} +2 -2
- package/dist/{chunk-m4xw99vm.js.map → chunk-dwqh79e5.js.map} +1 -1
- package/dist/{chunk-ng8pp9k2.js → chunk-fbwe0agk.js} +2 -2
- package/dist/{chunk-ng8pp9k2.js.map → chunk-fbwe0agk.js.map} +1 -1
- package/dist/{chunk-495qwteq.js → chunk-fc2je244.js} +3 -3
- package/dist/{chunk-495qwteq.js.map → chunk-fc2je244.js.map} +1 -1
- package/dist/{chunk-gr61ymse.js → chunk-gx0x772p.js} +2 -2
- package/dist/{chunk-gr61ymse.js.map → chunk-gx0x772p.js.map} +1 -1
- package/dist/{chunk-tdnfhe7x.js → chunk-ha705bcz.js} +3 -3
- package/dist/{chunk-tdnfhe7x.js.map → chunk-ha705bcz.js.map} +1 -1
- package/dist/chunk-jhe0t7yj.js +5 -0
- package/dist/chunk-jhe0t7yj.js.map +11 -0
- package/dist/{chunk-d0qwdeza.js → chunk-k5j65f2c.js} +2 -2
- package/dist/{chunk-d0qwdeza.js.map → chunk-k5j65f2c.js.map} +1 -1
- package/dist/{chunk-pt59xjfc.js → chunk-kmsrzbx1.js} +2 -2
- package/dist/{chunk-pt59xjfc.js.map → chunk-kmsrzbx1.js.map} +1 -1
- package/dist/{chunk-v1nm4tcq.js → chunk-m7y8d3k7.js} +2 -2
- package/dist/{chunk-v1nm4tcq.js.map → chunk-m7y8d3k7.js.map} +1 -1
- package/dist/{chunk-k2qh3hvd.js → chunk-mk8m3ffx.js} +2 -2
- package/dist/{chunk-k2qh3hvd.js.map → chunk-mk8m3ffx.js.map} +1 -1
- package/dist/{chunk-z7442w3q.js → chunk-mszy6cfw.js} +2 -2
- package/dist/{chunk-z7442w3q.js.map → chunk-mszy6cfw.js.map} +1 -1
- package/dist/{chunk-kb3xk9r8.js → chunk-ndat0nf0.js} +2 -2
- package/dist/{chunk-kb3xk9r8.js.map → chunk-ndat0nf0.js.map} +1 -1
- package/dist/{chunk-j9wqzemf.js → chunk-p0m3qgs5.js} +2 -2
- package/dist/{chunk-j9wqzemf.js.map → chunk-p0m3qgs5.js.map} +1 -1
- package/dist/{chunk-8mmfpqgs.js → chunk-p7r3ecpk.js} +2 -2
- package/dist/{chunk-zfch4da5.js.map → chunk-p7r3ecpk.js.map} +1 -1
- package/dist/{chunk-zp971jp2.js → chunk-pmmrhak1.js} +3 -3
- package/dist/{chunk-zp971jp2.js.map → chunk-pmmrhak1.js.map} +1 -1
- package/dist/{chunk-nvj1z2rs.js → chunk-pzwyg474.js} +2 -2
- package/dist/{chunk-nvj1z2rs.js.map → chunk-pzwyg474.js.map} +1 -1
- package/dist/{chunk-73dk6k4p.js → chunk-qje4kdff.js} +3 -3
- package/dist/{chunk-73dk6k4p.js.map → chunk-qje4kdff.js.map} +1 -1
- package/dist/{chunk-yk8s5egf.js → chunk-rdnm6rem.js} +2 -2
- package/dist/{chunk-yk8s5egf.js.map → chunk-rdnm6rem.js.map} +1 -1
- package/dist/{chunk-enf9mdac.js → chunk-s046a984.js} +2 -2
- package/dist/{chunk-enf9mdac.js.map → chunk-s046a984.js.map} +1 -1
- package/dist/{chunk-1s914cdj.js → chunk-saqfc6vp.js} +3 -3
- package/dist/{chunk-1s914cdj.js.map → chunk-saqfc6vp.js.map} +1 -1
- package/dist/{chunk-pgpqsgzx.js → chunk-sejnmn1q.js} +1 -1
- package/dist/{chunk-xhha1gb3.js → chunk-sjckrbr2.js} +2 -2
- package/dist/{chunk-xhha1gb3.js.map → chunk-sjckrbr2.js.map} +1 -1
- package/dist/{chunk-r8nhndzb.js → chunk-swhyp0yw.js} +2 -2
- package/dist/{chunk-r8nhndzb.js.map → chunk-swhyp0yw.js.map} +1 -1
- package/dist/{chunk-wkdzz0rx.js → chunk-trdwxm5x.js} +3 -3
- package/dist/{chunk-wkdzz0rx.js.map → chunk-trdwxm5x.js.map} +1 -1
- package/dist/{chunk-aztkrzvf.js → chunk-v2hvnxsf.js} +2 -2
- package/dist/{chunk-aztkrzvf.js.map → chunk-v2hvnxsf.js.map} +1 -1
- package/dist/{chunk-57ryyhh3.js → chunk-v4ngf77f.js} +2 -2
- package/dist/{chunk-57ryyhh3.js.map → chunk-v4ngf77f.js.map} +1 -1
- package/dist/{chunk-159hyeng.js → chunk-v8nf45gt.js} +2 -2
- package/dist/{chunk-159hyeng.js.map → chunk-v8nf45gt.js.map} +1 -1
- package/dist/{chunk-ys4fejmx.js → chunk-vwp1g8wh.js} +2 -2
- package/dist/{chunk-ys4fejmx.js.map → chunk-vwp1g8wh.js.map} +1 -1
- package/dist/chunk-w312e9nx.js +5 -0
- package/dist/{chunk-ash9e6fn.js.map → chunk-w312e9nx.js.map} +4 -3
- package/dist/{chunk-wwdaswxh.js → chunk-wwzg4dmy.js} +3 -3
- package/dist/{chunk-wwdaswxh.js.map → chunk-wwzg4dmy.js.map} +1 -1
- package/dist/{chunk-wsx3j5ws.js → chunk-xckeyg3v.js} +2 -2
- package/dist/{chunk-wsx3j5ws.js.map → chunk-xckeyg3v.js.map} +1 -1
- package/dist/chunk-xx2zg6sk.js +17 -0
- package/dist/{chunk-49akdtfe.js.map → chunk-xx2zg6sk.js.map} +11 -12
- package/dist/{chunk-rqh2wdhb.js → chunk-y7qnx8vm.js} +2 -2
- package/dist/{chunk-rqh2wdhb.js.map → chunk-y7qnx8vm.js.map} +1 -1
- package/dist/{chunk-rv7da58g.js → chunk-z4k18gnp.js} +2 -2
- package/dist/{chunk-rv7da58g.js.map → chunk-z4k18gnp.js.map} +1 -1
- package/dist/{chunk-w099t7zj.js → chunk-zf4r4kat.js} +2 -2
- package/dist/{chunk-w099t7zj.js.map → chunk-zf4r4kat.js.map} +1 -1
- package/dist/{chunk-dvpxkzms.js → chunk-zs90w6ke.js} +2 -2
- package/dist/{chunk-dvpxkzms.js.map → chunk-zs90w6ke.js.map} +1 -1
- package/dist/chunks/{ThemeProvider-Dn3UREDn.js → ThemeProvider-D1kDfCwY.js} +59 -2
- package/dist/chunks/ThemeProvider-D1kDfCwY.js.map +1 -0
- package/dist/client/Link.d.ts.map +1 -1
- package/dist/client/MutationError.d.ts +60 -50
- package/dist/client/MutationError.d.ts.map +1 -1
- package/dist/client/ProgressManager.d.ts +1 -1
- package/dist/client/QueryResource.d.ts +20 -0
- package/dist/client/QueryResource.d.ts.map +1 -1
- package/dist/client/index.d.ts +2 -1
- package/dist/client/index.d.ts.map +1 -1
- package/dist/client/index.js +109 -35
- package/dist/client/index.js.map +1 -1
- package/dist/client/useMutation.d.ts.map +1 -1
- package/dist/client/useQuery.d.ts.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/Email.d.ts.map +1 -1
- package/dist/email/debugEmail.d.ts +40 -0
- package/dist/email/debugEmail.d.ts.map +1 -0
- package/dist/email/index.js +4 -3
- package/dist/email/index.js.map +6 -5
- 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/ApiRouter.d.ts +12 -0
- package/dist/http/ApiRouter.d.ts.map +1 -1
- package/dist/http/CSRFMiddleware.d.ts +1 -1
- package/dist/http/CSRFMiddleware.d.ts.map +1 -1
- package/dist/http/Error.d.ts +50 -0
- package/dist/http/Error.d.ts.map +1 -1
- package/dist/http/HttpRequest.d.ts +26 -0
- package/dist/http/HttpRequest.d.ts.map +1 -1
- package/dist/http/RateLimitMiddleware.d.ts +6 -3
- package/dist/http/RateLimitMiddleware.d.ts.map +1 -1
- package/dist/http/Router.d.ts.map +1 -1
- package/dist/http/errors.d.ts.map +1 -1
- package/dist/http/index.d.ts +2 -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/http/mediaType.d.ts +16 -0
- package/dist/http/mediaType.d.ts.map +1 -0
- package/dist/http/refusal.d.ts +52 -0
- package/dist/http/refusal.d.ts.map +1 -0
- 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 +2 -2
- package/dist/kernel/index.js +2 -2
- package/dist/kernel/index.js.map +2 -2
- package/dist/orm/index.js +2 -2
- package/dist/orm/index.js.map +1 -1
- package/dist/server/devFetch.d.ts.map +1 -1
- package/dist/server/forwardedFor.d.ts +42 -0
- package/dist/server/forwardedFor.d.ts.map +1 -0
- package/dist/server/httpProd.d.ts.map +1 -1
- package/dist/server/index.js +2 -2
- package/dist/server/index.js.map +1 -1
- package/dist/server/staticFile.d.ts +33 -0
- package/dist/server/staticFile.d.ts.map +1 -0
- package/dist/server/unhandledError.d.ts.map +1 -1
- package/dist/services/index.js +2 -2
- package/dist/services/index.js.map +2 -2
- package/dist/services/mcp/McpRegistry.d.ts +2 -1
- package/dist/services/mcp/McpRegistry.d.ts.map +1 -1
- package/dist/services/mcp/toAgentTools.d.ts +1 -1
- 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/services/router/notFound.d.ts.map +1 -1
- package/dist/services/router/policyDenied.d.ts.map +1 -1
- package/dist/services/router/serverQueryFetcher.d.ts.map +1 -1
- package/dist/support/index.js +2 -2
- package/dist/support/index.js.map +1 -1
- package/dist/testing/index.js +1 -1
- package/package.json +1 -1
- package/skills/gemi-react-best-practices/rules/controller-throw-framework-errors.md +5 -0
- package/dist/chunk-302mkqeq.js +0 -7
- package/dist/chunk-49akdtfe.js +0 -17
- package/dist/chunk-ash9e6fn.js +0 -5
- package/dist/chunk-e43drft2.js +0 -5
- package/dist/chunk-j5xcfeqx.js +0 -24
- package/dist/chunk-j5xcfeqx.js.map +0 -16
- package/dist/chunk-rp5j1mgk.js +0 -55
- package/dist/chunk-tmwsvf02.js +0 -5
- package/dist/chunks/ThemeProvider-Dn3UREDn.js.map +0 -1
- /package/dist/{chunk-ah9ajys0.js.map → chunk-2gdhcswa.js.map} +0 -0
- /package/dist/{chunk-jg9eqd3r.js.map → chunk-c3gzpjba.js.map} +0 -0
- /package/dist/{chunk-pgpqsgzx.js.map → chunk-sejnmn1q.js.map} +0 -0
package/dist/chunk-ash9e6fn.js
DELETED
|
@@ -1,5 +0,0 @@
|
|
|
1
|
-
// @bun
|
|
2
|
-
var _=new WeakMap;function X(q){let z=_.get(q);if(!z)throw Error("gemi/ai: expected a schema built with `s`, got a foreign object");return z}function Q(q){let z=(q.optional||q.nullable)&&q.node.kind!=="json",A=E($(q.node),z);return q.description?{description:q.description,...A}:A}function $(q){switch(q.kind){case"string":return{type:"string"};case"number":return{type:"number"};case"boolean":return{type:"boolean"};case"literal":return{type:typeof q.value,const:q.value};case"enum":return{type:"string",enum:q.values};case"array":return{type:"array",items:Q(q.item)};case"object":return{type:"object",properties:Object.fromEntries(Object.entries(q.shape).map(([z,A])=>[z,Q(A)])),required:Object.keys(q.shape),additionalProperties:!1};case"union":return{anyOf:q.members.map(Q)};case"json":return{}}}function E(q,z){if(!z)return q;if(q.anyOf)return{...q,anyOf:[...q.anyOf,{type:"null"}]};if(q.enum||q.const!==void 0)return{anyOf:[q,{type:"null"}]};if(typeof q.type==="string")return{...q,type:[q.type,"null"]};return{anyOf:[q,{type:"null"}]}}function T(q){if(q===null)return"null";if(Array.isArray(q))return"array";return typeof q}function g(q,z){if(typeof z==="number"&&!Number.isFinite(z))return String(z);if(q.kind==="literal"||q.kind==="enum"){if(typeof z==="string"||typeof z==="number"||typeof z==="boolean")return JSON.stringify(z)}return T(z)}function x(q){let z=q.node,A=(()=>{switch(z.kind){case"string":case"number":case"boolean":return z.kind;case"literal":return JSON.stringify(z.value);case"enum":return`one of ${z.values.map((B)=>JSON.stringify(B)).join(" | ")}`;case"array":return"array";case"object":return"object";case"union":return"one of the variants";case"json":return"a JSON value"}})();return q.optional||q.nullable?`${A} or null`:A}function Y(q){return q?`${q}: `:""}function Z(q,z){if(z===null||z===void 0)return q.optional||q.nullable?1:0;let A=q.node;switch(A.kind){case"string":return typeof z==="string"?1:0;case"number":return typeof z==="number"?1:0;case"boolean":return typeof z==="boolean"?1:0;case"literal":return z===A.value?10:0;case"enum":return typeof z==="string"&&A.values.includes(z)?10:0;case"array":return Array.isArray(z)?1:0;case"object":{if(typeof z!=="object"||Array.isArray(z))return 0;let B=z,C=1;for(let[F,G]of Object.entries(A.shape))C+=Z(G,B[F]);return C}case"union":return A.members.reduce((B,C)=>Math.max(B,Z(C,z)),0);case"json":return 1}}function P(q,z,A,B){if(q.optional&&(z===null||z===void 0))return{drop:!0,value:void 0};if(q.nullable&&z===null)return{drop:!1,value:null};return{drop:!1,value:w(q,z,A,B)}}function w(q,z,A,B){let C=q.node,F=()=>{B.push(`${Y(A)}expected ${x(q)}, got ${g(C,z)}`);return};switch(C.kind){case"string":return typeof z==="string"?z:F();case"number":return typeof z==="number"&&Number.isFinite(z)?z:F();case"boolean":return typeof z==="boolean"?z:F();case"literal":return z===C.value?z:F();case"enum":return typeof z==="string"&&C.values.includes(z)?z:F();case"array":{if(!Array.isArray(z))return F();return z.map((G,H)=>{let D=P(C.item,G,`${A}[${H}]`,B);return D.drop?void 0:D.value})}case"object":{if(typeof z!=="object"||z===null||Array.isArray(z))return F();let G=z,H={};for(let[D,L]of Object.entries(C.shape)){let M=P(L,G[D],A?`${A}.${D}`:D,B);if(!M.drop)H[D]=M.value}return H}case"union":{let G;for(let H of C.members){let D=[],L=P(H,z,A,D);if(D.length===0)return L.drop?void 0:L.value;let M=Z(H,z);if(!G||M>G.score)G={errors:D,score:M}}B.push(`${Y(A)}no matching variant; closest: ${G.errors.join("; ")}`);return}case"json":if(z===void 0)return F();return R(z,A,B,new Set),z}}function R(q,z,A,B,C=!0){let F=(H)=>{A.push(`${Y(z)}expected a JSON value, got ${H}`)};switch(typeof q){case"undefined":case"string":case"boolean":return;case"number":if(!Number.isFinite(q))F(String(q));return;case"bigint":return F("a bigint");case"function":return F("a function");case"symbol":return F("a symbol")}if(q===null)return;let G=q;if(B.has(G))return F("a circular reference");B.add(G);try{let H=C?G.toJSON:void 0;if(typeof H==="function"){let D;try{D=H.call(G)}catch{return F("a toJSON that threw")}if(D===void 0)return F("a toJSON that returns undefined");return R(D,z,A,B,!1)}if(Array.isArray(q))q.forEach((D,L)=>R(D,`${z}[${L}]`,A,B));else for(let[D,L]of Object.entries(G))R(L,z?`${z}.${D}`:D,A,B)}finally{B.delete(G)}}function I(q){return U(q)}function U(q){let z={toJSONSchema:()=>Q(q),parse(A){let B=[],C=P(q,A,"",B);if(B.length>0)throw Error(B.join("; "));return C.drop?void 0:C.value},safeParse(A){let B=[],C=P(q,A,"",B);if(B.length>0)return{ok:!1,errors:B};return{ok:!0,value:C.drop?void 0:C.value}},describe:(A)=>U({...q,description:A}),optional:()=>U({...q,optional:!0}),nullable:()=>U({...q,nullable:!0,optional:!1})};return _.set(z,q),z}function K(q){return{node:q,optional:!1,nullable:!1}}var O={string:()=>I(K({kind:"string"})),number:()=>I(K({kind:"number"})),boolean:()=>I(K({kind:"boolean"})),literal:(q)=>I(K({kind:"literal",value:q})),enum:(q)=>I(K({kind:"enum",values:q})),object:(q)=>I(K({kind:"object",shape:Object.fromEntries(Object.entries(q).map(([z,A])=>[z,X(A)]))})),array:(q)=>I(K({kind:"array",item:X(q)})),union:(q)=>I(K({kind:"union",members:q.map(X)})),json:()=>I(K({kind:"json"}))};function J(q){let z=_.get(q);if(z)return W(z.node);return V(q.toJSONSchema())}function V(q){if(!(q.type!==void 0||q.enum!==void 0||q.const!==void 0||q.anyOf!==void 0||q.properties!==void 0||q.items!==void 0))return!1;for(let A of Object.values(q.properties??{}))if(!V(A))return!1;if(q.items&&!V(q.items))return!1;for(let A of q.anyOf??[])if(!V(A))return!1;return!0}function W(q){switch(q.kind){case"string":case"number":case"boolean":case"literal":case"enum":return!0;case"object":return Object.values(q.shape).every((z)=>W(z.node));case"array":return W(q.item.node);case"union":return q.members.every((z)=>W(z.node));case"json":return!1}}
|
|
3
|
-
export{O as Db,J as Eb};
|
|
4
|
-
|
|
5
|
-
//# debugId=0B622B65767C52F564756E2164756E21
|
package/dist/chunk-e43drft2.js
DELETED
|
@@ -1,5 +0,0 @@
|
|
|
1
|
-
// @bun
|
|
2
|
-
import{Db as b}from"./chunk-ash9e6fn.js";import{Mb as m,Ob as k,Qb as WZ,Rb as HZ,Sb as XZ,Ub as UZ}from"./chunk-vmpzg4z5.js";import{$b as ZZ,Xb as r,Yb as a,Zb as C,_b as e,bc as $Z}from"./chunk-1s914cdj.js";import{ec as I}from"./chunk-rv7da58g.js";import{Fc as E,Hc as n,Qc as zZ,Rc as c,Vc as j,bd as d,cd as f,hd as l,od as S,rc as CZ,vd as F,wd as v,xd as w}from"./chunk-49akdtfe.js";import{Fd as YZ,Gd as h}from"./chunk-tdnfhe7x.js";import{jf as u,lf as y,mf as D}from"./chunk-302mkqeq.js";import{vf as JZ}from"./chunk-wkdzz0rx.js";import{bg as U}from"./chunk-m4xw99vm.js";import{gg as p}from"./chunk-zp971jp2.js";import{lg as M}from"./chunk-v27a4se1.js";import{mg as VZ}from"./chunk-wh728wd6.js";async function FZ(Z){try{if(!await Z.shouldRun.call(Z))return}catch($){console.error(`Error evaluating shouldRun for cron job ${Z.name}:`,$);return}try{await Z.onTick.call(Z)}catch($){console.error(`Error executing cron job ${Z.name}:`,$)}try{await Z.callback.call(Z)}catch($){console.error(`Error in cron job ${Z.name}:`,$)}try{await Z.onComplete.call(Z)}catch($){console.error(`Error completing cron job ${Z.name}:`,$)}}class A{static token="scheduler";handles=[];resolved;inFlight=new Map;stopped=!1;constructor(Z){this.resolved=Z.jobs}get jobs(){return[...this.resolved]}useJobs(Z){this.resolved=Z}start(Z=($)=>$()){if(this.stopped=!1,this.resolved.length===0)return;let $=globalThis.__gemiCronJobs??=new Map,H=new Map;for(let G of this.resolved){let V=new G;if(!V.name){console.error(`Cron job must have a name \u2014 ${G.name||"an anonymous class"} has none, so it is not scheduled. If this is a base class that other jobs extend, move it out of the discovered directory: \`abstract\` does not survive to runtime, so a class under app/cron is indistinguishable from a job.`);continue}if(!V.cron){console.error(`Cron job must have an expression. Job: ${V.name}`);continue}let X=H.get(V.name);if(X!==void 0){console.error(`Two cron jobs claim the name "${V.name}" \u2014 ${X} is scheduled and ${G.name||"an anonymous class"} is not. A name is the scheduler's key, so only one job can hold it. Rename one.`);continue}H.set(V.name,G.name||"an anonymous class"),$.get(V.name)?.stop();let Y=Bun.cron(V.cron,()=>{if(this.stopped)return;return this.track(V.name,()=>Z(()=>FZ(V)))});$.set(V.name,Y),this.handles.push(Y)}}stop(){this.stopped=!0;for(let Z of this.handles)Z.stop();this.handles=[]}async drain(Z=1/0){this.stop();let $,H=new Promise((G)=>{if(Z!==1/0)$=setTimeout(G,Z)});return await Promise.race([Promise.allSettled([...this.inFlight.values()].map((G)=>G.done)),H]),clearTimeout($),{unfinished:[...this.inFlight.values()].map((G)=>({...G.tick}))}}get running(){return this.inFlight.size}track(Z,$){let H={},G=Promise.resolve().then($).finally(()=>this.inFlight.delete(H));return this.inFlight.set(H,{tick:{name:Z,startedAt:new Date},done:G}),G}}import{isMainThread as xZ}from"worker_threads";var EZ=100,TZ=(Z)=>Math.min(EZ,Math.floor(Z/10));class SZ extends I{register(){this.app.singleton(C,()=>new C(this.app.config.get("queue",{}),{application:this.app}))}async boot(){let Z=this.app.config.get("queue",{});if(Z.jobs!==void 0)return;let{jobsDir:$}=U(r(),Z);this.app.make(C).useJobs(await HZ($))}async shutdown(Z){if(!this.app.resolved(C))return;let $=this.app.make(C);if($.running>0)console.log(`[gemi] Shutting down: waiting for ${$.running} running queued job(s).`);let H=Z?.timeoutMs,{unfinished:G}=await $.drain(H===void 0?1/0:Math.max(0,H-TZ(H)));if(G.length>0)return console.error("[gemi] Queued jobs still running at shutdown: "+G.map((V)=>`${V.name} (${V.id})`).join(", ")),{abandoned:!0}}}function B3(Z){if(DZ(Z),Bun.env.NODE_ENV!=="production")return jZ(Z);if(GZ(Z))return;if(!e())return;if(!Z.bound(C))return;Z.make(C).start()}function GZ(Z){let $=Z.config.get("queue",{}).driver??"memory";return $==="memory"||$ instanceof a}function RZ(Z){if(GZ(Z))return!0;if(typeof Z.config.get("queue",{}).driver!=="function"||!Z.bound(C))return!1;try{return!Z.make(C).durable}catch{return!1}}function DZ(Z){let $=process.env.GEMI_QUEUE_CLAIM;if($===void 0||$Z())return;if(process.env.ROOT_DIR===void 0||!xZ)return;if(ZZ()){if(!RZ(Z))return;console.warn('[gemi] GEMI_QUEUE_CLAIM=off is ignored: the memory queue driver keeps jobs in the process that dispatched them, so no worker could run them. This server runs its own jobs. Use a driver other processes can read, such as "database", to hand jobs to `gemi queue:work`.')}else if($.trim().toLowerCase()!=="on")console.warn(`[gemi] GEMI_QUEUE_CLAIM="${$}" is not "off" or "on", so this server claims jobs. Set it to "off" to leave them to \`gemi queue:work\`.`)}function jZ(Z){let $=globalThis.__gemiDevQueue;if(!$)return;if(globalThis.__gemiDevQueue=void 0,$.stop(),Z.bound(C))Z.make(C).start()}class MZ extends I{register(){this.app.singleton(w,()=>new w(this.app.config.get("auth",{})))}}var kZ=100,yZ=(Z)=>Math.min(kZ,Math.floor(Z/10));class fZ extends I{register(){this.app.singleton(A,()=>new A(U(m(),this.app.config.get("schedule",{}))))}async boot(){let Z=this.app.make(A),$=this.app.config.get("schedule",{});if($.jobs===void 0){let{jobsDir:G}=U(m(),$);Z.useJobs(await XZ(G))}if(process.env.GEMI_NO_SCHEDULE==="1")return;let H=this.app;Z.start((G)=>VZ.run(H,G))}async shutdown(Z){if(!this.app.resolved(A))return;let $=this.app.make(A);if($.running>0)console.log(`[gemi] Shutting down: waiting for ${$.running} running cron tick(s).`);let H=Z?.timeoutMs,{unfinished:G}=await $.drain(H===void 0?1/0:Math.max(0,H-yZ(H)));if(G.length>0)return console.error("[gemi] Cron jobs still running at shutdown: "+G.map((V)=>`${V.name} (started ${V.startedAt.toISOString()})`).join(", ")),{abandoned:!0}}}class N extends zZ{modelName;constructor(Z="FeatureFlag"){super();this.modelName=Z}get available(){return YZ(this.modelName)}async load(){if(!this.available)throw new c(this.modelName);let Z=h(this.modelName);return await Z.asSystem(()=>Z.findMany())}async write(Z,$,H){if(!this.available)throw new c(this.modelName);let G=h(this.modelName),V=this.hasActorColumn(G),X={active:$};if(V)X.updatedBy=H.actor;return await G.asSystem(()=>G.upsert({where:{key:Z},create:{key:Z,...X},update:X})),{actorRecorded:V}}hasActorColumn(Z){let $=Z?.$schema?.fields?.updatedBy;return $!==void 0&&$.type==="String"}}function D3(Z){return Z}function KZ(){return{features:void 0,enabled:!0,source:new N,model:"FeatureFlag",ttl:30,context:void 0,onEvaluate:void 0,maxClientFlags:200}}class bZ extends I{register(){this.app.singleton(j,()=>{let Z=this.app.config.get("features",{}),$=U(KZ(),Z);if(Z?.model!==void 0&&Z?.source===void 0)$.source=new N(Z.model);else if(Z?.model!==void 0&&Z.source instanceof N&&Z.source.modelName!==Z.model)D.warning(`app/config/features.ts sets \`model: "${Z.model}"\` and a source reading "${Z.source.modelName}". The source wins; drop \`model\` to silence this.`);return new j($,(H)=>D.warning(H))})}async boot(){let Z=this.app.make(j);if(!Z.config.enabled)return;try{await Z.refresh()}catch($){D.error(`Could not warm the feature flag cache at boot. ${$ instanceof Error?$.message:String($)}`)}}}class gZ extends I{register(){this.app.singleton(p,()=>new p(this.app.config.get("mail",{})))}}function vZ(Z){return`listener:${Z}`}function IZ(Z,$){wZ(Z);let{maxAttempts:H,backoff:G,worker:V}=$,X=Z.event.name,Y=class extends WZ{maxAttempts=H;backoff=G;worker=V;async run(...z){let[K,B]=mZ(z),J=M(Q).rehydrate(K,B);await new Z().handle(J)}onFail(z){console.error(`The listener ${Z.name} threw while handling ${X} off the queue. The queue will retry it up to ${H} times in total; nothing the dispatcher did is waiting on it.`,z)}onDeadletter(z){console.error(`The listener ${Z.name} failed every one of its ${H} attempts at ${X} and has been dead-lettered, so this side effect did not happen and will not be retried.`,z)}};return Object.defineProperty(Y,"name",{value:vZ(Z.name),writable:!0}),Y}function wZ(Z){if(Object.getOwnPropertyDescriptor(Z,"name")?.writable)return;throw Error(`The listener ${Z.name} sets \`queued = true\` but does not declare \`static name\`, so it would be registered with the queue `+"under its class name \u2014 which a production build renames while the "+`payload that names it does not. Add: static name = "${Z.name}";`)}function mZ(Z){return typeof Z[0]==="string"?Z:Z[0]}class Q{static token="events";listeners={};events={};warnedFor=new Set;warnedAboutWaiting=new Set;config;constructor(Z={}){this.config=U(k(),Z),this.useListeners(this.config.listeners)}useListeners(Z){this.config.listeners=Z,this.listeners={},this.events={};let $=new Set;for(let H of Z){if(!H.event){console.error(`Listener ${H.name} does not declare \`static event\`, so there is no event name to register it under and its handle will never run. Add: static event = SomeEvent;`);continue}if($.has(H.name)){console.error(`Two event listeners are named "${H.name}" \u2014 the first is `+"registered and this one is not. A listener's name identifies it across the framework, so only one class can hold it. Rename one.");continue}$.add(H.name);let G=H.event.name,V=new H;this.events[G]??=H.event,(this.listeners[G]??=[]).push({listener:H,job:V.queued?IZ(H,V):null})}}get queuedListenerJobs(){return Object.values(this.listeners).flat().flatMap(({job:Z})=>Z?[Z]:[])}get registeredListeners(){return[...this.config.listeners]}dispatch(Z,$){if(this.deferToCommit(Z,$,!1))return;this.runListeners(Z,$)}async dispatchAndWait(Z,$){if(this.deferToCommit(Z,$,!0))return;return this.runListeners(Z,$)}deferToCommit(Z,$,H){let{name:G,afterCommit:V}=Z.constructor;if(!V)return!1;let X=JZ(()=>this.runListeners(Z,$));if(X&&H)this.warnNothingIsWaitedFor(G);return X}async runListeners(Z,$){let H=Z.constructor.name,G=this.listeners[H];if(!G?.length){this.warnNothingIsListening(H);return}for(let{listener:V,job:X}of G){if(X){this.enqueue(X,V,H,$);continue}try{await new V().handle(Z)}catch(Y){console.error(`The listener ${V.name} threw while handling ${H}. The `+"listeners after it still ran \u2014 a listener's failure is its own.",Y)}}}rehydrate(Z,$=[]){let H=this.events[Z];if(!H)throw Error(`Cannot rebuild the event "${Z}" that came off the queue: no registered listener binds to an event of that name, so there is no class to construct. A queued listener runs in an application that `+"discovered its own listeners \u2014 check that this process sees the "+`same app/listeners as the one that dispatched, and that the event declares \`static name = "${Z}"\`.`);return new H(...$)}enqueue(Z,$,H,G){if(G===void 0){console.error(`The listener ${$.name} is queued, but ${H} reached the dispatcher without its constructor arguments, so there is nothing for the queue to rebuild it from and the listener was skipped. Dispatch through ${H}.dispatch(...) or ${H}.dispatchAndWait(...), which carry them.`);return}let V=(X)=>console.error(`The listener ${$.name} could not be queued for ${H}, so it did not run and will not be retried. The listeners after it still ran.`,X);try{M(C).push(Z,JSON.stringify([H,G]),{reportFailure:!1}).catch(V)}catch(X){V(X)}}warnNothingIsWaitedFor(Z){if(Bun.env.NODE_ENV==="production")return;if(this.warnedAboutWaiting.has(Z))return;this.warnedAboutWaiting.add(Z),console.warn(`[gemi] ${Z}.dispatchAndWait() was called inside a transaction and ${Z} declares \`static afterCommit = true\`, so it resolved `+"immediately with no listener having run \u2014 they run when the "+"transaction commits. Await the transaction instead, or drop afterCommit if the caller needs the side effects first. Development only.")}warnNothingIsListening(Z){if(Bun.env.NODE_ENV==="production")return;if(this.warnedFor.has(Z))return;this.warnedFor.add(Z),console.warn(`[gemi] ${Z} was dispatched and nothing is listening for it. A listener registers under the name its event declares, so check that app/listeners holds a Listener with \`static event = ${Z}\` and that ${Z} declares \`static name = "${Z}"\`. Development only.`)}}class hZ extends I{register(){this.app.singleton(Q,()=>new Q(this.app.config.get("events",{})))}async boot(){let Z=this.app.make(Q),$=this.app.config.get("events",{});if($.listeners===void 0){let{listenersDir:V}=U(k(),$);Z.useListeners(await UZ(V))}let H=Z.queuedListenerJobs;if(H.length===0)return;let G=this.app.make(C);for(let V of H)G.registerJob(V)}}class cZ extends I{register(){this.app.singleton(u,()=>new u(this.app.config.get("filesystem",{})))}}class pZ extends I{register(){this.app.singleton(d,()=>new d(this.app.config.get("image",{})))}}class uZ extends I{register(){this.app.instance(l,new l)}}function P4(Z){return Z}function BZ(){return{maxFileSize:10485760,onLogFileClosed:()=>{},onLogCreated:()=>{}}}class dZ extends I{register(){this.app.singleton(y,()=>new y(U(BZ(),this.app.config.get("log",{}))))}async boot(){if(!process.env.ROOT_DIR)return;await this.app.make(y).boot()}}class lZ extends I{register(){this.app.singleton(f,()=>new f(U(CZ(),this.app.config.get("middleware",{}))))}boot(){this.app.make(f).assertGlobalMiddleware()}}class s{}function PZ(Z,$){return Math.floor(Z/$)*$}function sZ(Z,$){if($<=0)return 0;return Math.min(1,Math.max(0,($-Z)/$))}function i(Z,$,H,G){return $*sZ(H,G)+Z}function iZ(Z){let{current:$,previous:H,elapsed:G,window:V,limit:X,cost:Y}=Z,z=X-Y;if(z<0)return V;let K=Math.max(0,V-G);if(H>0){let J=V*(1-(z-$)/H);if(J<=V)return Math.max(0,Math.ceil(J-G))}if($<=z)return K;if($<=0)return K;let B=V*(1-z/$);return K+Math.max(0,Math.ceil(B))}function _Z(Z){let{allowed:$,current:H,previous:G,now:V,elapsed:X,window:Y,limit:z,cost:K}=Z;if($){let J=i(H,G,X,Y);return{allowed:!0,limit:z,remaining:Math.max(0,Math.floor(z-J)),resetAt:V-X+Y,retryAfter:0}}let B=iZ({current:H,previous:G,elapsed:X,window:Y,limit:z,cost:K});return{allowed:!1,limit:z,remaining:0,resetAt:V+B,retryAfter:B}}class o extends s{buckets=new Map;maxKeys;constructor(Z={}){super();this.maxKeys=Math.max(1,Z.maxKeys??1e5)}consume(Z){let{key:$,limit:H,window:G}=Z,V=Z.cost??1,X=Date.now(),Y=PZ(X,G),z=X-Y,K=this.roll($,G,Y),J=i(K.current,K.previous,z,G)+V<=H;if(J)K.current+=V;if(this.buckets.delete($),this.buckets.set($,K),this.buckets.size>this.maxKeys)this.evict(X);return _Z({allowed:J,current:K.current,previous:K.previous,now:X,elapsed:z,window:G,limit:H,cost:V})}clear(){this.buckets.clear()}get size(){return this.buckets.size}roll(Z,$,H){let G=this.buckets.get(Z);if(!G||G.window!==$)return{window:$,windowStart:H,current:0,previous:0};if(G.windowStart===H)return G;if(G.windowStart+$===H)return G.previous=G.current,G.current=0,G.windowStart=H,G;return G.previous=0,G.current=0,G.windowStart=H,G}evict(Z){for(let[$,H]of this.buckets)if(Z-H.windowStart>=H.window*2)this.buckets.delete($);for(let $ of this.buckets.keys()){if(this.buckets.size<=this.maxKeys)break;this.buckets.delete($)}}}function y4(Z){return Z}function OZ(){return{driver:new o,limit:1000,window:60}}class oZ extends I{register(){this.app.singleton(n,()=>new n(U(OZ(),this.app.config.get("ratelimiter",{}))))}}function h4(Z){return Z}function qZ(){return{url:process.env.REDIS_URL,options:void 0}}class nZ extends I{register(){this.app.singleton(E,()=>new E(U(qZ(),this.app.config.get("redis",{}))))}shutdown(){if(!this.app.resolved(E))return;this.app.make(E).close()}}class P extends Error{status;constructor(Z,$){super(Z);this.status=$;this.name="McpToolError"}}var tZ=/^[A-Za-z0-9_-]{1,64}$/,rZ=/:([A-Za-z_][A-Za-z0-9_]*)([?*+]?)/g,LZ=4000,t=1e5,aZ=/^(text\/|application\/([\w.+-]*\+)?(json|xml))/i;class T{dispatcher;static token="router.mcp";plans=new Map;constructor(Z,$){this.dispatcher=$;for(let[H,G]of Object.entries(Z.routes??{}))this.plans.set(H,this.plan(H,G))}list(Z,$){return AZ(Z),this.descriptors($)}descriptors(Z){let $=[];for(let{descriptor:H}of this.plans.values()){if(Z?.names&&!Z.names.includes(H.name))continue;if(Z?.tags&&!H.tags.some((G)=>Z.tags.includes(G)))continue;$.push(H)}return $}async execute(Z,$,H,G){AZ(Z);let V=this.plans.get($);if(!V)throw Error(`McpRegistry: there is no tool named "${$}".`);let{descriptor:X}=V,Y=X.inputSchema.safeParse(H);if(Y.ok===!1)throw new P(`Invalid arguments for "${$}": ${Y.errors.join(", ")}`);let z=Y.value,K=await this.fillPath(V,z,Z.req),{path:B}=this.dispatcher.getRouteHandlerAndParams(new Request(`http://gemi.internal/api${K}`));if(B!==X.url)throw new P(`"${$}" has nothing at ${K}.`,404);let J={};for(let L of V.jsonKeys)if(z[L]!==void 0)J[L]=z[L];let _,O="";if(V.fileFields.length>0)_=await this.formData(V,z,J,G);else if(X.method==="GET")O=H3(J);else if(V.jsonKeys.length>0)_=J;let x;try{x=await this.dispatcher.dispatchAs(Z.req,X.method,O?`${K}?${O}`:K,_)}catch(L){throw console.error(`[gemi/mcp] Dispatching "${$}" failed:`,L),new P(`"${$}" failed on the server.`,500)}return await G3($,x)}plan(Z,$){if(!tZ.test(Z))throw Error(`McpRouter: "${Z}" is not a valid tool name. A routes key is the tool's name as a model and an MCP client see it, used verbatim \u2014 letters, digits, "_" and "-", at most 64.`);let H=`McpRouter: "${Z}" (${$?.method} ${$?.url})`;if(!($ instanceof Object)||$.__internal_brand!=="McpRoute")throw Error(`McpRouter: "${Z}" is not a route. Declare it with this.fromApiRoute(...).`);let{method:G,url:V,meta:X}=$;if(V.startsWith("/__gemi__"))throw Error(`${H} is a framework route, not an app route.`);let Y=this.dispatcher.flatRoutes[V]?.[G];if(!Y)throw Error(`${H} names no route of this app. Expose a route by the path and verb it is mounted at.`);let z=[...V.matchAll(rZ)].map(([,W,q])=>({name:W,modifier:q})),K=X.params??{};for(let W of z)if(!(W.name in K))throw Error(`${H}: the path param "${W.name}" must be bound or declared "input".`);for(let[W,q]of Object.entries(K)){if(!z.some((R)=>R.name===W))throw Error(`${H}: "${W}" in params is not a param of the url.`);QZ(H,`params.${W}`,q)}let B=[],J;if(X.input){if(J=X.input.toJSONSchema(),J.type!=="object"||!J.properties)throw Error(`${H}: input must be an s.object(...), the fields of the request body.`);B=Object.keys(J.properties)}let _=Object.entries(X.files??{}).map(([W,q])=>({name:W,binder:q}));for(let W of _)QZ(H,`files.${W.name}`,W.binder);if(_.length>0&&G==="GET")throw Error(`${H}: a GET has no body to carry a file.`);let O={},x=new Map;for(let W of z){let q=K[W.name];if(q==="input"){let R=b.string().describe(`The ":${W.name}" segment of the url.`);O[W.name]=W.modifier==="?"||W.modifier==="*"?R.optional():R}else x.set(W.name,q)}for(let W of _)if(W.binder==="input")O[W.name]=b.string().describe("The id of an attachment the user uploaded or a tool produced (gemi_att_\u2026), whose file is sent as this field.");let L=[...Object.keys(O),..._.map((W)=>W.name)];for(let W of new Set(L))if(B.includes(W))throw Error(`${H}: "${W}" is both an input field and a param or file, and the model can only send one.`);return{descriptor:Object.freeze({name:Z,description:X.description,method:G,url:V,inputSchema:Z3(X.input,J,b.object(O)),annotations:eZ(G),tags:Object.freeze([...X.tags??[]]),requiresApproval:X.requiresApproval===!0,...Y.source?{source:Y.source}:{}}),params:z,paramBinders:x,fileFields:_,jsonKeys:B}}async fillPath(Z,$,H){let G=Z.descriptor.url;for(let V of Z.params){let X=Z.paramBinders.get(V.name),Y;if(X){if(Y=await this.bind(Z,`the param "${V.name}"`,()=>X(H)),Y===void 0||Y===null||Y==="")throw console.error(`[gemi/mcp] The binder for "${V.name}" of "${Z.descriptor.name}" returned ${JSON.stringify(Y)}.`),new P(`"${Z.descriptor.name}" failed on the server.`,500)}else Y=$[V.name];let z=`:${V.name}${V.modifier}`;if(Y===void 0||Y===null||Y===""){if(V.modifier!=="?"&&V.modifier!=="*")throw new P(`"${V.name}" of "${Z.descriptor.name}" must not be empty.`);G=G.replace(`/${z}`,"");continue}G=G.replace(z,$3(Z.descriptor.name,V,String(Y)))}return G}async formData(Z,$,H,G){let V=Z.descriptor.name;if(!G)throw Error(`McpRegistry: "${V}" sends a file, which is resolved through the tool context's attachments, and none was passed to execute().`);let X=new FormData;for(let[Y,z]of Object.entries(H))NZ(X,Y,z);for(let Y of Z.fileFields){let z=Y.binder==="input"?$[Y.name]:await this.bind(Z,`the file "${Y.name}"`,()=>Y.binder(G));if(typeof z!=="string"||z==="")throw new P(`"${V}" needs a file for "${Y.name}", and this turn has none. Ask the user to attach one.`);X.append(Y.name,await G.attachments.file(z))}return X}async bind(Z,$,H){try{return await H()}catch(G){throw console.error(`[gemi/mcp] Binding ${$} of "${Z.descriptor.name}" failed:`,G),new P(`"${Z.descriptor.name}" failed on the server.`,500)}}}function AZ(Z){if(Z?.kind!=="local")throw Error("McpRegistry: only local callers are implemented. A remote caller needs a bearer-token resolver, which v1 does not have \u2014 and until it does there is no remote surface to call from.")}function QZ(Z,$,H){if(H!=="input"&&typeof H!=="function")throw Error(`${Z}: ${$} must be a function or "input".`)}function eZ(Z){switch(Z){case"GET":return Object.freeze({readOnlyHint:!0});case"DELETE":return Object.freeze({destructiveHint:!0});case"PUT":return Object.freeze({idempotentHint:!0});default:return Object.freeze({})}}function Z3(Z,$,H){let G=H.toJSONSchema(),V={...$??{},type:"object",properties:{...$?.properties??{},...G.properties},required:[...$?.required??[],...G.required??[]],additionalProperties:!1},X=(Y)=>{if(typeof Y!=="object"||Y===null||Array.isArray(Y))return{ok:!1,errors:["expected an object"]};let z=[],K={};if(Z){let J=Z.safeParse(Y);if(J.ok===!1)z.push(...J.errors);else K={...J.value}}let B=H.safeParse(Y);if(B.ok===!1)z.push(...B.errors);else K={...K,...B.value};return z.length>0?{ok:!1,errors:z}:{ok:!0,value:K}};return{toJSONSchema:()=>V,safeParse:X,parse(Y){let z=X(Y);if(z.ok===!1)throw Error(z.errors.join(", "));return z.value}}}function $3(Z,$,H){let G=$.modifier==="*"||$.modifier==="+"?H.split("/"):[H];if(G.some((V)=>V==="."||V===".."))throw new P(`"${H}" is not a valid value for "${$.name}" of "${Z}".`);return G.map(encodeURIComponent).join("/")}function NZ(Z,$,H){if(H===void 0||H===null)return;if(Array.isArray(H)){for(let G of H)NZ(Z,$,G);return}Z.append($,typeof H==="object"?JSON.stringify(H):String(H))}function H3(Z){let $=new URLSearchParams,H=(G,V)=>{if(V===void 0||V===null)return;if(Array.isArray(V)){for(let X of V)H(G,X);return}$.append(G,typeof V==="object"?JSON.stringify(V):String(V))};for(let[G,V]of Object.entries(Z))H(G,V);return $.toString()}async function G3(Z,$){if($.status>=200&&$.status<300){let G=$.headers.get("Content-Type");if(G&&!aZ.test(G)){let X=(await $.arrayBuffer()).byteLength;return`"${Z}" answered with ${X} bytes of ${G}, which is not shown.`}let V=await $.text();if(V==="")return null;if(V.length>t)return`${V.slice(0,t)}\u2026 [cut at ${t} of ${V.length} characters]`;try{return JSON.parse(V)}catch{return V}}let H=await $.text();if($.status>=400&&$.status<500){let G=H.length>LZ?`${H.slice(0,LZ)}\u2026`:H;throw new P(`"${Z}" was refused with ${$.status}${G?`: ${G}`:"."}`,$.status)}if($.status<500)console.error(`[gemi/mcp] "${Z}" answered ${$.status}${$.headers.get("Location")?` to ${$.headers.get("Location")}`:""}, which a tool call cannot follow.`);throw new P(`"${Z}" failed on the server.`,$.status)}function g(Z,$){let H=Z.get($);if(!H)throw Error(`Missing "${$}" configuration. Route dispatching needs a root router \u2014 declare it in "app/config/route.ts".`);return H}class V3 extends I{register(){this.app.singleton(F,()=>new F(g(this.app.config,"route.api"))),this.app.singleton(S,()=>new S(g(this.app.config,"route.view"))),this.app.singleton(v,()=>new v({api:this.app.make(F),view:this.app.make(S)},{api:g(this.app.config,"route.api"),view:g(this.app.config,"route.view"),domains:this.app.config.get("route.domains")})),this.app.singleton(T,()=>{let Z=this.app.config.get("route.mcp");if(!Z?.router)throw Error('No MCP router is configured. Declare one as `mcp: { router }` in "app/config/route.ts".');return new T(new Z.router,this.app.make(F))})}boot(){if(this.app.make(F),this.app.make(S),this.app.make(v),this.app.config.get("route.mcp"))this.app.make(T)}}
|
|
3
|
-
export{A as Za,SZ as _a,B3 as $a,MZ as ab,fZ as bb,N as cb,D3 as db,KZ as eb,bZ as fb,gZ as gb,Q as hb,hZ as ib,cZ as jb,pZ as kb,uZ as lb,P4 as mb,BZ as nb,dZ as ob,lZ as pb,PZ as qb,_Z as rb,s as sb,o as tb,y4 as ub,OZ as vb,oZ as wb,h4 as xb,qZ as yb,nZ as zb,P as Ab,T as Bb,V3 as Cb};
|
|
4
|
-
|
|
5
|
-
//# debugId=3E596CFE4FBC3FEB64756E2164756E21
|
package/dist/chunk-j5xcfeqx.js
DELETED
|
@@ -1,24 +0,0 @@
|
|
|
1
|
-
// @bun
|
|
2
|
-
import{i as k,j as l}from"./chunk-0agfx93f.js";import{ka as F,oa as L,pa as c}from"./chunk-zq5m4scz.js";import"./chunk-8z37k28d.js";import{gd as I,kd as E,ld as T}from"./chunk-49akdtfe.js";import"./chunk-tdnfhe7x.js";import"./chunk-d0qwdeza.js";import"./chunk-302mkqeq.js";import"./chunk-rmv1jp9p.js";import"./chunk-wkdzz0rx.js";import"./chunk-g6qe6wyb.js";import"./chunk-3z6wkvwj.js";import"./chunk-m4xw99vm.js";import"./chunk-en3mtnsg.js";import"./chunk-v27a4se1.js";import"./chunk-wh728wd6.js";import"./chunk-r8nhndzb.js";import{yg as h}from"./chunk-r5e4vpa1.js";import{zg as P}from"./chunk-kb3xk9r8.js";import"./chunk-zfch4da5.js";import{join as A,resolve as CJ,sep as IJ}from"path";import{Duplex as JJ}from"stream";import{constants as C,createBrotliCompress as $J,createGzip as XJ}from"zlib";var ZJ=["br","gzip"],zJ=1024,GJ=5,jJ=19,xJ=6;function HJ(J){if(J===void 0)return 1;if(!/^\d+(\.\d{0,3})?$/.test(J.trim()))return 1;let $=Number(J.trim());return Number.isFinite($)?Math.min($,1):1}function QJ(J){if(J===null||J===void 0)return null;let $=new Map;for(let X of J.split(",")){let[z,...x]=X.split(";"),W=z.trim().toLowerCase();if(W==="")continue;let Q=1;for(let H of x){let Y=H.indexOf("=");if(Y===-1)continue;if(H.slice(0,Y).trim().toLowerCase()==="q"){Q=HJ(H.slice(Y+1));break}}$.set(W,Q)}return $}function WJ(J,$=ZJ){let X=QJ(J);if(!X)return null;let z=X.get("*"),x=null,W=0;for(let Q of $){let H=X.get(Q)??z??0;if(H>W)x=Q,W=H}return x}function OJ(J,$){if(!J)return!1;return J.split(",").some((X)=>X.trim().toLowerCase().split("=")[0].trim()===$)}function KJ(J,$){if(J==="HEAD")return!1;if(!$.body)return!1;if($.status<200||$.status===204||$.status===206||$.status===304)return!1;if($.headers.has("Content-Range"))return!1;let X=$.headers.get("Content-Type");if(!X||!/^\s*text\/html\s*(;|$)/i.test(X))return!1;let z=$.headers.get("Content-Encoding");if(z&&z.trim().toLowerCase()!=="identity")return!1;if(OJ($.headers.get("Cache-Control"),"no-transform"))return!1;let x=$.headers.get("Content-Length");if(x!==null&&Number(x)<zJ)return!1;return!0}function UJ(J){let $=J==="br"?$J({params:{[C.BROTLI_PARAM_QUALITY]:GJ,[C.BROTLI_PARAM_LGWIN]:jJ},flush:C.BROTLI_OPERATION_FLUSH}):XJ({level:xJ,flush:C.Z_SYNC_FLUSH});return JJ.toWeb($)}function YJ(J){let $=J.get("Vary");if(!$){J.set("Vary","Accept-Encoding");return}let X=$.split(",").map((z)=>z.trim().toLowerCase());if(X.includes("*")||X.includes("accept-encoding"))return;J.append("Vary","Accept-Encoding")}function q(J,$){if(!KJ(J.method,$))return $;let X=new Headers($.headers);YJ(X);let z=WJ(J.headers.get("Accept-Encoding"));if(!z)return new Response($.body,{status:$.status,statusText:$.statusText,headers:X});let x;try{x=UJ(z)}catch{return new Response($.body,{status:$.status,statusText:$.statusText,headers:X})}return X.set("Content-Encoding",z),X.delete("Content-Length"),new Response($.body.pipeThrough(x),{status:$.status,statusText:$.statusText,headers:X})}function v(J){let $=J.toString(),X=new Bun.CryptoHasher("sha1");return X.update($),X.digest("hex")}if(!globalThis.URLPattern)globalThis.URLPattern=I;import{stat as SJ}from"fs/promises";var S="app/client.tsx";function f(J,$=F){let X=J[S]?.file;if(!X)return;return{module:L(X,$),preload:R(J,S,$)}}function R(J,$,X=F){let z=[],x=new Set,W=(Q)=>{if(x.has(Q))return;x.add(Q);let H=J[Q];if(!H?.file)return;z.push(L(H.file,X));for(let Y of H.imports??[])W(Y)};return W($),z}var bJ=new RegExp(`^${E}/.+\\.m?js$`);function LJ(J){return bJ.test(J)}function u(J){if(LJ(J))return new Response("window.location.reload();export {}",{headers:{"Content-Type":"application/javascript","Cache-Control":"no-store"}});if(T(J))return new Response("Not found",{status:404});return}var VJ=`<!DOCTYPE html>
|
|
3
|
-
<html lang="en">
|
|
4
|
-
<head>
|
|
5
|
-
<meta charset="UTF-8" />
|
|
6
|
-
<meta name="viewport" content="width=device-width, initial-scale=1.0" />
|
|
7
|
-
<title>Internal Server Error</title>
|
|
8
|
-
<style>
|
|
9
|
-
body { font-family: system-ui, sans-serif; margin: 0; min-height: 100vh; display: grid; place-items: center; }
|
|
10
|
-
main { text-align: center; padding: 16px; }
|
|
11
|
-
h1 { font-size: 1.5rem; margin: 0 0 0.5rem; }
|
|
12
|
-
p { margin: 0; opacity: 0.7; }
|
|
13
|
-
</style>
|
|
14
|
-
</head>
|
|
15
|
-
<body>
|
|
16
|
-
<main>
|
|
17
|
-
<h1>Something went wrong</h1>
|
|
18
|
-
<p>Please try again later.</p>
|
|
19
|
-
</main>
|
|
20
|
-
</body>
|
|
21
|
-
</html>`;function _(J,$,X){if(!X)console.error(J);else try{X(J instanceof Error?J:Error(String(J),{cause:J}))}catch(z){console.error(J),console.error(z)}if(P($))return new Response(JSON.stringify({error:"Internal Server Error"}),{status:500,headers:{"Content-Type":"application/json"}});return new Response(VJ,{status:500,headers:{"Content-Type":"text/html; charset=utf-8"}})}var D=h(),TJ=A(D,"app"),b=A(D,"dist"),m=A(b,"client");function PJ(J){let $;try{$=decodeURIComponent(J)}catch{return null}let X=CJ(m,"."+$.replace("/assets/assets","/assets"));return X.startsWith(m+IJ)?X:null}async function DJ(J){try{return(await SJ(J)).isFile()}catch{return!1}}async function tJ(J,$){let X=await import(`${b}/client/.vite/manifest.json`),z=await import(`${b}/server/.vite/manifest.json`),x=await c(`${b}/client`);process.env.ROOT_DIR=D,process.env.APP_DIR=TJ,process.env.DIST_DIR=b;let W={},Q={},H={},Y={},M={},d=(Z,G)=>`"${Z}": () => import("${G}")`,N=[];for(let Z of["404",...J.getFlatComponentTree.call(J)]){let G=z[`app/views/${Z}.tsx`];if(!G?.file){console.log(`Server file not found for ${Z}`),console.log(G);let O=Object.keys(z),U=`app/views/${Z}.tsx`;console.log(`${U} not found in server manifest`),console.log(O)}let K=await import(`${process.env.DIST_DIR}/server/${G?.file}`);W[Z]=K.default,Q[Z]=K.OpenGraph,H[Z]=K;let j=X[`app/views/${Z}.tsx`];if(j?.css&&j?.css.length>0)Y[Z]=j?.css;if(j)N.push(d(Z,L(j?.file,x))),M[Z]=R(X,`app/views/${Z}.tsx`,x)}let p=`{${N.join(",")}}`,B=f(X,x);if(!B)console.error(`Client manifest has no "${S}" entry \u2014 dist/client is incomplete, so documents will render but never hydrate.`);let o=X["app/client.tsx"]?.css??[],n=(await Promise.all(o.map((Z)=>Bun.file(`${b}/client/${Z}`).text()))).join(`
|
|
22
|
-
`),i=new I({pathname:"/*.:filetype(png|jpg|jpeg|gif|svg|avif|webp|ico|css|js|mjs|map|txt|xml|webmanifest|woff|woff2|ttf|otf|webm|mp4|mp3|pdf)"});async function t(Z){let{pathname:G}=new URL(Z.url),K=T(G)||G.startsWith("/.well-known")||G==="/manifest.json"||i.test({pathname:G}),j=P(G);if(K&&!j){let O=PJ(G);if(!O||!await DJ(O))return u(G)??await w(Z,G);try{let U=Bun.file(O),V=v(U.lastModified);return new Response(U.stream(),{headers:{"Content-Type":U.type,"Cache-Control":"public, max-age=31536000, must-revalidate","Content-Length":String(U.size),ETag:V}})}catch(U){return J.onException?.(U),new Response("Not found",{status:404})}}return await w(Z,G)}async function w(Z,G){let K=J.fetch.bind(J);try{let j=await K(Z);if(j instanceof Response)return j;else{let O=[];return O.push({content:n}),await j({getStyles:async(V)=>{if(!V)return k([]);for(let r of V){let s=X[`app/views/${r}.tsx`];for(let g of s?.css??[]){let e=Bun.file(`${process.env.DIST_DIR}/client/${g}`);O.push({id:g,content:await e.text()})}}return k(O)},clientEntry:B,modulePreloadManifest:M,loaders:p,viewImportMap:W,viewModules:H,ogMap:Q,cssManifest:Y,assetBase:x})}}catch(j){return _(j,G,J.onException)}}let a=(process.env.GEMI_COMPRESSION??"auto").toLowerCase()!=="off",y=Bun.serve({maxRequestBodySize:10737418240,fetch:async(Z,G)=>{if(!Z.headers.get("x-forwarded-for")){let j=G.requestIP(Z);if(j)Z.headers.set("x-forwarded-for",j.address)}let K=await $(Z,(j)=>J.withGlobalMiddleware(j,t,(O)=>_(O,new URL(j.url).pathname,J.onException)));return a?q(Z,K):K},idleTimeout:Number(process.env.SERVER_IDLE_TIMEOUT??10),port:process.env.PORT||5173});return l({port:y.port,rootDir:D}),y}export{tJ as httpProd};
|
|
23
|
-
|
|
24
|
-
//# debugId=B4D68B1A9838DC2464756E2164756E21
|
|
@@ -1,16 +0,0 @@
|
|
|
1
|
-
{
|
|
2
|
-
"version": 3,
|
|
3
|
-
"sources": ["../server/httpProd.ts", "../server/compression.ts", "../server/generateEtag.ts", "../../../node_modules/.bun/urlpattern-polyfill@10.1.0/node_modules/urlpattern-polyfill/index.js", "../server/modulePreloads.ts", "../server/staticAssetMiss.ts", "../server/unhandledError.ts"],
|
|
4
|
-
"sourcesContent": [
|
|
5
|
-
"import { join, resolve, sep } from \"node:path\";\nimport { compressResponse } from \"./compression\";\nimport { generateETag } from \"./generateEtag\";\nimport { URLPattern } from \"urlpattern-polyfill\";\nimport { stat } from \"node:fs/promises\";\nimport { createStyles } from \"./styles\";\nimport { CLIENT_ENTRY_KEY, collectModulePreloads, createClientEntry } from \"./modulePreloads\";\nimport type { App } from \"../app\";\nimport { Instrumentation } from \"./types\";\nimport { printStartupBanner } from \"./banner\";\nimport { isReservedAssetPath, staticAssetMiss } from \"./staticAssetMiss\";\nimport { assetUrl, readBuiltAssetBase } from \"../config/assetBase\";\nimport { isApiPath } from \"../services/router/apiPath\";\nimport { projectRoot } from \"../support/discover\";\nimport { unhandledErrorResponse } from \"./unhandledError\";\n\n// The rule this file used to spell out itself. It moved to `projectRoot`\n// because discovery needs the same answer during `waitForBoot()`, which is\n// before `ROOT_DIR` below exists — and two spellings of \"where is the project\"\n// is how a job gets looked for in one directory and served from another.\nconst rootDir = projectRoot();\n\nconst appDir = join(rootDir, \"app\");\nconst distDir = join(rootDir, \"dist\");\n\nconst clientDir = join(distDir, \"client\");\n\n// The file in `dist/client` a static-looking pathname names, or `null` when\n// it names nothing there. The pathname is still percent-encoded, and Vite\n// writes files whose names need encoding (a public `my font.woff2`), so it is\n// decoded first. Decoding also turns `%2F` into a separator, which the URL\n// parser's own `..` normalization never saw — so the resolved path is checked\n// to still be inside `dist/client`. A malformed escape is a miss, not a 500.\nfunction clientFilePath(pathname: string): string | null {\n let decoded: string;\n try {\n decoded = decodeURIComponent(pathname);\n } catch {\n return null;\n }\n const path = resolve(clientDir, \".\" + decoded.replace(\"/assets/assets\", \"/assets\"));\n return path.startsWith(clientDir + sep) ? path : null;\n}\n\nasync function isFile(path: string) {\n try {\n return (await stat(path)).isFile();\n } catch {\n return false;\n }\n}\n\n// `app` is built by `Server.start` (from the kernel) and passed in — same as\n// `httpDev` — so prod and dev share one construction path. What differs here is\n// that views/styles are served from the built `dist/` manifests instead of\n// Vite's dev SSR graph.\nexport async function httpProd(app: App, instrumentation: Instrumentation) {\n const manifest = await import(`${distDir}/client/.vite/manifest.json`);\n const serverManifest = await import(`${distDir}/server/.vite/manifest.json`);\n // What the client build was built with, not `GEMI_ASSET_BASE` as it reads\n // now — see `readBuiltAssetBase`. Every URL below that names a chunk goes\n // through it, so the document links exactly what the bundle imports.\n const assetBase = await readBuiltAssetBase(`${distDir}/client`);\n\n process.env.ROOT_DIR = rootDir;\n process.env.APP_DIR = appDir;\n process.env.DIST_DIR = distDir;\n\n const viewImportMap = {};\n const ogMap = {};\n const viewModules = {};\n const cssManifest = {};\n // Which chunks a route's views pull in, so the shell can preload the chain\n // the client would otherwise discover one round trip at a time (#352).\n const modulePreloadManifest: Record<string, string[]> = {};\n const template = (viewName: string, path: string) => `\"${viewName}\": () => import(\"${path}\")`;\n const templates = [];\n\n for (const fileName of [\"404\", ...app.getFlatComponentTree.call(app)]) {\n const serverFile = serverManifest[`app/views/${fileName}.tsx`];\n if (!serverFile?.file) {\n console.log(`Server file not found for ${fileName}`);\n console.log(serverFile);\n const files = Object.keys(serverManifest);\n const path = `app/views/${fileName}.tsx`;\n console.log(`${path} not found in server manifest`);\n console.log(files);\n }\n const mod = await import(`${process.env.DIST_DIR}/server/${serverFile?.file}`);\n viewImportMap[fileName] = mod.default;\n ogMap[fileName] = mod.OpenGraph;\n // The whole module, so a streaming render can put the view's\n // `Loading`/`Error` exports into the shell it sends.\n viewModules[fileName] = mod;\n const clientFile = manifest[`app/views/${fileName}.tsx`];\n\n if (clientFile?.css && clientFile?.css.length > 0) {\n cssManifest[fileName] = clientFile?.css;\n }\n if (clientFile) {\n templates.push(template(fileName, assetUrl(clientFile?.file, assetBase)));\n modulePreloadManifest[fileName] = collectModulePreloads(\n manifest,\n `app/views/${fileName}.tsx`,\n assetBase,\n );\n }\n }\n\n const loaders = `{${templates.join(\",\")}}`;\n\n // Booted from the bootstrap script rather than through React's\n // `bootstrapModules`, which would preload it at `fetchPriority=\"low\"` — see\n // `clientEntry` in `ViewRouteDispatcher`.\n const clientEntry = createClientEntry(manifest, assetBase);\n if (!clientEntry) {\n // Loudly, but without dying: this is boot, and an incomplete `dist/` must\n // not cost the API routes and static assets too.\n console.error(\n `Client manifest has no \"${CLIENT_ENTRY_KEY}\" entry — dist/client is incomplete, so documents will render but never hydrate.`,\n );\n }\n\n // Vite's manifest `css` field is a `string[]` — a client entry can emit more\n // than one CSS chunk. Read and concatenate them all instead of interpolating\n // the array into a single path (which only works for a one-element array).\n const appCssFiles: string[] = manifest[\"app/client.tsx\"]?.css ?? [];\n const appCSSContent = (\n await Promise.all(appCssFiles.map((cssFile) => Bun.file(`${distDir}/client/${cssFile}`).text()))\n ).join(\"\\n\");\n\n // Which requests are answered from `dist/client` rather than the app:\n //\n // - `/assets` and everything under it, whatever the extension. Vite writes\n // fonts, GIFs, video and `?url` JSON there too, and an allowlist of\n // extensions always trailed the build — a `.woff2` went to the router\n // and paid for an SSR attempt. The router refuses routes under `/assets`\n // at boot, so there is no app answer to lose, and `staticAssetMiss`\n // turns a miss into the reload stub or a 404.\n // - `/.well-known/*`.\n // - A root-level public file (`/favicon.ico`, `/robots.txt`, …), known only\n // by its extension, since any other path may be an app route. A miss\n // there goes to the app. `json` is left out on purpose: a client-side\n // navigation fetches a view's data as `/<path>.json`, so matching it would\n // put a filesystem lookup in front of every navigation and let a public\n // file shadow a view's data. `mjs` is here because a build configured to\n // emit `.mjs` chunks is served the same way as `.js`.\n // - `/manifest.json`, the one root-level JSON file an app is expected to\n // ship (a PWA manifest in `public/`). Only when the file exists: a miss\n // goes to the app, so a view at `/manifest` keeps its data URL unless the\n // app also ships the file — and then the file wins.\n const publicFilePattern = new URLPattern({\n pathname:\n \"/*.:filetype(png|jpg|jpeg|gif|svg|avif|webp|ico|css|js|mjs|map|txt|xml|webmanifest|woff|woff2|ttf|otf|webm|mp4|mp3|pdf)\",\n });\n\n async function requestHandler(req: Request) {\n const { pathname } = new URL(req.url);\n\n const isFileRequest =\n isReservedAssetPath(pathname) ||\n pathname.startsWith(\"/.well-known\") ||\n pathname === \"/manifest.json\" ||\n publicFilePattern.test({ pathname });\n\n const isApi = isApiPath(pathname);\n\n if (isFileRequest && !isApi) {\n const distPath = clientFilePath(pathname);\n // Served from here whatever the asset base is: a CDN in front of the\n // app uses this origin as the source it fills from. A file, not merely\n // a path that exists: `/assets` itself is `dist/client/assets`, a\n // directory, and streaming one would answer 200 and then fail mid-body.\n if (!distPath || !(await isFile(distPath))) {\n return staticAssetMiss(pathname) ?? (await handleWithApp(req, pathname));\n }\n\n // `Bun.file(path).stream()` is lazy — a missing file only throws ENOENT\n // once the body is streamed, which is *after* this handler has returned,\n // so the `try/catch` below can't catch it (it surfaces as an unhandled\n // rejection with the response already committed as 200). Never build the\n // streaming Response without checking existence first.\n\n try {\n const file = Bun.file(distPath);\n\n const etag = generateETag(file.lastModified);\n return new Response(file.stream(), {\n headers: {\n \"Content-Type\": file.type,\n \"Cache-Control\": \"public, max-age=31536000, must-revalidate\",\n \"Content-Length\": String(file.size),\n ETag: etag,\n },\n });\n } catch (error) {\n app.onException?.(error);\n return new Response(\"Not found\", { status: 404 });\n }\n }\n\n return await handleWithApp(req, pathname);\n }\n\n async function handleWithApp(req: Request, pathname: string) {\n const handler = app.fetch.bind(app);\n\n try {\n const result = await handler(req);\n if (result instanceof Response) {\n return result;\n } else {\n const styles = [];\n\n styles.push({\n content: appCSSContent,\n });\n\n const getStyles = async (currentViews: string[]) => {\n if (!currentViews) {\n return createStyles([]);\n }\n for (const view of currentViews) {\n const clientFile = manifest[`app/views/${view}.tsx`];\n for (const cssFile of clientFile?.css ?? []) {\n const css = Bun.file(`${process.env.DIST_DIR}/client/${cssFile}`);\n styles.push({\n id: cssFile,\n content: await css.text(),\n });\n }\n }\n return createStyles(styles);\n };\n\n return await result({\n getStyles,\n clientEntry,\n modulePreloadManifest,\n loaders,\n viewImportMap,\n viewModules,\n ogMap,\n cssManifest,\n assetBase,\n });\n }\n } catch (err) {\n return unhandledErrorResponse(err, pathname, app.onException);\n }\n }\n\n // Compression is on unless the deployment opts out — set `GEMI_COMPRESSION=off`\n // when a layer in front of the origin already compresses HTML and you would\n // rather not spend origin CPU on it.\n const compressionEnabled = (process.env.GEMI_COMPRESSION ?? \"auto\").toLowerCase() !== \"off\";\n\n const server = Bun.serve({\n maxRequestBodySize: 10 * 1024 * 1024 * 1024, // 10 GB\n fetch: async (req, server) => {\n if (!req.headers.get(\"x-forwarded-for\")) {\n // `requestIP` is null for closed/unix sockets — guard so it never\n // throws before the request is handled.\n const ip = server.requestIP(req);\n if (ip) req.headers.set(\"x-forwarded-for\", ip.address);\n }\n // The app's global middleware goes in front of the static handler as well\n // as the router, so it can refuse `/assets/*` too.\n const res = await instrumentation(req, (req) =>\n app.withGlobalMiddleware(req, requestHandler, (err) =>\n unhandledErrorResponse(err, new URL(req.url).pathname, app.onException),\n ),\n );\n // Applied at the very edge, after instrumentation, so every HTML response\n // goes through the same negotiation — including the ones an app's\n // instrumentation produced itself. Anything that isn't HTML comes back\n // untouched.\n return compressionEnabled ? compressResponse(req, res) : res;\n },\n idleTimeout: Number(process.env.SERVER_IDLE_TIMEOUT ?? 10),\n port: process.env.PORT || 5173,\n });\n\n printStartupBanner({ port: server.port, rootDir });\n\n return server;\n}\n",
|
|
6
|
-
"/**\n * Transport-level compression for SSR HTML responses.\n *\n * This lives in the runtime rather than in an app, because every gemi app\n * serves the same shape of response: a streamed `text/html` document whose\n * bulk is critical CSS, markup and the `window.__GEMI_DATA__` hydration\n * payload. Compressing it here means the win is portable across deployments —\n * it does not depend on a CDN being configured to compress on the origin's\n * behalf — and it also cuts origin→edge bandwidth, which edge compression\n * cannot.\n *\n * Compression stays strictly at the transport layer: what the client decodes\n * is byte-for-byte the HTML React rendered, so hydration is unaffected.\n *\n * Deliberately dependency-free apart from `node:zlib`/`node:stream` so it can\n * be unit tested without booting a server.\n */\n\nimport { Duplex } from \"node:stream\";\nimport { constants, createBrotliCompress, createGzip } from \"node:zlib\";\n\n/** The content codings we can produce, in the order we prefer them. */\nexport type ContentEncoding = \"br\" | \"gzip\";\n\n/**\n * Server preference, used to break q-value ties. Brotli comes first: at the\n * quality we use it is both smaller *and* no more expensive than gzip on a\n * representative SSR document (~177 kB → 28.0 kB in ~2.0 ms, versus 31.6 kB in\n * ~2.0 ms for gzip).\n */\nconst SERVER_PREFERENCE: ContentEncoding[] = [\"br\", \"gzip\"];\n\n/**\n * Below this, an encoded body plus its framing overhead is not worth the CPU.\n * Only applied when the response declares a `Content-Length` — a streamed SSR\n * response does not, and buffering one just to measure it would defeat the\n * streaming render.\n */\nconst MIN_COMPRESSIBLE_BYTES = 1024;\n\n/**\n * Brotli quality 5 (of 11). The default, 11, is meant for static assets\n * compressed once at build time — on a streamed document it costs ~175 ms,\n * two orders of magnitude more than quality 5 for ~12% more savings. Quality 5\n * is the usual choice for dynamic content.\n *\n * `LGWIN` 19 caps the window at 512 kB rather than the default 16 MB. An SSR\n * document is far smaller than that, so the ratio is unchanged, and the bound\n * matters under concurrency: the window is allocated per in-flight response.\n */\nconst BROTLI_QUALITY = 5;\nconst BROTLI_WINDOW_BITS = 19;\n\n/** zlib's default level. Level 9 costs measurably more for ~1% on HTML. */\nconst GZIP_LEVEL = 6;\n\nfunction parseQValue(raw: string | undefined): number {\n if (raw === undefined) {\n return 1;\n }\n // `q` is a fixed-point number with at most three decimals (RFC 9110 §12.4.2).\n // Anything else is malformed; treat it as an unqualified \"acceptable\" rather\n // than dropping the encoding, matching what tolerant servers do.\n if (!/^\\d+(\\.\\d{0,3})?$/.test(raw.trim())) {\n return 1;\n }\n const value = Number(raw.trim());\n return Number.isFinite(value) ? Math.min(value, 1) : 1;\n}\n\n/**\n * Parses a request `Accept-Encoding` into `coding -> qvalue`.\n *\n * Returns `null` when the header is *absent*, which is distinct from an empty\n * one. RFC 9110 §12.5.3 says an absent header means any coding is acceptable,\n * but a client that cannot decode and forgets to say so is a broken page, not\n * a slow one — so we treat \"absent\" as \"identity\" and only encode when a\n * client has explicitly opted in. An empty header (`Accept-Encoding:`) is a\n * deliberate \"identity only\" and parses to an empty map.\n */\nexport function parseAcceptEncoding(header: string | null | undefined): Map<string, number> | null {\n if (header === null || header === undefined) {\n return null;\n }\n\n const accepted = new Map<string, number>();\n for (const part of header.split(\",\")) {\n const [rawCoding, ...params] = part.split(\";\");\n const coding = rawCoding.trim().toLowerCase();\n if (coding === \"\") {\n continue;\n }\n\n let q = 1;\n for (const param of params) {\n const separator = param.indexOf(\"=\");\n if (separator === -1) {\n continue;\n }\n if (param.slice(0, separator).trim().toLowerCase() === \"q\") {\n q = parseQValue(param.slice(separator + 1));\n break;\n }\n }\n\n accepted.set(coding, q);\n }\n\n return accepted;\n}\n\n/**\n * Picks the coding to use, or `null` for identity.\n *\n * A `q=0` is a refusal, `*` covers codings the client did not name, and ties\n * fall back to `available`'s order — so a plain `Accept-Encoding: gzip, br`\n * (equal q of 1) resolves to our preference rather than the client's.\n */\nexport function negotiateEncoding(\n header: string | null | undefined,\n available: ContentEncoding[] = SERVER_PREFERENCE,\n): ContentEncoding | null {\n const accepted = parseAcceptEncoding(header);\n if (!accepted) {\n return null;\n }\n\n const wildcard = accepted.get(\"*\");\n let best: ContentEncoding | null = null;\n let bestQ = 0;\n\n for (const coding of available) {\n const q = accepted.get(coding) ?? wildcard ?? 0;\n if (q > bestQ) {\n best = coding;\n bestQ = q;\n }\n }\n\n return best;\n}\n\nfunction hasDirective(headerValue: string | null, directive: string): boolean {\n if (!headerValue) {\n return false;\n }\n // Token match, not substring: `no-transform` must not be found inside\n // something like `x-no-transform`.\n return headerValue\n .split(\",\")\n .some((token) => token.trim().toLowerCase().split(\"=\")[0].trim() === directive);\n}\n\n/**\n * Whether this response's representation is one we may encode — and therefore\n * one that varies by `Accept-Encoding`, even on the requests where we end up\n * sending identity.\n *\n * HTML only, on purpose. JSON view-data and API responses are left alone so\n * that this change cannot alter how they are produced, framed or cached;\n * widening the set is a separate decision.\n */\nexport function isCompressible(method: string, res: Response): boolean {\n // A HEAD response carries no body to encode, and emitting `Content-Encoding`\n // without one would describe a body the client never receives.\n if (method === \"HEAD\") {\n return false;\n }\n\n if (!res.body) {\n return false;\n }\n\n // 204/304 are bodyless; 206 is a byte range of an already-committed\n // representation and re-encoding it would invalidate its `Content-Range`.\n if (res.status < 200 || res.status === 204 || res.status === 206 || res.status === 304) {\n return false;\n }\n\n if (res.headers.has(\"Content-Range\")) {\n return false;\n }\n\n const contentType = res.headers.get(\"Content-Type\");\n if (!contentType || !/^\\s*text\\/html\\s*(;|$)/i.test(contentType)) {\n return false;\n }\n\n // Already encoded upstream — `identity` is the one value that means \"not\n // encoded\" and is safe to replace.\n const contentEncoding = res.headers.get(\"Content-Encoding\");\n if (contentEncoding && contentEncoding.trim().toLowerCase() !== \"identity\") {\n return false;\n }\n\n // RFC 9110 §5.2.2.6: `no-transform` forbids intermediaries *and* us from\n // changing the representation's encoding.\n if (hasDirective(res.headers.get(\"Cache-Control\"), \"no-transform\")) {\n return false;\n }\n\n const contentLength = res.headers.get(\"Content-Length\");\n if (contentLength !== null && Number(contentLength) < MIN_COMPRESSIBLE_BYTES) {\n return false;\n }\n\n return true;\n}\n\n/**\n * Builds the encoder as a web `TransformStream`-shaped pair.\n *\n * Both codings are driven through `node:zlib` with an explicit per-write flush.\n * Without it the compressor holds output until its internal buffer fills,\n * which would sit on React's shell flush and turn a streamed render into a\n * buffered one — the compression win would be paid for in time to first byte.\n */\nexport function createEncoderStream(encoding: ContentEncoding) {\n const compressor =\n encoding === \"br\"\n ? createBrotliCompress({\n params: {\n [constants.BROTLI_PARAM_QUALITY]: BROTLI_QUALITY,\n [constants.BROTLI_PARAM_LGWIN]: BROTLI_WINDOW_BITS,\n },\n flush: constants.BROTLI_OPERATION_FLUSH,\n })\n : createGzip({ level: GZIP_LEVEL, flush: constants.Z_SYNC_FLUSH });\n\n return Duplex.toWeb(compressor) as unknown as ReadableWritablePair<Uint8Array, Uint8Array>;\n}\n\nfunction withVaryAcceptEncoding(headers: Headers) {\n const vary = headers.get(\"Vary\");\n if (!vary) {\n headers.set(\"Vary\", \"Accept-Encoding\");\n return;\n }\n const tokens = vary.split(\",\").map((token) => token.trim().toLowerCase());\n // `Vary: *` already means \"never reuse for another request\"; narrowing it\n // would be a downgrade.\n if (tokens.includes(\"*\") || tokens.includes(\"accept-encoding\")) {\n return;\n }\n headers.append(\"Vary\", \"Accept-Encoding\");\n}\n\n/**\n * Compresses an SSR HTML response when the client asked for it.\n *\n * Non-HTML responses are returned untouched — same object, same body, so this\n * is safe to apply at the edge of the server for every request.\n *\n * HTML responses always gain `Vary: Accept-Encoding`, whether or not this\n * particular request got an encoded body: without it a shared cache could\n * serve a stored encoded variant to a client that cannot decode it.\n */\nexport function compressResponse(req: Request, res: Response): Response {\n if (!isCompressible(req.method, res)) {\n return res;\n }\n\n const headers = new Headers(res.headers);\n withVaryAcceptEncoding(headers);\n\n const encoding = negotiateEncoding(req.headers.get(\"Accept-Encoding\"));\n if (!encoding) {\n return new Response(res.body, {\n status: res.status,\n statusText: res.statusText,\n headers,\n });\n }\n\n let encoder: ReadableWritablePair<Uint8Array, Uint8Array>;\n try {\n encoder = createEncoderStream(encoding);\n } catch {\n // A compressor we cannot construct is not worth failing a page render\n // over. Serve identity — with the `Vary` we already added.\n return new Response(res.body, {\n status: res.status,\n statusText: res.statusText,\n headers,\n });\n }\n\n headers.set(\"Content-Encoding\", encoding);\n // The length of the identity representation says nothing about the encoded\n // body, and a stale one would truncate the response.\n headers.delete(\"Content-Length\");\n\n return new Response(res.body!.pipeThrough(encoder), {\n status: res.status,\n statusText: res.statusText,\n headers,\n });\n}\n",
|
|
7
|
-
"export function generateETag(lastModified: number): string {\n // Assuming the last modified timestamp is in milliseconds\n const lastModifiedStr = lastModified.toString();\n\n const hasher = new Bun.CryptoHasher(\"sha1\");\n hasher.update(lastModifiedStr);\n const hash = hasher.digest(\"hex\");\n\n return hash;\n}\n",
|
|
8
|
-
"import { URLPattern } from \"./dist/urlpattern.js\";\n\nexport { URLPattern };\n\nif (!globalThis.URLPattern) {\n globalThis.URLPattern = URLPattern;\n}\n",
|
|
9
|
-
"import { DEFAULT_ASSET_BASE, assetUrl } from \"../config/assetBase\";\n\n/** The subset of a Vite manifest entry this module reads. */\nexport interface ViteManifestChunk {\n file: string;\n imports?: string[];\n dynamicImports?: string[];\n}\n\nexport type ViteManifest = Record<string, ViteManifestChunk>;\n\n/** Vite's manifest key for the module that boots hydration. */\nexport const CLIENT_ENTRY_KEY = \"app/client.tsx\";\n\n/**\n * How the shell boots hydration in production: `module` is imported from the\n * bootstrap script, `preload` is every chunk that import pulls in — see\n * `clientEntry` in `ViewRouteDispatcher` for why the entry does not go through\n * React's `bootstrapModules`.\n *\n * `undefined` when the manifest has no client entry, which means a `dist/`\n * interrupted between the server and client build passes. Degrading beats\n * throwing here: this runs at boot, so a deref would take down API routes,\n * static assets and health checks over what is only a document concern, and\n * the dispatcher already renders a shell that simply does not hydrate.\n *\n * `assetBase` is the base the client build recorded — see `readBuiltAssetBase`.\n */\nexport function createClientEntry(\n manifest: ViteManifest,\n assetBase: string = DEFAULT_ASSET_BASE,\n): { module: string; preload: string[] } | undefined {\n const file = manifest[CLIENT_ENTRY_KEY]?.file;\n if (!file) {\n return undefined;\n }\n return {\n module: assetUrl(file, assetBase),\n preload: collectModulePreloads(manifest, CLIENT_ENTRY_KEY, assetBase),\n };\n}\n\n/**\n * Every chunk URL that importing `entryKey` pulls in, itself first.\n *\n * The browser can only discover these one parse at a time — it learns about a\n * chunk's static imports after the chunk has arrived and been parsed — so a\n * `layout -> view -> child component` graph costs one round trip per level.\n * Handing the whole list to the shell as `modulepreload` hints turns that\n * chain into one parallel fetch (#352).\n *\n * `dynamicImports` are deliberately left out: those are the pieces the app\n * asked to load lazily, and preloading them would download code the current\n * route may never render.\n */\nexport function collectModulePreloads(\n manifest: ViteManifest,\n entryKey: string,\n assetBase: string = DEFAULT_ASSET_BASE,\n): string[] {\n const urls: string[] = [];\n // Chunk graphs are cyclic often enough (two chunks importing each other\n // through a shared module) that walking them without a visited set hangs.\n const visited = new Set<string>();\n\n const walk = (key: string) => {\n if (visited.has(key)) return;\n visited.add(key);\n const chunk = manifest[key];\n if (!chunk?.file) return;\n urls.push(assetUrl(chunk.file, assetBase));\n for (const imported of chunk.imports ?? []) {\n walk(imported);\n }\n };\n\n walk(entryKey);\n\n return urls;\n}\n",
|
|
10
|
-
"import { isReservedAssetPath, RESERVED_ROUTE_PREFIX } from \"../services/router/ViewRouteDispatcher\";\n\n/**\n * A JavaScript module under `/assets/` — the only shape a client build chunk\n * has. Vite writes every chunk into `assets/` with a `.js` extension (`.mjs`\n * is accepted for a build configured to emit it).\n *\n * The extension is matched at the end of the path, not anywhere in it:\n * `includes(\".js\")` also matched `app.js.map` and `data.json`, so a missing\n * source map was answered with a script that reloads the page.\n */\nconst BUILD_CHUNK = new RegExp(`^${RESERVED_ROUTE_PREFIX}/.+\\\\.m?js$`);\n\nexport function isBuildChunkPath(pathname: string): boolean {\n return BUILD_CHUNK.test(pathname);\n}\n\n/**\n * `/assets` or anything under it — the prefix the router refuses to mount a\n * route on at boot, so nothing there is ever the app's to answer. Defined\n * beside that check so the two cannot drift apart.\n */\nexport { isReservedAssetPath };\n\n/**\n * The answer to a static-looking request with no file behind it in\n * `dist/client`, or `undefined` to hand the request to the app.\n *\n * A missing build chunk is almost always a document rendered by another\n * release asking for its own chunks — a deploy between page load and a lazy\n * `import()`, or two releases serving at once. The page cannot continue with\n * the chunk it wanted, so it gets a module that reloads it onto this release's\n * document. Only for build chunks: outside `/assets/` a `.js` path may be an\n * app route, and a classic `<script src>` answered with a reload reloads\n * forever.\n *\n * `no-store` because the stub is a stand-in for one release's chunk, served\n * under that chunk's URL. Cached — by the browser or by an edge in front of\n * the origin — it would outlive the deploy that caused it and answer the\n * request after the real chunk is back.\n *\n * The body is only the reload. An earlier version opened with\n * `if(caches){caches?.delete(distPath)}`, which was wrong three times over:\n * `CacheStorage.delete` takes a cache *name*, not a URL, so a filesystem path\n * matched nothing; that path told anyone who asked for a missing chunk where\n * the server keeps its files; and `caches` is `[SecureContext]`, so on a\n * plain-http origin the bare identifier is not defined at all and reading it\n * threw a `ReferenceError` before the reload below could run — the recovery\n * failing exactly where it was needed.\n */\nexport function staticAssetMiss(pathname: string): Response | undefined {\n if (isBuildChunkPath(pathname)) {\n return new Response(`window.location.reload();export {}`, {\n headers: {\n \"Content-Type\": \"application/javascript\",\n \"Cache-Control\": \"no-store\",\n },\n });\n }\n\n // `/assets` is reserved for build output (the router rejects routes there\n // at boot), so a miss is a miss — 404 without paying for an SSR render.\n if (isReservedAssetPath(pathname)) {\n return new Response(\"Not found\", { status: 404 });\n }\n\n // Anywhere else the public-file pattern matched on extension alone, so this\n // may well be an app route — a file route like\n // `this.file(() => Bun.file(...))` mounted at `/files/logo.svg` lands here\n // too. The app answers it rather than a 404 on its behalf.\n return undefined;\n}\n",
|
|
11
|
-
"import { isApiPath } from \"../services/router/apiPath\";\n\n// The production server's last resort: an error nothing on the way here turned\n// into a response. Request breakers (auth, 404s, 416s) are answered by the\n// dispatchers before this, so what arrives is a genuine failure — and its\n// message and stack are for the developer, not for whoever triggered it. They\n// can carry absolute paths, dependency versions, SQL fragments and column\n// names. The dev server renders them on purpose (`httpDev.ts`); this does not.\n\nconst GENERIC_500_HTML = `<!DOCTYPE html>\n<html lang=\"en\">\n <head>\n <meta charset=\"UTF-8\" />\n <meta name=\"viewport\" content=\"width=device-width, initial-scale=1.0\" />\n <title>Internal Server Error</title>\n <style>\n body { font-family: system-ui, sans-serif; margin: 0; min-height: 100vh; display: grid; place-items: center; }\n main { text-align: center; padding: 16px; }\n h1 { font-size: 1.5rem; margin: 0 0 0.5rem; }\n p { margin: 0; opacity: 0.7; }\n </style>\n </head>\n <body>\n <main>\n <h1>Something went wrong</h1>\n <p>Please try again later.</p>\n </main>\n </body>\n</html>`;\n\nexport function unhandledErrorResponse(\n err: unknown,\n pathname: string,\n onException?: (error: Error) => void,\n): Response {\n // `onException` is the report, and the default one `App` installs is a\n // `console.error`, so logging here as well printed every failure twice\n // (three times for `/api`, whose dispatcher logs before rethrowing). Only\n // without a reporter does this log itself.\n //\n // Reported for `/api` too: an app's error tracking should see an API failure\n // that got this far, not only a page one. `onRequestFail` is a different\n // hook (route config, called by the dispatchers), so this is not a second\n // report through the same channel.\n if (!onException) {\n console.error(err);\n } else {\n try {\n // The hook is typed to receive an `Error`; a thrown string or object is\n // wrapped so a reporter reading `.stack` or `.name` gets one.\n onException(err instanceof Error ? err : new Error(String(err), { cause: err }));\n } catch (reportError) {\n // A broken reporter must not turn a 500 into a leaked stack either.\n console.error(err);\n console.error(reportError);\n }\n }\n\n if (isApiPath(pathname)) {\n return new Response(JSON.stringify({ error: \"Internal Server Error\" }), {\n status: 500,\n headers: { \"Content-Type\": \"application/json\" },\n });\n }\n\n return new Response(GENERIC_500_HTML, {\n status: 500,\n headers: { \"Content-Type\": \"text/html; charset=utf-8\" },\n });\n}\n"
|
|
12
|
-
],
|
|
13
|
-
"mappings": ";uuBAAA,SAAS,OAAM,IAAS,QCkBxB,WAAS,UACT,cAAS,oBAAW,WAAsB,QAW1C,FAAM,HAAuC,LAAC,DAAM,AAAM,JAQpD,HAAyB,DAYzB,GAAiB,EACjB,GAAqB,GAGrB,GAAa,EAEnB,SAAS,EAAW,CAAC,EAAiC,CACpD,GAAI,IAAQ,OACV,MAAO,GAKT,GAAI,CAAC,oBAAoB,KAAK,EAAI,KAAK,CAAC,EACtC,MAAO,GAET,IAAM,EAAQ,OAAO,EAAI,KAAK,CAAC,EAC/B,OAAO,OAAO,SAAS,CAAK,EAAI,KAAK,IAAI,EAAO,CAAC,EAAI,EAahD,SAAS,EAAmB,CAAC,EAA+D,CACjG,GAAI,IAAW,MAAQ,IAAW,OAChC,OAAO,KAGT,IAAM,EAAW,IAAI,IACrB,QAAW,KAAQ,EAAO,MAAM,GAAG,EAAG,CACpC,IAAO,KAAc,GAAU,EAAK,MAAM,GAAG,EACvC,EAAS,EA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k.js";import"./chunk-zq5m4scz.js";import"./chunk-9a8qz3s7.js";import"./chunk-gvkydx8r.js";import"./chunk-8z37k28d.js";import"./chunk-vfrrzr10.js";import{zg as S}from"./chunk-kb3xk9r8.js";import"./chunk-zfch4da5.js";import{join as u}from"path";import{createServer as v}from"vite";import{join as E}from"path";import{IncomingMessage as P,ServerResponse as k}from"http";import{Socket as q}from"net";function w(J){return J.replace(/\x1b\[[0-9;]*m/g,"").replace(/\[[0-9;]*m/g,"").replace(/\n\s*\n/g,`
|
|
3
|
-
`).split(`
|
|
4
|
-
`).map((K)=>K.trim()).filter((K)=>K.length>0).join(`
|
|
5
|
-
`).trim()}function D(J){return`
|
|
6
|
-
<!DOCTYPE html>
|
|
7
|
-
<html lang="en">
|
|
8
|
-
<head>
|
|
9
|
-
<meta charset="UTF-8" />
|
|
10
|
-
<meta
|
|
11
|
-
name="viewport"
|
|
12
|
-
content="width=device-width, initial-scale=1.0"
|
|
13
|
-
/>
|
|
14
|
-
|
|
15
|
-
<title>Error</title>
|
|
16
|
-
<style>
|
|
17
|
-
body {
|
|
18
|
-
font-family: Arial, sans-serif;
|
|
19
|
-
padding: 20px;
|
|
20
|
-
}
|
|
21
|
-
h1 {
|
|
22
|
-
color: red;
|
|
23
|
-
}
|
|
24
|
-
</style>
|
|
25
|
-
</head>
|
|
26
|
-
<body>
|
|
27
|
-
<div id="overlay"></div>
|
|
28
|
-
<script type="module" src="/refresh.js"></script>
|
|
29
|
-
<script type="module" src="/@vite/client"></script>
|
|
30
|
-
<script>
|
|
31
|
-
${w.toString()}
|
|
32
|
-
const err = ${JSON.stringify(J,Object.getOwnPropertyNames(J),2)}
|
|
33
|
-
|
|
34
|
-
window.addEventListener('load', () => {
|
|
35
|
-
const container = document.getElementById('overlay')
|
|
36
|
-
const ErrorOverlay = customElements.get('vite-error-overlay')
|
|
37
|
-
if (ErrorOverlay) {
|
|
38
|
-
const overlay = new ErrorOverlay({ ...err, message: cleanupTerminalText(err.message) });
|
|
39
|
-
container.appendChild(overlay)
|
|
40
|
-
}
|
|
41
|
-
})
|
|
42
|
-
</script>
|
|
43
|
-
</body>
|
|
44
|
-
</html>
|
|
45
|
-
`}function d(J,K){let O=new URL(K.url),Q=new P(new q);Q.url=O.pathname+O.search,Q.method=K.method,Q.headers=Object.fromEntries(K.headers);let U=new k(Q),Y=[];return new Promise((B)=>{U.write=(Z)=>{if(Z)Y.push(Buffer.from(Z));return!0},U.end=(Z)=>{if(Z&&typeof Z!=="function")Y.push(Buffer.from(Z));let W=new Headers;for(let[L,z]of Object.entries(U.getHeaders())){if(z==null)continue;for(let G of Array.isArray(z)?z:[z])W.append(L,String(G))}return B(new Response(Y.length?Buffer.concat(Y):null,{status:U.statusCode,headers:W})),U},J.middlewares(Q,U,()=>B(null))})}function m(J,K,O){let Q=String(K),U=" ".repeat(Q.length),Y=" ".repeat(Math.max(0,O-1))+"^";return`${Q} | ${J}
|
|
46
|
-
${U} | ${Y}
|
|
47
|
-
`}function H(J){if(J&&typeof J==="object"){let K=J.position;if(K&&typeof K==="object"&&typeof K.file==="string")return{message:typeof J.message==="string"?J.message:String(J),stack:"",frame:typeof K.lineText==="string"?m(K.lineText,K.line,K.column):void 0,loc:{file:K.file,line:K.line,column:K.column}};return{message:typeof J.message==="string"?J.message:String(J),stack:typeof J.stack==="string"?J.stack:""}}return{message:String(J),stack:""}}function X(J){let K=globalThis.__gemiVite;if(!K)return;K.ws.send({type:"error",err:H(J)}),globalThis.__gemiErrorActive=!0}function _(J){let K=J.environments.ssr;if(typeof K?.runner?.import!=="function")throw Error("gemi dev requires a runnable Vite SSR environment.");return K.runner}function c(J){let{pathname:K,host:O,protocol:Q}=new URL(J.url);if(K.startsWith("/render-error.js"))return new Response("window.render_error = true",{headers:{"Content-Type":"application/javascript"}});if(K.startsWith("/refresh.js"))return new Response(`
|
|
48
|
-
import RefreshRuntime from "${Q}//${O}/@react-refresh";
|
|
49
|
-
RefreshRuntime.injectIntoGlobalHook(window);
|
|
50
|
-
window.$RefreshReg$ = () => {};
|
|
51
|
-
window.$RefreshSig$ = () => (type) => type;
|
|
52
|
-
window.__vite_plugin_react_preamble_installed__ = true;
|
|
53
|
-
`,{headers:{"Content-Type":"application/javascript"}});return null}function f(J,K,O){let Q=E(process.cwd(),"app");return async(U)=>{let{pathname:Y}=new URL(U.url),B=(W)=>{if(console.error(W),O.ssrFixStacktrace?.(W),X(W),S(Y))return new Response(JSON.stringify({error:W?.message??String(W)}),{status:500,headers:{"Content-Type":"application/json"}});return globalThis.__gemiErrorPageServed=!0,new Response(D(H(W)),{status:500,headers:{"Content-Type":"text/html"}})},Z=async(W)=>{let L=c(W);if(L)return L;try{let z=J.fetch.bind(J),G=await d(O,W)??await z(W);if(G instanceof Response)return G;let C={},y={},I={},R=($,j)=>`"${$}": () => import("${j}")`,x=[];for(let $ of["404",...J.getFlatComponentTree.call(J)]){if(Bun.env.NODE_ENV==="test")break;let j=`${process.env.APP_DIR}`,A=await _(O).import(`${j}/views/${$}.tsx`);C[$]=A.default,y[$]=A?.OpenGraph,I[$]=A,x.push(R($,`/app/views/${$}.tsx`))}let g=`{${x.join(",")}}`;return await G({getStyles:async($)=>await b(Q,O,$),bootstrapModules:["/refresh.js","/app/client.tsx","/@vite/client"],viewImportMap:C,viewModules:I,ogMap:y,loaders:g,cssManifest:{}})}catch(z){return B(z)}};return await K(U,(W)=>J.withGlobalMiddleware(W,Z,B))}}function h(J){try{return Bun.listen({hostname:"0.0.0.0",port:J,socket:{data(){}}}).stop(!0),!0}catch(K){return K?.code!=="EADDRINUSE"}}function F(J,K=h){let O=24678+(J-5173);if(O>65471)O=24678;for(let Q=O;Q<O+64;Q++)if(K(Q))return Q;throw Error(`Could not find a free port for Vite's HMR websocket: tried ${O}-${O+64-1}. Set one explicitly in gemi.config.ts as \`vite: { server: { ws: { port } } }\`.`)}var V=process.cwd(),l=u(V,"app");if(!globalThis.__gemiErrorHooked)globalThis.__gemiErrorHooked=!0,process.on("unhandledRejection",(J)=>{console.error(J),X(J)}),process.on("uncaughtException",(J)=>{console.error(J),X(J)});async function ZJ(J,K){let O=Number(process.env.PORT)||5173,Q=Boolean(globalThis.__gemiVite),U=globalThis.__gemiVite??=await v({configFile:!1,plugins:[N()],server:{middlewareMode:!0,ws:{port:F(O)},allowedHosts:J.devAllowedHosts.call(J),watch:{ignored:(B)=>{let Z=B.split(/[/\\]/).pop()??"";return Z===".env"||Z.startsWith(".env.")}}},appType:"custom",resolve:{dedupe:["react","react-dom"]},optimizeDeps:{include:["react","react-dom","react-dom/client"]},ssr:{external:[...M]}});process.env.ROOT_DIR=V,process.env.APP_DIR=l;let Y=Bun.serve({port:O,fetch:f(J,K,U)});if(Q)_(U).clearCache();if(Q)if(globalThis.__gemiErrorActive&&globalThis.__gemiErrorPageServed)globalThis.__gemiErrorActive=!1,globalThis.__gemiErrorPageServed=!1,U.ws.send({type:"full-reload"});else globalThis.__gemiErrorActive=!1,U.ws.send({type:"custom",event:"http-reload"});else T({port:Y.port,rootDir:V});return Y}export{H as viteErrorPayload,ZJ as httpDev};
|
|
54
|
-
|
|
55
|
-
//# debugId=8B888930C6E6E5E564756E2164756E21
|
package/dist/chunk-tmwsvf02.js
DELETED
|
@@ -1,5 +0,0 @@
|
|
|
1
|
-
// @bun
|
|
2
|
-
import{dc as o}from"./chunk-j9wqzemf.js";import{ec as i}from"./chunk-rv7da58g.js";import{bg as t}from"./chunk-m4xw99vm.js";import{ig as r}from"./chunk-en3mtnsg.js";class n extends i{register(){this.app.singleton(r,()=>new r(t(o(),this.app.config.get("translation",{}))))}}
|
|
3
|
-
export{n as Wa};
|
|
4
|
-
|
|
5
|
-
//# debugId=A3DC7B3D536610D064756E2164756E21
|