fluxflow-cli 5.1.0 → 5.2.1
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 +1 -1
- package/dist/chunks/{9router-LRFKCJF4.js → 9router-KRJQK6JP.js} +1 -1
- package/dist/chunks/{addMemScore-PBVNSFPN.js → addMemScore-VUSJ2Q64.js} +1 -1
- package/dist/chunks/ai-BINPY3GV.js +1 -0
- package/dist/chunks/{aihubmix-TETL5QYQ.js → aihubmix-KJIG7CZO.js} +1 -1
- package/dist/chunks/{apinex-FAYOPQSL.js → apinex-EP3JJPZO.js} +1 -1
- package/dist/chunks/app-DRT7CX3P.js +331 -0
- package/dist/chunks/{auto_completion-FUOGJILX.js → auto_completion-I2GVIND6.js} +1 -1
- package/dist/chunks/{chat-ISCVWNVN.js → chat-OYRESDTX.js} +1 -1
- package/dist/chunks/{chunk-QESQR5GB.js → chunk-25EUCCH5.js} +1 -1
- package/dist/chunks/chunk-75OCC24T.js +2 -0
- package/dist/chunks/{chunk-J4J3F6BT.js → chunk-7CCULUZN.js} +1 -1
- package/dist/chunks/{chunk-52STSLCN.js → chunk-BLAXTPPN.js} +1 -1
- package/dist/chunks/chunk-BM4FWHBO.js +885 -0
- package/dist/chunks/{chunk-UIL6OCU4.js → chunk-BNKY5QOA.js} +2 -2
- package/dist/chunks/{chunk-IHDJDAG3.js → chunk-E5CFO23P.js} +1 -1
- package/dist/chunks/chunk-KIPZOUEA.js +44 -0
- package/dist/chunks/{chunk-6EYQQ7GQ.js → chunk-KOCMIEPK.js} +1 -1
- package/dist/chunks/chunk-L22YGL6T.js +15 -0
- package/dist/chunks/{chunk-P5HBJA23.js → chunk-NTZSL2UT.js} +1 -1
- package/dist/chunks/{chunk-EXT42EJZ.js → chunk-QVRPR3DJ.js} +1 -1
- package/dist/chunks/{chunk-GM5VNNTU.js → chunk-RINQH4H4.js} +1 -1
- package/dist/chunks/{chunk-B4UKMX5E.js → chunk-UMS5SEYB.js} +1 -1
- package/dist/chunks/{chunk-ZNO55RNG.js → chunk-VDO5TP6E.js} +1 -1
- package/dist/chunks/{chunk-V36DXF56.js → chunk-XAPXZ6KO.js} +1 -1
- package/dist/chunks/{chunk-HFTI3R3Q.js → chunk-XPIXBWTZ.js} +1 -1
- package/dist/chunks/{chunk-GBH7XI5A.js → chunk-XRTIQISS.js} +1 -1
- package/dist/chunks/chunk-YFIWMGCS.js +2 -0
- package/dist/chunks/{click-AWHZCV2E.js → click-3BB6KDIJ.js} +2 -2
- package/dist/chunks/{computer_action-MO2JR2XH.js → computer_action-6RHVNLZG.js} +1 -1
- package/dist/chunks/custom_openai-ODYQEMOR.js +3 -0
- package/dist/chunks/{deepseek-WNWZJTNE.js → deepseek-I2J4A7WQ.js} +1 -1
- package/dist/chunks/{drag-D2GVPIQB.js → drag-ZGNVQGXW.js} +1 -1
- package/dist/chunks/{emergency_rollback-ZHQXCIHW.js → emergency_rollback-LC4ZBOLP.js} +1 -1
- package/dist/chunks/{exec_command-6V5SM6WI.js → exec_command-SQB5LU5X.js} +1 -1
- package/dist/chunks/{explabs-XHHXTERB.js → explabs-OYP64XS6.js} +1 -1
- package/dist/chunks/{export-RU6LCZUB.js → export-I5DB7ESY.js} +1 -1
- package/dist/chunks/{file_map-UA4BA5OH.js → file_map-K6JQYV35.js} +1 -1
- package/dist/chunks/find_file-5RUNVQJO.js +4 -0
- package/dist/chunks/{generate_image-45UQ6P2B.js → generate_image-7UBJ3ODS.js} +1 -1
- package/dist/chunks/{inferx-HP5AGET3.js → inferx-B6PKXWLZ.js} +1 -1
- package/dist/chunks/{infron-ULXG7VDA.js → infron-4SLX3HMD.js} +1 -1
- package/dist/chunks/{invoke-HKCOHTBD.js → invoke-IXWW3N4C.js} +2 -2
- package/dist/chunks/{invokeSync-NWRHVGJ3.js → invokeSync-EUHHQZ2H.js} +2 -2
- package/dist/chunks/{key_press-AQNKL6UM.js → key_press-LO75QEJK.js} +1 -1
- package/dist/chunks/{keyboard_typing-QSBPTZJ6.js → keyboard_typing-DJ3HHTO7.js} +1 -1
- package/dist/chunks/{memory-7YOYCOXE.js → memory-AT7ARTG3.js} +1 -1
- package/dist/chunks/{mistral-ON6RQMK7.js → mistral-H23J6UYA.js} +1 -1
- package/dist/chunks/model_config-IVWGOIBK.js +1 -0
- package/dist/chunks/{nvidia-I6DPWP6U.js → nvidia-BUWXTYGV.js} +1 -1
- package/dist/chunks/{ollama-6WSZPCI5.js → ollama-53BJCQQX.js} +1 -1
- package/dist/chunks/{openrouter-6MRG4RT6.js → openrouter-LSG67TST.js} +1 -1
- package/dist/chunks/paths-MJECGRI2.js +1 -0
- package/dist/chunks/{poolside-ODFAIK4C.js → poolside-KWCBEP3P.js} +1 -1
- package/dist/chunks/{recapture_screen-PPXYK2YY.js → recapture_screen-LONV6G4U.js} +1 -1
- package/dist/chunks/{saveSummary-W2JMDVZJ.js → saveSummary-ZJDPCZSR.js} +1 -1
- package/dist/chunks/{screen_grid-3RU324CV.js → screen_grid-LK6IVH4B.js} +1 -1
- package/dist/chunks/{scroll-TSU6MTGU.js → scroll-XBXSN2EF.js} +1 -1
- package/dist/chunks/search_keyword-IRLPX555.js +9 -0
- package/dist/chunks/{secrets-TNMLVMST.js → secrets-LHP6ATGQ.js} +1 -1
- package/dist/chunks/{secrets_v2-OBRWR3UT.js → secrets_v2-4ZICSEV6.js} +1 -1
- package/dist/chunks/{sensenova-3K44URJQ.js → sensenova-MLFZTP7U.js} +1 -1
- package/dist/chunks/settings-IZC7UDNU.js +1 -0
- package/dist/chunks/{todo-CJLWLWJB.js → todo-YFLPXYFL.js} +1 -1
- package/dist/chunks/{tokenharbor-YV2GV2LM.js → tokenharbor-Y6HSTTHA.js} +1 -1
- package/dist/chunks/update_file-CH6YILXO.js +15 -0
- package/dist/chunks/{usage-EBE2OVES.js → usage-G7HRNQNU.js} +1 -1
- package/dist/chunks/{usageServer-RTK5N5KE.js → usageServer-SHBKSO4I.js} +13 -5
- package/dist/chunks/view_file-OYV2IEYG.js +1 -0
- package/dist/chunks/{web_scrape-J3PL2PXT.js → web_scrape-MVSCRDKO.js} +1 -1
- package/dist/chunks/{web_search-KBGH67IV.js → web_search-C3WKDOSZ.js} +1 -1
- package/dist/chunks/{write_docx-E3MTFXTQ.js → write_docx-QGW25TF7.js} +1 -1
- package/dist/chunks/write_file-WX4O436W.js +34 -0
- package/dist/chunks/{write_pdf-TPGUF4VT.js → write_pdf-5HOQYVQO.js} +1 -1
- package/dist/chunks/{xkiro-B2LYGZTF.js → xkiro-D3DTPVWY.js} +1 -1
- package/dist/cli.js +8 -8
- package/dist/package.json +2 -2
- package/package.json +2 -2
- package/dist/chunks/ai-ZMBQQ3QP.js +0 -1
- package/dist/chunks/app-DJV7SIS6.js +0 -325
- package/dist/chunks/chunk-26BQ45XP.js +0 -2
- package/dist/chunks/chunk-4BLSASW6.js +0 -13
- package/dist/chunks/chunk-7SGZ66KT.js +0 -44
- package/dist/chunks/chunk-LQM3JK7N.js +0 -1
- package/dist/chunks/chunk-WS35FH7W.js +0 -866
- package/dist/chunks/custom_openai-K554R7Q5.js +0 -3
- package/dist/chunks/find_file-HYHHFHUJ.js +0 -4
- package/dist/chunks/model_config-QRYAVWHF.js +0 -1
- package/dist/chunks/paths-RQRI2XRY.js +0 -1
- package/dist/chunks/search_keyword-4W6Q7Q7T.js +0 -8
- package/dist/chunks/settings-PUFSRWT3.js +0 -1
- package/dist/chunks/update_file-TGEB5UWK.js +0 -13
- package/dist/chunks/view_file-I77KYUO5.js +0 -1
- package/dist/chunks/write_file-O6OF7Z2W.js +0 -32
|
@@ -1,3 +0,0 @@
|
|
|
1
|
-
import{a as m}from"./chunk-PTFCY2D5.js";import{a as L}from"./chunk-HFTI3R3Q.js";import{n as U}from"./chunk-J4J3F6BT.js";import"./chunk-P5HBJA23.js";import"./chunk-26BQ45XP.js";var Q=async function*(_,C,v,E,A,b,$,d,W=1,B=""){let x=[];E&&x.push({role:"system",content:E});for(let t of v){let e=t.role==="user"?"user":"assistant",n=[];if(Array.isArray(t.parts)){for(let o of t.parts)if(o.text)n.push({type:"text",text:o.text});else if(o.inlineData&&$){let c=o.inlineData.mimeType,u=o.inlineData.data;c.startsWith("image/")&&n.push({type:"image_url",image_url:{url:`data:${c};base64,${u}`}})}}else{let o=t.text||"";o&&n.push({type:"text",text:o})}x.push({role:e,content:n.length===1&&n[0].type==="text"?n[0].text:n})}let P=L("c_openai",C,A),y=P!==null?P:{Fast:"none",Low:"low",Medium:"medium",Standard:"medium",High:"high",xHigh:"xhigh"}[A],a={model:C,messages:x,stream:!0,stream_options:{include_usage:!0},temperature:W,tools:[],tool_choice:"none"};y&&y!=="none"&&(a.reasoning_effort=y,a.reasoning={effort:y});let N=(B||process.env.CUSTOM_OPENAI_URL||process.env.C_OPENAI_URL||"").trim();if(!N)throw new Error("Custom OpenAI Base URL is not configured. Please set Base URL in /settings -> Providers.");let f=N.replace(/\/+$/,"");f.endsWith("/chat/completions")||(f.endsWith("/v1")?f=`${f}/chat/completions`:f=`${f}/chat/completions`);let l={"Content-Type":"application/json",Accept:"text/event-stream, application/json","X-Title":"Flux-Flow","User-Agent":"Flux-Flow"},S=_===U,T=S?"":_&&_!=="LOCAL"?_:process.env.CUSTOM_OPENAI_API_KEY||process.env.C_OPENAI_API_KEY||"";if(!S&&T&&T.trim()!==""){let t=T.trim();l.Authorization=t.startsWith("Bearer ")?t:`Bearer ${t}`,l["api-key"]=t}let s=await m(f,{method:"POST",headers:l,body:JSON.stringify(a),signal:d});if(!s.ok&&(s.status===400||s.status===422)&&(a.reasoning||a.reasoning_effort)){if(console.info(`
|
|
2
|
-
`),a.reasoning&&a.reasoning_effort){let t={...a};delete t.reasoning_effort;let e=await m(f,{method:"POST",headers:l,body:JSON.stringify(t),signal:d}).catch(()=>null);e&&e.ok&&(s=e)}if(!s.ok&&a.reasoning_effort){let t={...a};delete t.reasoning;let e=await m(f,{method:"POST",headers:l,body:JSON.stringify(t),signal:d}).catch(()=>null);e&&e.ok&&(s=e)}if(!s.ok){let t={...a};delete t.reasoning,delete t.reasoning_effort;let e=await m(f,{method:"POST",headers:l,body:JSON.stringify(t),signal:d}).catch(()=>null);e&&e.ok&&(s=e)}}if(!s.ok){let t=await s.json().catch(()=>({})),e=t.error?.metadata?.raw||t.error?.message||(typeof t.error=="string"?t.error:"")||t.message||s.statusText||"Unknown error";throw new Error(`Custom OpenAI Error (${s.status}): ${e}`)}let F=s.body.getReader(),J=new TextDecoder,w="",i=[],p=null,k=Date.now(),g=!1,R=(t,e)=>{if(!t&&!e)return null;if(t){if(typeof t.reasoning_content=="string"&&t.reasoning_content)return t.reasoning_content;if(typeof t.reasoning=="string"&&t.reasoning)return t.reasoning;if(typeof t.thinking=="string"&&t.thinking)return t.thinking;if(typeof t.thought=="string"&&t.thought)return t.thought;if(typeof t.reasoning_text=="string"&&t.reasoning_text)return t.reasoning_text;if(Array.isArray(t.reasoning_details)&&t.reasoning_details.length>0){let n=t.reasoning_details.map(o=>typeof o=="string"?o:o?.text||o?.content||"").filter(Boolean).join("");if(n)return n}}if(e){if(typeof e.reasoning_content=="string"&&e.reasoning_content)return e.reasoning_content;if(typeof e.reasoning=="string"&&e.reasoning)return e.reasoning}return null},K=(t,e)=>{if(t){if(typeof t.content=="string"&&t.content)return t.content;if(typeof t.text=="string"&&t.text)return t.text;if(Array.isArray(t.content))return t.content.map(n=>typeof n=="string"?n:n?.text||"").join("")}return e&&typeof e.text=="string"&&e.text?e.text:""},Y=t=>{let e=t.usage||t.usageMetadata||t.choices?.[0]?.usage||null;if(!e)return null;let n=e.prompt_tokens||e.promptTokenCount||e.input_tokens||0,o=e.completion_tokens||e.candidatesTokenCount||e.output_tokens||0,c=e.total_tokens||e.totalTokenCount||n+o,u=e.prompt_tokens_details?.cached_tokens||e.prompt_tokens_details?.cache_read_input_tokens||e.cachedContentTokenCount||e.cache_read_input_tokens||0,r=e.completion_tokens_details?.reasoning_tokens||e.thoughtsTokenCount||e.reasoning_tokens||0;return{totalTokenCount:c,promptTokenCount:n,candidatesTokenCount:o,cachedContentTokenCount:u,thoughtsTokenCount:r}};for(;;){let{done:t,value:e}=await F.read();if(t){g&&(i.length>0||p)&&(yield{candidates:i.length>0?[{content:{parts:i}}]:[],usageMetadata:p});break}w+=J.decode(e,{stream:!0});let n=w.split(`
|
|
3
|
-
`);w=n.pop();for(let o of n){let c=o.trim();if(!c||!c.startsWith("data: "))continue;let u=!1;if(c==="data: [DONE]"||c==="data: [DONE]\r")u=!0;else try{let r=JSON.parse(c.substring(6));if(r.error){let H=r.error.metadata?.raw||r.error.message||(typeof r.error=="string"?r.error:JSON.stringify(r.error));throw new Error(`Custom OpenAI Stream Error: ${H}`)}let h=r.choices?.[0],O=h?.delta;h?.finish_reason&&h.finish_reason!=="null"&&(u=!0);let D=Y(r);D&&(p=D,g=!0);let I=R(O,h);I&&(i.push({text:I,thought:!0}),g=!0);let M=K(O,h);M&&(i.push({text:M}),g=!0)}catch(r){if(r.message&&r.message.startsWith("Custom OpenAI Stream Error:"))throw r}if((u||Date.now()-k>=150)&&g&&(yield{candidates:i.length>0?[{content:{parts:[...i]}}]:[],usageMetadata:p},i=[],k=Date.now(),g=!1),u)break}Date.now()-k>=150&&g&&(yield{candidates:i.length>0?[{content:{parts:[...i]}}]:[],usageMetadata:p},i=[],k=Date.now(),g=!1)}};export{Q as getCustomOpenAIStream};
|
|
@@ -1,4 +0,0 @@
|
|
|
1
|
-
import{a as E}from"./chunk-Y5JU726N.js";import{w as F,x as S}from"./chunk-26BQ45XP.js";import W from"fs/promises";import y from"path";function R(n){let e=n.toLowerCase();if(e.length===0)return[];if(e.length===1)return[e];let o=[];for(let t=0;t<e.length-1;t++)o.push(e.slice(t,t+2));return o}function w(n,e){if(n===e)return 1;if(!n||!e)return 0;let o=R(n),t=R(e);if(o.length===0||t.length===0)return 0;let i=new Map;for(let l of t)i.set(l,(i.get(l)||0)+1);let r=0;for(let l of o){let a=i.get(l)||0;a>0&&(r++,i.set(l,a-1))}return 2*r/(o.length+t.length)}async function x(n,e,o=n,t=1,i=15){if(t>i)return[];let r;try{r=await W.readdir(n,{withFileTypes:!0})}catch{return[]}let l=[];for(let a of r){if(e.has(a.name))continue;let u=y.join(n,a.name);if(a.isDirectory()){let m=await x(u,e,o,t+1,i);l.push(...m)}else{let m=y.relative(o,u).replace(/\\/g,"/");l.push({name:a.name,relPath:`./${m}`})}}return l}var O=async n=>{let e=typeof n=="object"&&n!==null?n:E(n),o=e.basename||e.name||e.path||e.file||e.filename||e.query;if(!o&&typeof n=="string"&&n.trim()){let f=n.trim().replace(/^["']|["']$/g,"");!f.startsWith("{")&&!f.includes("=")&&(o=f)}if(!o)return'ERROR: "basename" parameter is required for FindFile';let t=String(o).trim().replace(/^["']|["']$/g,""),i=t.replace(/^(\.\/|\.\\)/,"").replace(/\\/g,"/"),r=i.toLowerCase(),a=t.includes("*")||t.includes("?")?new RegExp("^"+t.replace(/[.+^${}()|[\]\\]/g,"\\$&").replace(/\*/g,".*").replace(/\?/g,".")+"$","i"):null,u=process.cwd(),m=new Set([...F,...S(u)]);try{let f=await x(u,m,u),g=[];for(let s of f){let h=s.name.toLowerCase(),P=y.parse(s.name).name.toLowerCase(),p=s.relPath.toLowerCase(),d=p.startsWith("./")?p.slice(2):p,c=0;if(s.name===i||s.relPath===`./${i}`)c=1;else if(h===r||p===`./${r}`||d===r)c=.98;else if(P===r)c=.95;else if(a&&(a.test(s.name)||a.test(d)))c=.9;else if(h.includes(r)||d.includes(r))c=.7+r.length/Math.max(h.length,r.length)*.15;else{let C=w(r,h),q=w(r,P),M=w(r,d),L=Math.max(C,q,M);L>=.75&&(c=L*.85)}c>=.6&&g.push({relPath:s.relPath,score:c})}if(g.length===0)return`No file found matching name "${t}"`;g.sort((s,h)=>h.score-s.score||s.relPath.length-h.relPath.length);let $=Array.from(new Set(g.map(s=>s.relPath))),b=$.length;return`${`Found ${b} file${b===1?"":"s"} matching "${t}":
|
|
2
|
-
|
|
3
|
-
`}${$.join(`
|
|
4
|
-
`)}`}catch(f){return`ERROR: Failed to find file: ${f.message}`}};export{O as find_file};
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
import{a,b,c,d,e,f,g,h,i,j,k,l,m,n,o,p,q}from"./chunk-LQM3JK7N.js";import"./chunk-26BQ45XP.js";export{a as DEFAULT_MODEL_CONFIG,o as getDefaultModel,q as getFallbackValue,b as getModelConfig,p as getModelPricing,n as getModels,m as hasModelReasoning,l as isModelMultimodal,h as removeModelFromProvider,i as renameModelInProvider,c as saveModelConfigToDisk,d as saveModelToProvider,j as setCustomMultimodal,g as setDefaultModelForProvider,f as setModelMultimodalInProvider,k as setOllamaMultimodal,e as updateModelInfoInProvider};
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
import{a,b,c,d,e,f,g,h,i,j,k,l,m,n,o,p,q,r,s,t,u,v,w,x,y}from"./chunk-26BQ45XP.js";export{q as ACTIVE_TX_FILE,n as BACKUPS_DIR,s as CONTEXT_FILE,u as CU_CACHE_DIR,c as DATA_DIR,w as DEFAULT_EXCLUDES,a as FLUXFLOW_DIR,g as HISTORY_DIR,f as HISTORY_FILE,p as LEDGER_ADVANCE_FILE,o as LEDGER_FILE,d as LOGS_DIR,k as MEMORIES_FILE,t as PARSER_DIR,r as PATHS_FILE,e as SECRET_DIR,b as SETTINGS_FILE,m as TEMP_MEM_CHAT_FILE,l as TEMP_MEM_FILE,v as THINKING_CONFIG_FILE,i as USAGE_FILE,h as USAGE_FILE_OLD,j as USAGE_FILE_TIMED,x as getGitignoreExcludes,y as matchesPathPattern};
|
|
@@ -1,8 +0,0 @@
|
|
|
1
|
-
import{a as Y}from"./chunk-Y5JU726N.js";import{b as Q}from"./chunk-B4UKMX5E.js";import"./chunk-LQM3JK7N.js";import"./chunk-P5HBJA23.js";import{w as V,x as q,y as J}from"./chunk-26BQ45XP.js";import K from"fs/promises";import E from"path";import j from"fast-glob";import{Minimatch as tt}from"minimatch";async function A(f,o,n=f,p=1){if(p>12)return[];let h=[],s;try{s=await K.readdir(f,{withFileTypes:!0})}catch{return[]}for(let t of s){let a=E.join(f,t.name),y=E.relative(n,a),L=y.split(E.sep).map(w=>w.toLowerCase()),O=t.name.toLowerCase();if(!o.some(w=>{let F=w.toLowerCase();return F.startsWith(".")&&O.endsWith(F)?!0:L.some(M=>M===F||M.startsWith(".pnpm"))}))if(t.isDirectory()){let w=await A(a,o,n,p+1);h=h.concat(w)}else t.isFile()&&h.push({fullPath:a,relativePath:y})}return h}function rt(f,o,n=1/0){if(f===o)return 0;if(f.length===0)return o.length;if(o.length===0)return f.length;if(Math.abs(f.length-o.length)>n)return n+1;let p=Array.from({length:o.length+1},(h,s)=>s);for(let h=1;h<=f.length;h++){let s=[h],t=h;for(let a=1;a<=o.length;a++){let y=f[h-1]===o[a-1]?0:1,L=Math.min(s[a-1]+1,p[a]+1,p[a-1]+y);s.push(L),L<t&&(t=L)}if(p=s,t>n)return n+1}return p[o.length]}function nt(f,o){if(!f||!o)return!1;let n=f.toLowerCase(),p=o.toLowerCase();if(n.includes(p))return!0;let h=n.split(/[^a-z0-9]+/).filter(t=>t.length>0),s=p.split(/[^a-z0-9]+/).filter(t=>t.length>1||p.length===1&&t.length>0);return s.length===0?!1:s.every(t=>{let a=t.length<=2?0:t.length<=5?1:2;for(let y of h)if(y.includes(t)||t.length>=3&&y.length>=3&&Math.abs(y.length-t.length)<=a&&rt(t,y,a)<=a)return!0;return!1})}var gt=async f=>{let{keyword:o,path:n,fuzzy:p,subString:h,regex:s}=Y(f);if(o==null)return'ERROR: Missing "keyword" argument.';let t=String(o);if(n){let e=n.trim().toLowerCase();if(e==="#docs"||e==="#doc"||e==="#documentation"||e.includes("#skill/global/fluxflow")||e.startsWith("#skill"))return"ERROR: Cannot search in reserved VFS '#skill' namespace. Use 'ReadFile' to read specific skills."}let a=e=>e===!0||e==="true"||e===1||e==="1"||e==="yes",y=s===!1||s==="false"||s===0||s==="0"||s==="no",L=s===!0||s==="true"||s===1||s==="1"||s==="yes",O=a(p)||a(h),G=null,w=null;if(y)O||(w=new RegExp(`(?<![\\w])${t.replace(/[.*+?^${}()|[\]\\]/g,"\\$&")}(?![\\w])`,"i"));else{try{let e=t;G=new RegExp(e,"i")}catch(e){if(L)return`ERROR: Invalid regex pattern "${t}": ${e.message}`}w=new RegExp(`(?<![\\w])${t.replace(/[.*+?^${}()|[\]\\]/g,"\\$&")}(?![\\w])`,"i")}let F=Array.from(new Set([...V,...q(process.cwd())])),M=150;try{let e=[],P=process.cwd(),u=null;if(n){let i=r=>r.startsWith("!")||!r.startsWith("-")?r:"!"+r.replace(/^-+/,""),g=n.split(";").map(r=>r.trim()).filter(Boolean).map(i).filter(r=>r!=="!"),c=g.some(r=>r.startsWith("!"));if(g.some(r=>j.isDynamicPattern(r)||/[*?{}[\]()|+]/.test(r))){u="glob";let r=n.replace(/\\/g,"/"),l=g.map(m=>m.replace(/\\/g,"/")),z=F.map(m=>m.startsWith(".")?`**/*${m}`:`**/${m}/**`);if(c&&!g.some(m=>!m.startsWith("!"))){let m=await A(P,F,P),R=$=>$.endsWith("/")?$+"**":$,d=l.filter($=>$.startsWith("!")).map($=>R($.slice(1))),v=l.filter($=>!$.startsWith("!")).map(R);e=m.filter($=>{let x=$.relativePath.replace(/\\/g,"/"),_=v.length===0||v.some(b=>{try{return new tt(b).match(x)}catch{return!1}}),Z=d.some(b=>{try{return new tt(b).match(x)}catch{return!1}});return _&&!Z})}else{let m=l.some(d=>/[\(\)\|]|\.\*/.test(d)),R=[];if(!m)try{R=await j(l,{cwd:P,ignore:z,dot:!0,onlyFiles:!0,absolute:!1})}catch{R=[]}if(R.length===0&&(m||j.isDynamicPattern(r))){let d=r.match(/^([^\*\?\(\)\|\[\]\s]+)\//),v=d&&!/[\*\?\(\)\|\[\]]/.test(d[1])?E.resolve(P,d[1]):P,$=await A(v,F,P);try{let x=r.replace(/^\.\//,"");x=x.replace(/\.\*\/(\\.|[^\/])/g,".*$1"),!x.startsWith("^")&&!x.startsWith(".*")&&(x=`.*${x}`);let _=new RegExp(x.endsWith("$")?x:`${x}$`,"i");e=$.filter(Z=>{let b=Z.relativePath.replace(/\\/g,"/");return _.test(b)})}catch{e=[]}}else e=R.map(d=>({fullPath:E.resolve(P,d),relativePath:d}))}}else{let r=[],l=!1,z=!1;for(let k of g){let m=k.replace(/[\/\\]+$/,""),R=E.resolve(P,m);try{let d=await K.stat(R);if(d.isDirectory()){z=!0;let v=await A(R,F,P);r.push(...v)}else if(d.isFile())l=!0,r.push({fullPath:R,relativePath:E.relative(P,R)});else return`ERROR: Path is neither a file nor a directory: ${k}`}catch{return`ERROR: Path not found: ${k}`}}e=r,l&&!z?u="file":u="dir"}}else e=await A(P,F);let et=e.map(async i=>{try{let g=await K.readFile(i.fullPath,"utf-8");if(g.includes("\0"))return[];let c=g.split(/\r?\n/),W=[];for(let l=0;l<c.length;l++)(O?c[l].toLowerCase().includes(t.toLowerCase())||nt(c[l],t):y?w&&w.test(c[l]):G&&G.test(c[l])||w&&w.test(c[l]))&&W.push({line:l+1,content:c[l].trim()});return W.length===0?null:{path:i.relativePath.replace(/\\/g,"/"),matches:W}}catch{return[]}}),st=await Promise.all(et),S=[],D=0;for(let i of st){if(!i||!i.matches)continue;if(D>=M)break;let g=M-D,c=i.matches.slice(0,g);S.push({path:i.path,matches:c}),D+=c.length}typeof global.gc=="function"&&global.gc();let I=null;if(S.length===0){let i=u==="file"?` in '${n}'`:u==="dir"||u==="glob"?` in '${n}'`:". Try to specify files",g=u==="dir"?"[DIR]":u==="glob"?"[GLOB]":"";return`${g}${g?" ":""}Found 0 matches of '${t}'${i}${I?` ${I}`:""}`}let B=I?` ${I}`:"",T=`${S.length} file${S.length===1?"":"s"}`,U=`${D} match${D===1?"":"es"}`,N;u==="file"?N=`Found ${U} of '${t}' in '${n}'${B}:`:u==="dir"||u==="glob"?N=`Found ${U} of '${t}' in '${n}' across ${T}${B}:`:N=`Found ${U} of '${t}' across ${T}${B}:`;let X=u==="dir"?"[DIR]":u==="glob"?"[GLOB]":"",C=`${X}${X?" ":""}${N}
|
|
2
|
-
|
|
3
|
-
`,H="";try{let i=await Q();i?.systemSettings?.alwaysAskFiles&&(H=i.systemSettings.alwaysAskFiles)}catch{}for(let i of S)if(C+=`${i.path}:
|
|
4
|
-
`,J(i.path,H)){let c=i.matches.map(W=>`Line ${W.line}`).join(", ");C+=` ${c}. Line snapshot not available due to file restriction policy. ReadFile if needed
|
|
5
|
-
|
|
6
|
-
`}else{for(let c of i.matches)C+=` Line ${c.line}: ${c.content}
|
|
7
|
-
`;C+=`
|
|
8
|
-
`}return C.trimEnd()}catch(e){return`ERROR: ${e.message}`}};export{gt as search_keyword};
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
import{a,b,c}from"./chunk-B4UKMX5E.js";import"./chunk-LQM3JK7N.js";import"./chunk-P5HBJA23.js";import"./chunk-26BQ45XP.js";export{a as PROVIDER_BASE_URLS,b as loadSettings,c as saveSettings};
|
|
@@ -1,13 +0,0 @@
|
|
|
1
|
-
import{g as $,h as F,i as w,j as C}from"./chunk-7SGZ66KT.js";import{a as E}from"./chunk-6EYQQ7GQ.js";import{a as y}from"./chunk-Y5JU726N.js";import{o as R}from"./chunk-V36DXF56.js";import{b as m}from"./chunk-B4UKMX5E.js";import"./chunk-LQM3JK7N.js";import"./chunk-P5HBJA23.js";import"./chunk-26BQ45XP.js";import p from"fs";import k from"path";var D=async(M,P={})=>{let o=y(M),e=o.path;if(!e)return'ERROR: Missing "path" argument for PatchFile.';let{patchPairs:s,allowMultiple:S,error:u}=$(o);if(u)return`ERROR: ${u}`;if(s.length===0)return"ERROR: No valid replacement pairs found. Use searchContent1, newContent1, etc.";let O=o.allowMultiple!==void 0?o.allowMultiple===!0||String(o.allowMultiple).toLowerCase()==="true":S,i=k.resolve(process.cwd(),e);try{if(!p.existsSync(i))return`ERROR: File [${e}] does not exist. Use WriteFile instead.`;let t=P.forcedContent||p.readFileSync(i,"utf8");t.startsWith("\uFEFF")&&(t=t.slice(1));let n=t.replace(/\r\n/g,`
|
|
2
|
-
`).replace(/\r/g,`
|
|
3
|
-
`),{content:l,results:a}=F(n,s,{allowMultiple:O}),c=a.filter(r=>!r.success),f=a.filter(r=>r.success);if(f.length===0)return`ERROR: Patch Failed to apply to [${e}].
|
|
4
|
-
${c.map(r=>` \u2022 ${r.error}`).join(`
|
|
5
|
-
`)}`;await E.recordFileChange(i,n),p.writeFileSync(i,l,"utf8");let{systemSettings:b}=await m(),d=C(n,l,a,12,b?.compressToolResults),{added:g,removed:h}=w(n,l);return(g>0||h>0)&&await R({added:g,removed:h,file:e}),c.length>0?`File [${e}] updated with some blocks failed. [${f.length}/${s.length}] blocks applied.
|
|
6
|
-
|
|
7
|
-
Failures:
|
|
8
|
-
${c.map(r=>` \u2022 ${r.error}`).join(`
|
|
9
|
-
`)}
|
|
10
|
-
|
|
11
|
-
${d}`:`File [${e}] updated. [${a.length}/${s.length}] blocks applied.
|
|
12
|
-
|
|
13
|
-
${d}`}catch(t){let n=t instanceof Error?t.message:String(t);return`ERROR: Failed to update file [${e}]: ${n}`}};export{D as update_file};
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
import{a}from"./chunk-4BLSASW6.js";import"./chunk-Y5JU726N.js";import"./chunk-26BQ45XP.js";export{a as view_file};
|
|
@@ -1,32 +0,0 @@
|
|
|
1
|
-
import{a as x}from"./chunk-6EYQQ7GQ.js";import{a as k}from"./chunk-Y5JU726N.js";import{o as j}from"./chunk-V36DXF56.js";import{b as C}from"./chunk-B4UKMX5E.js";import"./chunk-LQM3JK7N.js";import"./chunk-P5HBJA23.js";import{c as F}from"./chunk-26BQ45XP.js";import e from"fs";import d from"path";var N=async(L,D={})=>{let{path:i,content:p}=k(L);if(!i)return'ERROR: Missing "path" argument for WriteFile.';if(p===void 0)return'ERROR: Missing "content" argument for WriteFile.';p=p.replace(/^```[\w]*\n?/,"").replace(/```\s*$/,"").replace(/\r\n/g,`
|
|
2
|
-
`).replace(/\r/g,`
|
|
3
|
-
`);let n=d.resolve(process.cwd(),i),y=d.dirname(n);try{await x.recordFileChange(n);let{systemSettings:o}=await C(),g=o?.overwriteProtection!==!1,a="",S=0;if(e.existsSync(n))try{let r=e.readFileSync(n,"utf8").split(/\r?\n/);if(S=r.length,!g)a="";else if(r.length<=50)a=`Old File contents:
|
|
4
|
-
${r.map((c,f)=>`${f+1} | ${c}`).join(`
|
|
5
|
-
`)}
|
|
6
|
-
|
|
7
|
-
`;else{let c=d.parse(n),f=d.join(F,"OverwriteBackups");e.existsSync(f)||e.mkdirSync(f,{recursive:!0});let b=`${c.name}-old-${Date.now()}${c.ext}.bak`,w=d.join(f,b);e.copyFileSync(n,w),a=`Old File contents:
|
|
8
|
-
- Renamed old file as ${w} and written requested content in ${i}. For reversal use Run
|
|
9
|
-
|
|
10
|
-
`}}catch{a=`[Note: Could not read existing file for reversal reference]
|
|
11
|
-
|
|
12
|
-
`}e.existsSync(y)||e.mkdirSync(y,{recursive:!0});let h=(t=>t.replace(/^```[\w]*\n?/,"").replace(/```\s*$/,"").replace(/\r\n/g,`
|
|
13
|
-
`).replace(/\r/g,`
|
|
14
|
-
`))(p),u=h.endsWith(`
|
|
15
|
-
`)?h:h+`
|
|
16
|
-
`,M=u.split(/\r?\n/).length,O=Buffer.byteLength(u,"utf8");e.writeFileSync(n,u,"utf8");let m=e.readFileSync(n,"utf8"),v=Buffer.byteLength(m,"utf8"),s=m.split(/\r?\n/),l=s.length;if(v===0&&O>0)return m=null,`ERROR: CRITICAL FAILURE: Verification failed. File [${i}] is empty on disk!`;let $="";if(l<=690)$=s.join(`
|
|
17
|
-
`);else{let t=s.slice(0,300).join(`
|
|
18
|
-
`),r=s.slice(-300).join(`
|
|
19
|
-
`);$=`${t}
|
|
20
|
-
|
|
21
|
-
... [${l-100} lines truncated] ...
|
|
22
|
-
|
|
23
|
-
${r}`}m=null,await j({added:l,removed:S,file:i});let R=`File [${i}] saved.
|
|
24
|
-
- Stats: [${l} lines, ${(v/1024).toFixed(1)} KB]
|
|
25
|
-
${a}- Content Preview:
|
|
26
|
-
|
|
27
|
-
${$}`;if(o?.compressToolResults&&l>6e3){let t=u.split(/\r?\n/),r=t.slice(0,25).join(`
|
|
28
|
-
`)===s.slice(0,25).join(`
|
|
29
|
-
`),c=t.slice(-25).join(`
|
|
30
|
-
`)===s.slice(-25).join(`
|
|
31
|
-
`);r&&c&&(R=`[[SAME]]
|
|
32
|
-
${R}`)}return R}catch(o){let g=o instanceof Error?o.message:String(o);return`ERROR: Failed to write file [${i}]: ${g}`}};export{N as write_file};
|