@hiperplano/aluy-cli 1.0.0-rc.59 → 1.0.0-rc.60
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/dist-bundle/bin/aluy.js +2 -2
- package/dist-bundle/index.js +2 -2
- package/package.json +1 -1
package/dist-bundle/bin/aluy.js
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
#!/usr/bin/env node
|
|
2
|
-
var VU=Object.defineProperty;var p=(t,e,o)=>()=>{if(o)throw o[0];try{return t&&(e=t(t=0)),e}catch(n){throw o=[n],n}};var gt=(t,e)=>{for(var o in e)VU(t,o,{get:e[o],enumerable:!0})};import{homedir as XU}from"node:os";import{join as JU}from"node:path";function Cl(t=XU()){return JU(t,".aluy")}var Vu=p(()=>{"use strict"});var Rl,JA=p(()=>{"use strict";Rl="1.0.0-rc.
|
|
2
|
+
var VU=Object.defineProperty;var p=(t,e,o)=>()=>{if(o)throw o[0];try{return t&&(e=t(t=0)),e}catch(n){throw o=[n],n}};var gt=(t,e)=>{for(var o in e)VU(t,o,{get:e[o],enumerable:!0})};import{homedir as XU}from"node:os";import{join as JU}from"node:path";function Cl(t=XU()){return JU(t,".aluy")}var Vu=p(()=>{"use strict"});var Rl,JA=p(()=>{"use strict";Rl="1.0.0-rc.60"});function yr(t,e){return t.decide(e)}var Us=p(()=>{"use strict"});var $n,br,vr=p(()=>{"use strict";$n="remember",br="recall"});var hg,QU,Gi,gg=p(()=>{"use strict";hg=class{id;horizon;label;parentId;children;dependencies;pinned;closed;createdAt;lastAccessedAt;accessCount;context;constructor(e,o,n,r,s){this.id=e,this.horizon=o,this.label=n,this.parentId=r,this.children=new Set,this.dependencies=new Set,this.pinned=!1,this.closed=!1,this.createdAt=s,this.lastAccessedAt=s,this.accessCount=0,this.context=[]}touch(e){this.lastAccessedAt=e,this.accessCount+=1}snapshot(){return{id:this.id,horizon:this.horizon,label:this.label,parentId:this.parentId,children:[...this.children],dependencies:[...this.dependencies],pinned:this.pinned,closed:this.closed,createdAt:this.createdAt,lastAccessedAt:this.lastAccessedAt,accessCount:this.accessCount,contextSize:this.context.length}}},QU=200,Gi=class{nodes=new Map;maxBoxes;now;constructor(e){this.maxBoxes=e?.maxBoxes??QU,this.now=e?.clock??Date.now}static boxId(e,o){return`${e.toLowerCase().replace(/[^a-z0-9]+/g,"-").replace(/^-|-$/g,"").slice(0,60)}-${o.toString(36)}`}openBox(e,o,n,r){let s=this.nodes.get(e);if(s)return s.touch(this.now()),{box:s.snapshot(),created:!1};if(this.nodes.size>=this.maxBoxes&&(this.evictOne(),this.nodes.size>=this.maxBoxes))return null;let i=this.now(),a=new hg(e,o,n,r??null,i);if(r){let l=this.nodes.get(r);l&&l.children.add(e)}return this.nodes.set(e,a),{box:a.snapshot(),created:!0}}closeBox(e){let o=this.nodes.get(e);return o?(o.closed=!0,o.touch(this.now()),o.snapshot()):null}isClosed(e){let o=this.nodes.get(e);return o?o.closed:!1}reopenBox(e){let o=this.nodes.get(e);return o?(o.closed=!1,o.touch(this.now()),o.snapshot()):null}setHorizon(e,o){let n=this.nodes.get(e);return n?(n.horizon=o,n.touch(this.now()),n.snapshot()):null}setParent(e,o){let n=this.nodes.get(e);return n?n.parentId===o?n.snapshot():o!==null&&this.wouldCreateCycle(e,o)?null:(n.parentId&&this.nodes.get(n.parentId)?.children.delete(e),n.parentId=o,o&&this.nodes.get(o)?.children.add(e),n.touch(this.now()),n.snapshot()):null}wouldCreateCycle(e,o){let n=new Set,r=o;for(;r!==null;){if(r===e||n.has(r))return!0;n.add(r),r=this.nodes.get(r)?.parentId??null}return!1}getBox(e){let o=this.nodes.get(e);return o?(o.touch(this.now()),o.snapshot()):null}listBoxes(e="lastAccessedAt"){let o=[...this.nodes.values()].map(n=>n.snapshot());switch(e){case"createdAt":return o.sort((n,r)=>n.createdAt-r.createdAt);case"accessCount":return o.sort((n,r)=>r.accessCount-n.accessCount);default:return o.sort((n,r)=>r.lastAccessedAt-n.lastAccessedAt)}}get size(){return this.nodes.size}addContext(e,o){let n=this.nodes.get(e);return n?(n.context.push({ts:this.now(),text:o}),n.touch(this.now()),n.snapshot()):null}getContext(e){let o=this.nodes.get(e);return o?(o.touch(this.now()),[...o.context]):[]}getContextChain(e){let o=[],n=new Set,r=e;for(;r&&!n.has(r);){n.add(r);let s=this.nodes.get(r);if(!s)break;s.touch(this.now()),o.push({boxId:s.id,entries:[...s.context]}),r=s.parentId}return o}addDependency(e,o){let n=this.nodes.get(e);return!n||!this.nodes.has(o)||n.id===o?!1:(n.dependencies.add(o),n.touch(this.now()),!0)}getDependencies(e){let o=this.nodes.get(e);return o?[...o.dependencies]:[]}pinBox(e){let o=this.nodes.get(e);return o?(o.pinned=!0,o.touch(this.now()),o.snapshot()):null}unpinBox(e){let o=this.nodes.get(e);return o?(o.pinned=!1,o.touch(this.now()),o.snapshot()):null}evictOne(){let e=[];for(let n of this.nodes.values())n.horizon==="longo"||n.pinned||e.push(n);if(e.length===0)return null;e.sort((n,r)=>{let s=n.horizon==="curto"?0:1,i=r.horizon==="curto"?0:1;if(s!==i)return s-i;let a=n.closed?0:1,l=r.closed?0:1;return a!==l?a-l:n.lastAccessedAt!==r.lastAccessedAt?n.lastAccessedAt-r.lastAccessedAt:n.accessCount-r.accessCount});let o=e[0];return this.removeNode(o)}forceEvict(e){let o=this.nodes.get(e);return!o||o.horizon==="longo"||o.pinned?null:this.removeNode(o)}removeBox(e){let o=this.nodes.get(e);return o?this.removeNode(o):null}removeNode(e){if(e.parentId){let o=this.nodes.get(e.parentId);o&&o.children.delete(e.id)}return this.nodes.delete(e.id),e.snapshot()}}});function Xu(t){let e=[];for(let o of t){e.push({step:o,depth:0});for(let n of o.substeps??[])e.push({step:n,depth:1})}return e}function eE(t,e){let o,n="pending",r;if(typeof t=="string")o=t;else if(t!==null&&typeof t=="object"){let i=t,a=i.title??i.step??i.text??i.name??i.content;if(typeof a=="string"&&(o=a),typeof i.status=="string"&&ZU.has(i.status)&&(n=i.status),e){let l=i.substeps??i.subtasks??i.subpassos??i.children;if(Array.isArray(l)&&l.length>0){let c=[];for(let d of l){let m=eE(d,!1);if(typeof m=="string")return m;c.push(m)}r=c}}}if(o===void 0||o.trim()==="")return tj;let s=o.trim().slice(0,ej);return r?{title:s,status:n,substeps:r}:{title:s,status:n}}function oj(t){let e=t.steps??t.plan??t.todos??t.items;if(!Array.isArray(e))return{error:'update_plan: passe "steps" como uma LISTA de passos (string ou {title,status}).'};if(e.length===0)return{error:"update_plan: a lista de passos est\xE1 vazia."};let o=[];for(let i of e){let a=eE(i,!0);if(typeof a=="string")return{error:a};o.push(a)}let n=new Set,r=i=>{if(!n.has(i))return n.add(i),i;for(let a=2;;a++){let l=`${i} #${a}`;if(!n.has(l))return n.add(l),l}};for(let i=0;i<o.length;i++){let a=o[i],l=r(a.title),c=a.substeps?.map(d=>({...d,title:r(d.title)}));o[i]=c!==void 0?{...a,title:l,substeps:c}:{...a,title:l}}let s=Xu(o).length;return s>QA?{error:`update_plan: no m\xE1ximo ${QA} passos (recebidos ${s}).`}:{steps:o}}function nj(t){let e=Xu(t),o=e.filter(r=>r.step.status==="completed").length,n=e.map(r=>`${" ".repeat(r.depth)}${tE[r.step.status]} ${r.step.title}`).join(`
|
|
3
3
|
`);return`plano (${o}/${e.length}):
|
|
4
4
|
${n}`}function sj(t,e){return e<0?"m\xE9dio":t===e?"curto":t>e?"longo":"m\xE9dio"}function ij(t,e){let o=new Map;for(let i of e.listBoxes())o.set(i.label,i.id);let n=t.findIndex(i=>i.status==="in_progress"||(i.substeps??[]).some(a=>a.status==="in_progress")),r=(i,a,l)=>{let c=i.status==="in_progress"?"curto":l,d=o.get(i.title),m=d??Gi.boxId(i.title,0);return d?(i.status!=="completed"&&e.isClosed(d)&&e.reopenBox(d),e.setHorizon(d,c),e.setParent(d,a)):e.openBox(m,c,i.title,a),i.status==="completed"&&!e.isClosed(m)&&e.closeBox(m),o.set(i.title,m),m};t.forEach((i,a)=>{let l=sj(a,n),c=r(i,null,l);for(let d of i.substeps??[])r(d,c,l)});let s=new Set;for(let i of t){s.add(i.title);for(let a of i.substeps??[])s.add(a.title)}for(let i of e.listBoxes())s.has(i.label)||e.removeBox(i.id)}function aj(t,e){if(!e)return nj(t);let o=new Map;for(let c of e.listBoxes())o.set(c.label,c);let n=new Map;for(let c of e.listBoxes())n.set(c.id,c);let r=new Map,s=(c,d=new Set)=>{let m=r.get(c);if(m!==void 0)return m;let u=n.get(c);if(!u||!u.parentId||d.has(c))return r.set(c,0),0;let h=s(u.parentId,new Set(d).add(c))+1;return r.set(c,h),h},i=Xu(t),l=[`plano (${i.filter(c=>c.step.status==="completed").length}/${i.length}):`];for(let{step:c,depth:d}of i){let m=o.get(c.title),u=m?rj[m.horizon]:"",h=m?s(m.id):d,g=" ".repeat(h),b=tE[c.status];l.push(`${g}${u} ${b} ${c.title}`)}return l.join(`
|
|
5
5
|
`)}var Ol,ZU,QA,ej,tj,tE,rj,ZA,lj,oE,Ju=p(()=>{"use strict";gg();Ol="update_plan";ZU=new Set(["pending","in_progress","completed"]),QA=30,ej=120,tj="update_plan: cada passo precisa de um t\xEDtulo (texto) n\xE3o-vazio.";tE={pending:"\u2610",in_progress:"\u25B6",completed:"\u2611"};rj={longo:"[\u{1F4D0}]",m\u00E9dio:"[\u{1F4CB}]",curto:"[\u{1F4CC}]"};ZA=Object.freeze({type:"string",enum:["pending","in_progress","completed"],description:"pending (a fazer) \xB7 in_progress (em curso) \xB7 completed (feito)."}),lj=Object.freeze({type:"object",properties:{steps:{type:"array",description:"A lista COMPLETA de passos do plano (re-emita TODOS a cada atualiza\xE7\xE3o \u2014 substitui o anterior).",items:{type:"object",properties:{title:{type:"string",description:"O passo, curto e no imperativo."},status:ZA,substeps:{type:"array",description:"OPCIONAL: sub-passos que detalham este passo (1 n\xEDvel). Aparecem indentados sob o passo e seguem o foco dele. Use quando um passo tem a\xE7\xF5es menores distintas.",items:{type:"object",properties:{title:{type:"string",description:"O sub-passo, curto e no imperativo."},status:ZA},required:["title"],additionalProperties:!1}}},required:["title"],additionalProperties:!1}}},required:["steps"],additionalProperties:!1}),oE={name:Ol,effect:"read",description:"Declara/atualiza um PLANO vis\xEDvel (checklist de passos). Use ao iniciar uma tarefa com V\xC1RIOS passos e a cada progresso: re-emita a lista TODA marcando o status de cada passo (pending/in_progress/completed). Mantenha 1 passo in_progress por vez. N\xE3o tem efeito no sistema \u2014 \xE9 s\xF3 o seu plano, para voc\xEA e para o usu\xE1rio acompanharem.",parameters:lj,async run(t,e){let o=oj(t);return"error"in o?{ok:!1,observation:o.error}:(e.graph&&ij(o.steps,e.graph),e.plan&&e.plan.set(Xu(o.steps).map(r=>({title:r.step.title,status:r.step.status}))),{ok:!0,observation:aj(o.steps,e.graph)})}}});function nE(t){let e=t.question??t.prompt??t.text??t.message;if(typeof e!="string"||e.trim()==="")return{error:'perguntar: passe "question" (a pergunta em texto). Para escolha, passe tamb\xE9m "options".'};let o=e.trim().slice(0,2e3),n=t.header??t.title,r=typeof n=="string"&&n.trim()!==""?n.trim().slice(0,200):void 0,s=t.options??t.choices,i=Array.isArray(s)?dj(s):void 0;if(typeof i=="string")return{error:i};let a,l=t.kind??t.type;if(typeof l=="string"&&cj.has(l))a=l;else{if(typeof l=="string"&&l.trim()!=="")return{error:`perguntar: "kind" inv\xE1lido "${l}". Use "single", "multi" ou "text".`};a=i!==void 0&&i.length>0?"single":"text"}if((a==="single"||a==="multi")&&(i===void 0||i.length===0))return{error:`perguntar: kind "${a}" requer "options" (uma lista de ao menos 1 op\xE7\xE3o).`};let c=t.allowOther!==!1;return{spec:{kind:a,question:o,...r!==void 0?{header:r}:{},...a!=="text"&&i!==void 0?{options:i}:{},...a!=="text"?{allowOther:c}:{}}}}function dj(t){if(t.length===0)return'perguntar: a lista de "options" est\xE1 vazia.';if(t.length>12)return`perguntar: no m\xE1ximo 12 op\xE7\xF5es (recebidas ${t.length}).`;let e=[];for(let o of t){let n,r;if(typeof o=="string")n=o;else if(o!==null&&typeof o=="object"){let s=o,i=s.label??s.text??s.value??s.name??s.title;typeof i=="string"&&(n=i),typeof s.description=="string"&&s.description.trim()!==""&&(r=s.description.trim().slice(0,300))}if(n===void 0||n.trim()==="")return'perguntar: cada op\xE7\xE3o precisa de um "label" (texto) n\xE3o-vazio.';e.push({label:n.trim().slice(0,200),...r!==void 0?{description:r}:{}})}return e}function uj(t){switch(t.kind){case"choice":return t.label;case"choices":return t.labels.length===0?"(nenhuma)":t.labels.join(", ");case"text":{let e=t.text.split(`
|
|
@@ -153,7 +153,7 @@ ${t.trim()}`}}function nO(t,e,o=Wc){let{older:n,recent:r}=vf(t,o);if(n.length===
|
|
|
153
153
|
`);let i=po(process.execPath,[n,"-p",o,"--yolo","--no-self-check"],{stdio:"inherit",timeout:9e5,env:{...process.env,ALUY_OVERWRITE_RENDER:"0",ALUY_SYNC_OUTPUT:"0",ALUY_NO_WEAK_YOLO_WARN:"1",ALUY_PRINT_VERBOSE:"1"}});if(t==="mem0")try{let l=ye(en(),_r),c=ye(l,wn);Xe(l)&&Yf(Xf(),c)}catch{}t==="ollama"&&(await xz(),Sz()),process.stderr.write(`
|
|
154
154
|
verificando "${t}"\u2026 (alguns segundos; a pr\xF3xima etapa vem em seguida)
|
|
155
155
|
`);let a=await R0(t,process.platform,!0);for(let l=0;l<bz&&!a;l++)await kz(vz),a=await R0(t,process.platform,!0);return{target:t,hashOk:a,installed:a,message:a?`complemento "${t}" instalado e verificado.`:`o complemento "${t}" ainda n\xE3o respondeu como esperado. O Aluy CLI funciona sem ele; voc\xEA pode tentar de novo depois com \`aluy bootstrap\`.`}}function kz(t){return new Promise(e=>setTimeout(e,t))}async function xz(){for(let t of[Sn,Jf()])try{await(await fetch(`http://${Qo}:${Gn}/api/pull`,{method:"POST",headers:{"content-type":"application/json"},body:JSON.stringify({name:t,stream:!1})})).text()}catch{}}function Sz(){if(process.platform!=="win32")try{let t=po("sh",["-lc","command -v ollama"],{encoding:"utf8",timeout:1e4});if(t.status===0&&(t.stdout??"").trim()!=="")return;let e=Vf(),n=["/usr/local/bin/ollama","/usr/bin/ollama","/opt/homebrew/bin/ollama",ye(e,".ollama","bin","ollama"),ye(en(),ss,"bin","ollama")].find(i=>Xe(i));if(n===void 0)return;let r=ye(e,".local","bin");_k(r,{recursive:!0});let s=ye(r,"ollama");try{if(E0(s)===E0(n))return;ez(s)}catch{}try{ZG(n,s)}catch{}}catch{}}function wz(){try{return po("python3",["-m","venv","--help"],{timeout:1e4}).status===0}catch{return!1}}function Az(){try{return po("python3",["-m","pip","--version"],{timeout:1e4}).status===0}catch{return!1}}function Ez(t){let e=[],o=[];if(t.has("ollama")&&(M0()||(e.push("zstd (extrair o Ollama)"),o.push("zstd")),L0()||(e.push("tar (extrair o Ollama)"),o.push("tar"))),t.has("mem0")||t.has("headroom")){let r=Rk();r.ok?(wz()||(e.push("m\xF3dulo venv do Python (mem0/headroom criam um virtualenv)"),o.push("python3-venv")),Az()||(e.push("pip do Python (mem0/headroom instalam pacotes)"),o.push("python3-pip"))):(e.push(`python3 >= ${Kc} para mem0/headroom (encontrado: ${r.version||"nenhum"})`),o.push("python3","python3-venv","python3-pip"))}if(e.length===0)return[];let n=[...new Set(o)];return["Faltam pr\xE9-requisitos para o modo turbo (o que conseguir, instala; o resto fica de fora):",...e.map(r=>` \u2022 ${r}`),`Instale e rode \`aluy bootstrap\` de novo: sudo apt install -y ${n.join(" ")}`,""]}async function I0(t,e,o){let n=t??"turbo",r=Cr(e??{}),s=o?.useAgent!==!1,i=new Tk({...o?.platform?{platform:o.platform}:{},...s?{agentInstaller:yz}:{}});if(!s)for(let a of Ez(r))process.stderr.write(a+`
|
|
156
|
-
`);return i.provisionAll(n,r)}var O0,_a,rz,wn,_0,Tk,C0,hz,bz,vz,Ok=p(()=>{"use strict";N();O0=".aluy",_a=448,rz=384;wn="aluy-mem0-server.py";_0="application/vnd.ollama.image.model";Tk=class{platform;agentInstaller;constructor(e={}){this.platform=e.platform??process.platform,this.agentInstaller=e.agentInstaller}hasPinnedArtifact(){return this.platform==="linux"}async isProvisioned(e){switch(e){case"ollama":{let o=ye(en(),ss,"bin","ollama");return Xe(o)}case"mem0":{let o=ye(en(),_r,"bin","python3");return Xe(o)&&ad(o)}case"headroom":{let o=ye(en(),is,"bin","headroom");return Xe(o)}default:return!1}}async provision(e,o){let n=oz().uid;if(Gv(n))return{target:e,hashOk:!1,installed:!1,message:"RECUSA ROOT (uid=0): provisionamento de sidecars \xE9 user-space. Execute como usu\xE1rio normal."};if(this.agentInstaller)return this.agentInstaller(e,o);if(!this.hasPinnedArtifact())return{target:e,hashOk:!1,installed:!1,message:`SO '${this.platform}' sem artefato pinado p/ provisionamento direto. Rode \`aluy bootstrap\` (o aluy instala via o pr\xF3prio agente, \u26A0 --yolo) ou instale manualmente.`};switch(e){case"ollama":return cz();case"mem0":return fz();case"headroom":return pz();default:return{target:e,hashOk:!1,installed:!1,message:`Alvo desconhecido: ${String(e)}`}}}async provisionAll(e,o){if(!Vc(e))return{profile:e,targets:[],anySuccess:!1,allFailed:!1};let n=[],r=[...o];for(let a=0;a<r.length;a++){let l=r[a],c={index:a+1,total:r.length,plan:r};try{n.push(await this.provision(l,c))}catch(d){let m=d instanceof Error?d.message:String(d);n.push({target:l,hashOk:!1,installed:!1,message:`falha inesperada ao provisionar \u2014 seguindo p/ os pr\xF3ximos (${m}).`})}}let s=n.some(a=>a.installed),i=n.length>0&&n.every(a=>!a.installed);return{profile:e,targets:n,anySuccess:s,allFailed:i}}},C0="na faixa 3.10\u20133.12 (N\xC3O use 3.13+/3.14 \u2014 as depend\xEAncias nativas n\xE3o t\xEAm wheels e o pip falha ao compilar; no Windows prefira `py -3.12` ou `py -3.11`). Se N\xC3O houver um Python 3.10\u20133.12 instalado, INSTALE primeiro (no Windows: `winget install -e --id Python.Python.3.12 --accept-source-agreements --accept-package-agreements`; no Linux/macOS use o gerenciador do sistema). Se j\xE1 existir um venv nesse caminho numa vers\xE3o incompat\xEDvel (ex.: 3.14), APAGUE e recrie com a vers\xE3o certa",hz="IMPORTANTE \u2014 o usu\xE1rio quer ACOMPANHAR: antes de cada passo, diga em 1 linha o que vai fazer; rode os comandos de instala\xE7\xE3o de forma VIS\xCDVEL (N\xC3O silencie pip/apt/curl com -q; mostre a sa\xEDda/progresso). Sem modo silencioso. ";bz=24,vz=5e3});var Kn,ld=p(()=>{"use strict";Kn="1.0.0-rc.59"});var B0={};gt(B0,{HELP_TEXT:()=>D0,parseArgs:()=>Mk,suggestFlag:()=>Rz,versionText:()=>$0});function ct(t,e,o={}){let n=`--${e}=`;for(let r=0;r<t.length;r++){let s=t[r];if(s===`--${e}`){let i=t[r+1];return i===void 0||(o.allowDashValue?i.startsWith("--"):i.startsWith("-"))?void 0:i}if(s!==void 0&&s.startsWith(n))return s.slice(n.length)}}function Tz(t,e){let o=`-${e}=`;for(let n=0;n<t.length;n++){let r=t[n];if(r===`-${e}`){let s=t[n+1];return s!==void 0&&!s.startsWith("-")?s:void 0}if(r!==void 0&&r.startsWith(o))return r.slice(o.length)}}function $0(){return`aluy ${Kn} (@hiperplano/aluy-cli-core ${Rl})`}function Cz(t,e){let o=t.length,n=e.length,r=Array.from({length:n+1},(s,i)=>i);for(let s=1;s<=o;s++){let i=[s];for(let a=1;a<=n;a++){let l=t[s-1]===e[a-1]?0:1;i[a]=Math.min(r[a]+1,i[a-1]+1,r[a-1]+l)}r=i}return r[n]}function Rz(t){let e,o=3;for(let n of F0){let r=Cz(t,n);r<o&&(o=r,e=n)}return e}function Oz(t,e){let o=[];for(let n=0;n<t.length;n++){let r=t[n];if(r==="--")break;if(!r.startsWith("--")||r.length===2||e.has(n))continue;let s=r.slice(2).split("=",1)[0];s===""||F0.has(s)||o.push(`--${s}`)}return o}function Mk(t){let e=t[0];if(e==="login"&&!t.includes("-h")&&!t.includes("--help")){let W=t.slice(1),fe=ct(W,"token"),Kt=ct(W,"org"),Et=W.includes("--device"),xt=ct(W,"provider"),In=W.includes("--oauth");return{kind:"login",forceDeviceFlow:Et,...fe!==void 0?{token:fe}:{},...Kt!==void 0?{org:Kt}:{},...xt!==void 0?{provider:xt}:{},...In?{oauth:!0}:{}}}if(e==="logout"&&!t.includes("-h")&&!t.includes("--help"))return{kind:"logout"};if(e==="whoami"&&!t.includes("-h")&&!t.includes("--help"))return{kind:"whoami"};if(e==="doctor"&&!t.includes("-h")&&!t.includes("--help")){let W=t.includes("--deep")||t.includes("--test"),fe=t.includes("--json");return{kind:"doctor",deep:W,json:fe}}if(e==="config"&&!t.includes("-h")&&!t.includes("--help"))return{kind:"config",json:t.includes("--json")};if(e==="agents"&&!t.includes("-h")&&!t.includes("--help"))return{kind:"agents"};if(e==="bootstrap"&&!t.includes("-h")&&!t.includes("--help"))return{kind:"bootstrap",agent:!t.includes("--no-agent")};if(e==="uninstall"&&!t.includes("-h")&&!t.includes("--help"))return{kind:"uninstall",agent:t.includes("--agent")};if(e==="onboard"&&!t.includes("-h")&&!t.includes("--help"))return{kind:"onboard"};if(e==="skills"&&!t.includes("-h")&&!t.includes("--help"))return{kind:"skills"};if(e==="workflows"&&!t.includes("-h")&&!t.includes("--help"))return{kind:"workflows"};if((e==="models"||e==="providers")&&!t.includes("-h")&&!t.includes("--help")){let W=t.includes("--json"),fe=t.findIndex(Et=>Et==="--backend"||Et.startsWith("--backend=")),Kt="both";if(fe!==-1){let xt=(t[fe].includes("=")?t[fe].slice(10):t[fe+1]??"").trim().toLowerCase();xt==="local"?Kt="local":xt==="broker"&&(Kt="broker")}return{kind:"models",scope:Kt,json:W,which:e==="providers"?"providers":"models"}}if(e==="telegram"&&!t.includes("-h")&&!t.includes("--help")){let W=t[1];if(W===void 0||!["login","logout","allow","deny","status"].includes(W))return{kind:"usage-error",message:"uso: aluy telegram <login|logout|allow|deny|status>",exitCode:2};let Kt=t.slice(2);if(W==="login"){let Et=ct(Kt,"token");return{kind:"telegram",sub:"login",...Et!==void 0?{token:Et}:{}}}if(W==="allow"||W==="deny"){let Et=Kt.find(In=>!In.startsWith("-")),xt=Et!==void 0&&/^-?\d+$/.test(Et)?Number(Et):void 0;return xt===void 0?{kind:"usage-error",message:`uso: aluy telegram ${W} <chat-id> (um inteiro)`,exitCode:2}:{kind:"telegram",sub:W,chatId:xt}}return{kind:"telegram",sub:W}}if(e==="mcp"&&t[1]==="search"&&!t.includes("-h")&&!t.includes("--help"))return{kind:"mcp-search",query:t.slice(2).filter(fe=>!fe.startsWith("-")).join(" ").trim()};if(e==="mcp")return{kind:"mcp",argv:t.slice(1)};if(e==="cron")return{kind:"cron",argv:t.slice(1)};if(t.includes("-v")||t.includes("--version"))return{kind:"version",text:$0()};if(t.includes("-h")||t.includes("--help"))return{kind:"help",text:D0};let o=t.includes("--plan"),n=t.includes("--unsafe"),r=t.includes("--yolo")||n,s=o?"plan":r?"unsafe":"normal",i=t.includes("--dense"),a=t.includes("--ascii"),l=t.includes("--split")||t.includes("--view")?!0:void 0,c=t.includes("--fullscreen")||t.includes("--cockpit")?!0:void 0,d=t.includes("--no-budget")?!1:t.includes("--budget")?!0:void 0,m=ct(t,"tier"),u=ct(t,"lang"),h=ct(t,"max-tokens"),g=ct(t,"max-iterations"),b=ct(t,"max-output-tokens"),y=!(t.includes("--no-subagents")||t.includes("--no-subagent")),w=t.includes("--no-self-check")?"0":t.includes("--self-check")?"1":void 0,A=t.includes("--no-autocompact")?"off":ct(t,"autocompact-at"),T=t.includes("--quiet")?!0:void 0,M=t.includes("--cycle")?!0:void 0,F=ct(t,"cycles"),H=ct(t,"cycle-for"),K=ct(t,"backend"),G=ct(t,"local-provider"),$=ct(t,"local-model"),Q=ct(t,"local-auth"),te=ct(t,"local-base-url"),U=ct(t,"model"),L=ct(t,"provider");if((t.includes("--provider")||t.some(W=>W.startsWith("--provider=")))&&(U===void 0||U.trim()===""))return{kind:"usage-error",message:"aluy: --provider exige --model (ex.: --provider <provider> --model <slug>)",exitCode:2};if((U===void 0||U.trim()==="")&&m!==void 0&&m.trim().toLowerCase()==="custom")return{kind:"usage-error",message:"aluy: --tier custom exige --model <slug> (ex.: --model deepseek-v4-pro). A via Custom precisa do slug do modelo; sem ele use um tier can\xF4nico (aluy-flux, aluy-granito, \u2026).",exitCode:2};let Se=ct(t,"effort"),V=t.includes("--effort")||t.some(W=>W.startsWith("--effort=")),me;if(Se!==void 0){if(Se.trim()==="")return{kind:"usage-error",message:"aluy: --effort requer um valor (ex.: --effort low)",exitCode:2};if(Se.length>32)return{kind:"usage-error",message:"aluy: --effort aceita no m\xE1ximo 32 caracteres",exitCode:2};me=Se}else if(V)return{kind:"usage-error",message:"aluy: --effort requer um valor (ex.: --effort low)",exitCode:2};let Z=t.includes("-p")||t.includes("--print")||t.includes("--exec")||t.some(W=>W.startsWith("-p=")||W.startsWith("--print=")||W.startsWith("--exec=")),ie=Z?ct(t,"print",{allowDashValue:!0})??ct(t,"exec",{allowDashValue:!0})??Tz(t,"p")??void 0:void 0,I=Z?ct(t,"output-format"):void 0,ge=t.includes("--new"),ee=t.includes("--continue"),ce=t.indexOf("--resume"),Ae=t.find(W=>W.startsWith("--resume=")),so=ce>=0||Ae!==void 0,Pe;if(Ae!==void 0)Pe=Ae.slice(9);else if(ce>=0){let W=t[ce+1];W!==void 0&&!W.startsWith("-")&&(Pe=W)}let Ke=m!==void 0?t.indexOf("--tier")+1:-1,pt=u!==void 0&&!t.some(W=>W.startsWith("--lang="))?t.indexOf("--lang")+1:-1,kt=Pe!==void 0&&Ae===void 0?ce+1:-1,io=h!==void 0&&!t.some(W=>W.startsWith("--max-tokens="))?t.indexOf("--max-tokens")+1:-1,P=g!==void 0&&!t.some(W=>W.startsWith("--max-iterations="))?t.indexOf("--max-iterations")+1:-1,xe=F!==void 0&&!t.some(W=>W.startsWith("--cycles="))?t.indexOf("--cycles")+1:-1,Ne=H!==void 0&&!t.some(W=>W.startsWith("--cycle-for="))?t.indexOf("--cycle-for")+1:-1,X=b!==void 0&&!t.some(W=>W.startsWith("--max-output-tokens="))?t.indexOf("--max-output-tokens")+1:-1,v=A!==void 0&&!t.includes("--no-autocompact")&&!t.some(W=>W.startsWith("--autocompact-at="))?t.indexOf("--autocompact-at")+1:-1,Po=K!==void 0&&!t.some(W=>W.startsWith("--backend="))?t.indexOf("--backend")+1:-1,Be=(W,fe)=>fe!==void 0&&!t.some(Kt=>Kt.startsWith(`--${W}=`))?t.indexOf(`--${W}`)+1:-1,Ps=Be("local-provider",G),Bi=Be("local-model",$),Nt=Be("local-auth",Q),mr=Be("local-base-url",te),Is=U!==void 0&&!t.some(W=>W.startsWith("--model="))?t.indexOf("--model")+1:-1,zo=L!==void 0&&!t.some(W=>W.startsWith("--provider="))?t.indexOf("--provider")+1:-1,pn=me!==void 0&&!t.some(W=>W.startsWith("--effort="))?t.indexOf("--effort")+1:-1,wo=I!==void 0&&!t.some(W=>W.startsWith("--output-format="))?t.indexOf("--output-format")+1:-1,lo=ie!==void 0&&!t.some(W=>W.startsWith("-p=")||W.startsWith("--print=")||W.startsWith("--exec="))?Math.max(t.indexOf("-p"),t.indexOf("--print"),t.indexOf("--exec"))+1:-1,Ko=t.find((W,fe)=>!W.startsWith("-")&&fe!==Ke&&fe!==pt&&fe!==Po&&fe!==Ps&&fe!==Bi&&fe!==Nt&&fe!==mr&&fe!==Is&&fe!==zo&&fe!==pn&&fe!==wo&&fe!==lo&&fe!==kt&&fe!==io&&fe!==P&&fe!==X&&fe!==v&&fe!==xe&&fe!==Ne),Ns=ee?{kind:"continue"}:so?{kind:"resume",...Pe!==void 0?{id:Pe}:{}}:void 0,zr=new Set([Ke,pt,Po,Ps,Bi,Nt,mr,Is,zo,pn,wo,lo,kt,io,P,X,v,xe,Ne].filter(W=>W>=0));for(let W of _z){let fe=t.indexOf(W);fe>=0&&!t[fe].includes("=")&&zr.add(fe+1)}let fr=Oz(t,zr);return{kind:"launch",mode:s,unsafe:s==="unsafe",unsafeAliasUsed:n,...fr.length>0?{unknownFlags:fr}:{},dense:i,fresh:ge,subAgents:y,safeGlyphs:a,print:Z,...l!==void 0?{split:l}:{},...c!==void 0?{fullscreen:c}:{},...d!==void 0?{budget:d}:{},...Ko!==void 0?{goal:Ko}:{},...m!==void 0?{tier:m}:{},...K!==void 0?{backend:K}:{},...G!==void 0?{localProvider:G}:{},...$!==void 0?{localModel:$}:{},...Q!==void 0?{localAuth:Q}:{},...te!==void 0?{localBaseUrl:te}:{},...U!==void 0?{model:U}:{},...L!==void 0?{provider:L}:{},...me!==void 0?{effort:me}:{},...ie!==void 0?{printArg:ie}:{},...I!==void 0?{outputFormat:I}:{},...u!==void 0?{lang:u}:{},...Ns!==void 0?{resume:Ns}:{},...h!==void 0?{maxTokens:h}:{},...g!==void 0?{maxIterations:g}:{},...b!==void 0?{maxOutputTokens:b}:{},...w!==void 0?{selfCheck:w}:{},...A!==void 0?{autoCompactAt:A}:{},...T!==void 0?{quiet:T}:{},...M!==void 0?{cycle:M}:{},...F!==void 0?{cycles:F}:{},...H!==void 0?{cycleFor:H}:{}}}var D0,F0,_z,Lk=p(()=>{"use strict";N();ld();D0=`aluy \u2014 agente de terminal que roda na sua m\xE1quina, com o seu provider de LLM
|
|
156
|
+
`);return i.provisionAll(n,r)}var O0,_a,rz,wn,_0,Tk,C0,hz,bz,vz,Ok=p(()=>{"use strict";N();O0=".aluy",_a=448,rz=384;wn="aluy-mem0-server.py";_0="application/vnd.ollama.image.model";Tk=class{platform;agentInstaller;constructor(e={}){this.platform=e.platform??process.platform,this.agentInstaller=e.agentInstaller}hasPinnedArtifact(){return this.platform==="linux"}async isProvisioned(e){switch(e){case"ollama":{let o=ye(en(),ss,"bin","ollama");return Xe(o)}case"mem0":{let o=ye(en(),_r,"bin","python3");return Xe(o)&&ad(o)}case"headroom":{let o=ye(en(),is,"bin","headroom");return Xe(o)}default:return!1}}async provision(e,o){let n=oz().uid;if(Gv(n))return{target:e,hashOk:!1,installed:!1,message:"RECUSA ROOT (uid=0): provisionamento de sidecars \xE9 user-space. Execute como usu\xE1rio normal."};if(this.agentInstaller)return this.agentInstaller(e,o);if(!this.hasPinnedArtifact())return{target:e,hashOk:!1,installed:!1,message:`SO '${this.platform}' sem artefato pinado p/ provisionamento direto. Rode \`aluy bootstrap\` (o aluy instala via o pr\xF3prio agente, \u26A0 --yolo) ou instale manualmente.`};switch(e){case"ollama":return cz();case"mem0":return fz();case"headroom":return pz();default:return{target:e,hashOk:!1,installed:!1,message:`Alvo desconhecido: ${String(e)}`}}}async provisionAll(e,o){if(!Vc(e))return{profile:e,targets:[],anySuccess:!1,allFailed:!1};let n=[],r=[...o];for(let a=0;a<r.length;a++){let l=r[a],c={index:a+1,total:r.length,plan:r};try{n.push(await this.provision(l,c))}catch(d){let m=d instanceof Error?d.message:String(d);n.push({target:l,hashOk:!1,installed:!1,message:`falha inesperada ao provisionar \u2014 seguindo p/ os pr\xF3ximos (${m}).`})}}let s=n.some(a=>a.installed),i=n.length>0&&n.every(a=>!a.installed);return{profile:e,targets:n,anySuccess:s,allFailed:i}}},C0="na faixa 3.10\u20133.12 (N\xC3O use 3.13+/3.14 \u2014 as depend\xEAncias nativas n\xE3o t\xEAm wheels e o pip falha ao compilar; no Windows prefira `py -3.12` ou `py -3.11`). Se N\xC3O houver um Python 3.10\u20133.12 instalado, INSTALE primeiro (no Windows: `winget install -e --id Python.Python.3.12 --accept-source-agreements --accept-package-agreements`; no Linux/macOS use o gerenciador do sistema). Se j\xE1 existir um venv nesse caminho numa vers\xE3o incompat\xEDvel (ex.: 3.14), APAGUE e recrie com a vers\xE3o certa",hz="IMPORTANTE \u2014 o usu\xE1rio quer ACOMPANHAR: antes de cada passo, diga em 1 linha o que vai fazer; rode os comandos de instala\xE7\xE3o de forma VIS\xCDVEL (N\xC3O silencie pip/apt/curl com -q; mostre a sa\xEDda/progresso). Sem modo silencioso. ";bz=24,vz=5e3});var Kn,ld=p(()=>{"use strict";Kn="1.0.0-rc.60"});var B0={};gt(B0,{HELP_TEXT:()=>D0,parseArgs:()=>Mk,suggestFlag:()=>Rz,versionText:()=>$0});function ct(t,e,o={}){let n=`--${e}=`;for(let r=0;r<t.length;r++){let s=t[r];if(s===`--${e}`){let i=t[r+1];return i===void 0||(o.allowDashValue?i.startsWith("--"):i.startsWith("-"))?void 0:i}if(s!==void 0&&s.startsWith(n))return s.slice(n.length)}}function Tz(t,e){let o=`-${e}=`;for(let n=0;n<t.length;n++){let r=t[n];if(r===`-${e}`){let s=t[n+1];return s!==void 0&&!s.startsWith("-")?s:void 0}if(r!==void 0&&r.startsWith(o))return r.slice(o.length)}}function $0(){return`aluy ${Kn} (@hiperplano/aluy-cli-core ${Rl})`}function Cz(t,e){let o=t.length,n=e.length,r=Array.from({length:n+1},(s,i)=>i);for(let s=1;s<=o;s++){let i=[s];for(let a=1;a<=n;a++){let l=t[s-1]===e[a-1]?0:1;i[a]=Math.min(r[a]+1,i[a-1]+1,r[a-1]+l)}r=i}return r[n]}function Rz(t){let e,o=3;for(let n of F0){let r=Cz(t,n);r<o&&(o=r,e=n)}return e}function Oz(t,e){let o=[];for(let n=0;n<t.length;n++){let r=t[n];if(r==="--")break;if(!r.startsWith("--")||r.length===2||e.has(n))continue;let s=r.slice(2).split("=",1)[0];s===""||F0.has(s)||o.push(`--${s}`)}return o}function Mk(t){let e=t[0];if(e==="login"&&!t.includes("-h")&&!t.includes("--help")){let W=t.slice(1),fe=ct(W,"token"),Kt=ct(W,"org"),Et=W.includes("--device"),xt=ct(W,"provider"),In=W.includes("--oauth");return{kind:"login",forceDeviceFlow:Et,...fe!==void 0?{token:fe}:{},...Kt!==void 0?{org:Kt}:{},...xt!==void 0?{provider:xt}:{},...In?{oauth:!0}:{}}}if(e==="logout"&&!t.includes("-h")&&!t.includes("--help"))return{kind:"logout"};if(e==="whoami"&&!t.includes("-h")&&!t.includes("--help"))return{kind:"whoami"};if(e==="doctor"&&!t.includes("-h")&&!t.includes("--help")){let W=t.includes("--deep")||t.includes("--test"),fe=t.includes("--json");return{kind:"doctor",deep:W,json:fe}}if(e==="config"&&!t.includes("-h")&&!t.includes("--help"))return{kind:"config",json:t.includes("--json")};if(e==="agents"&&!t.includes("-h")&&!t.includes("--help"))return{kind:"agents"};if(e==="bootstrap"&&!t.includes("-h")&&!t.includes("--help"))return{kind:"bootstrap",agent:!t.includes("--no-agent")};if(e==="uninstall"&&!t.includes("-h")&&!t.includes("--help"))return{kind:"uninstall",agent:t.includes("--agent")};if(e==="onboard"&&!t.includes("-h")&&!t.includes("--help"))return{kind:"onboard"};if(e==="skills"&&!t.includes("-h")&&!t.includes("--help"))return{kind:"skills"};if(e==="workflows"&&!t.includes("-h")&&!t.includes("--help"))return{kind:"workflows"};if((e==="models"||e==="providers")&&!t.includes("-h")&&!t.includes("--help")){let W=t.includes("--json"),fe=t.findIndex(Et=>Et==="--backend"||Et.startsWith("--backend=")),Kt="both";if(fe!==-1){let xt=(t[fe].includes("=")?t[fe].slice(10):t[fe+1]??"").trim().toLowerCase();xt==="local"?Kt="local":xt==="broker"&&(Kt="broker")}return{kind:"models",scope:Kt,json:W,which:e==="providers"?"providers":"models"}}if(e==="telegram"&&!t.includes("-h")&&!t.includes("--help")){let W=t[1];if(W===void 0||!["login","logout","allow","deny","status"].includes(W))return{kind:"usage-error",message:"uso: aluy telegram <login|logout|allow|deny|status>",exitCode:2};let Kt=t.slice(2);if(W==="login"){let Et=ct(Kt,"token");return{kind:"telegram",sub:"login",...Et!==void 0?{token:Et}:{}}}if(W==="allow"||W==="deny"){let Et=Kt.find(In=>!In.startsWith("-")),xt=Et!==void 0&&/^-?\d+$/.test(Et)?Number(Et):void 0;return xt===void 0?{kind:"usage-error",message:`uso: aluy telegram ${W} <chat-id> (um inteiro)`,exitCode:2}:{kind:"telegram",sub:W,chatId:xt}}return{kind:"telegram",sub:W}}if(e==="mcp"&&t[1]==="search"&&!t.includes("-h")&&!t.includes("--help"))return{kind:"mcp-search",query:t.slice(2).filter(fe=>!fe.startsWith("-")).join(" ").trim()};if(e==="mcp")return{kind:"mcp",argv:t.slice(1)};if(e==="cron")return{kind:"cron",argv:t.slice(1)};if(t.includes("-v")||t.includes("--version"))return{kind:"version",text:$0()};if(t.includes("-h")||t.includes("--help"))return{kind:"help",text:D0};let o=t.includes("--plan"),n=t.includes("--unsafe"),r=t.includes("--yolo")||n,s=o?"plan":r?"unsafe":"normal",i=t.includes("--dense"),a=t.includes("--ascii"),l=t.includes("--split")||t.includes("--view")?!0:void 0,c=t.includes("--fullscreen")||t.includes("--cockpit")?!0:void 0,d=t.includes("--no-budget")?!1:t.includes("--budget")?!0:void 0,m=ct(t,"tier"),u=ct(t,"lang"),h=ct(t,"max-tokens"),g=ct(t,"max-iterations"),b=ct(t,"max-output-tokens"),y=!(t.includes("--no-subagents")||t.includes("--no-subagent")),w=t.includes("--no-self-check")?"0":t.includes("--self-check")?"1":void 0,A=t.includes("--no-autocompact")?"off":ct(t,"autocompact-at"),T=t.includes("--quiet")?!0:void 0,M=t.includes("--cycle")?!0:void 0,F=ct(t,"cycles"),H=ct(t,"cycle-for"),K=ct(t,"backend"),G=ct(t,"local-provider"),$=ct(t,"local-model"),Q=ct(t,"local-auth"),te=ct(t,"local-base-url"),U=ct(t,"model"),L=ct(t,"provider");if((t.includes("--provider")||t.some(W=>W.startsWith("--provider=")))&&(U===void 0||U.trim()===""))return{kind:"usage-error",message:"aluy: --provider exige --model (ex.: --provider <provider> --model <slug>)",exitCode:2};if((U===void 0||U.trim()==="")&&m!==void 0&&m.trim().toLowerCase()==="custom")return{kind:"usage-error",message:"aluy: --tier custom exige --model <slug> (ex.: --model deepseek-v4-pro). A via Custom precisa do slug do modelo; sem ele use um tier can\xF4nico (aluy-flux, aluy-granito, \u2026).",exitCode:2};let Se=ct(t,"effort"),V=t.includes("--effort")||t.some(W=>W.startsWith("--effort=")),me;if(Se!==void 0){if(Se.trim()==="")return{kind:"usage-error",message:"aluy: --effort requer um valor (ex.: --effort low)",exitCode:2};if(Se.length>32)return{kind:"usage-error",message:"aluy: --effort aceita no m\xE1ximo 32 caracteres",exitCode:2};me=Se}else if(V)return{kind:"usage-error",message:"aluy: --effort requer um valor (ex.: --effort low)",exitCode:2};let Z=t.includes("-p")||t.includes("--print")||t.includes("--exec")||t.some(W=>W.startsWith("-p=")||W.startsWith("--print=")||W.startsWith("--exec=")),ie=Z?ct(t,"print",{allowDashValue:!0})??ct(t,"exec",{allowDashValue:!0})??Tz(t,"p")??void 0:void 0,I=Z?ct(t,"output-format"):void 0,ge=t.includes("--new"),ee=t.includes("--continue"),ce=t.indexOf("--resume"),Ae=t.find(W=>W.startsWith("--resume=")),so=ce>=0||Ae!==void 0,Pe;if(Ae!==void 0)Pe=Ae.slice(9);else if(ce>=0){let W=t[ce+1];W!==void 0&&!W.startsWith("-")&&(Pe=W)}let Ke=m!==void 0?t.indexOf("--tier")+1:-1,pt=u!==void 0&&!t.some(W=>W.startsWith("--lang="))?t.indexOf("--lang")+1:-1,kt=Pe!==void 0&&Ae===void 0?ce+1:-1,io=h!==void 0&&!t.some(W=>W.startsWith("--max-tokens="))?t.indexOf("--max-tokens")+1:-1,P=g!==void 0&&!t.some(W=>W.startsWith("--max-iterations="))?t.indexOf("--max-iterations")+1:-1,xe=F!==void 0&&!t.some(W=>W.startsWith("--cycles="))?t.indexOf("--cycles")+1:-1,Ne=H!==void 0&&!t.some(W=>W.startsWith("--cycle-for="))?t.indexOf("--cycle-for")+1:-1,X=b!==void 0&&!t.some(W=>W.startsWith("--max-output-tokens="))?t.indexOf("--max-output-tokens")+1:-1,v=A!==void 0&&!t.includes("--no-autocompact")&&!t.some(W=>W.startsWith("--autocompact-at="))?t.indexOf("--autocompact-at")+1:-1,Po=K!==void 0&&!t.some(W=>W.startsWith("--backend="))?t.indexOf("--backend")+1:-1,Be=(W,fe)=>fe!==void 0&&!t.some(Kt=>Kt.startsWith(`--${W}=`))?t.indexOf(`--${W}`)+1:-1,Ps=Be("local-provider",G),Bi=Be("local-model",$),Nt=Be("local-auth",Q),mr=Be("local-base-url",te),Is=U!==void 0&&!t.some(W=>W.startsWith("--model="))?t.indexOf("--model")+1:-1,zo=L!==void 0&&!t.some(W=>W.startsWith("--provider="))?t.indexOf("--provider")+1:-1,pn=me!==void 0&&!t.some(W=>W.startsWith("--effort="))?t.indexOf("--effort")+1:-1,wo=I!==void 0&&!t.some(W=>W.startsWith("--output-format="))?t.indexOf("--output-format")+1:-1,lo=ie!==void 0&&!t.some(W=>W.startsWith("-p=")||W.startsWith("--print=")||W.startsWith("--exec="))?Math.max(t.indexOf("-p"),t.indexOf("--print"),t.indexOf("--exec"))+1:-1,Ko=t.find((W,fe)=>!W.startsWith("-")&&fe!==Ke&&fe!==pt&&fe!==Po&&fe!==Ps&&fe!==Bi&&fe!==Nt&&fe!==mr&&fe!==Is&&fe!==zo&&fe!==pn&&fe!==wo&&fe!==lo&&fe!==kt&&fe!==io&&fe!==P&&fe!==X&&fe!==v&&fe!==xe&&fe!==Ne),Ns=ee?{kind:"continue"}:so?{kind:"resume",...Pe!==void 0?{id:Pe}:{}}:void 0,zr=new Set([Ke,pt,Po,Ps,Bi,Nt,mr,Is,zo,pn,wo,lo,kt,io,P,X,v,xe,Ne].filter(W=>W>=0));for(let W of _z){let fe=t.indexOf(W);fe>=0&&!t[fe].includes("=")&&zr.add(fe+1)}let fr=Oz(t,zr);return{kind:"launch",mode:s,unsafe:s==="unsafe",unsafeAliasUsed:n,...fr.length>0?{unknownFlags:fr}:{},dense:i,fresh:ge,subAgents:y,safeGlyphs:a,print:Z,...l!==void 0?{split:l}:{},...c!==void 0?{fullscreen:c}:{},...d!==void 0?{budget:d}:{},...Ko!==void 0?{goal:Ko}:{},...m!==void 0?{tier:m}:{},...K!==void 0?{backend:K}:{},...G!==void 0?{localProvider:G}:{},...$!==void 0?{localModel:$}:{},...Q!==void 0?{localAuth:Q}:{},...te!==void 0?{localBaseUrl:te}:{},...U!==void 0?{model:U}:{},...L!==void 0?{provider:L}:{},...me!==void 0?{effort:me}:{},...ie!==void 0?{printArg:ie}:{},...I!==void 0?{outputFormat:I}:{},...u!==void 0?{lang:u}:{},...Ns!==void 0?{resume:Ns}:{},...h!==void 0?{maxTokens:h}:{},...g!==void 0?{maxIterations:g}:{},...b!==void 0?{maxOutputTokens:b}:{},...w!==void 0?{selfCheck:w}:{},...A!==void 0?{autoCompactAt:A}:{},...T!==void 0?{quiet:T}:{},...M!==void 0?{cycle:M}:{},...F!==void 0?{cycles:F}:{},...H!==void 0?{cycleFor:H}:{}}}var D0,F0,_z,Lk=p(()=>{"use strict";N();ld();D0=`aluy \u2014 agente de terminal que roda na sua m\xE1quina, com o seu provider de LLM
|
|
157
157
|
|
|
158
158
|
Uso:
|
|
159
159
|
aluy ["objetivo"] [--plan | --yolo] [--dense] [--tier <tier>] [--lang <pt-BR|en>]
|
package/dist-bundle/index.js
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
var KI=Object.defineProperty;var S=(t,e,o)=>()=>{if(o)throw o[0];try{return t&&(e=t(t=0)),e}catch(n){throw o=[n],n}};var Kf=(t,e)=>{for(var o in e)KI(t,o,{get:e[o],enumerable:!0})};var ba,Ix=S(()=>{"use strict";ba="1.0.0-rc.
|
|
1
|
+
var KI=Object.defineProperty;var S=(t,e,o)=>()=>{if(o)throw o[0];try{return t&&(e=t(t=0)),e}catch(n){throw o=[n],n}};var Kf=(t,e)=>{for(var o in e)KI(t,o,{get:e[o],enumerable:!0})};var ba,Ix=S(()=>{"use strict";ba="1.0.0-rc.60"});function $n(t,e){return t.decide(e)}var Jr=S(()=>{"use strict"});var sn,Fn,Bn=S(()=>{"use strict";sn="remember",Fn="recall"});var Yf,YI,Zs,Vf=S(()=>{"use strict";Yf=class{id;horizon;label;parentId;children;dependencies;pinned;closed;createdAt;lastAccessedAt;accessCount;context;constructor(e,o,n,r,s){this.id=e,this.horizon=o,this.label=n,this.parentId=r,this.children=new Set,this.dependencies=new Set,this.pinned=!1,this.closed=!1,this.createdAt=s,this.lastAccessedAt=s,this.accessCount=0,this.context=[]}touch(e){this.lastAccessedAt=e,this.accessCount+=1}snapshot(){return{id:this.id,horizon:this.horizon,label:this.label,parentId:this.parentId,children:[...this.children],dependencies:[...this.dependencies],pinned:this.pinned,closed:this.closed,createdAt:this.createdAt,lastAccessedAt:this.lastAccessedAt,accessCount:this.accessCount,contextSize:this.context.length}}},YI=200,Zs=class{nodes=new Map;maxBoxes;now;constructor(e){this.maxBoxes=e?.maxBoxes??YI,this.now=e?.clock??Date.now}static boxId(e,o){return`${e.toLowerCase().replace(/[^a-z0-9]+/g,"-").replace(/^-|-$/g,"").slice(0,60)}-${o.toString(36)}`}openBox(e,o,n,r){let s=this.nodes.get(e);if(s)return s.touch(this.now()),{box:s.snapshot(),created:!1};if(this.nodes.size>=this.maxBoxes&&(this.evictOne(),this.nodes.size>=this.maxBoxes))return null;let i=this.now(),a=new Yf(e,o,n,r??null,i);if(r){let c=this.nodes.get(r);c&&c.children.add(e)}return this.nodes.set(e,a),{box:a.snapshot(),created:!0}}closeBox(e){let o=this.nodes.get(e);return o?(o.closed=!0,o.touch(this.now()),o.snapshot()):null}isClosed(e){let o=this.nodes.get(e);return o?o.closed:!1}reopenBox(e){let o=this.nodes.get(e);return o?(o.closed=!1,o.touch(this.now()),o.snapshot()):null}setHorizon(e,o){let n=this.nodes.get(e);return n?(n.horizon=o,n.touch(this.now()),n.snapshot()):null}setParent(e,o){let n=this.nodes.get(e);return n?n.parentId===o?n.snapshot():o!==null&&this.wouldCreateCycle(e,o)?null:(n.parentId&&this.nodes.get(n.parentId)?.children.delete(e),n.parentId=o,o&&this.nodes.get(o)?.children.add(e),n.touch(this.now()),n.snapshot()):null}wouldCreateCycle(e,o){let n=new Set,r=o;for(;r!==null;){if(r===e||n.has(r))return!0;n.add(r),r=this.nodes.get(r)?.parentId??null}return!1}getBox(e){let o=this.nodes.get(e);return o?(o.touch(this.now()),o.snapshot()):null}listBoxes(e="lastAccessedAt"){let o=[...this.nodes.values()].map(n=>n.snapshot());switch(e){case"createdAt":return o.sort((n,r)=>n.createdAt-r.createdAt);case"accessCount":return o.sort((n,r)=>r.accessCount-n.accessCount);default:return o.sort((n,r)=>r.lastAccessedAt-n.lastAccessedAt)}}get size(){return this.nodes.size}addContext(e,o){let n=this.nodes.get(e);return n?(n.context.push({ts:this.now(),text:o}),n.touch(this.now()),n.snapshot()):null}getContext(e){let o=this.nodes.get(e);return o?(o.touch(this.now()),[...o.context]):[]}getContextChain(e){let o=[],n=new Set,r=e;for(;r&&!n.has(r);){n.add(r);let s=this.nodes.get(r);if(!s)break;s.touch(this.now()),o.push({boxId:s.id,entries:[...s.context]}),r=s.parentId}return o}addDependency(e,o){let n=this.nodes.get(e);return!n||!this.nodes.has(o)||n.id===o?!1:(n.dependencies.add(o),n.touch(this.now()),!0)}getDependencies(e){let o=this.nodes.get(e);return o?[...o.dependencies]:[]}pinBox(e){let o=this.nodes.get(e);return o?(o.pinned=!0,o.touch(this.now()),o.snapshot()):null}unpinBox(e){let o=this.nodes.get(e);return o?(o.pinned=!1,o.touch(this.now()),o.snapshot()):null}evictOne(){let e=[];for(let n of this.nodes.values())n.horizon==="longo"||n.pinned||e.push(n);if(e.length===0)return null;e.sort((n,r)=>{let s=n.horizon==="curto"?0:1,i=r.horizon==="curto"?0:1;if(s!==i)return s-i;let a=n.closed?0:1,c=r.closed?0:1;return a!==c?a-c:n.lastAccessedAt!==r.lastAccessedAt?n.lastAccessedAt-r.lastAccessedAt:n.accessCount-r.accessCount});let o=e[0];return this.removeNode(o)}forceEvict(e){let o=this.nodes.get(e);return!o||o.horizon==="longo"||o.pinned?null:this.removeNode(o)}removeBox(e){let o=this.nodes.get(e);return o?this.removeNode(o):null}removeNode(e){if(e.parentId){let o=this.nodes.get(e.parentId);o&&o.children.delete(e.id)}return this.nodes.delete(e.id),e.snapshot()}}});function ud(t){let e=[];for(let o of t){e.push({step:o,depth:0});for(let n of o.substeps??[])e.push({step:n,depth:1})}return e}function $x(t,e){let o,n="pending",r;if(typeof t=="string")o=t;else if(t!==null&&typeof t=="object"){let i=t,a=i.title??i.step??i.text??i.name??i.content;if(typeof a=="string"&&(o=a),typeof i.status=="string"&&VI.has(i.status)&&(n=i.status),e){let c=i.substeps??i.subtasks??i.subpassos??i.children;if(Array.isArray(c)&&c.length>0){let l=[];for(let d of c){let f=$x(d,!1);if(typeof f=="string")return f;l.push(f)}r=l}}}if(o===void 0||o.trim()==="")return JI;let s=o.trim().slice(0,XI);return r?{title:s,status:n,substeps:r}:{title:s,status:n}}function QI(t){let e=t.steps??t.plan??t.todos??t.items;if(!Array.isArray(e))return{error:'update_plan: passe "steps" como uma LISTA de passos (string ou {title,status}).'};if(e.length===0)return{error:"update_plan: a lista de passos est\xE1 vazia."};let o=[];for(let i of e){let a=$x(i,!0);if(typeof a=="string")return{error:a};o.push(a)}let n=new Set,r=i=>{if(!n.has(i))return n.add(i),i;for(let a=2;;a++){let c=`${i} #${a}`;if(!n.has(c))return n.add(c),c}};for(let i=0;i<o.length;i++){let a=o[i],c=r(a.title),l=a.substeps?.map(d=>({...d,title:r(d.title)}));o[i]=l!==void 0?{...a,title:c,substeps:l}:{...a,title:c}}let s=ud(o).length;return s>Nx?{error:`update_plan: no m\xE1ximo ${Nx} passos (recebidos ${s}).`}:{steps:o}}function ZI(t){let e=ud(t),o=e.filter(r=>r.step.status==="completed").length,n=e.map(r=>`${" ".repeat(r.depth)}${Fx[r.step.status]} ${r.step.title}`).join(`
|
|
2
2
|
`);return`plano (${o}/${e.length}):
|
|
3
3
|
${n}`}function tN(t,e){return e<0?"m\xE9dio":t===e?"curto":t>e?"longo":"m\xE9dio"}function oN(t,e){let o=new Map;for(let i of e.listBoxes())o.set(i.label,i.id);let n=t.findIndex(i=>i.status==="in_progress"||(i.substeps??[]).some(a=>a.status==="in_progress")),r=(i,a,c)=>{let l=i.status==="in_progress"?"curto":c,d=o.get(i.title),f=d??Zs.boxId(i.title,0);return d?(i.status!=="completed"&&e.isClosed(d)&&e.reopenBox(d),e.setHorizon(d,l),e.setParent(d,a)):e.openBox(f,l,i.title,a),i.status==="completed"&&!e.isClosed(f)&&e.closeBox(f),o.set(i.title,f),f};t.forEach((i,a)=>{let c=tN(a,n),l=r(i,null,c);for(let d of i.substeps??[])r(d,l,c)});let s=new Set;for(let i of t){s.add(i.title);for(let a of i.substeps??[])s.add(a.title)}for(let i of e.listBoxes())s.has(i.label)||e.removeBox(i.id)}function nN(t,e){if(!e)return ZI(t);let o=new Map;for(let l of e.listBoxes())o.set(l.label,l);let n=new Map;for(let l of e.listBoxes())n.set(l.id,l);let r=new Map,s=(l,d=new Set)=>{let f=r.get(l);if(f!==void 0)return f;let u=n.get(l);if(!u||!u.parentId||d.has(l))return r.set(l,0),0;let p=s(u.parentId,new Set(d).add(l))+1;return r.set(l,p),p},i=ud(t),c=[`plano (${i.filter(l=>l.step.status==="completed").length}/${i.length}):`];for(let{step:l,depth:d}of i){let f=o.get(l.title),u=f?eN[f.horizon]:"",p=f?s(f.id):d,h=" ".repeat(p),y=Fx[l.status];c.push(`${h}${u} ${y} ${l.title}`)}return c.join(`
|
|
4
4
|
`)}var va,VI,Nx,XI,JI,Fx,eN,Dx,rN,Bx,md=S(()=>{"use strict";Vf();va="update_plan";VI=new Set(["pending","in_progress","completed"]),Nx=30,XI=120,JI="update_plan: cada passo precisa de um t\xEDtulo (texto) n\xE3o-vazio.";Fx={pending:"\u2610",in_progress:"\u25B6",completed:"\u2611"};eN={longo:"[\u{1F4D0}]",m\u00E9dio:"[\u{1F4CB}]",curto:"[\u{1F4CC}]"};Dx=Object.freeze({type:"string",enum:["pending","in_progress","completed"],description:"pending (a fazer) \xB7 in_progress (em curso) \xB7 completed (feito)."}),rN=Object.freeze({type:"object",properties:{steps:{type:"array",description:"A lista COMPLETA de passos do plano (re-emita TODOS a cada atualiza\xE7\xE3o \u2014 substitui o anterior).",items:{type:"object",properties:{title:{type:"string",description:"O passo, curto e no imperativo."},status:Dx,substeps:{type:"array",description:"OPCIONAL: sub-passos que detalham este passo (1 n\xEDvel). Aparecem indentados sob o passo e seguem o foco dele. Use quando um passo tem a\xE7\xF5es menores distintas.",items:{type:"object",properties:{title:{type:"string",description:"O sub-passo, curto e no imperativo."},status:Dx},required:["title"],additionalProperties:!1}}},required:["title"],additionalProperties:!1}}},required:["steps"],additionalProperties:!1}),Bx={name:va,effect:"read",description:"Declara/atualiza um PLANO vis\xEDvel (checklist de passos). Use ao iniciar uma tarefa com V\xC1RIOS passos e a cada progresso: re-emita a lista TODA marcando o status de cada passo (pending/in_progress/completed). Mantenha 1 passo in_progress por vez. N\xE3o tem efeito no sistema \u2014 \xE9 s\xF3 o seu plano, para voc\xEA e para o usu\xE1rio acompanharem.",parameters:rN,async run(t,e){let o=QI(t);return"error"in o?{ok:!1,observation:o.error}:(e.graph&&oN(o.steps,e.graph),e.plan&&e.plan.set(ud(o.steps).map(r=>({title:r.step.title,status:r.step.status}))),{ok:!0,observation:nN(o.steps,e.graph)})}}});function Ux(t){let e=t.question??t.prompt??t.text??t.message;if(typeof e!="string"||e.trim()==="")return{error:'perguntar: passe "question" (a pergunta em texto). Para escolha, passe tamb\xE9m "options".'};let o=e.trim().slice(0,2e3),n=t.header??t.title,r=typeof n=="string"&&n.trim()!==""?n.trim().slice(0,200):void 0,s=t.options??t.choices,i=Array.isArray(s)?iN(s):void 0;if(typeof i=="string")return{error:i};let a,c=t.kind??t.type;if(typeof c=="string"&&sN.has(c))a=c;else{if(typeof c=="string"&&c.trim()!=="")return{error:`perguntar: "kind" inv\xE1lido "${c}". Use "single", "multi" ou "text".`};a=i!==void 0&&i.length>0?"single":"text"}if((a==="single"||a==="multi")&&(i===void 0||i.length===0))return{error:`perguntar: kind "${a}" requer "options" (uma lista de ao menos 1 op\xE7\xE3o).`};let l=t.allowOther!==!1;return{spec:{kind:a,question:o,...r!==void 0?{header:r}:{},...a!=="text"&&i!==void 0?{options:i}:{},...a!=="text"?{allowOther:l}:{}}}}function iN(t){if(t.length===0)return'perguntar: a lista de "options" est\xE1 vazia.';if(t.length>12)return`perguntar: no m\xE1ximo 12 op\xE7\xF5es (recebidas ${t.length}).`;let e=[];for(let o of t){let n,r;if(typeof o=="string")n=o;else if(o!==null&&typeof o=="object"){let s=o,i=s.label??s.text??s.value??s.name??s.title;typeof i=="string"&&(n=i),typeof s.description=="string"&&s.description.trim()!==""&&(r=s.description.trim().slice(0,300))}if(n===void 0||n.trim()==="")return'perguntar: cada op\xE7\xE3o precisa de um "label" (texto) n\xE3o-vazio.';e.push({label:n.trim().slice(0,200),...r!==void 0?{description:r}:{}})}return e}function aN(t){switch(t.kind){case"choice":return t.label;case"choices":return t.labels.length===0?"(nenhuma)":t.labels.join(", ");case"text":{let e=t.text.split(`
|
|
@@ -136,7 +136,7 @@ ${t.trim()}`}}function NT(t,e,o=Rc){let{older:n,recent:r}=Pu(t,o);if(n.length===
|
|
|
136
136
|
\u2026[truncado: ${t.length-Uy} chars omitidos]`}function YB(t){return t.length<=Hy?t:`${t.slice(0,Hy)}\u2026`}function v_(t){let e=b_(t.server,t.descriptor.name),o=YB(t.descriptor.description.trim()),n=`[tool de um SERVER MCP de terceiro "${t.server}" \u2014 efeito n\xE3o-confi\xE1vel, passa pela catraca] ${o||"(sem descri\xE7\xE3o)"}`,r=t.descriptor.inputSchema,s=r!==null&&typeof r=="object"&&!Array.isArray(r)?r:void 0;return{name:e,effect:"mcp",description:n,...s?{parameters:s}:{},async run(i,a,c){try{let l=await t.transport.callTool(t.descriptor.name,i,c?.signal),d=je(l.content);return l.ok?{ok:!0,observation:y_(d),display:`${e}(${VB(i)})`}:{ok:!1,observation:y_(`MCP "${e}" erro: ${d}`)}}catch(l){return{ok:!1,observation:`MCP "${e}" falhou: ${l instanceof Error?l.message:String(l)}`}}}}}function qy(t,e){let o=[],n=new Set,r=new Map,s=new Map,i=new Set;for(let a of t){let c=v_(a);if(n.has(c.name))continue;n.add(c.name);let l=a.server;s.set(l,(s.get(l)??0)+1);let d=r.get(l)??0;if(d>=jy){i.add(l);continue}r.set(l,d+1),o.push(c)}if(e)for(let a of i){let c=s.get(a)??0;e(`server MCP "${a}" exp\xF4s ${c} tools; usando as primeiras ${jy} (teto por server, anti-estouro de contexto). As demais foram ignoradas \u2014 revise o server ou reduza as tools que ele exp\xF5e.`)}return o}function VB(t){if(Object.keys(t).length===0)return"";let o=JSON.stringify(t);return o.length<=200?o:`${o.slice(0,200)}\u2026`}var Uy,jy,Hy,k_=S(()=>{"use strict";hd();Wn();Uy=2e4;jy=128,Hy=1024});function w_(t,e){let o=new URL(S_);return t.trim().length>0&&o.searchParams.set("search",t.trim()),o.searchParams.set("limit",String(JB)),e!==void 0&&e.length>0&&o.searchParams.set("cursor",e),o.toString()}async function Gy(t,e,o){let n=t.trim(),r=[],s;for(let i=0;i<XB;i++){let a=w_(n,s),c;try{c=await e(a,o)}catch(f){return{ok:!1,query:n,reason:Hu(n1(f))}}if(!c.ok)return{ok:!1,query:n,reason:Hu(c.reason)};if(c.status<200||c.status>=300)return{ok:!1,query:n,reason:Hu(`HTTP ${c.status}`)};let l;try{l=JSON.parse(c.body)}catch{return{ok:!1,query:n,reason:Hu("resposta n\xE3o \xE9 JSON v\xE1lido")}}let d=E_(l);for(let f of d.servers)if(A_(f,n)&&r.push(f),r.length>=Wy)break;if(r.length>=Wy||(s=d.nextCursor,s===void 0||s.length===0))break}return{ok:!0,query:n,results:r}}function Hu(t){return`registro MCP indispon\xEDvel (${Ri}): ${t}`}function A_(t,e){if(e.length===0)return!0;let o=e.toLowerCase();return[t.name,t.title??"",t.description,t.run.command??"",t.run.args.join(" ")].join(" ").toLowerCase().includes(o)}function E_(t){if(!Yn(t))return{servers:[]};let e=Array.isArray(t.servers)?t.servers:[],o=[];for(let s of e){let i=QB(s);i!==void 0&&o.push(i)}let n=Yn(t.metadata)?t.metadata:void 0,r=n!==void 0&&typeof n.nextCursor=="string"?n.nextCursor:void 0;return{servers:o,...r!==void 0?{nextCursor:r}:{}}}function QB(t){if(!Yn(t))return;let e=Yn(t.server)?t.server:t,o=typeof e.name=="string"?e.name.trim():"";if(o.length===0)return;let n=typeof e.description=="string"?e.description.trim():"",r=typeof e.title=="string"&&e.title.trim().length>0?e.title.trim():void 0,s=typeof e.version=="string"?e.version.trim():void 0,i=ZB(e);return{name:o,description:n,run:i,...r!==void 0?{title:r}:{},...s!==void 0?{version:s}:{}}}function ZB(t){let e=[],o=Array.isArray(t.remotes)?t.remotes:[];for(let r of o)Yn(r)&&typeof r.url=="string"&&e.push(r.url);let n=Array.isArray(t.packages)?t.packages:[];for(let r of n){if(!Yn(r))continue;let s=e1(r);if(s!==void 0)return{...s,remoteUrls:e}}return{args:[],env:[],remoteUrls:e}}function e1(t){let e=ys(t.registryType)??ys(t.registry_name),o=ys(t.identifier)??ys(t.name);if(o===void 0)return;let n=ys(t.version),r=ys(t.runtimeHint),s=Yn(t.transport)?ys(t.transport.type):void 0,i=o1(t.environmentVariables),a=x_(t.runtimeArguments),c=x_(t.packageArguments),l=n!==void 0?`${o}@${n}`:o;return e==="npm"||r==="npx"?{command:"npx",args:t1(["-y",...a,l,...c]),env:i,...s!==void 0?{transport:s}:{}}:e==="pypi"||r==="uvx"||r==="uv"?{command:"uvx",args:[...a,o,...c],env:i,...s!==void 0?{transport:s}:{}}:e==="oci"||r==="docker"?{command:"docker",args:["run","-i","--rm",...a,l,...c],env:i,...s!==void 0?{transport:s}:{}}:{args:[l],env:i,...s!==void 0?{transport:s}:{}}}function t1(t){let e=[],o=!1;for(let n of t){if(n==="-y"||n==="--yes"){if(o)continue;o=!0}e.push(n)}return e}function x_(t){if(!Array.isArray(t))return[];let e=[];for(let o of t)Yn(o)&&typeof o.value=="string"&&e.push(o.value);return e}function o1(t){if(!Array.isArray(t))return[];let e=[];for(let o of t)Yn(o)&&typeof o.name=="string"&&o.name.length>0&&e.push({name:o.name,required:o.isRequired===!0});return e}function ys(t){return typeof t=="string"&&t.trim().length>0?t.trim():void 0}function Yn(t){return typeof t=="object"&&t!==null&&!Array.isArray(t)}function n1(t){return t instanceof Error?t.message:String(t)}var Ri,S_,XB,JB,Wy,T_=S(()=>{"use strict";Ri="registry.modelcontextprotocol.io",S_=`https://${Ri}/v0/servers`,XB=5,JB=100,Wy=25});function R_(t){let{command:e,args:o}=t.run;if(e===void 0)return;let n=C_(t.name);return["aluy","mcp","add",__(n),"--",e,...o.map(__)].join(" ")}function C_(t){let o=(t.split("/").pop()??t).replace(/[^A-Za-z0-9_-]+/g,"-").replace(/^-+|-+$/g,"");return o.length>0?o:"server"}function __(t){return/^[A-Za-z0-9_./@:+=-]+$/.test(t)?t:`'${t.replace(/'/g,"'\\''")}'`}function zy(t){if(!t.ok)return`\u26A0 ${t.reason}
|
|
137
137
|
Tente de novo em instantes; a busca no registro n\xE3o bloqueia o resto do aluy.`;if(t.results.length===0)return`nenhum server encontrado para "${t.query}" no registro oficial MCP.`;let e=[],o=t.results.length;e.push(`${o} server${o===1?"":"s"} para "${t.query}" (registro oficial MCP):`),e.push("");for(let n of t.results)e.push(r1(n)),e.push("");return e.push('Para instalar, copie a linha "\u2192 aluy mcp add \u2026" do server desejado.'),e.push("A sa\xEDda do registro \xE9 apenas informativa \u2014 nada \xE9 executado pela busca."),e.join(`
|
|
138
138
|
`)}function r1(t){let o=[`\u2022 ${t.version!==void 0?`${t.name} (v${t.version})`:t.name}`],n=t.title!==void 0&&t.title!==t.name?t.title:void 0;n!==void 0&&o.push(` ${n}`),t.description.length>0&&o.push(` ${s1(t.description,200)}`);let r=R_(t);if(r!==void 0){o.push(` \u2192 ${r}`),t.run.transport!==void 0&&t.run.transport!=="stdio"&&o.push(` (transporte "${t.run.transport}" \u2014 v1 do aluy s\xF3 pluga servers stdio LOCAIS)`);let s=t.run.env.filter(i=>i.required).map(i=>i.name);s.length>0&&o.push(` requer env: ${s.join(", ")} (defina por-server no mcp.json)`)}else t.run.remoteUrls.length>0?o.push(` (server REMOTO: ${t.run.remoteUrls.join(", ")} \u2014 fora do v1 de \`aluy mcp add\`)`):o.push(" (sem pacote local conhecido \u2014 nada a instalar pelo aluy)");return o.join(`
|
|
139
|
-
`)}function s1(t,e){return t.length<=e?t:t.slice(0,e-1).trimEnd()+"\u2026"}var O_=S(()=>{"use strict"});var M_=S(()=>{"use strict";ju();u_();m_();f_();p_();g_();k_();hd();T_();O_()});function Ky(t){let e=/^v?(\d+)\.(\d+)\.(\d+)(?:-([0-9A-Za-z.-]+))?/.exec(t.trim());if(!e)return null;let o=e[4]?e[4].split(".").map(n=>/^\d+$/.test(n)?Number(n):n):[];return{major:Number(e[1]),minor:Number(e[2]),patch:Number(e[3]),pre:o}}function L_(t,e){let o=Ky(t),n=Ky(e);if(!o||!n)return null;for(let s of["major","minor","patch"])if(o[s]!==n[s])return o[s]<n[s]?-1:1;if(o.pre.length===0&&n.pre.length===0)return 0;if(o.pre.length===0)return 1;if(n.pre.length===0)return-1;let r=Math.max(o.pre.length,n.pre.length);for(let s=0;s<r;s++){let i=o.pre[s],a=n.pre[s];if(i===void 0)return-1;if(a===void 0)return 1;if(i===a)continue;let c=typeof i=="number",l=typeof a=="number";return c&&l?i<a?-1:1:c?-1:l?1:i<a?-1:1}return 0}function Yy(t,e){return L_(t,e)===1}var P_=S(()=>{"use strict"});var Vy=S(()=>{"use strict"});var I_=S(()=>{"use strict";Vy()});var N_=S(()=>{"use strict"});var D_=S(()=>{"use strict"});function Xy(t){return`connector-${t}-token`}function Jy(t){let e=t.trim(),o=e.indexOf(":");return o<=0?`\u2026(${e.length} chars)`:`${e.slice(0,o)}:\u2026(${e.length-o-1} chars)`}var $_=S(()=>{"use strict"});var q=S(()=>{"use strict";Ix();oS();pS();Pw();e_();c_();M_();_y();vu();P_();Vy();I_();N_();D_();$_()});import{posix as Tj}from"node:path";function _j(t){return Tj.normalize(t)}function eo(t){let e=_j(t);for(let o of Rj)if(o.re.test(e))return o.deny?{kind:"deny",why:o.why}:{kind:"ask",why:o.why};return{kind:"allow"}}function gb(t){return eo(t).kind==="allow"}var Rj,Ar=S(()=>{"use strict";Rj=[{re:/(?:^|\/|~\/)\.ssh(?:\/|$)/,why:"chaves SSH (~/.ssh)",deny:!0},{re:/(?:^|\/|~\/)\.aws(?:\/|$)/,why:"credenciais AWS (~/.aws)",deny:!0},{re:/(?:^|\/|~\/)\.gnupg(?:\/|$)/,why:"chaves GPG (~/.gnupg)",deny:!0},{re:/(?:~\/|\$\{?HOME\}?\/|\/(?:home|Users)\/[^/]+\/)\.aluy\/rooms(?:\/|$)/,why:"arquivos de sala do Aluy (~/.aluy/rooms)",deny:!0},{re:/~\/\.aluy(?:\/|$)/,why:"estado/credencial do Aluy (~/.aluy)",deny:!0},{re:/(?:^|\/)\.aluy(?:\/(?!agents\/|workflows\/|commands\/)|$)/,why:"estado/credencial do Aluy (.aluy/)",deny:!0},{re:/(?:^|\/|~\/)\.config\/gh\/hosts\.yml$/,why:"token do gh CLI",deny:!0},{re:/(?:^|\/|~\/)\.docker\/config\.json$/,why:"credenciais Docker",deny:!0},{re:/(?:^|\/|~\/)\.kube\/config$/,why:"kubeconfig",deny:!0},{re:/(?:^|\/)id_(?:rsa|ed25519|ecdsa|dsa)\b/,why:"chave privada",deny:!0},{re:/\.pem$|\.p12$|\.pfx$|\.key$/i,why:"material de chave privada",deny:!0},{re:/(?:^|[/\w.-])\.env(?:\.(?!example$|sample$|template$|dist$)[\w.-]+)?$/,why:"arquivo .env (segredos)",deny:!1},{re:/(?:^|\/)[^/]*(?:secret|credential|token|apikey|api_key|password|passwd)[^/]*$/i,why:"arquivo com nome sens\xEDvel (token/secret)",deny:!1}]});var Bb={};Kf(Bb,{UserWorkflowsLoader:()=>Rr,WORKFLOWS_DIRNAME:()=>Fb});import{homedir as fq}from"node:os";import{join as $b}from"node:path";import{readdirSync as pq,readFileSync as hq,mkdirSync as gq,statSync as yq}from"node:fs";var bq,Fb,vq,kq,Rr,lm=S(()=>{"use strict";q();bq=448,Fb="workflows",vq=64*1024,kq=256,Rr=class{dir;constructor(e={}){let o=e.baseDir??$b(fq(),".aluy");this.dir=$b(o,Fb)}get workflowsDir(){return this.dir}ensureDir(){try{gq(this.dir,{mode:bq,recursive:!0})}catch{}}load(){let e;try{e=pq(this.dir,{withFileTypes:!0})}catch{return{workflows:[],errors:[]}}let o=e.filter(i=>i.isFile()&&i.name.toLowerCase().endsWith(".md")).map(i=>i.name).sort((i,a)=>i.localeCompare(a)),n=new Set,r=[],s=[];for(let i of o){if(r.length>=kq)break;let a=this.readOne(i);if(a!==null){if(yc(a)){s.push(a);continue}n.has(a.name)||(n.add(a.name),r.push(a))}}return{workflows:r,errors:s}}readOne(e){let o=$b(this.dir,e);try{let n=yq(o);if(!n.isFile()||n.size>vq)return null;let r=hq(o,"utf8");return bc(e,r,"global")}catch{return null}}}});var jb={};Kf(jb,{PROJECT_WORKFLOWS_DIRNAMES:()=>Ub,ProjectWorkflowsLoader:()=>Cr});import{join as xq}from"node:path";import{readdirSync as Sq,readFileSync as wq,statSync as Aq}from"node:fs";var Ub,Eq,Tq,Cr,dm=S(()=>{"use strict";q();Ar();Ub=[".claude/workflows",".aluy/workflows"],Eq=64*1024,Tq=256,Cr=class{workspace;constructor(e){this.workspace=e.workspace}load(){let e=new Set,o=[],n=[];for(let r of Ub){let s;try{s=this.workspace.resolveInside(r)}catch{continue}let i;try{i=Sq(s,{withFileTypes:!0})}catch{continue}let a=i.filter(c=>c.isFile()&&c.name.toLowerCase().endsWith(".md")).map(c=>c.name).sort((c,l)=>c.localeCompare(l));for(let c of a){if(o.length>=Tq)break;let l=this.readOne(r,s,c);if(l!==null){if(yc(l)){n.push(l);continue}e.has(l.name)||(e.add(l.name),o.push(l))}}}return{workflows:o,errors:n}}readOne(e,o,n){let r=`${e}/${n}`;if(eo(r).kind!=="allow")return null;let s=xq(o,n);try{this.workspace.resolveInside(r);let i=Aq(s);if(!i.isFile()||i.size>Eq)return null;let a=wq(s,"utf8");return bc(n,a,"project")}catch{return null}}}});var Dn="1.0.0-rc.
|
|
139
|
+
`)}function s1(t,e){return t.length<=e?t:t.slice(0,e-1).trimEnd()+"\u2026"}var O_=S(()=>{"use strict"});var M_=S(()=>{"use strict";ju();u_();m_();f_();p_();g_();k_();hd();T_();O_()});function Ky(t){let e=/^v?(\d+)\.(\d+)\.(\d+)(?:-([0-9A-Za-z.-]+))?/.exec(t.trim());if(!e)return null;let o=e[4]?e[4].split(".").map(n=>/^\d+$/.test(n)?Number(n):n):[];return{major:Number(e[1]),minor:Number(e[2]),patch:Number(e[3]),pre:o}}function L_(t,e){let o=Ky(t),n=Ky(e);if(!o||!n)return null;for(let s of["major","minor","patch"])if(o[s]!==n[s])return o[s]<n[s]?-1:1;if(o.pre.length===0&&n.pre.length===0)return 0;if(o.pre.length===0)return 1;if(n.pre.length===0)return-1;let r=Math.max(o.pre.length,n.pre.length);for(let s=0;s<r;s++){let i=o.pre[s],a=n.pre[s];if(i===void 0)return-1;if(a===void 0)return 1;if(i===a)continue;let c=typeof i=="number",l=typeof a=="number";return c&&l?i<a?-1:1:c?-1:l?1:i<a?-1:1}return 0}function Yy(t,e){return L_(t,e)===1}var P_=S(()=>{"use strict"});var Vy=S(()=>{"use strict"});var I_=S(()=>{"use strict";Vy()});var N_=S(()=>{"use strict"});var D_=S(()=>{"use strict"});function Xy(t){return`connector-${t}-token`}function Jy(t){let e=t.trim(),o=e.indexOf(":");return o<=0?`\u2026(${e.length} chars)`:`${e.slice(0,o)}:\u2026(${e.length-o-1} chars)`}var $_=S(()=>{"use strict"});var q=S(()=>{"use strict";Ix();oS();pS();Pw();e_();c_();M_();_y();vu();P_();Vy();I_();N_();D_();$_()});import{posix as Tj}from"node:path";function _j(t){return Tj.normalize(t)}function eo(t){let e=_j(t);for(let o of Rj)if(o.re.test(e))return o.deny?{kind:"deny",why:o.why}:{kind:"ask",why:o.why};return{kind:"allow"}}function gb(t){return eo(t).kind==="allow"}var Rj,Ar=S(()=>{"use strict";Rj=[{re:/(?:^|\/|~\/)\.ssh(?:\/|$)/,why:"chaves SSH (~/.ssh)",deny:!0},{re:/(?:^|\/|~\/)\.aws(?:\/|$)/,why:"credenciais AWS (~/.aws)",deny:!0},{re:/(?:^|\/|~\/)\.gnupg(?:\/|$)/,why:"chaves GPG (~/.gnupg)",deny:!0},{re:/(?:~\/|\$\{?HOME\}?\/|\/(?:home|Users)\/[^/]+\/)\.aluy\/rooms(?:\/|$)/,why:"arquivos de sala do Aluy (~/.aluy/rooms)",deny:!0},{re:/~\/\.aluy(?:\/|$)/,why:"estado/credencial do Aluy (~/.aluy)",deny:!0},{re:/(?:^|\/)\.aluy(?:\/(?!agents\/|workflows\/|commands\/)|$)/,why:"estado/credencial do Aluy (.aluy/)",deny:!0},{re:/(?:^|\/|~\/)\.config\/gh\/hosts\.yml$/,why:"token do gh CLI",deny:!0},{re:/(?:^|\/|~\/)\.docker\/config\.json$/,why:"credenciais Docker",deny:!0},{re:/(?:^|\/|~\/)\.kube\/config$/,why:"kubeconfig",deny:!0},{re:/(?:^|\/)id_(?:rsa|ed25519|ecdsa|dsa)\b/,why:"chave privada",deny:!0},{re:/\.pem$|\.p12$|\.pfx$|\.key$/i,why:"material de chave privada",deny:!0},{re:/(?:^|[/\w.-])\.env(?:\.(?!example$|sample$|template$|dist$)[\w.-]+)?$/,why:"arquivo .env (segredos)",deny:!1},{re:/(?:^|\/)[^/]*(?:secret|credential|token|apikey|api_key|password|passwd)[^/]*$/i,why:"arquivo com nome sens\xEDvel (token/secret)",deny:!1}]});var Bb={};Kf(Bb,{UserWorkflowsLoader:()=>Rr,WORKFLOWS_DIRNAME:()=>Fb});import{homedir as fq}from"node:os";import{join as $b}from"node:path";import{readdirSync as pq,readFileSync as hq,mkdirSync as gq,statSync as yq}from"node:fs";var bq,Fb,vq,kq,Rr,lm=S(()=>{"use strict";q();bq=448,Fb="workflows",vq=64*1024,kq=256,Rr=class{dir;constructor(e={}){let o=e.baseDir??$b(fq(),".aluy");this.dir=$b(o,Fb)}get workflowsDir(){return this.dir}ensureDir(){try{gq(this.dir,{mode:bq,recursive:!0})}catch{}}load(){let e;try{e=pq(this.dir,{withFileTypes:!0})}catch{return{workflows:[],errors:[]}}let o=e.filter(i=>i.isFile()&&i.name.toLowerCase().endsWith(".md")).map(i=>i.name).sort((i,a)=>i.localeCompare(a)),n=new Set,r=[],s=[];for(let i of o){if(r.length>=kq)break;let a=this.readOne(i);if(a!==null){if(yc(a)){s.push(a);continue}n.has(a.name)||(n.add(a.name),r.push(a))}}return{workflows:r,errors:s}}readOne(e){let o=$b(this.dir,e);try{let n=yq(o);if(!n.isFile()||n.size>vq)return null;let r=hq(o,"utf8");return bc(e,r,"global")}catch{return null}}}});var jb={};Kf(jb,{PROJECT_WORKFLOWS_DIRNAMES:()=>Ub,ProjectWorkflowsLoader:()=>Cr});import{join as xq}from"node:path";import{readdirSync as Sq,readFileSync as wq,statSync as Aq}from"node:fs";var Ub,Eq,Tq,Cr,dm=S(()=>{"use strict";q();Ar();Ub=[".claude/workflows",".aluy/workflows"],Eq=64*1024,Tq=256,Cr=class{workspace;constructor(e){this.workspace=e.workspace}load(){let e=new Set,o=[],n=[];for(let r of Ub){let s;try{s=this.workspace.resolveInside(r)}catch{continue}let i;try{i=Sq(s,{withFileTypes:!0})}catch{continue}let a=i.filter(c=>c.isFile()&&c.name.toLowerCase().endsWith(".md")).map(c=>c.name).sort((c,l)=>c.localeCompare(l));for(let c of a){if(o.length>=Tq)break;let l=this.readOne(r,s,c);if(l!==null){if(yc(l)){n.push(l);continue}e.has(l.name)||(e.add(l.name),o.push(l))}}}return{workflows:o,errors:n}}readOne(e,o,n){let r=`${e}/${n}`;if(eo(r).kind!=="allow")return null;let s=xq(o,n);try{this.workspace.resolveInside(r);let i=Aq(s);if(!i.isFile()||i.size>Eq)return null;let a=wq(s,"utf8");return bc(n,a,"project")}catch{return null}}}});var Dn="1.0.0-rc.60";q();var F_=`aluy \u2014 agente de terminal que roda na sua m\xE1quina, com o seu provider de LLM
|
|
140
140
|
|
|
141
141
|
Uso:
|
|
142
142
|
aluy ["objetivo"] [--plan | --yolo] [--dense] [--tier <tier>] [--lang <pt-BR|en>]
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@hiperplano/aluy-cli",
|
|
3
|
-
"version": "1.0.0-rc.
|
|
3
|
+
"version": "1.0.0-rc.60",
|
|
4
4
|
"description": "Aluy CLI — TUI (Ink) + binário `aluy` + wiring. Consome @hiperplano/aluy-cli-core (engine portável). Credenciais só no keychain do SO.",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"license": "SEE LICENSE IN LICENSE",
|