@yukino.js/yukino 0.0.13-dev → 0.0.14
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/README.md +20 -16
- package/dist/{a2a-DG2JNM3U.js → a2a-D7KSHNUT.js} +4 -3
- package/dist/{acp-DCZDS6FQ.js → acp-W4R5P6CZ.js} +7 -7
- package/dist/{anthropic-5BTWVZVT.js → anthropic-DSNN5AE5.js} +1 -1
- package/dist/browser/dist/index.html +44 -0
- package/dist/browser/dist/static/index.css +2 -0
- package/dist/{fe → browser}/dist/static/index.js +48 -48
- package/dist/{chunk-4CLD7LEU.js → chunk-A7CJPQC5.js} +1 -1
- package/dist/{chunk-COHBT6M7.js → chunk-D2SZ6GQJ.js} +184 -186
- package/dist/{chunk-AZQD75PX.js → chunk-GVRZBATW.js} +1 -1
- package/dist/{chunk-OI2W6R6H.js → chunk-HWCLMDQF.js} +8 -8
- package/dist/{chunk-BDLFNDC4.js → chunk-I356BFD2.js} +1 -1
- package/dist/chunk-JDK4YHNF.js +63 -0
- package/dist/{chunk-5URXBVET.js → chunk-OREDGNI6.js} +1 -1
- package/dist/chunk-T6WQ3Z5J.js +4 -0
- package/dist/{chunk-5DK2M7VI.js → chunk-UUWXDH7J.js} +1 -1
- package/dist/{chunk-IWMCIYOG.js → chunk-WKSVBXUO.js} +26 -25
- package/dist/{chunk-SZXXASVH.js → chunk-Z3EFT645.js} +1 -1
- package/dist/lib/{anthropic-AVZIC22O.js → anthropic-TDNNKQMT.js} +4 -4
- package/dist/lib/{chunk-O2H6VKKR.js → chunk-56DL5ZYL.js} +2 -2
- package/dist/lib/{chunk-TUNZLQLO.js → chunk-BRLCCEU7.js} +1 -1
- package/dist/lib/{chunk-EGJKLA2W.js → chunk-EJNKEFE7.js} +2 -2
- package/dist/lib/{chunk-XH7D5FLE.js → chunk-IZXMDC5O.js} +3 -3
- package/dist/lib/{chunk-QJ32WYQY.js → chunk-UKXGO7AW.js} +264 -324
- package/dist/lib/{chunk-GVI5R2DA.js → chunk-WNGF7243.js} +1 -2
- package/dist/lib/{chunk-LSI3T24Q.js → chunk-WXR5HNB4.js} +1 -1
- package/dist/lib/index.d.ts +118 -298
- package/dist/lib/index.js +472 -1235
- package/dist/lib/{openai-54IQOU6Y.js → openai-6VYIA7CT.js} +3 -3
- package/dist/lib/{providers-MOCB6Y5L.js → providers-UXL5FVF7.js} +2 -2
- package/dist/lib/{tool-filter-5Z6UTRRR.js → tool-filter-O6YLSFAS.js} +3 -3
- package/dist/{main-IA22XMQR.js → main-FOIMPIOD.js} +232 -223
- package/dist/main.js +11 -2
- package/dist/{openai-I2TTMBWK.js → openai-7C6BVQ7M.js} +1 -1
- package/dist/{providers-DXQRJUIY.js → providers-TH6MQC7V.js} +1 -1
- package/dist/{server-QS7CX37F.js → server-TC5GDF6E.js} +1 -1
- package/dist/tool-filter-SYH5ZFC2.js +4 -0
- package/package.json +6 -6
- package/dist/chunk-CW5XFH7H.js +0 -59
- package/dist/chunk-UGX62ZSO.js +0 -4
- package/dist/fe/dist/index.html +0 -21
- package/dist/fe/dist/static/index.css +0 -2
- package/dist/tool-filter-KDQMXIDC.js +0 -4
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
#!/usr/bin/env node
|
|
2
2
|
import { createRequire as __yukinoCreateRequire } from "node:module";
|
|
3
3
|
const require = __yukinoCreateRequire(import.meta.url);
|
|
4
|
-
import{a as _}from"./chunk-MQAQBW7F.js";import{b}from"./chunk-
|
|
4
|
+
import{a as _}from"./chunk-MQAQBW7F.js";import{b}from"./chunk-HWCLMDQF.js";import{C as r,b as x}from"./chunk-W4GMCNWF.js";function m(){return b("config.yaml")}var g=["off","minimal","low","medium","high","xhigh","max"],p=r.enum(["none","minimal","low","medium","high","xhigh","max"]),D=r.enum(["low","medium","high","xhigh","max"]),M=r.strictObject({off:r.literal("none").nullable().optional(),minimal:p.nullable().optional(),low:p.nullable().optional(),medium:p.nullable().optional(),high:p.nullable().optional(),xhigh:p.nullable().optional(),max:p.nullable().optional()}),y=r.looseObject({name:r.string(),protocol:r.enum(["anthropic","openai","openai-compat"]),base_url:r.string(),model:r.string(),api_key:r.string().optional(),thinking:r.enum(g).optional(),reasoning:r.boolean().optional(),thinking_level_map:M.optional(),thinking_mode:r.enum(["budget","adaptive"]).optional(),context_window:r.coerce.number().optional(),max_output_tokens:r.coerce.number().optional()});function ue(e,n){return e[n]??e[0]}var K="high",d=1e6,h=128e3,V={minimal:1024,low:2048,medium:8192,high:16384,xhigh:32768,max:65536},$=1024,F=1024;function ae(e){return g.some(n=>n===e)}function v(e){return B(e,e.thinking??K)}function fe(e){return e==="off"?0:V[e]}function w(e,n){if(n?.reasoning===!1)return null;if(e==="off")return"none";let t=n?.thinking_level_map?.[e];if(t!==void 0)return t;if(n?.protocol==="anthropic"&&n.thinking_mode==="adaptive"){if(e==="minimal")return"low";if(e==="xhigh")return"high"}return(n?.protocol==="openai"||n?.protocol==="openai-compat")&&(e==="xhigh"||e==="max")?"high":e}function G(e,n){let t=D.safeParse(w(e,n));return t.success?t.data:null}function H(e){return e.reasoning===!1||e.protocol==="anthropic"&&e.thinking_mode!=="adaptive"&&P(e)<$+F?["off"]:g.filter(n=>{if(n==="off")return!0;if(e.protocol==="anthropic"&&e.thinking_mode==="adaptive")return G(n,e)!==null;let t=w(n,e);return!(t===null||t==="none"||(e.protocol==="openai"||e.protocol==="openai-compat")&&(n==="xhigh"||n==="max")&&e.thinking_level_map?.[n]===void 0)})}function B(e,n){let t=H(e),o="off";for(let s of g)if(t.includes(s)&&(o=s),s===n)break;return o}function ce(e){return{...e,thinking:v(e),context_window:E(e),max_output_tokens:P(e)}}function E(e){return Number.isSafeInteger(e.context_window)&&(e.context_window??0)>0?e.context_window??d:d}function P(e){let n=e.max_output_tokens,t=Number.isSafeInteger(n)&&(n??0)>0?n??h:h;return Math.min(t,E(e))}import{randomUUID as W}from"crypto";import{existsSync as N,mkdirSync as X,readFileSync as q,renameSync as Z,unlinkSync as J,writeFileSync as Q}from"fs";import{dirname as Y,join as ee}from"path";var L=(e,n,t)=>r.preprocess(o=>o===void 0||typeof o=="string"&&!o.trim()?e:o,r.union([r.number(),r.string().trim().regex(/^\d+$/,"Enter a whole number").transform(Number)]).pipe(r.number().int().min(n).max(t))),ne=y.extend({name:r.string().trim().min(1,"Name is required"),base_url:r.url("Enter a valid HTTP(S) URL").refine(e=>/^https?:\/\//i.test(e),"Use an HTTP(S) URL"),api_key:r.string().trim().min(1,"API key is required"),model:r.string().trim().min(1,"Model is required"),thinking:r.enum(g).optional(),context_window:L(d,1e3,1e7),max_output_tokens:L(h,1,1e6)}).refine(e=>e.max_output_tokens<=e.context_window,{path:["max_output_tokens"],message:"Max output tokens must not exceed the context window"}).transform(e=>({...e,thinking:v(e)}));function k(e){if(!N(e))return{};let n;try{n=_.load(q(e,"utf-8"))}catch{throw new Error(`Unable to read existing ${e}; it has not been changed.`)}return r.record(r.string(),r.unknown()).parse(n??{})}function T(e,n){let t=Y(e);X(t,{recursive:!0});let o=ee(t,`.config-${W()}.tmp`);try{Q(o,_.dump(n,{lineWidth:-1,noRefs:!0}),{encoding:"utf-8",mode:384,flag:"wx"}),Z(o,e)}finally{N(o)&&J(o)}}function _e(e,n){let t=ne.parse(e),o=m(),s=k(o),f=[...r.array(r.record(r.string(),r.unknown())).parse(s.providers??[])];for(let c of n)f.some(z=>z.base_url===c.base_url)||f.push({...c});let i=[],a=!1;for(let c of f){if(c.base_url!==t.base_url){i.push(c);continue}a||(a=!0,i.push(t))}a||i.push(t);let j=i.map(c=>y.parse(c));return T(o,{...s,providers:i}),{provider:t,providers:j,replaced:a,path:o}}function A(e,n,t){let o=m(),s=k(o),u=r.array(r.record(r.string(),r.unknown())).parse(s.providers??[]),f=u.filter(a=>a.base_url===e);if(f.length===0)throw new Error(`Provider with base URL "${e}" not found in ${o}.`);let i=f.filter(a=>a[n]!==t);if(i.length!==0){for(let a of i)a[n]=t;T(o,{...s,providers:u})}}function ye(e,n){A(e,"thinking",n)}function ve(e,n){A(e,"model",n)}function ke(e){let n=m(),t=k(n);t.default_provider!==e&&T(n,{...t,default_provider:e})}var te="Tool execution was interrupted. The tool may or may not have completed; verify before relying on its effects.",Se="The user rejected this tool use. Nothing was changed (for file edits, the new content was NOT written).";function be(e){let n=[];for(let t=0;t<e.length;t++){let o=e[t];if(o.role==="assistant"&&o.toolUses?.length){n.push(o);let s=new Set(o.toolUses.map(i=>i.toolUseId)),u=[],f=[];for(;t+1<e.length;){let i=e[t+1];if(i.role!=="user"||!i.toolResults?.length||i.toolUses?.length)break;t++,f.push(i);for(let a of i.toolResults)s.delete(a.toolUseId)&&u.push(a)}for(let i of s)u.push({toolUseId:i,content:te,isError:!0});n.push({...f[0]??{role:"user",content:""},toolResults:u});for(let i of f.slice(1))(i.content.length>0||i.thinkingBlocks?.length)&&n.push({...i,toolResults:[]});continue}if((o.toolResults?.length??0)>0){if(o.content.length===0&&!o.toolUses?.length&&!o.thinkingBlocks?.length)continue;n.push({...o,toolResults:[]})}else n.push(o)}return n}var l=class extends Error{constructor(n){super(n),this.name="LLMError"}},C=class extends l{constructor(n){super(n),this.name="AuthenticationError"}},O=class extends l{retryAfter;constructor(n,t){super(n),this.name="RateLimitError",this.retryAfter=t}},U=class extends l{constructor(n){super(n),this.name="NetworkError"}},I=class extends l{constructor(t,o){super(t);this.retryAfter=o;this.name="ServerError"}retryAfter},R=class extends l{constructor(n){super(n),this.name="ContextTooLongError"}};function Ee(e){return/context_length_exceeded/i.test(e)||/maximum\s+context\s+length/i.test(e)||/prompts?\s+(?:is\s+)?too\s+long/i.test(e)}function S(e){return!!e._zod}function Ge(e,n){return S(e)?x(e,n):e.safeParse(n)}function He(e){if(!e)return;let n;if(S(e)?n=e._zod?.def?.shape:n=e.shape,!!n){if(typeof n=="function")try{return n()}catch{return}return n}}function re(e){return e.length===0?"object root":e.reduce((n,t,o)=>o===0?String(t):typeof t=="number"?`${n}[${t}]`:`${n}.${t}`,"")}function Be(e){if(e&&typeof e=="object"){if("issues"in e&&Array.isArray(e.issues)&&e.issues.length>0)return e.issues.map(n=>n.path?.length?`${n.message} at ${re(n.path)}`:n.message).join(`
|
|
5
5
|
`);if("message"in e&&typeof e.message=="string")return e.message;try{return JSON.stringify(e)}catch{return String(e)}}return String(e)}function We(e){if(S(e)){let u=e._zod?.def;if(u){if(u.value!==void 0)return u.value;if(Array.isArray(u.values)&&u.values.length>0)return u.values[0]}}let t=e._def;if(t){if(t.value!==void 0)return t.value;if(Array.isArray(t.values)&&t.values.length>0)return t.values[0]}let o=e.value;if(o!==void 0)return o}export{Ge as a,He as b,Be as c,We as d,m as e,g as f,y as g,ue as h,K as i,d as j,h as k,F as l,ae as m,v as n,fe as o,w as p,G as q,H as r,B as s,ce as t,E as u,P as v,ne as w,_e as x,ye as y,ve as z,ke as A,Se as B,be as C,l as D,C as E,O as F,U as G,I as H,R as I,Ee as J};
|