@agentica/chat 0.30.0 → 0.30.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/{VendorConfigurationMovie-Coy9x47k.js → VendorConfigurationMovie-BF9-mkPN.js} +1 -1
- package/dist/assets/bbs/{index-rprWaFW8.js → index-B0J-d3cM.js} +1 -1
- package/dist/assets/shopping/{index.html-CXIn2tw7.js → index.html-CvD7zfzZ.js} +1 -1
- package/dist/assets/uploader/{index.html-BBOkC8P7.js → index.html-BelmjIv4.js} +1 -1
- package/dist/bbs/index.html +2 -2
- package/dist/shopping/index.html +2 -2
- package/dist/uploader/index.html +2 -2
- package/package.json +2 -2
package/dist/assets/{VendorConfigurationMovie-Coy9x47k.js → VendorConfigurationMovie-BF9-mkPN.js}
RENAMED
|
@@ -1434,7 +1434,7 @@ You have been provided with \`IValidation.IError[][]\` containing **previous his
|
|
|
1434
1434
|
- Redesign the entire AST structure using proper architectural patterns
|
|
1435
1435
|
- Enhance with comprehensive business context and realistic data
|
|
1436
1436
|
|
|
1437
|
-
**Success means: the error path never appears in future correction cycles.**`};var vDn={};const _Dn=new $Ie(()=>{var o;return TIe()?((o=vDn.LANG)==null?void 0:o.split(".")[0])??"en-US":navigator.language}),xDn=new $Ie(()=>Intl.DateTimeFormat().resolvedOptions().timeZone);function EDn(o){var y;if(((y=o==null?void 0:o.systemPrompt)==null?void 0:y.common)!==void 0)return o.systemPrompt.common(o);const s=(o==null?void 0:o.locale)??_Dn.get(),p=(o==null?void 0:o.timezone)??xDn.get();return A6.COMMON.replace("${locale}",s).replace("${timezone}",p).replace("${datetime}",new Date().toISOString())}const o$={write:EDn};function TDn(o){return typeof o.initialize=="function"}var JBt;(o=>{function s(p){return new TextDecoder().decode(p)}o.toUtf8=s})(JBt||(JBt={}));function jIe(o,s){return{accepted_prediction_tokens:(o.accepted_prediction_tokens??0)+(s.accepted_prediction_tokens??0),reasoning_tokens:(o.reasoning_tokens??0)+(s.reasoning_tokens??0),rejected_prediction_tokens:(o.rejected_prediction_tokens??0)+(s.rejected_prediction_tokens??0)}}function HIe(o,s){return{audio_tokens:(o.audio_tokens??0)+(s.audio_tokens??0),cached_tokens:(o.cached_tokens??0)+(s.cached_tokens??0)}}function kDn(o,s){return{prompt_tokens:(o.prompt_tokens??0)+(s.prompt_tokens??0),completion_tokens:(o.completion_tokens??0)+(s.completion_tokens??0),total_tokens:(o.total_tokens??0)+(s.total_tokens??0),completion_tokens_details:jIe(o.completion_tokens_details??{accepted_prediction_tokens:0,reasoning_tokens:0,rejected_prediction_tokens:0},s.completion_tokens_details??{accepted_prediction_tokens:0,reasoning_tokens:0,rejected_prediction_tokens:0}),prompt_tokens_details:HIe(o.prompt_tokens_details??{audio_tokens:0,cached_tokens:0},s.prompt_tokens_details??{audio_tokens:0,cached_tokens:0})}}const SDn={sum:kDn,sumCompletionTokenDetail:jIe,sumPromptTokenDetail:HIe};function CDn(o){const s=o instanceof Uint8Array?JBt.toUtf8(o):o;return JSON.parse(s)}function zIe(o,s){const p=o.choices;s.choices.forEach(C=>{const N=p[C.index];if(N!=null){p[C.index]=UIe(N,C);return}p[C.index]={index:C.index,finish_reason:C.finish_reason??null,logprobs:C.logprobs??null,message:{tool_calls:C.delta.tool_calls!==void 0?C.delta.tool_calls.reduce((L,z)=>{var G,q;return L[z.index]={id:z.id??"",type:"function",function:{name:((G=z.function)==null?void 0:G.name)??"",arguments:((q=z.function)==null?void 0:q.arguments)??""}},L},[]):void 0,content:C.delta.content??null,refusal:C.delta.refusal??null,role:"assistant"}}});const y=s.usage==null?o.usage:o.usage==null?s.usage:SDn.sum(o.usage,s.usage);return{...o,choices:p,usage:y}}function ADn(o){const s=o[0];if(s===void 0)throw new Error("No chunks received");return o.reduce(zIe,{id:s.id,choices:[],created:s.created,model:s.model,object:"chat.completion",usage:void 0,service_tier:s.service_tier,system_fingerprint:s.system_fingerprint})}function UIe(o,s){var p;if(o.finish_reason==null&&s.finish_reason!=null&&(o.finish_reason=s.finish_reason),o.logprobs==null&&s.logprobs!=null&&(o.logprobs=s.logprobs),s.delta.content!=null&&(o.message.content==null?o.message.content=s.delta.content:o.message.content+=s.delta.content),s.delta.refusal!=null&&(o.message.refusal==null?o.message.refusal=s.delta.refusal:o.message.refusal+=s.delta.refusal),s.delta.tool_calls!=null){(p=o.message).tool_calls??(p.tool_calls=[]);const y=o.message.tool_calls;s.delta.tool_calls.forEach(C=>{var L,z;const N=y[C.index];if(N!=null){y[C.index]=qIe(N,C);return}y[C.index]={id:C.id??"",type:"function",function:{name:((L=C.function)==null?void 0:L.name)??"",arguments:((z=C.function)==null?void 0:z.arguments)??""}}})}return o}function qIe(o,s){return s.function!=null&&(o.function.arguments+=s.function.arguments??"",o.function.name+=s.function.name??""),o.id+=s.id??"",o}const I6={transformCompletionChunk:CDn,accumulate:zIe,merge:ADn,mergeChoice:UIe,mergeToolCalls:qIe};async function IDn(o){const s=o.getReader(),p=[];for(;;){const{done:y,value:C}=await s.read();if(y)break;p.push(C)}return p}async function ODn(o,s,p){const y=o.getReader(),C=Xmt(y);let N=p??null;for await(const L of C){if(N===null){N=L;continue}N=s(N,L)}return N}function NDn(o){return new ReadableStream({start:p=>{p.enqueue(o),p.close()}})}async function*WIe(o){yield o}async function*Xmt(o){for(;;){const{done:s,value:p}=await o.read();if(s)break;yield p}}function PDn(o,s){const p=o.getReader();return new ReadableStream({pull:async y=>{const{done:C,value:N}=await p.read();C?y.close():y.enqueue(s(N))}})}const vC={readAll:IDn,reduce:ODn,from:NDn,transform:PDn};function Qmt(o){return{operation:o.operation,reason:o.reason,toJSON:()=>({operation:o.operation.toJSON(),reason:o.reason})}}function KIe(o,s){const p=o.stack.findIndex(N=>N.operation.name===s.name);if(p===-1)return;const y=o.stack[p];o.stack.splice(p,1);const C=nRn({selection:Qmt({operation:y.operation,reason:s.reason})});o.dispatch(C)}async function LDn(o,s){var L,z,G,q,nt,tt;const p=await o.request("call",{messages:[{role:"system",content:o$.write(o.config)},...o.histories.map(a$).flat(),{role:"user",content:o.prompt.contents.map(s$)},...((z=(L=o.config)==null?void 0:L.systemPrompt)==null?void 0:z.execute)===null?[]:[{role:"system",content:((nt=(q=(G=o.config)==null?void 0:G.systemPrompt)==null?void 0:q.execute)==null?void 0:nt.call(q,o.histories))??A6.EXECUTE}]],tools:s.map(et=>({type:"function",function:{name:et.name,description:et.function.description,parameters:"separated"in et.function&&et.function.separated!==void 0?et.function.separated.llm??{type:"object",properties:{},required:[],additionalProperties:!1,$defs:{}}:et.function.parameters}})),tool_choice:"auto"}),y=await vC.readAll(p),C=I6.merge(y),N=[];for(const et of C.choices){for(const st of et.message.tool_calls??[])if(st.type==="function"){const at=s.find(Dt=>Dt.name===st.function.name);if(at===void 0)continue;const Ot=await GIe(o,at,st,[],((tt=o.config)==null?void 0:tt.retry)??wk.RETRY);o.dispatch(Ot),N.push(Ot),TDn(o)&&KIe(o,{name:Ot.operation.name,reason:"completed"})}if(et.message.role==="assistant"&&et.message.content!=null&&et.message.content.length!==0){const st=et.message.content,at=GFt({get:()=>st,done:()=>!0,stream:WIe(st),join:async()=>Promise.resolve(st)});o.dispatch(at)}}return
|
|
1437
|
+
**Success means: the error path never appears in future correction cycles.**`};var vDn={};const _Dn=new $Ie(()=>{var o;return TIe()?((o=vDn.LANG)==null?void 0:o.split(".")[0])??"en-US":navigator.language}),xDn=new $Ie(()=>Intl.DateTimeFormat().resolvedOptions().timeZone);function EDn(o){var y;if(((y=o==null?void 0:o.systemPrompt)==null?void 0:y.common)!==void 0)return o.systemPrompt.common(o);const s=(o==null?void 0:o.locale)??_Dn.get(),p=(o==null?void 0:o.timezone)??xDn.get();return A6.COMMON.replace("${locale}",s).replace("${timezone}",p).replace("${datetime}",new Date().toISOString())}const o$={write:EDn};function TDn(o){return typeof o.initialize=="function"}var JBt;(o=>{function s(p){return new TextDecoder().decode(p)}o.toUtf8=s})(JBt||(JBt={}));function jIe(o,s){return{accepted_prediction_tokens:(o.accepted_prediction_tokens??0)+(s.accepted_prediction_tokens??0),reasoning_tokens:(o.reasoning_tokens??0)+(s.reasoning_tokens??0),rejected_prediction_tokens:(o.rejected_prediction_tokens??0)+(s.rejected_prediction_tokens??0)}}function HIe(o,s){return{audio_tokens:(o.audio_tokens??0)+(s.audio_tokens??0),cached_tokens:(o.cached_tokens??0)+(s.cached_tokens??0)}}function kDn(o,s){return{prompt_tokens:(o.prompt_tokens??0)+(s.prompt_tokens??0),completion_tokens:(o.completion_tokens??0)+(s.completion_tokens??0),total_tokens:(o.total_tokens??0)+(s.total_tokens??0),completion_tokens_details:jIe(o.completion_tokens_details??{accepted_prediction_tokens:0,reasoning_tokens:0,rejected_prediction_tokens:0},s.completion_tokens_details??{accepted_prediction_tokens:0,reasoning_tokens:0,rejected_prediction_tokens:0}),prompt_tokens_details:HIe(o.prompt_tokens_details??{audio_tokens:0,cached_tokens:0},s.prompt_tokens_details??{audio_tokens:0,cached_tokens:0})}}const SDn={sum:kDn,sumCompletionTokenDetail:jIe,sumPromptTokenDetail:HIe};function CDn(o){const s=o instanceof Uint8Array?JBt.toUtf8(o):o;return JSON.parse(s)}function zIe(o,s){const p=o.choices;s.choices.forEach(C=>{const N=p[C.index];if(N!=null){p[C.index]=UIe(N,C);return}p[C.index]={index:C.index,finish_reason:C.finish_reason??null,logprobs:C.logprobs??null,message:{tool_calls:C.delta.tool_calls!==void 0?C.delta.tool_calls.reduce((L,z)=>{var G,q;return L[z.index]={id:z.id??"",type:"function",function:{name:((G=z.function)==null?void 0:G.name)??"",arguments:((q=z.function)==null?void 0:q.arguments)??""}},L},[]):void 0,content:C.delta.content??null,refusal:C.delta.refusal??null,role:"assistant"}}});const y=s.usage==null?o.usage:o.usage==null?s.usage:SDn.sum(o.usage,s.usage);return{...o,choices:p,usage:y}}function ADn(o){const s=o[0];if(s===void 0)throw new Error("No chunks received");return o.reduce(zIe,{id:s.id,choices:[],created:s.created,model:s.model,object:"chat.completion",usage:void 0,service_tier:s.service_tier,system_fingerprint:s.system_fingerprint})}function UIe(o,s){var p;if(o.finish_reason==null&&s.finish_reason!=null&&(o.finish_reason=s.finish_reason),o.logprobs==null&&s.logprobs!=null&&(o.logprobs=s.logprobs),s.delta.content!=null&&(o.message.content==null?o.message.content=s.delta.content:o.message.content+=s.delta.content),s.delta.refusal!=null&&(o.message.refusal==null?o.message.refusal=s.delta.refusal:o.message.refusal+=s.delta.refusal),s.delta.tool_calls!=null){(p=o.message).tool_calls??(p.tool_calls=[]);const y=o.message.tool_calls;s.delta.tool_calls.forEach(C=>{var L,z;const N=y[C.index];if(N!=null){y[C.index]=qIe(N,C);return}y[C.index]={id:C.id??"",type:"function",function:{name:((L=C.function)==null?void 0:L.name)??"",arguments:((z=C.function)==null?void 0:z.arguments)??""}}})}return o}function qIe(o,s){return s.function!=null&&(o.function.arguments+=s.function.arguments??"",o.function.name+=s.function.name??""),o.id+=s.id??"",o}const I6={transformCompletionChunk:CDn,accumulate:zIe,merge:ADn,mergeChoice:UIe,mergeToolCalls:qIe};async function IDn(o){const s=o.getReader(),p=[];for(;;){const{done:y,value:C}=await s.read();if(y)break;p.push(C)}return p}async function ODn(o,s,p){const y=o.getReader(),C=Xmt(y);let N=p??null;for await(const L of C){if(N===null){N=L;continue}N=s(N,L)}return N}function NDn(o){return new ReadableStream({start:p=>{p.enqueue(o),p.close()}})}async function*WIe(o){yield o}async function*Xmt(o){for(;;){const{done:s,value:p}=await o.read();if(s)break;yield p}}function PDn(o,s){const p=o.getReader();return new ReadableStream({pull:async y=>{const{done:C,value:N}=await p.read();C?y.close():y.enqueue(s(N))}})}const vC={readAll:IDn,reduce:ODn,from:NDn,transform:PDn};function Qmt(o){return{operation:o.operation,reason:o.reason,toJSON:()=>({operation:o.operation.toJSON(),reason:o.reason})}}function KIe(o,s){const p=o.stack.findIndex(N=>N.operation.name===s.name);if(p===-1)return;const y=o.stack[p];o.stack.splice(p,1);const C=nRn({selection:Qmt({operation:y.operation,reason:s.reason})});o.dispatch(C)}async function LDn(o,s){var L,z,G,q,nt,tt;const p=await o.request("call",{messages:[{role:"system",content:o$.write(o.config)},...o.histories.map(a$).flat(),{role:"user",content:o.prompt.contents.map(s$)},...((z=(L=o.config)==null?void 0:L.systemPrompt)==null?void 0:z.execute)===null?[]:[{role:"system",content:((nt=(q=(G=o.config)==null?void 0:G.systemPrompt)==null?void 0:q.execute)==null?void 0:nt.call(q,o.histories))??A6.EXECUTE}]],tools:s.map(et=>({type:"function",function:{name:et.name,description:et.function.description,parameters:"separated"in et.function&&et.function.separated!==void 0?et.function.separated.llm??{type:"object",properties:{},required:[],additionalProperties:!1,$defs:{}}:et.function.parameters}})),tool_choice:"auto"}),y=await vC.readAll(p),C=I6.merge(y),N=[];for(const et of C.choices){for(const st of et.message.tool_calls??[])if(st.type==="function"){const at=s.find(Dt=>Dt.name===st.function.name);if(at===void 0)continue;const Ot=await GIe(o,at,st,[],((tt=o.config)==null?void 0:tt.retry)??wk.RETRY);o.dispatch(Ot),N.push(Ot),TDn(o)&&KIe(o,{name:Ot.operation.name,reason:"completed"})}if(et.message.role==="assistant"&&et.message.content!=null&&et.message.content.length!==0){const st=et.message.content,at=GFt({get:()=>st,done:()=>!0,stream:WIe(st),join:async()=>Promise.resolve(st)});o.dispatch(at)}}return N}async function GIe(o,s,p,y,C){const N=DDn(s,p);if(o.dispatch(N),N.type==="jsonParseError")return RDn(o,N,y,C-1);const L=s.function.validate(N.arguments);if(L.success===!1){const G=aRn({id:p.id,operation:s,result:L});return o.dispatch(G),MDn(o,N,G,[...y,G],C-1)}const z=await BDn(N,s);return o.dispatch(z),z}async function MDn(o,s,p,y,C){var N,L,z;return YIe(o,{giveUp:()=>ymt({operation:s.operation,arguments:s.arguments,value:{name:"ValidationError",message:`Invalid arguments. The validation failed after ${wk.RETRY} retries.`,errors:p.result.errors}}),operation:s.operation,messageArguments:JSON.stringify(s.arguments),messageToolParam:{role:"tool",content:JSON.stringify(p.result.errors),tool_call_id:s.id},systemPrompt:((z=(L=(N=o.config)==null?void 0:N.systemPrompt)==null?void 0:L.validate)==null?void 0:z.call(L,y.slice(0,-1)))??[A6.VALIDATE,...y.length>1?["",A6.VALIDATE_REPEATED.replace("${{HISTORICAL_ERRORS}}",JSON.stringify(y.slice(0,-1).map(G=>G.result.errors)))]:[]].join(`
|
|
1438
1438
|
`),life:C,previousValidationErrors:y})}async function RDn(o,s,p,y){var C,N,L;return YIe(o,{giveUp:()=>ymt({operation:s.operation,arguments:{},value:{name:"JsonParseError",message:`Invalid JSON format. The parsing failed after ${wk.RETRY} retries.`,arguments:s.arguments,errorMessage:s.errorMessage}}),operation:s.operation,messageArguments:s.arguments,messageToolParam:null,systemPrompt:((L=(N=(C=o.config)==null?void 0:C.systemPrompt)==null?void 0:N.jsonParseError)==null?void 0:L.call(N,s))??A6.JSON_PARSE_ERROR.replace("${{ERROR_MESSAGE}}",s.errorMessage),life:y,previousValidationErrors:p})}function DDn(o,s){try{const p=JSON.parse(s.function.arguments);return rRn({id:s.id,operation:o,arguments:p})}catch(p){return iRn({id:s.id,operation:o,arguments:s.function.arguments,errorMessage:p instanceof Error?p.message:String(p)})}}async function YIe(o,s){var L,z,G,q,nt,tt;if(s.life<=0)return s.giveUp();const p=await o.request("call",{messages:[{role:"system",content:o$.write(o.config)},...o.histories.map(a$).flat(),{role:"user",content:o.prompt.contents.map(s$)},{role:"system",content:((G=(z=(L=o.config)==null?void 0:L.systemPrompt)==null?void 0:z.execute)==null?void 0:G.call(z,o.histories))??A6.EXECUTE},{role:"assistant",tool_calls:[{type:"function",id:P6(),function:{name:s.operation.name,arguments:s.messageArguments}}]},...s.messageToolParam!==null?[s.messageToolParam]:[],{role:"system",content:s.systemPrompt}],tools:[{type:"function",function:{name:s.operation.name,description:s.operation.function.description,parameters:"separated"in s.operation.function&&s.operation.function.separated!==void 0?((q=s.operation.function.separated)==null?void 0:q.llm)??{$defs:{},type:"object",properties:{},additionalProperties:!1,required:[]}:s.operation.function.parameters}}],tool_choice:{type:"function",function:{name:s.operation.name}}}),y=await vC.readAll(p),N=(tt=(nt=I6.merge(y).choices[0])==null?void 0:nt.message.tool_calls)==null?void 0:tt.find(et=>et.function.name===s.operation.name);return N===void 0?s.giveUp():GIe(o,s.operation,N,s.previousValidationErrors,s.life)}async function BDn(o,s){try{const p=await(async()=>{switch(s.protocol){case"class":return FDn(o,s);case"http":return $Dn(o,s);case"mcp":return jDn(o,s);default:throw new Error("Unknown protocol")}})();return ymt({operation:o.operation,arguments:o.arguments,value:p})}catch(p){return ymt({operation:o.operation,arguments:o.arguments,value:p instanceof Error?{...p,name:p.name,message:p.message}:p})}}async function FDn(o,s){const p=s.controller.execute;return typeof p=="function"?await p({application:s.controller.application,function:s.function,arguments:o.arguments}):await p[s.function.name](o.arguments)}async function $Dn(o,s){const p=s.controller.execute;return typeof p=="function"?await p({connection:s.controller.connection,application:s.controller.application,function:s.function,arguments:o.arguments}):await QBt.propagate({connection:s.controller.connection,application:s.controller.application,function:s.function,input:o.arguments})}async function jDn(o,s){return s.controller.client.callTool({method:s.function.name,name:s.function.name,arguments:o.arguments}).then(p=>p.content)}var YFt={};Object.defineProperty(YFt,"__esModule",{value:!0});var c$=YFt._validateReport=void 0;const HDn=o=>{const s=p=>{if(o.length===0)return!0;const y=o[o.length-1].path;return p.length>y.length||y.substring(0,p.length)!==p};return(p,y)=>(p&&s(y.path)&&o.push(y),!1)};c$=YFt._validateReport=HDn;const Sbt={functions:[{name:"cancelFunctions",parameters:{description:` Properties of the function
|
|
1439
1439
|
|
|
1440
1440
|
------------------------------
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import{j as y,o as v,r as h,T as b}from"../client-B3aq8qpT.js";import{v as I,A as B,d as T,_ as m,V as g,c as C,F as A,T as j,B as w}from"../VendorConfigurationMovie-
|
|
1
|
+
import{j as y,o as v,r as h,T as b}from"../client-B3aq8qpT.js";import{v as I,A as B,d as T,_ as m,V as g,c as C,F as A,T as j,B as w}from"../VendorConfigurationMovie-BF9-mkPN.js";import{a as u,_ as p}from"../_isFormatUri-YqTfGpHo.js";import{D as x}from"../Divider-DX1xhf0M.js";class R{constructor(){this.articles=[]}index(){return this.articles}create(c){const d={id:I(),title:c.input.title,body:c.input.body,thumbnail:c.input.thumbnail,created_at:new Date().toISOString(),updated_at:new Date().toISOString()};return this.articles.push(d),d}update(c){const d=this.articles.find(s=>s.id===c.id);if(d===void 0)throw new Error("Unable to find the matched article.");c.input.title!==void 0&&(d.title=c.input.title),c.input.body!==void 0&&(d.body=c.input.body),c.input.thumbnail!==void 0&&(d.thumbnail=c.input.thumbnail),d.updated_at=new Date().toISOString()}erase(c){const d=this.articles.findIndex(s=>s.id===c.id);if(d===-1)throw new Error("Unable to find the matched article.");this.articles.splice(d,1)}}const P={chatgpt:{model:"chatgpt",options:{reference:!0,strict:!1,separate:null},functions:[{name:"index",parameters:{type:"object",properties:{},additionalProperties:!1,required:[],$defs:{IBbsArticle:{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.
|