@yukino.js/yukino 0.0.13 → 0.0.15

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 (108) hide show
  1. package/README.md +13 -11
  2. package/dist/a2a-ANR7PFD4.js +15 -0
  3. package/dist/acp-4E7R254I.js +14 -0
  4. package/dist/{anthropic-74ALYMH2.js → anthropic-ZO73YJFY.js} +1 -1
  5. package/dist/browser/dist/index.html +44 -0
  6. package/dist/browser/dist/static/index.css +2 -0
  7. package/dist/browser/dist/static/index.js +203 -0
  8. package/dist/bwrap-LVIPV72Q.js +0 -0
  9. package/dist/chunk-3KKA6537.js +0 -0
  10. package/dist/chunk-3RH3COZW.js +365 -0
  11. package/dist/chunk-4JHZPFU6.js +67 -0
  12. package/dist/chunk-7MKA3SHV.js +0 -0
  13. package/dist/{chunk-OREDGNI6.js → chunk-B2RNOTT5.js} +1 -1
  14. package/dist/{chunk-APJAUOF6.js → chunk-C56EKYBO.js} +1 -1
  15. package/dist/{chunk-WGFROGUC.js → chunk-CKOUBYG6.js} +0 -0
  16. package/dist/{chunk-6JUOKMSJ.js → chunk-CW6G3RYM.js} +1 -1
  17. package/dist/{chunk-556TRLPT.js → chunk-CWWRUTF2.js} +1 -1
  18. package/dist/chunk-DVB57IVG.js +18 -0
  19. package/dist/chunk-ETZPOVUC.js +4 -0
  20. package/dist/chunk-F3JTT3TI.js +110 -0
  21. package/dist/chunk-FC2LG24U.js +4 -0
  22. package/dist/chunk-FNQMXCCE.js +4 -0
  23. package/dist/chunk-HWCLMDQF.js +0 -0
  24. package/dist/chunk-I74AL3PF.js +0 -0
  25. package/dist/chunk-IOMQY54U.js +967 -0
  26. package/dist/chunk-IQT2IFSO.js +4 -0
  27. package/dist/chunk-K45OXLJJ.js +16 -0
  28. package/dist/chunk-KJJYW5IY.js +0 -0
  29. package/dist/chunk-LCWNSYZU.js +0 -0
  30. package/dist/chunk-LR4ZNAAM.js +4 -0
  31. package/dist/chunk-LTMY67B2.js +5 -0
  32. package/dist/chunk-MDPSQ6L7.js +0 -0
  33. package/dist/chunk-MQAQBW7F.js +0 -0
  34. package/dist/{chunk-NEU4ER5V.js → chunk-NSNTZXFL.js} +1 -1
  35. package/dist/chunk-P6DHMU7R.js +0 -0
  36. package/dist/chunk-VCIRD267.js +0 -0
  37. package/dist/chunk-VM4YKTHC.js +0 -0
  38. package/dist/chunk-VU3JWAJR.js +0 -0
  39. package/dist/chunk-W4GMCNWF.js +0 -0
  40. package/dist/chunk-XY7ZFVZL.js +4 -0
  41. package/dist/devtools-UVGRIXO2.js +0 -0
  42. package/dist/{esm-HW2JMFYC.js → esm-2JJG3HR7.js} +1 -1
  43. package/dist/esm-7DWXO52B.js +4 -0
  44. package/dist/{esm-6L5BJ5GT.js → esm-EOOB75BT.js} +1 -1
  45. package/dist/{esm-DIYJ5HX6.js → esm-H73EL6IR.js} +1 -1
  46. package/dist/{esm-YKAO4ES6.js → esm-IBZKE3IU.js} +1 -1
  47. package/dist/esm-W4NAAZTQ.js +225 -0
  48. package/dist/{esm-RPR2GBJ2.js → esm-Y237QNPJ.js} +1 -1
  49. package/dist/getMachineId-bsd-A3UCSHLE.js +4 -0
  50. package/dist/getMachineId-bsd-E27XJQLX.js +0 -0
  51. package/dist/getMachineId-darwin-35UPAIXP.js +0 -0
  52. package/dist/getMachineId-darwin-MWJEU7OI.js +5 -0
  53. package/dist/getMachineId-linux-FNSLKUDN.js +4 -0
  54. package/dist/getMachineId-linux-MKXIYT6A.js +0 -0
  55. package/dist/getMachineId-unsupported-PKQWB2OJ.js +4 -0
  56. package/dist/getMachineId-unsupported-ZXVGGFX2.js +0 -0
  57. package/dist/getMachineId-win-3A667JT3.js +4 -0
  58. package/dist/getMachineId-win-RNVIYJG5.js +0 -0
  59. package/dist/lib/{anthropic-EQRUGP2C.js → anthropic-SQBOFRPQ.js} +4 -4
  60. package/dist/lib/{chunk-EGT7BJRD.js → chunk-AW2577J5.js} +2 -2
  61. package/dist/lib/{chunk-JYCSWXCR.js → chunk-GPJL4PLE.js} +2 -2
  62. package/dist/lib/{chunk-UBVKYJFI.js → chunk-IHVYAEY2.js} +1058 -522
  63. package/dist/lib/{chunk-CDMR25FD.js → chunk-U3OT4POQ.js} +3 -3
  64. package/dist/lib/{chunk-HUTUNNDX.js → chunk-WNGF7243.js} +0 -1
  65. package/dist/lib/{chunk-FUJDUZTH.js → chunk-WXR5HNB4.js} +1 -1
  66. package/dist/lib/{chunk-WWCSFKMR.js → chunk-XS3GONYN.js} +2 -11
  67. package/dist/lib/index.d.ts +98 -282
  68. package/dist/lib/index.js +1092 -2409
  69. package/dist/lib/{openai-B3I5WBFT.js → openai-UV4KFNQV.js} +3 -3
  70. package/dist/lib/{providers-EJ4VBHNP.js → providers-77VBEX3K.js} +2 -2
  71. package/dist/lib/{tool-filter-TURPCYFR.js → tool-filter-MLYQGWM5.js} +3 -3
  72. package/dist/{main-JEEKFCGX.js → main-653YZQHY.js} +228 -232
  73. package/dist/main.js +2 -2
  74. package/dist/node-634LOHDX.js +0 -0
  75. package/dist/{openai-7C6BVQ7M.js → openai-FKLMHNNC.js} +1 -1
  76. package/dist/providers-4IU7SUEQ.js +4 -0
  77. package/dist/seatbelt-UO7HGD4Z.js +0 -0
  78. package/dist/server-4NHV4RJL.js +4 -0
  79. package/dist/slim-Q56GHZZP.js +0 -0
  80. package/dist/{src-JBRNH4FA.js → src-DEVJGNXS.js} +1 -1
  81. package/dist/{src-X6JWWHHT.js → src-EMFESWQS.js} +1 -1
  82. package/dist/{src-R4BSSIJJ.js → src-GG4YROJH.js} +1 -1
  83. package/dist/{src-43CPCEK2.js → src-JFAO2DGP.js} +1 -1
  84. package/dist/tool-filter-LJTLMGFP.js +4 -0
  85. package/dist/turndown.es-NQ3KDXM7.js +0 -0
  86. package/package.json +22 -21
  87. package/dist/a2a-DKWMWGID.js +0 -14
  88. package/dist/acp-RL6DKS3R.js +0 -14
  89. package/dist/chunk-2LHY3FND.js +0 -67
  90. package/dist/chunk-3QL446GD.js +0 -4
  91. package/dist/chunk-6FSIG63T.js +0 -364
  92. package/dist/chunk-A5G5NTDB.js +0 -1015
  93. package/dist/chunk-A7CJPQC5.js +0 -5
  94. package/dist/chunk-AGSYLE4E.js +0 -16
  95. package/dist/chunk-CJSMVCUF.js +0 -6
  96. package/dist/chunk-CU3IISCC.js +0 -4
  97. package/dist/chunk-HMZQYFYG.js +0 -4
  98. package/dist/chunk-JFKC4VCA.js +0 -4
  99. package/dist/chunk-KCMBAHWU.js +0 -4
  100. package/dist/chunk-SCR7NDDL.js +0 -63
  101. package/dist/esm-57CJEGGK.js +0 -4
  102. package/dist/esm-YOQPBF42.js +0 -225
  103. package/dist/fe/dist/index.html +0 -21
  104. package/dist/fe/dist/static/index.css +0 -2
  105. package/dist/fe/dist/static/index.js +0 -203
  106. package/dist/providers-U23PWAHG.js +0 -4
  107. package/dist/server-EOSEQPNY.js +0 -4
  108. package/dist/tool-filter-UDSHRE5F.js +0 -4
File without changes
@@ -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{a as m,c as g,e as v,g as h,t as b}from"./chunk-A7CJPQC5.js";import{a as u}from"./chunk-MQAQBW7F.js";import{k as S}from"./chunk-HWCLMDQF.js";import{C as o}from"./chunk-W4GMCNWF.js";import{existsSync as P,readFileSync as E}from"fs";import{join as M}from"path";var y=o.object({name:o.string().trim().min(1),command:o.string().min(1),args:o.array(o.string()).optional(),languages:o.record(o.string().regex(/^\.[\w-]+$/u),o.string().min(1)).refine(r=>Object.keys(r).length>0,"At least one file extension is required"),env:o.record(o.string(),o.string()).optional(),initialization_options:o.record(o.string(),o.unknown()).optional(),settings:o.record(o.string(),o.unknown()).optional(),timeout_ms:o.number().int().min(100).max(6e4).optional()});var d=S({module:"config"}),x={anthropic:"ANTHROPIC_API_KEY",openai:"OPENAI_API_KEY","openai-compat":"OPENAI_API_KEY"};function A(r){return f.has(r)}var f=new Set(Object.keys(x)),s=class extends Error{constructor(e){super(e),this.name="ConfigError"}};function Q(r){if(r.api_key)return r.api_key;let e=A(r.protocol)?x[r.protocol]:"";return e?process.env[e]??"":""}var j=o.object({name:o.string(),command:o.string().optional(),args:o.array(o.string()).optional(),url:o.string().optional(),transport:o.string().optional(),headers:o.record(o.string(),o.string()).optional(),env:o.record(o.string(),o.string()).optional()}),k=o.object({id:o.string().optional(),event:o.string(),condition:o.string().optional(),action:o.object({type:o.string(),command:o.string().optional(),url:o.string().optional(),method:o.string().optional(),prompt:o.string().optional()}),reject:o.boolean().optional(),once:o.boolean().optional(),async:o.boolean().optional(),on_error:o.string().optional()}),$=o.object({enabled:o.boolean().optional(),auto_allow:o.boolean().optional(),network_enabled:o.boolean().optional()}),O=o.looseObject({default_provider:o.number().default(0),providers:o.array(h),permission_mode:o.string().optional(),mcp_servers:o.array(j).default([]),lsp_servers:o.array(y).refine(r=>new Set(r.map(e=>e.name)).size===r.length,"LSP server names must be unique").optional(),hooks:o.array(k).default([]),sandbox:$.optional(),enable_coordinator_mode:o.boolean().optional(),enable_fork:o.boolean().optional(),enable_memory:o.boolean().optional()});function W(r){return r.enable_fork!==!1}function X(r){return r.enable_memory!==!1}function w(r){let e=E(r,"utf-8"),i=u.load(e),n=m(O,i);if(!n.success)throw new s(`Invalid configuration in ${r}: ${g(n.error)}`);let t=n.data;return{...t,providers:t.providers.map(b)}}function C(r){if(r.providers.length===0)throw new s("At least one provider MUST be configured.");let e=["name","protocol","base_url","model"],i=new Map;for(let n=0;n<r.providers.length;n++){let t=r.providers[n],a={name:t.name,protocol:t.protocol,base_url:t.base_url,model:t.model},l=e.filter(c=>!a[c].trim());if(l.length>0)throw new s(`Provider #${String(n+1)}: missing fields: ${l.join(", ")}`);if(!f.has(t.protocol))throw new s(`Provider #${String(n+1)}: invalid protocol '${t.protocol}', MUST be one of: ${Array.from(f).join(", ")}`);let p=i.get(t.base_url);if(p!==void 0)throw new s(`Provider #${String(n+1)}: duplicate base_url '${t.base_url}' (already used by provider #${String(p+1)}).`);i.set(t.base_url,n)}}function _(r){let e=new Map;for(let i=0;i<r.mcp_servers.length;i++){let n=r.mcp_servers[i],t=`MCP server #${String(i+1)}`;if(!n.name.trim())throw new s(`${t}: name must not be empty.`);let a=e.get(n.name);if(a!==void 0)throw new s(`${t}: duplicate name '${n.name}' (already used by MCP server #${String(a+1)}).`);e.set(n.name,i);let l=!!n.command?.trim(),p=!!n.url?.trim();if(l===p)throw new s(`${t} '${n.name}': configure exactly one of command or url.`);if(l&&n.transport&&n.transport!=="stdio")throw new s(`${t} '${n.name}': command servers must use stdio.`);if(p&&n.transport&&!["http","sse"].includes(n.transport))throw new s(`${t} '${n.name}': URL transport must be http or sse.`)}}var L=".mcp.json",z=o.looseObject({command:o.string().optional(),args:o.array(o.string()).optional(),env:o.record(o.string(),o.string()).optional(),type:o.enum(["stdio","sse","http"]).optional(),url:o.string().optional(),headers:o.record(o.string(),o.string()).optional()}),I=o.looseObject({mcpServers:o.record(o.string(),o.unknown()).default({})});function J(r,e){let i=e.type??(e.command!==void 0?"stdio":"http");return i==="stdio"?!e.command||e.url!==void 0?null:{name:r,command:e.command,args:e.args,env:e.env}:!e.url||e.command!==void 0?null:{name:r,url:e.url,transport:i,headers:e.headers}}function K(r){let e=M(r,L);if(!P(e))return[];let i;try{i=JSON.parse(E(e,"utf-8"))}catch(a){return d.error({err:a,path:e},"invalid .mcp.json"),[]}let n=m(I,i);if(!n.success)return d.error({error:n.error,path:e},"invalid .mcp.json"),[];let t=[];for(let[a,l]of Object.entries(n.data.mcpServers)){let p=m(z,l);if(!a.trim()||!p.success){d.warn({name:a,path:e,error:p.success?void 0:p.error},"skipping invalid .mcp.json server entry");continue}let c=J(a,p.data);c?t.push(c):d.warn({name:a,path:e},"skipping invalid .mcp.json server entry")}return t}function Z(r,e){let i=K(e);if(i.length===0)return r;let n=new Set(r.mcp_servers.map(t=>t.name));return{...r,mcp_servers:[...r.mcp_servers,...i.filter(t=>!n.has(t.name))]}}function oo(r,e={}){if(r){let t=w(r);return _(t),(!e.allowEmptyProviders||t.providers.length>0)&&C(t),t}let i=v();if(!P(i)){if(e.allowEmptyProviders)return{default_provider:0,providers:[],mcp_servers:[],hooks:[]};throw new s(`No config file found, expected ${i}.`)}let n=w(i);return _(n),(!e.allowEmptyProviders||n.providers.length>0)&&C(n),n}export{Q as a,W as b,X as c,Z as d,oo as e};
4
+ import{a as m,c as g,e as v,g as h,t as b}from"./chunk-LTMY67B2.js";import{a as u}from"./chunk-MQAQBW7F.js";import{k as S}from"./chunk-HWCLMDQF.js";import{C as o}from"./chunk-W4GMCNWF.js";import{existsSync as P,readFileSync as E}from"fs";import{join as M}from"path";var y=o.object({name:o.string().trim().min(1),command:o.string().min(1),args:o.array(o.string()).optional(),languages:o.record(o.string().regex(/^\.[\w-]+$/u),o.string().min(1)).refine(r=>Object.keys(r).length>0,"At least one file extension is required"),env:o.record(o.string(),o.string()).optional(),initialization_options:o.record(o.string(),o.unknown()).optional(),settings:o.record(o.string(),o.unknown()).optional(),timeout_ms:o.number().int().min(100).max(6e4).optional()});var d=S({module:"config"}),x={anthropic:"ANTHROPIC_API_KEY",openai:"OPENAI_API_KEY","openai-compat":"OPENAI_API_KEY"};function A(r){return f.has(r)}var f=new Set(Object.keys(x)),s=class extends Error{constructor(e){super(e),this.name="ConfigError"}};function Q(r){if(r.api_key)return r.api_key;let e=A(r.protocol)?x[r.protocol]:"";return e?process.env[e]??"":""}var j=o.object({name:o.string(),command:o.string().optional(),args:o.array(o.string()).optional(),url:o.string().optional(),transport:o.string().optional(),headers:o.record(o.string(),o.string()).optional(),env:o.record(o.string(),o.string()).optional()}),k=o.object({id:o.string().optional(),event:o.string(),condition:o.string().optional(),action:o.object({type:o.string(),command:o.string().optional(),url:o.string().optional(),method:o.string().optional(),prompt:o.string().optional()}),reject:o.boolean().optional(),once:o.boolean().optional(),async:o.boolean().optional(),on_error:o.string().optional()}),$=o.object({enabled:o.boolean().optional(),auto_allow:o.boolean().optional(),network_enabled:o.boolean().optional()}),O=o.looseObject({default_provider:o.number().default(0),providers:o.array(h),permission_mode:o.string().optional(),mcp_servers:o.array(j).default([]),lsp_servers:o.array(y).refine(r=>new Set(r.map(e=>e.name)).size===r.length,"LSP server names must be unique").optional(),hooks:o.array(k).default([]),sandbox:$.optional(),enable_coordinator_mode:o.boolean().optional(),enable_fork:o.boolean().optional(),enable_memory:o.boolean().optional()});function W(r){return r.enable_fork!==!1}function X(r){return r.enable_memory!==!1}function w(r){let e=E(r,"utf-8"),i=u.load(e),n=m(O,i);if(!n.success)throw new s(`Invalid configuration in ${r}: ${g(n.error)}`);let t=n.data;return{...t,providers:t.providers.map(b)}}function C(r){if(r.providers.length===0)throw new s("At least one provider MUST be configured.");let e=["name","protocol","base_url","model"],i=new Map;for(let n=0;n<r.providers.length;n++){let t=r.providers[n],a={name:t.name,protocol:t.protocol,base_url:t.base_url,model:t.model},l=e.filter(c=>!a[c].trim());if(l.length>0)throw new s(`Provider #${String(n+1)}: missing fields: ${l.join(", ")}`);if(!f.has(t.protocol))throw new s(`Provider #${String(n+1)}: invalid protocol '${t.protocol}', MUST be one of: ${Array.from(f).join(", ")}`);let p=i.get(t.base_url);if(p!==void 0)throw new s(`Provider #${String(n+1)}: duplicate base_url '${t.base_url}' (already used by provider #${String(p+1)}).`);i.set(t.base_url,n)}}function _(r){let e=new Map;for(let i=0;i<r.mcp_servers.length;i++){let n=r.mcp_servers[i],t=`MCP server #${String(i+1)}`;if(!n.name.trim())throw new s(`${t}: name must not be empty.`);let a=e.get(n.name);if(a!==void 0)throw new s(`${t}: duplicate name '${n.name}' (already used by MCP server #${String(a+1)}).`);e.set(n.name,i);let l=!!n.command?.trim(),p=!!n.url?.trim();if(l===p)throw new s(`${t} '${n.name}': configure exactly one of command or url.`);if(l&&n.transport&&n.transport!=="stdio")throw new s(`${t} '${n.name}': command servers must use stdio.`);if(p&&n.transport&&!["http","sse"].includes(n.transport))throw new s(`${t} '${n.name}': URL transport must be http or sse.`)}}var L=".mcp.json",z=o.looseObject({command:o.string().optional(),args:o.array(o.string()).optional(),env:o.record(o.string(),o.string()).optional(),type:o.enum(["stdio","sse","http"]).optional(),url:o.string().optional(),headers:o.record(o.string(),o.string()).optional()}),I=o.looseObject({mcpServers:o.record(o.string(),o.unknown()).default({})});function J(r,e){let i=e.type??(e.command!==void 0?"stdio":"http");return i==="stdio"?!e.command||e.url!==void 0?null:{name:r,command:e.command,args:e.args,env:e.env}:!e.url||e.command!==void 0?null:{name:r,url:e.url,transport:i,headers:e.headers}}function K(r){let e=M(r,L);if(!P(e))return[];let i;try{i=JSON.parse(E(e,"utf-8"))}catch(a){return d.error({err:a,path:e},"invalid .mcp.json"),[]}let n=m(I,i);if(!n.success)return d.error({error:n.error,path:e},"invalid .mcp.json"),[];let t=[];for(let[a,l]of Object.entries(n.data.mcpServers)){let p=m(z,l);if(!a.trim()||!p.success){d.warn({name:a,path:e,error:p.success?void 0:p.error},"skipping invalid .mcp.json server entry");continue}let c=J(a,p.data);c?t.push(c):d.warn({name:a,path:e},"skipping invalid .mcp.json server entry")}return t}function Z(r,e){let i=K(e);if(i.length===0)return r;let n=new Set(r.mcp_servers.map(t=>t.name));return{...r,mcp_servers:[...r.mcp_servers,...i.filter(t=>!n.has(t.name))]}}function oo(r,e={}){if(r){let t=w(r);return _(t),(!e.allowEmptyProviders||t.providers.length>0)&&C(t),t}let i=v();if(!P(i)){if(e.allowEmptyProviders)return{default_provider:0,providers:[],mcp_servers:[],hooks:[]};throw new s(`No config file found, expected ${i}.`)}let n=w(i);return _(n),(!e.allowEmptyProviders||n.providers.length>0)&&C(n),n}export{Q as a,W as b,X as c,Z as d,oo as e};
@@ -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{k as h,p as g,r as T,v as c}from"./chunk-HWCLMDQF.js";function u(e){return typeof e=="object"&&e!==null&&!Array.isArray(e)}var C=new Set(["image/jpeg","image/png","image/gif","image/webp"]);function R(e){return C.has(e)}function y(e){return u(e)&&e.type==="text"&&typeof e.text=="string"?{type:"text",text:e.text}:null}function k(e){return!u(e)||e.type!=="image"||!u(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"&&R(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 _(e){if(e.type!=="document"||!u(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=y(r)??k(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 I(e){let t=y(e);if(t)return t;let o=k(e);if(o)return o;if(!u(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=y(i);if(!n)return null;r.push(n)}return{type:"search_result",source:e.source,title:e.title,content:r}}return _(e)}var j=new Set([".agents",".git",".yukino",".next",".venv",".mypy_cache","__pycache__","dist","node_modules"]);var A=h({module:"mcp"}),a="mcp__",l="__";function m(e){return e.replace(/[^a-zA-Z0-9_]/g,"_")}function M(e){let t=m(e);return`${a}${String(t.length)}_${t}${l}`}function f(e,t){return M(e)+m(t)}var x=class{name;description;category="command";deferred=!0;mcpServerName;client;originalName;inputSchema;constructor(t,o,r){this.name=f(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 A.error({err:r},"mcp operation failed"),{output:`MCP tool error: ${T(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 d(e,t){if(typeof t!="object"||t===null)return e;let o=g(t),r=c(o,"type","");if(r==="object"&&typeof e=="object"&&e!==null&&!Array.isArray(e)){let i=g(o.properties??{}),n={};for(let[s,p]of Object.entries(e))n[s]=s in i?d(p,i[s]):p;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=>d(s,i)):n}return r!==""?w(e,r):e}function D(e,t){if(t.startsWith(a)){let o=t.slice(a.length),r=/^(\d+)_/u.exec(o);if(r){let i=r[0].length,n=Number.parseInt(r[1],10),s=i+n;if(o.slice(s,s+2)===l)return o.slice(i,s)+l+o.slice(s+l.length)}}return m(e)+l+m(t)}function P(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=c(t,"server"),r=c(t,"tool");if(!o||!r)return;let i=r.startsWith(a)?r:f(o,r),n=this.registry.get(i);return n&&P(n)&&n.mcpServerName===o?n:void 0}availableNames(){return this.registry.listTools().filter(t=>t.name.startsWith(a)).map(t=>t.name).sort()}prepareArguments(t){let o=this.resolveTarget(t);return!o||typeof t.arguments!="object"||t.arguments===null||Array.isArray(t.arguments)?t:{...t,arguments:d(t.arguments,o.mcpInputSchema())}}async execute(t,o){let r=c(o,"server",""),i=c(o,"tool","");if(i==="")return{output:"McpCall requires a 'tool' name",isError:!0};let n=this.resolveTarget(o);if(!n){let p=this.availableNames(),b=p.length>0?p.join(", "):"(none connected)";return{output:`Unknown MCP tool '${i}' on server '${r}'. Available tools: ${b}`,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=g(this.prepareArguments(o).arguments);return t.abortSignal?.throwIfAborted(),n.execute(t,s)}};export{I as a,j as b,a as c,x as d,D as e,P as f,S as g};
4
+ import{k as h,p as g,r as T,v as c}from"./chunk-HWCLMDQF.js";function u(e){return typeof e=="object"&&e!==null&&!Array.isArray(e)}var C=new Set(["image/jpeg","image/png","image/gif","image/webp"]);function R(e){return C.has(e)}function y(e){return u(e)&&e.type==="text"&&typeof e.text=="string"?{type:"text",text:e.text}:null}function k(e){return!u(e)||e.type!=="image"||!u(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"&&R(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 _(e){if(e.type!=="document"||!u(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=y(r)??k(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 I(e){let t=y(e);if(t)return t;let o=k(e);if(o)return o;if(!u(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=y(i);if(!n)return null;r.push(n)}return{type:"search_result",source:e.source,title:e.title,content:r}}return _(e)}var j=new Set([".agents",".git",".yukino",".next",".venv",".mypy_cache","__pycache__","dist","node_modules"]);var A=h({module:"mcp"}),a="mcp__",l="__";function m(e){return e.replace(/[^a-zA-Z0-9_]/g,"_")}function P(e){let t=m(e);return`${a}${String(t.length)}_${t}${l}`}function f(e,t){return P(e)+m(t)}var x=class{name;description;category="command";deferred=!0;mcpServerName;client;originalName;inputSchema;constructor(t,o,r){this.name=f(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 A.error({err:r},"mcp operation failed"),{output:`MCP tool error: ${T(r)}`,isError:!0}}}};function M(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 d(e,t){if(typeof t!="object"||t===null)return e;let o=g(t),r=c(o,"type","");if(r==="object"&&typeof e=="object"&&e!==null&&!Array.isArray(e)){let i=g(o.properties??{}),n={};for(let[s,p]of Object.entries(e))n[s]=s in i?d(p,i[s]):p;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=>d(s,i)):n}return r!==""?M(e,r):e}function q(e,t){if(t.startsWith(a)){let o=t.slice(a.length),r=/^(\d+)_/u.exec(o);if(r){let i=r[0].length,n=Number.parseInt(r[1],10),s=i+n;if(o.slice(s,s+2)===l)return o.slice(i,s)+l+o.slice(s+l.length)}}return m(e)+l+m(t)}function w(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=c(t,"server"),r=c(t,"tool");if(!o||!r)return;let i=r.startsWith(a)?r:f(o,r),n=this.registry.get(i);return n&&w(n)&&n.mcpServerName===o?n:void 0}availableNames(){return this.registry.listTools().filter(t=>t.name.startsWith(a)).map(t=>t.name).sort()}prepareArguments(t){let o=this.resolveTarget(t);return!o||typeof t.arguments!="object"||t.arguments===null||Array.isArray(t.arguments)?t:{...t,arguments:d(t.arguments,o.mcpInputSchema())}}async execute(t,o){let r=c(o,"server",""),i=c(o,"tool","");if(i==="")return{output:"McpCall requires a 'tool' name",isError:!0};let n=this.resolveTarget(o);if(!n){let p=this.availableNames(),b=p.length>0?p.join(", "):"(none connected)";return{output:`Unknown MCP tool '${i}' on server '${r}'. Available tools: ${b}`,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=g(this.prepareArguments(o).arguments);return t.abortSignal?.throwIfAborted(),n.execute(t,s)}};export{I as a,j as b,a as c,x as d,q as e,w as f,S as g};
File without changes
@@ -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{c,f as s}from"./chunk-APJAUOF6.js";var p=10,f=2.5,_="advanced-tool-use-2025-11-20",d=new Set(["api.anthropic.com"]),l="YUKINO_MCP_LOADING";function u(o){if(!o)return!0;try{return d.has(new URL(o).hostname.toLowerCase())}catch{return!1}}function g(o){return Math.floor(o/f)}function m(o,e,t,n,i=p){let r=(process.env[l]??"").trim().toLowerCase();if(r==="eager"||r==="native"||r==="dispatch")return r==="native"&&e!=="anthropic"?"dispatch":r;if(n<=0)return"eager";let a=t*i/100;return g(n)<a?"eager":e==="anthropic"&&u(o)?"native":"dispatch"}function h(o){let e=0;for(let t of o.listTools())if(t.name.startsWith(c))try{e+=JSON.stringify(t.schema()).length}catch{e+=t.name.length+(t.description?.length??0)}return e}function T(o,e){o.mcpLoadingMode=e;let t=e==="eager";for(let n of o.listTools())s(n)&&typeof n.setDeferLoading=="function"&&n.setDeferLoading(!t);o.exposeToolSearch=!t,o.exposeMcpCall=e==="dispatch"}function v(o,e,t,n){let i=m(e,t,n,h(o));return T(o,i),i}export{_ as a,u as b,T as c,v as d};
4
+ import{c,f as s}from"./chunk-C56EKYBO.js";var p=10,f=2.5,_="advanced-tool-use-2025-11-20",d=new Set(["api.anthropic.com"]),l="YUKINO_MCP_LOADING";function u(o){if(!o)return!0;try{return d.has(new URL(o).hostname.toLowerCase())}catch{return!1}}function g(o){return Math.floor(o/f)}function m(o,e,t,n,i=p){let r=(process.env[l]??"").trim().toLowerCase();if(r==="eager"||r==="native"||r==="dispatch")return r==="native"&&e!=="anthropic"?"dispatch":r;if(n<=0)return"eager";let a=t*i/100;return g(n)<a?"eager":e==="anthropic"&&u(o)?"native":"dispatch"}function h(o){let e=0;for(let t of o.listTools())if(t.name.startsWith(c))try{e+=JSON.stringify(t.schema()).length}catch{e+=t.name.length+(t.description?.length??0)}return e}function T(o,e){o.mcpLoadingMode=e;let t=e==="eager";for(let n of o.listTools())s(n)&&typeof n.setDeferLoading=="function"&&n.setDeferLoading(!t);o.exposeToolSearch=!t,o.exposeMcpCall=e==="dispatch"}function v(o,e,t,n){let i=m(e,t,n,h(o));return T(o,i),i}export{_ as a,u as b,T as c,v as d};
@@ -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{C as e}from"./chunk-W4GMCNWF.js";import{readFileSync as i}from"fs";import o from"path";import{fileURLToPath as c}from"url";var f=e.object({version:e.string()});function _(){return"0.0.13"}var u=_();export{u as a};
4
+ import{C as e}from"./chunk-W4GMCNWF.js";import{readFileSync as i}from"fs";import o from"path";import{fileURLToPath as c}from"url";var f=e.object({version:e.string()});function _(){return"0.0.15"}var u=_();export{u as a};