fluxflow-cli 4.16.10 → 4.16.11

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.
@@ -1,15 +0,0 @@
1
- import{a as P}from"./chunk-FDNLMLIM.js";import{a as I}from"./chunk-Y5JU726N.js";import c from"fs";import d from"path";var z=s=>{if(!s)return null;let n=s.match(/^\s*---\r?\n([\s\S]*?)\r?\n---(?:\r?\n)?([\s\S]*)$/);if(!n)return null;let e=n[1];if((n[2]||"").trim().length===0)return null;let r="",i=e.match(/^name:\s*(.+)$/m);return i&&(r=i[1].trim().replace(/^["']|["']$/g,"")),r?{name:r}:null},A=s=>{let n=[];if(!s||!c.existsSync(s))return n;let e=(p,r=0)=>{if(!(r>5))try{let i=c.readdirSync(p,{withFileTypes:!0});for(let l of i){let a=d.join(p,l.name),o=l.name.toLowerCase();l.isFile()?o==="skill.md"&&n.push(a):l.isDirectory()&&(r===0?(o==="skills"||o===".skills"||o==="skill"||o===".skill")&&e(a,r+1):e(a,r+1))}}catch{}};return e(s,0),n},X=s=>s.replace(/^(\s*---\r?\n)([\s\S]*?)(\r?\n---)/,(n,e,p,r)=>{let i=p.split(`
2
- `),l=[],a=!1;for(let o of i){if(/^\s*description\s*:/i.test(o)){a=!0;continue}if(a){if(/^\s+/.test(o))continue;a=!1}l.push(o)}return`${e}${l.join(`
3
- `)}${r}`}),Y=(s,n)=>{let e=[d.join(s,"references"),d.join(s,"reference"),s],p=n.toLowerCase().endsWith(".md")?n.toLowerCase():`${n.toLowerCase()}.md`,r=n.toLowerCase();for(let i of e)if(c.existsSync(i)&&c.statSync(i).isDirectory())try{let l=c.readdirSync(i);for(let a of l){let o=a.toLowerCase();if(o===p||o===r){let R=d.join(i,a);if(c.statSync(R).isFile())return R}}}catch{}return null},Q=async(s,n={})=>{let{path:e,StartLine:p,EndLine:r,start_line:i,end_line:l,startLine:a,endLine:o}=I(s),R=parseInt(p||i||a),v=parseInt(r||l||o),O=!isNaN(R),D=!isNaN(v),x=R||1,b=v||(R?R+800:800);if(!e)return'ERROR: Missing "path" argument for ReadFile.';if(e.trim().toLowerCase().startsWith("#skill")){let f=e.trim().replace(/\\/g,"/").replace(/^#skills?\/?/i,"").split("/").filter(Boolean),S=f[0]?.toLowerCase();if(S!=="global"&&S!=="project")return`ERROR: Invalid skill scope '${S||""}'. Expected 'global' or 'project'.`;let g=f[1];if(!g)return`ERROR: Missing skill name in path [${e}].`;let h=f[2]?.toLowerCase()==="references"||f[2]?.toLowerCase()==="reference",F=h?f.slice(3).join("/"):null,$=S==="global"?P:process.cwd(),k=A($),L=null;for(let t of k)try{let m=c.readFileSync(t,"utf8"),w=z(m),y=d.basename(d.dirname(t)).toLowerCase();if(w?.name&&w.name.toLowerCase()===g.toLowerCase()||y===g.toLowerCase()||t.toLowerCase()===d.join($,"skill.md").toLowerCase()&&g.toLowerCase()==="skill"){L=t;break}}catch{}if(!L)return`No '${g}' exist in given scope.`;let j=d.dirname(L),E=L,C=!0;if(h){if(!F)return`ERROR: Missing reference file name in path [${e}].`;let t=Y(j,F);if(!t)return`No such reference exist for skill '${g}'`;E=t,C=!1}try{let t=c.readFileSync(E,"utf8");t.startsWith("\uFEFF")&&(t=t.slice(1)),t=t.replace(/\r\n/g,`
4
- `).replace(/\r/g,`
5
- `),C&&(t=X(t));let m=t.split(`
6
- `),w=m.length,y=O?Math.max(0,x-1):0,T=D?Math.min(w,b):w,U=m.slice(y,T),N=e.replace(/\\/g,"/").toLowerCase(),W=`${N.includes("#skill/global/fluxflow")||N.includes("#skills/global/fluxflow")?"DOCs":"Skill"}: [${e.replace(/\\/g,"/")}]`,_=U.map(B=>B.trimEnd()).join(`
7
- `);return`${W}
8
-
9
- ${_}`}catch(t){let m=t instanceof Error?t.message:String(t);return`ERROR: Failed to read skill file [${e}]: ${m}`}}try{let u=d.resolve(process.cwd(),e);if(!c.existsSync(u))return`ERROR: File [${e}] does not exist.`;if(c.statSync(u).isDirectory())return`ERROR: Path [${e}] is a directory. Use list_files instead.`;let f=d.extname(e).toLowerCase();if([".mp4",".mkv",".avi",".mov",".webm",".flv",".wmv",".mpeg",".mpg"].includes(f))return`ERROR: Unable to read. Type ${f.slice(1).toUpperCase()} not supported`;let g={".pdf":"application/pdf",".jpg":"image/jpeg",".jpeg":"image/jpeg",".png":"image/png",".webp":"image/webp",".docx":"application/vnd.openxmlformats-officedocument.wordprocessingml.document",".doc":"application/msword"};if(g[f]){if(!(n.isMultiModal!==!1))return`ERROR: Multimodality is not supported for the current model. Unable to load [${e}].`;let w=c.readFileSync(u).toString("base64"),y=g[f];return{text:`[BINARY FILE]: ${e} (${y}) - Loaded as multimodal part.`,binaryPart:{inlineData:{data:w,mimeType:y}}}}let h=c.readFileSync(u,"utf8");h.startsWith("\uFEFF")&&(h=h.slice(1)),h=h.replace(/\r\n/g,`
10
- `).replace(/\r/g,`
11
- `);let F=h.split(`
12
- `),$=F.length;!O&&!D&&$>800&&(x=1,b=50);let k=Math.max(0,x-1),L=Math.min($,b),j=F.slice(k,L),E=`File: [${e}] (Showing lines ${k+1}-${L} of ${$}).`,C=j.map((t,m)=>`${String(k+m+1).padStart(4)}: ${t.trimEnd()}`).join(`
13
- `);return`${E}
14
-
15
- ${C}`}catch(u){let M=u instanceof Error?u.message:String(u);return`ERROR: Failed to read file [${e}]: ${M}`}};export{Q as a};
@@ -1,6 +0,0 @@
1
- import{a as k,c as d}from"./chunk-56EJGQU3.js";import{a as b}from"./chunk-Y5JU726N.js";var I=async(w,s={})=>{let{runSubagent:U}=await import("./ai-BU4EDZKV.js"),l=b(w),c=l.task||l.instruction||l.prompt,C=l.model||null,E=l.title||null,m=l.tools||null;if(!c)return'ERROR: Missing "task" argument for invoke.';let f=null;if(m)try{let t=m.trim();t.startsWith("[")&&t.endsWith("]")&&(t=t.substring(1,t.length-1)),f=t.split(",").map(n=>n.trim().replace(/^["']|["']$/g,"")).filter(Boolean)}catch{}let i=`subagent-${Date.now()}-${Math.floor(Math.random()*1e3)}`,h=null,S=null,$=new Promise((t,n)=>{h=t,S=n}),e={id:i,title:E||c.substring(0,30),task:c,status:"running",startedAt:Date.now(),lastChunkTime:Date.now(),wps:0,questions:[],pendingSteerMessages:[],steer:t=>{t&&e.pendingSteerMessages.push(t)},completionPromise:$,_resolveCompletion:h,_rejectCompletion:S,progress:[]},r={chunks:[],totalWords:0};k.push(e),s.onSubagentUpdate&&s.onSubagentUpdate();let a=[],M={...s,taskId:i,onAskMain:async t=>{let n=`q-${Date.now()}-${Math.floor(Math.random()*1e3)}`,o=null,p=new Promise(g=>{o=g}),u={id:n,question:t,answered:!1,answer:null,askedAt:Date.now(),_resolve:o};return e.questions.push(u),e.status="waiting",s.onSubagentUpdate&&s.onSubagentUpdate(),d(`[SYSTEM] Background subagent "${e.title}" is WAITING FOR YOUR INPUT: "${t}"
2
- Respond using tool: [tool:functions.Answer(id="${i}", answer="...")]
3
- [/SYSTEM]`),await p},onVisualFeedback:t=>{e.lastChunkTime=Date.now();let n=t.replace(/\x1b\[[0-9;]*m/g,""),o=n.match(/[✔✘✗✖🔍📖→➕↻•]\s*([A-Za-z0-9\s-]+)/);o?e.currentTool=o[1].trim():e.currentTool=n,s.onSubagentUpdate&&s.onSubagentUpdate()},onTokenChunk:(t,n)=>{let o=Date.now();if(e.lastChunkTime=o,e.currentTool="Thinking",typeof n=="number"&&n>0){r.totalWords+=n,r.chunks.push({time:o,words:n});let p=o-400;if(r.chunks=r.chunks.filter(u=>u.time>=p),r.chunks.length>0){let u=r.chunks.reduce((_,A)=>_+A.words,0),T=r.chunks[0].time,g=Math.max(.4,(o-T)/1e3);e.wps=Math.round(u/g)}}s.onSubagentUpdate&&s.onSubagentUpdate()}};return U(c,M,C,f,50,t=>{if(e.status==="cancelled")return;if(t.startsWith("[Subagent Turn")&&a.length>0&&(e.progress.push([...a]),a=[]),t.includes("[Executing Tool]")){let o=t.match(/\[Executing Tool\]\s*([a-zA-Z0-9_]+)/);o&&(!e.currentTool||e.currentTool==="Thinking")&&(e.currentTool=o[1])}let n=t;if(n.startsWith("[Tool Result]")){let o=n.split(`
4
- `);o.length>5&&(n=o.slice(0,4).join(`
5
- `)+`
6
- ... [Content/Diff Truncated from Logs] ...`)}a.push(n),s.onSubagentUpdate&&s.onSubagentUpdate()},!0).then(t=>{if(e.status==="cancelled"){e._resolveCompletion&&e._resolveCompletion(t);return}a.length>0&&(e.progress.push([...a]),a=[]),e.status="completed",e.finalAnswer=t,s.onSubagentUpdate&&s.onSubagentUpdate(),d(`[SYSTEM] Background subagent "${e.title}" (id: ${i}) has FINISHED. Call GetProgress(id="${i}") to see the final result. [/SYSTEM]`),e._resolveCompletion&&e._resolveCompletion(t)}).catch(async t=>{let{isTerminationSignaled:n}=await import("./ai-BU4EDZKV.js");if(t.message==="Subagent task was cancelled."||e.status==="cancelled"||n()){e.status="cancelled",a.push("[SUBAGENT CANCELLED] Task was cancelled."),e.progress.push([...a]),s.onSubagentUpdate&&s.onSubagentUpdate(),e._resolveCompletion&&e._resolveCompletion(null);return}a.push(`[SUBAGENT FAILURE] Error: ${t.message}`),e.progress.push([...a]),e.status="failed",e.error=t.message,s.onSubagentUpdate&&s.onSubagentUpdate(),d(`[SYSTEM] Background subagent "${e.title}" (id: ${i}) FAILED with error: ${t.message}. [/SYSTEM]`),e._rejectCompletion&&e._rejectCompletion(t)}),`SUCCESS: Background subagent started. Task ID: ${i}`};export{I as invoke};
@@ -1,3 +0,0 @@
1
- import{a as o}from"./chunk-Y5JU726N.js";var k=async(b,t={})=>{let{runSubagent:u}=await import("./ai-MZSCGMKK.js"),s=o(b),a=s.task||s.instruction||s.prompt,m=s.model||null,l=s.tools||null;if(!a)return'ERROR: Missing "task" argument for invokeSync.';let r=null;if(l)try{let e=l.trim();e.startsWith("[")&&e.endsWith("]")&&(e=e.substring(1,e.length-1)),r=e.split(",").map(i=>i.trim().replace(/^["']|["']$/g,"")).filter(Boolean)}catch{}let n=s.title||a.substring(0,30);try{t.onVisualFeedback&&t.onVisualFeedback(`\x1B[95mSubAgent\x1B[0m: \x1B[32mGeneralist\x1B[0m \u2192 ${n}`);let e=await u(a,t,m,r,50);return t.onVisualFeedback&&t.onVisualFeedback(`\x1B[95mSubAgent\x1B[0m: \x1B[32mGeneralist\x1B[0m \u2192 ${n} [COMPLETED]
2
- `),e}catch(e){let{isTerminationSignaled:i}=await import("./ai-MZSCGMKK.js"),c=e.message==="Subagent task was cancelled by user."||i();if(t.onVisualFeedback){let d=c?"[CANCELLED]":"[FAILED]";t.onVisualFeedback(`\x1B[95mSubAgent\x1B[0m: \x1B[32mGeneralist\x1B[0m \u2192 ${n} ${d}
3
- `)}return`ERROR: Subagent execution failed: ${e.message}`}};export{k as invokeSync};
@@ -1 +0,0 @@
1
- import{a}from"./chunk-ZYJYKSIA.js";import"./chunk-FDNLMLIM.js";import"./chunk-Y5JU726N.js";export{a as view_file};