@swifty.js/swifty 0.0.22 → 0.0.24

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 (35) hide show
  1. package/dist/{agent-5T7KNC7V.js → agent-24XMR2WX.js} +1 -1
  2. package/dist/anthropic-7QRAPLOY.js +4 -0
  3. package/dist/{checker-OJFS2MZY.js → checker-3RWAYF2U.js} +1 -1
  4. package/dist/{chunk-HJIGA37J.js → chunk-5KXBVL2A.js} +1 -1
  5. package/dist/chunk-FAJYJI6T.js +389 -0
  6. package/dist/chunk-MWZIARZE.js +130 -0
  7. package/dist/{chunk-GUXBLUNR.js → chunk-NR62AA5K.js} +1 -1
  8. package/dist/chunk-QN27QEFS.js +4 -0
  9. package/dist/{chunk-LX2LK3TF.js → chunk-SIWLMWHH.js} +12 -11
  10. package/dist/{chunk-NEAR6YPZ.js → chunk-VQUWSKQQ.js} +21 -20
  11. package/dist/{chunk-NLNH3IRT.js → chunk-W37Y53LX.js} +1 -1
  12. package/dist/lib/agent-U42LS73D.js +9 -0
  13. package/dist/lib/{anthropic-GFWP3ORB.js → anthropic-RYPJDHQM.js} +6 -6
  14. package/dist/lib/{checker-IIXJXQCB.js → checker-6BW4222R.js} +3 -3
  15. package/dist/lib/{chunk-LUEP4JMF.js → chunk-2AUSNVIB.js} +8 -12
  16. package/dist/lib/{chunk-C7IHCJZ3.js → chunk-2QILP24G.js} +283 -12
  17. package/dist/lib/{chunk-6GOWRPYS.js → chunk-3LU4APFB.js} +2 -2
  18. package/dist/lib/{chunk-EJLGB2EJ.js → chunk-EY7HE52Q.js} +14 -7
  19. package/dist/lib/{chunk-7URDLWQN.js → chunk-GNI7YX6F.js} +2 -2
  20. package/dist/lib/{chunk-UMFNTXKA.js → chunk-OO2CLOEE.js} +38 -38
  21. package/dist/lib/{chunk-GNBXECZN.js → chunk-PZ42NAFA.js} +2 -3
  22. package/dist/lib/{chunk-RR2CZ6CY.js → chunk-XFSN4LMA.js} +94 -75
  23. package/dist/lib/{chunk-UHVO63Y7.js → chunk-XG6NELJH.js} +69 -38
  24. package/dist/lib/index.d.ts +234 -237
  25. package/dist/lib/index.js +212 -224
  26. package/dist/lib/{openai-HXRMPNB7.js → openai-VX5VBXZ4.js} +4 -4
  27. package/dist/main.js +197 -465
  28. package/dist/{openai-TVUUHRG7.js → openai-6MXNADYN.js} +15 -15
  29. package/dist/{server-ZTLHJWEQ.js → server-NJ2NXAOI.js} +16 -16
  30. package/package.json +5 -5
  31. package/dist/anthropic-P2R4GW6F.js +0 -4
  32. package/dist/chunk-L73IHJF4.js +0 -386
  33. package/dist/chunk-YQQVB6VB.js +0 -127
  34. package/dist/chunk-ZZQE743W.js +0 -4
  35. package/dist/lib/agent-2AGRYN3R.js +0 -9
@@ -1,127 +0,0 @@
1
- #!/usr/bin/env node
2
- import { createRequire as __swiftyCreateRequire } from "node:module";
3
- const require = __swiftyCreateRequire(import.meta.url);
4
- import{D as i,I as v,K as p,O as _,S as U,e as M,f as x}from"./chunk-LX2LK3TF.js";var T=class{history=[];longTermMemoryInjected=!1;baselineTokens=0;_anchorCount=0;addUserMessage(e){this.history.push({role:"user",content:e})}addAssistantMessage(e){this.history.push({role:"assistant",content:e})}addToolUseMessage(e,o,s,n){this.history.push({role:"assistant",content:e,toolUses:[{toolUseId:o,toolName:s,arguments:n}]})}addAssistantMessageWithTools(e,o){this.history.push({role:"assistant",content:e,toolUses:o})}addAssistantFull(e,o,s){this.history.push({role:"assistant",content:e,thinkingBlocks:o.length>0?o:void 0,toolUses:s.length>0?s:void 0})}addToolResultMessage(e,o,s){this.history.push({role:"user",content:"",toolResults:[{toolUseId:e,content:o,isError:s}]})}addToolResultsMessage(e){this.history.push({role:"user",content:"",toolResults:e})}addSystemReminder(e){this.history.push({role:"user",content:`<system-reminder>
5
- ${e}
6
- </system-reminder>`})}hasReminderContaining(e){return this.history.some(o=>o.role==="user"&&p(o.content).includes(e))}injectLongTermMemory(e,o,s=""){if(this.longTermMemoryInjected)return;let n=[];if(e&&n.push(`# SWIFTY.md
7
- Codebase and user instructions are shown below. Be sure to adhere to these instructions. IMPORTANT: These instructions OVERRIDE any default behavior and you MUST follow them exactly as written.
8
-
9
- ${e}}`),o&&n.push(`# Auto Memory
10
- `+o),s&&n.push(`# Available Skills
11
- `+s),n.length===0)return;let r=new Date().toISOString().split("T")[0];n.push(`# Current Date
12
-
13
- Today's date is ${r}.`);let a=`
14
- <system-reminder>
15
- As you answer the user's questions, you can use the following context:
16
-
17
- ${n.join(`
18
-
19
- `)}
20
-
21
- IMPORTANT: this context may or may not be relevant to your tasks. You should not respond to this context unless it is highly relevant to your task.
22
- </system-reminder>`;this.history.unshift({role:"user",content:a}),this.longTermMemoryInjected=!0}len(){return this.history.length}truncateTo(e){e<0&&(e=0),!(e>this.history.length)&&(this.history=this.history.slice(0,e))}reset(){this.history=[],this.longTermMemoryInjected=!1,this.clearUsageAnchor()}getMessages(){return[...this.history]}replaceWithCompacted(e,o){this.history=[{role:"user",content:e},...o],this.longTermMemoryInjected=!1,this.clearUsageAnchor()}recordUsageAnchor(e,o,s,n){let r=e+s+n+o;r<=0||(this.baselineTokens=r,this._anchorCount=this.history.length)}clearUsageAnchor(){this.baselineTokens=0,this._anchorCount=0}usageAnchorState(){return this.baselineTokens<=0?null:{baselineTokens:this.baselineTokens,anchorCount:this._anchorCount}}};import{randomBytes as z}from"crypto";import{readFileSync as A,writeFileSync as H,readdirSync as W,mkdirSync as J,statSync as X,existsSync as I,unlinkSync as Ce,rmSync as xe}from"fs";import{join as y}from"path";var S="compact_boundary";var E=i.object({tool_use_id:i.string(),tool_name:i.string(),arguments:i.record(i.string(),i.unknown()).optional()}),k=i.union([i.string(),i.array(i.record(i.string(),i.unknown()))]),N=i.object({tool_use_id:i.string(),content:k,is_error:i.boolean().optional()}),B=i.object({role:i.string(),content:k.default(""),timestamp:i.number(),type:i.string().optional(),tool_uses:i.array(E).optional(),tool_results:i.array(N).optional()}),G=i.object({role:i.string(),content:k,tool_uses:i.array(E).optional(),tool_results:i.array(N).optional()});function O(t){return(t??[]).map(e=>({tool_use_id:e.toolUseId,tool_name:e.toolName,...e.arguments&&Object.keys(e.arguments).length?{arguments:e.arguments}:{}}))}function L(t){return(t??[]).map(e=>({tool_use_id:e.toolUseId,content:e.content,...e.isError?{is_error:!0}:{}}))}var V=i.object({summary:i.string(),keep:i.array(G)}),b=v({module:"session"});function R(t){return y(t,".swifty","sessions")}function Ae(t,e){return y(R(t),e+".jsonl")}function Ie(){let t=Date.now().toString(36),e=z(4).toString("hex");return`${t}-${e}`}function Q(t,e,o){let s=R(t);J(s,{recursive:!0});let n=y(s,`${e}.jsonl`),r=JSON.stringify(o)+`
23
- `;H(n,r,{flag:"a",encoding:"utf-8"})}function Ee(t,e,o){Q(t,e,{role:"system",content:JSON.stringify(o),timestamp:Math.floor(Date.now()/1e3),type:S})}function Ne(t,e){let o=y(R(t),`${e}.jsonl`);if(!I(o))return[];let s=[];for(let n of A(o,"utf-8").split(`
24
- `))if(n.trim())try{let r=JSON.parse(n),{success:l,data:a,error:c}=x(B,r);l?!a.content&&!(a.tool_uses?.length??0)&&!(a.tool_results?.length??0)||s.push(a):b.error({err:c},"session operation failed")}catch(r){b.error({err:r},"session operation failed")}return s}function j(t){return t?.map(e=>({toolUseId:e.tool_use_id,toolName:e.tool_name,arguments:e.arguments}))}function F(t){return t?.map(e=>({toolUseId:e.tool_use_id,content:e.content,isError:e.is_error}))}function Be(t){let e=-1;for(let s=t.length-1;s>=0;s--)if(t[s].type===S){e=s;break}let o=[];if(e>=0){let s=null;try{let n=t[e].content,r=typeof n=="string"?JSON.parse(n):null;s=M(V,r)}catch{s=null}if(s){let n=`This session continues from a previous conversation, which has been compressed due to context limitations. Here is a summary of the earlier messages:
25
-
26
- `+s.summary;s.keep.length>0&&(n+=`
27
-
28
- Recent messages have been preserved verbatim.`),o.push({role:"user",content:n});for(let r of s.keep)r.role!=="user"&&r.role!=="assistant"||!r.content&&!(r.tool_uses?.length??0)&&!(r.tool_results?.length??0)||o.push({role:r.role,content:r.content,toolUses:j(r.tool_uses),toolResults:F(r.tool_results)})}for(let n=e+1;n<t.length;n++){let r=t[n];if(r.type===S)continue;let l=P(r);l&&o.push(l)}return o}for(let s of t){let n=P(s);n&&o.push(n)}return o}function P(t){return t.role!=="user"&&t.role!=="assistant"||!t.content&&!(t.tool_uses?.length??0)&&!(t.tool_results?.length??0)?null:{role:t.role,content:t.content,toolUses:j(t.tool_uses),toolResults:F(t.tool_results)}}function Oe(t){let e=R(t);if(!I(e))return[];let o=W(e).filter(n=>n.endsWith(".jsonl")),s=[];for(let n of o){let r=y(e,n),l=X(r),a=n.replace(".jsonl",""),c="",u=0;try{for(let d of A(r,"utf-8").split(`
29
- `)){if(!d.trim())continue;let m;try{let g=JSON.parse(d);m=M(B,g)}catch(g){b.error({err:g},"session operation failed");continue}u++,!c&&m.role==="user"&&m.content&&(c=p(m.content).slice(0,100))}}catch(d){b.error({err:d},"session operation failed");continue}s.push({id:a,firstMessage:c,messageCount:u,size:l.size,modTime:l.mtime})}return s.sort((n,r)=>r.modTime.getTime()-n.modTime.getTime()),s}var $=3,Z=3,ee="[earlier conversation truncated for compaction retry]",te=3.5,oe=1e4,se=5,ne=4e4,re=2,ie=2e4,ae=13e3,le=3e3;function D(t,e,o=!1){return t-Math.min(e,ie)-(o?le:ae)}var q=class{consecutiveFailures=0},ce=7e3;function Y(t){if(typeof t=="string")return t.length;let e=0;for(let o of t)o.type==="text"?e+=U(o,"text").length:o.type==="image"&&(e+=ce);return e}function w(t){let e=0;for(let o of t){if(e+=Y(o.content),o.toolUses&&(e+=JSON.stringify(o.toolUses).length),o.toolResults)for(let s of o.toolResults)e+=Y(s.content);if(o.thinkingBlocks)for(let s of o.thinkingBlocks)e+=s.thinking.length}return Math.ceil(e/te)}function ue(t){return w(t.getMessages())}function C(t){return w([t])}function de(t){return t.role==="user"&&!!t.toolResults&&t.toolResults.length>0}function me(t){let e=0,o=0,s=t.length;for(let n=t.length-1;n>=0;n--){let r=C(t[n]);if(o>0&&e+r>ne||(s=n,e+=r,o++,e>=oe||o>=se))break}return s=he(t,s),s}function he(t,e){if(e<=0||e>=t.length||!de(t[e]))return e;let o=new Set((t[e].toolResults??[]).map(s=>s.toolUseId));for(let s=e-1;s>=0;s--){let n=t[s];if(n.role==="assistant"&&n.toolUses?.some(r=>o.has(r.toolUseId)))return s}return e}function ge(t,e){let o=e??t.usageAnchorState();if(!o)return ue(t);let s=t.getMessages(),n=Math.min(o.anchorCount,s.length);return o.baselineTokens+w(s.slice(n))}async function De(t,e,o,s,n,r,l,a,c=""){let u=ge(t),d=D(o,s),m=D(o,s,!0);if(u<d)return{compacted:!1,message:""};if(!(u>=m)&&n.consecutiveFailures>=$)return{compacted:!1,message:`Auto-compact circuit breaker: ${String($)} consecutive failures`};try{let f=await K(t,e,r,l,a,c);return n.consecutiveFailures=0,f}catch(f){return n.consecutiveFailures++,{compacted:!1,message:`Auto-compact failed: ${_(f)}`}}}async function qe(t,e,o,s,n,r=""){return K(t,e,o,s,n,r)}var fe=`Your task is to create a detailed summary of the conversation so far, paying close attention to the user's explicit requests and your previous actions.
30
- This summary should be thorough in capturing technical details, code patterns, and architectural decisions that would be essential for continuing development work without losing context.
31
-
32
- Before providing your final summary, wrap your analysis in <analysis> tags to organize your thoughts and ensure you've covered all necessary points. In your analysis process:
33
-
34
- 1. Chronologically analyze each message and section of the conversation. For each section thoroughly identify:
35
- - The user's explicit requests and intents
36
- - Your approach to addressing the user's requests
37
- - Key decisions, technical concepts and code patterns
38
- - Specific details like:
39
- - file names
40
- - full code snippets
41
- - function signatures
42
- - file edits
43
- - Errors that you ran into and how you fixed them
44
- - Pay special attention to specific user feedback that you received, especially if the user told you to do something differently.
45
- 2. Double-check for technical accuracy and completeness, addressing each required element thoroughly.
46
-
47
- After your analysis, output your final summary wrapped in <summary> tags. Your summary should include the following sections:
48
-
49
- 1. Primary Request and Intent: Capture all of the user's explicit requests and intents in detail
50
- 2. Key Technical Concepts: List all important technical concepts, technologies, and frameworks discussed.
51
- 3. Files and Code Sections: Enumerate specific files and code sections examined, modified, or created. Pay special attention to the most recent messages and include full code snippets where applicable and include a summary of why this file read or edit is important.
52
- 4. Errors and fixes: List all errors that you ran into, and how you fixed them. Pay special attention to specific user feedback that you received, especially if the user told you to do something differently.
53
- 5. Problem Solving: Document problems solved and any ongoing troubleshooting efforts.
54
- 6. All user messages: List ALL user messages that are not tool results. These are critical for understanding the users' feedback and changing intent.
55
- 7. Pending Tasks: Outline any pending tasks that you have explicitly been asked to work on.
56
- 8. Current Work: Describe in detail precisely what was being worked on immediately before this summary request, paying special attention to the most recent messages from both user and assistant. Include file names and code snippets where applicable.
57
- 9. Optional Next Step: List the next step that you will take that is related to the most recent work you were doing. IMPORTANT: ensure that this step is DIRECTLY in line with the user's most recent explicit requests, and the task you were working on immediately before this summary request. If your last task was concluded, then only list next steps if they are explicitly in line with the users request. Do not start on tangential requests or really old requests that were already completed without confirming with the user first.
58
- If there is a next step, include direct quotes from the most recent conversation showing exactly what task you were working on and where you left off. This should be verbatim to ensure there's no drift in task interpretation.
59
-
60
- Here's an example of how your output should be structured:
61
-
62
- <example>
63
- <analysis>
64
- [Your thought process, ensuring all points are covered thoroughly and accurately]
65
- </analysis>
66
-
67
- <summary>
68
- 1. Primary Request and Intent:
69
- [Detailed description]
70
-
71
- 2. Key Technical Concepts:
72
- - [Concept 1]
73
- - [Concept 2]
74
- - [...]
75
-
76
- 3. Files and Code Sections:
77
- - [File Name 1]
78
- - [Summary of why this file is important]
79
- - [Summary of the changes made to this file, if any]
80
- - [Important Code Snippet]
81
- - [File Name 2]
82
- - [Important Code Snippet]
83
- - [...]
84
-
85
- 4. Errors and fixes:
86
- - [Detailed description of error 1]:
87
- - [How you fixed the error]
88
- - [User feedback on the error if any]
89
- - [...]
90
-
91
- 5. Problem Solving:
92
- [Description of solved problems and ongoing troubleshooting]
93
-
94
- 6. All user messages:
95
- - [Detailed non tool use user message]
96
- - [...]
97
-
98
- 7. Pending Tasks:
99
- - [Task 1]
100
- - [Task 2]
101
- - [...]
102
-
103
- 8. Current Work:
104
- [Precise description of current work]
105
-
106
- 9. Optional Next Step:
107
- [Optional Next step to take]
108
-
109
- </summary>
110
- </example>
111
-
112
- Please provide your summary based on the conversation so far, following this structure and ensuring precision and thoroughness in your response.`;function pe(t){return fe+`
113
-
114
- `+t}function ye(t){let e=[],o=[],s=!1;for(let n of t)n.role==="assistant"&&s&&o.length>0&&(e.push(o),o=[]),o.push(n),s=!!(n.toolResults&&n.toolResults.length>0);return o.length>0&&e.push(o),e}function Te(t,e){let o=ye(t);if(o.length<2)return null;let s;if(e>0){let r=0;s=0;for(let l of o)if(r+=l.reduce((a,c)=>a+C(c),0),s++,r>=e)break}else s=Math.max(1,Math.floor(o.length/5));if(s=Math.min(s,o.length-1),s<1)return null;let n=o.slice(s).flat();return n.length>0&&n[0].role!=="user"&&n.unshift({role:"user",content:ee}),n}function be(t){return t.map(e=>{let o=`[${e.role}]: ${p(e.content)}`;return e.toolUses&&(o+=`
115
- [tools: ${e.toolUses.map(s=>s.toolName).join(", ")}]`),o}).join(`
116
-
117
- `)}async function Re(t,e,o){let s=e;for(let n=0;;n++){let r=be(s),l=new T;l.addUserMessage(pe(r));try{let a="",c=t.stream(l,o);for await(let d of c)d.type==="text_delta"&&(a+=d.text);let u=/<summary>([\s\S]*?)<\/summary>/.exec(a);return u?u[1].trim():a}catch(a){let c=a instanceof Error?a.message.toLowerCase():"";if(!(c.includes("prompt")&&c.includes("long")||c.includes("too many")||c.includes("context_length"))||n>=Z)throw a;let d=s.reduce((g,f)=>g+C(f),0)/5,m=Te(s,d);if(!m)throw a;s=m}}}async function K(t,e,o,s,n,r=""){let l=t.getMessages(),a=me(l);if(a<=0||a<re)return{compacted:!1,message:`Compaction skipped: only ${String(a)} message(s) to summarize, kept verbatim`};let c=l.slice(0,a),u=l.slice(a),d=await Re(e,c,n),m=o?o.buildRecoveryAttachment(s):"",g=`This session continues from a previous conversation, which has been compressed due to context limitations. Here is a summary of the earlier messages:
118
-
119
- `+d;u.length>0&&(g+=`
120
-
121
- Recent messages have been preserved verbatim.`),r&&(g+=`
122
-
123
- If you need specific details from before compaction (code snippets, error messages, etc.), use ReadFile to read the full session transcript: ${r}`),m&&(g+=`
124
-
125
- ---
126
-
127
- ${m}`),t.replaceWithCompacted(g,u);let f=u.filter(h=>(h.role==="user"||h.role==="assistant")&&(h.content||(h.toolUses?.length??0)||(h.toolResults?.length??0))).map(h=>({role:h.role,content:h.content,...h.toolUses?.length?{tool_uses:O(h.toolUses)}:{},...h.toolResults?.length?{tool_results:L(h.toolResults)}:{}}));return{compacted:!0,message:`Compacted ${String(c.length)} messages into summary (${String(d.length)} chars), kept ${String(u.length)} recent messages verbatim`,boundary:{summary:d,keep:f}}}export{T as a,O as b,L as c,Ae as d,Ie as e,Q as f,Ee as g,Ne as h,Be as i,Oe as j,D as k,q as l,De as m,qe as n};
@@ -1,4 +0,0 @@
1
- #!/usr/bin/env node
2
- import { createRequire as __swiftyCreateRequire } from "node:module";
3
- const require = __swiftyCreateRequire(import.meta.url);
4
- import{I as y,M as u,O as T,S as f}from"./chunk-LX2LK3TF.js";import{b as g}from"./chunk-E55KH72M.js";var S=y({module:"mcp"}),p="mcp__",m="__";function a(e){return e.replace(/[^a-zA-Z0-9_]/g,"_")}function _(e){return p+a(e)+m}function h(e,r){return _(e)+a(r)}var C=class{name;description;category="command";deferred=!0;mcpServerName;client;originalName;inputSchema;constructor(r,t,n){this.name=h(t,n.name),this.description=n.description,this.originalName=n.name,this.client=r,this.inputSchema=n.inputSchema,this.mcpServerName=t}mcpInputSchema(){return this.inputSchema??{}}setDeferLoading(r){this.deferred=r}schema(){return{name:this.name,description:this.description,input_schema:this.inputSchema}}async execute(r,t){try{let{output:n,isError:s}=await this.client.callTool(this.originalName,t);return{output:n,isError:s}}catch(n){return S.error({err:n},"mcp operation failed"),{output:`MCP tool error: ${T(n)}`,isError:!0}}}};function x(e,r){if(r==="string"&&typeof e=="number"&&Number.isFinite(e))return String(e);if((r==="integer"||r==="number")&&typeof e=="string"){let t=e.trim();if(t===""||!(r==="integer"?/^[+-]?\d+$/:/^[+-]?(\d+\.?\d*|\.\d+)([eE][+-]?\d+)?$/).test(t))return e;let s=r==="integer"?Number.parseInt(t,10):Number.parseFloat(t);return Number.isNaN(s)?e:s}if(r==="boolean"&&typeof e=="string"){let t=e.trim().toLowerCase();if(t==="true")return!0;if(t==="false")return!1}return e}function d(e,r){if(typeof r!="object"||r===null)return e;let t=u(r),n=f(t,"type","");if(n==="object"&&typeof e=="object"&&e!==null&&!Array.isArray(e)){let s=u(t.properties??{}),o={};for(let[i,c]of Object.entries(e))o[i]=i in s?d(c,s[i]):c;return o}if(n==="array"){let s=t.items??{},o=e;if(typeof o=="object"&&o!==null&&!Array.isArray(o)){let i=Object.values(o);i.length===1&&Array.isArray(i[0])&&(o=i[0])}else typeof o=="string"&&(o=o.split(",").map(i=>i.trim()).filter(i=>i!==""));return Array.isArray(o)?o.map(i=>d(i,s)):o}return n!==""?x(e,n):e}function O(e,r){if(r.startsWith(p)){let t=r.slice(p.length),n=t.indexOf(m);if(n>=0)return a(t.slice(0,n))+m+a(t.slice(n+m.length))}return a(e)+m+a(r)}function M(e){return"mcpInputSchema"in e&&typeof e.mcpInputSchema=="function"}var b=class{constructor(r){this.registry=r}registry;name=g;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"]}}}resolve(r,t){let n=this.registry.get(t)??this.registry.get(h(r,t));if(n)return n;let s=m+a(t),o=this.registry.listTools().filter(i=>i.name.startsWith(p)&&i.name.endsWith(s));return o.length===1?o[0]:void 0}availableNames(){return this.registry.listTools().filter(r=>r.name.startsWith(p)).map(r=>r.name).sort()}async execute(r,t){let n=f(t,"server",""),s=f(t,"tool","");if(s==="")return{output:"McpCall requires a 'tool' name",isError:!0};let o=this.resolve(n,s);if(!o){let c=this.availableNames(),l=c.length>0?c.join(", "):"(none connected)";return{output:`Unknown MCP tool '${s}' on server '${n}'. Available tools: ${l}`,isError:!0}}let i={};if(typeof t.arguments=="object"&&t.arguments!==null&&!Array.isArray(t.arguments)&&(i=u(t.arguments)),M(o)){let c=o.mcpInputSchema();if(Object.keys(c).length>0){let l=d(i,c);typeof l=="object"&&l!==null&&!Array.isArray(l)&&(i=u(l))}}return o.execute(r,i)}};export{p as a,C as b,O as c,M as d,b as e};
@@ -1,9 +0,0 @@
1
- import {
2
- Agent
3
- } from "./chunk-UHVO63Y7.js";
4
- import "./chunk-C7IHCJZ3.js";
5
- import "./chunk-UMFNTXKA.js";
6
- import "./chunk-EJLGB2EJ.js";
7
- export {
8
- Agent
9
- };