@agentica/chat 0.12.0 → 0.12.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/assets/{AgenticaChatApplication-DOAuu8zP.js → AgenticaChatApplication-DxrCYEqZ.js} +1 -1
- package/dist/assets/{OpenApi-tYTc9xIi.js → OpenApi-BZsnK1St.js} +1 -1
- package/dist/assets/bbs/{index-CsmlV9LE.js → index-BO5HWFAH.js} +1 -1
- package/dist/assets/shopping/{index.html-CvTWIjXT.js → index.html-C2UYfkXx.js} +1 -1
- package/dist/assets/uploader/{index.html-D4uZ5-ja.js → index.html-Ce-0OznC.js} +1 -1
- package/dist/bbs/index.html +2 -2
- package/dist/shopping/index.html +3 -3
- package/dist/uploader/index.html +3 -3
- package/package.json +2 -2
package/dist/assets/{AgenticaChatApplication-DOAuu8zP.js → AgenticaChatApplication-DxrCYEqZ.js}
RENAMED
|
@@ -2448,7 +2448,7 @@ them all into the \`functions\` property.
|
|
|
2448
2448
|
Also, if you A.I. agent can't specify a specific function to call due to lack
|
|
2449
2449
|
of specificity or homogeneity of candidate functions, just assign all of them
|
|
2450
2450
|
by in the\` functions\` property\` too. Instead, when you A.I. agent can specify
|
|
2451
|
-
a specific function to call, the others would be eliminated.`}]};var aBt;(o=>{o.execute=h=>async b=>{const _=[];if(b.ready()===!1){if((h==null?void 0:h.initialize)===null)await b.initialize();else if(_.push(...await((h==null?void 0:h.initialize)??rBt.execute)(b)),b.ready()===!1)return _}if(b.stack.length!==0&&_.push(...await((h==null?void 0:h.cancel)??TX.execute)(b)),_.push(...await((h==null?void 0:h.select)??iBt.execute)(b)),b.stack.length===0)return _;for(;;){const O=await((h==null?void 0:h.call)??tBt.execute)(b);_.push(...O);const P=O.filter(B=>B.type==="execute");for(const B of P)await TX.cancelFunction(b,{reason:"completed",name:B.operation.name});if(_.push(...await((h==null?void 0:h.describe)??nBt.execute)(b,P)),P.length===0||b.stack.length===0)break}return _}})(aBt||(aBt={}));var oBt;(o=>{o.aggregate=h=>{var P,B,G,Z,q;if(!h.completionUsage)return;const b=h.usage[h.kind];b.total+=h.completionUsage.total_tokens,b.input.total+=h.completionUsage.prompt_tokens,b.input.total+=((P=h.completionUsage.prompt_tokens_details)==null?void 0:P.audio_tokens)??0,b.input.cached+=((B=h.completionUsage.prompt_tokens_details)==null?void 0:B.cached_tokens)??0,b.output.total+=h.completionUsage.total_tokens,b.output.accepted_prediction+=((G=h.completionUsage.completion_tokens_details)==null?void 0:G.accepted_prediction_tokens)??0,b.output.reasoning+=((Z=h.completionUsage.completion_tokens_details)==null?void 0:Z.reasoning_tokens)??0,b.output.rejected_prediction+=((q=h.completionUsage.completion_tokens_details)==null?void 0:q.rejected_prediction_tokens)??0;const _=nt=>Object.entries(h.usage).filter(([ot])=>ot!=="aggregate").map(([,ot])=>nt(ot)).reduce((ot,ut)=>ot+ut,0),O=h.usage.aggregate;O.total=_(nt=>nt.total),O.input.total=_(nt=>nt.input.total),O.input.cached=_(nt=>nt.input.cached),O.output.total=_(nt=>nt.output.total),O.output.reasoning=_(nt=>nt.output.reasoning),O.output.accepted_prediction=_(nt=>nt.output.accepted_prediction),O.output.rejected_prediction=_(nt=>nt.output.rejected_prediction)}})(oBt||(oBt={}));class xMn extends tC{constructor(){super("initialize")}toJSON(){return{type:"initialize"}}}const E7e=(o,h,b)=>{const _=o.get(h);if(_)return _;const O=b();return o.set(h,O),O};var sBt;(o=>{o.compose=b=>{var q;const _=b.controllers.length===1||(()=>{const nt=b.controllers.map(ot=>ot.application.functions.map(ut=>ut.name)).flat();return new Set(nt).size===nt.length})(),O=(nt,ot)=>_?nt:`_${ot}_${nt}`,P=b.controllers.map((nt,ot)=>nt.protocol==="http"?nt.application.functions.map(ut=>({protocol:"http",controller:nt,function:ut,name:O(ut.name,ot),toJSON:()=>({protocol:"http",controller:nt.name,function:ut.name,name:O(ut.name,ot)})})):nt.application.functions.map(ut=>({protocol:"class",controller:nt,function:ut,name:O(ut.name,ot),toJSON:()=>({protocol:"class",controller:nt.name,function:ut.name,name:O(ut.name,ot)})}))).flat(),B=(q=b.config)!=null&&q.capacity&&P.length>b.config.capacity?h({array:P,capacity:b.config.capacity}):void 0,G=new Map,Z=new Map;for(const nt of P)G.set(nt.name,nt),E7e(Z,nt.controller.name,()=>new Map).set(nt.name,nt);return{array:P,divided:B,flat:G,group:Z}};const h=b=>{const _=Math.ceil(b.array.length/b.capacity),O=Math.ceil(b.array.length/_),P=b.array.slice();return new Array(_).fill(0).map(()=>P.splice(0,O))}})(sBt||(sBt={}));var cBt;(o=>{o.transform=h=>{if(h.prompt.type==="text")return(0,o.transformText)({prompt:h.prompt});if(h.prompt.type==="select")return(0,o.transformSelect)({operations:h.operations,prompt:h.prompt});if(h.prompt.type==="cancel")return(0,o.transformCancel)({operations:h.operations,prompt:h.prompt});if(h.prompt.type==="execute")return(0,o.transformExecute)({operations:h.operations,prompt:h.prompt});if(h.prompt.type==="describe")return(0,o.transformDescribe)({operations:h.operations,prompt:h.prompt});throw new Error("Invalid prompt type.")},o.transformText=h=>new Gj(h.prompt),o.transformSelect=h=>new Mmt({id:h.prompt.id,selections:h.prompt.selections.map(b=>new YN({operation:VDt({operations:h.operations,input:b.operation}),reason:b.reason}))}),o.transformCancel=h=>new GPn({id:h.prompt.id,selections:h.prompt.selections.map(b=>new YN({operation:VDt({operations:h.operations,input:b.operation}),reason:b.reason}))}),o.transformExecute=h=>new HN({id:h.prompt.id,operation:VDt({operations:h.operations,input:h.prompt.operation}),arguments:h.prompt.arguments,value:h.prompt.value}),o.transformDescribe=h=>new QBt({text:h.prompt.text,executes:h.prompt.executes.map(b=>(0,o.transformExecute)({operations:h.operations,prompt:b}))})})(cBt||(cBt={}));const VDt=o=>{var b;const h=(b=o.operations.get(o.input.controller))==null?void 0:b.get(o.input.function);if(h===void 0)throw new Error(`No operation found: (controller: ${o.input.controller}, function: ${o.input.function})`);return h};class T7e{constructor(h){var b,_;this.props=h,this.operations_=sBt.compose({controllers:h.controllers,config:h.config}),this.stack_=[],this.listeners_=new Map,this.prompt_histories_=(h.histories??[]).map(O=>cBt.transform({operations:this.operations_.group,prompt:O})),this.token_usage_=uX.zero(),this.ready_=!1,this.executor_=typeof((b=h.config)==null?void 0:b.executor)=="function"?h.config.executor:aBt.execute(((_=h.config)==null?void 0:_.executor)??null)}clone(){var h;return new T7e({...this.props,histories:(h=this.props.histories)==null?void 0:h.slice()})}async conversate(h){const b=new Gj({role:"user",text:h});await this.dispatch(new tjt({role:"user",stream:kw.to(h),done:()=>!0,get:()=>h,join:()=>Promise.resolve(h)}));const _=await this.executor_(this.getContext({prompt:b,usage:this.token_usage_}));return this.prompt_histories_.push(b,..._),[b,..._]}getConfig(){return this.props.config}getVendor(){return this.props.vendor}getControllers(){return this.props.controllers}getOperations(){return this.operations_.array}getPromptHistories(){return this.prompt_histories_}getTokenUsage(){return this.token_usage_}getContext(h){const b=_=>this.dispatch(_);return{operations:this.operations_,config:this.props.config,histories:this.prompt_histories_,stack:this.stack_,ready:()=>this.ready_,prompt:h.prompt,dispatch:_=>this.dispatch(_),request:async(_,O)=>{const P=new KPn({source:_,body:{...O,model:this.props.vendor.model,stream:!0},options:this.props.vendor.options});await b(P);const B=await this.props.vendor.api.chat.completions.create(P.body,P.options),[G,Z]=kw.transform(B.toReadableStream(),ot=>V5.transformCompletionChunk(ot)).tee(),[q,nt]=Z.tee();return(async()=>{const ot=q.getReader();for(;;){const ut=await ot.read();if(ut.done)break;ut.value.usage&&oBt.aggregate({kind:_,completionUsage:ut.value.usage,usage:h.usage})}})(),await b({type:"response",source:_,stream:G,body:P.body,options:P.options,join:async()=>{const ot=await kw.readAll(G);return V5.merge(ot)}}),nt},initialize:async()=>{this.ready_=!0,await b(new xMn)}}}on(h,b){return E7e(this.listeners_,h,()=>new Set).add(b),this}off(h,b){const _=this.listeners_.get(h);return _&&(_.delete(b),_.size===0&&this.listeners_.delete(h)),this}async dispatch(h){const b=this.listeners_.get(h.type);b&&await Promise.all(Array.from(b).map(async _=>{try{await _(h)}catch{}}))}}const uBt="RFC3986",lBt={RFC1738:o=>String(o).replace(/%20/g,"+"),RFC3986:o=>String(o)},kMn="RFC1738",_Mn=Array.isArray,u6=(()=>{const o=[];for(let h=0;h<256;++h)o.push("%"+((h<16?"0":"")+h.toString(16)).toUpperCase());return o})(),YDt=1024,EMn=(o,h,b,_,O)=>{if(o.length===0)return o;let P=o;if(typeof o=="symbol"?P=Symbol.prototype.toString.call(o):typeof o!="string"&&(P=String(o)),b==="iso-8859-1")return escape(P).replace(/%u[0-9a-f]{4}/gi,function(G){return"%26%23"+parseInt(G.slice(2),16)+"%3B"});let B="";for(let G=0;G<P.length;G+=YDt){const Z=P.length>=YDt?P.slice(G,G+YDt):P,q=[];for(let nt=0;nt<Z.length;++nt){let ot=Z.charCodeAt(nt);if(ot===45||ot===46||ot===95||ot===126||ot>=48&&ot<=57||ot>=65&&ot<=90||ot>=97&&ot<=122||O===kMn&&(ot===40||ot===41)){q[q.length]=Z.charAt(nt);continue}if(ot<128){q[q.length]=u6[ot];continue}if(ot<2048){q[q.length]=u6[192|ot>>6]+u6[128|ot&63];continue}if(ot<55296||ot>=57344){q[q.length]=u6[224|ot>>12]+u6[128|ot>>6&63]+u6[128|ot&63];continue}nt+=1,ot=65536+((ot&1023)<<10|Z.charCodeAt(nt)&1023),q[q.length]=u6[240|ot>>18]+u6[128|ot>>12&63]+u6[128|ot>>6&63]+u6[128|ot&63]}B+=q.join("")}return B};function TMn(o){return!o||typeof o!="object"?!1:!!(o.constructor&&o.constructor.isBuffer&&o.constructor.isBuffer(o))}function Y8e(o,h){if(_Mn(o)){const b=[];for(let _=0;_<o.length;_+=1)b.push(h(o[_]));return b}return h(o)}const SMn=Object.prototype.hasOwnProperty,S7e={brackets(o){return String(o)+"[]"},comma:"comma",indices(o,h){return String(o)+"["+h+"]"},repeat(o){return String(o)}},h6=Array.isArray,IMn=Array.prototype.push,I7e=function(o,h){IMn.apply(o,h6(h)?h:[h])},CMn=Date.prototype.toISOString,Jp={addQueryPrefix:!1,allowDots:!1,allowEmptyArrays:!1,arrayFormat:"indices",charset:"utf-8",charsetSentinel:!1,delimiter:"&",encode:!0,encodeDotInKeys:!1,encoder:EMn,encodeValuesOnly:!1,format:uBt,formatter:lBt[uBt],indices:!1,serializeDate(o){return CMn.call(o)},skipNulls:!1,strictNullHandling:!1};function AMn(o){return typeof o=="string"||typeof o=="number"||typeof o=="boolean"||typeof o=="symbol"||typeof o=="bigint"}const JDt={};function C7e(o,h,b,_,O,P,B,G,Z,q,nt,ot,ut,dt,st,Mt,Ut,Jt){let ce=o,oe=Jt,Be=0,Nn=!1;for(;(oe=oe.get(JDt))!==void 0&&!Nn;){const Pr=oe.get(o);if(Be+=1,typeof Pr<"u"){if(Pr===Be)throw new RangeError("Cyclic object value");Nn=!0}typeof oe.get(JDt)>"u"&&(Be=0)}if(typeof q=="function"?ce=q(h,ce):ce instanceof Date?ce=ut==null?void 0:ut(ce):b==="comma"&&h6(ce)&&(ce=Y8e(ce,function(Pr){return Pr instanceof Date?ut==null?void 0:ut(Pr):Pr})),ce===null){if(P)return Z&&!Mt?Z(h,Jp.encoder,Ut,"key",dt):h;ce=""}if(AMn(ce)||TMn(ce)){if(Z){const Pr=Mt?h:Z(h,Jp.encoder,Ut,"key",dt);return[(st==null?void 0:st(Pr))+"="+(st==null?void 0:st(Z(ce,Jp.encoder,Ut,"value",dt)))]}return[(st==null?void 0:st(h))+"="+(st==null?void 0:st(String(ce)))]}const Ce=[];if(typeof ce>"u")return Ce;let Jn;if(b==="comma"&&h6(ce))Mt&&Z&&(ce=Y8e(ce,Z)),Jn=[{value:ce.length>0?ce.join(",")||null:void 0}];else if(h6(q))Jn=q;else{const Pr=Object.keys(ce);Jn=nt?Pr.sort(nt):Pr}const $r=G?String(h).replace(/\./g,"%2E"):String(h),Br=_&&h6(ce)&&ce.length===1?$r+"[]":$r;if(O&&h6(ce)&&ce.length===0)return Br+"[]";for(let Pr=0;Pr<Jn.length;++Pr){const qn=Jn[Pr],Je=typeof qn=="object"&&typeof qn.value<"u"?qn.value:ce[qn];if(B&&Je===null)continue;const lr=ot&&G?qn.replace(/\./g,"%2E"):qn,Wt=h6(ce)?typeof b=="function"?b(Br,lr):Br:Br+(ot?"."+lr:"["+lr+"]");Jt.set(o,Be);const Ae=new WeakMap;Ae.set(JDt,Jt),I7e(Ce,C7e(Je,Wt,b,_,O,P,B,G,b==="comma"&&Mt&&h6(ce)?null:Z,q,nt,ot,ut,dt,st,Mt,Ut,Ae))}return Ce}function OMn(o=Jp){if(typeof o.allowEmptyArrays<"u"&&typeof o.allowEmptyArrays!="boolean")throw new TypeError("`allowEmptyArrays` option can only be `true` or `false`, when provided");if(typeof o.encodeDotInKeys<"u"&&typeof o.encodeDotInKeys!="boolean")throw new TypeError("`encodeDotInKeys` option can only be `true` or `false`, when provided");if(o.encoder!==null&&typeof o.encoder<"u"&&typeof o.encoder!="function")throw new TypeError("Encoder has to be a function.");const h=o.charset||Jp.charset;if(typeof o.charset<"u"&&o.charset!=="utf-8"&&o.charset!=="iso-8859-1")throw new TypeError("The charset option must be either utf-8, iso-8859-1, or undefined");let b=uBt;if(typeof o.format<"u"){if(!SMn.call(lBt,o.format))throw new TypeError("Unknown format option provided.");b=o.format}const _=lBt[b];let O=Jp.filter;(typeof o.filter=="function"||h6(o.filter))&&(O=o.filter);let P;if(o.arrayFormat&&o.arrayFormat in S7e?P=o.arrayFormat:"indices"in o?P=o.indices?"indices":"repeat":P=Jp.arrayFormat,"commaRoundTrip"in o&&typeof o.commaRoundTrip!="boolean")throw new TypeError("`commaRoundTrip` must be a boolean, or absent");const B=typeof o.allowDots>"u"?o.encodeDotInKeys?!0:Jp.allowDots:!!o.allowDots;return{addQueryPrefix:typeof o.addQueryPrefix=="boolean"?o.addQueryPrefix:Jp.addQueryPrefix,allowDots:B,allowEmptyArrays:typeof o.allowEmptyArrays=="boolean"?!!o.allowEmptyArrays:Jp.allowEmptyArrays,arrayFormat:P,charset:h,charsetSentinel:typeof o.charsetSentinel=="boolean"?o.charsetSentinel:Jp.charsetSentinel,commaRoundTrip:!!o.commaRoundTrip,delimiter:typeof o.delimiter>"u"?Jp.delimiter:o.delimiter,encode:typeof o.encode=="boolean"?o.encode:Jp.encode,encodeDotInKeys:typeof o.encodeDotInKeys=="boolean"?o.encodeDotInKeys:Jp.encodeDotInKeys,encoder:typeof o.encoder=="function"?o.encoder:Jp.encoder,encodeValuesOnly:typeof o.encodeValuesOnly=="boolean"?o.encodeValuesOnly:Jp.encodeValuesOnly,filter:O,format:b,formatter:_,serializeDate:typeof o.serializeDate=="function"?o.serializeDate:Jp.serializeDate,skipNulls:typeof o.skipNulls=="boolean"?o.skipNulls:Jp.skipNulls,sort:typeof o.sort=="function"?o.sort:null,strictNullHandling:typeof o.strictNullHandling=="boolean"?o.strictNullHandling:Jp.strictNullHandling}}function NMn(o,h={}){let b=o;const _=OMn(h);let O,P;typeof _.filter=="function"?(P=_.filter,b=P("",b)):h6(_.filter)&&(P=_.filter,O=P);const B=[];if(typeof b!="object"||b===null)return"";const G=S7e[_.arrayFormat],Z=G==="comma"&&_.commaRoundTrip;O||(O=Object.keys(b)),_.sort&&O.sort(_.sort);const q=new WeakMap;for(let ut=0;ut<O.length;++ut){const dt=O[ut];_.skipNulls&&b[dt]===null||I7e(B,C7e(b[dt],dt,G,Z,_.allowEmptyArrays,_.strictNullHandling,_.skipNulls,_.encodeDotInKeys,_.encode?_.encoder:null,_.filter,_.sort,_.allowDots,_.serializeDate,_.format,_.formatter,_.encodeValuesOnly,_.charset,q))}const nt=B.join(_.delimiter);let ot=_.addQueryPrefix===!0?"?":"";return _.charsetSentinel&&(_.charset==="iso-8859-1"?ot+="utf8=%26%2310003%3B&":ot+="utf8=%E2%9C%93&"),nt.length>0?ot+nt:""}const xj="4.87.3";let J8e=!1,lX,A7e,O7e,hBt,N7e,P7e,L7e,M7e,D7e;function PMn(o,h={auto:!1}){if(J8e)throw new Error(`you must \`import 'openai/shims/${o.kind}'\` before importing anything else from openai`);if(lX)throw new Error(`can't \`import 'openai/shims/${o.kind}'\` after \`import 'openai/shims/${lX}'\``);J8e=h.auto,lX=o.kind,A7e=o.fetch,O7e=o.FormData,hBt=o.File,N7e=o.ReadableStream,P7e=o.getMultipartRequestOptions,L7e=o.getDefaultAgent,M7e=o.fileFromPath,D7e=o.isFsReadStream}class LMn{constructor(h){this.body=h}get[Symbol.toStringTag](){return"MultipartBody"}}function MMn({manuallyImported:o}={}){const h=o?"You may need to use polyfills":"Add one of these imports before your first `import … from 'openai'`:\n- `import 'openai/shims/node'` (if you're running on Node)\n- `import 'openai/shims/web'` (otherwise)\n";let b,_,O,P;try{b=fetch,_=Request,O=Response,P=Headers}catch(B){throw new Error(`this environment is missing the following Web Fetch API type: ${B.message}. ${h}`)}return{kind:"web",fetch:b,Request:_,Response:O,Headers:P,FormData:typeof FormData<"u"?FormData:class{constructor(){throw new Error(`file uploads aren't supported in this environment yet as 'FormData' is undefined. ${h}`)}},Blob:typeof Blob<"u"?Blob:class{constructor(){throw new Error(`file uploads aren't supported in this environment yet as 'Blob' is undefined. ${h}`)}},File:typeof File<"u"?File:class{constructor(){throw new Error(`file uploads aren't supported in this environment yet as 'File' is undefined. ${h}`)}},ReadableStream:typeof ReadableStream<"u"?ReadableStream:class{constructor(){throw new Error(`streaming isn't supported in this environment yet as 'ReadableStream' is undefined. ${h}`)}},getMultipartRequestOptions:async(B,G)=>({...G,body:new LMn(B)}),getDefaultAgent:B=>{},fileFromPath:()=>{throw new Error("The `fileFromPath` function is only supported in Node. See the README for more details: https://www.github.com/openai/openai-node#file-uploads")},isFsReadStream:B=>!1}}lX||PMn(MMn(),{auto:!0});class As extends Error{}class Cg extends As{constructor(h,b,_,O){super(`${Cg.makeMessage(h,b,_)}`),this.status=h,this.headers=O,this.request_id=O==null?void 0:O["x-request-id"],this.error=b;const P=b;this.code=P==null?void 0:P.code,this.param=P==null?void 0:P.param,this.type=P==null?void 0:P.type}static makeMessage(h,b,_){const O=b!=null&&b.message?typeof b.message=="string"?b.message:JSON.stringify(b.message):b?JSON.stringify(b):_;return h&&O?`${h} ${O}`:h?`${h} status code (no body)`:O||"(no status code or body)"}static generate(h,b,_,O){if(!h||!O)return new ebt({message:_,cause:dBt(b)});const P=b==null?void 0:b.error;return h===400?new R7e(h,P,_,O):h===401?new B7e(h,P,_,O):h===403?new j7e(h,P,_,O):h===404?new F7e(h,P,_,O):h===409?new $7e(h,P,_,O):h===422?new H7e(h,P,_,O):h===429?new z7e(h,P,_,O):h>=500?new U7e(h,P,_,O):new Cg(h,P,_,O)}}class k3 extends Cg{constructor({message:h}={}){super(void 0,void 0,h||"Request was aborted.",void 0)}}class ebt extends Cg{constructor({message:h,cause:b}){super(void 0,void 0,h||"Connection error.",void 0),b&&(this.cause=b)}}class ajt extends ebt{constructor({message:h}={}){super({message:h??"Request timed out."})}}class R7e extends Cg{}class B7e extends Cg{}class j7e extends Cg{}class F7e extends Cg{}class $7e extends Cg{}class H7e extends Cg{}class z7e extends Cg{}class U7e extends Cg{}class G7e extends As{constructor(){super("Could not parse response content as the length limit was reached")}}class q7e extends As{constructor(){super("Could not parse response content as the request was rejected by the content filter")}}var smt=function(o,h,b,_,O){if(_==="m")throw new TypeError("Private method is not writable");if(_==="a"&&!O)throw new TypeError("Private accessor was defined without a setter");if(typeof h=="function"?o!==h||!O:!h.has(o))throw new TypeError("Cannot write private member to an object whose class did not declare it");return _==="a"?O.call(o,b):O?O.value=b:h.set(o,b),b},jN=function(o,h,b,_){if(b==="a"&&!_)throw new TypeError("Private accessor was defined without a getter");if(typeof h=="function"?o!==h||!_:!h.has(o))throw new TypeError("Cannot read private member from an object whose class did not declare it");return b==="m"?_:b==="a"?_.call(o):_?_.value:h.get(o)},mw;class nbt{constructor(){mw.set(this,void 0),this.buffer=new Uint8Array,smt(this,mw,null,"f")}decode(h){if(h==null)return[];const b=h instanceof ArrayBuffer?new Uint8Array(h):typeof h=="string"?new TextEncoder().encode(h):h;let _=new Uint8Array(this.buffer.length+b.length);_.set(this.buffer),_.set(b,this.buffer.length),this.buffer=_;const O=[];let P;for(;(P=DMn(this.buffer,jN(this,mw,"f")))!=null;){if(P.carriage&&jN(this,mw,"f")==null){smt(this,mw,P.index,"f");continue}if(jN(this,mw,"f")!=null&&(P.index!==jN(this,mw,"f")+1||P.carriage)){O.push(this.decodeText(this.buffer.slice(0,jN(this,mw,"f")-1))),this.buffer=this.buffer.slice(jN(this,mw,"f")),smt(this,mw,null,"f");continue}const B=jN(this,mw,"f")!==null?P.preceding-1:P.preceding,G=this.decodeText(this.buffer.slice(0,B));O.push(G),this.buffer=this.buffer.slice(P.index),smt(this,mw,null,"f")}return O}decodeText(h){if(h==null)return"";if(typeof h=="string")return h;if(typeof Buffer<"u"){if(h instanceof Buffer)return h.toString();if(h instanceof Uint8Array)return Buffer.from(h).toString();throw new As(`Unexpected: received non-Uint8Array (${h.constructor.name}) stream chunk in an environment with a global "Buffer" defined, which this library assumes to be Node. Please report this error.`)}if(typeof TextDecoder<"u"){if(h instanceof Uint8Array||h instanceof ArrayBuffer)return this.textDecoder??(this.textDecoder=new TextDecoder("utf8")),this.textDecoder.decode(h);throw new As(`Unexpected: received non-Uint8Array/ArrayBuffer (${h.constructor.name}) in a web platform. Please report this error.`)}throw new As("Unexpected: neither Buffer nor TextDecoder are available as globals. Please report this error.")}flush(){return this.buffer.length?this.decode(`
|
|
2451
|
+
a specific function to call, the others would be eliminated.`}]};var aBt;(o=>{o.execute=h=>async b=>{const _=[];if(b.ready()===!1){if((h==null?void 0:h.initialize)===null)await b.initialize();else if(_.push(...await((h==null?void 0:h.initialize)??rBt.execute)(b)),b.ready()===!1)return _}if(b.stack.length!==0&&_.push(...await((h==null?void 0:h.cancel)??TX.execute)(b)),_.push(...await((h==null?void 0:h.select)??iBt.execute)(b)),b.stack.length===0)return _;for(;;){const O=await((h==null?void 0:h.call)??tBt.execute)(b);_.push(...O);const P=O.filter(B=>B.type==="execute");for(const B of P)await TX.cancelFunction(b,{reason:"completed",name:B.operation.name});if(_.push(...await((h==null?void 0:h.describe)??nBt.execute)(b,P)),P.length===0||b.stack.length===0)break}return _}})(aBt||(aBt={}));var oBt;(o=>{o.aggregate=h=>{var P,B,G,Z,q;if(!h.completionUsage)return;const b=h.usage[h.kind];b.total+=h.completionUsage.total_tokens,b.input.total+=h.completionUsage.prompt_tokens,b.input.total+=((P=h.completionUsage.prompt_tokens_details)==null?void 0:P.audio_tokens)??0,b.input.cached+=((B=h.completionUsage.prompt_tokens_details)==null?void 0:B.cached_tokens)??0,b.output.total+=h.completionUsage.completion_tokens,b.output.accepted_prediction+=((G=h.completionUsage.completion_tokens_details)==null?void 0:G.accepted_prediction_tokens)??0,b.output.reasoning+=((Z=h.completionUsage.completion_tokens_details)==null?void 0:Z.reasoning_tokens)??0,b.output.rejected_prediction+=((q=h.completionUsage.completion_tokens_details)==null?void 0:q.rejected_prediction_tokens)??0;const _=nt=>Object.entries(h.usage).filter(([ot])=>ot!=="aggregate").map(([,ot])=>nt(ot)).reduce((ot,ut)=>ot+ut,0),O=h.usage.aggregate;O.total=_(nt=>nt.total),O.input.total=_(nt=>nt.input.total),O.input.cached=_(nt=>nt.input.cached),O.output.total=_(nt=>nt.output.total),O.output.reasoning=_(nt=>nt.output.reasoning),O.output.accepted_prediction=_(nt=>nt.output.accepted_prediction),O.output.rejected_prediction=_(nt=>nt.output.rejected_prediction)}})(oBt||(oBt={}));class xMn extends tC{constructor(){super("initialize")}toJSON(){return{type:"initialize"}}}const E7e=(o,h,b)=>{const _=o.get(h);if(_)return _;const O=b();return o.set(h,O),O};var sBt;(o=>{o.compose=b=>{var q;const _=b.controllers.length===1||(()=>{const nt=b.controllers.map(ot=>ot.application.functions.map(ut=>ut.name)).flat();return new Set(nt).size===nt.length})(),O=(nt,ot)=>_?nt:`_${ot}_${nt}`,P=b.controllers.map((nt,ot)=>nt.protocol==="http"?nt.application.functions.map(ut=>({protocol:"http",controller:nt,function:ut,name:O(ut.name,ot),toJSON:()=>({protocol:"http",controller:nt.name,function:ut.name,name:O(ut.name,ot)})})):nt.application.functions.map(ut=>({protocol:"class",controller:nt,function:ut,name:O(ut.name,ot),toJSON:()=>({protocol:"class",controller:nt.name,function:ut.name,name:O(ut.name,ot)})}))).flat(),B=(q=b.config)!=null&&q.capacity&&P.length>b.config.capacity?h({array:P,capacity:b.config.capacity}):void 0,G=new Map,Z=new Map;for(const nt of P)G.set(nt.name,nt),E7e(Z,nt.controller.name,()=>new Map).set(nt.name,nt);return{array:P,divided:B,flat:G,group:Z}};const h=b=>{const _=Math.ceil(b.array.length/b.capacity),O=Math.ceil(b.array.length/_),P=b.array.slice();return new Array(_).fill(0).map(()=>P.splice(0,O))}})(sBt||(sBt={}));var cBt;(o=>{o.transform=h=>{if(h.prompt.type==="text")return(0,o.transformText)({prompt:h.prompt});if(h.prompt.type==="select")return(0,o.transformSelect)({operations:h.operations,prompt:h.prompt});if(h.prompt.type==="cancel")return(0,o.transformCancel)({operations:h.operations,prompt:h.prompt});if(h.prompt.type==="execute")return(0,o.transformExecute)({operations:h.operations,prompt:h.prompt});if(h.prompt.type==="describe")return(0,o.transformDescribe)({operations:h.operations,prompt:h.prompt});throw new Error("Invalid prompt type.")},o.transformText=h=>new Gj(h.prompt),o.transformSelect=h=>new Mmt({id:h.prompt.id,selections:h.prompt.selections.map(b=>new YN({operation:VDt({operations:h.operations,input:b.operation}),reason:b.reason}))}),o.transformCancel=h=>new GPn({id:h.prompt.id,selections:h.prompt.selections.map(b=>new YN({operation:VDt({operations:h.operations,input:b.operation}),reason:b.reason}))}),o.transformExecute=h=>new HN({id:h.prompt.id,operation:VDt({operations:h.operations,input:h.prompt.operation}),arguments:h.prompt.arguments,value:h.prompt.value}),o.transformDescribe=h=>new QBt({text:h.prompt.text,executes:h.prompt.executes.map(b=>(0,o.transformExecute)({operations:h.operations,prompt:b}))})})(cBt||(cBt={}));const VDt=o=>{var b;const h=(b=o.operations.get(o.input.controller))==null?void 0:b.get(o.input.function);if(h===void 0)throw new Error(`No operation found: (controller: ${o.input.controller}, function: ${o.input.function})`);return h};class T7e{constructor(h){var b,_;this.props=h,this.operations_=sBt.compose({controllers:h.controllers,config:h.config}),this.stack_=[],this.listeners_=new Map,this.prompt_histories_=(h.histories??[]).map(O=>cBt.transform({operations:this.operations_.group,prompt:O})),this.token_usage_=uX.zero(),this.ready_=!1,this.executor_=typeof((b=h.config)==null?void 0:b.executor)=="function"?h.config.executor:aBt.execute(((_=h.config)==null?void 0:_.executor)??null)}clone(){var h;return new T7e({...this.props,histories:(h=this.props.histories)==null?void 0:h.slice()})}async conversate(h){const b=new Gj({role:"user",text:h});await this.dispatch(new tjt({role:"user",stream:kw.to(h),done:()=>!0,get:()=>h,join:()=>Promise.resolve(h)}));const _=await this.executor_(this.getContext({prompt:b,usage:this.token_usage_}));return this.prompt_histories_.push(b,..._),[b,..._]}getConfig(){return this.props.config}getVendor(){return this.props.vendor}getControllers(){return this.props.controllers}getOperations(){return this.operations_.array}getPromptHistories(){return this.prompt_histories_}getTokenUsage(){return this.token_usage_}getContext(h){const b=_=>this.dispatch(_);return{operations:this.operations_,config:this.props.config,histories:this.prompt_histories_,stack:this.stack_,ready:()=>this.ready_,prompt:h.prompt,dispatch:_=>this.dispatch(_),request:async(_,O)=>{const P=new KPn({source:_,body:{...O,model:this.props.vendor.model,stream:!0,stream_options:{include_usage:!0}},options:this.props.vendor.options});await b(P);const B=await this.props.vendor.api.chat.completions.create(P.body,P.options),[G,Z]=kw.transform(B.toReadableStream(),ot=>V5.transformCompletionChunk(ot)).tee(),[q,nt]=Z.tee();return(async()=>{const ot=q.getReader();for(;;){const ut=await ot.read();if(ut.done)break;ut.value.usage&&oBt.aggregate({kind:_,completionUsage:ut.value.usage,usage:h.usage})}})(),await b({type:"response",source:_,stream:G,body:P.body,options:P.options,join:async()=>{const ot=await kw.readAll(G);return V5.merge(ot)}}),nt},initialize:async()=>{this.ready_=!0,await b(new xMn)}}}on(h,b){return E7e(this.listeners_,h,()=>new Set).add(b),this}off(h,b){const _=this.listeners_.get(h);return _&&(_.delete(b),_.size===0&&this.listeners_.delete(h)),this}async dispatch(h){const b=this.listeners_.get(h.type);b&&await Promise.all(Array.from(b).map(async _=>{try{await _(h)}catch{}}))}}const uBt="RFC3986",lBt={RFC1738:o=>String(o).replace(/%20/g,"+"),RFC3986:o=>String(o)},kMn="RFC1738",_Mn=Array.isArray,u6=(()=>{const o=[];for(let h=0;h<256;++h)o.push("%"+((h<16?"0":"")+h.toString(16)).toUpperCase());return o})(),YDt=1024,EMn=(o,h,b,_,O)=>{if(o.length===0)return o;let P=o;if(typeof o=="symbol"?P=Symbol.prototype.toString.call(o):typeof o!="string"&&(P=String(o)),b==="iso-8859-1")return escape(P).replace(/%u[0-9a-f]{4}/gi,function(G){return"%26%23"+parseInt(G.slice(2),16)+"%3B"});let B="";for(let G=0;G<P.length;G+=YDt){const Z=P.length>=YDt?P.slice(G,G+YDt):P,q=[];for(let nt=0;nt<Z.length;++nt){let ot=Z.charCodeAt(nt);if(ot===45||ot===46||ot===95||ot===126||ot>=48&&ot<=57||ot>=65&&ot<=90||ot>=97&&ot<=122||O===kMn&&(ot===40||ot===41)){q[q.length]=Z.charAt(nt);continue}if(ot<128){q[q.length]=u6[ot];continue}if(ot<2048){q[q.length]=u6[192|ot>>6]+u6[128|ot&63];continue}if(ot<55296||ot>=57344){q[q.length]=u6[224|ot>>12]+u6[128|ot>>6&63]+u6[128|ot&63];continue}nt+=1,ot=65536+((ot&1023)<<10|Z.charCodeAt(nt)&1023),q[q.length]=u6[240|ot>>18]+u6[128|ot>>12&63]+u6[128|ot>>6&63]+u6[128|ot&63]}B+=q.join("")}return B};function TMn(o){return!o||typeof o!="object"?!1:!!(o.constructor&&o.constructor.isBuffer&&o.constructor.isBuffer(o))}function Y8e(o,h){if(_Mn(o)){const b=[];for(let _=0;_<o.length;_+=1)b.push(h(o[_]));return b}return h(o)}const SMn=Object.prototype.hasOwnProperty,S7e={brackets(o){return String(o)+"[]"},comma:"comma",indices(o,h){return String(o)+"["+h+"]"},repeat(o){return String(o)}},h6=Array.isArray,IMn=Array.prototype.push,I7e=function(o,h){IMn.apply(o,h6(h)?h:[h])},CMn=Date.prototype.toISOString,Jp={addQueryPrefix:!1,allowDots:!1,allowEmptyArrays:!1,arrayFormat:"indices",charset:"utf-8",charsetSentinel:!1,delimiter:"&",encode:!0,encodeDotInKeys:!1,encoder:EMn,encodeValuesOnly:!1,format:uBt,formatter:lBt[uBt],indices:!1,serializeDate(o){return CMn.call(o)},skipNulls:!1,strictNullHandling:!1};function AMn(o){return typeof o=="string"||typeof o=="number"||typeof o=="boolean"||typeof o=="symbol"||typeof o=="bigint"}const JDt={};function C7e(o,h,b,_,O,P,B,G,Z,q,nt,ot,ut,dt,st,Mt,Ut,Jt){let ce=o,oe=Jt,Be=0,Nn=!1;for(;(oe=oe.get(JDt))!==void 0&&!Nn;){const Pr=oe.get(o);if(Be+=1,typeof Pr<"u"){if(Pr===Be)throw new RangeError("Cyclic object value");Nn=!0}typeof oe.get(JDt)>"u"&&(Be=0)}if(typeof q=="function"?ce=q(h,ce):ce instanceof Date?ce=ut==null?void 0:ut(ce):b==="comma"&&h6(ce)&&(ce=Y8e(ce,function(Pr){return Pr instanceof Date?ut==null?void 0:ut(Pr):Pr})),ce===null){if(P)return Z&&!Mt?Z(h,Jp.encoder,Ut,"key",dt):h;ce=""}if(AMn(ce)||TMn(ce)){if(Z){const Pr=Mt?h:Z(h,Jp.encoder,Ut,"key",dt);return[(st==null?void 0:st(Pr))+"="+(st==null?void 0:st(Z(ce,Jp.encoder,Ut,"value",dt)))]}return[(st==null?void 0:st(h))+"="+(st==null?void 0:st(String(ce)))]}const Ce=[];if(typeof ce>"u")return Ce;let Jn;if(b==="comma"&&h6(ce))Mt&&Z&&(ce=Y8e(ce,Z)),Jn=[{value:ce.length>0?ce.join(",")||null:void 0}];else if(h6(q))Jn=q;else{const Pr=Object.keys(ce);Jn=nt?Pr.sort(nt):Pr}const $r=G?String(h).replace(/\./g,"%2E"):String(h),Br=_&&h6(ce)&&ce.length===1?$r+"[]":$r;if(O&&h6(ce)&&ce.length===0)return Br+"[]";for(let Pr=0;Pr<Jn.length;++Pr){const qn=Jn[Pr],Je=typeof qn=="object"&&typeof qn.value<"u"?qn.value:ce[qn];if(B&&Je===null)continue;const lr=ot&&G?qn.replace(/\./g,"%2E"):qn,Wt=h6(ce)?typeof b=="function"?b(Br,lr):Br:Br+(ot?"."+lr:"["+lr+"]");Jt.set(o,Be);const Ae=new WeakMap;Ae.set(JDt,Jt),I7e(Ce,C7e(Je,Wt,b,_,O,P,B,G,b==="comma"&&Mt&&h6(ce)?null:Z,q,nt,ot,ut,dt,st,Mt,Ut,Ae))}return Ce}function OMn(o=Jp){if(typeof o.allowEmptyArrays<"u"&&typeof o.allowEmptyArrays!="boolean")throw new TypeError("`allowEmptyArrays` option can only be `true` or `false`, when provided");if(typeof o.encodeDotInKeys<"u"&&typeof o.encodeDotInKeys!="boolean")throw new TypeError("`encodeDotInKeys` option can only be `true` or `false`, when provided");if(o.encoder!==null&&typeof o.encoder<"u"&&typeof o.encoder!="function")throw new TypeError("Encoder has to be a function.");const h=o.charset||Jp.charset;if(typeof o.charset<"u"&&o.charset!=="utf-8"&&o.charset!=="iso-8859-1")throw new TypeError("The charset option must be either utf-8, iso-8859-1, or undefined");let b=uBt;if(typeof o.format<"u"){if(!SMn.call(lBt,o.format))throw new TypeError("Unknown format option provided.");b=o.format}const _=lBt[b];let O=Jp.filter;(typeof o.filter=="function"||h6(o.filter))&&(O=o.filter);let P;if(o.arrayFormat&&o.arrayFormat in S7e?P=o.arrayFormat:"indices"in o?P=o.indices?"indices":"repeat":P=Jp.arrayFormat,"commaRoundTrip"in o&&typeof o.commaRoundTrip!="boolean")throw new TypeError("`commaRoundTrip` must be a boolean, or absent");const B=typeof o.allowDots>"u"?o.encodeDotInKeys?!0:Jp.allowDots:!!o.allowDots;return{addQueryPrefix:typeof o.addQueryPrefix=="boolean"?o.addQueryPrefix:Jp.addQueryPrefix,allowDots:B,allowEmptyArrays:typeof o.allowEmptyArrays=="boolean"?!!o.allowEmptyArrays:Jp.allowEmptyArrays,arrayFormat:P,charset:h,charsetSentinel:typeof o.charsetSentinel=="boolean"?o.charsetSentinel:Jp.charsetSentinel,commaRoundTrip:!!o.commaRoundTrip,delimiter:typeof o.delimiter>"u"?Jp.delimiter:o.delimiter,encode:typeof o.encode=="boolean"?o.encode:Jp.encode,encodeDotInKeys:typeof o.encodeDotInKeys=="boolean"?o.encodeDotInKeys:Jp.encodeDotInKeys,encoder:typeof o.encoder=="function"?o.encoder:Jp.encoder,encodeValuesOnly:typeof o.encodeValuesOnly=="boolean"?o.encodeValuesOnly:Jp.encodeValuesOnly,filter:O,format:b,formatter:_,serializeDate:typeof o.serializeDate=="function"?o.serializeDate:Jp.serializeDate,skipNulls:typeof o.skipNulls=="boolean"?o.skipNulls:Jp.skipNulls,sort:typeof o.sort=="function"?o.sort:null,strictNullHandling:typeof o.strictNullHandling=="boolean"?o.strictNullHandling:Jp.strictNullHandling}}function NMn(o,h={}){let b=o;const _=OMn(h);let O,P;typeof _.filter=="function"?(P=_.filter,b=P("",b)):h6(_.filter)&&(P=_.filter,O=P);const B=[];if(typeof b!="object"||b===null)return"";const G=S7e[_.arrayFormat],Z=G==="comma"&&_.commaRoundTrip;O||(O=Object.keys(b)),_.sort&&O.sort(_.sort);const q=new WeakMap;for(let ut=0;ut<O.length;++ut){const dt=O[ut];_.skipNulls&&b[dt]===null||I7e(B,C7e(b[dt],dt,G,Z,_.allowEmptyArrays,_.strictNullHandling,_.skipNulls,_.encodeDotInKeys,_.encode?_.encoder:null,_.filter,_.sort,_.allowDots,_.serializeDate,_.format,_.formatter,_.encodeValuesOnly,_.charset,q))}const nt=B.join(_.delimiter);let ot=_.addQueryPrefix===!0?"?":"";return _.charsetSentinel&&(_.charset==="iso-8859-1"?ot+="utf8=%26%2310003%3B&":ot+="utf8=%E2%9C%93&"),nt.length>0?ot+nt:""}const xj="4.87.3";let J8e=!1,lX,A7e,O7e,hBt,N7e,P7e,L7e,M7e,D7e;function PMn(o,h={auto:!1}){if(J8e)throw new Error(`you must \`import 'openai/shims/${o.kind}'\` before importing anything else from openai`);if(lX)throw new Error(`can't \`import 'openai/shims/${o.kind}'\` after \`import 'openai/shims/${lX}'\``);J8e=h.auto,lX=o.kind,A7e=o.fetch,O7e=o.FormData,hBt=o.File,N7e=o.ReadableStream,P7e=o.getMultipartRequestOptions,L7e=o.getDefaultAgent,M7e=o.fileFromPath,D7e=o.isFsReadStream}class LMn{constructor(h){this.body=h}get[Symbol.toStringTag](){return"MultipartBody"}}function MMn({manuallyImported:o}={}){const h=o?"You may need to use polyfills":"Add one of these imports before your first `import … from 'openai'`:\n- `import 'openai/shims/node'` (if you're running on Node)\n- `import 'openai/shims/web'` (otherwise)\n";let b,_,O,P;try{b=fetch,_=Request,O=Response,P=Headers}catch(B){throw new Error(`this environment is missing the following Web Fetch API type: ${B.message}. ${h}`)}return{kind:"web",fetch:b,Request:_,Response:O,Headers:P,FormData:typeof FormData<"u"?FormData:class{constructor(){throw new Error(`file uploads aren't supported in this environment yet as 'FormData' is undefined. ${h}`)}},Blob:typeof Blob<"u"?Blob:class{constructor(){throw new Error(`file uploads aren't supported in this environment yet as 'Blob' is undefined. ${h}`)}},File:typeof File<"u"?File:class{constructor(){throw new Error(`file uploads aren't supported in this environment yet as 'File' is undefined. ${h}`)}},ReadableStream:typeof ReadableStream<"u"?ReadableStream:class{constructor(){throw new Error(`streaming isn't supported in this environment yet as 'ReadableStream' is undefined. ${h}`)}},getMultipartRequestOptions:async(B,G)=>({...G,body:new LMn(B)}),getDefaultAgent:B=>{},fileFromPath:()=>{throw new Error("The `fileFromPath` function is only supported in Node. See the README for more details: https://www.github.com/openai/openai-node#file-uploads")},isFsReadStream:B=>!1}}lX||PMn(MMn(),{auto:!0});class As extends Error{}class Cg extends As{constructor(h,b,_,O){super(`${Cg.makeMessage(h,b,_)}`),this.status=h,this.headers=O,this.request_id=O==null?void 0:O["x-request-id"],this.error=b;const P=b;this.code=P==null?void 0:P.code,this.param=P==null?void 0:P.param,this.type=P==null?void 0:P.type}static makeMessage(h,b,_){const O=b!=null&&b.message?typeof b.message=="string"?b.message:JSON.stringify(b.message):b?JSON.stringify(b):_;return h&&O?`${h} ${O}`:h?`${h} status code (no body)`:O||"(no status code or body)"}static generate(h,b,_,O){if(!h||!O)return new ebt({message:_,cause:dBt(b)});const P=b==null?void 0:b.error;return h===400?new R7e(h,P,_,O):h===401?new B7e(h,P,_,O):h===403?new j7e(h,P,_,O):h===404?new F7e(h,P,_,O):h===409?new $7e(h,P,_,O):h===422?new H7e(h,P,_,O):h===429?new z7e(h,P,_,O):h>=500?new U7e(h,P,_,O):new Cg(h,P,_,O)}}class k3 extends Cg{constructor({message:h}={}){super(void 0,void 0,h||"Request was aborted.",void 0)}}class ebt extends Cg{constructor({message:h,cause:b}){super(void 0,void 0,h||"Connection error.",void 0),b&&(this.cause=b)}}class ajt extends ebt{constructor({message:h}={}){super({message:h??"Request timed out."})}}class R7e extends Cg{}class B7e extends Cg{}class j7e extends Cg{}class F7e extends Cg{}class $7e extends Cg{}class H7e extends Cg{}class z7e extends Cg{}class U7e extends Cg{}class G7e extends As{constructor(){super("Could not parse response content as the length limit was reached")}}class q7e extends As{constructor(){super("Could not parse response content as the request was rejected by the content filter")}}var smt=function(o,h,b,_,O){if(_==="m")throw new TypeError("Private method is not writable");if(_==="a"&&!O)throw new TypeError("Private accessor was defined without a setter");if(typeof h=="function"?o!==h||!O:!h.has(o))throw new TypeError("Cannot write private member to an object whose class did not declare it");return _==="a"?O.call(o,b):O?O.value=b:h.set(o,b),b},jN=function(o,h,b,_){if(b==="a"&&!_)throw new TypeError("Private accessor was defined without a getter");if(typeof h=="function"?o!==h||!_:!h.has(o))throw new TypeError("Cannot read private member from an object whose class did not declare it");return b==="m"?_:b==="a"?_.call(o):_?_.value:h.get(o)},mw;class nbt{constructor(){mw.set(this,void 0),this.buffer=new Uint8Array,smt(this,mw,null,"f")}decode(h){if(h==null)return[];const b=h instanceof ArrayBuffer?new Uint8Array(h):typeof h=="string"?new TextEncoder().encode(h):h;let _=new Uint8Array(this.buffer.length+b.length);_.set(this.buffer),_.set(b,this.buffer.length),this.buffer=_;const O=[];let P;for(;(P=DMn(this.buffer,jN(this,mw,"f")))!=null;){if(P.carriage&&jN(this,mw,"f")==null){smt(this,mw,P.index,"f");continue}if(jN(this,mw,"f")!=null&&(P.index!==jN(this,mw,"f")+1||P.carriage)){O.push(this.decodeText(this.buffer.slice(0,jN(this,mw,"f")-1))),this.buffer=this.buffer.slice(jN(this,mw,"f")),smt(this,mw,null,"f");continue}const B=jN(this,mw,"f")!==null?P.preceding-1:P.preceding,G=this.decodeText(this.buffer.slice(0,B));O.push(G),this.buffer=this.buffer.slice(P.index),smt(this,mw,null,"f")}return O}decodeText(h){if(h==null)return"";if(typeof h=="string")return h;if(typeof Buffer<"u"){if(h instanceof Buffer)return h.toString();if(h instanceof Uint8Array)return Buffer.from(h).toString();throw new As(`Unexpected: received non-Uint8Array (${h.constructor.name}) stream chunk in an environment with a global "Buffer" defined, which this library assumes to be Node. Please report this error.`)}if(typeof TextDecoder<"u"){if(h instanceof Uint8Array||h instanceof ArrayBuffer)return this.textDecoder??(this.textDecoder=new TextDecoder("utf8")),this.textDecoder.decode(h);throw new As(`Unexpected: received non-Uint8Array/ArrayBuffer (${h.constructor.name}) in a web platform. Please report this error.`)}throw new As("Unexpected: neither Buffer nor TextDecoder are available as globals. Please report this error.")}flush(){return this.buffer.length?this.decode(`
|
|
2452
2452
|
`):[]}}mw=new WeakMap;nbt.NEWLINE_CHARS=new Set([`
|
|
2453
2453
|
`,"\r"]);nbt.NEWLINE_REGEXP=/\r\n|[\n\r]/g;function DMn(o,h){for(let O=h??0;O<o.length;O++){if(o[O]===10)return{preceding:O,index:O+1,carriage:!1};if(o[O]===13)return{preceding:O,index:O+1,carriage:!0}}return null}function RMn(o){for(let _=0;_<o.length-1;_++){if(o[_]===10&&o[_+1]===10||o[_]===13&&o[_+1]===13)return _+2;if(o[_]===13&&o[_+1]===10&&_+3<o.length&&o[_+2]===13&&o[_+3]===10)return _+4}return-1}function W7e(o){if(o[Symbol.asyncIterator])return o;const h=o.getReader();return{async next(){try{const b=await h.read();return b!=null&&b.done&&h.releaseLock(),b}catch(b){throw h.releaseLock(),b}},async return(){const b=h.cancel();return h.releaseLock(),await b,{done:!0,value:void 0}},[Symbol.asyncIterator](){return this}}}class g6{constructor(h,b){this.iterator=h,this.controller=b}static fromSSEResponse(h,b){let _=!1;async function*O(){if(_)throw new Error("Cannot iterate over a consumed stream, use `.tee()` to split the stream.");_=!0;let P=!1;try{for await(const B of BMn(h,b))if(!P){if(B.data.startsWith("[DONE]")){P=!0;continue}if(B.event===null||B.event.startsWith("response.")){let G;try{G=JSON.parse(B.data)}catch(Z){throw console.error("Could not parse message into JSON:",B.data),console.error("From chunk:",B.raw),Z}if(G&&G.error)throw new Cg(void 0,G.error,void 0,void 0);yield G}else{let G;try{G=JSON.parse(B.data)}catch(Z){throw console.error("Could not parse message into JSON:",B.data),console.error("From chunk:",B.raw),Z}if(B.event=="error")throw new Cg(void 0,G.error,G.message,void 0);yield{event:B.event,data:G}}}P=!0}catch(B){if(B instanceof Error&&B.name==="AbortError")return;throw B}finally{P||b.abort()}}return new g6(O,b)}static fromReadableStream(h,b){let _=!1;async function*O(){const B=new nbt,G=W7e(h);for await(const Z of G)for(const q of B.decode(Z))yield q;for(const Z of B.flush())yield Z}async function*P(){if(_)throw new Error("Cannot iterate over a consumed stream, use `.tee()` to split the stream.");_=!0;let B=!1;try{for await(const G of O())B||G&&(yield JSON.parse(G));B=!0}catch(G){if(G instanceof Error&&G.name==="AbortError")return;throw G}finally{B||b.abort()}}return new g6(P,b)}[Symbol.asyncIterator](){return this.iterator()}tee(){const h=[],b=[],_=this.iterator(),O=P=>({next:()=>{if(P.length===0){const B=_.next();h.push(B),b.push(B)}return P.shift()}});return[new g6(()=>O(h),this.controller),new g6(()=>O(b),this.controller)]}toReadableStream(){const h=this;let b;const _=new TextEncoder;return new N7e({async start(){b=h[Symbol.asyncIterator]()},async pull(O){try{const{value:P,done:B}=await b.next();if(B)return O.close();const G=_.encode(JSON.stringify(P)+`
|
|
2454
2454
|
`);O.enqueue(G)}catch(P){O.error(P)}},async cancel(){var O;await((O=b.return)==null?void 0:O.call(b))}})}}async function*BMn(o,h){if(!o.body)throw h.abort(),new As("Attempted to iterate over a response with no body");const b=new FMn,_=new nbt,O=W7e(o.body);for await(const P of jMn(O))for(const B of _.decode(P)){const G=b.decode(B);G&&(yield G)}for(const P of _.flush()){const B=b.decode(P);B&&(yield B)}}async function*jMn(o){let h=new Uint8Array;for await(const b of o){if(b==null)continue;const _=b instanceof ArrayBuffer?new Uint8Array(b):typeof b=="string"?new TextEncoder().encode(b):b;let O=new Uint8Array(h.length+_.length);O.set(h),O.set(_,h.length),h=O;let P;for(;(P=RMn(h))!==-1;)yield h.slice(0,P),h=h.slice(P)}h.length>0&&(yield h)}class FMn{constructor(){this.event=null,this.data=[],this.chunks=[]}decode(h){if(h.endsWith("\r")&&(h=h.substring(0,h.length-1)),!h){if(!this.event&&!this.data.length)return null;const P={event:this.event,data:this.data.join(`
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{l as x,n as K,o as F}from"./AgenticaChatApplication-DOAuu8zP.js";var A;(function(a){a.is=m=>typeof m=="object"&&m!==null&&typeof m.openapi=="string"&&m.openapi.startsWith("3.0")})(A||(A={}));var S;(function(a){a.is=m=>typeof m=="object"&&m!==null&&typeof m.openapi=="string"&&m.openapi.startsWith("3.1")})(S||(S={}));var _;(function(a){a.is=m=>typeof m=="object"&&m!==null&&typeof m.swagger=="string"&&m.swagger.startsWith("2.0")})(_||(_={}));var q;(function(a){a.convert=i=>i["x-samchon-emended"]===!0?i:{...i,components:w(i.components??{}),paths:i.paths?Object.fromEntries(Object.entries(i.paths).filter(([e,r])=>r!==void 0).map(([e,r])=>[e,O(i)(r)])):void 0,webhooks:i.webhooks?Object.fromEntries(Object.entries(i.webhooks).filter(([e,r])=>r!==void 0).map(([e,r])=>[e,m(i)(r)]).filter(([e,r])=>r!==void 0)):void 0,"x-samchon-emended":!0};const m=i=>e=>{var o,d;if(!n.isReference(e))return O(i)(e);const r=(d=(o=i.components)==null?void 0:o.pathItems)==null?void 0:d[e.$ref.split("/").pop()??""];return r?O(i)(r):void 0},O=i=>e=>({...e,...e.get?{get:b(i)(e)(e.get)}:void 0,...e.put?{put:b(i)(e)(e.put)}:void 0,...e.post?{post:b(i)(e)(e.post)}:void 0,...e.delete?{delete:b(i)(e)(e.delete)}:void 0,...e.options?{options:b(i)(e)(e.options)}:void 0,...e.head?{head:b(i)(e)(e.head)}:void 0,...e.patch?{patch:b(i)(e)(e.patch)}:void 0,...e.trace?{trace:b(i)(e)(e.trace)}:void 0}),b=i=>e=>r=>({...r,parameters:e.parameters!==void 0||r.parameters!==void 0?[...e.parameters??[],...r.parameters??[]].map(o=>{var u,s,v,p;if(!n.isReference(o))return g(i.components??{})(o);const d=o.$ref.startsWith("#/components/headers/")?(s=(u=i.components)==null?void 0:u.headers)==null?void 0:s[o.$ref.split("/").pop()??""]:(p=(v=i.components)==null?void 0:v.parameters)==null?void 0:p[o.$ref.split("/").pop()??""];return d!==void 0?g(i.components??{})({...d,in:"header"}):void 0}).filter((o,d)=>d!==void 0):void 0,requestBody:r.requestBody?$(i)(r.requestBody):void 0,responses:r.responses?Object.fromEntries(Object.entries(r.responses).filter(([o,d])=>d!==void 0).map(([o,d])=>[o,R(i)(d)]).filter(([o,d])=>d!==void 0)):void 0}),g=i=>e=>({...e,schema:l(i)(e.schema),examples:e.examples?Object.fromEntries(Object.entries(e.examples).map(([r,o])=>{var d;return[r,n.isReference(o)?(d=i.examples)==null?void 0:d[o.$ref.split("/").pop()??""]:o]}).filter(([r,o])=>o!==void 0)):void 0}),$=i=>e=>{var r,o;if(n.isReference(e)){const d=(o=(r=i.components)==null?void 0:r.requestBodies)==null?void 0:o[e.$ref.split("/").pop()??""];if(d===void 0)return;e=d}return{...e,content:e.content?E(i.components??{})(e.content):void 0}},R=i=>e=>{var r,o;if(n.isReference(e)){const d=(o=(r=i.components)==null?void 0:r.responses)==null?void 0:o[e.$ref.split("/").pop()??""];if(d===void 0)return;e=d}return{...e,content:e.content?E(i.components??{})(e.content):void 0,headers:e.headers?Object.fromEntries(Object.entries(e.headers).filter(([d,u])=>u!==void 0).map(([d,u])=>[d,(()=>{var v,p;if(n.isReference(u)===!1)return g(i.components??{})({...u,in:"header"});const s=u.$ref.startsWith("#/components/headers/")?(p=(v=i.components)==null?void 0:v.headers)==null?void 0:p[u.$ref.split("/").pop()??""]:void 0;return s!==void 0?g(i.components??{})({...s,in:"header"}):void 0})()]).filter(([d,u])=>u!==void 0)):void 0}},E=i=>e=>Object.fromEntries(Object.entries(e).filter(([r,o])=>o!==void 0).map(([r,o])=>[r,{...o,schema:o.schema?l(i)(o.schema):void 0,examples:o.examples?Object.fromEntries(Object.entries(o.examples).map(([d,u])=>{var s;return[d,n.isReference(u)?(s=i.examples)==null?void 0:s[u.$ref.split("/").pop()??""]:u]}).filter(([d,u])=>u!==void 0)):void 0}])),w=i=>({schemas:Object.fromEntries(Object.entries(i.schemas??{}).filter(([e,r])=>r!==void 0).map(([e,r])=>[e,l(i)(r)])),securitySchemes:i.securitySchemes}),l=i=>e=>{const r=[],o={title:e.title,description:e.description,...Object.fromEntries(Object.entries(e).filter(([s,v])=>s.startsWith("x-")&&v!==void 0))},d={value:!1,default:void 0},u=s=>{var v,p,j,N,z,M,U;if(s.nullable===!0&&(d.value||(d.value=!0),s.default===null&&(d.default=null)),Array.isArray(s.enum)&&((v=s.enum)!=null&&v.length)&&((p=s.enum)!=null&&p.some(c=>c===null))&&(d.value||(d.value=!0)),n.isMixed(s)){s.const!==void 0&&u({...s,type:void 0,oneOf:void 0,anyOf:void 0,allOf:void 0,$ref:void 0}),s.oneOf!==void 0&&u({...s,type:void 0,anyOf:void 0,allOf:void 0,$ref:void 0}),s.anyOf!==void 0&&u({...s,type:void 0,oneOf:void 0,allOf:void 0,$ref:void 0}),s.allOf!==void 0&&u({...s,type:void 0,oneOf:void 0,anyOf:void 0,$ref:void 0});for(const c of s.type)u(c==="boolean"||c==="number"||c==="string"?{...s,enum:(j=s.enum)!=null&&j.length&&s.enum.filter(y=>y!==null)?s.enum.filter(y=>typeof y===c):void 0,type:c}:c==="integer"?{...s,enum:(N=s.enum)!=null&&N.length&&s.enum.filter(y=>y!==null)?s.enum.filter(y=>y!==null&&typeof y=="number"&&Number.isInteger(y)):void 0,type:c}:{...s,type:c})}else if(n.isOneOf(s))s.oneOf.forEach(u);else if(n.isAnyOf(s))s.anyOf.forEach(u);else if(n.isAllOf(s))s.allOf.length===1?u(s.allOf[0]):r.push(f(i)(s));else if(n.isBoolean(s))if((z=s.enum)!=null&&z.length&&s.enum.filter(c=>c!==null).length)for(const c of s.enum.filter(y=>y!==null))r.push({const:c,...s,type:void 0,enum:void 0,default:void 0});else r.push({...s,default:s.default??void 0,enum:void 0});else if(n.isInteger(s)||n.isNumber(s))if((M=s.enum)!=null&&M.length&&s.enum.filter(c=>c!==null))for(const c of s.enum.filter(y=>y!==null))r.push({const:c,...s,type:void 0,enum:void 0,default:void 0,minimum:void 0,maximum:void 0,exclusiveMinimum:void 0,exclusiveMaximum:void 0,multipleOf:void 0});else r.push({...s,default:s.default??void 0,enum:void 0,...typeof s.exclusiveMinimum=="number"?{minimum:s.exclusiveMinimum,exclusiveMinimum:!0}:{exclusiveMinimum:s.exclusiveMinimum},...typeof s.exclusiveMaximum=="number"?{maximum:s.exclusiveMaximum,exclusiveMaximum:!0}:{exclusiveMaximum:s.exclusiveMaximum}});else if(n.isString(s))if((U=s.enum)!=null&&U.length&&s.enum.filter(c=>c!==null).length)for(const c of s.enum.filter(y=>y!==null))r.push({const:c,...s,type:void 0,enum:void 0,default:void 0});else r.push({...s,default:s.default??void 0,enum:void 0});else n.isArray(s)?Array.isArray(s.items)?r.push({...s,items:void 0,prefixItems:s.items.map(l(i)),additionalItems:typeof s.additionalItems=="object"&&s.additionalItems!==null?l(i)(s.additionalItems):s.additionalItems}):Array.isArray(s.prefixItems)?r.push({...s,items:void 0,prefixItems:s.prefixItems.map(l(i)),additionalItems:typeof s.additionalItems=="object"&&s.additionalItems!==null?l(i)(s.additionalItems):s.additionalItems}):s.items===void 0?r.push({...s,items:void 0,prefixItems:[]}):r.push({...s,items:l(i)(s.items),prefixItems:void 0,additionalItems:void 0}):n.isObject(s)?r.push({...s,properties:s.properties?Object.fromEntries(Object.entries(s.properties).filter(([c,y])=>y!==void 0).map(([c,y])=>[c,l(i)(y)])):{},additionalProperties:s.additionalProperties?typeof s.additionalProperties=="object"&&s.additionalProperties!==null?l(i)(s.additionalProperties):s.additionalProperties:void 0,required:s.required??[]}):n.isRecursiveReference(s)?r.push({...s,$ref:s.$recursiveRef,$recursiveRef:void 0}):r.push(s)};return u(e),d.value===!0&&!r.some(s=>s.type==="null")&&r.push({type:"null",default:d.default}),{...r.length===0?{type:void 0}:r.length===1?{...r[0]}:{oneOf:r.map(s=>({...s,nullable:void 0}))},...o,nullable:void 0}},f=i=>e=>{const r=e.allOf.map(o=>t(i)(o));return r.some(o=>o===null)?{type:void 0,allOf:void 0}:{...e,type:"object",properties:Object.fromEntries(r.map(o=>Object.entries((o==null?void 0:o.properties)??{})).flat().map(([o,d])=>[o,l(i)(d)])),allOf:void 0,required:[...new Set(r.map(o=>(o==null?void 0:o.required)??[]).flat())]}},t=i=>(e,r=new Set)=>{var o,d;return n.isObject(e)?e.properties!==void 0&&!e.additionalProperties?e:null:r.has(e)?null:(r.add(e),n.isReference(e)?t(i)(((o=i.schemas)==null?void 0:o[e.$ref.split("/").pop()??""])??{},r):n.isRecursiveReference(e)?t(i)(((d=i.schemas)==null?void 0:d[e.$recursiveRef.split("/").pop()??""])??{},r):null)};let n;(function(i){i.isConstant=e=>e.const!==void 0,i.isBoolean=e=>e.type==="boolean",i.isInteger=e=>e.type==="integer",i.isNumber=e=>e.type==="number",i.isString=e=>e.type==="string",i.isArray=e=>e.type==="array",i.isObject=e=>e.type==="object",i.isReference=e=>e.$ref!==void 0,i.isRecursiveReference=e=>e.$recursiveRef!==void 0,i.isAllOf=e=>e.allOf!==void 0,i.isAnyOf=e=>e.anyOf!==void 0,i.isOneOf=e=>e.oneOf!==void 0,i.isNullOnly=e=>e.type==="null",i.isMixed=e=>Array.isArray(e.type)})(n||(n={}))})(q||(q={}));var P;(function(a){a.downgrade=l=>{var t,n,i;const f=a.downgradeComponents(l.components);return{swagger:"2.0",info:l.info,host:(n=(t=l.servers)==null?void 0:t[0])!=null&&n.url?l.servers[0].url.split("://").pop():"",definitions:f.downgraded,securityDefinitions:(i=l.components)!=null&&i.securitySchemes?Object.fromEntries(Object.entries(l.components.securitySchemes).filter(([e,r])=>r!==void 0).map(([e,r])=>E(r).map(o=>[e,o])).flat()):void 0,paths:l.paths?Object.fromEntries(Object.entries(l.paths).filter(([e,r])=>r!==void 0).map(([e,r])=>[e,m(f)(r)])):void 0,security:l.security,tags:l.tags}};const m=l=>f=>({...f,...f.get?{get:O(l)(f.get)}:void 0,...f.put?{put:O(l)(f.put)}:void 0,...f.post?{post:O(l)(f.post)}:void 0,...f.delete?{delete:O(l)(f.delete)}:void 0,...f.options?{options:O(l)(f.options)}:void 0,...f.head?{head:O(l)(f.head)}:void 0,...f.patch?{patch:O(l)(f.patch)}:void 0,...f.trace?{trace:O(l)(f.trace)}:void 0}),O=l=>f=>({...f,parameters:f.parameters!==void 0||f.requestBody!==void 0?[...(f.parameters??[]).map(b(l)),...f.requestBody?[g(l)(f.requestBody)]:[]]:void 0,responses:f.responses?Object.fromEntries(Object.entries(f.responses).filter(([t,n])=>n!==void 0).map(([t,n])=>[t,$(l)(n)])):void 0,requestBody:void 0,servers:void 0}),b=l=>(f,t)=>{var n;return{...a.downgradeSchema(l)(f.schema),...f,required:(n=f.schema)==null?void 0:n.required,schema:void 0,name:f.name??`p${t}`,example:void 0,examples:void 0}},g=l=>f=>{var t;return{name:"body",in:"body",description:f.description,required:f.required,schema:a.downgradeSchema(l)(((t=Object.values(f.content??{})[0])==null?void 0:t.schema)??{})}},$=l=>f=>{var t;return{description:f.description,schema:a.downgradeSchema(l)(((t=Object.values(f.content??{})[0])==null?void 0:t.schema)??{}),headers:f.headers?Object.fromEntries(Object.entries(f.headers).filter(([n,i])=>i!==void 0).map(([n,i])=>[n,{...i,schema:a.downgradeSchema(l)(i.schema),example:void 0,examples:void 0}])):void 0}};a.downgradeComponents=l=>{const f={original:l,downgraded:{}};if(l.schemas){f.downgraded.schemas={};for(const[t,n]of Object.entries(l.schemas))n!==void 0&&(f.downgraded[t.split("/").pop()]=a.downgradeSchema(f)(n))}return f},a.downgradeSchema=l=>f=>{const t=w(new Set)(l.original)(f),n=[],i={title:f.title,description:f.description,example:f.example,examples:f.examples?Object.values(f.examples):void 0,...Object.fromEntries(Object.entries(f).filter(([r,o])=>r.startsWith("x-")&&o!==void 0))},e=r=>{x.isBoolean(r)?n.push({type:"boolean"}):x.isBoolean(r)||x.isInteger(r)||x.isNumber(r)||x.isString(r)?n.push({...r,examples:r.examples?Object.values(r.examples):void 0}):x.isReference(r)?n.push({$ref:`#/definitions/${r.$ref.split("/").pop()}`}):x.isArray(r)?n.push({...r,items:a.downgradeSchema(l)(r.items),examples:r.examples?Object.values(r.examples):void 0}):x.isTuple(r)?n.push({...r,items:(()=>{if(r.additionalItems===!0)return{};const o=[...r.prefixItems,...typeof r.additionalItems=="object"?[a.downgradeSchema(l)(r.additionalItems)]:[]];return o.length===0?{}:{"x-oneOf":o.map(a.downgradeSchema(l))}})(),minItems:r.prefixItems.length,maxItems:r.additionalItems?void 0:r.prefixItems.length,prefixItems:void 0,additionalItems:void 0,examples:r.examples?Object.values(r.examples):void 0}):x.isObject(r)?n.push({...r,properties:r.properties?Object.fromEntries(Object.entries(r.properties).filter(([o,d])=>d!==void 0).map(([o,d])=>[o,a.downgradeSchema(l)(d)])):void 0,additionalProperties:typeof r.additionalProperties=="object"?a.downgradeSchema(l)(r.additionalProperties):r.additionalProperties,required:r.required,examples:r.examples?Object.values(r.examples):void 0}):x.isOneOf(r)&&r.oneOf.forEach(e)};if(e(f),t)for(const r of n)x.isReference(r)?R(new Set)(l)(r):r["x-nullable"]=!0;return t===!0&&n.length===0?{type:"null",...i}:{...n.length===0?{type:void 0}:n.length===1?{...n[0]}:{"x-oneOf":n},...i,...n.length>1?{discriminator:void 0}:{}}};const R=l=>f=>t=>{var e;const n=t.$ref.split("/").pop();if(n.endsWith(".Nullable"))return;const i=(e=f.original.schemas)==null?void 0:e[n];if(i!==void 0){{if(w(l)(f.original)(i)===!0)return;f.downgraded[`${n}.Nullable`]===void 0&&(f.downgraded[`${n}.Nullable`]={},f.downgraded[`${n}.Nullable`]=a.downgradeSchema(f)(x.isOneOf(i)?{...i,oneOf:[...i.oneOf,{type:"null"}]}:{title:i.title,description:i.description,example:i.example,examples:i.examples?Object.values(i.examples):void 0,...Object.fromEntries(Object.entries(i).filter(([r,o])=>r.startsWith("x-")&&o!==void 0)),oneOf:[i,{type:"null"}]}))}t.$ref+=".Nullable"}},E=l=>{if(l.type==="apiKey")return[l];if(l.type==="http")return l.scheme==="basic"?[{type:"basic",description:l.description}]:[];if(l.type==="oauth2"){const f=[];return l.flows.implicit&&f.push({type:"oauth2",flow:"implicit",authorizationUrl:l.flows.implicit.authorizationUrl,scopes:l.flows.implicit.scopes}),l.flows.password&&f.push({type:"oauth2",flow:"password",tokenUrl:l.flows.password.tokenUrl,scopes:l.flows.password.scopes}),l.flows.clientCredentials&&f.push({type:"oauth2",flow:"application",tokenUrl:l.flows.clientCredentials.tokenUrl,scopes:l.flows.clientCredentials.scopes}),l.flows.authorizationCode&&f.push({type:"oauth2",flow:"accessCode",authorizationUrl:l.flows.authorizationCode.authorizationUrl,tokenUrl:l.flows.authorizationCode.tokenUrl,scopes:l.flows.authorizationCode.scopes}),f}return[]},w=l=>f=>t=>{var n;if(x.isNull(t))return!0;if(x.isReference(t)){if(l.has(t.$ref))return!1;l.add(t.$ref);const i=t.$ref.split("/").pop(),e=(n=f.schemas)==null?void 0:n[i];return e?w(l)(f)(e):!1}return x.isOneOf(t)&&t.oneOf.some(w(l)(f))}})(P||(P={}));var B;(function(a){a.convert=t=>({openapi:"3.1.0",info:t.info,components:R(t),paths:t.paths?Object.fromEntries(Object.entries(t.paths).filter(([n,i])=>i!==void 0).map(([n,i])=>[n,m(t)(i)])):void 0,servers:t.host?[{url:t.host}]:void 0,security:t.security,tags:t.tags,"x-samchon-emended":!0});const m=t=>n=>({...n,...n.get?{get:O(t)(n)(n.get)}:void 0,...n.put?{put:O(t)(n)(n.put)}:void 0,...n.post?{post:O(t)(n)(n.post)}:void 0,...n.delete?{delete:O(t)(n)(n.delete)}:void 0,...n.options?{options:O(t)(n)(n.options)}:void 0,...n.head?{head:O(t)(n)(n.head)}:void 0,...n.patch?{patch:O(t)(n)(n.patch)}:void 0,...n.trace?{trace:O(t)(n)(n.trace)}:void 0}),O=t=>n=>i=>({...i,parameters:n.parameters!==void 0||i.parameters!==void 0?[...n.parameters??[],...i.parameters??[]].map(e=>{var r;return f.isReference(e)?(r=t.parameters)==null?void 0:r[e.$ref.split("/").pop()??""]:e}).filter(e=>e!==void 0&&e.in!=="body"&&e.schema===void 0).map(b(t.definitions??{})):void 0,requestBody:(()=>{var r;const e=(r=i.parameters)==null?void 0:r.find(o=>{var d;return f.isReference(o)&&(o=(d=t.parameters)==null?void 0:d[o.$ref.split("/").pop()??""]),(o==null?void 0:o.schema)!==void 0});return e?g(t.definitions??{})(e):void 0})(),responses:i.responses?Object.fromEntries(Object.entries(i.responses).filter(([e,r])=>r!==void 0).map(([e,r])=>[e,$(t)(r)]).filter(([e,r])=>r!==void 0)):void 0}),b=t=>n=>({name:n.name,in:n.in,description:n.description,schema:a.convertSchema(t)(n),required:!0}),g=t=>n=>({description:n.description,content:{"application/json":{schema:a.convertSchema(t)(n.schema)}}}),$=t=>n=>{var i;if(f.isReference(n)){const e=(i=t.responses)==null?void 0:i[n.$ref.split("/").pop()??""];if(e===void 0)return;n=e}return{description:n.description,content:n.schema?{"application/json":{schema:a.convertSchema(t.definitions??{})(n.schema),example:n.example}}:void 0,headers:n.headers?Object.fromEntries(Object.entries(n.headers).filter(([e,r])=>r!==void 0).map(([e,r])=>[e,{schema:a.convertSchema(t.definitions??{})(r),in:"header"}])):void 0}},R=t=>({schemas:Object.fromEntries(Object.entries(t.definitions??{}).filter(([n,i])=>i!==void 0).map(([n,i])=>[n,a.convertSchema(t.definitions??{})(i)])),securitySchemes:t.securityDefinitions?Object.fromEntries(Object.entries(t.securityDefinitions).filter(([n,i])=>i!==void 0).map(([n,i])=>[n,E(i)]).filter(([n,i])=>i!==void 0)):void 0}),E=t=>{if(t.type==="apiKey")return t;if(t.type==="basic")return{type:"http",scheme:"basic",description:t.description};if(t.type==="oauth2")return t.flow==="implicit"?{type:"oauth2",description:t.description,flows:{implicit:{authorizationUrl:t.authorizationUrl,scopes:t.scopes}}}:t.flow==="accessCode"?{type:"oauth2",description:t.description,flows:{authorizationCode:{authorizationUrl:t.authorizationUrl,tokenUrl:t.tokenUrl,scopes:t.scopes}}}:t.flow==="password"?{type:"oauth2",description:t.description,flows:{password:{tokenUrl:t.tokenUrl,scopes:t.scopes}}}:t.flow==="application"?{type:"oauth2",description:t.description,flows:{clientCredentials:{tokenUrl:t.tokenUrl,scopes:t.scopes}}}:void 0};a.convertSchema=t=>n=>{const i={value:!1,default:void 0},e=[],r={title:n.title,description:n.description,...Object.fromEntries(Object.entries(n).filter(([d,u])=>d.startsWith("x-")&&u!==void 0)),example:n.example,examples:n.examples?Object.fromEntries(n.examples.map((d,u)=>[u.toString(),d])):void 0},o=d=>{var u,s,v;d["x-nullable"]===!0&&(i.value||(i.value=!0),d.default===null&&(i.default=null)),Array.isArray(d.enum)&&((u=d.enum)!=null&&u.length)&&((s=d.enum)!=null&&s.some(p=>p===null))&&(i.value||(i.value=!0)),f.isAnyOf(d)?d["x-anyOf"].forEach(o):f.isOneOf(d)?d["x-oneOf"].forEach(o):f.isAllOf(d)?d.allOf.length===1?o(d.allOf[0]):e.push(w(t)(d)):f.isBoolean(d)||f.isInteger(d)||f.isNumber(d)||f.isString(d)?(v=d.enum)!=null&&v.length&&d.enum.filter(p=>p!==null).length?e.push(...d.enum.filter(p=>p!==null).map(p=>({const:p}))):e.push({...d,default:d.default??void 0,examples:d.examples?Object.fromEntries(d.examples.map((p,j)=>[j.toString(),p])):void 0,enum:void 0}):f.isArray(d)?e.push({...d,items:a.convertSchema(t)(d.items),examples:d.examples?Object.fromEntries(d.examples.map((p,j)=>[j.toString(),p])):void 0}):f.isObject(d)?e.push({...d,properties:d.properties?Object.fromEntries(Object.entries(d.properties).filter(([p,j])=>j!==void 0).map(([p,j])=>[p,a.convertSchema(t)(j)])):{},additionalProperties:d.additionalProperties?typeof d.additionalProperties=="object"&&d.additionalProperties!==null?a.convertSchema(t)(d.additionalProperties):d.additionalProperties:void 0,examples:d.examples?Object.fromEntries(d.examples.map((p,j)=>[j.toString(),p])):void 0,required:d.required??[]}):f.isReference(d)?e.push({...d,$ref:d.$ref.replace("#/definitions/","#/components/schemas/"),examples:d.examples?Object.fromEntries(d.examples.map((p,j)=>[j.toString(),p])):void 0}):e.push({...d,examples:d.examples?Object.fromEntries(d.examples.map((p,j)=>[j.toString(),p])):void 0})};if(o(n),i.value===!0&&!e.some(d=>d.type==="null")&&e.push({type:"null",default:i.default}),e.length===2&&e.filter(d=>x.isNull(d)).length===1){const d=e.filter(u=>x.isNull(u)===!1)[0];for(const u of["title","description","deprecated","example","examples"])d[u]!==void 0&&delete d[u]}return{...e.length===0?{type:void 0}:e.length===1?{...e[0]}:{oneOf:e.map(d=>({...d,"x-nullable":void 0}))},...r,"x-nullable":void 0}};const w=t=>n=>{const i=n.allOf.map(e=>l(t)(e));return i.some(e=>e===null)?{type:void 0,allOf:void 0}:{...n,type:"object",properties:Object.fromEntries(i.map(e=>Object.entries((e==null?void 0:e.properties)??{})).flat().map(([e,r])=>[e,a.convertSchema(t)(r)])),allOf:void 0,required:[...new Set(i.map(e=>(e==null?void 0:e.required)??[]).flat())]}},l=t=>(n,i=new Set)=>f.isObject(n)?n.properties!==void 0&&!n.additionalProperties?n:null:i.has(n)?null:(i.add(n),f.isReference(n)?l(t)((t==null?void 0:t[n.$ref.split("/").pop()??""])??{},i):null);let f;(function(t){t.isBoolean=n=>n.type==="boolean",t.isInteger=n=>n.type==="integer",t.isNumber=n=>n.type==="number",t.isString=n=>n.type==="string",t.isArray=n=>n.type==="array",t.isObject=n=>n.type==="object",t.isReference=n=>n.$ref!==void 0,t.isAllOf=n=>n.allOf!==void 0,t.isOneOf=n=>n["x-oneOf"]!==void 0,t.isAnyOf=n=>n["x-anyOf"]!==void 0,t.isNullOnly=n=>n.type==="null"})(f||(f={}))})(B||(B={}));var W;(function(a){function m(b){if(S.is(b))return q.convert(b);if(A.is(b))return K.convert(b);if(_.is(b))return B.convert(b);throw new TypeError("Unrecognized Swagger/OpenAPI version.")}a.convert=m;function O(b,g){if(g==="2.0")return P.downgrade(b);if(g==="3.0")return F.downgrade(b);throw new TypeError("Unrecognized Swagger/OpenAPI version.")}a.downgrade=O})(W||(W={}));export{W as O,_ as S,A as a,S as b};
|
|
1
|
+
import{l as x,n as K,o as F}from"./AgenticaChatApplication-DxrCYEqZ.js";var A;(function(a){a.is=m=>typeof m=="object"&&m!==null&&typeof m.openapi=="string"&&m.openapi.startsWith("3.0")})(A||(A={}));var S;(function(a){a.is=m=>typeof m=="object"&&m!==null&&typeof m.openapi=="string"&&m.openapi.startsWith("3.1")})(S||(S={}));var _;(function(a){a.is=m=>typeof m=="object"&&m!==null&&typeof m.swagger=="string"&&m.swagger.startsWith("2.0")})(_||(_={}));var q;(function(a){a.convert=i=>i["x-samchon-emended"]===!0?i:{...i,components:w(i.components??{}),paths:i.paths?Object.fromEntries(Object.entries(i.paths).filter(([e,r])=>r!==void 0).map(([e,r])=>[e,O(i)(r)])):void 0,webhooks:i.webhooks?Object.fromEntries(Object.entries(i.webhooks).filter(([e,r])=>r!==void 0).map(([e,r])=>[e,m(i)(r)]).filter(([e,r])=>r!==void 0)):void 0,"x-samchon-emended":!0};const m=i=>e=>{var o,d;if(!n.isReference(e))return O(i)(e);const r=(d=(o=i.components)==null?void 0:o.pathItems)==null?void 0:d[e.$ref.split("/").pop()??""];return r?O(i)(r):void 0},O=i=>e=>({...e,...e.get?{get:b(i)(e)(e.get)}:void 0,...e.put?{put:b(i)(e)(e.put)}:void 0,...e.post?{post:b(i)(e)(e.post)}:void 0,...e.delete?{delete:b(i)(e)(e.delete)}:void 0,...e.options?{options:b(i)(e)(e.options)}:void 0,...e.head?{head:b(i)(e)(e.head)}:void 0,...e.patch?{patch:b(i)(e)(e.patch)}:void 0,...e.trace?{trace:b(i)(e)(e.trace)}:void 0}),b=i=>e=>r=>({...r,parameters:e.parameters!==void 0||r.parameters!==void 0?[...e.parameters??[],...r.parameters??[]].map(o=>{var u,s,v,p;if(!n.isReference(o))return g(i.components??{})(o);const d=o.$ref.startsWith("#/components/headers/")?(s=(u=i.components)==null?void 0:u.headers)==null?void 0:s[o.$ref.split("/").pop()??""]:(p=(v=i.components)==null?void 0:v.parameters)==null?void 0:p[o.$ref.split("/").pop()??""];return d!==void 0?g(i.components??{})({...d,in:"header"}):void 0}).filter((o,d)=>d!==void 0):void 0,requestBody:r.requestBody?$(i)(r.requestBody):void 0,responses:r.responses?Object.fromEntries(Object.entries(r.responses).filter(([o,d])=>d!==void 0).map(([o,d])=>[o,R(i)(d)]).filter(([o,d])=>d!==void 0)):void 0}),g=i=>e=>({...e,schema:l(i)(e.schema),examples:e.examples?Object.fromEntries(Object.entries(e.examples).map(([r,o])=>{var d;return[r,n.isReference(o)?(d=i.examples)==null?void 0:d[o.$ref.split("/").pop()??""]:o]}).filter(([r,o])=>o!==void 0)):void 0}),$=i=>e=>{var r,o;if(n.isReference(e)){const d=(o=(r=i.components)==null?void 0:r.requestBodies)==null?void 0:o[e.$ref.split("/").pop()??""];if(d===void 0)return;e=d}return{...e,content:e.content?E(i.components??{})(e.content):void 0}},R=i=>e=>{var r,o;if(n.isReference(e)){const d=(o=(r=i.components)==null?void 0:r.responses)==null?void 0:o[e.$ref.split("/").pop()??""];if(d===void 0)return;e=d}return{...e,content:e.content?E(i.components??{})(e.content):void 0,headers:e.headers?Object.fromEntries(Object.entries(e.headers).filter(([d,u])=>u!==void 0).map(([d,u])=>[d,(()=>{var v,p;if(n.isReference(u)===!1)return g(i.components??{})({...u,in:"header"});const s=u.$ref.startsWith("#/components/headers/")?(p=(v=i.components)==null?void 0:v.headers)==null?void 0:p[u.$ref.split("/").pop()??""]:void 0;return s!==void 0?g(i.components??{})({...s,in:"header"}):void 0})()]).filter(([d,u])=>u!==void 0)):void 0}},E=i=>e=>Object.fromEntries(Object.entries(e).filter(([r,o])=>o!==void 0).map(([r,o])=>[r,{...o,schema:o.schema?l(i)(o.schema):void 0,examples:o.examples?Object.fromEntries(Object.entries(o.examples).map(([d,u])=>{var s;return[d,n.isReference(u)?(s=i.examples)==null?void 0:s[u.$ref.split("/").pop()??""]:u]}).filter(([d,u])=>u!==void 0)):void 0}])),w=i=>({schemas:Object.fromEntries(Object.entries(i.schemas??{}).filter(([e,r])=>r!==void 0).map(([e,r])=>[e,l(i)(r)])),securitySchemes:i.securitySchemes}),l=i=>e=>{const r=[],o={title:e.title,description:e.description,...Object.fromEntries(Object.entries(e).filter(([s,v])=>s.startsWith("x-")&&v!==void 0))},d={value:!1,default:void 0},u=s=>{var v,p,j,N,z,M,U;if(s.nullable===!0&&(d.value||(d.value=!0),s.default===null&&(d.default=null)),Array.isArray(s.enum)&&((v=s.enum)!=null&&v.length)&&((p=s.enum)!=null&&p.some(c=>c===null))&&(d.value||(d.value=!0)),n.isMixed(s)){s.const!==void 0&&u({...s,type:void 0,oneOf:void 0,anyOf:void 0,allOf:void 0,$ref:void 0}),s.oneOf!==void 0&&u({...s,type:void 0,anyOf:void 0,allOf:void 0,$ref:void 0}),s.anyOf!==void 0&&u({...s,type:void 0,oneOf:void 0,allOf:void 0,$ref:void 0}),s.allOf!==void 0&&u({...s,type:void 0,oneOf:void 0,anyOf:void 0,$ref:void 0});for(const c of s.type)u(c==="boolean"||c==="number"||c==="string"?{...s,enum:(j=s.enum)!=null&&j.length&&s.enum.filter(y=>y!==null)?s.enum.filter(y=>typeof y===c):void 0,type:c}:c==="integer"?{...s,enum:(N=s.enum)!=null&&N.length&&s.enum.filter(y=>y!==null)?s.enum.filter(y=>y!==null&&typeof y=="number"&&Number.isInteger(y)):void 0,type:c}:{...s,type:c})}else if(n.isOneOf(s))s.oneOf.forEach(u);else if(n.isAnyOf(s))s.anyOf.forEach(u);else if(n.isAllOf(s))s.allOf.length===1?u(s.allOf[0]):r.push(f(i)(s));else if(n.isBoolean(s))if((z=s.enum)!=null&&z.length&&s.enum.filter(c=>c!==null).length)for(const c of s.enum.filter(y=>y!==null))r.push({const:c,...s,type:void 0,enum:void 0,default:void 0});else r.push({...s,default:s.default??void 0,enum:void 0});else if(n.isInteger(s)||n.isNumber(s))if((M=s.enum)!=null&&M.length&&s.enum.filter(c=>c!==null))for(const c of s.enum.filter(y=>y!==null))r.push({const:c,...s,type:void 0,enum:void 0,default:void 0,minimum:void 0,maximum:void 0,exclusiveMinimum:void 0,exclusiveMaximum:void 0,multipleOf:void 0});else r.push({...s,default:s.default??void 0,enum:void 0,...typeof s.exclusiveMinimum=="number"?{minimum:s.exclusiveMinimum,exclusiveMinimum:!0}:{exclusiveMinimum:s.exclusiveMinimum},...typeof s.exclusiveMaximum=="number"?{maximum:s.exclusiveMaximum,exclusiveMaximum:!0}:{exclusiveMaximum:s.exclusiveMaximum}});else if(n.isString(s))if((U=s.enum)!=null&&U.length&&s.enum.filter(c=>c!==null).length)for(const c of s.enum.filter(y=>y!==null))r.push({const:c,...s,type:void 0,enum:void 0,default:void 0});else r.push({...s,default:s.default??void 0,enum:void 0});else n.isArray(s)?Array.isArray(s.items)?r.push({...s,items:void 0,prefixItems:s.items.map(l(i)),additionalItems:typeof s.additionalItems=="object"&&s.additionalItems!==null?l(i)(s.additionalItems):s.additionalItems}):Array.isArray(s.prefixItems)?r.push({...s,items:void 0,prefixItems:s.prefixItems.map(l(i)),additionalItems:typeof s.additionalItems=="object"&&s.additionalItems!==null?l(i)(s.additionalItems):s.additionalItems}):s.items===void 0?r.push({...s,items:void 0,prefixItems:[]}):r.push({...s,items:l(i)(s.items),prefixItems:void 0,additionalItems:void 0}):n.isObject(s)?r.push({...s,properties:s.properties?Object.fromEntries(Object.entries(s.properties).filter(([c,y])=>y!==void 0).map(([c,y])=>[c,l(i)(y)])):{},additionalProperties:s.additionalProperties?typeof s.additionalProperties=="object"&&s.additionalProperties!==null?l(i)(s.additionalProperties):s.additionalProperties:void 0,required:s.required??[]}):n.isRecursiveReference(s)?r.push({...s,$ref:s.$recursiveRef,$recursiveRef:void 0}):r.push(s)};return u(e),d.value===!0&&!r.some(s=>s.type==="null")&&r.push({type:"null",default:d.default}),{...r.length===0?{type:void 0}:r.length===1?{...r[0]}:{oneOf:r.map(s=>({...s,nullable:void 0}))},...o,nullable:void 0}},f=i=>e=>{const r=e.allOf.map(o=>t(i)(o));return r.some(o=>o===null)?{type:void 0,allOf:void 0}:{...e,type:"object",properties:Object.fromEntries(r.map(o=>Object.entries((o==null?void 0:o.properties)??{})).flat().map(([o,d])=>[o,l(i)(d)])),allOf:void 0,required:[...new Set(r.map(o=>(o==null?void 0:o.required)??[]).flat())]}},t=i=>(e,r=new Set)=>{var o,d;return n.isObject(e)?e.properties!==void 0&&!e.additionalProperties?e:null:r.has(e)?null:(r.add(e),n.isReference(e)?t(i)(((o=i.schemas)==null?void 0:o[e.$ref.split("/").pop()??""])??{},r):n.isRecursiveReference(e)?t(i)(((d=i.schemas)==null?void 0:d[e.$recursiveRef.split("/").pop()??""])??{},r):null)};let n;(function(i){i.isConstant=e=>e.const!==void 0,i.isBoolean=e=>e.type==="boolean",i.isInteger=e=>e.type==="integer",i.isNumber=e=>e.type==="number",i.isString=e=>e.type==="string",i.isArray=e=>e.type==="array",i.isObject=e=>e.type==="object",i.isReference=e=>e.$ref!==void 0,i.isRecursiveReference=e=>e.$recursiveRef!==void 0,i.isAllOf=e=>e.allOf!==void 0,i.isAnyOf=e=>e.anyOf!==void 0,i.isOneOf=e=>e.oneOf!==void 0,i.isNullOnly=e=>e.type==="null",i.isMixed=e=>Array.isArray(e.type)})(n||(n={}))})(q||(q={}));var P;(function(a){a.downgrade=l=>{var t,n,i;const f=a.downgradeComponents(l.components);return{swagger:"2.0",info:l.info,host:(n=(t=l.servers)==null?void 0:t[0])!=null&&n.url?l.servers[0].url.split("://").pop():"",definitions:f.downgraded,securityDefinitions:(i=l.components)!=null&&i.securitySchemes?Object.fromEntries(Object.entries(l.components.securitySchemes).filter(([e,r])=>r!==void 0).map(([e,r])=>E(r).map(o=>[e,o])).flat()):void 0,paths:l.paths?Object.fromEntries(Object.entries(l.paths).filter(([e,r])=>r!==void 0).map(([e,r])=>[e,m(f)(r)])):void 0,security:l.security,tags:l.tags}};const m=l=>f=>({...f,...f.get?{get:O(l)(f.get)}:void 0,...f.put?{put:O(l)(f.put)}:void 0,...f.post?{post:O(l)(f.post)}:void 0,...f.delete?{delete:O(l)(f.delete)}:void 0,...f.options?{options:O(l)(f.options)}:void 0,...f.head?{head:O(l)(f.head)}:void 0,...f.patch?{patch:O(l)(f.patch)}:void 0,...f.trace?{trace:O(l)(f.trace)}:void 0}),O=l=>f=>({...f,parameters:f.parameters!==void 0||f.requestBody!==void 0?[...(f.parameters??[]).map(b(l)),...f.requestBody?[g(l)(f.requestBody)]:[]]:void 0,responses:f.responses?Object.fromEntries(Object.entries(f.responses).filter(([t,n])=>n!==void 0).map(([t,n])=>[t,$(l)(n)])):void 0,requestBody:void 0,servers:void 0}),b=l=>(f,t)=>{var n;return{...a.downgradeSchema(l)(f.schema),...f,required:(n=f.schema)==null?void 0:n.required,schema:void 0,name:f.name??`p${t}`,example:void 0,examples:void 0}},g=l=>f=>{var t;return{name:"body",in:"body",description:f.description,required:f.required,schema:a.downgradeSchema(l)(((t=Object.values(f.content??{})[0])==null?void 0:t.schema)??{})}},$=l=>f=>{var t;return{description:f.description,schema:a.downgradeSchema(l)(((t=Object.values(f.content??{})[0])==null?void 0:t.schema)??{}),headers:f.headers?Object.fromEntries(Object.entries(f.headers).filter(([n,i])=>i!==void 0).map(([n,i])=>[n,{...i,schema:a.downgradeSchema(l)(i.schema),example:void 0,examples:void 0}])):void 0}};a.downgradeComponents=l=>{const f={original:l,downgraded:{}};if(l.schemas){f.downgraded.schemas={};for(const[t,n]of Object.entries(l.schemas))n!==void 0&&(f.downgraded[t.split("/").pop()]=a.downgradeSchema(f)(n))}return f},a.downgradeSchema=l=>f=>{const t=w(new Set)(l.original)(f),n=[],i={title:f.title,description:f.description,example:f.example,examples:f.examples?Object.values(f.examples):void 0,...Object.fromEntries(Object.entries(f).filter(([r,o])=>r.startsWith("x-")&&o!==void 0))},e=r=>{x.isBoolean(r)?n.push({type:"boolean"}):x.isBoolean(r)||x.isInteger(r)||x.isNumber(r)||x.isString(r)?n.push({...r,examples:r.examples?Object.values(r.examples):void 0}):x.isReference(r)?n.push({$ref:`#/definitions/${r.$ref.split("/").pop()}`}):x.isArray(r)?n.push({...r,items:a.downgradeSchema(l)(r.items),examples:r.examples?Object.values(r.examples):void 0}):x.isTuple(r)?n.push({...r,items:(()=>{if(r.additionalItems===!0)return{};const o=[...r.prefixItems,...typeof r.additionalItems=="object"?[a.downgradeSchema(l)(r.additionalItems)]:[]];return o.length===0?{}:{"x-oneOf":o.map(a.downgradeSchema(l))}})(),minItems:r.prefixItems.length,maxItems:r.additionalItems?void 0:r.prefixItems.length,prefixItems:void 0,additionalItems:void 0,examples:r.examples?Object.values(r.examples):void 0}):x.isObject(r)?n.push({...r,properties:r.properties?Object.fromEntries(Object.entries(r.properties).filter(([o,d])=>d!==void 0).map(([o,d])=>[o,a.downgradeSchema(l)(d)])):void 0,additionalProperties:typeof r.additionalProperties=="object"?a.downgradeSchema(l)(r.additionalProperties):r.additionalProperties,required:r.required,examples:r.examples?Object.values(r.examples):void 0}):x.isOneOf(r)&&r.oneOf.forEach(e)};if(e(f),t)for(const r of n)x.isReference(r)?R(new Set)(l)(r):r["x-nullable"]=!0;return t===!0&&n.length===0?{type:"null",...i}:{...n.length===0?{type:void 0}:n.length===1?{...n[0]}:{"x-oneOf":n},...i,...n.length>1?{discriminator:void 0}:{}}};const R=l=>f=>t=>{var e;const n=t.$ref.split("/").pop();if(n.endsWith(".Nullable"))return;const i=(e=f.original.schemas)==null?void 0:e[n];if(i!==void 0){{if(w(l)(f.original)(i)===!0)return;f.downgraded[`${n}.Nullable`]===void 0&&(f.downgraded[`${n}.Nullable`]={},f.downgraded[`${n}.Nullable`]=a.downgradeSchema(f)(x.isOneOf(i)?{...i,oneOf:[...i.oneOf,{type:"null"}]}:{title:i.title,description:i.description,example:i.example,examples:i.examples?Object.values(i.examples):void 0,...Object.fromEntries(Object.entries(i).filter(([r,o])=>r.startsWith("x-")&&o!==void 0)),oneOf:[i,{type:"null"}]}))}t.$ref+=".Nullable"}},E=l=>{if(l.type==="apiKey")return[l];if(l.type==="http")return l.scheme==="basic"?[{type:"basic",description:l.description}]:[];if(l.type==="oauth2"){const f=[];return l.flows.implicit&&f.push({type:"oauth2",flow:"implicit",authorizationUrl:l.flows.implicit.authorizationUrl,scopes:l.flows.implicit.scopes}),l.flows.password&&f.push({type:"oauth2",flow:"password",tokenUrl:l.flows.password.tokenUrl,scopes:l.flows.password.scopes}),l.flows.clientCredentials&&f.push({type:"oauth2",flow:"application",tokenUrl:l.flows.clientCredentials.tokenUrl,scopes:l.flows.clientCredentials.scopes}),l.flows.authorizationCode&&f.push({type:"oauth2",flow:"accessCode",authorizationUrl:l.flows.authorizationCode.authorizationUrl,tokenUrl:l.flows.authorizationCode.tokenUrl,scopes:l.flows.authorizationCode.scopes}),f}return[]},w=l=>f=>t=>{var n;if(x.isNull(t))return!0;if(x.isReference(t)){if(l.has(t.$ref))return!1;l.add(t.$ref);const i=t.$ref.split("/").pop(),e=(n=f.schemas)==null?void 0:n[i];return e?w(l)(f)(e):!1}return x.isOneOf(t)&&t.oneOf.some(w(l)(f))}})(P||(P={}));var B;(function(a){a.convert=t=>({openapi:"3.1.0",info:t.info,components:R(t),paths:t.paths?Object.fromEntries(Object.entries(t.paths).filter(([n,i])=>i!==void 0).map(([n,i])=>[n,m(t)(i)])):void 0,servers:t.host?[{url:t.host}]:void 0,security:t.security,tags:t.tags,"x-samchon-emended":!0});const m=t=>n=>({...n,...n.get?{get:O(t)(n)(n.get)}:void 0,...n.put?{put:O(t)(n)(n.put)}:void 0,...n.post?{post:O(t)(n)(n.post)}:void 0,...n.delete?{delete:O(t)(n)(n.delete)}:void 0,...n.options?{options:O(t)(n)(n.options)}:void 0,...n.head?{head:O(t)(n)(n.head)}:void 0,...n.patch?{patch:O(t)(n)(n.patch)}:void 0,...n.trace?{trace:O(t)(n)(n.trace)}:void 0}),O=t=>n=>i=>({...i,parameters:n.parameters!==void 0||i.parameters!==void 0?[...n.parameters??[],...i.parameters??[]].map(e=>{var r;return f.isReference(e)?(r=t.parameters)==null?void 0:r[e.$ref.split("/").pop()??""]:e}).filter(e=>e!==void 0&&e.in!=="body"&&e.schema===void 0).map(b(t.definitions??{})):void 0,requestBody:(()=>{var r;const e=(r=i.parameters)==null?void 0:r.find(o=>{var d;return f.isReference(o)&&(o=(d=t.parameters)==null?void 0:d[o.$ref.split("/").pop()??""]),(o==null?void 0:o.schema)!==void 0});return e?g(t.definitions??{})(e):void 0})(),responses:i.responses?Object.fromEntries(Object.entries(i.responses).filter(([e,r])=>r!==void 0).map(([e,r])=>[e,$(t)(r)]).filter(([e,r])=>r!==void 0)):void 0}),b=t=>n=>({name:n.name,in:n.in,description:n.description,schema:a.convertSchema(t)(n),required:!0}),g=t=>n=>({description:n.description,content:{"application/json":{schema:a.convertSchema(t)(n.schema)}}}),$=t=>n=>{var i;if(f.isReference(n)){const e=(i=t.responses)==null?void 0:i[n.$ref.split("/").pop()??""];if(e===void 0)return;n=e}return{description:n.description,content:n.schema?{"application/json":{schema:a.convertSchema(t.definitions??{})(n.schema),example:n.example}}:void 0,headers:n.headers?Object.fromEntries(Object.entries(n.headers).filter(([e,r])=>r!==void 0).map(([e,r])=>[e,{schema:a.convertSchema(t.definitions??{})(r),in:"header"}])):void 0}},R=t=>({schemas:Object.fromEntries(Object.entries(t.definitions??{}).filter(([n,i])=>i!==void 0).map(([n,i])=>[n,a.convertSchema(t.definitions??{})(i)])),securitySchemes:t.securityDefinitions?Object.fromEntries(Object.entries(t.securityDefinitions).filter(([n,i])=>i!==void 0).map(([n,i])=>[n,E(i)]).filter(([n,i])=>i!==void 0)):void 0}),E=t=>{if(t.type==="apiKey")return t;if(t.type==="basic")return{type:"http",scheme:"basic",description:t.description};if(t.type==="oauth2")return t.flow==="implicit"?{type:"oauth2",description:t.description,flows:{implicit:{authorizationUrl:t.authorizationUrl,scopes:t.scopes}}}:t.flow==="accessCode"?{type:"oauth2",description:t.description,flows:{authorizationCode:{authorizationUrl:t.authorizationUrl,tokenUrl:t.tokenUrl,scopes:t.scopes}}}:t.flow==="password"?{type:"oauth2",description:t.description,flows:{password:{tokenUrl:t.tokenUrl,scopes:t.scopes}}}:t.flow==="application"?{type:"oauth2",description:t.description,flows:{clientCredentials:{tokenUrl:t.tokenUrl,scopes:t.scopes}}}:void 0};a.convertSchema=t=>n=>{const i={value:!1,default:void 0},e=[],r={title:n.title,description:n.description,...Object.fromEntries(Object.entries(n).filter(([d,u])=>d.startsWith("x-")&&u!==void 0)),example:n.example,examples:n.examples?Object.fromEntries(n.examples.map((d,u)=>[u.toString(),d])):void 0},o=d=>{var u,s,v;d["x-nullable"]===!0&&(i.value||(i.value=!0),d.default===null&&(i.default=null)),Array.isArray(d.enum)&&((u=d.enum)!=null&&u.length)&&((s=d.enum)!=null&&s.some(p=>p===null))&&(i.value||(i.value=!0)),f.isAnyOf(d)?d["x-anyOf"].forEach(o):f.isOneOf(d)?d["x-oneOf"].forEach(o):f.isAllOf(d)?d.allOf.length===1?o(d.allOf[0]):e.push(w(t)(d)):f.isBoolean(d)||f.isInteger(d)||f.isNumber(d)||f.isString(d)?(v=d.enum)!=null&&v.length&&d.enum.filter(p=>p!==null).length?e.push(...d.enum.filter(p=>p!==null).map(p=>({const:p}))):e.push({...d,default:d.default??void 0,examples:d.examples?Object.fromEntries(d.examples.map((p,j)=>[j.toString(),p])):void 0,enum:void 0}):f.isArray(d)?e.push({...d,items:a.convertSchema(t)(d.items),examples:d.examples?Object.fromEntries(d.examples.map((p,j)=>[j.toString(),p])):void 0}):f.isObject(d)?e.push({...d,properties:d.properties?Object.fromEntries(Object.entries(d.properties).filter(([p,j])=>j!==void 0).map(([p,j])=>[p,a.convertSchema(t)(j)])):{},additionalProperties:d.additionalProperties?typeof d.additionalProperties=="object"&&d.additionalProperties!==null?a.convertSchema(t)(d.additionalProperties):d.additionalProperties:void 0,examples:d.examples?Object.fromEntries(d.examples.map((p,j)=>[j.toString(),p])):void 0,required:d.required??[]}):f.isReference(d)?e.push({...d,$ref:d.$ref.replace("#/definitions/","#/components/schemas/"),examples:d.examples?Object.fromEntries(d.examples.map((p,j)=>[j.toString(),p])):void 0}):e.push({...d,examples:d.examples?Object.fromEntries(d.examples.map((p,j)=>[j.toString(),p])):void 0})};if(o(n),i.value===!0&&!e.some(d=>d.type==="null")&&e.push({type:"null",default:i.default}),e.length===2&&e.filter(d=>x.isNull(d)).length===1){const d=e.filter(u=>x.isNull(u)===!1)[0];for(const u of["title","description","deprecated","example","examples"])d[u]!==void 0&&delete d[u]}return{...e.length===0?{type:void 0}:e.length===1?{...e[0]}:{oneOf:e.map(d=>({...d,"x-nullable":void 0}))},...r,"x-nullable":void 0}};const w=t=>n=>{const i=n.allOf.map(e=>l(t)(e));return i.some(e=>e===null)?{type:void 0,allOf:void 0}:{...n,type:"object",properties:Object.fromEntries(i.map(e=>Object.entries((e==null?void 0:e.properties)??{})).flat().map(([e,r])=>[e,a.convertSchema(t)(r)])),allOf:void 0,required:[...new Set(i.map(e=>(e==null?void 0:e.required)??[]).flat())]}},l=t=>(n,i=new Set)=>f.isObject(n)?n.properties!==void 0&&!n.additionalProperties?n:null:i.has(n)?null:(i.add(n),f.isReference(n)?l(t)((t==null?void 0:t[n.$ref.split("/").pop()??""])??{},i):null);let f;(function(t){t.isBoolean=n=>n.type==="boolean",t.isInteger=n=>n.type==="integer",t.isNumber=n=>n.type==="number",t.isString=n=>n.type==="string",t.isArray=n=>n.type==="array",t.isObject=n=>n.type==="object",t.isReference=n=>n.$ref!==void 0,t.isAllOf=n=>n.allOf!==void 0,t.isOneOf=n=>n["x-oneOf"]!==void 0,t.isAnyOf=n=>n["x-anyOf"]!==void 0,t.isNullOnly=n=>n.type==="null"})(f||(f={}))})(B||(B={}));var W;(function(a){function m(b){if(S.is(b))return q.convert(b);if(A.is(b))return K.convert(b);if(_.is(b))return B.convert(b);throw new TypeError("Unrecognized Swagger/OpenAPI version.")}a.convert=m;function O(b,g){if(g==="2.0")return P.downgrade(b);if(g==="3.0")return F.downgrade(b);throw new TypeError("Unrecognized Swagger/OpenAPI version.")}a.downgrade=O})(W||(W={}));export{W as O,_ as S,A as a,S as b};
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import{j as a,o as B,r as y,T as g}from"../client-BwmHWUFW.js";import{v as T,A as C,O as w,_ as v,e as R,F as S,T as I,R as _,c as x,d as j,B as P}from"../AgenticaChatApplication-
|
|
1
|
+
import{j as a,o as B,r as y,T as g}from"../client-BwmHWUFW.js";import{v as T,A as C,O as w,_ as v,e as R,F as S,T as I,R as _,c as x,d as j,B as P}from"../AgenticaChatApplication-DxrCYEqZ.js";import{a as f,_ as b}from"../_isFormatUri-YqTfGpHo.js";import{D as U}from"../Divider-D4B39gYv.js";class k{constructor(){this.articles=[]}index(){return this.articles}create(o){const l={id:T(),title:o.input.title,body:o.input.body,thumbnail:o.input.thumbnail,created_at:new Date().toISOString(),updated_at:new Date().toISOString()};return this.articles.push(l),l}update(o){const l=this.articles.find(d=>d.id===o.id);if(l===void 0)throw new Error("Unable to find the matched article.");o.input.title!==void 0&&(l.title=o.input.title),o.input.body!==void 0&&(l.body=o.input.body),o.input.thumbnail!==void 0&&(l.thumbnail=o.input.thumbnail),l.updated_at=new Date().toISOString()}erase(o){const l=this.articles.findIndex(d=>d.id===o.id);if(l===-1)throw new Error("Unable to find the matched article.");this.articles.splice(l,1)}}const F=u=>{const o=new k,l=new C({model:"chatgpt",vendor:{api:new w({apiKey:u.apiKey,dangerouslyAllowBrowser:!0}),model:u.model??"gpt-4o-mini"},controllers:[{protocol:"class",name:"bbs",application:{model:"chatgpt",options:{reference:!1,strict:!1,separate:null},functions:[{name:"index",parameters:{type:"object",properties:{},additionalProperties:!1,required:[],$defs:{}},output:{description:"List of every articles",type:"array",items:{description:"Article entity.\n\n`IBbsArticle` is an entity representing an article in the BBS (Bulletin Board System).",type:"object",properties:{id:{title:"Primary Key",description:`Primary Key.
|
|
2
2
|
|
|
3
3
|
|
|
4
4
|
@format uuid`,type:"string"},created_at:{title:"Creation time of the article",description:`Creation time of the article.
|