gemi 0.78.0 → 0.80.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 (41) hide show
  1. package/dist/ai/Agent.d.ts.map +1 -1
  2. package/dist/ai/Schema.d.ts.map +1 -1
  3. package/dist/ai/index.js +8 -8
  4. package/dist/ai/index.js.map +3 -3
  5. package/dist/{chunk-sw0kvtpt.js → chunk-0vkd0v3b.js} +1 -1
  6. package/dist/chunk-9hbwvcxn.js.map +2 -2
  7. package/dist/{chunk-e8z3nyd5.js → chunk-azebyh90.js} +4 -4
  8. package/dist/{chunk-e8z3nyd5.js.map → chunk-azebyh90.js.map} +3 -3
  9. package/dist/chunk-cg469vsg.js +5 -0
  10. package/dist/{chunk-9z3y20ms.js.map → chunk-cg469vsg.js.map} +3 -3
  11. package/dist/{chunk-tnx6jt4r.js → chunk-hjbe3jn2.js} +2 -2
  12. package/dist/{chunk-tnx6jt4r.js.map → chunk-hjbe3jn2.js.map} +1 -1
  13. package/dist/{chunk-971a8v3v.js → chunk-jvyj4hxd.js} +1 -1
  14. package/dist/chunk-yedycsnk.js +6 -0
  15. package/dist/chunk-yedycsnk.js.map +10 -0
  16. package/dist/chunk-zbhqa2z7.js.map +2 -2
  17. package/dist/database/DatabaseServiceProvider.d.ts +12 -0
  18. package/dist/database/DatabaseServiceProvider.d.ts.map +1 -1
  19. package/dist/database/index.js +1 -1
  20. package/dist/facades/index.js +1 -1
  21. package/dist/http/index.js +1 -1
  22. package/dist/i18n/index.js +1 -1
  23. package/dist/kernel/index.js +1 -1
  24. package/dist/server/Server.d.ts.map +1 -1
  25. package/dist/server/devReload.d.ts +68 -0
  26. package/dist/server/devReload.d.ts.map +1 -0
  27. package/dist/server/index.js +2 -2
  28. package/dist/server/index.js.map +5 -4
  29. package/dist/services/index.js +1 -1
  30. package/dist/services/redis/RedisManager.d.ts +5 -0
  31. package/dist/services/redis/RedisManager.d.ts.map +1 -1
  32. package/dist/services/redis/RedisServiceProvider.d.ts +6 -0
  33. package/dist/services/redis/RedisServiceProvider.d.ts.map +1 -1
  34. package/dist/support/ServiceProvider.d.ts +6 -0
  35. package/dist/support/ServiceProvider.d.ts.map +1 -1
  36. package/package.json +1 -1
  37. package/dist/chunk-3jyz4378.js +0 -6
  38. package/dist/chunk-3jyz4378.js.map +0 -10
  39. package/dist/chunk-9z3y20ms.js +0 -5
  40. /package/dist/{chunk-sw0kvtpt.js.map → chunk-0vkd0v3b.js.map} +0 -0
  41. /package/dist/{chunk-971a8v3v.js.map → chunk-jvyj4hxd.js.map} +0 -0
@@ -0,0 +1,5 @@
1
+ // @bun
2
+ import{Gb as b}from"./chunk-zbhqa2z7.js";import{Pb as m,Rb as k,Tb as IZ,Ub as GZ,Vb as YZ,Xb as UZ}from"./chunk-1qwkhbc4.js";import{$b as e,_b as a,ac as C,bc as ZZ,cc as $Z,ec as HZ}from"./chunk-b941c34r.js";import{hc as K}from"./chunk-9hbwvcxn.js";import{Cc as s,Cd as x,Dd as v,Ed as w,Ic as y,Jc as D,Mc as E,Oc as t,Xc as KZ,Yc as c,ad as j,id as d,jd as f,od as l,uc as PZ,vd as S}from"./chunk-azebyh90.js";import{Md as zZ,Nd as h}from"./chunk-34s3tfgk.js";import{qf as u}from"./chunk-4h7z32zp.js";import{vf as J}from"./chunk-1712rv0r.js";import{Bf as JZ}from"./chunk-bdfdjnht.js";import{lg as p}from"./chunk-sp4wwg7s.js";import{qg as M}from"./chunk-989rzqd6.js";import{rg as XZ}from"./chunk-0da5t7vs.js";async function EZ(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(()=>EZ(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 TZ}from"worker_threads";var SZ=100,RZ=(Z)=>Math.min(SZ,Math.floor(Z/10));class DZ extends K{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:$}=J(a(),Z);this.app.make(C).useJobs(await GZ($))}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-RZ(H)));if(G.length>0)console.error("[gemi] Queued jobs still running at shutdown: "+G.map((V)=>`${V.name} (${V.id})`).join(", "))}}function _3(Z){if(MZ(Z),Bun.env.NODE_ENV!=="production")return kZ(Z);if(VZ(Z))return;if(!ZZ())return;if(!Z.bound(C))return;Z.make(C).start()}function VZ(Z){let $=Z.config.get("queue",{}).driver??"memory";return $==="memory"||$ instanceof e}function jZ(Z){if(VZ(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 MZ(Z){let $=process.env.GEMI_QUEUE_CLAIM;if($===void 0||HZ())return;if(process.env.ROOT_DIR===void 0||!TZ)return;if($Z()){if(!jZ(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 kZ(Z){let $=globalThis.__gemiDevQueue;if(!$)return;if(globalThis.__gemiDevQueue=void 0,$.stop(),Z.bound(C))Z.make(C).start()}class yZ extends K{register(){this.app.singleton(w,()=>new w(this.app.config.get("auth",{})))}}var fZ=100,bZ=(Z)=>Math.min(fZ,Math.floor(Z/10));class gZ extends K{register(){this.app.singleton(A,()=>new A(J(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}=J(m(),$);Z.useJobs(await YZ(G))}if(process.env.GEMI_NO_SCHEDULE==="1")return;let H=this.app;Z.start((G)=>XZ.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-bZ(H)));if(G.length>0)console.error("[gemi] Cron jobs still running at shutdown: "+G.map((V)=>`${V.name} (started ${V.startedAt.toISOString()})`).join(", "))}}class N extends KZ{modelName;constructor(Z="FeatureFlag"){super();this.modelName=Z}get available(){return zZ(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 k3(Z){return Z}function WZ(){return{features:void 0,enabled:!0,source:new N,model:"FeatureFlag",ttl:30,context:void 0,onEvaluate:void 0,maxClientFlags:200}}class vZ extends K{register(){this.app.singleton(j,()=>{let Z=this.app.config.get("features",{}),$=J(WZ(),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 wZ extends K{register(){this.app.singleton(p,()=>new p(this.app.config.get("mail",{})))}}function mZ(Z){return`listener:${Z}`}function BZ(Z,$){hZ(Z);let{maxAttempts:H,backoff:G,worker:V}=$,X=Z.event.name,Y=class extends IZ{maxAttempts=H;backoff=G;worker=V;async run(...z){let[W,U]=cZ(z),B=M(Q).rehydrate(W,U);await new Z().handle(B)}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:mZ(Z.name),writable:!0}),Y}function hZ(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 cZ(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=J(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?BZ(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 pZ extends K{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}=J(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 uZ extends K{register(){this.app.singleton(u,()=>new u(this.app.config.get("filesystem",{})))}}class dZ extends K{register(){this.app.singleton(d,()=>new d(this.app.config.get("image",{})))}}class lZ extends K{register(){this.app.instance(l,new l)}}function q4(Z){return Z}function CZ(){return{maxFileSize:10485760,onLogFileClosed:()=>{},onLogCreated:()=>{}}}class sZ extends K{register(){this.app.singleton(y,()=>new y(J(CZ(),this.app.config.get("log",{}))))}async boot(){if(!process.env.ROOT_DIR)return;await this.app.make(y).boot()}}class iZ extends K{register(){this.app.singleton(f,()=>new f(J(PZ(),this.app.config.get("middleware",{}))))}boot(){this.app.make(f).assertGlobalMiddleware()}}function j4(Z){return Z}function _Z(){return{channels:{}}}class oZ extends K{register(){this.app.singleton(s,()=>new s(J(_Z(),this.app.config.get("broadcast",{}))))}}class i{}function OZ(Z,$){return Math.floor(Z/$)*$}function nZ(Z,$){if($<=0)return 0;return Math.min(1,Math.max(0,($-Z)/$))}function o(Z,$,H,G){return $*nZ(H,G)+Z}function tZ(Z){let{current:$,previous:H,elapsed:G,window:V,limit:X,cost:Y}=Z,z=X-Y;if(z<0)return V;let W=Math.max(0,V-G);if(H>0){let B=V*(1-(z-$)/H);if(B<=V)return Math.max(0,Math.ceil(B-G))}if($<=z)return W;if($<=0)return W;let U=V*(1-z/$);return W+Math.max(0,Math.ceil(U))}function qZ(Z){let{allowed:$,current:H,previous:G,now:V,elapsed:X,window:Y,limit:z,cost:W}=Z;if($){let B=o(H,G,X,Y);return{allowed:!0,limit:z,remaining:Math.max(0,Math.floor(z-B)),resetAt:V-X+Y,retryAfter:0}}let U=tZ({current:H,previous:G,elapsed:X,window:Y,limit:z,cost:W});return{allowed:!1,limit:z,remaining:0,resetAt:V+U,retryAfter:U}}class n extends i{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=OZ(X,G),z=X-Y,W=this.roll($,G,Y),B=o(W.current,W.previous,z,G)+V<=H;if(B)W.current+=V;if(this.buckets.delete($),this.buckets.set($,W),this.buckets.size>this.maxKeys)this.evict(X);return qZ({allowed:B,current:W.current,previous:W.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 u4(Z){return Z}function LZ(){return{driver:new n,limit:1000,window:60}}class rZ extends K{register(){this.app.singleton(t,()=>new t(J(LZ(),this.app.config.get("ratelimiter",{}))))}}function t4(Z){return Z}function AZ(){return{url:process.env.REDIS_URL,options:void 0}}class aZ extends K{register(){this.app.singleton(E,()=>new E(J(AZ(),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 eZ=/^[A-Za-z0-9_-]{1,64}$/,Z3=/:([A-Za-z_][A-Za-z0-9_]*)([?*+]?)/g,QZ=4000,r=1e5,$3=/^(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 NZ(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){NZ(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,W=await this.fillPath(V,z,Z.req),{path:U}=this.dispatcher.getRouteHandlerAndParams(new Request(`http://gemi.internal/api${W}`));if(U!==X.url)throw new P(`"${$}" has nothing at ${W}.`,404);let B={};for(let L of V.jsonKeys)if(z[L]!==void 0)B[L]=z[L];let _,O="";if(V.fileFields.length>0)_=await this.formData(V,z,B,G);else if(X.method==="GET")O=X3(B);else if(V.jsonKeys.length>0)_=B;let F;try{F=await this.dispatcher.dispatchAs(Z.req,X.method,O?`${W}?${O}`:W,_)}catch(L){throw console.error(`[gemi/mcp] Dispatching "${$}" failed:`,L),new P(`"${$}" failed on the server.`,500)}return await Y3($,F)}plan(Z,$){if(!eZ.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(Z3)].map(([,I,q])=>({name:I,modifier:q})),W=X.params??{};for(let I of z)if(!(I.name in W))throw Error(`${H}: the path param "${I.name}" must be bound or declared "input".`);for(let[I,q]of Object.entries(W)){if(!z.some((R)=>R.name===I))throw Error(`${H}: "${I}" in params is not a param of the url.`);xZ(H,`params.${I}`,q)}let U=[],B;if(X.input){if(B=X.input.toJSONSchema(),B.type!=="object"||!B.properties)throw Error(`${H}: input must be an s.object(...), the fields of the request body.`);U=Object.keys(B.properties)}let _=Object.entries(X.files??{}).map(([I,q])=>({name:I,binder:q}));for(let I of _)xZ(H,`files.${I.name}`,I.binder);if(_.length>0&&G==="GET")throw Error(`${H}: a GET has no body to carry a file.`);let O={},F=new Map;for(let I of z){let q=W[I.name];if(q==="input"){let R=b.string().describe(`The ":${I.name}" segment of the url.`);O[I.name]=I.modifier==="?"||I.modifier==="*"?R.optional():R}else F.set(I.name,q)}for(let I of _)if(I.binder==="input")O[I.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((I)=>I.name)];for(let I of new Set(L))if(U.includes(I))throw Error(`${H}: "${I}" 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:G3(X.input,B,b.object(O)),annotations:H3(G),tags:Object.freeze([...X.tags??[]]),requiresApproval:X.requiresApproval===!0,...Y.source?{source:Y.source}:{}}),params:z,paramBinders:F,fileFields:_,jsonKeys:U}}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,V3(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))FZ(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 NZ(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 xZ(Z,$,H){if(H!=="input"&&typeof H!=="function")throw Error(`${Z}: ${$} must be a function or "input".`)}function H3(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 G3(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=[],W={};if(Z){let B=Z.safeParse(Y);if(B.ok===!1)z.push(...B.errors);else W={...B.value}}let U=H.safeParse(Y);if(U.ok===!1)z.push(...U.errors);else W={...W,...U.value};return z.length>0?{ok:!1,errors:z}:{ok:!0,value:W}};return{toJSONSchema:()=>V,safeParse:X,parse(Y){let z=X(Y);if(z.ok===!1)throw Error(z.errors.join(", "));return z.value}}}function V3(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 FZ(Z,$,H){if(H===void 0||H===null)return;if(Array.isArray(H)){for(let G of H)FZ(Z,$,G);return}Z.append($,typeof H==="object"?JSON.stringify(H):String(H))}function X3(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 Y3(Z,$){if($.status>=200&&$.status<300){let G=$.headers.get("Content-Type");if(G&&!$3.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>r)return`${V.slice(0,r)}\u2026 [cut at ${r} 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>QZ?`${H.slice(0,QZ)}\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 z3 extends K{register(){this.app.singleton(x,()=>new x(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(x),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(x))})}boot(){if(this.app.make(x),this.app.make(S),this.app.make(v),this.app.config.get("route.mcp"))this.app.make(T)}}
3
+ export{A as Za,DZ as _a,_3 as $a,yZ as ab,gZ as bb,N as cb,k3 as db,WZ as eb,vZ as fb,wZ as gb,Q as hb,pZ as ib,uZ as jb,dZ as kb,lZ as lb,q4 as mb,CZ as nb,sZ as ob,iZ as pb,j4 as qb,_Z as rb,oZ as sb,OZ as tb,qZ as ub,i as vb,n as wb,u4 as xb,LZ as yb,rZ as zb,t4 as Ab,AZ as Bb,aZ as Cb,P as Db,T as Eb,z3 as Fb};
4
+
5
+ //# debugId=3B294F0B2F14319864756E2164756E21
@@ -27,11 +27,11 @@
27
27
  "import { InMemoryRateLimiter } from \"./drivers/InMemoryRateLimiterDriver\";\nimport type { RateLimiterDriver } from \"./drivers/RateLimiterDriver\";\n\n// Config key: `ratelimiter`. Derived from `RateLimiterServiceProvider`.\nexport interface RateLimiterConfig {\n /**\n * Where counters live. In-process by default; swap in `RedisRateLimiter` once\n * the app runs on more than one instance.\n */\n driver?: RateLimiterDriver;\n\n /** Requests allowed per window when the `rate-limit` DSL omits a limit. */\n limit?: number;\n\n /** Window length in **seconds** when the `rate-limit` DSL omits one. */\n window?: number;\n}\n\nexport function defineRateLimiterConfig(\n config: RateLimiterConfig,\n): RateLimiterConfig {\n return config;\n}\n\nexport function rateLimiterConfigDefaults(): Required<RateLimiterConfig> {\n return {\n driver: new InMemoryRateLimiter(),\n limit: 1000,\n window: 60,\n };\n}\n",
28
28
  "import { ServiceProvider } from \"../../support/ServiceProvider\";\nimport { withDefaults } from \"../../support/withDefaults\";\nimport { RateLimiter } from \"./RateLimiter\";\nimport { rateLimiterConfigDefaults, type RateLimiterConfig } from \"./config\";\n\nexport class RateLimiterServiceProvider extends ServiceProvider {\n register() {\n this.app.singleton(\n RateLimiter,\n () =>\n new RateLimiter(\n withDefaults(\n rateLimiterConfigDefaults(),\n this.app.config.get<RateLimiterConfig>(\"ratelimiter\", {}),\n ),\n ),\n );\n }\n}\n",
29
29
  "import type { RedisOptions } from \"bun\";\n\n// Config key: `redis`. Derived from `RedisServiceProvider`.\nexport interface RedisConfig {\n // Connection URL for Bun's Redis client. Defaults to the `REDIS_URL`\n // environment variable (Bun itself falls back to `redis://localhost:6379`\n // when unset).\n url?: string;\n\n // Optional Bun Redis client options (TLS, timeouts, auto-reconnect, ...).\n options?: RedisOptions;\n}\n\nexport function defineRedisConfig(config: RedisConfig): RedisConfig {\n return config;\n}\n\nexport function redisConfigDefaults(): RedisConfig {\n return {\n url: process.env.REDIS_URL,\n options: undefined,\n };\n}\n",
30
- "import { ServiceProvider } from \"../../support/ServiceProvider\";\nimport { withDefaults } from \"../../support/withDefaults\";\nimport { redisConfigDefaults, type RedisConfig } from \"./config\";\nimport { RedisManager } from \"./RedisManager\";\n\nexport class RedisServiceProvider extends ServiceProvider {\n register() {\n this.app.singleton(\n RedisManager,\n () =>\n new RedisManager(\n withDefaults(\n redisConfigDefaults(),\n this.app.config.get<RedisConfig>(\"redis\", {}),\n ),\n ),\n );\n }\n}\n",
30
+ "import { ServiceProvider } from \"../../support/ServiceProvider\";\nimport { withDefaults } from \"../../support/withDefaults\";\nimport { redisConfigDefaults, type RedisConfig } from \"./config\";\nimport { RedisManager } from \"./RedisManager\";\n\nexport class RedisServiceProvider extends ServiceProvider {\n register() {\n this.app.singleton(\n RedisManager,\n () =>\n new RedisManager(\n withDefaults(\n redisConfigDefaults(),\n this.app.config.get<RedisConfig>(\"redis\", {}),\n ),\n ),\n );\n }\n\n /**\n * Closes the client, if anything built one. Under `gemi dev` this is what\n * keeps each `bun --hot` reload from leaving a Redis connection behind; see\n * `DatabaseServiceProvider.shutdown`.\n */\n shutdown() {\n if (!this.app.resolved(RedisManager)) return;\n this.app.make(RedisManager).close();\n }\n}\n",
31
31
  "import type { ToolContext } from \"../../ai/Agent\";\nimport { s, type AnySchema, type JSONSchema, type Schema } from \"../../ai/Schema\";\nimport type { RouteSource } from \"../../http/ApiRouter\";\nimport type { HttpRequest } from \"../../http/HttpRequest\";\nimport type {\n McpFileBinder,\n McpMethod,\n McpParamBinder,\n McpRouteDeclaration,\n McpRouter,\n} from \"../../http/McpRouter\";\nimport type { ApiRouteDispatcher } from \"../router/ApiRouteDispatcher\";\n\n/**\n * Who a tool call runs as. Always an argument to the registry, never read from\n * ambient state by it.\n *\n * `local` is an agent running in this server, and `req` is the request that\n * started its run — read by `toAgentTools` at the moment the tool executes,\n * not when the tool was built, which is what lets one set of tools serve every\n * user's run.\n *\n * That producer *does* read ambient state, since a run no longer carries a\n * request (see `AgentContext`), and the boundary is what keeps that from\n * mattering here: the registry is handed a caller and dispatches as that\n * caller, so a second producer — a job, a test, v2's remote client — supplies\n * one however it likes, and a run with no ambient request is refused by\n * `toAgentTools` before the registry is reached rather than dispatching as\n * nobody.\n * The call is dispatched with that request's credentials, so it runs as that\n * user, through that route's middleware.\n *\n * `remote` is v2's MCP client with a bearer token. It is typed so the seam\n * exists and every entry point already takes it; each of them refuses it,\n * because a token resolver is what makes it safe and there is none yet.\n * Reading the caller from `RequestContext` instead would have been shorter,\n * and would have left v2 a registry that only works inside a gemi request.\n */\nexport type McpCaller =\n | { kind: \"local\"; req: HttpRequest<any, any> }\n | { kind: \"remote\"; token: string };\n\n/**\n * MCP's tool annotations, from the verb. They drive confirmation prompts in\n * remote clients, which is why they are set now rather than when v2 lands:\n * every app would otherwise have to revisit its MCP file to get them.\n *\n * Only what the verb says is set. POST and PATCH carry nothing, and MCP's\n * defaults for an unannotated tool — not read-only, possibly destructive — are\n * the honest answer for them.\n */\nexport type McpToolAnnotations = {\n readOnlyHint?: true;\n destructiveHint?: true;\n idempotentHint?: true;\n};\n\n/**\n * One tool, described without committing to who consumes it.\n *\n * The registry's native output. An in-process agent projects it to an\n * `AgentTool` (`toAgentTools`); v2's `tools/list` will project it to JSON.\n * Emitting `AgentTool`s here instead would leave v2 reversing JSON Schema back\n * out of them.\n */\nexport interface McpToolDescriptor {\n /** The `routes` key, verbatim. See `McpRouter`. */\n readonly name: string;\n readonly description: string;\n readonly method: McpMethod;\n /** The route's path as declared, params unfilled. */\n readonly url: string;\n /**\n * What the model fills in: the declared `input`, plus a string for every\n * `\"input\"` path param and every `\"input\"` file field. Bound params and\n * bound files are not in it at all.\n */\n readonly inputSchema: Schema<Record<string, unknown>>;\n readonly annotations: McpToolAnnotations;\n readonly tags: readonly string[];\n readonly requiresApproval: boolean;\n /** The controller method mounted at the route, when there is one (#502). */\n readonly source?: RouteSource;\n}\n\n/**\n * Narrows `list`. Data rather than a predicate, because v2's per-token\n * visibility will come from a token's grants, which are data. Both fields\n * narrow: `names` keeps only those tools, `tags` keeps tools carrying at least\n * one of them.\n */\nexport type McpToolFilter = {\n names?: readonly string[];\n tags?: readonly string[];\n};\n\n/**\n * A failure the model is meant to read: a 4xx from the route, a missing file,\n * a bad argument. v2 turns it into `isError: true` rather than a protocol\n * error. Anything else thrown from `execute` is the caller's mistake or the\n * server's, not the model's.\n */\nexport class McpToolError extends Error {\n constructor(\n message: string,\n readonly status?: number,\n ) {\n super(message);\n this.name = \"McpToolError\";\n }\n}\n\n/** Tool names as OpenAI's function tools and MCP clients both accept them. */\nconst TOOL_NAME = /^[A-Za-z0-9_-]{1,64}$/;\n\n/** `:name`, with URLPattern's modifiers. */\nconst PATH_PARAM = /:([A-Za-z_][A-Za-z0-9_]*)([?*+]?)/g;\n\n/**\n * A 4xx body goes to the model verbatim, so a validation error can be fixed on\n * the next step — but a route that answers a 4xx with a page of HTML should not\n * be able to fill the context window with it.\n */\nconst MAX_ERROR_BODY = 4000;\n\n/**\n * The same limit for a success, set higher: a list route answering every row,\n * or a route serving a large text file, would otherwise land in the context\n * window whole. Past it the model gets the text cut short and told so, rather\n * than an error — the route has already done what it does, and a model told it\n * failed would do it again.\n */\nconst MAX_RESULT_BODY = 100_000;\n\n/** A body a model can read. A missing content-type is read as text. */\nconst READABLE = /^(text\\/|application\\/([\\w.+-]*\\+)?(json|xml))/i;\n\ntype PathParam = { name: string; modifier: string };\n\ntype Plan = {\n descriptor: McpToolDescriptor;\n params: PathParam[];\n paramBinders: Map<string, McpParamBinder>;\n fileFields: { name: string; binder: McpFileBinder | \"input\" }[];\n jsonKeys: string[];\n};\n\n/**\n * The tools an app's `McpRouter` declares, resolved against the api route\n * table, and the one place a call to them is dispatched.\n *\n * Built once, at boot, from the dispatcher's flat route table — so a route\n * that was renamed or unmounted fails the boot here, and at compile time\n * before that, rather than the first model that calls it.\n *\n * THE INVARIANT: a tool call can do nothing its caller could not do with a\n * direct HTTP request. `execute` builds a request and hands it to\n * `ApiRouteDispatcher.dispatchAs`, which runs the route's middleware, auth and\n * policies exactly as for a client. It never reaches for a flat entry's\n * `exec`, which is the handler alone — no auth, no policies, no rate limit —\n * and is the shorter path for exactly that reason.\n */\nexport class McpRegistry {\n static token = \"router.mcp\";\n\n private readonly plans = new Map<string, Plan>();\n\n constructor(\n router: McpRouter<any>,\n private readonly dispatcher: Pick<\n ApiRouteDispatcher,\n \"flatRoutes\" | \"dispatchAs\" | \"getRouteHandlerAndParams\"\n >,\n ) {\n for (const [name, declaration] of Object.entries(router.routes ?? {})) {\n this.plans.set(name, this.plan(name, declaration));\n }\n }\n\n /**\n * The tools `caller` may see. v1 has only local callers, and every declared\n * tool is visible to every one of them; `filter` is taken now so the shape\n * v2's per-token visibility needs is the shape callers already use.\n */\n list(caller: McpCaller, filter?: McpToolFilter): McpToolDescriptor[] {\n assertLocal(caller);\n return this.descriptors(filter);\n }\n\n /**\n * The same listing without a caller, for a projection built once before any\n * caller exists — `toAgentTools`. It is not per-caller visibility, and a v2\n * remote listing must go through `list`.\n */\n descriptors(filter?: McpToolFilter): McpToolDescriptor[] {\n const out: McpToolDescriptor[] = [];\n for (const { descriptor } of this.plans.values()) {\n if (filter?.names && !filter.names.includes(descriptor.name)) continue;\n if (filter?.tags && !descriptor.tags.some((tag) => filter.tags.includes(tag))) continue;\n out.push(descriptor);\n }\n return out;\n }\n\n /**\n * Calls the tool `name` as `caller`, and answers the route's JSON.\n *\n * `ctx` is the tool context of the agent call, and only files need it:\n * `\"input\"` files resolve through `ctx.attachments`, the handle already\n * scoped to the caller, and bound files are chosen by a binder given `ctx`.\n * Nothing here reads an attachment any other way — the store has no\n * unscoped lookup, and this must not become one.\n *\n * A 2xx answers its JSON, or its text, cut at `MAX_RESULT_BODY`; a body\n * that is neither — a file a route serves — is described, not shown.\n * A 4xx throws an `McpToolError` carrying the route's body, so a validation\n * error reaches the model word for word. Anything else, or a route that\n * throws, throws an `McpToolError` that says only that the server failed.\n * The app gets the reason in its log, and a stack trace or a database\n * message is not something to hand a model that may be steered by whoever\n * wrote the document it is reading.\n */\n async execute(\n caller: McpCaller,\n name: string,\n args: unknown,\n ctx?: ToolContext,\n ): Promise<unknown> {\n assertLocal(caller);\n const plan = this.plans.get(name);\n if (!plan) {\n throw new Error(`McpRegistry: there is no tool named \"${name}\".`);\n }\n const { descriptor } = plan;\n\n const parsed = descriptor.inputSchema.safeParse(args);\n if (parsed.ok === false) {\n throw new McpToolError(`Invalid arguments for \"${name}\": ${parsed.errors.join(\", \")}`);\n }\n const input = parsed.value;\n\n const path = await this.fillPath(plan, input, caller.req);\n\n // The dispatcher routes `path` afresh and takes the first route that\n // matches it, so a model's \"archive-all\" for `/products/:id` would reach a\n // `/products/archive-all` declared above it — a route the app never\n // exposed, behind none of this tool's approval or annotations.\n const { path: matched } = this.dispatcher.getRouteHandlerAndParams(\n new Request(`http://gemi.internal/api${path}`),\n );\n if (matched !== descriptor.url) {\n throw new McpToolError(`\"${name}\" has nothing at ${path}.`, 404);\n }\n\n const json: Record<string, unknown> = {};\n for (const key of plan.jsonKeys) {\n if (input[key] !== undefined) json[key] = input[key];\n }\n\n let body: FormData | Record<string, unknown> | undefined;\n let query = \"\";\n if (plan.fileFields.length > 0) {\n body = await this.formData(plan, input, json, ctx);\n } else if (descriptor.method === \"GET\") {\n query = toQuery(json);\n } else if (plan.jsonKeys.length > 0) {\n body = json;\n }\n\n let response: Response;\n try {\n response = await this.dispatcher.dispatchAs(\n caller.req,\n descriptor.method,\n query ? `${path}?${query}` : path,\n body,\n );\n } catch (error) {\n // What a client would get as a 500. A handler's throw is logged by the\n // dispatcher too, but dispatchAs's own refusal of the path is not.\n console.error(`[gemi/mcp] Dispatching \"${name}\" failed:`, error);\n throw new McpToolError(`\"${name}\" failed on the server.`, 500);\n }\n return await readResponse(name, response);\n }\n\n // --- building ------------------------------------------------------------\n\n private plan(name: string, declaration: McpRouteDeclaration): Plan {\n if (!TOOL_NAME.test(name)) {\n throw new Error(\n `McpRouter: \"${name}\" 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 — letters, digits, \"_\" and \"-\", at most 64.`,\n );\n }\n const where = `McpRouter: \"${name}\" (${declaration?.method} ${declaration?.url})`;\n if (!(declaration instanceof Object) || declaration.__internal_brand !== \"McpRoute\") {\n throw new Error(\n `McpRouter: \"${name}\" is not a route. Declare it with this.fromApiRoute(...).`,\n );\n }\n const { method, url, meta } = declaration;\n if (url.startsWith(\"/__gemi__\")) {\n throw new Error(`${where} is a framework route, not an app route.`);\n }\n\n const entry = this.dispatcher.flatRoutes[url]?.[method];\n if (!entry) {\n throw new Error(\n `${where} names no route of this app. Expose a route by the path and verb it is mounted at.`,\n );\n }\n\n // Mirrors the compile-time check, for a router written in JavaScript or\n // behind a cast: a param left undeclared would otherwise be the model's.\n const params: PathParam[] = [...url.matchAll(PATH_PARAM)].map(([, param, modifier]) => ({\n name: param,\n modifier,\n }));\n const declared = meta.params ?? {};\n for (const param of params) {\n if (!(param.name in declared)) {\n throw new Error(\n `${where}: the path param \"${param.name}\" must be bound or declared \"input\".`,\n );\n }\n }\n for (const [key, binder] of Object.entries(declared)) {\n if (!params.some((param) => param.name === key)) {\n throw new Error(`${where}: \"${key}\" in params is not a param of the url.`);\n }\n assertBinder(where, `params.${key}`, binder);\n }\n\n let jsonKeys: string[] = [];\n let base: JSONSchema | undefined;\n if (meta.input) {\n base = meta.input.toJSONSchema();\n if (base.type !== \"object\" || !base.properties) {\n throw new Error(\n `${where}: input must be an s.object(...), the fields of the request body.`,\n );\n }\n jsonKeys = Object.keys(base.properties);\n }\n\n const fileFields = Object.entries(meta.files ?? {}).map(([field, binder]) => ({\n name: field,\n binder,\n }));\n for (const file of fileFields) {\n assertBinder(where, `files.${file.name}`, file.binder);\n }\n if (fileFields.length > 0 && method === \"GET\") {\n throw new Error(`${where}: a GET has no body to carry a file.`);\n }\n\n const extras: Record<string, AnySchema> = {};\n const paramBinders = new Map<string, McpParamBinder>();\n for (const param of params) {\n const binder = declared[param.name];\n if (binder === \"input\") {\n const field = s.string().describe(`The \":${param.name}\" segment of the url.`);\n extras[param.name] =\n param.modifier === \"?\" || param.modifier === \"*\" ? field.optional() : field;\n } else {\n paramBinders.set(param.name, binder);\n }\n }\n for (const file of fileFields) {\n if (file.binder === \"input\") {\n extras[file.name] = s\n .string()\n .describe(\n \"The id of an attachment the user uploaded or a tool produced (gemi_att_…), whose file is sent as this field.\",\n );\n }\n }\n // A bound file is not the model's, but it shares the form with the input,\n // so it collides all the same.\n const bodyKeys = [...Object.keys(extras), ...fileFields.map((file) => file.name)];\n for (const key of new Set(bodyKeys)) {\n if (jsonKeys.includes(key)) {\n throw new Error(\n `${where}: \"${key}\" is both an input field and a param or file, and the model can only send one.`,\n );\n }\n }\n\n return {\n descriptor: Object.freeze({\n name,\n description: meta.description,\n method,\n url,\n inputSchema: combineSchemas(meta.input, base, s.object(extras)),\n annotations: annotationsFor(method),\n tags: Object.freeze([...(meta.tags ?? [])]),\n requiresApproval: meta.requiresApproval === true,\n ...(entry.source ? { source: entry.source } : {}),\n }),\n params,\n paramBinders,\n fileFields,\n jsonKeys,\n };\n }\n\n // --- calling -------------------------------------------------------------\n\n private async fillPath(\n plan: Plan,\n input: Record<string, unknown>,\n req: HttpRequest<any, any>,\n ): Promise<string> {\n let path = plan.descriptor.url;\n for (const param of plan.params) {\n const binder = plan.paramBinders.get(param.name);\n let value: unknown;\n if (binder) {\n value = await this.bind(plan, `the param \"${param.name}\"`, () => binder(req));\n if (value === undefined || value === null || value === \"\") {\n console.error(\n `[gemi/mcp] The binder for \"${param.name}\" of \"${plan.descriptor.name}\" returned ${JSON.stringify(value)}.`,\n );\n throw new McpToolError(`\"${plan.descriptor.name}\" failed on the server.`, 500);\n }\n } else {\n value = input[param.name];\n }\n\n const token = `:${param.name}${param.modifier}`;\n if (value === undefined || value === null || value === \"\") {\n if (param.modifier !== \"?\" && param.modifier !== \"*\") {\n throw new McpToolError(`\"${param.name}\" of \"${plan.descriptor.name}\" must not be empty.`);\n }\n path = path.replace(`/${token}`, \"\");\n continue;\n }\n path = path.replace(token, encodeSegment(plan.descriptor.name, param, String(value)));\n }\n return path;\n }\n\n private async formData(\n plan: Plan,\n input: Record<string, unknown>,\n json: Record<string, unknown>,\n ctx: ToolContext | undefined,\n ): Promise<FormData> {\n const name = plan.descriptor.name;\n if (!ctx) {\n throw new Error(\n `McpRegistry: \"${name}\" sends a file, which is resolved through the tool context's attachments, and none was passed to execute().`,\n );\n }\n const form = new FormData();\n for (const [key, value] of Object.entries(json)) {\n appendField(form, key, value);\n }\n for (const field of plan.fileFields) {\n const id =\n field.binder === \"input\"\n ? (input[field.name] as string)\n : await this.bind(plan, `the file \"${field.name}\"`, () =>\n (field.binder as McpFileBinder)(ctx),\n );\n if (typeof id !== \"string\" || id === \"\") {\n throw new McpToolError(\n `\"${name}\" needs a file for \"${field.name}\", and this turn has none. Ask the user to attach one.`,\n );\n }\n // Scoped to the caller: someone else's id is a not-found, worded like an\n // invented one, and that error is what the model reads.\n form.append(field.name, await ctx.attachments.file(id));\n }\n return form;\n }\n\n /**\n * Runs an app's binder. Its failure is the server's, not the model's, so the\n * model is told only that; the app gets the error in its log.\n */\n private async bind<T>(plan: Plan, what: string, fn: () => T | Promise<T>): Promise<T> {\n try {\n return await fn();\n } catch (error) {\n console.error(`[gemi/mcp] Binding ${what} of \"${plan.descriptor.name}\" failed:`, error);\n throw new McpToolError(`\"${plan.descriptor.name}\" failed on the server.`, 500);\n }\n }\n}\n\nfunction assertLocal(caller: McpCaller): asserts caller is Extract<McpCaller, { kind: \"local\" }> {\n if (caller?.kind !== \"local\") {\n throw new Error(\n \"McpRegistry: only local callers are implemented. A remote caller needs a bearer-token resolver, which v1 does not have — and until it does there is no remote surface to call from.\",\n );\n }\n}\n\n/** A binder is a function or `\"input\"`; anything else would leave the value to nobody. */\nfunction assertBinder(where: string, at: string, binder: unknown) {\n if (binder !== \"input\" && typeof binder !== \"function\") {\n throw new Error(`${where}: ${at} must be a function or \"input\".`);\n }\n}\n\nfunction annotationsFor(method: McpMethod): McpToolAnnotations {\n switch (method) {\n case \"GET\":\n return Object.freeze({ readOnlyHint: true as const });\n case \"DELETE\":\n return Object.freeze({ destructiveHint: true as const });\n case \"PUT\":\n return Object.freeze({ idempotentHint: true as const });\n default:\n return Object.freeze({});\n }\n}\n\n/**\n * One schema out of two: the app's `input`, and the strings for `\"input\"`\n * params and files.\n *\n * Built by hand, like `questionSchema` in `ai/Agent.ts`, rather than by\n * widening `s` with a merge: `Schema.ts` is deliberately the strict\n * structured-output subset and owns no operation on a finished schema. Both\n * halves are real `s` schemas, each parses the whole value and drops the keys\n * that are not its own — which is also where a bound param the model sent\n * anyway disappears, since neither half declares it.\n */\nfunction combineSchemas(\n input: AnySchema | undefined,\n base: JSONSchema | undefined,\n extras: AnySchema,\n): Schema<Record<string, unknown>> {\n const extra = extras.toJSONSchema();\n const json: JSONSchema = {\n ...(base ?? {}),\n type: \"object\",\n properties: { ...(base?.properties ?? {}), ...extra.properties },\n required: [...(base?.required ?? []), ...(extra.required ?? [])],\n additionalProperties: false,\n };\n\n const safeParse = (value: unknown) => {\n if (typeof value !== \"object\" || value === null || Array.isArray(value)) {\n return { ok: false as const, errors: [\"expected an object\"] };\n }\n const errors: string[] = [];\n let out: Record<string, unknown> = {};\n if (input) {\n const own = input.safeParse(value);\n if (own.ok === false) errors.push(...own.errors);\n else out = { ...own.value };\n }\n const more = extras.safeParse(value);\n if (more.ok === false) errors.push(...more.errors);\n else out = { ...out, ...more.value };\n return errors.length > 0 ? { ok: false as const, errors } : { ok: true as const, value: out };\n };\n\n return {\n toJSONSchema: () => json,\n safeParse,\n parse(value: unknown) {\n const result = safeParse(value);\n if (result.ok === false) throw new Error(result.errors.join(\", \"));\n return result.value;\n },\n } as unknown as Schema<Record<string, unknown>>;\n}\n\n/**\n * A model-supplied param, as one encoded path segment. `.` and `..` are\n * refused rather than encoded: they encode to themselves, and URL parsing\n * would walk them out of the route.\n */\nfunction encodeSegment(tool: string, param: PathParam, value: string): string {\n const parts = param.modifier === \"*\" || param.modifier === \"+\" ? value.split(\"/\") : [value];\n if (parts.some((part) => part === \".\" || part === \"..\")) {\n throw new McpToolError(`\"${value}\" is not a valid value for \"${param.name}\" of \"${tool}\".`);\n }\n return parts.map(encodeURIComponent).join(\"/\");\n}\n\n/**\n * A JSON field as a multipart form field. A form has only strings, so the\n * route reads `\"12\"` where a JSON body would have carried `12` — what a\n * browser form sends the same route. An array becomes the key repeated, which\n * `HttpRequest` reads back as an array.\n */\nfunction appendField(form: FormData, key: string, value: unknown) {\n if (value === undefined || value === null) return;\n if (Array.isArray(value)) {\n for (const item of value) appendField(form, key, item);\n return;\n }\n form.append(key, typeof value === \"object\" ? JSON.stringify(value) : String(value));\n}\n\n/** A GET's input, as the query string `HttpRequest.search` reads. */\nfunction toQuery(json: Record<string, unknown>): string {\n const search = new URLSearchParams();\n const add = (key: string, value: unknown) => {\n if (value === undefined || value === null) return;\n if (Array.isArray(value)) {\n for (const item of value) add(key, item);\n return;\n }\n search.append(key, typeof value === \"object\" ? JSON.stringify(value) : String(value));\n };\n for (const [key, value] of Object.entries(json)) add(key, value);\n return search.toString();\n}\n\nasync function readResponse(name: string, response: Response): Promise<unknown> {\n if (response.status >= 200 && response.status < 300) {\n const type = response.headers.get(\"Content-Type\");\n if (type && !READABLE.test(type)) {\n const size = (await response.arrayBuffer()).byteLength;\n return `\"${name}\" answered with ${size} bytes of ${type}, which is not shown.`;\n }\n const text = await response.text();\n if (text === \"\") return null;\n if (text.length > MAX_RESULT_BODY) {\n return `${text.slice(0, MAX_RESULT_BODY)}… [cut at ${MAX_RESULT_BODY} of ${text.length} characters]`;\n }\n try {\n return JSON.parse(text);\n } catch {\n return text;\n }\n }\n const text = await response.text();\n if (response.status >= 400 && response.status < 500) {\n const shown = text.length > MAX_ERROR_BODY ? `${text.slice(0, MAX_ERROR_BODY)}…` : text;\n throw new McpToolError(\n `\"${name}\" was refused with ${response.status}${shown ? `: ${shown}` : \".\"}`,\n response.status,\n );\n }\n if (response.status < 500) {\n // A redirect, or a 1xx: nothing the model can follow, and nothing the\n // dispatcher logged.\n console.error(\n `[gemi/mcp] \"${name}\" answered ${response.status}${response.headers.get(\"Location\") ? ` to ${response.headers.get(\"Location\")}` : \"\"}, which a tool call cannot follow.`,\n );\n }\n throw new McpToolError(`\"${name}\" failed on the server.`, response.status);\n}\n",
32
32
  "import { ServiceProvider } from \"../../support/ServiceProvider\";\nimport { McpRegistry } from \"../mcp/McpRegistry\";\nimport { ApiRouteDispatcher } from \"./ApiRouteDispatcher\";\nimport { DomainRouter } from \"./DomainRouter\";\nimport { ViewRouteDispatcher } from \"./ViewRouteDispatcher\";\nimport type { ApiRouteConfig, DomainsConfig, McpRouteConfig, ViewRouteConfig } from \"./config\";\nimport type { Repository } from \"../../support/Repository\";\n\nfunction readConfig<T>(config: Repository, key: string): T {\n const slice = config.get<T>(key);\n if (!slice) {\n throw new Error(\n `Missing \"${key}\" configuration. Route dispatching needs a root router — declare it in \"app/config/route.ts\".`,\n );\n }\n return slice;\n}\n\n/**\n * Owns both route dispatchers. Laravel ships a single RouteServiceProvider for\n * every route file it loads; the api/view split is a config slice, not a\n * separate provider.\n */\nexport class RouteServiceProvider extends ServiceProvider {\n register() {\n this.app.singleton(\n ApiRouteDispatcher,\n () =>\n new ApiRouteDispatcher(\n readConfig<ApiRouteConfig>(this.app.config, \"route.api\"),\n ),\n );\n\n this.app.singleton(\n ViewRouteDispatcher,\n () =>\n new ViewRouteDispatcher(\n readConfig<ViewRouteConfig>(this.app.config, \"route.view\"),\n ),\n );\n\n // The root pair above is the root group's; the other `route.domains`\n // groups get their own only when they bring their own routers.\n this.app.singleton(\n DomainRouter,\n () =>\n new DomainRouter(\n { api: this.app.make(ApiRouteDispatcher), view: this.app.make(ViewRouteDispatcher) },\n {\n api: readConfig<ApiRouteConfig>(this.app.config, \"route.api\"),\n view: readConfig<ViewRouteConfig>(this.app.config, \"route.view\"),\n domains: this.app.config.get<DomainsConfig | undefined>(\"route.domains\"),\n },\n ),\n );\n\n // Bound whether or not the app declares one, so asking for it without\n // `route.mcp` fails with a sentence rather than an unbound token.\n this.app.singleton(McpRegistry, () => {\n const config = this.app.config.get<McpRouteConfig | undefined>(\"route.mcp\");\n if (!config?.router) {\n throw new Error(\n 'No MCP router is configured. Declare one as `mcp: { router }` in \"app/config/route.ts\".',\n );\n }\n return new McpRegistry(new config.router(), this.app.make(ApiRouteDispatcher));\n });\n }\n\n /**\n * The dispatchers of every host group, and the MCP registry when an app declares one, must\n * not be built lazily: constructing the dispatchers flattens the route\n * tables and runs `assertNoReservedRoutePaths`, and constructing the registry\n * resolves every tool against those tables. A missing `route` config, a\n * route under a reserved prefix or a tool naming a route that is gone has to\n * fail the boot rather than the first request, or the first tool call, that\n * happens to hit it.\n */\n boot() {\n this.app.make(ApiRouteDispatcher);\n this.app.make(ViewRouteDispatcher);\n // Builds every host group's dispatchers and validates `route.domains`.\n this.app.make(DomainRouter);\n if (this.app.config.get(\"route.mcp\")) {\n this.app.make(McpRegistry);\n }\n }\n}\n"
33
33
  ],
34
- "mappings": ";0wBAmCA,SAAsB,JAAO,LAAC,JAA6B,LACzD,HAAI,LAQF,HAAI,LAAE,AAAM,JAAI,UAAU,KAAK,CAAG,EAChC,OAEF,MAAO,EAAO,CAMd,QAAQ,MACN,2CAA2C,EAAI,QAC/C,CACF,EACA,OAGF,GAAI,CACF,MAAM,EAAI,OAAO,KAAK,CAAG,EACzB,MAAO,EAAO,CACd,QAAQ,MAAM,4BAA4B,EAAI,QAAS,CAAK,EAE9D,GAAI,CACF,MAAM,EAAI,SAAS,KAAK,CAAG,EAC3B,MAAO,EAAO,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EAQF,MAAM,WAA6B,CAAgB,CACxD,QAAQ,EAAG,CACT,KAAK,IAAI,UACP,EACA,IACE,IAAI,EACF,EAA2B,KAAK,IAAI,OAAQ,WAAW,CACzD,CACJ,EAEA,KAAK,IAAI,UACP,EACA,IACE,IAAI,EACF,EAA4B,KAAK,IAAI,OAAQ,YAAY,CAC3D,CACJ,EAIA,KAAK,IAAI,UACP,EACA,IACE,IAAI,EACF,CAAE,IAAK,KAAK,IAAI,KAAK,CAAkB,EAAG,KAAM,KAAK,IAAI,KAAK,CAAmB,CAAE,EACnF,CACE,IAAK,EAA2B,KAAK,IAAI,OAAQ,WAAW,EAC5D,KAAM,EAA4B,KAAK,IAAI,OAAQ,YAAY,EAC/D,QAAS,KAAK,IAAI,OAAO,IAA+B,eAAe,CACzE,CACF,CACJ,EAIA,KAAK,IAAI,UAAU,EAAa,IAAM,CACpC,IAAM,EAAS,KAAK,IAAI,OAAO,IAAgC,WAAW,EAC1E,GAAI,CAAC,GAAQ,OACX,MAAU,MACR,yFACF,EAEF,OAAO,IAAI,EAAY,IAAI,EAAO,OAAU,KAAK,IAAI,KAAK,CAAkB,CAAC,EAC9E,EAYH,IAAI,EAAG,CAKL,GAJA,KAAK,IAAI,KAAK,CAAkB,EAChC,KAAK,IAAI,KAAK,CAAmB,EAEjC,KAAK,IAAI,KAAK,CAAY,EACtB,KAAK,IAAI,OAAO,IAAI,WAAW,EACjC,KAAK,IAAI,KAAK,CAAW,EAG/B",
35
+ "debugId": "3B294F0B2F14319864756E2164756E21",
36
36
  "names": []
37
37
  }
@@ -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 l of e)u.add(l)}let r=[],p=[],g={};for(let t of u)if(t)for(let e of t.importedModules){if(e.file.includes("module.css"))g[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"),l=t.includes("module.css"),o="";if(l)o=h(g[t],e.default);r.push({isDev:!0,id:t,content:l?o: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.78.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","./broadcasting":"./broadcasting/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),a=(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}`,g=["",...q.map((t)=>T(t)),"",` ${d("gemi")} ${a(`v${R()}`)}`,"",p("Local:",a(b)),p("Network:",u?a(u):d("unavailable")),p("Env:",r.length?r.join(", "):d("none")),""];console.log(g.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 l of e)u.add(l)}let r=[],p=[],g={};for(let t of u)if(t)for(let e of t.importedModules){if(e.file.includes("module.css"))g[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"),l=t.includes("module.css"),o="";if(l)o=h(g[t],e.default);r.push({isDev:!0,id:t,content:l?o: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.80.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","./broadcasting":"./broadcasting/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),a=(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}`,g=["",...q.map((t)=>T(t)),"",` ${d("gemi")} ${a(`v${R()}`)}`,"",p("Local:",a(b)),p("Network:",u?a(u):d("unavailable")),p("Env:",r.length?r.join(", "):d("none")),""];console.log(g.join(`
3
3
  `))}
4
4
  export{J as h,L as i,A as j};
5
5
 
6
- //# debugId=3985C2F7C5D22EC764756E2164756E21
6
+ //# debugId=0B2972456B7CB77764756E2164756E21
@@ -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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I,CAAC,EAG1B,SAAS,CAAkB,CAAC,EAGhC,CACD,IAAQ,OAAM,WAAY,EACpB,EAAQ,oBAAoB,IAC5B,EAAU,EAAW,CAAI,EACzB,EAAM,EAAe,CAAO,EAE5B,EAAM,CAAC,EAAe,IAC1B,KAAK,EAAM,QAAE,MAAM,EAAK,EAAM,OAAO,CAAC,CAAC,IAAI,IAEvC,EAAM,CACV,GACA,GAAG,EAAI,IAAI,CAAC,IAAS,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": "3985C2F7C5D22EC764756E2164756E21",
9
+ "debugId": "0B2972456B7CB77764756E2164756E21",
10
10
  "names": []
11
11
  }
@@ -1,5 +1,5 @@
1
1
  // @bun
2
- import{h as b,j as T}from"./chunk-tnx6jt4r.js";import{ia as M,ja as N}from"./chunk-0e5z1x9w.js";import"./chunk-zq5m4scz.js";import"./chunk-9a8qz3s7.js";import"./chunk-gvkydx8r.js";import"./chunk-8z37k28d.js";import"./chunk-rv9k5bqn.js";import{Eg as S}from"./chunk-7yhsy039.js";import"./chunk-xzp2ptj5.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,`
2
+ import{h as b,j as T}from"./chunk-hjbe3jn2.js";import{ia as M,ja as N}from"./chunk-0e5z1x9w.js";import"./chunk-zq5m4scz.js";import"./chunk-9a8qz3s7.js";import"./chunk-gvkydx8r.js";import"./chunk-8z37k28d.js";import"./chunk-rv9k5bqn.js";import{Eg as S}from"./chunk-7yhsy039.js";import"./chunk-xzp2ptj5.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
3
  `).split(`
4
4
  `).map((K)=>K.trim()).filter((K)=>K.length>0).join(`
5
5
  `).trim()}function D(J){return`
@@ -0,0 +1,6 @@
1
+ // @bun
2
+ import{hc as G}from"./chunk-9hbwvcxn.js";import{Je as F}from"./chunk-q0nqypca.js";import{vf as E}from"./chunk-1712rv0r.js";import{Lf as B,Yf as x}from"./chunk-jcq0tbdv.js";class J extends G{register(){this.app.singleton(x,()=>{let j=new x(E(B(),this.app.config.get("database",{})));return K(j),j})}async shutdown(){if(!this.app.resolved(x))return;await this.app.make(x).close()}}function K(j){if(Bun.env.NODE_ENV!=="development")return;for(let z of j.connectionNames){let A=j.connection(z);if(F(A.dialect))continue;let H=z===j.name?"DATABASE_URL":`The "${z}" database connection`;console.warn(`[gemi] ${H} points at ${A.dialect}, which the gemi ORM `+"does not implement \u2014 only sqlite and postgres are. The connection "+`works, so raw SQL through DB.query / DB.sql and transactions are fine, but every model operation will raise UnsupportedDialectError.
3
+ (development only)`)}}
4
+ export{J as ya};
5
+
6
+ //# debugId=ACDAB57675BACE2F64756E2164756E21
@@ -0,0 +1,10 @@
1
+ {
2
+ "version": 3,
3
+ "sources": ["../database/DatabaseServiceProvider.ts"],
4
+ "sourcesContent": [
5
+ "import { ormSupports } from \"../orm/dialect\";\nimport { ServiceProvider } from \"../support/ServiceProvider\";\nimport { withDefaults } from \"../support/withDefaults\";\nimport { databaseConfigDefaults, type DatabaseConfig } from \"./config\";\nimport { DatabaseManager } from \"./DatabaseManager\";\n\nexport class DatabaseServiceProvider extends ServiceProvider {\n register() {\n this.app.singleton(\n DatabaseManager,\n () => {\n const database = new DatabaseManager(\n withDefaults(\n databaseConfigDefaults(),\n this.app.config.get<DatabaseConfig>(\"database\", {}),\n ),\n );\n\n warnIfOrmUnavailable(database);\n return database;\n },\n );\n }\n\n /**\n * Closes every connection's pool. Registered early, so it runs late: after\n * the queue and the scheduler have waited for their jobs, which still need\n * it. Bun's `close()` lets a query already sent finish.\n *\n * On the way out of a production server this only tidies up before the\n * exit. Under `gemi dev` it is the whole point: a `bun --hot` reload boots\n * a new application with a new pool, and the replaced one's is closed here\n * rather than left holding its connections for the life of the process\n * (#652).\n */\n async shutdown() {\n // Resolving the manager now would open a pool only to close it.\n if (!this.app.resolved(DatabaseManager)) return;\n await this.app.make(DatabaseManager).close();\n }\n}\n\n/**\n * Say it at boot, not on the first model query.\n *\n * `DatabaseManager` connects to MySQL and MariaDB without complaint — Bun's\n * client speaks them — and the ORM's compiler has no dialect for either. So a\n * deploy pointed at one starts, passes a health check, serves whatever does not\n * touch a model, and raises `UnsupportedDialectError` on the first `findMany`.\n * That is the latest and most expensive moment to learn it.\n *\n * A **warning rather than a throw**, deliberately: raw SQL through `DB.query`\n * and `DB.sql` genuinely works on those dialects, and so do transactions.\n * Refusing to construct the manager would break code that is correct today to\n * pre-empt an error the ORM already raises clearly. The supported set is a\n * property of the query compiler, not of the connection.\n *\n * Development only, for the same reason the slow-transaction warning is: it is\n * a diagnostic aimed at whoever is choosing the database, and it should not\n * add noise to a production log every time the container starts.\n */\nfunction warnIfOrmUnavailable(database: DatabaseManager): void {\n if (process.env.NODE_ENV !== \"development\") return;\n\n // Every connection, not only the default one. A named connection is a whole\n // pool an application will run model queries on — `Model.on(\"analytics\")` —\n // so it can be pointed at MySQL exactly as the default can, and warning about\n // only one of them would make the check pass while the query that raises is\n // on the other.\n for (const name of database.connectionNames) {\n const connection = database.connection(name);\n if (ormSupports(connection.dialect)) continue;\n\n const source =\n name === database.name\n ? \"DATABASE_URL\"\n : `The \"${name}\" database connection`;\n\n console.warn(\n `[gemi] ${source} points at ${connection.dialect}, which the gemi ORM ` +\n `does not implement — only sqlite and postgres are. The connection ` +\n `works, so raw SQL through DB.query / DB.sql and transactions are ` +\n `fine, but every model operation will raise ` +\n `UnsupportedDialectError.\\n(development only)`,\n );\n }\n}\n"
6
+ ],
7
+ "mappings": ";8LAMO,AAAM,IAAgC,LAAgB,CAC3D,QAAQ,EAAG,CACT,KAAK,IAAI,UACP,EACA,IAAM,CACJ,IAAM,EAAW,IAAI,EACnB,EACE,EAAuB,EACvB,KAAK,IAAI,OAAO,IAAoB,WAAY,CAAC,CAAC,CACpD,CACF,EAGA,OADA,EAAqB,CAAQ,EACtB,EAEX,OAcI,SAAQ,EAAG,CAEf,GAAI,CAAC,KAAK,IAAI,SAAS,CAAe,EAAG,OACzC,MAAM,KAAK,IAAI,KAAK,CAAe,EAAE,MAAM,EAE/C,CAqBA,SAAS,CAAoB,CAAC,EAAiC,CAC7D,GAAI,mBAAyB,cAAe,OAO5C,QAAW,KAAQ,EAAS,gBAAiB,CAC3C,IAAM,EAAa,EAAS,WAAW,CAAI,EAC3C,GAAI,EAAY,EAAW,OAAO,EAAG,SAErC,IAAM,EACJ,IAAS,EAAS,KACd,eACA,QAAQ,yBAEd,QAAQ,KACN,UAAU,eAAoB,EAAW,+BACvC,0EACA;AAAA,mBAGJ",
8
+ "debugId": "ACDAB57675BACE2F64756E2164756E21",
9
+ "names": []
10
+ }
@@ -2,9 +2,9 @@
2
2
  "version": 3,
3
3
  "sources": ["../ai/Schema.ts"],
4
4
  "sourcesContent": [
5
- "/**\n * The schema layer for tool inputs, tool outputs and structured final answers.\n *\n * Two things have to come out of one declaration: a TypeScript type, so\n * `execute(input)` is typed at the call site and the result is typed in the\n * browser, and a JSON Schema, because that is what the model is actually shown.\n * A phantom `Schema<T>` gives the first and nothing of the second, and a\n * hand-written JSON Schema next to a hand-written type gives both and lets them\n * drift. So the builder below is the single source, and `Infer` reads the type\n * back off it.\n *\n * Everything here is deliberately narrower than JSON Schema. OpenAI's strict\n * structured output only accepts a subset — every property listed in\n * `required`, `additionalProperties: false` on every object, no patterns, no\n * `oneOf` at the root — and a builder that cannot express the rejected parts is\n * better than one that lets you write a schema the API refuses at runtime.\n *\n * `json()` is the one deliberate hole in that, for the formats strict mode\n * cannot describe at all: a record with arbitrary keys, a mixed-type tuple, a\n * recursive document. It does not widen the subset — it turns strict mode off\n * for the schema containing it, which `supportsStrict` reads back off the tree\n * so that no caller has to remember to.\n */\n\nexport type JSONSchema = {\n type?: string | string[];\n description?: string;\n enum?: readonly (string | number)[];\n const?: string | number | boolean;\n properties?: Record<string, JSONSchema>;\n required?: readonly string[];\n additionalProperties?: false;\n items?: JSONSchema;\n anyOf?: readonly JSONSchema[];\n};\n\n/**\n * Any value JSON can carry. The default output type of `json()`, and the\n * annotation an app reaches for when it hands one of those values on.\n */\nexport type JsonValue =\n | string\n | number\n | boolean\n | null\n | JsonValue[]\n | { [key: string]: JsonValue };\n\ndeclare const OUTPUT: unique symbol;\ndeclare const OPTIONAL: unique symbol;\n\n/**\n * `T` is carried in a phantom property rather than a real one: it exists only\n * for inference, and a real field would show up on the object the app writes.\n */\nexport interface Schema<T> {\n readonly [OUTPUT]: T;\n /** The JSON Schema handed to the provider. */\n toJSONSchema(): JSONSchema;\n /**\n * Parses a value coming back from the model. Tool arguments arrive as a JSON\n * string the model generated, so they are untrusted in exactly the way a\n * request body is: shape-checked before `execute` ever sees them.\n */\n parse(value: unknown): T;\n safeParse(value: unknown): { ok: true; value: T } | { ok: false; errors: string[] };\n}\n\n/**\n * A schema whose key may be left out of the object containing it.\n *\n * Marked with a property rather than detected from the output type, because\n * `undefined extends T` — the obvious test — is true of *everything* when\n * `strictNullChecks` is off, which is how this package and plenty of apps\n * compile. That version made every field of every tool optional, and did it\n * quietly: the JSON Schema was still right, so only the TypeScript types lied.\n */\nexport interface OptionalSchema<T> extends Schema<T | undefined> {\n readonly [OPTIONAL]: true;\n}\n\nexport type AnySchema = Schema<any>;\n\nexport type Infer<S> = S extends Schema<infer T> ? T : never;\n\n/**\n * Collapses a type into one flat object.\n *\n * `ShapeOutput` builds its result as an intersection of two mapped types, one\n * required and one optional, and that intersection is what every hover, every\n * error message and every type assertion would otherwise show. The difference\n * is between an app reading `{ command: string; cwd?: string }` and reading two\n * mapped types joined by an ampersand.\n *\n * It also drops `readonly`, which the mapped types copy from the shape literal\n * — `s.object({ ... })` infers that literal as `const` to keep the keys, and a\n * tool has no reason to receive an immutable input because of how its schema\n * was written down.\n */\ntype Flatten<T> = { -readonly [K in keyof T]: T[K] };\n\ntype ShapeOutput<S extends Record<string, AnySchema>> = Flatten<\n {\n [K in keyof S as S[K] extends OptionalSchema<any> ? never : K]: Infer<S[K]>;\n } & {\n [K in keyof S as S[K] extends OptionalSchema<any> ? K : never]?: Infer<S[K]>;\n }\n>;\n\ninterface SchemaBuilder<T> extends Schema<T> {\n /**\n * The description is not documentation — it is the only prose the model gets\n * about a field, and it is the difference between a tool that is called\n * correctly and one that is not.\n */\n describe(description: string): this;\n /**\n * Strict mode has no notion of an omitted key: every property must appear in\n * `required`. So `optional()` emits a nullable union and the model is told to\n * send `null`, while the TypeScript type says `| undefined` and the parsed\n * value drops the key. The asymmetry is the point — it is what lets an app\n * write ordinary optional fields against an API that forbids them.\n */\n optional(): OptionalSchemaBuilder<T>;\n nullable(): SchemaBuilder<T | null>;\n}\n\ninterface OptionalSchemaBuilder<T> extends SchemaBuilder<T | undefined>, OptionalSchema<T> {}\n\n// --- the runtime ---------------------------------------------------------\n\n/**\n * What a builder actually is. `optional` and `nullable` are flags rather than\n * wrapper nodes so that `.nullable().optional()` cannot nest into something\n * whose emitted shape depends on which order they were called in.\n */\ntype Definition = {\n node: SchemaNode;\n description?: string;\n optional: boolean;\n nullable: boolean;\n};\n\ntype SchemaNode =\n | { kind: \"string\" }\n | { kind: \"number\" }\n | { kind: \"boolean\" }\n | { kind: \"literal\"; value: string | number | boolean }\n | { kind: \"enum\"; values: readonly string[] }\n | { kind: \"object\"; shape: Record<string, Definition> }\n | { kind: \"array\"; item: Definition }\n | { kind: \"union\"; members: readonly Definition[] }\n /** Constrains nothing. The node strict mode has no spelling for. */\n | { kind: \"json\" };\n\ntype ParseResult = { ok: true; value: unknown } | { ok: false; errors: string[] };\n\n/** The public interface with the phantoms and the generic taken off. */\ninterface RuntimeSchema {\n toJSONSchema(): JSONSchema;\n parse(value: unknown): unknown;\n safeParse(value: unknown): ParseResult;\n describe(description: string): RuntimeSchema;\n optional(): RuntimeSchema;\n nullable(): RuntimeSchema;\n}\n\n/**\n * Definitions hang off the builders here rather than on the builders\n * themselves: a property, however obscurely named, is a property an app can\n * see, serialise or accidentally depend on, and `Schema<T>` promises exactly\n * three methods.\n */\nconst definitions = new WeakMap<object, Definition>();\n\nfunction definitionOf(schema: AnySchema): Definition {\n const definition = definitions.get(schema);\n if (!definition) {\n throw new Error(\"gemi/ai: expected a schema built with `s`, got a foreign object\");\n }\n return definition;\n}\n\n// --- emitting ------------------------------------------------------------\n\nfunction emit(definition: Definition): JSONSchema {\n // A `json` node already admits every value there is, null included, so\n // widening it would only add an `anyOf` for the model to read past — and one\n // whose second branch is a strictly narrower repeat of its first.\n const widen = (definition.optional || definition.nullable) && definition.node.kind !== \"json\";\n const body = allowNull(emitNode(definition.node), widen);\n return definition.description ? { description: definition.description, ...body } : body;\n}\n\nfunction emitNode(node: SchemaNode): JSONSchema {\n switch (node.kind) {\n case \"string\":\n return { type: \"string\" };\n case \"number\":\n return { type: \"number\" };\n case \"boolean\":\n return { type: \"boolean\" };\n // `const` rather than a one-member `enum`, because a boolean literal has no\n // `enum` form and one branch that works for all three beats two that\n // disagree about what a literal is.\n case \"literal\":\n return { type: typeof node.value, const: node.value };\n case \"enum\":\n return { type: \"string\", enum: node.values };\n case \"array\":\n return { type: \"array\", items: emit(node.item) };\n case \"object\":\n return {\n type: \"object\",\n properties: Object.fromEntries(\n Object.entries(node.shape).map(([key, child]) => [key, emit(child)]),\n ),\n // Every declared property, optional ones included. This is the whole of\n // strict mode's bargain: the model is never allowed to omit a key, so\n // \"may be absent\" has to be spelled as \"may be null\" instead.\n required: Object.keys(node.shape),\n additionalProperties: false,\n };\n case \"union\":\n return { anyOf: node.members.map(emit) };\n // The empty schema, which is JSON Schema's own way of saying \"any value\" —\n // no `type` listing all seven, which reads as a constraint the model then\n // has to check itself. What the field actually is gets said in\n // `description`, the one channel a model reads either way.\n case \"json\":\n return {};\n }\n}\n\n/**\n * Widens a schema to admit `null` — for a `nullable()` field, and for the null\n * an `optional()` field tells the model to send in place of omitting the key.\n */\nfunction allowNull(base: JSONSchema, on: boolean): JSONSchema {\n if (!on) return base;\n // A union is already a list of alternatives; appending to it is flatter than\n // nesting an `anyOf` inside an `anyOf`, and reads the same to the model.\n if (base.anyOf) return { ...base, anyOf: [...base.anyOf, { type: \"null\" }] };\n // `enum` and `const` cannot carry the null themselves — `enum` here is\n // strings and numbers by declaration — so those get wrapped rather than\n // widened.\n if (base.enum || base.const !== undefined) return { anyOf: [base, { type: \"null\" }] };\n if (typeof base.type === \"string\") return { ...base, type: [base.type, \"null\"] };\n return { anyOf: [base, { type: \"null\" }] };\n}\n\n// --- parsing -------------------------------------------------------------\n\nfunction typeName(value: unknown): string {\n if (value === null) return \"null\";\n if (Array.isArray(value)) return \"array\";\n return typeof value;\n}\n\n/**\n * What the value looked like. For a literal or an enum the *type* is usually\n * right and the value is wrong, and \"expected \\\"refund\\\", got string\" tells\n * whoever is reading the failed tool call nothing they did not know.\n */\nfunction saw(node: SchemaNode, value: unknown): string {\n if (typeof value === \"number\" && !Number.isFinite(value)) return String(value);\n if (node.kind === \"literal\" || node.kind === \"enum\") {\n const primitive =\n typeof value === \"string\" || typeof value === \"number\" || typeof value === \"boolean\";\n if (primitive) return JSON.stringify(value);\n }\n return typeName(value);\n}\n\nfunction wanted(definition: Definition): string {\n const node = definition.node;\n const base = (() => {\n switch (node.kind) {\n case \"string\":\n case \"number\":\n case \"boolean\":\n return node.kind;\n case \"literal\":\n return JSON.stringify(node.value);\n case \"enum\":\n return `one of ${node.values.map((v) => JSON.stringify(v)).join(\" | \")}`;\n case \"array\":\n return \"array\";\n case \"object\":\n return \"object\";\n case \"union\":\n return \"one of the variants\";\n case \"json\":\n return \"a JSON value\";\n }\n })();\n return definition.optional || definition.nullable ? `${base} or null` : base;\n}\n\n/** `orders[2].total: ` — empty at the root, where a prefix would be noise. */\nfunction at(path: string): string {\n return path ? `${path}: ` : \"\";\n}\n\n/**\n * How well a value matches, used only to pick which union variant to blame.\n * A literal or an enum hit counts for far more than an ordinary field, because\n * that is what a discriminated union turns on: the variant whose `kind` matched\n * is the one the model meant, whatever else it got wrong.\n */\nfunction score(definition: Definition, value: unknown): number {\n if (value === null || value === undefined) {\n return definition.optional || definition.nullable ? 1 : 0;\n }\n const node = definition.node;\n switch (node.kind) {\n case \"string\":\n return typeof value === \"string\" ? 1 : 0;\n case \"number\":\n return typeof value === \"number\" ? 1 : 0;\n case \"boolean\":\n return typeof value === \"boolean\" ? 1 : 0;\n case \"literal\":\n return value === node.value ? 10 : 0;\n case \"enum\":\n return typeof value === \"string\" && node.values.includes(value) ? 10 : 0;\n case \"array\":\n return Array.isArray(value) ? 1 : 0;\n case \"object\": {\n if (typeof value !== \"object\" || Array.isArray(value)) return 0;\n const source = value as Record<string, unknown>;\n let total = 1;\n for (const [key, child] of Object.entries(node.shape)) {\n total += score(child, source[key]);\n }\n return total;\n }\n case \"union\":\n return node.members.reduce((best, member) => Math.max(best, score(member, value)), 0);\n // Matches, because it matches everything — but at the score of a plain\n // scalar, so a sibling variant that pinned its discriminant still wins the\n // blame.\n //\n // Reached only when no member parsed, which for a `json` member means the\n // value is not JSON at all: a function, a bigint, a cycle. Then this is\n // what makes the report name the reason the value was refused rather than\n // the discriminant of a variant the model was never aiming at.\n case \"json\":\n return 1;\n }\n}\n\n/** `drop` is a key that should not appear in the parsed object at all. */\ntype Reading = { drop: boolean; value: unknown };\n\nfunction read(definition: Definition, value: unknown, path: string, errors: string[]): Reading {\n // `optional` is checked before `nullable`, so a schema that is both treats\n // null as \"absent\". They are not distinguishable on the wire: strict mode\n // gives the model one spelling for \"nothing\", and pretending otherwise would\n // mean `.nullable().optional()` silently kept a key the type says is\n // optional. What that trades away is the ability to say \"present and null\" on\n // a field that may also be absent — a distinction no model can express here.\n if (definition.optional && (value === null || value === undefined)) {\n return { drop: true, value: undefined };\n }\n if (definition.nullable && value === null) return { drop: false, value: null };\n return { drop: false, value: readNode(definition, value, path, errors) };\n}\n\nfunction readNode(definition: Definition, value: unknown, path: string, errors: string[]): unknown {\n const node = definition.node;\n const fail = () => {\n errors.push(`${at(path)}expected ${wanted(definition)}, got ${saw(node, value)}`);\n return undefined;\n };\n\n switch (node.kind) {\n case \"string\":\n return typeof value === \"string\" ? value : fail();\n case \"number\":\n // NaN and Infinity do not survive `JSON.stringify`, so a tool that\n // returns one produces a body the provider cannot be sent.\n return typeof value === \"number\" && Number.isFinite(value) ? value : fail();\n case \"boolean\":\n return typeof value === \"boolean\" ? value : fail();\n case \"literal\":\n return value === node.value ? value : fail();\n case \"enum\":\n return typeof value === \"string\" && node.values.includes(value) ? value : fail();\n case \"array\": {\n if (!Array.isArray(value)) return fail();\n return value.map((item, index) => {\n const element = read(node.item, item, `${path}[${index}]`, errors);\n return element.drop ? undefined : element.value;\n });\n }\n case \"object\": {\n if (typeof value !== \"object\" || value === null || Array.isArray(value)) return fail();\n const source = value as Record<string, unknown>;\n const output: Record<string, unknown> = {};\n for (const [key, child] of Object.entries(node.shape)) {\n const element = read(child, source[key], path ? `${path}.${key}` : key, errors);\n if (!element.drop) output[key] = element.value;\n }\n // Unknown keys are DROPPED, not rejected. `additionalProperties: false`\n // has already told the model not to send them, so one arriving anyway is\n // a slip rather than an attack, and failing a whole tool call over a\n // stray field costs a turn to fix nothing. Dropping is also what keeps\n // `execute` from ever seeing a field its input type says cannot be there.\n return output;\n }\n case \"union\": {\n let best: { errors: string[]; score: number } | undefined;\n for (const member of node.members) {\n const attempt: string[] = [];\n const element = read(member, value, path, attempt);\n if (attempt.length === 0) return element.drop ? undefined : element.value;\n const points = score(member, value);\n if (!best || points > best.score) best = { errors: attempt, score: points };\n }\n // \"no match\" is useless when one field of a five-field variant was wrong.\n // Naming the closest variant and why it stopped is the difference between\n // a debuggable bad tool call and a shrug.\n errors.push(`${at(path)}no matching variant; closest: ${best.errors.join(\"; \")}`);\n return undefined;\n }\n // Passed through by reference, not rebuilt. Two reasons beyond the obvious\n // one: a rebuild would turn a `Date` into `{}` by copying own properties\n // that a `toJSON` was going to replace anyway, and the agent loop signs the\n // *parsed* input and later verifies the signature against it — a parse that\n // is exactly the identity cannot disagree with itself.\n case \"json\":\n if (value === undefined) return fail();\n checkJson(value, path, errors, new Set());\n return value;\n }\n}\n\n/**\n * Checks that a value is JSON, which is the only check a `json()` node makes.\n *\n * Tool arguments arrive through `JSON.parse`, so this never fires on model\n * input. It fires on a tool *output* or a structured answer an app built, where\n * a `bigint` or a cycle throws inside `JSON.stringify` and a function or a\n * `symbol` is dropped without a word — one turn later, with the provider's\n * request body to debug instead of the value.\n *\n * `undefined` and non-plain objects are deliberately allowed below the root:\n * `JSON.stringify` drops an `undefined` property, writes `null` for an\n * `undefined` element, and calls `toJSON` where there is one. Those are JSON's\n * own answers, and rejecting a `Date` to catch a `Map` is a bad trade.\n *\n * `toJSON` is honoured rather than assumed harmless: the walk checks what it\n * returns and never the object behind it, because that is all `JSON.stringify`\n * will look at.\n */\nfunction checkJson(\n value: unknown,\n path: string,\n errors: string[],\n seen: Set<object>,\n // False for the value a `toJSON` just returned: `JSON.stringify` applies\n // `toJSON` once per position, and re-applying it is how a pair of them\n // returning each other became an infinite loop.\n applyToJSON = true,\n): void {\n const reject = (what: string) => {\n errors.push(`${at(path)}expected a JSON value, got ${what}`);\n };\n\n switch (typeof value) {\n case \"undefined\":\n case \"string\":\n case \"boolean\":\n return;\n case \"number\":\n if (!Number.isFinite(value)) reject(String(value));\n return;\n case \"bigint\":\n return reject(\"a bigint\");\n case \"function\":\n return reject(\"a function\");\n case \"symbol\":\n return reject(\"a symbol\");\n }\n\n if (value === null) return;\n const object = value as object;\n\n // The cycle guard comes FIRST, above `toJSON`, and that ordering is the whole\n // of it: a `toJSON` is arbitrary code that can hand back another object with a\n // `toJSON` of its own, so two of them returning each other is a cycle that\n // `seen` catches and an identity test cannot. Below the guard, that pair hung\n // `safeParse` forever — and a `toJSON` returning a fresh object each time threw\n // `RangeError` out of a function documented to return `{ ok: false, errors }`.\n if (seen.has(object)) return reject(\"a circular reference\");\n seen.add(object);\n try {\n // `JSON.stringify` asks `toJSON` what to write and never looks at the object\n // itself, so that answer is what has to be checked. Without this the walk\n // descended into the wrapper's own fields and refused values `stringify`\n // serializes without complaint — a `toJSON` returning a string off a `bigint`\n // field being the archetype, since writing a `toJSON` is exactly what one\n // does about a field JSON cannot carry. `Date` passed only by having no own\n // enumerable properties to trip over.\n const toJSON = applyToJSON ? (object as { toJSON?: unknown }).toJSON : undefined;\n if (typeof toJSON === \"function\") {\n let replaced: unknown;\n try {\n replaced = (toJSON as (key?: string) => unknown).call(object);\n } catch {\n return reject(\"a toJSON that threw\");\n }\n // `JSON.stringify` applies `toJSON` once per value position, not until it\n // stops changing, so the replacement is checked with it switched off here\n // — its nested values get their own.\n if (replaced === undefined) return reject(\"a toJSON that returns undefined\");\n return checkJson(replaced, path, errors, seen, false);\n }\n if (Array.isArray(value)) {\n value.forEach((item, index) => checkJson(item, `${path}[${index}]`, errors, seen));\n } else {\n for (const [key, child] of Object.entries(object)) {\n checkJson(child, path ? `${path}.${key}` : key, errors, seen);\n }\n }\n } finally {\n // Removed rather than left in: `seen` is the path currently being walked, and\n // keeping it would call the same object appearing twice side by side — which\n // `JSON.stringify` writes out twice quite happily — a cycle. In a `finally`\n // so the `toJSON` returns above cannot leave it marked.\n seen.delete(object);\n }\n}\n\n/**\n * The one cast in this file, and the reason it has to exist: `OUTPUT` and\n * `OPTIONAL` are `declare const` unique symbols. They have no runtime\n * counterpart — they are inference channels — so no object that can actually be\n * constructed satisfies `Schema<T>` structurally. Funnelling every builder\n * through here means the lie is told once, in one place, and everything else in\n * the module is checked against the real declarations.\n */\nfunction make<T>(definition: Definition): SchemaBuilder<T> {\n return build(definition) as unknown as SchemaBuilder<T>;\n}\n\n/**\n * Builders are immutable: `describe`, `optional` and `nullable` each build a\n * fresh one from a copied definition. Mutating in place is the obvious\n * implementation and it is wrong — `const id = s.string()` reused in two\n * objects, described in one of them, would carry that description into the\n * other, and the only symptom is a model being told the wrong thing about a\n * field somewhere else.\n */\nfunction build(definition: Definition): RuntimeSchema {\n const runtime: RuntimeSchema = {\n toJSONSchema: () => emit(definition),\n parse(value) {\n const errors: string[] = [];\n const result = read(definition, value, \"\", errors);\n if (errors.length > 0) throw new Error(errors.join(\"; \"));\n return result.drop ? undefined : result.value;\n },\n safeParse(value) {\n const errors: string[] = [];\n const result = read(definition, value, \"\", errors);\n if (errors.length > 0) return { ok: false, errors };\n return { ok: true, value: result.drop ? undefined : result.value };\n },\n describe: (description) => build({ ...definition, description }),\n optional: () => build({ ...definition, optional: true }),\n // Clearing `optional` is not tidiness. `nullable()` returns a\n // `SchemaBuilder`, not an `OptionalSchemaBuilder`, so the key it describes\n // is required again in `ShapeOutput` — and a parse that still dropped it\n // would hand back an object missing a key its own type declares.\n nullable: () => build({ ...definition, nullable: true, optional: false }),\n };\n definitions.set(runtime, definition);\n return runtime;\n}\n\nfunction leaf(node: SchemaNode): Definition {\n return { node, optional: false, nullable: false };\n}\n\nexport const s: {\n string(): SchemaBuilder<string>;\n number(): SchemaBuilder<number>;\n boolean(): SchemaBuilder<boolean>;\n literal<const L extends string | number | boolean>(value: L): SchemaBuilder<L>;\n /** Modelled as a JSON Schema `enum`, which strict mode does support. */\n enum<const L extends readonly [string, ...string[]]>(values: L): SchemaBuilder<L[number]>;\n object<const S extends Record<string, AnySchema>>(shape: S): SchemaBuilder<ShapeOutput<S>>;\n array<const S extends AnySchema>(item: S): SchemaBuilder<Infer<S>[]>;\n /**\n * `anyOf` of object schemas, discriminated by a literal member. Left in\n * because tool outputs are frequently a success/failure pair, and modelling\n * that as one object with everything optional is worse for the model.\n */\n union<const S extends readonly [AnySchema, AnySchema, ...AnySchema[]]>(\n members: S,\n ): SchemaBuilder<Infer<S[number]>>;\n /**\n * Any JSON value, constrained by nothing — for a format the rest of this\n * builder cannot describe: a record with arbitrary keys, a mixed-type tuple,\n * a document that nests into itself.\n *\n * A schema containing one cannot be sent under strict mode, so a tool whose\n * input uses it is sent with `strict: false` automatically. That is not an\n * option to pass anywhere; it is read back off the schema by\n * `supportsStrict`. The rest of the tool is unaffected, and so is streaming:\n * partial arguments are parsed from the raw text, never through a schema.\n *\n * `T` is an assertion, not a guarantee. The emitted schema constrains\n * nothing, so nothing checks the model's output against `T` — only that it is\n * JSON. Validate it in `execute` and hand the model back an error it can fix,\n * the way it would any other bad argument. `describe()` is where you tell it\n * the format; with no constraints to read, that prose is all it gets.\n *\n * TWO CALL SIGNATURES, NOT A DEFAULT TYPE PARAMETER, and that is load-bearing.\n * Written `json<T = JsonValue>()`, the default lost to the surrounding\n * contextual type in the position this is actually used: `s.object`'s shape is\n * constrained to `Record<string, AnySchema>` — `Schema<any>` — which supplies\n * `any` as an inference candidate, and a candidate beats a default. So\n * `s.object({ definition: s.json() })` inferred `{ definition: any }`, which is\n * type checking switched off around exactly the field this exists for, and the\n * opposite of what the default was written to prevent. An overload with no type\n * parameter has nothing to infer, so `s.json()` is `JsonValue` wherever it is\n * written.\n *\n * `ai:generate-client` maps it to the native `JSONValue` and says nothing about\n * it. `JsonValue` is a union of every JSON shape, so it used to reach the\n * generator's \"a union that is not told apart by one string member\" warning —\n * true, and a misdescription of a field that is free-form on purpose. The\n * extractor recognises it now.\n */\n json(): SchemaBuilder<JsonValue>;\n json<T>(): SchemaBuilder<T>;\n} = {\n string: () => make<string>(leaf({ kind: \"string\" })),\n number: () => make<number>(leaf({ kind: \"number\" })),\n boolean: () => make<boolean>(leaf({ kind: \"boolean\" })),\n literal: (value) => make<typeof value>(leaf({ kind: \"literal\", value })),\n enum: (values) => make<(typeof values)[number]>(leaf({ kind: \"enum\", values })),\n object: (shape) =>\n make<ShapeOutput<typeof shape>>(\n leaf({\n kind: \"object\",\n shape: Object.fromEntries(\n Object.entries(shape).map(([key, child]) => [key, definitionOf(child)]),\n ),\n }),\n ),\n array: (item) => make<Infer<typeof item>[]>(leaf({ kind: \"array\", item: definitionOf(item) })),\n // A union is legal wherever a property is, but not as the root of a\n // structured output: the provider wants an object there. That is the\n // provider's check to make, not this one's.\n union: (members) =>\n make<Infer<(typeof members)[number]>>(\n leaf({ kind: \"union\", members: members.map(definitionOf) }),\n ),\n json: <T>() => make<T>(leaf({ kind: \"json\" })),\n};\n\n/**\n * Whether a schema can be sent under a provider's strict mode.\n *\n * False exactly when a `json()` node is somewhere inside it. Strict mode's\n * bargain is that every node constrains its value; an unconstrained one has no\n * spelling there, and sending it anyway is a 400 naming a path.\n *\n * Derived from the tree rather than declared alongside it, because the two\n * would drift: a field added to a tool's input a year from now would need\n * whoever adds it to know that a flag somewhere else describes it. Adding the\n * field is the whole of turning strict off.\n */\nexport function supportsStrict(schema: AnySchema): boolean {\n const definition = definitions.get(schema);\n if (definition) return strictNode(definition.node);\n // A schema built by hand rather than with `s`: `questionSchema` in\n // `ai/Agent.ts`, and the merged one `services/mcp` casts together.\n //\n // Answering `true` here was wrong, and not harmlessly. `McpRegistry`'s\n // `combineSchemas` spreads `meta.input.toJSONSchema()` into its own object,\n // so an `s.json()` field an app declared on an `mcp` route survives into the\n // emitted schema while the *tree* that would have reported it is discarded.\n // Every MCP-projected tool was therefore sent `strict: true` with an empty\n // subschema inside it — a 400 on every turn, from the one path this function\n // exists to get right.\n //\n // So the emitted schema is read instead. It is the same question asked of the\n // artifact rather than the source, which is the only thing a foreign schema\n // has to offer.\n return strictJSONSchema(schema.toJSONSchema());\n}\n\n/**\n * Whether an already-emitted JSON Schema constrains every value it describes.\n *\n * Only for schemas with no definition tree. It answers a narrower question than\n * `strictNode` — it cannot see optionality or a builder's intent, just whether\n * some node says nothing about its value — but that is exactly the property\n * strict mode rejects, and it is visible in the artifact.\n */\nfunction strictJSONSchema(schema: JSONSchema): boolean {\n // `description` is prose, not a constraint. A node carrying only that — which\n // is what `s.json().describe(...)` emits — says nothing about its value.\n const constrained =\n schema.type !== undefined ||\n schema.enum !== undefined ||\n schema.const !== undefined ||\n schema.anyOf !== undefined ||\n schema.properties !== undefined ||\n schema.items !== undefined;\n if (!constrained) return false;\n\n for (const child of Object.values(schema.properties ?? {})) {\n if (!strictJSONSchema(child)) return false;\n }\n if (schema.items && !strictJSONSchema(schema.items)) return false;\n for (const member of schema.anyOf ?? []) {\n if (!strictJSONSchema(member)) return false;\n }\n return true;\n}\n\n/**\n * Enumerated rather than defaulted, so that a node kind added later cannot\n * inherit \"strict\" by omission — which is the failure that shows up as a 400\n * from the provider rather than as a type error here.\n *\n * Needs no cycle guard: a definition tree is built bottom-up out of finished\n * builders, so nothing in it can refer to something still being constructed.\n */\nfunction strictNode(node: SchemaNode): boolean {\n switch (node.kind) {\n case \"string\":\n case \"number\":\n case \"boolean\":\n case \"literal\":\n case \"enum\":\n return true;\n case \"object\":\n return Object.values(node.shape).every((child) => strictNode(child.node));\n case \"array\":\n return strictNode(node.item.node);\n case \"union\":\n return node.members.every((member) => strictNode(member.node));\n case \"json\":\n return false;\n }\n}\n"
5
+ "/**\n * The schema layer for tool inputs, tool outputs and structured final answers.\n *\n * Two things have to come out of one declaration: a TypeScript type, so\n * `execute(input)` is typed at the call site and the result is typed in the\n * browser, and a JSON Schema, because that is what the model is actually shown.\n * A phantom `Schema<T>` gives the first and nothing of the second, and a\n * hand-written JSON Schema next to a hand-written type gives both and lets them\n * drift. So the builder below is the single source, and `Infer` reads the type\n * back off it.\n *\n * Everything here is deliberately narrower than JSON Schema. OpenAI's strict\n * structured output only accepts a subset — every property listed in\n * `required`, `additionalProperties: false` on every object, no patterns, no\n * `oneOf` at the root — and a builder that cannot express the rejected parts is\n * better than one that lets you write a schema the API refuses at runtime.\n *\n * `json()` is the one deliberate hole in that, for the formats strict mode\n * cannot describe at all: a record with arbitrary keys, a mixed-type tuple, a\n * recursive document. It does not widen the subset — it turns strict mode off\n * for the schema containing it, which `supportsStrict` reads back off the tree\n * so that no caller has to remember to.\n */\n\nexport type JSONSchema = {\n type?: string | string[];\n description?: string;\n enum?: readonly (string | number)[];\n const?: string | number | boolean;\n properties?: Record<string, JSONSchema>;\n required?: readonly string[];\n additionalProperties?: false;\n items?: JSONSchema;\n anyOf?: readonly JSONSchema[];\n};\n\n/**\n * Any value JSON can carry. The default output type of `json()`, and the\n * annotation an app reaches for when it hands one of those values on.\n */\nexport type JsonValue =\n | string\n | number\n | boolean\n | null\n | JsonValue[]\n | { [key: string]: JsonValue };\n\ndeclare const OUTPUT: unique symbol;\ndeclare const OPTIONAL: unique symbol;\n\n/**\n * `T` is carried in a phantom property rather than a real one: it exists only\n * for inference, and a real field would show up on the object the app writes.\n */\nexport interface Schema<T> {\n readonly [OUTPUT]: T;\n /** The JSON Schema handed to the provider. */\n toJSONSchema(): JSONSchema;\n /**\n * Parses a value coming back from the model. Tool arguments arrive as a JSON\n * string the model generated, so they are untrusted in exactly the way a\n * request body is: shape-checked before `execute` ever sees them.\n */\n parse(value: unknown): T;\n safeParse(value: unknown): { ok: true; value: T } | { ok: false; errors: string[] };\n}\n\n/**\n * A schema whose key may be left out of the object containing it.\n *\n * Marked with a property rather than detected from the output type, because\n * `undefined extends T` — the obvious test — is true of *everything* when\n * `strictNullChecks` is off, which is how this package and plenty of apps\n * compile. That version made every field of every tool optional, and did it\n * quietly: the JSON Schema was still right, so only the TypeScript types lied.\n */\nexport interface OptionalSchema<T> extends Schema<T | undefined> {\n readonly [OPTIONAL]: true;\n}\n\nexport type AnySchema = Schema<any>;\n\nexport type Infer<S> = S extends Schema<infer T> ? T : never;\n\n/**\n * Collapses a type into one flat object.\n *\n * `ShapeOutput` builds its result as an intersection of two mapped types, one\n * required and one optional, and that intersection is what every hover, every\n * error message and every type assertion would otherwise show. The difference\n * is between an app reading `{ command: string; cwd?: string }` and reading two\n * mapped types joined by an ampersand.\n *\n * It also drops `readonly`, which the mapped types copy from the shape literal\n * — `s.object({ ... })` infers that literal as `const` to keep the keys, and a\n * tool has no reason to receive an immutable input because of how its schema\n * was written down.\n */\ntype Flatten<T> = { -readonly [K in keyof T]: T[K] };\n\ntype ShapeOutput<S extends Record<string, AnySchema>> = Flatten<\n {\n [K in keyof S as S[K] extends OptionalSchema<any> ? never : K]: Infer<S[K]>;\n } & {\n [K in keyof S as S[K] extends OptionalSchema<any> ? K : never]?: Infer<S[K]>;\n }\n>;\n\ninterface SchemaBuilder<T> extends Schema<T> {\n /**\n * The description is not documentation — it is the only prose the model gets\n * about a field, and it is the difference between a tool that is called\n * correctly and one that is not.\n */\n describe(description: string): this;\n /**\n * Strict mode has no notion of an omitted key: every property must appear in\n * `required`. So `optional()` emits a nullable union and the model is told to\n * send `null`, while the TypeScript type says `| undefined` and the parsed\n * value drops the key. The asymmetry is the point — it is what lets an app\n * write ordinary optional fields against an API that forbids them.\n */\n optional(): OptionalSchemaBuilder<T>;\n nullable(): SchemaBuilder<T | null>;\n}\n\ninterface OptionalSchemaBuilder<T> extends SchemaBuilder<T | undefined>, OptionalSchema<T> {}\n\n// --- the runtime ---------------------------------------------------------\n\n/**\n * What a builder actually is. `optional` and `nullable` are flags rather than\n * wrapper nodes so that `.nullable().optional()` cannot nest into something\n * whose emitted shape depends on which order they were called in.\n */\ntype Definition = {\n node: SchemaNode;\n description?: string;\n optional: boolean;\n nullable: boolean;\n};\n\ntype SchemaNode =\n | { kind: \"string\" }\n | { kind: \"number\" }\n | { kind: \"boolean\" }\n | { kind: \"literal\"; value: string | number | boolean }\n | { kind: \"enum\"; values: readonly string[] }\n | { kind: \"object\"; shape: Record<string, Definition> }\n | { kind: \"array\"; item: Definition }\n | { kind: \"union\"; members: readonly Definition[] }\n /** Constrains nothing. The node strict mode has no spelling for. */\n | { kind: \"json\" };\n\ntype ParseResult = { ok: true; value: unknown } | { ok: false; errors: string[] };\n\n/** The public interface with the phantoms and the generic taken off. */\ninterface RuntimeSchema {\n toJSONSchema(): JSONSchema;\n parse(value: unknown): unknown;\n safeParse(value: unknown): ParseResult;\n describe(description: string): RuntimeSchema;\n optional(): RuntimeSchema;\n nullable(): RuntimeSchema;\n}\n\n/**\n * Definitions hang off the builders here rather than on the builders\n * themselves: a property, however obscurely named, is a property an app can\n * see, serialise or accidentally depend on, and `Schema<T>` promises exactly\n * three methods.\n */\nconst definitions = new WeakMap<object, Definition>();\n\nfunction definitionOf(schema: AnySchema): Definition {\n const definition = definitions.get(schema);\n if (!definition) {\n throw new Error(\"gemi/ai: expected a schema built with `s`, got a foreign object\");\n }\n return definition;\n}\n\n// --- emitting ------------------------------------------------------------\n\nfunction emit(definition: Definition): JSONSchema {\n // A `json` node already admits every value there is, null included, so\n // widening it would only add an `anyOf` for the model to read past — and one\n // whose second branch is a strictly narrower repeat of its first.\n const widen = (definition.optional || definition.nullable) && definition.node.kind !== \"json\";\n const body = allowNull(emitNode(definition.node), widen);\n return definition.description ? { description: definition.description, ...body } : body;\n}\n\nfunction emitNode(node: SchemaNode): JSONSchema {\n switch (node.kind) {\n case \"string\":\n return { type: \"string\" };\n case \"number\":\n return { type: \"number\" };\n case \"boolean\":\n return { type: \"boolean\" };\n // `const` rather than a one-member `enum`, because a boolean literal has no\n // `enum` form and one branch that works for all three beats two that\n // disagree about what a literal is.\n case \"literal\":\n return { type: typeof node.value, const: node.value };\n case \"enum\":\n return { type: \"string\", enum: node.values };\n case \"array\":\n return { type: \"array\", items: emit(node.item) };\n case \"object\":\n return {\n type: \"object\",\n properties: Object.fromEntries(\n Object.entries(node.shape).map(([key, child]) => [key, emit(child)]),\n ),\n // Every declared property, optional ones included. This is the whole of\n // strict mode's bargain: the model is never allowed to omit a key, so\n // \"may be absent\" has to be spelled as \"may be null\" instead.\n required: Object.keys(node.shape),\n additionalProperties: false,\n };\n case \"union\":\n return { anyOf: node.members.map(emit) };\n // The empty schema, which is JSON Schema's own way of saying \"any value\" —\n // no `type` listing all seven, which reads as a constraint the model then\n // has to check itself. What the field actually is gets said in\n // `description`, the one channel a model reads either way.\n case \"json\":\n return {};\n }\n}\n\n/**\n * Widens a schema to admit `null` — for a `nullable()` field, and for the null\n * an `optional()` field tells the model to send in place of omitting the key.\n */\nfunction allowNull(base: JSONSchema, on: boolean): JSONSchema {\n if (!on) return base;\n // A union is already a list of alternatives; appending to it is flatter than\n // nesting an `anyOf` inside an `anyOf`, and reads the same to the model.\n if (base.anyOf) return { ...base, anyOf: [...base.anyOf, { type: \"null\" }] };\n // `enum` and `const` cannot carry the null themselves — `enum` here is\n // strings and numbers by declaration — so those get wrapped rather than\n // widened.\n if (base.enum || base.const !== undefined) return { anyOf: [base, { type: \"null\" }] };\n if (typeof base.type === \"string\") return { ...base, type: [base.type, \"null\"] };\n return { anyOf: [base, { type: \"null\" }] };\n}\n\n// --- parsing -------------------------------------------------------------\n\nfunction typeName(value: unknown): string {\n if (value === null) return \"null\";\n if (Array.isArray(value)) return \"array\";\n return typeof value;\n}\n\n/**\n * What the value looked like. For a literal or an enum the *type* is usually\n * right and the value is wrong, and \"expected \\\"refund\\\", got string\" tells\n * whoever is reading the failed tool call nothing they did not know.\n */\nfunction saw(node: SchemaNode, value: unknown): string {\n if (typeof value === \"number\" && !Number.isFinite(value)) return String(value);\n if (node.kind === \"literal\" || node.kind === \"enum\") {\n const primitive =\n typeof value === \"string\" || typeof value === \"number\" || typeof value === \"boolean\";\n if (primitive) return JSON.stringify(value);\n }\n return typeName(value);\n}\n\nfunction wanted(definition: Definition): string {\n const node = definition.node;\n const base = (() => {\n switch (node.kind) {\n case \"string\":\n case \"number\":\n case \"boolean\":\n return node.kind;\n case \"literal\":\n return JSON.stringify(node.value);\n case \"enum\":\n return `one of ${node.values.map((v) => JSON.stringify(v)).join(\" | \")}`;\n case \"array\":\n return \"array\";\n case \"object\":\n return \"object\";\n case \"union\":\n return \"one of the variants\";\n case \"json\":\n return \"a JSON value\";\n }\n })();\n return definition.optional || definition.nullable ? `${base} or null` : base;\n}\n\n/** `orders[2].total: ` — empty at the root, where a prefix would be noise. */\nfunction at(path: string): string {\n return path ? `${path}: ` : \"\";\n}\n\n/**\n * How well a value matches, used only to pick which union variant to blame.\n * A literal or an enum hit counts for far more than an ordinary field, because\n * that is what a discriminated union turns on: the variant whose `kind` matched\n * is the one the model meant, whatever else it got wrong.\n */\nfunction score(definition: Definition, value: unknown): number {\n if (value === null || value === undefined) {\n return definition.optional || definition.nullable ? 1 : 0;\n }\n const node = definition.node;\n switch (node.kind) {\n case \"string\":\n return typeof value === \"string\" ? 1 : 0;\n case \"number\":\n return typeof value === \"number\" ? 1 : 0;\n case \"boolean\":\n return typeof value === \"boolean\" ? 1 : 0;\n case \"literal\":\n return value === node.value ? 10 : 0;\n case \"enum\":\n return typeof value === \"string\" && node.values.includes(value) ? 10 : 0;\n case \"array\":\n return Array.isArray(value) ? 1 : 0;\n case \"object\": {\n if (typeof value !== \"object\" || Array.isArray(value)) return 0;\n const source = value as Record<string, unknown>;\n let total = 1;\n for (const [key, child] of Object.entries(node.shape)) {\n total += score(child, source[key]);\n }\n return total;\n }\n case \"union\":\n return node.members.reduce((best, member) => Math.max(best, score(member, value)), 0);\n // Matches, because it matches everything — but at the score of a plain\n // scalar, so a sibling variant that pinned its discriminant still wins the\n // blame.\n //\n // Reached only when no member parsed, which for a `json` member means the\n // value is not JSON at all: a function, a bigint, a cycle. Then this is\n // what makes the report name the reason the value was refused rather than\n // the discriminant of a variant the model was never aiming at.\n case \"json\":\n return 1;\n }\n}\n\n/** `drop` is a key that should not appear in the parsed object at all. */\ntype Reading = { drop: boolean; value: unknown };\n\nfunction read(definition: Definition, value: unknown, path: string, errors: string[]): Reading {\n // `optional` is checked before `nullable`, so a schema that is both treats\n // null as \"absent\". They are not distinguishable on the wire: strict mode\n // gives the model one spelling for \"nothing\", and pretending otherwise would\n // mean `.nullable().optional()` silently kept a key the type says is\n // optional. What that trades away is the ability to say \"present and null\" on\n // a field that may also be absent — a distinction no model can express here.\n if (definition.optional && (value === null || value === undefined)) {\n return { drop: true, value: undefined };\n }\n if (definition.nullable && value === null) return { drop: false, value: null };\n return { drop: false, value: readNode(definition, value, path, errors) };\n}\n\nfunction readNode(definition: Definition, value: unknown, path: string, errors: string[]): unknown {\n const node = definition.node;\n const fail = () => {\n errors.push(`${at(path)}expected ${wanted(definition)}, got ${saw(node, value)}`);\n return undefined;\n };\n\n switch (node.kind) {\n case \"string\":\n return typeof value === \"string\" ? value : fail();\n case \"number\":\n // NaN and Infinity do not survive `JSON.stringify`, so a tool that\n // returns one produces a body the provider cannot be sent.\n return typeof value === \"number\" && Number.isFinite(value) ? value : fail();\n case \"boolean\":\n return typeof value === \"boolean\" ? value : fail();\n case \"literal\":\n return value === node.value ? value : fail();\n case \"enum\":\n return typeof value === \"string\" && node.values.includes(value) ? value : fail();\n case \"array\": {\n if (!Array.isArray(value)) return fail();\n return value.map((item, index) => {\n const element = read(node.item, item, `${path}[${index}]`, errors);\n return element.drop ? undefined : element.value;\n });\n }\n case \"object\": {\n if (typeof value !== \"object\" || value === null || Array.isArray(value)) return fail();\n const source = value as Record<string, unknown>;\n const output: Record<string, unknown> = {};\n for (const [key, child] of Object.entries(node.shape)) {\n const element = read(child, source[key], path ? `${path}.${key}` : key, errors);\n if (!element.drop) output[key] = element.value;\n }\n // Unknown keys are DROPPED, not rejected. `additionalProperties: false`\n // has already told the model not to send them, so one arriving anyway is\n // a slip rather than an attack, and failing a whole tool call over a\n // stray field costs a turn to fix nothing. Dropping is also what keeps\n // `execute` from ever seeing a field its input type says cannot be there.\n return output;\n }\n case \"union\": {\n let best: { errors: string[]; score: number } | undefined;\n for (const member of node.members) {\n const attempt: string[] = [];\n const element = read(member, value, path, attempt);\n if (attempt.length === 0) return element.drop ? undefined : element.value;\n const points = score(member, value);\n if (!best || points > best.score) best = { errors: attempt, score: points };\n }\n // \"no match\" is useless when one field of a five-field variant was wrong.\n // Naming the closest variant and why it stopped is the difference between\n // a debuggable bad tool call and a shrug.\n errors.push(`${at(path)}no matching variant; closest: ${best.errors.join(\"; \")}`);\n return undefined;\n }\n // Passed through by reference, not rebuilt. Two reasons beyond the obvious\n // one: a rebuild would turn a `Date` into `{}` by copying own properties\n // that a `toJSON` was going to replace anyway, and the agent loop signs the\n // *parsed* input and later verifies the signature against it — a parse that\n // is exactly the identity cannot disagree with itself.\n case \"json\":\n if (value === undefined) return fail();\n checkJson(value, path, errors, new Set());\n return value;\n }\n}\n\n/**\n * Checks that a value is JSON, which is the only check a `json()` node makes.\n *\n * Tool arguments arrive through `JSON.parse`, so this never fires on model\n * input. It fires on a tool *output* or a structured answer an app built, where\n * a `bigint` or a cycle throws inside `JSON.stringify` and a function or a\n * `symbol` is dropped without a word — one turn later, with the provider's\n * request body to debug instead of the value.\n *\n * `undefined` and non-plain objects are deliberately allowed below the root:\n * `JSON.stringify` drops an `undefined` property, writes `null` for an\n * `undefined` element, and calls `toJSON` where there is one. Those are JSON's\n * own answers, and rejecting a `Date` to catch a `Map` is a bad trade.\n *\n * `toJSON` is honoured rather than assumed harmless: the walk checks what it\n * returns and never the object behind it, because that is all `JSON.stringify`\n * will look at.\n */\nfunction checkJson(\n value: unknown,\n path: string,\n errors: string[],\n seen: Set<object>,\n // False for the value a `toJSON` just returned: `JSON.stringify` applies\n // `toJSON` once per position, and re-applying it is how a pair of them\n // returning each other became an infinite loop.\n applyToJSON = true,\n): void {\n const reject = (what: string) => {\n errors.push(`${at(path)}expected a JSON value, got ${what}`);\n };\n\n switch (typeof value) {\n case \"undefined\":\n case \"string\":\n case \"boolean\":\n return;\n case \"number\":\n if (!Number.isFinite(value)) reject(String(value));\n return;\n case \"bigint\":\n return reject(\"a bigint\");\n case \"function\":\n return reject(\"a function\");\n case \"symbol\":\n return reject(\"a symbol\");\n }\n\n if (value === null) return;\n const object = value as object;\n\n // The cycle guard comes FIRST, above `toJSON`, and that ordering is the whole\n // of it: a `toJSON` is arbitrary code that can hand back another object with a\n // `toJSON` of its own, so two of them returning each other is a cycle that\n // `seen` catches and an identity test cannot. Below the guard, that pair hung\n // `safeParse` forever — and a `toJSON` returning a fresh object each time threw\n // `RangeError` out of a function documented to return `{ ok: false, errors }`.\n if (seen.has(object)) return reject(\"a circular reference\");\n seen.add(object);\n try {\n // `JSON.stringify` asks `toJSON` what to write and never looks at the object\n // itself, so that answer is what has to be checked. Without this the walk\n // descended into the wrapper's own fields and refused values `stringify`\n // serializes without complaint — a `toJSON` returning a string off a `bigint`\n // field being the archetype, since writing a `toJSON` is exactly what one\n // does about a field JSON cannot carry. `Date` passed only by having no own\n // enumerable properties to trip over.\n const toJSON = applyToJSON ? (object as { toJSON?: unknown }).toJSON : undefined;\n if (typeof toJSON === \"function\") {\n let replaced: unknown;\n try {\n replaced = (toJSON as (key?: string) => unknown).call(object);\n } catch {\n return reject(\"a toJSON that threw\");\n }\n // `JSON.stringify` applies `toJSON` once per value position, not until it\n // stops changing, so the replacement is checked with it switched off here\n // — its nested values get their own.\n if (replaced === undefined) return reject(\"a toJSON that returns undefined\");\n return checkJson(replaced, path, errors, seen, false);\n }\n if (Array.isArray(value)) {\n value.forEach((item, index) => checkJson(item, `${path}[${index}]`, errors, seen));\n } else {\n for (const [key, child] of Object.entries(object)) {\n checkJson(child, path ? `${path}.${key}` : key, errors, seen);\n }\n }\n } finally {\n // Removed rather than left in: `seen` is the path currently being walked, and\n // keeping it would call the same object appearing twice side by side — which\n // `JSON.stringify` writes out twice quite happily — a cycle. In a `finally`\n // so the `toJSON` returns above cannot leave it marked.\n seen.delete(object);\n }\n}\n\n/**\n * The one cast in this file, and the reason it has to exist: `OUTPUT` and\n * `OPTIONAL` are `declare const` unique symbols. They have no runtime\n * counterpart — they are inference channels — so no object that can actually be\n * constructed satisfies `Schema<T>` structurally. Funnelling every builder\n * through here means the lie is told once, in one place, and everything else in\n * the module is checked against the real declarations.\n */\nfunction make<T>(definition: Definition): SchemaBuilder<T> {\n return build(definition) as unknown as SchemaBuilder<T>;\n}\n\n/**\n * Builders are immutable: `describe`, `optional` and `nullable` each build a\n * fresh one from a copied definition. Mutating in place is the obvious\n * implementation and it is wrong — `const id = s.string()` reused in two\n * objects, described in one of them, would carry that description into the\n * other, and the only symptom is a model being told the wrong thing about a\n * field somewhere else.\n */\nfunction build(definition: Definition): RuntimeSchema {\n const runtime: RuntimeSchema = {\n toJSONSchema: () => emit(definition),\n parse(value) {\n const errors: string[] = [];\n const result = read(definition, value, \"\", errors);\n if (errors.length > 0) throw new Error(errors.join(\"; \"));\n return result.drop ? undefined : result.value;\n },\n safeParse(value) {\n const errors: string[] = [];\n const result = read(definition, value, \"\", errors);\n if (errors.length > 0) return { ok: false, errors };\n return { ok: true, value: result.drop ? undefined : result.value };\n },\n describe: (description) => build({ ...definition, description }),\n optional: () => build({ ...definition, optional: true }),\n // Clearing `optional` is not tidiness. `nullable()` returns a\n // `SchemaBuilder`, not an `OptionalSchemaBuilder`, so the key it describes\n // is required again in `ShapeOutput` — and a parse that still dropped it\n // would hand back an object missing a key its own type declares.\n nullable: () => build({ ...definition, nullable: true, optional: false }),\n };\n definitions.set(runtime, definition);\n return runtime;\n}\n\nfunction leaf(node: SchemaNode): Definition {\n return { node, optional: false, nullable: false };\n}\n\nexport const s: {\n string(): SchemaBuilder<string>;\n number(): SchemaBuilder<number>;\n boolean(): SchemaBuilder<boolean>;\n literal<const L extends string | number | boolean>(value: L): SchemaBuilder<L>;\n /** Modelled as a JSON Schema `enum`, which strict mode does support. */\n enum<const L extends readonly [string, ...string[]]>(values: L): SchemaBuilder<L[number]>;\n object<const S extends Record<string, AnySchema>>(shape: S): SchemaBuilder<ShapeOutput<S>>;\n array<const S extends AnySchema>(item: S): SchemaBuilder<Infer<S>[]>;\n /**\n * `anyOf` of object schemas, discriminated by a literal member. Left in\n * because tool outputs are frequently a success/failure pair, and modelling\n * that as one object with everything optional is worse for the model.\n */\n union<const S extends readonly [AnySchema, AnySchema, ...AnySchema[]]>(\n members: S,\n ): SchemaBuilder<Infer<S[number]>>;\n /**\n * Any JSON value, constrained by nothing — for a format the rest of this\n * builder cannot describe: a record with arbitrary keys, a mixed-type tuple,\n * a document that nests into itself.\n *\n * A schema containing one cannot be sent under strict mode, so a tool whose\n * input uses it is sent with `strict: false` automatically. That is not an\n * option to pass anywhere; it is read back off the schema by\n * `supportsStrict`. The rest of the tool is unaffected, and so is streaming:\n * partial arguments are parsed from the raw text, never through a schema.\n *\n * `T` is an assertion, not a guarantee. The emitted schema constrains\n * nothing, so nothing checks the model's output against `T` — only that it is\n * JSON. Validate it in `execute` and hand the model back an error it can fix,\n * the way it would any other bad argument. `describe()` is where you tell it\n * the format; with no constraints to read, that prose is all it gets.\n *\n * TWO CALL SIGNATURES, NOT A DEFAULT TYPE PARAMETER, and that is load-bearing.\n * Written `json<T = JsonValue>()`, the default lost to the surrounding\n * contextual type in the position this is actually used: `s.object`'s shape is\n * constrained to `Record<string, AnySchema>` — `Schema<any>` — which supplies\n * `any` as an inference candidate, and a candidate beats a default. So\n * `s.object({ definition: s.json() })` inferred `{ definition: any }`, which is\n * type checking switched off around exactly the field this exists for, and the\n * opposite of what the default was written to prevent. An overload with no type\n * parameter has nothing to infer, so `s.json()` is `JsonValue` wherever it is\n * written.\n *\n * `ai:generate-client` maps it to the native `JSONValue` and says nothing about\n * it. `JsonValue` is a union of every JSON shape, so it used to reach the\n * generator's \"a union that is not told apart by one string member\" warning —\n * true, and a misdescription of a field that is free-form on purpose. The\n * extractor recognises it now.\n */\n json(): SchemaBuilder<JsonValue>;\n json<T>(): SchemaBuilder<T>;\n} = {\n string: () => make<string>(leaf({ kind: \"string\" })),\n number: () => make<number>(leaf({ kind: \"number\" })),\n boolean: () => make<boolean>(leaf({ kind: \"boolean\" })),\n literal: (value) => make<typeof value>(leaf({ kind: \"literal\", value })),\n enum: (values) => make<(typeof values)[number]>(leaf({ kind: \"enum\", values })),\n object: (shape) =>\n make<ShapeOutput<typeof shape>>(\n leaf({\n kind: \"object\",\n shape: Object.fromEntries(\n Object.entries(shape).map(([key, child]) => [key, definitionOf(child)]),\n ),\n }),\n ),\n array: (item) => make<Infer<typeof item>[]>(leaf({ kind: \"array\", item: definitionOf(item) })),\n // A union is legal wherever a property is, but not as the root of a tool's\n // input or an agent's structured output: the provider wants an object there.\n // `s` cannot know where a schema will be used, so `AgentTool.create` and\n // `Agent.create` are what reject it at the root.\n union: (members) =>\n make<Infer<(typeof members)[number]>>(\n leaf({ kind: \"union\", members: members.map(definitionOf) }),\n ),\n json: <T>() => make<T>(leaf({ kind: \"json\" })),\n};\n\n/**\n * Whether a schema can be sent under a provider's strict mode.\n *\n * False exactly when a `json()` node is somewhere inside it. Strict mode's\n * bargain is that every node constrains its value; an unconstrained one has no\n * spelling there, and sending it anyway is a 400 naming a path.\n *\n * Derived from the tree rather than declared alongside it, because the two\n * would drift: a field added to a tool's input a year from now would need\n * whoever adds it to know that a flag somewhere else describes it. Adding the\n * field is the whole of turning strict off.\n */\nexport function supportsStrict(schema: AnySchema): boolean {\n const definition = definitions.get(schema);\n if (definition) return strictNode(definition.node);\n // A schema built by hand rather than with `s`: `questionSchema` in\n // `ai/Agent.ts`, and the merged one `services/mcp` casts together.\n //\n // Answering `true` here was wrong, and not harmlessly. `McpRegistry`'s\n // `combineSchemas` spreads `meta.input.toJSONSchema()` into its own object,\n // so an `s.json()` field an app declared on an `mcp` route survives into the\n // emitted schema while the *tree* that would have reported it is discarded.\n // Every MCP-projected tool was therefore sent `strict: true` with an empty\n // subschema inside it — a 400 on every turn, from the one path this function\n // exists to get right.\n //\n // So the emitted schema is read instead. It is the same question asked of the\n // artifact rather than the source, which is the only thing a foreign schema\n // has to offer.\n return strictJSONSchema(schema.toJSONSchema());\n}\n\n/**\n * Whether an already-emitted JSON Schema constrains every value it describes.\n *\n * Only for schemas with no definition tree. It answers a narrower question than\n * `strictNode` — it cannot see optionality or a builder's intent, just whether\n * some node says nothing about its value — but that is exactly the property\n * strict mode rejects, and it is visible in the artifact.\n */\nfunction strictJSONSchema(schema: JSONSchema): boolean {\n // `description` is prose, not a constraint. A node carrying only that — which\n // is what `s.json().describe(...)` emits — says nothing about its value.\n const constrained =\n schema.type !== undefined ||\n schema.enum !== undefined ||\n schema.const !== undefined ||\n schema.anyOf !== undefined ||\n schema.properties !== undefined ||\n schema.items !== undefined;\n if (!constrained) return false;\n\n for (const child of Object.values(schema.properties ?? {})) {\n if (!strictJSONSchema(child)) return false;\n }\n if (schema.items && !strictJSONSchema(schema.items)) return false;\n for (const member of schema.anyOf ?? []) {\n if (!strictJSONSchema(member)) return false;\n }\n return true;\n}\n\n/**\n * Enumerated rather than defaulted, so that a node kind added later cannot\n * inherit \"strict\" by omission — which is the failure that shows up as a 400\n * from the provider rather than as a type error here.\n *\n * Needs no cycle guard: a definition tree is built bottom-up out of finished\n * builders, so nothing in it can refer to something still being constructed.\n */\nfunction strictNode(node: SchemaNode): boolean {\n switch (node.kind) {\n case \"string\":\n case \"number\":\n case \"boolean\":\n case \"literal\":\n case \"enum\":\n return true;\n case \"object\":\n return Object.values(node.shape).every((child) => strictNode(child.node));\n case \"array\":\n return strictNode(node.item.node);\n case \"union\":\n return node.members.every((member) => strictNode(member.node));\n case \"json\":\n return false;\n }\n}\n"
6
6
  ],
7
- "mappings": ";AA6KA,IAAM,EAAc,IAAI,QAExB,SAAS,CAAY,CAAC,EAA+B,CACnD,IAAM,EAAa,EAAY,IAAI,CAAM,EACzC,GAAI,CAAC,EACH,MAAU,MAAM,iEAAiE,EAEnF,OAAO,EAKT,SAAS,CAAI,CAAC,EAAoC,CAIhD,IAAM,GAAS,EAAW,UAAY,EAAW,WAAa,EAAW,KAAK,OAAS,OACjF,EAAO,EAAU,EAAS,EAAW,IAAI,EAAG,CAAK,EACvD,OAAO,EAAW,YAAc,CAAE,YAAa,EAAW,eAAgB,CAAK,EAAI,EAGrF,SAAS,CAAQ,CAAC,EAA8B,CAC9C,OAAQ,EAAK,U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