gemi 0.101.0 → 0.102.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.
Files changed (33) hide show
  1. package/dist/ai/index.d.ts +1 -1
  2. package/dist/ai/index.d.ts.map +1 -1
  3. package/dist/ai/index.js +13 -13
  4. package/dist/ai/index.js.map +3 -3
  5. package/dist/chunk-23mpa8t7.js +5 -0
  6. package/dist/{chunk-8v5z6646.js.map → chunk-23mpa8t7.js.map} +3 -3
  7. package/dist/chunk-9hs7prvj.js +17 -0
  8. package/dist/{chunk-d6prwkff.js.map → chunk-9hs7prvj.js.map} +4 -4
  9. package/dist/{chunk-pdvsc6jd.js → chunk-hr0m35tr.js} +1 -1
  10. package/dist/{chunk-jyswmx60.js → chunk-mb8chren.js} +2 -2
  11. package/dist/{chunk-jyswmx60.js.map → chunk-mb8chren.js.map} +1 -1
  12. package/dist/{chunk-ztcsyeg7.js → chunk-md8hmejq.js} +1 -1
  13. package/dist/facades/index.js +1 -1
  14. package/dist/http/McpRouter.d.ts +126 -11
  15. package/dist/http/McpRouter.d.ts.map +1 -1
  16. package/dist/http/index.js +1 -1
  17. package/dist/i18n/index.js +1 -1
  18. package/dist/kernel/index.js +1 -1
  19. package/dist/server/index.js +1 -1
  20. package/dist/services/index.d.ts +2 -2
  21. package/dist/services/index.d.ts.map +1 -1
  22. package/dist/services/index.js +1 -1
  23. package/dist/services/mcp/McpRegistry.d.ts +56 -3
  24. package/dist/services/mcp/McpRegistry.d.ts.map +1 -1
  25. package/dist/services/mcp/toAgentTools.d.ts +57 -1
  26. package/dist/services/mcp/toAgentTools.d.ts.map +1 -1
  27. package/dist/services/router/ApiRouteDispatcher.d.ts +27 -1
  28. package/dist/services/router/ApiRouteDispatcher.d.ts.map +1 -1
  29. package/package.json +1 -1
  30. package/dist/chunk-8v5z6646.js +0 -5
  31. package/dist/chunk-d6prwkff.js +0 -17
  32. /package/dist/{chunk-pdvsc6jd.js.map → chunk-hr0m35tr.js.map} +0 -0
  33. /package/dist/{chunk-ztcsyeg7.js.map → chunk-md8hmejq.js.map} +0 -0
@@ -1,5 +1,5 @@
1
1
  // @bun
2
- import{i as B,j as e}from"./chunk-jyswmx60.js";import{ka as D,oa as I,pa as r}from"./chunk-zq5m4scz.js";import"./chunk-8z37k28d.js";import{hc as c,ud as o,vd as P}from"./chunk-d6prwkff.js";import"./chunk-bf1q3m7a.js";import"./chunk-adm5g1v8.js";import{Se as f,Te as u,We as m}from"./chunk-4x41cmg3.js";import{Bf as n}from"./chunk-9xf2fx98.js";import"./chunk-eqtsfvvd.js";import"./chunk-br9p390p.js";import"./chunk-n4807648.js";import"./chunk-ghz3e8b7.js";import"./chunk-7vjbebst.js";import"./chunk-3fr22rtg.js";import"./chunk-qttatc7h.js";import"./chunk-48dek9s7.js";import"./chunk-f6s7ddjz.js";import{Wg as a}from"./chunk-n63xjrck.js";import{Xg as _}from"./chunk-2tm56xq1.js";import"./chunk-68zf43ah.js";import{join as M,resolve as yJ,sep as vJ}from"path";import{Duplex as KJ}from"stream";import{constants as L,createBrotliCompress as OJ,createGzip as YJ}from"zlib";var UJ=["br","gzip"],xJ=1024,VJ=5,IJ=19,CJ=6;function LJ(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 AJ(J){if(J===null||J===void 0)return null;let $=new Map;for(let X of J.split(",")){let[Z,...Q]=X.split(";"),W=Z.trim().toLowerCase();if(W==="")continue;let j=1;for(let G of Q){let Y=G.indexOf("=");if(Y===-1)continue;if(G.slice(0,Y).trim().toLowerCase()==="q"){j=LJ(G.slice(Y+1));break}}$.set(W,j)}return $}function PJ(J,$=UJ){let X=AJ(J);if(!X)return null;let Z=X.get("*"),Q=null,W=0;for(let j of $){let G=X.get(j)??Z??0;if(G>W)Q=j,W=G}return Q}function _J(J,$){if(!J)return!1;return J.split(",").some((X)=>X.trim().toLowerCase().split("=")[0].trim()===$)}function SJ(J,$){if(J==="HEAD")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;if(!$.body)return!1;let Z=$.headers.get("Content-Encoding");if(Z&&Z.trim().toLowerCase()!=="identity")return!1;if(_J($.headers.get("Cache-Control"),"no-transform"))return!1;let Q=$.headers.get("Content-Length");if(Q!==null&&Number(Q)<xJ)return!1;return!0}function TJ(J){let $=J==="br"?OJ({params:{[L.BROTLI_PARAM_QUALITY]:VJ,[L.BROTLI_PARAM_LGWIN]:IJ},flush:L.BROTLI_OPERATION_FLUSH}):YJ({level:CJ,flush:L.Z_SYNC_FLUSH});return KJ.toWeb($)}function DJ(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 g(J,$){if(!SJ(J.method,$))return $;let X=new Headers($.headers);DJ(X);let Z=PJ(J.headers.get("Accept-Encoding"));if(!Z)return new Response($.body,{status:$.status,statusText:$.statusText,headers:X});let Q;try{Q=TJ(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(Q),{status:$.status,statusText:$.statusText,headers:X})}import{readdir as FJ,stat as NJ}from"fs/promises";import{join as BJ}from"path";function w(J){let $=J.toString(),X=new Bun.CryptoHasher("sha1");return X.update($),X.digest("hex")}async function h(J){let $=new Set;async function X(Z,Q){let W;try{W=await FJ(Z,{withFileTypes:!0})}catch{return}for(let j of W){if(j.name.startsWith("."))continue;if(Q&&j.name==="assets")continue;let G=BJ(Z,j.name),Y=j.isDirectory(),V=j.isFile();if(j.isSymbolicLink())try{let C=await NJ(G);Y=C.isDirectory(),V=C.isFile()}catch{continue}if(V)$.add(G);else if(Y&&!j.isSymbolicLink())await X(G,!1)}}return await X(J,!0),$}var bJ="public, max-age=31536000, must-revalidate";function p(J,$){let X=Bun.file($),Z=X.size,Q=w(X.lastModified),W={"Content-Type":X.type||"application/octet-stream","Cache-Control":bJ,"Accept-Ranges":"bytes",ETag:Q},j=f(J.headers.get("Range"));if(j){let G=u(j,Z);if(!G)return c(Z);return new Response(X.slice(G.start,G.end+1).stream(),{status:206,headers:{...W,"Content-Range":m(G.start,G.end,Z),"Content-Length":String(G.length)}})}return new Response(X.stream(),{headers:{...W,"Content-Length":String(Z)}})}import{stat as EJ}from"fs/promises";var A="app/client.tsx";function d(J,$=D){let X=J[A]?.file;if(!X)return;return{module:I(X,$),preload:F(J,A,$)}}function F(J,$,X=D){let Z=[],Q=new Set,W=(j)=>{if(Q.has(j))return;Q.add(j);let G=J[j];if(!G?.file)return;Z.push(I(G.file,X));for(let Y of G.imports??[])W(Y)};return W($),Z}function l(J,$=30000){let X=JSON.stringify("gemi:chunk-reload"),Z=JSON.stringify(`Failed to fetch dynamically imported module: ${J}`);return`var r=!1;try{var s=window.sessionStorage,m=JSON.parse(s.getItem(${X})||"null");var d=m?Date.now()-m.at:NaN;if(navigator.onLine!==!1&&!(d>=0&&d<${$})){s.setItem(${X},JSON.stringify({url:window.location.href,at:Date.now()}));r=!0}}catch(e){}if(r)window.location.reload();else throw new Error(${Z});export {}`}var MJ=new RegExp(`^${o}/.+\\.m?js$`);function qJ(J){return MJ.test(J)}function i(J){if(qJ(J))return new Response(l(J),{headers:{"Content-Type":"application/javascript","Cache-Control":"no-store"}});if(P(J))return new Response("Not found",{status:404});return}var RJ=`<!DOCTYPE html>
2
+ import{i as B,j as e}from"./chunk-mb8chren.js";import{ka as D,oa as I,pa as r}from"./chunk-zq5m4scz.js";import"./chunk-8z37k28d.js";import{hc as c,ud as o,vd as P}from"./chunk-9hs7prvj.js";import"./chunk-bf1q3m7a.js";import"./chunk-adm5g1v8.js";import{Se as f,Te as u,We as m}from"./chunk-4x41cmg3.js";import{Bf as n}from"./chunk-9xf2fx98.js";import"./chunk-eqtsfvvd.js";import"./chunk-br9p390p.js";import"./chunk-n4807648.js";import"./chunk-ghz3e8b7.js";import"./chunk-7vjbebst.js";import"./chunk-3fr22rtg.js";import"./chunk-qttatc7h.js";import"./chunk-48dek9s7.js";import"./chunk-f6s7ddjz.js";import{Wg as a}from"./chunk-n63xjrck.js";import{Xg as _}from"./chunk-2tm56xq1.js";import"./chunk-68zf43ah.js";import{join as M,resolve as yJ,sep as vJ}from"path";import{Duplex as KJ}from"stream";import{constants as L,createBrotliCompress as OJ,createGzip as YJ}from"zlib";var UJ=["br","gzip"],xJ=1024,VJ=5,IJ=19,CJ=6;function LJ(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 AJ(J){if(J===null||J===void 0)return null;let $=new Map;for(let X of J.split(",")){let[Z,...Q]=X.split(";"),W=Z.trim().toLowerCase();if(W==="")continue;let j=1;for(let G of Q){let Y=G.indexOf("=");if(Y===-1)continue;if(G.slice(0,Y).trim().toLowerCase()==="q"){j=LJ(G.slice(Y+1));break}}$.set(W,j)}return $}function PJ(J,$=UJ){let X=AJ(J);if(!X)return null;let Z=X.get("*"),Q=null,W=0;for(let j of $){let G=X.get(j)??Z??0;if(G>W)Q=j,W=G}return Q}function _J(J,$){if(!J)return!1;return J.split(",").some((X)=>X.trim().toLowerCase().split("=")[0].trim()===$)}function SJ(J,$){if(J==="HEAD")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;if(!$.body)return!1;let Z=$.headers.get("Content-Encoding");if(Z&&Z.trim().toLowerCase()!=="identity")return!1;if(_J($.headers.get("Cache-Control"),"no-transform"))return!1;let Q=$.headers.get("Content-Length");if(Q!==null&&Number(Q)<xJ)return!1;return!0}function TJ(J){let $=J==="br"?OJ({params:{[L.BROTLI_PARAM_QUALITY]:VJ,[L.BROTLI_PARAM_LGWIN]:IJ},flush:L.BROTLI_OPERATION_FLUSH}):YJ({level:CJ,flush:L.Z_SYNC_FLUSH});return KJ.toWeb($)}function DJ(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 g(J,$){if(!SJ(J.method,$))return $;let X=new Headers($.headers);DJ(X);let Z=PJ(J.headers.get("Accept-Encoding"));if(!Z)return new Response($.body,{status:$.status,statusText:$.statusText,headers:X});let Q;try{Q=TJ(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(Q),{status:$.status,statusText:$.statusText,headers:X})}import{readdir as FJ,stat as NJ}from"fs/promises";import{join as BJ}from"path";function w(J){let $=J.toString(),X=new Bun.CryptoHasher("sha1");return X.update($),X.digest("hex")}async function h(J){let $=new Set;async function X(Z,Q){let W;try{W=await FJ(Z,{withFileTypes:!0})}catch{return}for(let j of W){if(j.name.startsWith("."))continue;if(Q&&j.name==="assets")continue;let G=BJ(Z,j.name),Y=j.isDirectory(),V=j.isFile();if(j.isSymbolicLink())try{let C=await NJ(G);Y=C.isDirectory(),V=C.isFile()}catch{continue}if(V)$.add(G);else if(Y&&!j.isSymbolicLink())await X(G,!1)}}return await X(J,!0),$}var bJ="public, max-age=31536000, must-revalidate";function p(J,$){let X=Bun.file($),Z=X.size,Q=w(X.lastModified),W={"Content-Type":X.type||"application/octet-stream","Cache-Control":bJ,"Accept-Ranges":"bytes",ETag:Q},j=f(J.headers.get("Range"));if(j){let G=u(j,Z);if(!G)return c(Z);return new Response(X.slice(G.start,G.end+1).stream(),{status:206,headers:{...W,"Content-Range":m(G.start,G.end,Z),"Content-Length":String(G.length)}})}return new Response(X.stream(),{headers:{...W,"Content-Length":String(Z)}})}import{stat as EJ}from"fs/promises";var A="app/client.tsx";function d(J,$=D){let X=J[A]?.file;if(!X)return;return{module:I(X,$),preload:F(J,A,$)}}function F(J,$,X=D){let Z=[],Q=new Set,W=(j)=>{if(Q.has(j))return;Q.add(j);let G=J[j];if(!G?.file)return;Z.push(I(G.file,X));for(let Y of G.imports??[])W(Y)};return W($),Z}function l(J,$=30000){let X=JSON.stringify("gemi:chunk-reload"),Z=JSON.stringify(`Failed to fetch dynamically imported module: ${J}`);return`var r=!1;try{var s=window.sessionStorage,m=JSON.parse(s.getItem(${X})||"null");var d=m?Date.now()-m.at:NaN;if(navigator.onLine!==!1&&!(d>=0&&d<${$})){s.setItem(${X},JSON.stringify({url:window.location.href,at:Date.now()}));r=!0}}catch(e){}if(r)window.location.reload();else throw new Error(${Z});export {}`}var MJ=new RegExp(`^${o}/.+\\.m?js$`);function qJ(J){return MJ.test(J)}function i(J){if(qJ(J))return new Response(l(J),{headers:{"Content-Type":"application/javascript","Cache-Control":"no-store"}});if(P(J))return new Response("Not found",{status:404});return}var RJ=`<!DOCTYPE html>
3
3
  <html lang="en">
4
4
  <head>
5
5
  <meta charset="UTF-8" />
@@ -1,6 +1,6 @@
1
1
  // @bun
2
- import{va as j}from"./chunk-8z37k28d.js";import{createElement as x}from"react";function h(i,n){let s=Object.keys(n).sort((u,r)=>r.length-u.length).map((u)=>u.replace(/[.*+?^${}()|[\]\\]/g,"\\$&")),b=new RegExp(s.join("|"),"g");return i.replace(b,(u)=>n[u])}async function J(i,n,s=[]){let b=[...s.map((t)=>`${i}/views/${t}.tsx`),`${i}/views/RootLayout.tsx`],u=new Set;for(let t of b){let e=n.moduleGraph.getModulesByFile(t);if(e)for(let g of e)u.add(g)}let r=[],p=[],l={};for(let t of u)if(t)for(let e of t.importedModules){if(e.file.includes("module.css"))l[e.file]=e.ssrTransformResult.map.sourcesContent.join("");if(e.file.includes(".css"))p.push(e.file)}for(let t of p){let e=await n.transformRequest(t+"?direct"),g=t.includes("module.css"),a="";if(g)a=h(l[t],e.default);r.push({isDev:!0,id:t,content:g?a:e.code})}return r.map((t,e)=>{return x("style",{key:e,type:"text/css","data-vite-dev-id":t.id,dangerouslySetInnerHTML:{__html:t.content}})})}async function L(i=[]){return i.map((n,s)=>{return x("style",{key:s,id:n?.id,type:"text/css",dangerouslySetInnerHTML:{__html:n.content}})})}import{existsSync as v}from"fs";import{basename as f}from"path";import{networkInterfaces as k}from"os";var y={name:"gemi",version:"0.101.0",private:!1,license:"MIT",author:"Enes Tufekci <enes@gemijs.dev>",repository:{type:"git",url:"git+https://github.com/nstfkc/gemi.git",directory:"packages/gemi"},bin:{gemi:"./dist/bin/gemi.js","gemi-orm-generator":"./dist/bin/orm-generator.js"},files:["dist/**/*","ide/typescript-plugin/package.json","skills/**/*"],module:!0,exports:{"./http":"./http/index.ts","./client":"./client/index.ts","./ai":"./ai/index.ts","./ai/client":"./ai/client/index.ts","./testing":"./testing/index.ts","./app":"./app/index.ts","./facades":"./facades/index.ts","./email":"./email/index.ts","./vite":"./dist/vite/index.mjs","./kernel":"./kernel/index.ts","./services":"./services/index.ts","./i18n":"./i18n/index.ts","./dictionary":"./i18n/dictionaryRuntime.ts","./server":"./server/index.ts","./config":"./config/index.ts","./container":"./container/index.ts","./foundation":"./foundation/index.ts","./database":"./database/index.ts","./orm":"./orm/index.ts","./support":"./support/index.ts","./console/run":"./console/run.ts","./queue/work":"./services/queue/work.ts","./ide/typescript-plugin":"./ide/typescript-plugin/index.ts","./bun/preload":"./bun/preload.ts","./bun/plugin":"./bun/plugin.ts"},scripts:{lint:"oxlint",typecheck:"tsc --noEmit -p tsconfig.json && tsc --noEmit -p tsconfig.browser.json && tsc --noEmit -p ide/typescript-plugin/tsconfig.json",build:"NODE_ENV=production bun run build:core && bun run build:bin && bun run build:types && bun run build:client && bun run build:plugin && bun run build:ts-plugin && bun run build:client-types && bun run build:augmentation","build:core":"bun ./scripts/build.ts","build:bin":"bun build --outdir=./dist/bin --target=bun --external=vite --external=react-dom --external=react/jsx-runtime --external=bun --external=sharp --external=@azure/storage-blob --external=typescript --sourcemap ./bin/gemi.ts ./bin/orm-generator.ts && bun ./scripts/prepare-bin.ts","build:client":"rm -rf dist/client dist/testing dist/ai/client dist/chunks && vite build -c vite.client.config.mts","build:plugin":"vite build -c vite.plugin.config.mts","build:ts-plugin":"bun ./scripts/build-ts-plugin.ts","build:types":"tsc -p tsconfig.build.json","build:client-types":"tsc -p tsconfig.browser.json",test:"bun --bun vitest","test:types":"vitest run --typecheck.only","test:live":"bun --bun vitest run ai/live","test:packaging":"bun --bun vitest run --config vitest.packaging.config.ts","build:publish":"bun scripts/build-publish.ts",prepublishOnly:"echo 'Do not publish from this directory \u2014 its exports point at TS source. Run: bun run build:publish, then publish from .publish/' && exit 1","build:augmentation":"bun ./scripts/wire-augmentation.ts"},dependencies:{"@aws-sdk/client-s3":"^3.629.0","@aws-sdk/s3-request-presigner":"^3.629.0","ast-types":"^0.14.2",commander:"^12.1.0",history:"^5.3.0","jsx-email":"2.0.0-rc2.1","magic-string":"^0.30.17",open:"^10.1.0","react-error-boundary":"^6.0.0",recast:"^0.23.9",resend:"^6.12.3",satori:"^0.12.2","temporal-polyfill":"^0.2.5","twitter-api-v2":"^1.20.2","urlpattern-polyfill":"^10.0.0",uuid:"^9.0.1"},devDependencies:{"@babel/parser":"^7.25.4","@prisma/generator-helper":"^6.5.0","@repo/typescript-config":"*","@testing-library/react":"^16.3.2","@types/bun":"^1.3.14","@types/eslint":"^8.56.5","@types/node":"^20.11.24","@types/react":"^19.0.2","@types/react-dom":"^19.0.2",eslint:"^8.57.0",jsdom:"^30.0.1",oxlint:"^1.39.0",react:"19.2.3","react-dom":"19.2.3",typescript:"^5.7.3",vitest:"^4.0.0"},peerDependencies:{"@azure/storage-blob":"^12.28.0",react:">=19","react-dom":">=19",sharp:"^0.34.2",typescript:">=5",vite:"^8.0.0"},peerDependenciesMeta:{"@azure/storage-blob":{optional:!0},typescript:{optional:!0}}};var q=[" \u2588\u2588\u2588\u2588\u2588\u2588\u2557 \u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2557\u2588\u2588\u2588\u2557 \u2588\u2588\u2588\u2557\u2588\u2588\u2557","\u2588\u2588\u2554\u2550\u2550\u2550\u2550\u255D \u2588\u2588\u2554\u2550\u2550\u2550\u2550\u255D\u2588\u2588\u2588\u2588\u2557 \u2588\u2588\u2588\u2588\u2551\u2588\u2588\u2551","\u2588\u2588\u2551 \u2588\u2588\u2588\u2557\u2588\u2588\u2588\u2588\u2588\u2557 \u2588\u2588\u2554\u2588\u2588\u2588\u2588\u2554\u2588\u2588\u2551\u2588\u2588\u2551","\u2588\u2588\u2551 \u2588\u2588\u2551\u2588\u2588\u2554\u2550\u2550\u255D \u2588\u2588\u2551\u255A\u2588\u2588\u2554\u255D\u2588\u2588\u2551\u2588\u2588\u2551","\u255A\u2588\u2588\u2588\u2588\u2588\u2588\u2554\u255D\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2557\u2588\u2588\u2551 \u255A\u2550\u255D \u2588\u2588\u2551\u2588\u2588\u2551"," \u255A\u2550\u2550\u2550\u2550\u2550\u255D \u255A\u2550\u2550\u2550\u2550\u2550\u2550\u255D\u255A\u2550\u255D \u255A\u2550\u255D\u255A\u2550\u255D"],z=Boolean(process.stdout.isTTY)&&!process.env.NO_COLOR,c=(i,n)=>z?`\x1B[${i}m${n}\x1B[0m`:n,E=(i)=>c("1",i),d=(i)=>c("2",i),o=(i)=>c("36",i),O=(i)=>c("32",i),T=(i)=>c("35",i);function R(){return y.version??"?"}function _(i){for(let n of Object.values(k()))for(let s of n??[])if((s.family==="IPv4"||s.family===4)&&!s.internal)return`http://${s.address}:${i}`;return null}function G(i){return j(i).filter((n)=>v(n)).map((n)=>f(n))}function A(i){let{port:n,rootDir:s}=i,b=`http://localhost:${n}`,u=_(n),r=G(s),p=(t,e)=>` ${O("\u279C")} ${E(t.padEnd(9))}${e}`,l=["",...q.map((t)=>T(t)),"",` ${d("gemi")} ${o(`v${R()}`)}`,"",p("Local:",o(b)),p("Network:",u?o(u):d("unavailable")),p("Env:",r.length?r.join(", "):d("none")),""];console.log(l.join(`
2
+ import{va as j}from"./chunk-8z37k28d.js";import{createElement as x}from"react";function h(i,n){let s=Object.keys(n).sort((u,r)=>r.length-u.length).map((u)=>u.replace(/[.*+?^${}()|[\]\\]/g,"\\$&")),b=new RegExp(s.join("|"),"g");return i.replace(b,(u)=>n[u])}async function J(i,n,s=[]){let b=[...s.map((t)=>`${i}/views/${t}.tsx`),`${i}/views/RootLayout.tsx`],u=new Set;for(let t of b){let e=n.moduleGraph.getModulesByFile(t);if(e)for(let g of e)u.add(g)}let r=[],p=[],l={};for(let t of u)if(t)for(let e of t.importedModules){if(e.file.includes("module.css"))l[e.file]=e.ssrTransformResult.map.sourcesContent.join("");if(e.file.includes(".css"))p.push(e.file)}for(let t of p){let e=await n.transformRequest(t+"?direct"),g=t.includes("module.css"),a="";if(g)a=h(l[t],e.default);r.push({isDev:!0,id:t,content:g?a:e.code})}return r.map((t,e)=>{return x("style",{key:e,type:"text/css","data-vite-dev-id":t.id,dangerouslySetInnerHTML:{__html:t.content}})})}async function L(i=[]){return i.map((n,s)=>{return x("style",{key:s,id:n?.id,type:"text/css",dangerouslySetInnerHTML:{__html:n.content}})})}import{existsSync as v}from"fs";import{basename as f}from"path";import{networkInterfaces as k}from"os";var y={name:"gemi",version:"0.102.0",private:!1,license:"MIT",author:"Enes Tufekci <enes@gemijs.dev>",repository:{type:"git",url:"git+https://github.com/nstfkc/gemi.git",directory:"packages/gemi"},bin:{gemi:"./dist/bin/gemi.js","gemi-orm-generator":"./dist/bin/orm-generator.js"},files:["dist/**/*","ide/typescript-plugin/package.json","skills/**/*"],module:!0,exports:{"./http":"./http/index.ts","./client":"./client/index.ts","./ai":"./ai/index.ts","./ai/client":"./ai/client/index.ts","./testing":"./testing/index.ts","./app":"./app/index.ts","./facades":"./facades/index.ts","./email":"./email/index.ts","./vite":"./dist/vite/index.mjs","./kernel":"./kernel/index.ts","./services":"./services/index.ts","./i18n":"./i18n/index.ts","./dictionary":"./i18n/dictionaryRuntime.ts","./server":"./server/index.ts","./config":"./config/index.ts","./container":"./container/index.ts","./foundation":"./foundation/index.ts","./database":"./database/index.ts","./orm":"./orm/index.ts","./support":"./support/index.ts","./console/run":"./console/run.ts","./queue/work":"./services/queue/work.ts","./ide/typescript-plugin":"./ide/typescript-plugin/index.ts","./bun/preload":"./bun/preload.ts","./bun/plugin":"./bun/plugin.ts"},scripts:{lint:"oxlint",typecheck:"tsc --noEmit -p tsconfig.json && tsc --noEmit -p tsconfig.browser.json && tsc --noEmit -p ide/typescript-plugin/tsconfig.json",build:"NODE_ENV=production bun run build:core && bun run build:bin && bun run build:types && bun run build:client && bun run build:plugin && bun run build:ts-plugin && bun run build:client-types && bun run build:augmentation","build:core":"bun ./scripts/build.ts","build:bin":"bun build --outdir=./dist/bin --target=bun --external=vite --external=react-dom --external=react/jsx-runtime --external=bun --external=sharp --external=@azure/storage-blob --external=typescript --sourcemap ./bin/gemi.ts ./bin/orm-generator.ts && bun ./scripts/prepare-bin.ts","build:client":"rm -rf dist/client dist/testing dist/ai/client dist/chunks && vite build -c vite.client.config.mts","build:plugin":"vite build -c vite.plugin.config.mts","build:ts-plugin":"bun ./scripts/build-ts-plugin.ts","build:types":"tsc -p tsconfig.build.json","build:client-types":"tsc -p tsconfig.browser.json",test:"bun --bun vitest","test:types":"vitest run --typecheck.only","test:live":"bun --bun vitest run ai/live","test:packaging":"bun --bun vitest run --config vitest.packaging.config.ts","build:publish":"bun scripts/build-publish.ts",prepublishOnly:"echo 'Do not publish from this directory \u2014 its exports point at TS source. Run: bun run build:publish, then publish from .publish/' && exit 1","build:augmentation":"bun ./scripts/wire-augmentation.ts"},dependencies:{"@aws-sdk/client-s3":"^3.629.0","@aws-sdk/s3-request-presigner":"^3.629.0","ast-types":"^0.14.2",commander:"^12.1.0",history:"^5.3.0","jsx-email":"2.0.0-rc2.1","magic-string":"^0.30.17",open:"^10.1.0","react-error-boundary":"^6.0.0",recast:"^0.23.9",resend:"^6.12.3",satori:"^0.12.2","temporal-polyfill":"^0.2.5","twitter-api-v2":"^1.20.2","urlpattern-polyfill":"^10.0.0",uuid:"^9.0.1"},devDependencies:{"@babel/parser":"^7.25.4","@prisma/generator-helper":"^6.5.0","@repo/typescript-config":"*","@testing-library/react":"^16.3.2","@types/bun":"^1.3.14","@types/eslint":"^8.56.5","@types/node":"^20.11.24","@types/react":"^19.0.2","@types/react-dom":"^19.0.2",eslint:"^8.57.0",jsdom:"^30.0.1",oxlint:"^1.39.0",react:"19.2.3","react-dom":"19.2.3",typescript:"^5.7.3",vitest:"^4.0.0"},peerDependencies:{"@azure/storage-blob":"^12.28.0",react:">=19","react-dom":">=19",sharp:"^0.34.2",typescript:">=5",vite:"^8.0.0"},peerDependenciesMeta:{"@azure/storage-blob":{optional:!0},typescript:{optional:!0}}};var q=[" \u2588\u2588\u2588\u2588\u2588\u2588\u2557 \u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2557\u2588\u2588\u2588\u2557 \u2588\u2588\u2588\u2557\u2588\u2588\u2557","\u2588\u2588\u2554\u2550\u2550\u2550\u2550\u255D \u2588\u2588\u2554\u2550\u2550\u2550\u2550\u255D\u2588\u2588\u2588\u2588\u2557 \u2588\u2588\u2588\u2588\u2551\u2588\u2588\u2551","\u2588\u2588\u2551 \u2588\u2588\u2588\u2557\u2588\u2588\u2588\u2588\u2588\u2557 \u2588\u2588\u2554\u2588\u2588\u2588\u2588\u2554\u2588\u2588\u2551\u2588\u2588\u2551","\u2588\u2588\u2551 \u2588\u2588\u2551\u2588\u2588\u2554\u2550\u2550\u255D \u2588\u2588\u2551\u255A\u2588\u2588\u2554\u255D\u2588\u2588\u2551\u2588\u2588\u2551","\u255A\u2588\u2588\u2588\u2588\u2588\u2588\u2554\u255D\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2557\u2588\u2588\u2551 \u255A\u2550\u255D \u2588\u2588\u2551\u2588\u2588\u2551"," \u255A\u2550\u2550\u2550\u2550\u2550\u255D \u255A\u2550\u2550\u2550\u2550\u2550\u2550\u255D\u255A\u2550\u255D \u255A\u2550\u255D\u255A\u2550\u255D"],z=Boolean(process.stdout.isTTY)&&!process.env.NO_COLOR,c=(i,n)=>z?`\x1B[${i}m${n}\x1B[0m`:n,E=(i)=>c("1",i),d=(i)=>c("2",i),o=(i)=>c("36",i),O=(i)=>c("32",i),T=(i)=>c("35",i);function R(){return y.version??"?"}function _(i){for(let n of Object.values(k()))for(let s of n??[])if((s.family==="IPv4"||s.family===4)&&!s.internal)return`http://${s.address}:${i}`;return null}function G(i){return j(i).filter((n)=>v(n)).map((n)=>f(n))}function A(i){let{port:n,rootDir:s}=i,b=`http://localhost:${n}`,u=_(n),r=G(s),p=(t,e)=>` ${O("\u279C")} ${E(t.padEnd(9))}${e}`,l=["",...q.map((t)=>T(t)),"",` ${d("gemi")} ${o(`v${R()}`)}`,"",p("Local:",o(b)),p("Network:",u?o(u):d("unavailable")),p("Env:",r.length?r.join(", "):d("none")),""];console.log(l.join(`
3
3
  `))}
4
4
  export{J as h,L as i,A as j};
5
5
 
6
- //# debugId=2BBAD893EA665AFA64756E2164756E21
6
+ //# debugId=BFB8576E2C2E684264756E2164756E21
@@ -6,6 +6,6 @@
6
6
  "import { existsSync } from \"node:fs\";\nimport { basename } from \"node:path\";\nimport { networkInterfaces } from \"node:os\";\nimport { envFiles } from \"./watchEnv\";\nimport pkg from \"../package.json\";\n\n// \"GEMI\" — ANSI Shadow figlet font.\nconst ART = [\n \" ██████╗ ███████╗███╗ ███╗██╗\",\n \"██╔════╝ ██╔════╝████╗ ████║██║\",\n \"██║ ███╗█████╗ ██╔████╔██║██║\",\n \"██║ ██║██╔══╝ ██║╚██╔╝██║██║\",\n \"╚██████╔╝███████╗██║ ╚═╝ ██║██║\",\n \" ╚═════╝ ╚══════╝╚═╝ ╚═╝╚═╝\",\n];\n\nconst useColor = Boolean(process.stdout.isTTY) && !process.env.NO_COLOR;\nconst paint = (code: string, text: string) =>\n useColor ? `\\x1b[${code}m${text}\\x1b[0m` : text;\nconst bold = (t: string) => paint(\"1\", t);\nconst dim = (t: string) => paint(\"2\", t);\nconst cyan = (t: string) => paint(\"36\", t);\nconst green = (t: string) => paint(\"32\", t);\nconst magenta = (t: string) => paint(\"35\", t);\n\nfunction gemiVersion(): string {\n return (pkg as { version?: string }).version ?? \"?\";\n}\n\nfunction networkUrl(port: number | string): string | null {\n for (const ifaces of Object.values(networkInterfaces())) {\n for (const iface of ifaces ?? []) {\n // Node <18 reported `family` as the number 4; newer Bun/Node use \"IPv4\".\n const isV4 = iface.family === \"IPv4\" || (iface.family as unknown) === 4;\n if (isV4 && !iface.internal) return `http://${iface.address}:${port}`;\n }\n }\n return null;\n}\n\nfunction loadedEnvFiles(rootDir: string): string[] {\n return envFiles(rootDir)\n .filter((file) => existsSync(file))\n .map((file) => basename(file));\n}\n\nexport function printStartupBanner(params: {\n port: number | string;\n rootDir: string;\n}) {\n const { port, rootDir } = params;\n const local = `http://localhost:${port}`;\n const network = networkUrl(port);\n const env = loadedEnvFiles(rootDir);\n\n const row = (label: string, value: string) =>\n ` ${green(\"➜\")} ${bold(label.padEnd(9))}${value}`;\n\n const out = [\n \"\",\n ...ART.map((line) => magenta(line)),\n \"\",\n ` ${dim(\"gemi\")} ${cyan(`v${gemiVersion()}`)}`,\n \"\",\n row(\"Local:\", cyan(local)),\n row(\"Network:\", network ? cyan(network) : dim(\"unavailable\")),\n row(\"Env:\", env.length ? env.join(\", \") : dim(\"none\")),\n \"\",\n ];\n\n console.log(out.join(\"\\n\"));\n}\n"
7
7
  ],
8
8
  "mappings": ";yCAAA,wBAAS,cAGT,SAAS,CAAc,CAAC,EAAc,EAAwC,CAC5E,IAAM,EAAc,OAAO,KAAK,CAAM,EACnC,KAAK,CAAC,EAAG,IAAM,EAAE,OAAS,EAAE,MAAM,EAClC,IAAI,CAAC,IAAQ,EAAI,QAAQ,sBAAuB,MA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,EAAQ,CAAI,CAAC,EAClC,GACA,KAAK,EAAI,MAAM,KAAK,EAAK,IAAI,EAAY,GAAG,IAC5C,GACA,EAAI,SAAU,EAAK,CAAK,CAAC,EACzB,EAAI,WAAY,EAAU,EAAK,CAAO,EAAI,EAAI,aAAa,CAAC,EAC5D,EAAI,OAAQ,EAAI,OAAS,EAAI,KAAK,IAAI,EAAI,EAAI,MAAM,CAAC,EACrD,EACF,EAEA,QAAQ,IAAI,EAAI,KAAK;AAAA,CAAI,CAAC",
9
- "debugId": "2BBAD893EA665AFA64756E2164756E21",
9
+ "debugId": "BFB8576E2C2E684264756E2164756E21",
10
10
  "names": []
11
11
  }
@@ -1,5 +1,5 @@
1
1
  // @bun
2
- import{h as N,j as q}from"./chunk-jyswmx60.js";import{ia as E,ja as w}from"./chunk-53we503k.js";import"./chunk-zq5m4scz.js";import"./chunk-9a8qz3s7.js";import"./chunk-gvkydx8r.js";import"./chunk-8z37k28d.js";import"./chunk-xp6nr441.js";import{Bf as _}from"./chunk-9xf2fx98.js";import{Xg as y}from"./chunk-2tm56xq1.js";import"./chunk-68zf43ah.js";import{join as KJ}from"path";import{createServer as QJ}from"vite";import{join as u}from"path";import{IncomingMessage as v,ServerResponse as l}from"http";import{Socket as d}from"net";function c(J){return J.replace(/\x1b\[[0-9;]*m/g,"").replace(/\[[0-9;]*m/g,"").replace(/\n\s*\n/g,`
2
+ import{h as N,j as q}from"./chunk-mb8chren.js";import{ia as E,ja as w}from"./chunk-53we503k.js";import"./chunk-zq5m4scz.js";import"./chunk-9a8qz3s7.js";import"./chunk-gvkydx8r.js";import"./chunk-8z37k28d.js";import"./chunk-xp6nr441.js";import{Bf as _}from"./chunk-9xf2fx98.js";import{Xg as y}from"./chunk-2tm56xq1.js";import"./chunk-68zf43ah.js";import{join as KJ}from"path";import{createServer as QJ}from"vite";import{join as u}from"path";import{IncomingMessage as v,ServerResponse as l}from"http";import{Socket as d}from"net";function c(J){return J.replace(/\x1b\[[0-9;]*m/g,"").replace(/\[[0-9;]*m/g,"").replace(/\n\s*\n/g,`
3
3
  `).split(`
4
4
  `).map((K)=>K.trim()).filter((K)=>K.length>0).join(`
5
5
  `).trim()}function F(J){return`
@@ -1,4 +1,4 @@
1
1
  // @bun
2
- import{Lc as c,Mc as d,Nc as f,Oc as g,Pc as i,Qc as j,Rc as k,Sc as l,Tc as m,fd as n,gd as o,hd as p,mc as a}from"../chunk-d6prwkff.js";import"../chunk-bf1q3m7a.js";import"../chunk-adm5g1v8.js";import{lf as b,tf as e,vf as h}from"../chunk-4x41cmg3.js";import"../chunk-9xf2fx98.js";import"../chunk-eqtsfvvd.js";import"../chunk-br9p390p.js";import"../chunk-n4807648.js";import"../chunk-ghz3e8b7.js";import"../chunk-7vjbebst.js";import"../chunk-3fr22rtg.js";import"../chunk-qttatc7h.js";import"../chunk-48dek9s7.js";import"../chunk-f6s7ddjz.js";import"../chunk-n63xjrck.js";import"../chunk-2tm56xq1.js";import"../chunk-68zf43ah.js";export{g as Url,e as Storage,k as Redis,a as Redirect,l as RateLimiter,f as Query,i as Meta,h as Log,m as Lock,d as Lang,n as Features,b as Facade,p as DB,j as Cookie,o as ConnectionQueries,c as Auth};
2
+ import{Lc as c,Mc as d,Nc as f,Oc as g,Pc as i,Qc as j,Rc as k,Sc as l,Tc as m,fd as n,gd as o,hd as p,mc as a}from"../chunk-9hs7prvj.js";import"../chunk-bf1q3m7a.js";import"../chunk-adm5g1v8.js";import{lf as b,tf as e,vf as h}from"../chunk-4x41cmg3.js";import"../chunk-9xf2fx98.js";import"../chunk-eqtsfvvd.js";import"../chunk-br9p390p.js";import"../chunk-n4807648.js";import"../chunk-ghz3e8b7.js";import"../chunk-7vjbebst.js";import"../chunk-3fr22rtg.js";import"../chunk-qttatc7h.js";import"../chunk-48dek9s7.js";import"../chunk-f6s7ddjz.js";import"../chunk-n63xjrck.js";import"../chunk-2tm56xq1.js";import"../chunk-68zf43ah.js";export{g as Url,e as Storage,k as Redis,a as Redirect,l as RateLimiter,f as Query,i as Meta,h as Log,m as Lock,d as Lang,n as Features,b as Facade,p as DB,j as Cookie,o as ConnectionQueries,c as Auth};
3
3
 
4
4
  //# debugId=0905CD6AC3F7D4D564756E2164756E21
@@ -1,6 +1,7 @@
1
1
  import type { ToolContext } from "../ai/Agent";
2
2
  import type { AnySchema, Infer, Schema } from "../ai/Schema";
3
3
  import type { UrlParser } from "../client/types";
4
+ import type { McpCallContext, McpCredentials } from "../services/mcp/McpRegistry";
4
5
  import type { ApiRouterHandler } from "./ApiRouter";
5
6
  import type { HttpRequest } from "./HttpRequest";
6
7
  /**
@@ -23,22 +24,36 @@ export type McpMethod = "GET" | "POST" | "PUT" | "PATCH" | "DELETE";
23
24
  * say in it: the param is absent from the tool's input schema, and anything
24
25
  * the model sends under its name is dropped before the url is built.
25
26
  *
26
- * It is handed the run's request, not a tool context, so the same binder
27
- * keeps meaning something for a caller that is not an agent run. A binder may
28
- * read the user as `req.ctx().user`: that is the store of the request that
29
- * started the run, and it stays open until the run settles — through a
30
- * streamed response, and after the client has disconnected, since leaving does
31
- * not stop the run. `user` is whatever that route's middleware set, so the
32
- * route that starts the run must be behind `auth` for it to be there.
27
+ * It is handed the run's request first, so the same binder keeps meaning
28
+ * something for a caller that is not an agent run. A binder may read the user
29
+ * as `req.ctx().user`: that is the store of the request that started the run,
30
+ * and it stays open until the run settles — through a streamed response, and
31
+ * after the client has disconnected, since leaving does not stop the run.
32
+ * `user` is whatever that route's middleware set, so the route that starts the
33
+ * run must be behind `auth` for it to be there.
34
+ *
35
+ * The second argument is the whole call (#756): the caller, the tool, the
36
+ * model's parsed arguments, and `ctx`, the run's `ToolContext` — absent when
37
+ * the registry is called without one. A param that names "the resource this
38
+ * run is about" reads it from there rather than from the chat route's url:
39
+ *
40
+ * ```ts
41
+ * params: { siteId: (_req, { ctx }) => ctx?.context.siteId }
42
+ * ```
43
+ *
44
+ * `ctx.body` is the client's, as untrusted as a request body: bind from it
45
+ * only what the route's own middleware checks anyway.
33
46
  */
34
- export type McpParamBinder = (req: HttpRequest<any, any>) => string | number | Promise<string | number>;
47
+ export type McpParamBinder = (req: HttpRequest<any, any>, call: McpCallContext) => string | number | Promise<string | number>;
35
48
  /**
36
49
  * Picks the attachment a bound file field sends, usually out of `ctx.turn`.
37
50
  * The id still resolves through `ctx.attachments`, so a binder can narrow which
38
51
  * of the caller's files is sent and can never reach anybody else's. `undefined`
39
52
  * means there is no file to send, and the model is told so.
53
+ *
54
+ * The second argument is the whole call, as a param binder gets it.
40
55
  */
41
- export type McpFileBinder = (ctx: ToolContext) => string | undefined | Promise<string | undefined>;
56
+ export type McpFileBinder = (ctx: ToolContext, call: McpCallContext) => string | undefined | Promise<string | undefined>;
42
57
  /** `Methods[M][K]`, exactly as `useMutation` splits `RPC` — plus `GET`. */
43
58
  type RoutesOf<R> = {
44
59
  [M in McpMethod]: {
@@ -47,6 +62,12 @@ type RoutesOf<R> = {
47
62
  };
48
63
  type IsAny<T> = 0 extends 1 & T ? true : false;
49
64
  type BodyOf<H> = H extends ApiRouterHandler<infer T, any, any> ? T : never;
65
+ /**
66
+ * What the route answers on success, as `useQuery` reads it. The registry
67
+ * hands `result` the parsed JSON, so a `Date` in a handler's return arrives as
68
+ * the string it was serialised to.
69
+ */
70
+ export type DataOf<H> = H extends ApiRouterHandler<any, infer O, any, any> ? Awaited<O> : unknown;
50
71
  /**
51
72
  * A body there is nothing to check against: a handler that never names its
52
73
  * request (`async list() {}` infers `unknown`), or one typed `any`. The meta
@@ -148,7 +169,73 @@ type InputProp<B, I> = {
148
169
  */
149
170
  input: I & NoInfer<InputCheck<I, B>>;
150
171
  };
151
- export type McpRouteMeta<H, K, I> = MetaBase & InputMeta<BodyOf<H>, I> & ParamsMeta<K> & FilesMeta<BodyOf<H>>;
172
+ /**
173
+ * What `result` is handed beside the route's answer: the whole call, as the
174
+ * binders and the `credentials` hook get it — the tool, the model's parsed
175
+ * arguments, the caller and the run's `ToolContext`.
176
+ */
177
+ export type McpResultContext = McpCallContext;
178
+ /**
179
+ * Turns the route's answer into what the model is shown. See `ResultMeta`.
180
+ */
181
+ export type McpResultProjection<D = any, P = unknown> = (data: D, call: McpResultContext) => P | Promise<P>;
182
+ /**
183
+ * An `output` without a `result` must describe what the route answers.
184
+ * Checked one way — the answer must be assignable to the schema's type — so a
185
+ * schema that names fewer fields than the route answers is fine (parsing
186
+ * drops the rest), and one naming a field the route does not have, or with a
187
+ * different type, is not. A route whose answer type is unknown is not checked.
188
+ */
189
+ type OutputCheck<O, P> = IsAny<P> extends true ? unknown : unknown extends P ? unknown : O extends AnySchema ? [P] extends [Infer<O>] ? unknown : {
190
+ "output does not describe what the route answers": Infer<O>;
191
+ } : unknown;
192
+ /** What `result` must return: anything, or what `output` describes when it is set. */
193
+ type ResultReturn<O> = O extends AnySchema ? Infer<O> | Promise<Infer<O>> : unknown;
194
+ /**
195
+ * Two shapes, told apart by whether `result` is there, because `output`
196
+ * describes a different thing in each: what `result` returns, or what the
197
+ * route answers.
198
+ *
199
+ * `result`'s return is checked against `output` through its contextual type
200
+ * rather than by inferring it and comparing afterwards. A type parameter for
201
+ * it would have to be inferred from a context-sensitive function, and any
202
+ * check that mentioned it beside `output` fixed it to its default first.
203
+ */
204
+ type ResultMeta<H, O> = {
205
+ /**
206
+ * Trims or reshapes the route's 2xx JSON before the model sees it.
207
+ * Routes are written for a UI and answer whole records; a model needs a
208
+ * few fields of them, and every other one costs context on every call.
209
+ *
210
+ * ```ts
211
+ * result: (pages) => pages.map(({ path, title }) => ({ path, title })),
212
+ * ```
213
+ *
214
+ * A 4xx is not passed through it: a refusal reaches the model as the
215
+ * route wrote it. A throw is the server's failure, logged, and the model
216
+ * is told only that the tool failed.
217
+ */
218
+ result: (data: DataOf<H>, call: McpResultContext) => ResultReturn<O>;
219
+ /**
220
+ * The shape of what `result` returns. The return is parsed with it,
221
+ * which drops every field it does not declare. It is the descriptor's
222
+ * `outputSchema`, and the `AgentTool`'s. A value that does not parse is
223
+ * the server's failure.
224
+ */
225
+ output?: O;
226
+ } | {
227
+ result?: never;
228
+ /**
229
+ * The shape of what the route answers. The answer is parsed with it,
230
+ * which drops every field it does not declare, so an `output` alone is
231
+ * a projection too: it may name fewer fields than the route answers,
232
+ * never one it does not have. It is the descriptor's `outputSchema`, and
233
+ * the `AgentTool`'s. An answer that does not parse is the server's
234
+ * failure.
235
+ */
236
+ output?: O & NoInfer<OutputCheck<O, DataOf<H>>>;
237
+ };
238
+ export type McpRouteMeta<H, K, I, O = undefined> = MetaBase & InputMeta<BodyOf<H>, I> & ParamsMeta<K> & FilesMeta<BodyOf<H>> & ResultMeta<H, O>;
152
239
  /** The runtime shape of a meta, generics erased. */
153
240
  export type McpRouteMetaRuntime = {
154
241
  description: string;
@@ -157,6 +244,8 @@ export type McpRouteMetaRuntime = {
157
244
  requiresApproval?: boolean;
158
245
  params?: Record<string, McpParamBinder | "input">;
159
246
  files?: Record<string, McpFileBinder | "input">;
247
+ result?: McpResultProjection;
248
+ output?: AnySchema;
160
249
  };
161
250
  /**
162
251
  * One exposed route: what `fromApiRoute` returns and `routes` holds. Plain
@@ -201,7 +290,33 @@ export declare class McpRouteDeclaration<M extends McpMethod = McpMethod, K exte
201
290
  export declare class McpRouter<R = McpRoutes> {
202
291
  static __brand: string;
203
292
  routes: Record<string, McpRouteDeclaration>;
204
- fromApiRoute<M extends McpMethod, K extends keyof RoutesOf<R>[M] & string, I extends AnySchema | undefined = undefined>(method: M, url: K, meta: McpRouteMeta<RoutesOf<R>[M][K], K, I>): McpRouteDeclaration<M, K>;
293
+ /**
294
+ * The app's own credentials for one tool call, sent beside the access token
295
+ * of the user who started the run. Optional; without it a tool call carries
296
+ * gemi's access token and nothing else.
297
+ *
298
+ * For routes whose middleware reads something gemi does not know about: a
299
+ * cookie naming an anonymous owner, or a header the app signs per run so a
300
+ * route can check what this run may touch.
301
+ *
302
+ * ```ts
303
+ * credentials({ req, ctx }: McpCallContext) {
304
+ * return {
305
+ * cookies: { owner: req.cookies.get("owner") },
306
+ * headers: { "x-run-grant": signGrant(ctx?.runId) },
307
+ * };
308
+ * }
309
+ * ```
310
+ *
311
+ * Nothing of the initiator's is forwarded unless it is returned here, value
312
+ * by value. `access_token`, `Cookie`, `Host`, `User-Agent`, the body's
313
+ * framing headers and `x-forwarded-*` cannot be set: the identity stays the
314
+ * initiator's, and the call fails on the server, logged, if one is returned.
315
+ * The route's middleware still decides what a credential is worth, so this
316
+ * can reach nothing a direct request carrying the same values could not.
317
+ */
318
+ credentials?(call: McpCallContext): McpCredentials | undefined | Promise<McpCredentials | undefined>;
319
+ fromApiRoute<M extends McpMethod, K extends keyof RoutesOf<R>[M] & string, I extends AnySchema | undefined = undefined, O extends AnySchema | undefined = undefined>(method: M, url: K, meta: McpRouteMeta<RoutesOf<R>[M][K], K, I, O>): McpRouteDeclaration<M, K>;
205
320
  }
206
321
  export {};
207
322
  //# sourceMappingURL=McpRouter.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"McpRouter.d.ts","sourceRoot":"","sources":["../../http/McpRouter.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,WAAW,EAAE,MAAM,aAAa,CAAC;AAC/C,OAAO,KAAK,EAAE,SAAS,EAAE,KAAK,EAAE,MAAM,EAAE,MAAM,cAAc,CAAC;AAC7D,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,iBAAiB,CAAC;AACjD,OAAO,KAAK,EAAE,gBAAgB,EAAE,MAAM,aAAa,CAAC;AACpD,OAAO,KAAK,EAAE,WAAW,EAAE,MAAM,eAAe,CAAC;AAEjD;;;;;;;;;;GAUG;AACH,MAAM,WAAW,SAAS;CAAG;AAE7B,sFAAsF;AACtF,MAAM,MAAM,SAAS,GAAG,KAAK,GAAG,MAAM,GAAG,KAAK,GAAG,OAAO,GAAG,QAAQ,CAAC;AAEpE;;;;;;;;;;;;GAYG;AACH,MAAM,MAAM,cAAc,GAAG,CAC3B,GAAG,EAAE,WAAW,CAAC,GAAG,EAAE,GAAG,CAAC,KACvB,MAAM,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AAS,MAAM,QAAQ,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,GAAG,MAAM,EACvC,CAAC,SAAS,SAAS,GAAG,SAAS,GAAG,SAAS,EAC3C,CAAC,SAAS,SAAS,GAAG,SAAS,GAAG,SAAS,EAE3C,MAAM,EAAE,CAAC,EACT,GAAG,EAAE,CAAC,EACN,IAAI,EAAE,YAAY,CAAC,QAAQ,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,EAAE,CAAC,EAAE,CAAC,EAAE,CAAC,CAAC,GAC7C,mBAAmB,CAAC,CAAC,EAAE,CAAC,CAAC;CAG7B"}
@@ -1,4 +1,4 @@
1
1
  // @bun
2
- import{Ac as H,Fd as I,Gd as J,Hd as K,Id as L,Jd as M,Kd as N,gc as n,hc as o,ic as p,jc as v,kc as w,lc as x,nc as y,oc as z,pc as A,qc as B,rc as C,sc as D,tc as E,yc as F,zc as G}from"../chunk-d6prwkff.js";import"../chunk-bf1q3m7a.js";import"../chunk-adm5g1v8.js";import{Me as a,Ne as b,Oe as d,Se as e,Te as f,Ue as g,Ve as h,We as i,Xe as j,af as k,bf as l,ff as m,gf as q,hf as r,if as s,jf as t,kf as u}from"../chunk-4x41cmg3.js";import{zf as c}from"../chunk-9xf2fx98.js";import"../chunk-eqtsfvvd.js";import"../chunk-br9p390p.js";import"../chunk-n4807648.js";import"../chunk-ghz3e8b7.js";import"../chunk-7vjbebst.js";import"../chunk-3fr22rtg.js";import"../chunk-qttatc7h.js";import"../chunk-48dek9s7.js";import"../chunk-f6s7ddjz.js";import"../chunk-n63xjrck.js";import"../chunk-2tm56xq1.js";import"../chunk-68zf43ah.js";export{g as toRangeHeaderValue,n as toMiddlewareList,f as resolveRange,e as parseRangeHeader,h as parseContentRange,E as middlewareConfigDefaults,z as httpError,d as getCookies,j as formatUnsatisfiedContentRange,i as formatContentRange,D as defineMiddlewareConfig,o as createUnsatisfiableResponse,p as createStreamResponse,A as createFileResponse,H as clientIp,B as ViewRouter,k as ValidationError,b as ResourceController,c as RequestBreakerError,G as RateLimitMiddleware,F as RateLimitExceededError,s as RangeNotSatisfiableError,M as PoliciesServiceProvider,N as Policies,C as Middleware,x as McpRouter,w as McpRouteDeclaration,l as InvalidValidationRuleError,r as InsufficientPermissionsError,y as HttpResponse,m as HttpRequest,t as FileNotFoundError,K as CorsMiddleware,a as Controller,J as CacheMiddleware,L as CSRFMiddleware,q as AuthorizationError,I as AuthenticationMiddleware,u as AuthenticationError,v as ApiRouter};
2
+ import{Ac as H,Fd as I,Gd as J,Hd as K,Id as L,Jd as M,Kd as N,gc as n,hc as o,ic as p,jc as v,kc as w,lc as x,nc as y,oc as z,pc as A,qc as B,rc as C,sc as D,tc as E,yc as F,zc as G}from"../chunk-9hs7prvj.js";import"../chunk-bf1q3m7a.js";import"../chunk-adm5g1v8.js";import{Me as a,Ne as b,Oe as d,Se as e,Te as f,Ue as g,Ve as h,We as i,Xe as j,af as k,bf as l,ff as m,gf as q,hf as r,if as s,jf as t,kf as u}from"../chunk-4x41cmg3.js";import{zf as c}from"../chunk-9xf2fx98.js";import"../chunk-eqtsfvvd.js";import"../chunk-br9p390p.js";import"../chunk-n4807648.js";import"../chunk-ghz3e8b7.js";import"../chunk-7vjbebst.js";import"../chunk-3fr22rtg.js";import"../chunk-qttatc7h.js";import"../chunk-48dek9s7.js";import"../chunk-f6s7ddjz.js";import"../chunk-n63xjrck.js";import"../chunk-2tm56xq1.js";import"../chunk-68zf43ah.js";export{g as toRangeHeaderValue,n as toMiddlewareList,f as resolveRange,e as parseRangeHeader,h as parseContentRange,E as middlewareConfigDefaults,z as httpError,d as getCookies,j as formatUnsatisfiedContentRange,i as formatContentRange,D as defineMiddlewareConfig,o as createUnsatisfiableResponse,p as createStreamResponse,A as createFileResponse,H as clientIp,B as ViewRouter,k as ValidationError,b as ResourceController,c as RequestBreakerError,G as RateLimitMiddleware,F as RateLimitExceededError,s as RangeNotSatisfiableError,M as PoliciesServiceProvider,N as Policies,C as Middleware,x as McpRouter,w as McpRouteDeclaration,l as InvalidValidationRuleError,r as InsufficientPermissionsError,y as HttpResponse,m as HttpRequest,t as FileNotFoundError,K as CorsMiddleware,a as Controller,J as CacheMiddleware,L as CSRFMiddleware,q as AuthorizationError,I as AuthenticationMiddleware,u as AuthenticationError,v as ApiRouter};
3
3
 
4
4
  //# debugId=40862F9DA4E1987764756E2164756E21
@@ -1,4 +1,4 @@
1
1
  // @bun
2
- import{aa as w}from"../chunk-mekw2ap4.js";import"../chunk-9a8qz3s7.js";import{Wa as b}from"../chunk-yhkffean.js";import{dc as R,ec as S}from"../chunk-f9t39vwk.js";import"../chunk-7kedxtbp.js";import{Mc as j}from"../chunk-d6prwkff.js";import"../chunk-bf1q3m7a.js";import"../chunk-adm5g1v8.js";import"../chunk-4x41cmg3.js";import"../chunk-9xf2fx98.js";import"../chunk-eqtsfvvd.js";import"../chunk-br9p390p.js";import"../chunk-n4807648.js";import"../chunk-ghz3e8b7.js";import"../chunk-7vjbebst.js";import"../chunk-3fr22rtg.js";import{Dg as X,Eg as E,Fg as V,Gg as L}from"../chunk-qttatc7h.js";import"../chunk-48dek9s7.js";import"../chunk-f6s7ddjz.js";import"../chunk-n63xjrck.js";import"../chunk-2tm56xq1.js";import"../chunk-68zf43ah.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};
2
+ import{aa as w}from"../chunk-mekw2ap4.js";import"../chunk-9a8qz3s7.js";import{Wa as b}from"../chunk-yhkffean.js";import{dc as R,ec as S}from"../chunk-f9t39vwk.js";import"../chunk-7kedxtbp.js";import{Mc as j}from"../chunk-9hs7prvj.js";import"../chunk-bf1q3m7a.js";import"../chunk-adm5g1v8.js";import"../chunk-4x41cmg3.js";import"../chunk-9xf2fx98.js";import"../chunk-eqtsfvvd.js";import"../chunk-br9p390p.js";import"../chunk-n4807648.js";import"../chunk-ghz3e8b7.js";import"../chunk-7vjbebst.js";import"../chunk-3fr22rtg.js";import{Dg as X,Eg as E,Fg as V,Gg as L}from"../chunk-qttatc7h.js";import"../chunk-48dek9s7.js";import"../chunk-f6s7ddjz.js";import"../chunk-n63xjrck.js";import"../chunk-2tm56xq1.js";import"../chunk-68zf43ah.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
4
  //# debugId=57FB2330D198750F64756E2164756E21
@@ -1,5 +1,5 @@
1
1
  // @bun
2
- import{ya as y}from"../chunk-epwaxctc.js";import{Va as i}from"../chunk-pjg7gqnh.js";import{Wa as g}from"../chunk-yhkffean.js";import{$a as e,Za as T,_a as D,ab as A,bb as w,fb as P,gb as S,ib as h,jb as R,kb as u,lb as l,ob as v,pb as d,sb as c,vb as p,yb as n}from"../chunk-8v5z6646.js";import"../chunk-wc46df4w.js";import"../chunk-3tn480wt.js";import{_b as r}from"../chunk-z8jf7jwg.js";import"../chunk-f9t39vwk.js";import"../chunk-7kedxtbp.js";import{Ad as m,Bd as Q,Cd as t,Dd as o,Fc as Zj,Gc as $j,Jc as Gj,Kc as Hj,nd as x,sd as I,td as E,wd as K,xd as M,yd as s,zd as C}from"../chunk-d6prwkff.js";import{Od as a}from"../chunk-bf1q3m7a.js";import{$d as V,ee as f}from"../chunk-adm5g1v8.js";import{ff as F}from"../chunk-4x41cmg3.js";import{yf as B}from"../chunk-9xf2fx98.js";import{Ef as L}from"../chunk-eqtsfvvd.js";import"../chunk-br9p390p.js";import"../chunk-n4807648.js";import"../chunk-ghz3e8b7.js";import"../chunk-7vjbebst.js";import"../chunk-3fr22rtg.js";import"../chunk-77kw61f4.js";import"../chunk-qttatc7h.js";import{Hg as _,Jg as N,Kg as b}from"../chunk-48dek9s7.js";import"../chunk-f6s7ddjz.js";import"../chunk-xmjhensy.js";import"../chunk-n63xjrck.js";import{Xg as q}from"../chunk-2tm56xq1.js";import"../chunk-68zf43ah.js";function Jj(j){let X=j.headers.get("Cache-Control")?.toLowerCase()??"";return/(^|[\s,])(public|s-maxage)\b/.test(X)}var Wj=new Set,Xj={refusal:null,apply:(j)=>j,carried:null};async function k(j){let X=b(x);if(X.config.global.length===0)return Xj;let{pathname:Z}=new URL(j.url),W=q(Z),z=new F(j,{},W?"api":"view","");return await L.run(z,async()=>{let $=L.getStore(),{headers:H,cookies:zj}=$,Y=(J)=>{if(!Jj(J))return Q(J,H,zj);let G=new Headers(H);return G.delete("Set-Cookie"),Q(J,G,Wj)};try{return await X.runGlobalMiddleware(),{refusal:null,apply:Y,carried:{user:$.user}}}catch(J){let G=!W&&Z.endsWith(".json");if(J?.kind===B){let O=W?m(J.payload.api):G?M(J.payload.viewData??J.payload.api):K(J.payload.view);return{refusal:Y(O),apply:Y,carried:null}}if(V(J)&&(W||G))return{refusal:Y(C()),apply:Y,carried:null};if(f(J)){console.error(J);let O=W||G?I():K(E());return{refusal:Y(O),apply:Y,carried:null}}throw J}finally{$.destroy()}})}var U=[l,d,y,P,n,A,S,v,R,D,h,p,u,g,c,w];class jj{config={};providers=[];services=[];serviceInstances=[];serviceTokens=new Set;servicesBooted=!1;models=[];app=new N;boot(){if(this.models.length>0)i(...this.models);else Yj();this.app.config.merge(this.config),N.setInstance(this.app),this.app.registerMany([...U,...this.providers]),this.registerServices()}registerServices(){let j=this.serviceTokens;this.serviceInstances=[],this.serviceTokens=new Set,this.servicesBooted=!1;let X=new Map;for(let Z of this.services){let W=typeof Z==="function"?new Z:Z,z=W.constructor;if(!z.token)throw Error(`Service [${z.name}] is listed in \`services\` but does not declare a \`static token\`.`);let $=X.get(z.token);if($)throw Error(`Services [${$}] and [${z.name}] both declare the token "${z.token}". Tokens are the container's keys, so they must be unique.`);X.set(z.token,z.name);let H=z;if(!j.has(z.token)&&this.app.bound(H))throw Error(`Service [${z.name}] declares the token "${z.token}", which is already bound in the container by the framework or a provider. Binding it would replace that service everywhere, so pick a token nothing else owns.`);this.app.instance(H,W),this.serviceInstances.push(W),this.serviceTokens.add(z.token)}}async waitForBoot(){await this.app.boot(),await this.bootServices(),e(this.app)}async bootServices(){if(this.servicesBooted)return;for(let j of this.serviceInstances)await j.boot();this.servicesBooted=!0}shutdown(j){return this.run(()=>this.app.shutdown(j))}run(j){return _.run(this.app,j)}resolve(j){return this.app.make(j)}apiRoutes(){return this.app.make(t)}viewRoutes(){return this.app.make(s)}domains(){return this.app.make(o)}queue(){return this.app.make(r)}globalMiddleware(j){return k(j)}destroy(){if(this.app.resolved(T))this.app.make(T).stop();if(this.app.flush(),N.getInstance()===this.app)N.setInstance(void 0);_.disable()}}function Yj(){if(Bun.env.NODE_ENV==="production")return;let j=a();if(j.length===0)return;console.warn(`[gemi] ${j.length} model${j.length===1?" is":"s are"} registered, but Kernel.models is empty.
2
+ import{ya as y}from"../chunk-epwaxctc.js";import{Va as i}from"../chunk-pjg7gqnh.js";import{Wa as g}from"../chunk-yhkffean.js";import{$a as e,Za as T,_a as D,ab as A,bb as w,fb as P,gb as S,ib as h,jb as R,kb as u,lb as l,ob as v,pb as d,sb as c,vb as p,yb as n}from"../chunk-23mpa8t7.js";import"../chunk-wc46df4w.js";import"../chunk-3tn480wt.js";import{_b as r}from"../chunk-z8jf7jwg.js";import"../chunk-f9t39vwk.js";import"../chunk-7kedxtbp.js";import{Ad as m,Bd as Q,Cd as t,Dd as o,Fc as Zj,Gc as $j,Jc as Gj,Kc as Hj,nd as x,sd as I,td as E,wd as K,xd as M,yd as s,zd as C}from"../chunk-9hs7prvj.js";import{Od as a}from"../chunk-bf1q3m7a.js";import{$d as V,ee as f}from"../chunk-adm5g1v8.js";import{ff as F}from"../chunk-4x41cmg3.js";import{yf as B}from"../chunk-9xf2fx98.js";import{Ef as L}from"../chunk-eqtsfvvd.js";import"../chunk-br9p390p.js";import"../chunk-n4807648.js";import"../chunk-ghz3e8b7.js";import"../chunk-7vjbebst.js";import"../chunk-3fr22rtg.js";import"../chunk-77kw61f4.js";import"../chunk-qttatc7h.js";import{Hg as _,Jg as N,Kg as b}from"../chunk-48dek9s7.js";import"../chunk-f6s7ddjz.js";import"../chunk-xmjhensy.js";import"../chunk-n63xjrck.js";import{Xg as q}from"../chunk-2tm56xq1.js";import"../chunk-68zf43ah.js";function Jj(j){let X=j.headers.get("Cache-Control")?.toLowerCase()??"";return/(^|[\s,])(public|s-maxage)\b/.test(X)}var Wj=new Set,Xj={refusal:null,apply:(j)=>j,carried:null};async function k(j){let X=b(x);if(X.config.global.length===0)return Xj;let{pathname:Z}=new URL(j.url),W=q(Z),z=new F(j,{},W?"api":"view","");return await L.run(z,async()=>{let $=L.getStore(),{headers:H,cookies:zj}=$,Y=(J)=>{if(!Jj(J))return Q(J,H,zj);let G=new Headers(H);return G.delete("Set-Cookie"),Q(J,G,Wj)};try{return await X.runGlobalMiddleware(),{refusal:null,apply:Y,carried:{user:$.user}}}catch(J){let G=!W&&Z.endsWith(".json");if(J?.kind===B){let O=W?m(J.payload.api):G?M(J.payload.viewData??J.payload.api):K(J.payload.view);return{refusal:Y(O),apply:Y,carried:null}}if(V(J)&&(W||G))return{refusal:Y(C()),apply:Y,carried:null};if(f(J)){console.error(J);let O=W||G?I():K(E());return{refusal:Y(O),apply:Y,carried:null}}throw J}finally{$.destroy()}})}var U=[l,d,y,P,n,A,S,v,R,D,h,p,u,g,c,w];class jj{config={};providers=[];services=[];serviceInstances=[];serviceTokens=new Set;servicesBooted=!1;models=[];app=new N;boot(){if(this.models.length>0)i(...this.models);else Yj();this.app.config.merge(this.config),N.setInstance(this.app),this.app.registerMany([...U,...this.providers]),this.registerServices()}registerServices(){let j=this.serviceTokens;this.serviceInstances=[],this.serviceTokens=new Set,this.servicesBooted=!1;let X=new Map;for(let Z of this.services){let W=typeof Z==="function"?new Z:Z,z=W.constructor;if(!z.token)throw Error(`Service [${z.name}] is listed in \`services\` but does not declare a \`static token\`.`);let $=X.get(z.token);if($)throw Error(`Services [${$}] and [${z.name}] both declare the token "${z.token}". Tokens are the container's keys, so they must be unique.`);X.set(z.token,z.name);let H=z;if(!j.has(z.token)&&this.app.bound(H))throw Error(`Service [${z.name}] declares the token "${z.token}", which is already bound in the container by the framework or a provider. Binding it would replace that service everywhere, so pick a token nothing else owns.`);this.app.instance(H,W),this.serviceInstances.push(W),this.serviceTokens.add(z.token)}}async waitForBoot(){await this.app.boot(),await this.bootServices(),e(this.app)}async bootServices(){if(this.servicesBooted)return;for(let j of this.serviceInstances)await j.boot();this.servicesBooted=!0}shutdown(j){return this.run(()=>this.app.shutdown(j))}run(j){return _.run(this.app,j)}resolve(j){return this.app.make(j)}apiRoutes(){return this.app.make(t)}viewRoutes(){return this.app.make(s)}domains(){return this.app.make(o)}queue(){return this.app.make(r)}globalMiddleware(j){return k(j)}destroy(){if(this.app.resolved(T))this.app.make(T).stop();if(this.app.flush(),N.getInstance()===this.app)N.setInstance(void 0);_.disable()}}function Yj(){if(Bun.env.NODE_ENV==="production")return;let j=a();if(j.length===0)return;console.warn(`[gemi] ${j.length} model${j.length===1?" is":"s are"} registered, but Kernel.models is empty.
3
3
  Nested relation reads resolve a model by name, so a policy on a subclass that does not own its
4
4
  `+" name is skipped inside every include \u2014 scoped at the root, "+`unscoped in an include, with nothing
5
5
  to notice it. Declaring the modules registers each class under its own name and audits the set:
@@ -1,4 +1,4 @@
1
1
  // @bun
2
- import{wa as I}from"../chunk-8z37k28d.js";import{xa as A}from"../chunk-xp6nr441.js";import{Ng as b,Pg as V,Qg as H,Rg as O,Sg as W}from"../chunk-xmjhensy.js";import{Wg as k}from"../chunk-n63xjrck.js";import"../chunk-2tm56xq1.js";import{bh as $}from"../chunk-68zf43ah.js";var X=Symbol.for("gemi.server.devGeneration"),L={graceMs:1e4,providerTimeoutMs:5000};class Q{app;inFlight=0;waiters=new Set;constructor(z){this.app=z}track(z){return async(B,J)=>{this.inFlight++;try{return await z(B,J)}finally{if(this.inFlight--,this.inFlight===0)this.wake()}}}get pending(){return this.inFlight}async retire({graceMs:z,providerTimeoutMs:B}){try{await this.idle(z),await Promise.resolve().then(()=>this.app.shutdown({timeoutMs:B}))}catch(J){Z(J)}}idle(z){if(this.inFlight===0)return Promise.resolve();return new Promise((B)=>{let J=()=>{clearTimeout(K),this.waiters.delete(J),B()},K=setTimeout(J,z);this.waiters.add(J)})}wake(){for(let z of this.waiters)z()}}function Y(z,B=L){let J=globalThis,K=J[X];if(J[X]=z,!K||K===z||typeof K.retire!=="function")return Promise.resolve();let _=K.retire.bind(K);return Promise.resolve().then(()=>_(B)).catch(Z)}function Z(z){console.error("[gemi] Shutting down the application a reload replaced failed:",z)}class P{app;instrumentation;handleSignals;server;stopping;settings;constructor(z){this.app=new A({kernel:z.kernel}),this.handleSignals=z.handleSignals??!0,this.instrumentation=O(z.instrumentation??((B,J)=>J(B)))}async start(){process.env.ROOT_DIR=k();let z=Bun.env.NODE_ENV==="production";if(z){if(this.handleSignals)W(()=>this.stop());this.settings=V()}try{await this.app.waitForBoot()}catch(B){if(!z)this.app.shutdown({timeoutMs:L.providerTimeoutMs});throw B}if(z){let{httpProd:B}=await import("../chunk-pdvsc6jd.js");this.server=await B(this.app,this.instrumentation.bind(this))}else{I();let{httpDev:B}=await import("../chunk-ztcsyeg7.js"),J=new Q(this.app);this.server=await B(this.app,J.track(this.instrumentation.bind(this))),Y(J)}return this.server}stop(z={}){return this.stopping??=H({server:this.server,shutdownProviders:(B)=>this.app.shutdown(B),settings:{...this.settings??V(),...z}}),this.stopping}}export{b as isShuttingDown,P as Server};
2
+ import{wa as I}from"../chunk-8z37k28d.js";import{xa as A}from"../chunk-xp6nr441.js";import{Ng as b,Pg as V,Qg as H,Rg as O,Sg as W}from"../chunk-xmjhensy.js";import{Wg as k}from"../chunk-n63xjrck.js";import"../chunk-2tm56xq1.js";import{bh as $}from"../chunk-68zf43ah.js";var X=Symbol.for("gemi.server.devGeneration"),L={graceMs:1e4,providerTimeoutMs:5000};class Q{app;inFlight=0;waiters=new Set;constructor(z){this.app=z}track(z){return async(B,J)=>{this.inFlight++;try{return await z(B,J)}finally{if(this.inFlight--,this.inFlight===0)this.wake()}}}get pending(){return this.inFlight}async retire({graceMs:z,providerTimeoutMs:B}){try{await this.idle(z),await Promise.resolve().then(()=>this.app.shutdown({timeoutMs:B}))}catch(J){Z(J)}}idle(z){if(this.inFlight===0)return Promise.resolve();return new Promise((B)=>{let J=()=>{clearTimeout(K),this.waiters.delete(J),B()},K=setTimeout(J,z);this.waiters.add(J)})}wake(){for(let z of this.waiters)z()}}function Y(z,B=L){let J=globalThis,K=J[X];if(J[X]=z,!K||K===z||typeof K.retire!=="function")return Promise.resolve();let _=K.retire.bind(K);return Promise.resolve().then(()=>_(B)).catch(Z)}function Z(z){console.error("[gemi] Shutting down the application a reload replaced failed:",z)}class P{app;instrumentation;handleSignals;server;stopping;settings;constructor(z){this.app=new A({kernel:z.kernel}),this.handleSignals=z.handleSignals??!0,this.instrumentation=O(z.instrumentation??((B,J)=>J(B)))}async start(){process.env.ROOT_DIR=k();let z=Bun.env.NODE_ENV==="production";if(z){if(this.handleSignals)W(()=>this.stop());this.settings=V()}try{await this.app.waitForBoot()}catch(B){if(!z)this.app.shutdown({timeoutMs:L.providerTimeoutMs});throw B}if(z){let{httpProd:B}=await import("../chunk-hr0m35tr.js");this.server=await B(this.app,this.instrumentation.bind(this))}else{I();let{httpDev:B}=await import("../chunk-md8hmejq.js"),J=new Q(this.app);this.server=await B(this.app,J.track(this.instrumentation.bind(this))),Y(J)}return this.server}stop(z={}){return this.stopping??=H({server:this.server,shutdownProviders:(B)=>this.app.shutdown(B),settings:{...this.settings??V(),...z}}),this.stopping}}export{b as isShuttingDown,P as Server};
3
3
 
4
4
  //# debugId=3D36CFA294CE7ED664756E2164756E21
@@ -20,10 +20,10 @@ export { EmailDriver } from "./email/drivers/EmailDriver";
20
20
  export { ResendDriver } from "./email/drivers/ResendDriver";
21
21
  export type { EmailAttachment, EmailDeliveryResult, EmailSendResult, SendEmailParams, } from "./email/drivers/types";
22
22
  export { RouteServiceProvider } from "./router/RouteServiceProvider";
23
- export { ApiRouteDispatcher } from "./router/ApiRouteDispatcher";
23
+ export { ApiRouteDispatcher, type DispatchAsOptions, type DispatchCredentials, } from "./router/ApiRouteDispatcher";
24
24
  export { ViewRouteDispatcher } from "./router/ViewRouteDispatcher";
25
25
  export type { StreamSummary, StreamQuerySummary, } from "./router/ServerQueryStore";
26
- export { McpRegistry, McpToolError, type McpCaller, type McpToolAnnotations, type McpToolDescriptor, type McpToolFilter, } from "./mcp/McpRegistry";
26
+ export { McpRegistry, McpToolError, type McpCaller, type McpCallContext, type McpCredentials, type McpToolAnnotations, type McpToolDescriptor, type McpToolFilter, } from "./mcp/McpRegistry";
27
27
  export { LogServiceProvider } from "./logging/LogServiceProvider";
28
28
  export { LogManager } from "./logging/LogManager";
29
29
  export type { LogEntry } from "./logging/types";
@@ -1 +1 @@
1
- {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../services/index.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,yBAAyB,EAAE,MAAM,0CAA0C,CAAC;AACrF,OAAO,EAAE,iBAAiB,EAAE,MAAM,kCAAkC,CAAC;AACrE,OAAO,EAAE,gBAAgB,EAAE,MAAM,yCAAyC,CAAC;AAC3E,OAAO,EAAE,QAAQ,EAAE,MAAM,iCAAiC,CAAC;AAC3D,OAAO,EACL,eAAe,EACf,KAAK,qBAAqB,GAC3B,MAAM,wCAAwC,CAAC;AAChD,YAAY,EACV,SAAS,EACT,gBAAgB,EAChB,gBAAgB,EAChB,YAAY,EACZ,cAAc,EACd,aAAa,EACb,cAAc,EACd,UAAU,GACX,MAAM,8BAA8B,CAAC;AACtC,OAAO,EAAE,iBAAiB,EAAE,MAAM,0CAA0C,CAAC;AAE7E,OAAO,EACL,YAAY,EACZ,kBAAkB,EAClB,iBAAiB,G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B,CAAC;AACxB,OAAO,EACL,iBAAiB,EACjB,mBAAmB,EACnB,KAAK,WAAW,GACjB,MAAM,iBAAiB,CAAC;AACzB,OAAO,EACL,iBAAiB,EACjB,mBAAmB,EACnB,KAAK,WAAW,GACjB,MAAM,6BAA6B,CAAC;AACrC,OAAO,EACL,oBAAoB,EACpB,sBAAsB,EACtB,KAAK,cAAc,GACpB,MAAM,eAAe,CAAC;AACvB,OAAO,EACL,mBAAmB,EACnB,qBAAqB,EACrB,KAAK,aAAa,GACnB,MAAM,mBAAmB,CAAC;AAC3B,OAAO,EACL,iBAAiB,EACjB,mBAAmB,EACnB,KAAK,WAAW,GACjB,MAAM,gBAAgB,CAAC;AACxB,OAAO,EACL,oBAAoB,EACpB,sBAAsB,EACtB,KAAK,cAAc,GACpB,MAAM,mBAAmB,CAAC;AAC3B,OAAO,EACL,gBAAgB,EAChB,kBAAkB,EAClB,KAAK,UAAU,EACf,KAAK,iBAAiB,EACtB,KAAK,eAAe,EACpB,KAAK,iBAAiB,EACtB,KAAK,qBAAqB,GAC3B,MAAM,gBAAgB,CAAC;AACxB,OAAO,EACL,uBAAuB,EACvB,yBAAyB,EACzB,KAAK,iBAAiB,GACvB,MAAM,gBAAgB,CAAC;AACxB,OAAO,EACL,sBAAsB,EACtB,wBAAwB,EACxB,KAAK,gBAAgB,GACtB,MAAM,2BAA2B,CAAC"}
@@ -1,5 +1,5 @@
1
1
  // @bun
2
- import{Ya as dW}from"../chunk-zytmxty5.js";import{Za as i6,_a as DW,ab as FW,bb as UW,cb as SW,db as fW,eb as RW,fb as kW,gb as _W,hb as U,ib as CW,jb as vW,kb as bW,lb as IW,mb as TW,nb as qW,ob as hW,pb as PW,qb as wW,rb as AW,sb as yW,tb as VW,ub as gW,vb as cW,wb as EW,xb as mW,yb as uW}from"../chunk-8v5z6646.js";import"../chunk-wc46df4w.js";import{Eb as YW,Fb as JW,Gb as ZW,Hb as GW,Ib as $W,Jb as QW,Kb as KW,Lb as XW,Mb as zW,Nb as BW,Ob as xW,Pb as MW,Qb as jW,Rb as NW,Sb as LW}from"../chunk-3tn480wt.js";import{Tb as n6,Ub as o6,Vb as s6,Wb as a6,Xb as t6,Yb as r6,Zb as e6,_b as WW}from"../chunk-z8jf7jwg.js";import{dc as OW,ec as HW}from"../chunk-f9t39vwk.js";import"../chunk-7kedxtbp.js";import{$c as d4,Bc as s4,Cc as a4,Cd as c6,Dc as g1,Ec as $6,Ed as E6,Hc as Q6,Ic as K6,Uc as D6,Vc as F6,Wc as O6,Xc as H6,Yc as U6,Zc as S6,_c as f6,ad as R6,bd as k6,cd as _6,dd as C6,ed as v6,id as b6,jd as I6,kd as T6,ld as q6,mc as b0,md as h6,nd as P6,od as w6,pd as A6,qd as y6,rd as V6,sc as e0,tc as W6,uc as Y6,vc as J6,wc as Z6,xc as G6,yd as g6}from"../chunk-d6prwkff.js";import"../chunk-bf1q3m7a.js";import"../chunk-adm5g1v8.js";import{Te as V1,Ue as A1,Ve as Y1,if as g,jf as w,nf as J1,of as L1,pf as X6,qf as z6,rf as B6,sf as x6,uf as M6,wf as D1}from"../chunk-4x41cmg3.js";import"../chunk-9xf2fx98.js";import"../chunk-eqtsfvvd.js";import{Ff as j6,Gf as N6,Hf as L6}from"../chunk-br9p390p.js";import"../chunk-n4807648.js";import"../chunk-ghz3e8b7.js";import"../chunk-7vjbebst.js";import"../chunk-3fr22rtg.js";import{Bg as l6,wg as m6,xg as u6,yg as d6,zg as p6}from"../chunk-77kw61f4.js";import"../chunk-qttatc7h.js";import{Kg as c}from"../chunk-48dek9s7.js";import"../chunk-f6s7ddjz.js";import"../chunk-xmjhensy.js";import"../chunk-n63xjrck.js";import"../chunk-2tm56xq1.js";import{bh as l4}from"../chunk-68zf43ah.js";import{Buffer as p4}from"buffer";class n4 extends J1{client;config;constructor(...W){super();this.config=W}async connect(){let W=await import("../chunk-99wzvsz5.js");return this.client??=new W.S3Client(...this.config),{sdk:W,client:this.client}}async put(W,{signal:Y}={}){Y?.throwIfAborted();let J,Z,G,$=process.env.BUCKET_NAME;if(W instanceof Blob)J=W,G=`${Bun.randomUUIDv7()}.${W.type.split("/")[1].split(";")[0]}`,Z=W.type;else J=W.body,G=W.name,$=W.bucket??$,Z=W.contentType||(J instanceof Blob||J instanceof File?J.type:void 0);Z=Z||void 0;let Q=J instanceof p4?J:J instanceof Blob||J instanceof File?p4.from(await J.arrayBuffer()):"",{sdk:K,client:z}=await this.connect();return Y?.throwIfAborted(),await z.send(new K.PutObjectCommand({Bucket:$,Key:G,Body:Q,ContentType:Z}),{abortSignal:Y}),G}async delete(W){let Y=typeof W==="string"?W:W.name,J=(typeof W==="string"?void 0:W.bucket)??process.env.BUCKET_NAME;if(!Y)throw Error("Object name has to be specified");let{sdk:Z,client:G}=await this.connect();try{await G.send(new Z.DeleteObjectCommand({Bucket:J,Key:Y}))}catch($){if($?.name==="NoSuchKey"||$?.$metadata?.httpStatusCode===404)return;throw $}}async list(W){let{sdk:Y,client:J}=await this.connect();return await J.send(new Y.ListObjectsV2Command({Bucket:process.env.BUCKET_NAME,Prefix:W}))}async fetch(W,{signal:Y}={}){Y?.throwIfAborted();let J=process.env.BUCKET_NAME,Z;if(typeof W==="string")Z=W;else J=W.bucket??J,Z=W.name;if(!Z)throw Error("Object name has to be specified");let{sdk:G,client:$}=await this.connect();Y?.throwIfAborted();let Q=await $.send(new G.GetObjectCommand({Bucket:J,Key:Z}),{abortSignal:Y}),K=L1(Q.Body.transformToWebStream(),Y);return Y?.throwIfAborted(),new Response(K,{headers:{"Content-Type":Q.ContentType,"Content-Length":Q.ContentLength.toString(),"Cache-Control":"private, max-age=12000, must-revalidate","Last-Modified":Q.LastModified?.toUTCString()||"",ETag:Q.ETag||""}})}async read(W){let Y=typeof W==="string"?{name:W}:W,J=Y.bucket??process.env.BUCKET_NAME,{name:Z,range:G=null}=Y;if(!Z)throw Error("Object name has to be specified");let{sdk:$,client:Q}=await this.connect(),K;try{K=await Q.send(new $.GetObjectCommand({Bucket:J,Key:Z,Range:G?A1(G):void 0}))}catch(M){if(M?.name==="InvalidRange"||M?.$metadata?.httpStatusCode===416)throw new g(await this.size({name:Z,bucket:J}));if(M?.name==="NoSuchKey"||M?.$metadata?.httpStatusCode===404)throw new w(Z);throw M}let z=Y1(K.ContentRange),X=Boolean(z)&&K.$metadata?.httpStatusCode===206,x=z?.total??K.ContentLength??0;return{body:K.Body.transformToWebStream(),start:z?.start??0,end:z?.end??x-1,total:x,partial:X,type:K.ContentType??"application/octet-stream",etag:K.ETag||void 0,lastModified:K.LastModified,name:Z}}async size(W){let Y=typeof W==="string"?W:W.name,J=(typeof W==="string"?void 0:W.bucket)??process.env.BUCKET_NAME,{sdk:Z,client:G}=await this.connect();try{return(await G.send(new Z.HeadObjectCommand({Bucket:J,Key:Y}))).ContentLength??0}catch($){if($?.name==="NotFound"||$?.$metadata?.httpStatusCode===404)throw new w(Y);throw $}}}import{Buffer as i4}from"buffer";import{Readable as q0}from"stream";function y1(W){return W?.statusCode===404||W?.details?.errorCode==="BlobNotFound"||W?.code==="BlobNotFound"}function h0(W){return W?.statusCode===416||W?.details?.errorCode==="InvalidRange"||W?.code==="InvalidRange"}class o4 extends J1{config;serviceClientPromise=null;constructor(W={}){super();this.config=W}async serviceClient(){if(this.config.serviceClient)return this.config.serviceClient;return this.serviceClientPromise??=(async()=>{let W;try{W=await import("@azure/storage-blob")}catch{throw Error("AzureBlobDriver requires the '@azure/storage-blob' package. Install it with `bun add @azure/storage-blob`, or pass a pre-built `serviceClient`.")}let Y=this.config.connectionString??process.env.AZURE_STORAGE_CONNECTION_STRING;if(this.config.url)return new W.BlobServiceClient(this.config.url,this.config.credential);if(Y)return W.BlobServiceClient.fromConnectionString(Y);throw Error("AzureBlobDriver needs a connection string (AZURE_STORAGE_CONNECTION_STRING), a `url`, or a `serviceClient`.")})(),this.serviceClientPromise}async blob(W,Y){if(!W)throw Error("Object name has to be specified");let J=Y??this.config.container??process.env.BUCKET_NAME;if(!J)throw Error("AzureBlobDriver needs a container name, from `bucket`, the `container` config, or BUCKET_NAME.");return(await this.serviceClient()).getContainerClient(J).getBlockBlobClient(W)}async put(W,{signal:Y}={}){Y?.throwIfAborted();let J,Z,G,$;if(W instanceof Blob)J=W,G=`${Bun.randomUUIDv7()}.${W.type.split("/")[1].split(";")[0]}`,Z=W.type;else J=W.body,G=W.name,$=W.bucket,Z=W.contentType??(J instanceof Blob||J instanceof File?J.type:void 0);let Q=J instanceof i4?J:i4.from(await J.arrayBuffer()),K=await this.blob(G,$);return Y?.throwIfAborted(),await K.uploadData(Q,{blobHTTPHeaders:Z?{blobContentType:Z}:void 0,abortSignal:Y}),G}async list(W){let Y=this.config.container??process.env.BUCKET_NAME,Z=(await this.serviceClient()).getContainerClient(Y),G=[];for await(let $ of Z.listBlobsFlat({prefix:W}))G.push($.name);return G}async fetch(W,{signal:Y}={}){Y?.throwIfAborted();let J=await this.download(typeof W==="string"?{name:W}:{name:W.name,bucket:W.bucket},Y);return new Response(J.body,{headers:{"Content-Type":J.type,"Content-Length":String(J.total),"Cache-Control":"private, max-age=12000, must-revalidate","Last-Modified":J.lastModified?.toUTCString()??"",ETag:J.etag??""}})}async read(W){return this.download(typeof W==="string"?{name:W}:W)}async download(W,Y){let{name:J,bucket:Z,range:G=null}=W,$=await this.blob(J,Z);Y?.throwIfAborted();let Q,K,z=G?.kind==="suffix"||G?.kind==="offset"&&G.end===null&&G.start===0;if(G&&z){let b=await this.size({name:J,bucket:Z}),W1=V1(G,b);if(!W1)throw new g(b);Q=W1.start,K=W1.length}else if(G?.kind==="offset")Q=G.start,K=G.end===null?void 0:G.end-G.start+1;let X;try{X=await $.download(Q,K,Y?{abortSignal:Y}:void 0)}catch(b){if(h0(b))throw new g(await this.size({name:J,bucket:Z}));if(y1(b))throw new w(J);throw b}let x=Y1(X.contentRange),M=Boolean(x),R=x?.total??X.contentLength??0,v=await P0(X);if(v instanceof ReadableStream)v=L1(v,Y);return Y?.throwIfAborted(),{body:v,start:x?.start??0,end:x?.end??R-1,total:R,partial:M,type:X.contentType??"application/octet-stream",etag:X.etag||void 0,lastModified:X.lastModified,name:J}}async size(W){let Y=typeof W==="string"?W:W.name,J=typeof W==="string"?void 0:W.bucket,Z=await this.blob(Y,J);try{return(await Z.getProperties()).contentLength??0}catch(G){if(y1(G))throw new w(Y);throw G}}async delete(W){let Y=typeof W==="string"?W:W.name,J=typeof W==="string"?void 0:W.bucket,Z=await this.blob(Y,J);try{await Z.delete()}catch(G){if(y1(G))return;throw G}}}async function P0(W){if(W.blobBody)return await W.blobBody;if(W.readableStreamBody)return q0.toWeb(W.readableStreamBody);return null}var w0=`
2
+ import{Ya as dW}from"../chunk-zytmxty5.js";import{Za as i6,_a as DW,ab as FW,bb as UW,cb as SW,db as fW,eb as RW,fb as kW,gb as _W,hb as U,ib as CW,jb as vW,kb as bW,lb as IW,mb as TW,nb as qW,ob as hW,pb as PW,qb as wW,rb as AW,sb as yW,tb as VW,ub as gW,vb as cW,wb as EW,xb as mW,yb as uW}from"../chunk-23mpa8t7.js";import"../chunk-wc46df4w.js";import{Eb as YW,Fb as JW,Gb as ZW,Hb as GW,Ib as $W,Jb as QW,Kb as KW,Lb as XW,Mb as zW,Nb as BW,Ob as xW,Pb as MW,Qb as jW,Rb as NW,Sb as LW}from"../chunk-3tn480wt.js";import{Tb as n6,Ub as o6,Vb as s6,Wb as a6,Xb as t6,Yb as r6,Zb as e6,_b as WW}from"../chunk-z8jf7jwg.js";import{dc as OW,ec as HW}from"../chunk-f9t39vwk.js";import"../chunk-7kedxtbp.js";import{$c as d4,Bc as s4,Cc as a4,Cd as c6,Dc as g1,Ec as $6,Ed as E6,Hc as Q6,Ic as K6,Uc as D6,Vc as F6,Wc as O6,Xc as H6,Yc as U6,Zc as S6,_c as f6,ad as R6,bd as k6,cd as _6,dd as C6,ed as v6,id as b6,jd as I6,kd as T6,ld as q6,mc as b0,md as h6,nd as P6,od as w6,pd as A6,qd as y6,rd as V6,sc as e0,tc as W6,uc as Y6,vc as J6,wc as Z6,xc as G6,yd as g6}from"../chunk-9hs7prvj.js";import"../chunk-bf1q3m7a.js";import"../chunk-adm5g1v8.js";import{Te as V1,Ue as A1,Ve as Y1,if as g,jf as w,nf as J1,of as L1,pf as X6,qf as z6,rf as B6,sf as x6,uf as M6,wf as D1}from"../chunk-4x41cmg3.js";import"../chunk-9xf2fx98.js";import"../chunk-eqtsfvvd.js";import{Ff as j6,Gf as N6,Hf as L6}from"../chunk-br9p390p.js";import"../chunk-n4807648.js";import"../chunk-ghz3e8b7.js";import"../chunk-7vjbebst.js";import"../chunk-3fr22rtg.js";import{Bg as l6,wg as m6,xg as u6,yg as d6,zg as p6}from"../chunk-77kw61f4.js";import"../chunk-qttatc7h.js";import{Kg as c}from"../chunk-48dek9s7.js";import"../chunk-f6s7ddjz.js";import"../chunk-xmjhensy.js";import"../chunk-n63xjrck.js";import"../chunk-2tm56xq1.js";import{bh as l4}from"../chunk-68zf43ah.js";import{Buffer as p4}from"buffer";class n4 extends J1{client;config;constructor(...W){super();this.config=W}async connect(){let W=await import("../chunk-99wzvsz5.js");return this.client??=new W.S3Client(...this.config),{sdk:W,client:this.client}}async put(W,{signal:Y}={}){Y?.throwIfAborted();let J,Z,G,$=process.env.BUCKET_NAME;if(W instanceof Blob)J=W,G=`${Bun.randomUUIDv7()}.${W.type.split("/")[1].split(";")[0]}`,Z=W.type;else J=W.body,G=W.name,$=W.bucket??$,Z=W.contentType||(J instanceof Blob||J instanceof File?J.type:void 0);Z=Z||void 0;let Q=J instanceof p4?J:J instanceof Blob||J instanceof File?p4.from(await J.arrayBuffer()):"",{sdk:K,client:z}=await this.connect();return Y?.throwIfAborted(),await z.send(new K.PutObjectCommand({Bucket:$,Key:G,Body:Q,ContentType:Z}),{abortSignal:Y}),G}async delete(W){let Y=typeof W==="string"?W:W.name,J=(typeof W==="string"?void 0:W.bucket)??process.env.BUCKET_NAME;if(!Y)throw Error("Object name has to be specified");let{sdk:Z,client:G}=await this.connect();try{await G.send(new Z.DeleteObjectCommand({Bucket:J,Key:Y}))}catch($){if($?.name==="NoSuchKey"||$?.$metadata?.httpStatusCode===404)return;throw $}}async list(W){let{sdk:Y,client:J}=await this.connect();return await J.send(new Y.ListObjectsV2Command({Bucket:process.env.BUCKET_NAME,Prefix:W}))}async fetch(W,{signal:Y}={}){Y?.throwIfAborted();let J=process.env.BUCKET_NAME,Z;if(typeof W==="string")Z=W;else J=W.bucket??J,Z=W.name;if(!Z)throw Error("Object name has to be specified");let{sdk:G,client:$}=await this.connect();Y?.throwIfAborted();let Q=await $.send(new G.GetObjectCommand({Bucket:J,Key:Z}),{abortSignal:Y}),K=L1(Q.Body.transformToWebStream(),Y);return Y?.throwIfAborted(),new Response(K,{headers:{"Content-Type":Q.ContentType,"Content-Length":Q.ContentLength.toString(),"Cache-Control":"private, max-age=12000, must-revalidate","Last-Modified":Q.LastModified?.toUTCString()||"",ETag:Q.ETag||""}})}async read(W){let Y=typeof W==="string"?{name:W}:W,J=Y.bucket??process.env.BUCKET_NAME,{name:Z,range:G=null}=Y;if(!Z)throw Error("Object name has to be specified");let{sdk:$,client:Q}=await this.connect(),K;try{K=await Q.send(new $.GetObjectCommand({Bucket:J,Key:Z,Range:G?A1(G):void 0}))}catch(M){if(M?.name==="InvalidRange"||M?.$metadata?.httpStatusCode===416)throw new g(await this.size({name:Z,bucket:J}));if(M?.name==="NoSuchKey"||M?.$metadata?.httpStatusCode===404)throw new w(Z);throw M}let z=Y1(K.ContentRange),X=Boolean(z)&&K.$metadata?.httpStatusCode===206,x=z?.total??K.ContentLength??0;return{body:K.Body.transformToWebStream(),start:z?.start??0,end:z?.end??x-1,total:x,partial:X,type:K.ContentType??"application/octet-stream",etag:K.ETag||void 0,lastModified:K.LastModified,name:Z}}async size(W){let Y=typeof W==="string"?W:W.name,J=(typeof W==="string"?void 0:W.bucket)??process.env.BUCKET_NAME,{sdk:Z,client:G}=await this.connect();try{return(await G.send(new Z.HeadObjectCommand({Bucket:J,Key:Y}))).ContentLength??0}catch($){if($?.name==="NotFound"||$?.$metadata?.httpStatusCode===404)throw new w(Y);throw $}}}import{Buffer as i4}from"buffer";import{Readable as q0}from"stream";function y1(W){return W?.statusCode===404||W?.details?.errorCode==="BlobNotFound"||W?.code==="BlobNotFound"}function h0(W){return W?.statusCode===416||W?.details?.errorCode==="InvalidRange"||W?.code==="InvalidRange"}class o4 extends J1{config;serviceClientPromise=null;constructor(W={}){super();this.config=W}async serviceClient(){if(this.config.serviceClient)return this.config.serviceClient;return this.serviceClientPromise??=(async()=>{let W;try{W=await import("@azure/storage-blob")}catch{throw Error("AzureBlobDriver requires the '@azure/storage-blob' package. Install it with `bun add @azure/storage-blob`, or pass a pre-built `serviceClient`.")}let Y=this.config.connectionString??process.env.AZURE_STORAGE_CONNECTION_STRING;if(this.config.url)return new W.BlobServiceClient(this.config.url,this.config.credential);if(Y)return W.BlobServiceClient.fromConnectionString(Y);throw Error("AzureBlobDriver needs a connection string (AZURE_STORAGE_CONNECTION_STRING), a `url`, or a `serviceClient`.")})(),this.serviceClientPromise}async blob(W,Y){if(!W)throw Error("Object name has to be specified");let J=Y??this.config.container??process.env.BUCKET_NAME;if(!J)throw Error("AzureBlobDriver needs a container name, from `bucket`, the `container` config, or BUCKET_NAME.");return(await this.serviceClient()).getContainerClient(J).getBlockBlobClient(W)}async put(W,{signal:Y}={}){Y?.throwIfAborted();let J,Z,G,$;if(W instanceof Blob)J=W,G=`${Bun.randomUUIDv7()}.${W.type.split("/")[1].split(";")[0]}`,Z=W.type;else J=W.body,G=W.name,$=W.bucket,Z=W.contentType??(J instanceof Blob||J instanceof File?J.type:void 0);let Q=J instanceof i4?J:i4.from(await J.arrayBuffer()),K=await this.blob(G,$);return Y?.throwIfAborted(),await K.uploadData(Q,{blobHTTPHeaders:Z?{blobContentType:Z}:void 0,abortSignal:Y}),G}async list(W){let Y=this.config.container??process.env.BUCKET_NAME,Z=(await this.serviceClient()).getContainerClient(Y),G=[];for await(let $ of Z.listBlobsFlat({prefix:W}))G.push($.name);return G}async fetch(W,{signal:Y}={}){Y?.throwIfAborted();let J=await this.download(typeof W==="string"?{name:W}:{name:W.name,bucket:W.bucket},Y);return new Response(J.body,{headers:{"Content-Type":J.type,"Content-Length":String(J.total),"Cache-Control":"private, max-age=12000, must-revalidate","Last-Modified":J.lastModified?.toUTCString()??"",ETag:J.etag??""}})}async read(W){return this.download(typeof W==="string"?{name:W}:W)}async download(W,Y){let{name:J,bucket:Z,range:G=null}=W,$=await this.blob(J,Z);Y?.throwIfAborted();let Q,K,z=G?.kind==="suffix"||G?.kind==="offset"&&G.end===null&&G.start===0;if(G&&z){let b=await this.size({name:J,bucket:Z}),W1=V1(G,b);if(!W1)throw new g(b);Q=W1.start,K=W1.length}else if(G?.kind==="offset")Q=G.start,K=G.end===null?void 0:G.end-G.start+1;let X;try{X=await $.download(Q,K,Y?{abortSignal:Y}:void 0)}catch(b){if(h0(b))throw new g(await this.size({name:J,bucket:Z}));if(y1(b))throw new w(J);throw b}let x=Y1(X.contentRange),M=Boolean(x),R=x?.total??X.contentLength??0,v=await P0(X);if(v instanceof ReadableStream)v=L1(v,Y);return Y?.throwIfAborted(),{body:v,start:x?.start??0,end:x?.end??R-1,total:R,partial:M,type:X.contentType??"application/octet-stream",etag:X.etag||void 0,lastModified:X.lastModified,name:J}}async size(W){let Y=typeof W==="string"?W:W.name,J=typeof W==="string"?void 0:W.bucket,Z=await this.blob(Y,J);try{return(await Z.getProperties()).contentLength??0}catch(G){if(y1(G))throw new w(Y);throw G}}async delete(W){let Y=typeof W==="string"?W:W.name,J=typeof W==="string"?void 0:W.bucket,Z=await this.blob(Y,J);try{await Z.delete()}catch(G){if(y1(G))return;throw G}}}async function P0(W){if(W.blobBody)return await W.blobBody;if(W.readableStreamBody)return q0.toWeb(W.readableStreamBody);return null}var w0=`
3
3
  local currentKey = KEYS[1]
4
4
  local previousKey = KEYS[2]
5
5
  local limit = tonumber(ARGV[1])