UNPKG

@muppet-kit/shared

Version:

Shared utilities and types for Muppet Kit.

2 lines (1 loc) 1.16 kB
var g=Object.defineProperty;var i=(o,s)=>g(o,"name",{value:s,configurable:!0});import e from"zod";function S(o){const{host:s=process.env.HOST??"localhost",port:m=Number(process.env.PORT??3553),auto_open:u=!0,enableTelemetry:f=!0,enableOpenAPI:T=!0,models:n,...b}=o;let a;const r={};if(n)for(const t of n)"modelId"in t?r[c(t)]=t:(r[c(t.model)]=t.model,t.default&&(a=t.model));return!a&&n&&(a=r[Object.keys(r)[0]]),{host:s,port:m,auto_open:u,enableTelemetry:f,enableOpenAPI:T,models:n?{default:a,available:r}:void 0,...b}}i(S,"defineInspectorConfig");function c(o){return`${o.provider.split(".")[0]}:${o.modelId}`}i(c,"_generateModelKey");const l={STDIO:"stdio",SSE:"sse",HTTP:"streamable-http"},d=e.object({type:e.literal(l.STDIO),command:e.string(),args:e.string().optional(),env:e.array(e.object({key:e.string(),value:e.string()})).optional()}),p=e.object({type:e.union([e.literal(l.SSE),e.literal(l.HTTP)]),url:e.string().url(),headerName:e.string().optional(),bearerToken:e.string().optional()}),v=e.union([d,p]);export{l as Transport,c as _generateModelKey,S as defineInspectorConfig,p as remoteTransportSchema,d as stdioTransportSchema,v as transportSchema};