@yukino.js/yukino 0.0.6 → 0.0.8

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.
Files changed (40) hide show
  1. package/README.md +147 -37
  2. package/dist/a2a-GBVNBDMY.js +14 -0
  3. package/dist/{acp-U7GA5YRP.js → acp-C6VUCEZ6.js} +7 -7
  4. package/dist/anthropic-ZEQI4K52.js +4 -0
  5. package/dist/chunk-37IAJFPF.js +4 -0
  6. package/dist/{chunk-E7FXB7TA.js → chunk-3P7BR7SO.js} +17 -17
  7. package/dist/{chunk-WVT2D5AR.js → chunk-6XDMANXO.js} +1 -1
  8. package/dist/{chunk-SYLHBECV.js → chunk-L5C5JBLP.js} +1 -1
  9. package/dist/chunk-MU6PSBZT.js +358 -0
  10. package/dist/chunk-WGFROGUC.js +8 -0
  11. package/dist/{chunk-ME5UYXP4.js → chunk-YHE4BT76.js} +148 -148
  12. package/dist/esm-4KOJC56H.js +225 -0
  13. package/dist/fe/dist/index.html +21 -0
  14. package/dist/fe/dist/static/index.css +2 -0
  15. package/dist/fe/dist/static/index.js +203 -0
  16. package/dist/lib/{anthropic-GAD2PGEN.js → anthropic-K7VWTSFH.js} +2 -2
  17. package/dist/lib/{chunk-D3SXNTPZ.js → chunk-2NA2RSV7.js} +1 -9
  18. package/dist/lib/{chunk-RVSLQCZ5.js → chunk-E2DXHLHR.js} +1 -1
  19. package/dist/lib/{chunk-3ONNRNKQ.js → chunk-IIL5NGQF.js} +467 -456
  20. package/dist/lib/{chunk-OYQY3Q45.js → chunk-K532PPI6.js} +0 -2
  21. package/dist/lib/{chunk-CBBSDV2D.js → chunk-RJQT6B2O.js} +1 -1
  22. package/dist/lib/index.d.ts +412 -3620
  23. package/dist/lib/index.js +2762 -1885
  24. package/dist/lib/{openai-BYOGAZU5.js → openai-6MPSWGKN.js} +2 -2
  25. package/dist/lib/{providers-YHVXG3PP.js → providers-N52Y2QTJ.js} +1 -1
  26. package/dist/lib/{tool-filter-HUVHJN3O.js → tool-filter-F4S25GMJ.js} +1 -1
  27. package/dist/main.js +366 -237
  28. package/dist/{openai-PYPO6SKD.js → openai-VV2RYB77.js} +1 -1
  29. package/dist/{providers-6UOA2HYN.js → providers-UD3DPALA.js} +1 -1
  30. package/dist/server-FXK26WN2.js +4 -0
  31. package/package.json +11 -12
  32. package/dist/anthropic-3TRLGKHZ.js +0 -4
  33. package/dist/chunk-4GE22WHI.js +0 -4
  34. package/dist/chunk-TPWRDFEX.js +0 -4
  35. package/dist/chunk-XFVM5ZZL.js +0 -241
  36. package/dist/esm-5V3TYPZK.js +0 -229
  37. package/dist/lib/chunk-EFNPK4SJ.js +0 -137
  38. package/dist/lib/sandbox-runtime-QDN5SXPM.js +0 -9
  39. package/dist/sandbox-runtime-ELKAYRIL.js +0 -4
  40. package/dist/server-NXQ6REG3.js +0 -4
@@ -1,4 +1,4 @@
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{B as x,M as f,O as k,T as u}from"./chunk-E7FXB7TA.js";function g(e){return typeof e=="object"&&e!==null&&!Array.isArray(e)}var _=new Set(["image/jpeg","image/png","image/gif","image/webp"]);function b(e){return _.has(e)}function d(e){return g(e)&&e.type==="text"&&typeof e.text=="string"?{type:"text",text:e.text}:null}function C(e){return!g(e)||e.type!=="image"||!g(e.source)?null:e.source.type==="url"&&typeof e.source.url=="string"?{type:"image",source:{type:"url",url:e.source.url}}:e.source.type==="base64"&&typeof e.source.media_type=="string"&&b(e.source.media_type)&&typeof e.source.data=="string"?{type:"image",source:{type:"base64",media_type:e.source.media_type,data:e.source.data}}:null}function A(e){if(e.type!=="document"||!g(e.source))return null;let t=null;if(e.source.type==="url"&&typeof e.source.url=="string")t={type:"url",url:e.source.url};else if(e.source.type==="base64"&&e.source.media_type==="application/pdf"&&typeof e.source.data=="string")t={type:"base64",media_type:"application/pdf",data:e.source.data};else if(e.source.type==="text"&&e.source.media_type==="text/plain"&&typeof e.source.data=="string")t={type:"text",media_type:"text/plain",data:e.source.data};else if(e.source.type==="content"){if(typeof e.source.content=="string")t={type:"content",content:e.source.content};else if(Array.isArray(e.source.content)){let o=[];for(let r of e.source.content){let i=d(r)??C(r);if(!i)return null;o.push(i)}t={type:"content",content:o}}}return t?{type:"document",source:t,...typeof e.title=="string"||e.title===null?{title:e.title}:{},...typeof e.context=="string"||e.context===null?{context:e.context}:{}}:null}function q(e){let t=d(e);if(t)return t;let o=C(e);if(o)return o;if(!g(e))return null;if(e.type==="tool_reference"&&typeof e.tool_name=="string")return{type:"tool_reference",tool_name:e.tool_name};if(e.type==="search_result"&&typeof e.source=="string"&&typeof e.title=="string"&&Array.isArray(e.content)){let r=[];for(let i of e.content){let n=d(i);if(!n)return null;r.push(n)}return{type:"search_result",source:e.source,title:e.title,content:r}}return A(e)}var H=new Set([".agents",".git",".yukino",".next",".venv",".mypy_cache","__pycache__","dist","node_modules"]);var M=x({module:"mcp"}),l="mcp__",m="__";function a(e){return e.replace(/[^a-zA-Z0-9_]/g,"_")}function P(e){return l+a(e)+m}function h(e,t){return P(e)+a(t)}var R=class{name;description;category="command";deferred=!0;mcpServerName;client;originalName;inputSchema;constructor(t,o,r){this.name=h(o,r.name),this.description=r.description,this.originalName=r.name,this.client=t,this.inputSchema=r.inputSchema,this.mcpServerName=o}mcpInputSchema(){return this.inputSchema??{}}setDeferLoading(t){this.deferred=t}schema(){return{name:this.name,description:this.description,input_schema:this.inputSchema}}async execute(t,o){try{return await this.client.callTool(this.originalName,o,t.abortSignal)}catch(r){return M.error({err:r},"mcp operation failed"),{output:`MCP tool error: ${k(r)}`,isError:!0}}}};function w(e,t){if(t==="string"&&typeof e=="number"&&Number.isFinite(e))return String(e);if((t==="integer"||t==="number")&&typeof e=="string"){let o=e.trim();if(o===""||!(t==="integer"?/^[+-]?\d+$/:/^[+-]?(\d+\.?\d*|\.\d+)([eE][+-]?\d+)?$/).test(o))return e;let i=t==="integer"?Number.parseInt(o,10):Number.parseFloat(o);return Number.isFinite(i)?i:e}if(t==="boolean"&&typeof e=="string"){let o=e.trim().toLowerCase();if(o==="true")return!0;if(o==="false")return!1}return e}function T(e,t){if(typeof t!="object"||t===null)return e;let o=f(t),r=u(o,"type","");if(r==="object"&&typeof e=="object"&&e!==null&&!Array.isArray(e)){let i=f(o.properties??{}),n={};for(let[s,c]of Object.entries(e))n[s]=s in i?T(c,i[s]):c;return n}if(r==="array"){let i=o.items??{},n=e;if(typeof n=="object"&&n!==null&&!Array.isArray(n)){let s=Object.values(n);s.length===1&&Array.isArray(s[0])&&(n=s[0])}else typeof n=="string"&&(n=n.split(",").map(s=>s.trim()).filter(s=>s!==""));return Array.isArray(n)?n.map(s=>T(s,i)):n}return r!==""?w(e,r):e}function V(e,t){if(t.startsWith(l)){let o=t.slice(l.length),r=o.indexOf(m);if(r>=0)return a(o.slice(0,r))+m+a(o.slice(r+m.length))}return a(e)+m+a(t)}function y(e){return"mcpInputSchema"in e&&typeof e.mcpInputSchema=="function"}var S=class{constructor(t){this.registry=t}registry;name="McpCall";description="Invoke a tool on a connected MCP server. Call ToolSearch first to load the tool's schema, then pass its arguments here exactly as that schema requires, using the same JSON types.";category="command";deferred=!1;schema(){return{name:this.name,description:this.description,input_schema:{type:"object",properties:{server:{type:"string",description:"MCP server name, e.g. 'linear'."},tool:{type:"string",description:"Full tool name as returned by ToolSearch, e.g. 'mcp__linear__create_issue'."},arguments:{type:"object",description:"The target tool's arguments. Must match that tool's input_schema exactly, including JSON types: bare numbers for integer fields, bare true/false for boolean fields, quoted strings for string fields, and plain JSON arrays for array fields."}},required:["server","tool","arguments"]}}}resolveTarget(t){let o=u(t,"server"),r=u(t,"tool");if(!o||!r)return;let i=r.startsWith(l)?r:h(o,r),n=this.registry.get(i);return n&&y(n)&&a(n.mcpServerName)===a(o)?n:void 0}availableNames(){return this.registry.listTools().filter(t=>t.name.startsWith(l)).map(t=>t.name).sort()}async execute(t,o){let r=u(o,"server",""),i=u(o,"tool","");if(i==="")return{output:"McpCall requires a 'tool' name",isError:!0};let n=this.resolveTarget(o);if(!n){let c=this.availableNames(),p=c.length>0?c.join(", "):"(none connected)";return{output:`Unknown MCP tool '${i}' on server '${r}'. Available tools: ${p}`,isError:!0}}if(typeof o.arguments!="object"||o.arguments===null||Array.isArray(o.arguments))return{output:"McpCall requires an 'arguments' object matching the target schema",isError:!0};let s=f(o.arguments);if(y(n)){let c=n.mcpInputSchema();if(Object.keys(c).length>0){let p=T(s,c);typeof p=="object"&&p!==null&&!Array.isArray(p)&&(s=f(p))}}return t.abortSignal?.throwIfAborted(),n.execute(t,s)}};var I=10,E=2.5,Z="advanced-tool-use-2025-11-20",N=new Set(["api.anthropic.com"]),O="YUKINO_MCP_LOADING";function L(e){if(!e)return!0;try{return N.has(new URL(e).hostname.toLowerCase())}catch{return!1}}function j(e){return Math.floor(e/E)}function B(e,t,o,r,i=I){let n=(process.env[O]??"").trim().toLowerCase();if(n==="eager"||n==="native"||n==="dispatch")return n==="native"&&t!=="anthropic"?"dispatch":n;if(r<=0)return"eager";let s=o*i/100;return j(r)<s?"eager":t==="anthropic"&&L(e)?"native":"dispatch"}function D(e){let t=0;for(let o of e.listTools())if(o.name.startsWith(l))try{t+=JSON.stringify(o.schema()).length}catch{t+=o.name.length+(o.description?.length??0)}return t}function F(e,t){e.mcpLoadingMode=t;let o=t==="eager";for(let r of e.listTools())y(r)&&typeof r.setDeferLoading=="function"&&r.setDeferLoading(!o);e.exposeToolSearch=!o,e.exposeMcpCall=t==="dispatch"}function Q(e,t,o,r){let i=B(t,o,r,D(e));return F(e,i),i}export{q as a,H as b,l as c,R as d,V as e,S as f,Z as g,L as h,F as i,Q as j};
4
+ import{C as x,O as f,Q as k,V as u}from"./chunk-3P7BR7SO.js";function g(e){return typeof e=="object"&&e!==null&&!Array.isArray(e)}var _=new Set(["image/jpeg","image/png","image/gif","image/webp"]);function b(e){return _.has(e)}function d(e){return g(e)&&e.type==="text"&&typeof e.text=="string"?{type:"text",text:e.text}:null}function C(e){return!g(e)||e.type!=="image"||!g(e.source)?null:e.source.type==="url"&&typeof e.source.url=="string"?{type:"image",source:{type:"url",url:e.source.url}}:e.source.type==="base64"&&typeof e.source.media_type=="string"&&b(e.source.media_type)&&typeof e.source.data=="string"?{type:"image",source:{type:"base64",media_type:e.source.media_type,data:e.source.data}}:null}function A(e){if(e.type!=="document"||!g(e.source))return null;let t=null;if(e.source.type==="url"&&typeof e.source.url=="string")t={type:"url",url:e.source.url};else if(e.source.type==="base64"&&e.source.media_type==="application/pdf"&&typeof e.source.data=="string")t={type:"base64",media_type:"application/pdf",data:e.source.data};else if(e.source.type==="text"&&e.source.media_type==="text/plain"&&typeof e.source.data=="string")t={type:"text",media_type:"text/plain",data:e.source.data};else if(e.source.type==="content"){if(typeof e.source.content=="string")t={type:"content",content:e.source.content};else if(Array.isArray(e.source.content)){let o=[];for(let r of e.source.content){let i=d(r)??C(r);if(!i)return null;o.push(i)}t={type:"content",content:o}}}return t?{type:"document",source:t,...typeof e.title=="string"||e.title===null?{title:e.title}:{},...typeof e.context=="string"||e.context===null?{context:e.context}:{}}:null}function q(e){let t=d(e);if(t)return t;let o=C(e);if(o)return o;if(!g(e))return null;if(e.type==="tool_reference"&&typeof e.tool_name=="string")return{type:"tool_reference",tool_name:e.tool_name};if(e.type==="search_result"&&typeof e.source=="string"&&typeof e.title=="string"&&Array.isArray(e.content)){let r=[];for(let i of e.content){let n=d(i);if(!n)return null;r.push(n)}return{type:"search_result",source:e.source,title:e.title,content:r}}return A(e)}var H=new Set([".agents",".git",".yukino",".next",".venv",".mypy_cache","__pycache__","dist","node_modules"]);var M=x({module:"mcp"}),l="mcp__",m="__";function a(e){return e.replace(/[^a-zA-Z0-9_]/g,"_")}function P(e){return l+a(e)+m}function h(e,t){return P(e)+a(t)}var R=class{name;description;category="command";deferred=!0;mcpServerName;client;originalName;inputSchema;constructor(t,o,r){this.name=h(o,r.name),this.description=r.description,this.originalName=r.name,this.client=t,this.inputSchema=r.inputSchema,this.mcpServerName=o}mcpInputSchema(){return this.inputSchema??{}}setDeferLoading(t){this.deferred=t}schema(){return{name:this.name,description:this.description,input_schema:this.inputSchema}}async execute(t,o){try{return await this.client.callTool(this.originalName,o,t.abortSignal)}catch(r){return M.error({err:r},"mcp operation failed"),{output:`MCP tool error: ${k(r)}`,isError:!0}}}};function w(e,t){if(t==="string"&&typeof e=="number"&&Number.isFinite(e))return String(e);if((t==="integer"||t==="number")&&typeof e=="string"){let o=e.trim();if(o===""||!(t==="integer"?/^[+-]?\d+$/:/^[+-]?(\d+\.?\d*|\.\d+)([eE][+-]?\d+)?$/).test(o))return e;let i=t==="integer"?Number.parseInt(o,10):Number.parseFloat(o);return Number.isFinite(i)?i:e}if(t==="boolean"&&typeof e=="string"){let o=e.trim().toLowerCase();if(o==="true")return!0;if(o==="false")return!1}return e}function T(e,t){if(typeof t!="object"||t===null)return e;let o=f(t),r=u(o,"type","");if(r==="object"&&typeof e=="object"&&e!==null&&!Array.isArray(e)){let i=f(o.properties??{}),n={};for(let[s,c]of Object.entries(e))n[s]=s in i?T(c,i[s]):c;return n}if(r==="array"){let i=o.items??{},n=e;if(typeof n=="object"&&n!==null&&!Array.isArray(n)){let s=Object.values(n);s.length===1&&Array.isArray(s[0])&&(n=s[0])}else typeof n=="string"&&(n=n.split(",").map(s=>s.trim()).filter(s=>s!==""));return Array.isArray(n)?n.map(s=>T(s,i)):n}return r!==""?w(e,r):e}function V(e,t){if(t.startsWith(l)){let o=t.slice(l.length),r=o.indexOf(m);if(r>=0)return a(o.slice(0,r))+m+a(o.slice(r+m.length))}return a(e)+m+a(t)}function y(e){return"mcpInputSchema"in e&&typeof e.mcpInputSchema=="function"}var S=class{constructor(t){this.registry=t}registry;name="McpCall";description="Invoke a tool on a connected MCP server. Call ToolSearch first to load the tool's schema, then pass its arguments here exactly as that schema requires, using the same JSON types.";category="command";deferred=!1;schema(){return{name:this.name,description:this.description,input_schema:{type:"object",properties:{server:{type:"string",description:"MCP server name, e.g. 'linear'."},tool:{type:"string",description:"Full tool name as returned by ToolSearch, e.g. 'mcp__linear__create_issue'."},arguments:{type:"object",description:"The target tool's arguments. Must match that tool's input_schema exactly, including JSON types: bare numbers for integer fields, bare true/false for boolean fields, quoted strings for string fields, and plain JSON arrays for array fields."}},required:["server","tool","arguments"]}}}resolveTarget(t){let o=u(t,"server"),r=u(t,"tool");if(!o||!r)return;let i=r.startsWith(l)?r:h(o,r),n=this.registry.get(i);return n&&y(n)&&a(n.mcpServerName)===a(o)?n:void 0}availableNames(){return this.registry.listTools().filter(t=>t.name.startsWith(l)).map(t=>t.name).sort()}async execute(t,o){let r=u(o,"server",""),i=u(o,"tool","");if(i==="")return{output:"McpCall requires a 'tool' name",isError:!0};let n=this.resolveTarget(o);if(!n){let c=this.availableNames(),p=c.length>0?c.join(", "):"(none connected)";return{output:`Unknown MCP tool '${i}' on server '${r}'. Available tools: ${p}`,isError:!0}}if(typeof o.arguments!="object"||o.arguments===null||Array.isArray(o.arguments))return{output:"McpCall requires an 'arguments' object matching the target schema",isError:!0};let s=f(o.arguments);if(y(n)){let c=n.mcpInputSchema();if(Object.keys(c).length>0){let p=T(s,c);typeof p=="object"&&p!==null&&!Array.isArray(p)&&(s=f(p))}}return t.abortSignal?.throwIfAborted(),n.execute(t,s)}};var I=10,E=2.5,Z="advanced-tool-use-2025-11-20",N=new Set(["api.anthropic.com"]),O="YUKINO_MCP_LOADING";function L(e){if(!e)return!0;try{return N.has(new URL(e).hostname.toLowerCase())}catch{return!1}}function j(e){return Math.floor(e/E)}function B(e,t,o,r,i=I){let n=(process.env[O]??"").trim().toLowerCase();if(n==="eager"||n==="native"||n==="dispatch")return n==="native"&&t!=="anthropic"?"dispatch":n;if(r<=0)return"eager";let s=o*i/100;return j(r)<s?"eager":t==="anthropic"&&L(e)?"native":"dispatch"}function D(e){let t=0;for(let o of e.listTools())if(o.name.startsWith(l))try{t+=JSON.stringify(o.schema()).length}catch{t+=o.name.length+(o.description?.length??0)}return t}function F(e,t){e.mcpLoadingMode=t;let o=t==="eager";for(let r of e.listTools())y(r)&&typeof r.setDeferLoading=="function"&&r.setDeferLoading(!o);e.exposeToolSearch=!o,e.exposeMcpCall=t==="dispatch"}function Q(e,t,o,r){let i=B(t,o,r,D(e));return F(e,i),i}export{q as a,H as b,l as c,R as d,V as e,S as f,Z as g,L as h,F as i,Q as j};