@comate/zulu 0.7.0 → 0.7.2
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/comate-engine/node_modules/@comate/plugin-engine/dist/index.js +7 -7
- package/comate-engine/node_modules/@comate/plugin-host/dist/index.js +1 -1
- package/comate-engine/node_modules/@comate/plugin-host/dist/main.js +1 -1
- package/comate-engine/node_modules/@comate/plugin-host/dist/{user-DPNOYSqg.js → user-Cd64T1ck.js} +5 -5
- package/comate-engine/node_modules/@comate/plugin-shared-internals/dist/index.d.ts +97 -3
- package/comate-engine/node_modules/@comate/plugin-shared-internals/dist/index.js +5 -5
- package/comate-engine/node_modules/better-sqlite3/node_modules/.bin/prebuild-install +2 -2
- package/comate-engine/package.json +3 -1
- package/comate-engine/plugins/demo-feature/dist/index.js +28 -0
- package/comate-engine/server.js +76 -76
- package/dist/bundle/index.js +2 -2
- package/package.json +1 -1
|
@@ -1 +1 @@
|
|
|
1
|
-
import{U as t,S as e}from"./user-
|
|
1
|
+
import{U as t,S as e}from"./user-Cd64T1ck.js";export{B as BackgroundServiceProvider,C as ConfigProvider,F as FallbackProvider,a as FunctionModel,P as PromptProvider,T as TextModel,n as getGitRepositoryUrl}from"./user-Cd64T1ck.js";import"node:path";import"node:fs/promises";import"node:fs";import"node:process";import"node:url";import"node:stream";import"os";import"path";import"node:crypto";import"node:os";import"node:buffer";import"node:child_process";import"child_process";import"fs";import"node:timers/promises";import"stream";import"node:util";import"constants";import"util";import"assert";import"http";import"https";import"url";import"crypto";import"tty";import"zlib";import"events";import"buffer";import"string_decoder";const s=["comate-sec.baidu-int.com","comate-sec.baidu.com","comate-sec-test.baidu-int.com"];function i(e,n={}){const i=t.currentAuth,o=new URL(e);if(!s.includes(o.hostname))return Promise.reject(new Error("Unauthorized Host"));const r={"X-Comate-Authorization":i};return fetch(e,{...n,headers:{...n.headers,...r}})}const o=["10.11.135.35","comate.baidu.com","comate.baidu-int.com"];function r(e,s={}){const n=t.currentAuth,i=new URL(e);if(!o.includes(i.hostname))return Promise.reject(new Error("Unauthorized Host"));const r={"Uuap-login-name":n};return fetch(e,{...s,headers:{...s.headers,...r}})}class c extends e{async*execute(t){const e=await this.buildRequest(t),s=(n=e.headers,n?.["Content-Type"]??n?.["content-type"]??null)?.includes("application/json");var n;const i=e.timeout?AbortSignal.timeout(e.timeout):null;try{const t=await fetch(e.url,{method:e.method,headers:e.headers,body:e.body?s?JSON.stringify(e.body):e.body:null,signal:i});if(t.ok){const s=await("json"===e.responseType?t.json():t.text());yield{command:"draw",content:this.transformResponseToText(s)}}else yield{command:"fail",content:`非常抱歉,发生了未知的网络错误,状态码为${t.status}。`}}catch{i?.aborted?yield{command:"fail",content:"非常抱歉,网络请求超时。"}:yield{command:"fail",content:"非常抱歉,发生了未知的网络错误。"}}}transformResponseToText(t){return String(t)}}class h{outputType;elements=[];constructor(t={outputType:"string"}){this.outputType=t.outputType}append(t){this.elements.push(this.normalize(t))}flush(t){return t&&this.append(t),{command:"draw",content:this.elements}}async flushStreaming(t){for await(const e of t)this.flush(e)}replaceLast(t){this.elements.length?this.elements[this.elements.length-1]=this.normalize(t):this.append(t)}flushReplaceLast(t){return this.replaceLast(t),this.flush()}fail(t){return this.elements.length=0,{command:"fail",content:this.normalize(t)}}normalize(t){if("mixed"===this.outputType)return t;if("string"==typeof t)return t;switch(t.type){case"p":return t.children+"\n\n";case"code-block":return"```"+(t.language??"")+"\n"+(e=t.children,(Array.isArray(e)?e:[e]).map((t=>t.toString())).join(""))+(t.closed?"\n```":"");default:return""}var e}}class l{elements=[];append(t){Array.isArray(t)?this.elements.push(...t):this.elements.push(t)}flush(t){return t&&this.append(t),{command:"draw",content:this.elements}}replaceLast(t){this.elements.length?this.elements[this.elements.length-1]=t:this.append(t)}replaceAll(t){this.elements.length?this.elements=Array.isArray(t)?t:[t]:this.append(t)}flushReplaceLast(t){return this.replaceLast(t),this.flush()}flushReplaceAll(t){return this.replaceAll(t),this.flush()}appendLast(t){const e=this.elements.at(-1);return!!e&&(e.children?!!Array.isArray(e.children)&&(e.children.push(t),!0):(e.children=[t],!0))}flushAppendLast(t){return this.appendLast(t),this.flush()}fail(t){return this.elements.length=0,{command:"fail",content:t}}}class m{chunks=[];append(t){this.chunks.push(t)}flush(t){return t&&this.append(t),{command:"draw",content:this.chunks}}replaceLast(t){this.chunks.length?this.chunks[this.chunks.length-1]=t:this.append(t)}flushReplaceLast(t){return this.replaceLast(t),this.flush()}fail(t){return this.chunks.length=0,{command:"fail",content:t}}}class p{sections={dynamicSections:[],dynamicFooterSections:[]};content="";actionSet={actions:{},actionConfigs:{}};append(t,e,s){t?.dynamicSections?.length&&this.sections.dynamicSections.push(...t.dynamicSections),t?.dynamicFooterSections?.length&&this.sections.dynamicFooterSections.push(...t.dynamicFooterSections),e&&(this.content=e),s&&(this.actionSet=s)}flush(t,e,s){return(t||e||s)&&this.append(t,e,s),{command:"section",sections:this.sections,content:this.content,actionSet:this.actionSet}}replaceLast(t,e,s){const n=this.sections.dynamicSections.length&&t.dynamicSections?.length,i=this.sections.dynamicFooterSections.length&&t.dynamicFooterSections?.length;n||i?(t.dynamicSections?.length&&(this.sections.dynamicSections=t.dynamicSections),t.dynamicFooterSections?.length&&(this.sections.dynamicFooterSections=t.dynamicFooterSections),this.content=e??"",s&&(this.actionSet=s)):this.append(t,e,s)}flushReplaceLast(t,e,s){return this.replaceLast(t,e,s),this.flush()}}-1===Math.random()&&console.log("THIS IS COMATE");export{l as ElementChunkStream,c as PipeHttpRequestSkillProvider,p as SectionChunkStream,e as SkillProvider,m as StringChunkStream,h as TaskProgressChunkStream,r as authorizedFirstPartyFetch,i as fetch};
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import p from"node:path";import{g as e,P as a,S as d,F as m,B as i,C as l,T as t,L as s,a as o,I as r,i as n,b as v,U as u,c,A as h,d as w,e as f,f as g,h as y,j as N,k as b,l as _,m as S}from"./user-
|
|
1
|
+
import p from"node:path";import{g as e,P as a,S as d,F as m,B as i,C as l,T as t,L as s,a as o,I as r,i as n,b as v,U as u,c,A as h,d as w,e as f,f as g,h as y,j as N,k as b,l as _,m as S}from"./user-Cd64T1ck.js";import D from"node:fs/promises";import"node:fs";import"node:process";import"node:url";import"node:stream";import"os";import"path";import"node:crypto";import"node:os";import V from"stream";import T from"http";import C from"url";import A from"punycode";import E from"https";import k from"zlib";import"node:buffer";import"node:child_process";import"child_process";import"fs";import"node:timers/promises";import"node:util";import"constants";import"util";import"assert";import"crypto";import"tty";import"events";import"buffer";import"string_decoder";var I="win32"===process.platform;function B(p,e){var a=p[e];return e>0&&("/"===a||I&&"\\"===a)}
|
|
2
2
|
/*!
|
|
3
3
|
* normalize-path <https://github.com/jonschlinkert/normalize-path>
|
|
4
4
|
*
|