@hiperplano/aluy-cli 1.0.0-rc.14 → 1.0.0-rc.15
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- 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 iU=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 yt=(t,e)=>{for(var o in e)iU(t,o,{get:e[o],enumerable:!0})};import{homedir as aU}from"node:os";import{join as cU}from"node:path";function mc(t=aU()){return cU(t,".aluy")}var Pu=p(()=>{"use strict"});var fc,xA=p(()=>{"use strict";fc="1.0.0-rc.
|
|
2
|
+
var iU=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 yt=(t,e)=>{for(var o in e)iU(t,o,{get:e[o],enumerable:!0})};import{homedir as aU}from"node:os";import{join as cU}from"node:path";function mc(t=aU()){return cU(t,".aluy")}var Pu=p(()=>{"use strict"});var fc,xA=p(()=>{"use strict";fc="1.0.0-rc.15"});function sr(t,e){return t.decide(e)}var Es=p(()=>{"use strict"});var Cn,ir,ar=p(()=>{"use strict";Cn="remember",ir="recall"});var Kh,lU,$i,Yh=p(()=>{"use strict";Kh=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}}},lU=200,$i=class{nodes=new Map;maxBoxes;now;constructor(e){this.maxBoxes=e?.maxBoxes??lU,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 Kh(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 Iu(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 AA(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"&&dU.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 m=AA(d,!1);if(typeof m=="string")return m;l.push(m)}r=l}}}if(o===void 0||o.trim()==="")return mU;let s=o.trim().slice(0,uU);return r?{title:s,status:n,substeps:r}:{title:s,status:n}}function fU(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=AA(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=Iu(o).length;return s>SA?{error:`update_plan: no m\xE1ximo ${SA} passos (recebidos ${s}).`}:{steps:o}}function pU(t){let e=Iu(t),o=e.filter(r=>r.step.status==="completed").length,n=e.map(r=>`${" ".repeat(r.depth)}${EA[r.step.status]} ${r.step.title}`).join(`
|
|
3
3
|
`);return`plano (${o}/${e.length}):
|
|
4
4
|
${n}`}function gU(t,e){return e<0?"m\xE9dio":t===e?"curto":t>e?"longo":"m\xE9dio"}function yU(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),m=d??$i.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(m,l,i.title,a),i.status==="completed"&&!e.isClosed(m)&&e.closeBox(m),o.set(i.title,m),m};t.forEach((i,a)=>{let c=gU(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 bU(t,e){if(!e)return pU(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 m=r.get(l);if(m!==void 0)return m;let u=n.get(l);if(!u||!u.parentId||d.has(l))return r.set(l,0),0;let h=s(u.parentId,new Set(d).add(l))+1;return r.set(l,h),h},i=Iu(t),c=[`plano (${i.filter(l=>l.step.status==="completed").length}/${i.length}):`];for(let{step:l,depth:d}of i){let m=o.get(l.title),u=m?hU[m.horizon]:"",h=m?s(m.id):d,g=" ".repeat(h),b=EA[l.status];c.push(`${g}${u} ${b} ${l.title}`)}return c.join(`
|
|
5
5
|
`)}var pc,dU,SA,uU,mU,EA,hU,wA,vU,TA,Nu=p(()=>{"use strict";Yh();pc="update_plan";dU=new Set(["pending","in_progress","completed"]),SA=30,uU=120,mU="update_plan: cada passo precisa de um t\xEDtulo (texto) n\xE3o-vazio.";EA={pending:"\u2610",in_progress:"\u25B6",completed:"\u2611"};hU={longo:"[\u{1F4D0}]",m\u00E9dio:"[\u{1F4CB}]",curto:"[\u{1F4CC}]"};wA=Object.freeze({type:"string",enum:["pending","in_progress","completed"],description:"pending (a fazer) \xB7 in_progress (em curso) \xB7 completed (feito)."}),vU=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:wA,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:wA},required:["title"],additionalProperties:!1}}},required:["title"],additionalProperties:!1}}},required:["steps"],additionalProperties:!1}),TA={name:pc,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:vU,async run(t,e){let o=fU(t);return"error"in o?{ok:!1,observation:o.error}:(e.graph&&yU(o.steps,e.graph),e.plan&&e.plan.set(Iu(o.steps).map(r=>({title:r.step.title,status:r.step.status}))),{ok:!0,observation:bU(o.steps,e.graph)})}}});function _A(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)?xU(s):void 0;if(typeof i=="string")return{error:i};let a,c=t.kind??t.type;if(typeof c=="string"&&kU.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 xU(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 SU(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(`
|
|
@@ -137,7 +137,7 @@ ${t.trim()}`}}function RC(t,e,o=_l){let{older:n,recent:r}=nf(t,o);if(n.length===
|
|
|
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(S2(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 S2(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(` ${w2(t.description,200)}`);let r=yO(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
139
|
`)}function w2(t,e){return t.length<=e?t:t.slice(0,e-1).trimEnd()+"\u2026"}var vO=p(()=>{"use strict"});var kO=p(()=>{"use strict";gf();eO();tO();oO();nO();sO();lO();Fu();hO();vO()});function Uv(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 xO(t,e){let o=Uv(t),n=Uv(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 jv(t,e){return xO(t,e)===1}var SO=p(()=>{"use strict"});var Hv=p(()=>{"use strict"});var wO=p(()=>{"use strict";Hv()});var AO=p(()=>{"use strict"});var EO=p(()=>{"use strict"});function qv(t){return`connector-${t}-token`}function Wv(t){let e=t.trim();return/^\d{5,}:[A-Za-z0-9_-]{30,}$/.test(e)}function bf(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 TO=p(()=>{"use strict"});var D=p(()=>{"use strict";xA();zA();lE();RT();qC();JC();kO();Sv();qm();SO();Hv();wO();AO();EO();TO()});var kf,xf,_O,RO,CO,OO,Sf=p(()=>{"use strict";kf={fg:{color:"#F2EEE8"},fgDim:{color:"#8A7F6D",dimColor:!0},accent:{color:"#DDA13F",bold:!0},accentDim:{color:"#A66A14",bold:!0},danger:{color:"#E5897C",bold:!0},success:{color:"#82CF9E"},depth:{color:"#5BA8A2"}},xf={fg:{color:"#1A1712"},fgDim:{color:"#544B3C"},accent:{color:"#82530F",bold:!0},accentDim:{color:"#82530F",bold:!0},danger:{color:"#B23A2A",bold:!0},success:{color:"#1F6B3A"},depth:{color:"#2E6E69"}},_O={fg:{color:"white"},fgDim:{color:"gray",dimColor:!0},accent:{color:"yellow",bold:!0},accentDim:{color:"yellow",bold:!0},danger:{color:"red",bold:!0},success:{color:"green"},depth:{color:"cyan"}},RO={fg:{color:"black"},fgDim:{color:"gray",dimColor:!0},accent:{color:"yellow",bold:!0},accentDim:{color:"yellow",bold:!0},danger:{color:"red",bold:!0},success:{color:"green"},depth:{color:"cyan"}},CO={fg:{color:"#F2EEE8"},fgDim:{color:"#B0A593",dimColor:!0},accent:{color:"#DDA13F",bold:!0},accentDim:{color:"#A66A14",bold:!0},danger:{color:"#E5897C",bold:!0},success:{color:"#82CF9E"},depth:{color:"#5BA8A2"}},OO={fg:{},fgDim:{dimColor:!0},accent:{bold:!0},accentDim:{bold:!0},danger:{bold:!0,inverse:!0},success:{},depth:{}}});var MO,LO,PO,IO,NO,DO,$O,wf=p(()=>{"use strict";MO={you:"\u258C",aluy:"\u039B",tool:"\u23FA",toolInflight:"\u25CB",wave:"~",waveHead:"\u203A",ask:"\u26A0",ok:"\u2713",err:"\u2717",broker:"\u25CF",clock:"\u25F7",gauge:"\u25D4",window:"\u25A1",branch:"\u2387",diffDel:"\u2039",diffAdd:"\u203A",prompt:"\u203A",cursor:"\u25CF",thinkingCursor:"\u25CF",planMode:"\u25D1",normalMode:"\u25C7",subagents:"+",sessionDot:"\u25CF",barFull:"\u25B0",barEmpty:"\u25B1"},LO={you:"\u258C",aluy:"\u039B",tool:"\u25CF",toolInflight:"\u25CB",wave:"~",waveHead:">",ask:"!",ok:"\u221A",err:"x",broker:"\u25CF",clock:"o",gauge:"\u25D4",window:"\u25A1",branch:"Y",diffDel:"<",diffAdd:">",prompt:">",cursor:"\u25CF",thinkingCursor:"\u25CF",planMode:"\u25D1",normalMode:"\u25C7",subagents:"+",sessionDot:"\u25CF",barFull:"\u2588",barEmpty:"\u2591"},PO={you:">",aluy:"/\\",tool:"o",toolInflight:".",wave:"~",waveHead:">",ask:"!",ok:"[ok]",err:"[x]",broker:"(b)",clock:"t:",gauge:"%:",window:"ctx:",branch:"git:",diffDel:"-",diffAdd:"+",prompt:">",cursor:"*",thinkingCursor:"*",planMode:"[plan]",normalMode:"*",subagents:"(+)",sessionDot:"*",barFull:"#",barEmpty:"."},IO=["\u280B","\u2819","\u2839","\u2838","\u283C","\u2834","\u2826","\u2827","\u2807","\u280F"],NO=["-","\\","|","/"],DO={topLeft:"\u256D",topRight:"\u256E",bottomLeft:"\u2570",bottomRight:"\u256F",horizontal:"\u2500",vertical:"\u2502",teeLeft:"\u251C",teeRight:"\u2524"},$O={topLeft:"+",topRight:"+",bottomLeft:"+",bottomRight:"+",horizontal:"-",vertical:"|",teeLeft:"+",teeRight:"+"}});function FO(t){return pa.includes(t.trim().toLowerCase())}function Gv(t){let e=2166136261,o=t.trim().toLowerCase();for(let r=0;r<o.length;r++)e^=o.charCodeAt(r),e=Math.imul(e,16777619);let n=(e>>>0)%Ul.length;return Ul[n].name}function BO(t,e,o){let n=t.trim().toLowerCase(),r=Ul.find(s=>s.name===n)??Ul.find(s=>s.name===Gv(n));return e==="mono"?{bold:!0}:e==="truecolor"?{color:o==="light"?r.lightHex:r.darkHex,bold:!0}:{color:r.ansi,bold:!0}}var Ul,pa,Af=p(()=>{"use strict";Ul=[{name:"ambar",darkHex:"#DDA13F",lightHex:"#82530F",ansi:"yellow"},{name:"verde",darkHex:"#82CF9E",lightHex:"#1F6B3A",ansi:"green"},{name:"teal",darkHex:"#5BA8A2",lightHex:"#2E6E69",ansi:"cyan"},{name:"azul",darkHex:"#6FA8DC",lightHex:"#1F5C99",ansi:"blue"},{name:"violeta",darkHex:"#B08CD9",lightHex:"#6A3FA6",ansi:"magenta"},{name:"rosa",darkHex:"#E59BC0",lightHex:"#A63D74",ansi:"magenta"},{name:"coral",darkHex:"#E5897C",lightHex:"#B23A2A",ansi:"red"},{name:"ardosia",darkHex:"#9AA7B0",lightHex:"#4A5963",ansi:"gray"}],pa=Ul.map(t=>t.name)});function Ef(t){return t!==void 0&&t!==""&&t!=="0"&&t.toLowerCase()!=="false"}function P2(t){if(t.NO_COLOR!==void 0)return"mono";let e=(t.COLORTERM??"").toLowerCase();if(e==="truecolor"||e==="24bit")return"truecolor";let o=(t.TERM??"").toLowerCase();return o==="dumb"||o===""?"mono":"ansi16"}function I2(t,e){if(e)return e;let o=t.COLORFGBG;if(o){let n=o.split(";"),r=Number(n[n.length-1]);if(Number.isFinite(r))return r>=8?"light":"dark"}return"dark"}function N2(t){let e=(t.TERM??"").toLowerCase();if(e==="linux"||e==="dumb")return!1;let o=`${t.LC_ALL??""}${t.LC_CTYPE??""}${t.LANG??""}`.toLowerCase();return!(Ef(t.ALUY_ASCII)||o&&!o.includes("utf"))}function D2(t,e){return e!==void 0?e:Ef(t.ALUY_SAFE_GLYPHS)}function $2(t,e,o){return t==="mono"?OO:t==="truecolor"?o??(e==="light"?xf:kf):e==="light"?RO:_O}function Ko(t={}){let e=t.env??process.env,o=P2(e),n=I2(e,t.theme),r=N2(e),s=r&&D2(e,t.safeGlyphs),i=t.density??(Ef(e.ALUY_DENSITY)&&e.ALUY_DENSITY==="compact"?"compact":"comfortable"),a=t.animate??!Ef(e.ALUY_NO_ANIM),c=$2(o,n,t.truecolorPalette),l=r?s?LO:MO:PO;return{colorMode:o,brightness:n,unicode:r,safeGlyphs:s,density:i,animate:a,role:h=>c[h],sessionColor:h=>BO(h,o,n),glyph:h=>l[h],aluyMark:r?"\u039B":"/\\",spinnerFrames:r&&!s?IO:NO,box:r?DO:$O}}var Tf=p(()=>{"use strict";Sf();wf();Af()});function Kr(t){return Do.find(e=>e.name===t)}function br(t){let e=t.trim().toLowerCase();if(e==="")return;let o=Do.find(r=>r.name===e);if(o)return o;let n=Do.find(r=>r.name===`aluy-${e}`);return n||Do.find(r=>r.label.toLowerCase()===e)}function Xs(t){return t==="light"?"aluy-light":"aluy-dark"}function UO(t,e={}){let o=Kr(t)??Kr(Yv);return Ko({...e,theme:o.brightness,truecolorPalette:o.palette})}var Do,Yv,Yr=p(()=>{"use strict";Tf();Sf();Do=[{name:"aluy-dark",label:"Aluy Dark",brightness:"dark",summary:"escuro neutro (default) \u2014 fundo quase-preto, accent \xE2mbar",bg:"#070707",palette:kf},{name:"aluy-light",label:"Aluy Light",brightness:"light",summary:"claro creme \u2014 fundo --stone-50, accent \xE2mbar escurecido (AA)",bg:"#F4ECDC",palette:xf},{name:"aluy-slate",label:"Aluy Slate",brightness:"dark",summary:"terra escura WARM \u2014 fundo --stone-950, accent \xE2mbar",bg:"#0E0C09",palette:CO}],Yv="aluy-dark"});function Js(t){return Pt.find(e=>e.code===t)}function Vr(t){let e=t.trim().toLowerCase();if(e==="")return;let o=Pt.find(n=>n.code.toLowerCase()===e);if(o)return o;if(e==="pt"||e==="pt_br"||e==="br"||e==="portugu\xEAs"||e==="portugues")return Js("pt-BR");if(e==="en"||e==="en_us"||e==="english"||e==="ingl\xEAs"||e==="ingles")return Js("en")}function jO(t){let e=(t.LC_ALL??t.LC_MESSAGES??t.LANG??"").trim().toLowerCase();if(e==="")return Dn;let o=e.split(".")[0].split("@")[0].replace("_","-");return o==="c"||o==="posix"?Dn:o==="en"||o.startsWith("en-")?"en":Dn}function Vv(t,e,o){if(t!==void 0&&t.trim()!==""){let n=Vr(t);if(n)return n.code}return e!==void 0?e:jO(o)}var Dn,Pt,ha=p(()=>{"use strict";Dn="pt-BR",Pt=[{code:"pt-BR",label:"Portugu\xEAs (Brasil)",summary:"idioma padr\xE3o da TUI"},{code:"en",label:"English",summary:"English interface (opt-in)"}]});import{homedir as F2}from"node:os";import{join as HO}from"node:path";import{randomBytes as B2}from"node:crypto";import{openSync as U2,writeSync as j2,closeSync as qO,readFileSync as H2,mkdirSync as q2,renameSync as W2,unlinkSync as G2,constants as Xv}from"node:fs";function WO(t){let o=(Array.isArray(t)?t:t!==void 0?[t]:[]).filter(n=>typeof n=="string"&&n.trim()!=="");return o.length>0?o:void 0}function V2(t){if(typeof t!="string")return!1;let e=t.trim().toLowerCase();return e==="localhost"||e==="::1"||/^127\.\d{1,3}\.\d{1,3}\.\d{1,3}$/.test(e)}function X2(t){return typeof t=="number"&&Number.isInteger(t)&&t>=1&&t<=65535}function Jv(t){if(typeof t!="object"||t===null)return;let e=t,o={};return V2(e.host)&&(o.host=e.host.trim()),X2(e.port)&&(o.port=e.port),o.host!==void 0||o.port!==void 0?o:void 0}function J2(t){if(typeof t!="object"||t===null)return;let e=t,o={};if(typeof e.telegram=="object"&&e.telegram!==null){let n=e.telegram;if(Array.isArray(n.allowlist)){let r=[];for(let s of n.allowlist)typeof s=="number"&&Number.isFinite(s)&&Number.isInteger(s)&&!r.includes(s)&&r.push(s);o.telegram={allowlist:r}}else o.telegram={}}return o.telegram!==void 0?o:void 0}function Q2(t){if(typeof t!="object"||t===null)return;let e=t,o={},n=Jv(e.ollama),r=Jv(e.mem0),s=Jv(e.headroom);return n&&(o.ollama=n),r&&(o.mem0=r),s&&(o.headroom=s),Object.keys(o).length>0?o:void 0}function Z2(t){if(!Array.isArray(t))return;let e=[];for(let o of t){if(typeof o!="object"||o===null)continue;let n=o,r=typeof n.id=="string"?n.id.trim():"",s=typeof n.baseUrl=="string"?n.baseUrl.trim():"",i=typeof n.defaultModel=="string"?n.defaultModel.trim():"",a=typeof n.wireFormat=="string"?n.wireFormat:"";if(r===""||s===""||i===""||!Y2.has(a))continue;let c=WO(n.auth),l=WO(n.models),d={id:r,wireFormat:a,baseUrl:s,defaultModel:i,...typeof n.label=="string"&&n.label.trim()?{label:n.label.trim()}:{},...c?{auth:c}:{},...l?{models:l}:{}};e.push(d)}return e.length>0?e:void 0}function jl(t){if(typeof t!="string")return!1;let e=t.trim();return e===""||e.length>eG?!1:!/[\u0000-\u001F\u007F]/.test(e)}function GO(t){if(typeof t!="object"||t===null)return{};let e=t,o={};if(typeof e.theme=="string"){let i=Kr(e.theme);i&&(o.theme=i.name)}if(jl(e.tier)&&(o.tier=e.tier.trim()),o.tier==="custom"&&jl(e.model)&&(o.model=e.model.trim()),typeof e.splitView=="boolean"&&(o.splitView=e.splitView),typeof e.lang=="string"){let i=Js(e.lang);i&&(o.lang=i.code)}if(typeof e.fullscreen=="boolean"&&(o.fullscreen=e.fullscreen),(e.backend==="broker"||e.backend==="local")&&(o.backend=e.backend),jl(e.localProvider)&&(o.localProvider=e.localProvider.trim()),jl(e.localModel)&&(o.localModel=e.localModel.trim()),(e.localAuth==="apikey"||e.localAuth==="oauth")&&(o.localAuth=e.localAuth),jl(e.localBaseUrl)&&(o.localBaseUrl=e.localBaseUrl.trim()),typeof e.localBudget=="boolean"&&(o.localBudget=e.localBudget),typeof e.rooms=="object"&&e.rooms!==null){let i=e.rooms;if(typeof i.backend=="string"){let a=i.backend.trim().toLowerCase();a.length>0&&a.length<=32&&(o.rooms={backend:a})}}if((e.profile==="turbo"||e.profile==="leve")&&(o.profile=e.profile),typeof e.sidecarToggles=="object"&&e.sidecarToggles!==null){let i=e.sidecarToggles,a={};typeof i.ollama=="boolean"&&(a.ollama=i.ollama),typeof i.mem0=="boolean"&&(a.mem0=i.mem0),typeof i.headroom=="boolean"&&(a.headroom=i.headroom),Object.keys(a).length>0&&(o.sidecarToggles=a)}let n=Z2(e.providers);n&&(o.providers=n);let r=Q2(e.services);r&&(o.services=r);let s=J2(e.connectors);return s&&(o.connectors=s),o}function _f(t){return t.connectors?.telegram?.allowlist??[]}function zO(t,e){let o=_f(t);return o.includes(e)?o:[...o,e]}function KO(t,e){return _f(t).filter(o=>o!==e)}function ql(t,e,o){return t!==void 0&&t.trim()!==""?t.trim():e.tier!==void 0&&e.tier.trim()!==""?e.tier.trim():o}function YO(t){return t.lang}function Qv(t,e){return t===!0?!0:e.splitView??!1}function Zv(t,e){return t===!0?!0:e.fullscreen??!1}var z2,K2,Hl,Y2,eG,it,hn=p(()=>{"use strict";Yr();ha();z2=448,K2=384,Hl="config.json",Y2=new Set(["openai-compat","anthropic","gemini"]);eG=128;it=class{base;file;constructor(e={}){this.base=e.baseDir??HO(F2(),".aluy"),this.file=HO(this.base,Hl)}get configPath(){return this.file}load(){let e;try{e=H2(this.file,"utf8")}catch{return{}}let o;try{o=JSON.parse(e)}catch{return{}}return GO(o)}save(e){try{let o=GO({...this.load(),...e});return this.writeAtomic(o),!0}catch{return!1}}saveTheme(e){return this.save({theme:e})}saveLang(e){return this.save({lang:e})}saveTier(e,o){let r=e.trim()==="custom"&&o!==void 0&&o.trim()!==""?o.trim():void 0;return this.save(r!==void 0?{tier:e,model:r}:{tier:e})}saveSplitView(e){return this.save({splitView:e})}saveFullscreen(e){return this.save({fullscreen:e})}saveLocalBudget(e){return this.save({localBudget:e})}writeAtomic(e){q2(this.base,{recursive:!0,mode:z2});let o=`${this.file}.${process.pid}.${B2(6).toString("hex")}.tmp`,n=JSON.stringify(e,null,2)+`
|
|
140
|
-
`,r;try{r=U2(o,Xv.O_CREAT|Xv.O_EXCL|Xv.O_WRONLY,K2),j2(r,n),qO(r),r=void 0,W2(o,this.file)}catch(s){if(r!==void 0)try{qO(r)}catch{}try{G2(o)}catch{}throw s}}}});function ek(t){let e=t.env??process.env,o=e[t.urlKey]?.trim();if(o!==void 0&&o!=="")return o;let n=e[t.hostKey]?.trim()||t.cfg?.host||t.defHost,r=e[t.portKey]?.trim(),s=r&&/^\d+$/.test(r)?Number(r):void 0,i=(s!==void 0&&s>=1&&s<=65535?s:void 0)??t.cfg?.port??t.defPort;return`http://${n}:${i}`}function ga(t,e){return ek({env:t,urlKey:"ALUY_MEM0_URL",hostKey:"ALUY_MEM0_HOST",portKey:"ALUY_MEM0_PORT",cfg:e?.mem0,defHost:zo,defPort:11435})}function ya(t,e){return ek({env:t,urlKey:"ALUY_OLLAMA_URL",hostKey:"ALUY_OLLAMA_HOST",portKey:"ALUY_OLLAMA_PORT",cfg:e?.ollama,defHost:zo,defPort:11434})}function VO(t,e){return ek({env:t,urlKey:"ALUY_HEADROOM_URL",hostKey:"ALUY_HEADROOM_HOST",portKey:"ALUY_HEADROOM_PORT",cfg:e?.headroom,defHost:zo,defPort:8787})}var Rf=p(()=>{"use strict";D()});var Xr,Cf=p(()=>{"use strict";Xr="1.0.0-rc.14"});var t0={};yt(t0,{HELP_TEXT:()=>QO,parseArgs:()=>tk,suggestFlag:()=>sG,versionText:()=>ZO});function ot(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 oG(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 ZO(){return`aluy ${Xr} (@hiperplano/aluy-cli-core ${fc})`}function rG(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 c=t[s-1]===e[a-1]?0:1;i[a]=Math.min(r[a]+1,i[a-1]+1,r[a-1]+c)}r=i}return r[n]}function sG(t){let e,o=3;for(let n of e0){let r=rG(t,n);r<o&&(o=r,e=n)}return e}function iG(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===""||e0.has(s)||o.push(`--${s}`)}return o}function tk(t){let e=t[0];if(e==="login"&&!t.includes("-h")&&!t.includes("--help")){let U=t.slice(1),he=ot(U,"token"),Je=ot(U,"org"),ht=U.includes("--device"),xt=ot(U,"provider"),Et=U.includes("--oauth");return{kind:"login",forceDeviceFlow:ht,...he!==void 0?{token:he}:{},...Je!==void 0?{org:Je}:{},...xt!==void 0?{provider:xt}:{},...Et?{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 U=t.includes("--deep")||t.includes("--test"),he=t.includes("--json");return{kind:"doctor",deep:U,json:he}}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("--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 U=t.includes("--json"),he=t.findIndex(ht=>ht==="--backend"||ht.startsWith("--backend=")),Je="both";if(he!==-1){let xt=(t[he].includes("=")?t[he].slice(10):t[he+1]??"").trim().toLowerCase();xt==="local"?Je="local":xt==="broker"&&(Je="broker")}return{kind:"models",scope:Je,json:U,which:e==="providers"?"providers":"models"}}if(e==="telegram"&&!t.includes("-h")&&!t.includes("--help")){let U=t[1];if(U===void 0||!["login","logout","allow","deny","status"].includes(U))return{kind:"usage-error",message:"uso: aluy telegram <login|logout|allow|deny|status>",exitCode:2};let Je=t.slice(2);if(U==="login"){let ht=ot(Je,"token");return{kind:"telegram",sub:"login",...ht!==void 0?{token:ht}:{}}}if(U==="allow"||U==="deny"){let ht=Je.find(Et=>!Et.startsWith("-")),xt=ht!==void 0&&/^-?\d+$/.test(ht)?Number(ht):void 0;return xt===void 0?{kind:"usage-error",message:`uso: aluy telegram ${U} <chat-id> (um inteiro)`,exitCode:2}:{kind:"telegram",sub:U,chatId:xt}}return{kind:"telegram",sub:U}}if(e==="mcp"&&t[1]==="search"&&!t.includes("-h")&&!t.includes("--help"))return{kind:"mcp-search",query:t.slice(2).filter(he=>!he.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:ZO()};if(t.includes("-h")||t.includes("--help"))return{kind:"help",text:QO};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"),c=t.includes("--split")||t.includes("--view")?!0:void 0,l=t.includes("--fullscreen")||t.includes("--cockpit")?!0:void 0,d=t.includes("--no-budget")?!1:t.includes("--budget")?!0:void 0,m=ot(t,"tier"),u=ot(t,"lang"),h=ot(t,"max-tokens"),g=ot(t,"max-iterations"),b=ot(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,R=t.includes("--no-autocompact")?"off":ot(t,"autocompact-at"),A=t.includes("--quiet")?!0:void 0,L=t.includes("--cycle")?!0:void 0,j=ot(t,"cycles"),H=ot(t,"cycle-for"),K=ot(t,"backend"),V=ot(t,"local-provider"),I=ot(t,"local-model"),J=ot(t,"local-auth"),Q=ot(t,"local-base-url"),G=ot(t,"model"),N=ot(t,"provider");if((t.includes("--provider")||t.some(U=>U.startsWith("--provider=")))&&(G===void 0||G.trim()===""))return{kind:"usage-error",message:"aluy: --provider exige --model (ex.: --provider <provider> --model <slug>)",exitCode:2};if((G===void 0||G.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 Oe=ot(t,"effort"),Y=t.includes("--effort")||t.some(U=>U.startsWith("--effort=")),le;if(Oe!==void 0){if(Oe.trim()==="")return{kind:"usage-error",message:"aluy: --effort requer um valor (ex.: --effort low)",exitCode:2};if(Oe.length>32)return{kind:"usage-error",message:"aluy: --effort aceita no m\xE1ximo 32 caracteres",exitCode:2};le=Oe}else if(Y)return{kind:"usage-error",message:"aluy: --effort requer um valor (ex.: --effort low)",exitCode:2};let O=t.includes("-p")||t.includes("--print")||t.includes("--exec")||t.some(U=>U.startsWith("-p=")||U.startsWith("--print=")||U.startsWith("--exec=")),se=O?ot(t,"print",{allowDashValue:!0})??ot(t,"exec",{allowDashValue:!0})??oG(t,"p")??void 0:void 0,de=O?ot(t,"output-format"):void 0,ye=t.includes("--new"),Z=t.includes("--continue"),oe=t.indexOf("--resume"),Me=t.find(U=>U.startsWith("--resume=")),Ht=oe>=0||Me!==void 0,ft;if(Me!==void 0)ft=Me.slice(9);else if(oe>=0){let U=t[oe+1];U!==void 0&&!U.startsWith("-")&&(ft=U)}let st=m!==void 0?t.indexOf("--tier")+1:-1,lt=u!==void 0&&!t.some(U=>U.startsWith("--lang="))?t.indexOf("--lang")+1:-1,pt=ft!==void 0&&Me===void 0?oe+1:-1,z=h!==void 0&&!t.some(U=>U.startsWith("--max-tokens="))?t.indexOf("--max-tokens")+1:-1,pe=g!==void 0&&!t.some(U=>U.startsWith("--max-iterations="))?t.indexOf("--max-iterations")+1:-1,Ze=j!==void 0&&!t.some(U=>U.startsWith("--cycles="))?t.indexOf("--cycles")+1:-1,Ro=H!==void 0&&!t.some(U=>U.startsWith("--cycle-for="))?t.indexOf("--cycle-for")+1:-1,te=b!==void 0&&!t.some(U=>U.startsWith("--max-output-tokens="))?t.indexOf("--max-output-tokens")+1:-1,k=R!==void 0&&!t.includes("--no-autocompact")&&!t.some(U=>U.startsWith("--autocompact-at="))?t.indexOf("--autocompact-at")+1:-1,Co=K!==void 0&&!t.some(U=>U.startsWith("--backend="))?t.indexOf("--backend")+1:-1,Ie=(U,he)=>he!==void 0&&!t.some(Je=>Je.startsWith(`--${U}=`))?t.indexOf(`--${U}`)+1:-1,Ss=Ie("local-provider",V),Ci=Ie("local-model",I),qt=Ie("local-auth",J),Cr=Ie("local-base-url",Q),As=G!==void 0&&!t.some(U=>U.startsWith("--model="))?t.indexOf("--model")+1:-1,jo=N!==void 0&&!t.some(U=>U.startsWith("--provider="))?t.indexOf("--provider")+1:-1,cn=le!==void 0&&!t.some(U=>U.startsWith("--effort="))?t.indexOf("--effort")+1:-1,mo=de!==void 0&&!t.some(U=>U.startsWith("--output-format="))?t.indexOf("--output-format")+1:-1,Qt=se!==void 0&&!t.some(U=>U.startsWith("-p=")||U.startsWith("--print=")||U.startsWith("--exec="))?Math.max(t.indexOf("-p"),t.indexOf("--print"),t.indexOf("--exec"))+1:-1,Ho=t.find((U,he)=>!U.startsWith("-")&&he!==st&&he!==lt&&he!==Co&&he!==Ss&&he!==Ci&&he!==qt&&he!==Cr&&he!==As&&he!==jo&&he!==cn&&he!==mo&&he!==Qt&&he!==pt&&he!==z&&he!==pe&&he!==te&&he!==k&&he!==Ze&&he!==Ro),Oi=Z?{kind:"continue"}:Ht?{kind:"resume",...ft!==void 0?{id:ft}:{}}:void 0,Or=new Set([st,lt,Co,Ss,Ci,qt,Cr,As,jo,cn,mo,Qt,pt,z,pe,te,k,Ze,Ro].filter(U=>U>=0));for(let U of nG){let he=t.indexOf(U);he>=0&&!t[he].includes("=")&&Or.add(he+1)}let ln=iG(t,Or);return{kind:"launch",mode:s,unsafe:s==="unsafe",unsafeAliasUsed:n,...ln.length>0?{unknownFlags:ln}:{},dense:i,fresh:ye,subAgents:y,safeGlyphs:a,print:O,...c!==void 0?{split:c}:{},...l!==void 0?{fullscreen:l}:{},...d!==void 0?{budget:d}:{},...Ho!==void 0?{goal:Ho}:{},...m!==void 0?{tier:m}:{},...K!==void 0?{backend:K}:{},...V!==void 0?{localProvider:V}:{},...I!==void 0?{localModel:I}:{},...J!==void 0?{localAuth:J}:{},...Q!==void 0?{localBaseUrl:Q}:{},...G!==void 0?{model:G}:{},...N!==void 0?{provider:N}:{},...le!==void 0?{effort:le}:{},...se!==void 0?{printArg:se}:{},...de!==void 0?{outputFormat:de}:{},...u!==void 0?{lang:u}:{},...Oi!==void 0?{resume:Oi}:{},...h!==void 0?{maxTokens:h}:{},...g!==void 0?{maxIterations:g}:{},...b!==void 0?{maxOutputTokens:b}:{},...w!==void 0?{selfCheck:w}:{},...R!==void 0?{autoCompactAt:R}:{},...A!==void 0?{quiet:A}:{},...L!==void 0?{cycle:L}:{},...j!==void 0?{cycles:j}:{},...H!==void 0?{cycleFor:H}:{}}}var QO,e0,nG,ok=p(()=>{"use strict";D();Cf();QO=`aluy \u2014 agente de terminal que roda na sua m\xE1quina, com o seu provider de LLM
|
|
140
|
+
`,r;try{r=U2(o,Xv.O_CREAT|Xv.O_EXCL|Xv.O_WRONLY,K2),j2(r,n),qO(r),r=void 0,W2(o,this.file)}catch(s){if(r!==void 0)try{qO(r)}catch{}try{G2(o)}catch{}throw s}}}});function ek(t){let e=t.env??process.env,o=e[t.urlKey]?.trim();if(o!==void 0&&o!=="")return o;let n=e[t.hostKey]?.trim()||t.cfg?.host||t.defHost,r=e[t.portKey]?.trim(),s=r&&/^\d+$/.test(r)?Number(r):void 0,i=(s!==void 0&&s>=1&&s<=65535?s:void 0)??t.cfg?.port??t.defPort;return`http://${n}:${i}`}function ga(t,e){return ek({env:t,urlKey:"ALUY_MEM0_URL",hostKey:"ALUY_MEM0_HOST",portKey:"ALUY_MEM0_PORT",cfg:e?.mem0,defHost:zo,defPort:11435})}function ya(t,e){return ek({env:t,urlKey:"ALUY_OLLAMA_URL",hostKey:"ALUY_OLLAMA_HOST",portKey:"ALUY_OLLAMA_PORT",cfg:e?.ollama,defHost:zo,defPort:11434})}function VO(t,e){return ek({env:t,urlKey:"ALUY_HEADROOM_URL",hostKey:"ALUY_HEADROOM_HOST",portKey:"ALUY_HEADROOM_PORT",cfg:e?.headroom,defHost:zo,defPort:8787})}var Rf=p(()=>{"use strict";D()});var Xr,Cf=p(()=>{"use strict";Xr="1.0.0-rc.15"});var t0={};yt(t0,{HELP_TEXT:()=>QO,parseArgs:()=>tk,suggestFlag:()=>sG,versionText:()=>ZO});function ot(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 oG(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 ZO(){return`aluy ${Xr} (@hiperplano/aluy-cli-core ${fc})`}function rG(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 c=t[s-1]===e[a-1]?0:1;i[a]=Math.min(r[a]+1,i[a-1]+1,r[a-1]+c)}r=i}return r[n]}function sG(t){let e,o=3;for(let n of e0){let r=rG(t,n);r<o&&(o=r,e=n)}return e}function iG(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===""||e0.has(s)||o.push(`--${s}`)}return o}function tk(t){let e=t[0];if(e==="login"&&!t.includes("-h")&&!t.includes("--help")){let U=t.slice(1),he=ot(U,"token"),Je=ot(U,"org"),ht=U.includes("--device"),xt=ot(U,"provider"),Et=U.includes("--oauth");return{kind:"login",forceDeviceFlow:ht,...he!==void 0?{token:he}:{},...Je!==void 0?{org:Je}:{},...xt!==void 0?{provider:xt}:{},...Et?{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 U=t.includes("--deep")||t.includes("--test"),he=t.includes("--json");return{kind:"doctor",deep:U,json:he}}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("--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 U=t.includes("--json"),he=t.findIndex(ht=>ht==="--backend"||ht.startsWith("--backend=")),Je="both";if(he!==-1){let xt=(t[he].includes("=")?t[he].slice(10):t[he+1]??"").trim().toLowerCase();xt==="local"?Je="local":xt==="broker"&&(Je="broker")}return{kind:"models",scope:Je,json:U,which:e==="providers"?"providers":"models"}}if(e==="telegram"&&!t.includes("-h")&&!t.includes("--help")){let U=t[1];if(U===void 0||!["login","logout","allow","deny","status"].includes(U))return{kind:"usage-error",message:"uso: aluy telegram <login|logout|allow|deny|status>",exitCode:2};let Je=t.slice(2);if(U==="login"){let ht=ot(Je,"token");return{kind:"telegram",sub:"login",...ht!==void 0?{token:ht}:{}}}if(U==="allow"||U==="deny"){let ht=Je.find(Et=>!Et.startsWith("-")),xt=ht!==void 0&&/^-?\d+$/.test(ht)?Number(ht):void 0;return xt===void 0?{kind:"usage-error",message:`uso: aluy telegram ${U} <chat-id> (um inteiro)`,exitCode:2}:{kind:"telegram",sub:U,chatId:xt}}return{kind:"telegram",sub:U}}if(e==="mcp"&&t[1]==="search"&&!t.includes("-h")&&!t.includes("--help"))return{kind:"mcp-search",query:t.slice(2).filter(he=>!he.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:ZO()};if(t.includes("-h")||t.includes("--help"))return{kind:"help",text:QO};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"),c=t.includes("--split")||t.includes("--view")?!0:void 0,l=t.includes("--fullscreen")||t.includes("--cockpit")?!0:void 0,d=t.includes("--no-budget")?!1:t.includes("--budget")?!0:void 0,m=ot(t,"tier"),u=ot(t,"lang"),h=ot(t,"max-tokens"),g=ot(t,"max-iterations"),b=ot(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,R=t.includes("--no-autocompact")?"off":ot(t,"autocompact-at"),A=t.includes("--quiet")?!0:void 0,L=t.includes("--cycle")?!0:void 0,j=ot(t,"cycles"),H=ot(t,"cycle-for"),K=ot(t,"backend"),V=ot(t,"local-provider"),I=ot(t,"local-model"),J=ot(t,"local-auth"),Q=ot(t,"local-base-url"),G=ot(t,"model"),N=ot(t,"provider");if((t.includes("--provider")||t.some(U=>U.startsWith("--provider=")))&&(G===void 0||G.trim()===""))return{kind:"usage-error",message:"aluy: --provider exige --model (ex.: --provider <provider> --model <slug>)",exitCode:2};if((G===void 0||G.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 Oe=ot(t,"effort"),Y=t.includes("--effort")||t.some(U=>U.startsWith("--effort=")),le;if(Oe!==void 0){if(Oe.trim()==="")return{kind:"usage-error",message:"aluy: --effort requer um valor (ex.: --effort low)",exitCode:2};if(Oe.length>32)return{kind:"usage-error",message:"aluy: --effort aceita no m\xE1ximo 32 caracteres",exitCode:2};le=Oe}else if(Y)return{kind:"usage-error",message:"aluy: --effort requer um valor (ex.: --effort low)",exitCode:2};let O=t.includes("-p")||t.includes("--print")||t.includes("--exec")||t.some(U=>U.startsWith("-p=")||U.startsWith("--print=")||U.startsWith("--exec=")),se=O?ot(t,"print",{allowDashValue:!0})??ot(t,"exec",{allowDashValue:!0})??oG(t,"p")??void 0:void 0,de=O?ot(t,"output-format"):void 0,ye=t.includes("--new"),Z=t.includes("--continue"),oe=t.indexOf("--resume"),Me=t.find(U=>U.startsWith("--resume=")),Ht=oe>=0||Me!==void 0,ft;if(Me!==void 0)ft=Me.slice(9);else if(oe>=0){let U=t[oe+1];U!==void 0&&!U.startsWith("-")&&(ft=U)}let st=m!==void 0?t.indexOf("--tier")+1:-1,lt=u!==void 0&&!t.some(U=>U.startsWith("--lang="))?t.indexOf("--lang")+1:-1,pt=ft!==void 0&&Me===void 0?oe+1:-1,z=h!==void 0&&!t.some(U=>U.startsWith("--max-tokens="))?t.indexOf("--max-tokens")+1:-1,pe=g!==void 0&&!t.some(U=>U.startsWith("--max-iterations="))?t.indexOf("--max-iterations")+1:-1,Ze=j!==void 0&&!t.some(U=>U.startsWith("--cycles="))?t.indexOf("--cycles")+1:-1,Ro=H!==void 0&&!t.some(U=>U.startsWith("--cycle-for="))?t.indexOf("--cycle-for")+1:-1,te=b!==void 0&&!t.some(U=>U.startsWith("--max-output-tokens="))?t.indexOf("--max-output-tokens")+1:-1,k=R!==void 0&&!t.includes("--no-autocompact")&&!t.some(U=>U.startsWith("--autocompact-at="))?t.indexOf("--autocompact-at")+1:-1,Co=K!==void 0&&!t.some(U=>U.startsWith("--backend="))?t.indexOf("--backend")+1:-1,Ie=(U,he)=>he!==void 0&&!t.some(Je=>Je.startsWith(`--${U}=`))?t.indexOf(`--${U}`)+1:-1,Ss=Ie("local-provider",V),Ci=Ie("local-model",I),qt=Ie("local-auth",J),Cr=Ie("local-base-url",Q),As=G!==void 0&&!t.some(U=>U.startsWith("--model="))?t.indexOf("--model")+1:-1,jo=N!==void 0&&!t.some(U=>U.startsWith("--provider="))?t.indexOf("--provider")+1:-1,cn=le!==void 0&&!t.some(U=>U.startsWith("--effort="))?t.indexOf("--effort")+1:-1,mo=de!==void 0&&!t.some(U=>U.startsWith("--output-format="))?t.indexOf("--output-format")+1:-1,Qt=se!==void 0&&!t.some(U=>U.startsWith("-p=")||U.startsWith("--print=")||U.startsWith("--exec="))?Math.max(t.indexOf("-p"),t.indexOf("--print"),t.indexOf("--exec"))+1:-1,Ho=t.find((U,he)=>!U.startsWith("-")&&he!==st&&he!==lt&&he!==Co&&he!==Ss&&he!==Ci&&he!==qt&&he!==Cr&&he!==As&&he!==jo&&he!==cn&&he!==mo&&he!==Qt&&he!==pt&&he!==z&&he!==pe&&he!==te&&he!==k&&he!==Ze&&he!==Ro),Oi=Z?{kind:"continue"}:Ht?{kind:"resume",...ft!==void 0?{id:ft}:{}}:void 0,Or=new Set([st,lt,Co,Ss,Ci,qt,Cr,As,jo,cn,mo,Qt,pt,z,pe,te,k,Ze,Ro].filter(U=>U>=0));for(let U of nG){let he=t.indexOf(U);he>=0&&!t[he].includes("=")&&Or.add(he+1)}let ln=iG(t,Or);return{kind:"launch",mode:s,unsafe:s==="unsafe",unsafeAliasUsed:n,...ln.length>0?{unknownFlags:ln}:{},dense:i,fresh:ye,subAgents:y,safeGlyphs:a,print:O,...c!==void 0?{split:c}:{},...l!==void 0?{fullscreen:l}:{},...d!==void 0?{budget:d}:{},...Ho!==void 0?{goal:Ho}:{},...m!==void 0?{tier:m}:{},...K!==void 0?{backend:K}:{},...V!==void 0?{localProvider:V}:{},...I!==void 0?{localModel:I}:{},...J!==void 0?{localAuth:J}:{},...Q!==void 0?{localBaseUrl:Q}:{},...G!==void 0?{model:G}:{},...N!==void 0?{provider:N}:{},...le!==void 0?{effort:le}:{},...se!==void 0?{printArg:se}:{},...de!==void 0?{outputFormat:de}:{},...u!==void 0?{lang:u}:{},...Oi!==void 0?{resume:Oi}:{},...h!==void 0?{maxTokens:h}:{},...g!==void 0?{maxIterations:g}:{},...b!==void 0?{maxOutputTokens:b}:{},...w!==void 0?{selfCheck:w}:{},...R!==void 0?{autoCompactAt:R}:{},...A!==void 0?{quiet:A}:{},...L!==void 0?{cycle:L}:{},...j!==void 0?{cycles:j}:{},...H!==void 0?{cycleFor:H}:{}}}var QO,e0,nG,ok=p(()=>{"use strict";D();Cf();QO=`aluy \u2014 agente de terminal que roda na sua m\xE1quina, com o seu provider de LLM
|
|
141
141
|
|
|
142
142
|
Uso:
|
|
143
143
|
aluy ["objetivo"] [--plan | --yolo] [--dense] [--tier <tier>] [--lang <pt-BR|en>]
|
package/dist-bundle/index.js
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
var gN=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 Bf=(t,e)=>{for(var o in e)gN(t,o,{get:e[o],enumerable:!0})};var aa,gx=S(()=>{"use strict";aa="1.0.0-rc.
|
|
1
|
+
var gN=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 Bf=(t,e)=>{for(var o in e)gN(t,o,{get:e[o],enumerable:!0})};var aa,gx=S(()=>{"use strict";aa="1.0.0-rc.15"});function Ln(t,e){return t.decide(e)}var jr=S(()=>{"use strict"});var en,Pn,Nn=S(()=>{"use strict";en="remember",Pn="recall"});var Uf,yN,qs,jf=S(()=>{"use strict";Uf=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}}},yN=200,qs=class{nodes=new Map;maxBoxes;now;constructor(e){this.maxBoxes=e?.maxBoxes??yN,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 Uf(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 rd(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 vx(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"&&bN.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=vx(d,!1);if(typeof f=="string")return f;l.push(f)}r=l}}}if(o===void 0||o.trim()==="")return kN;let s=o.trim().slice(0,vN);return r?{title:s,status:n,substeps:r}:{title:s,status:n}}function xN(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=vx(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=rd(o).length;return s>yx?{error:`update_plan: no m\xE1ximo ${yx} passos (recebidos ${s}).`}:{steps:o}}function SN(t){let e=rd(t),o=e.filter(r=>r.step.status==="completed").length,n=e.map(r=>`${" ".repeat(r.depth)}${kx[r.step.status]} ${r.step.title}`).join(`
|
|
2
2
|
`);return`plano (${o}/${e.length}):
|
|
3
3
|
${n}`}function AN(t,e){return e<0?"m\xE9dio":t===e?"curto":t>e?"longo":"m\xE9dio"}function EN(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??qs.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=AN(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 TN(t,e){if(!e)return SN(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=rd(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?wN[f.horizon]:"",p=f?s(f.id):d,h=" ".repeat(p),y=kx[l.status];c.push(`${h}${u} ${y} ${l.title}`)}return c.join(`
|
|
4
4
|
`)}var ca,bN,yx,vN,kN,kx,wN,bx,_N,xx,sd=S(()=>{"use strict";jf();ca="update_plan";bN=new Set(["pending","in_progress","completed"]),yx=30,vN=120,kN="update_plan: cada passo precisa de um t\xEDtulo (texto) n\xE3o-vazio.";kx={pending:"\u2610",in_progress:"\u25B6",completed:"\u2611"};wN={longo:"[\u{1F4D0}]",m\u00E9dio:"[\u{1F4CB}]",curto:"[\u{1F4CC}]"};bx=Object.freeze({type:"string",enum:["pending","in_progress","completed"],description:"pending (a fazer) \xB7 in_progress (em curso) \xB7 completed (feito)."}),_N=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:bx,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:bx},required:["title"],additionalProperties:!1}}},required:["title"],additionalProperties:!1}}},required:["steps"],additionalProperties:!1}),xx={name:ca,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:_N,async run(t,e){let o=xN(t);return"error"in o?{ok:!1,observation:o.error}:(e.graph&&EN(o.steps,e.graph),e.plan&&e.plan.set(rd(o.steps).map(r=>({title:r.step.title,status:r.step.status}))),{ok:!0,observation:TN(o.steps,e.graph)})}}});function Sx(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)?CN(s):void 0;if(typeof i=="string")return{error:i};let a,c=t.kind??t.type;if(typeof c=="string"&&RN.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 CN(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 ON(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(`
|
|
@@ -135,7 +135,7 @@ ${t.trim()}`}}function vT(t,e,o=pc){let{older:n,recent:r}=Tu(t,o);if(n.length===
|
|
|
135
135
|
\u2026[truncado: ${t.length-Oy} chars omitidos]`}function yB(t){return t.length<=Ly?t:`${t.slice(0,Ly)}\u2026`}function o_(t){let e=t_(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=Ue(l.content);return l.ok?{ok:!0,observation:e_(d),display:`${e}(${bB(i)})`}:{ok:!1,observation:e_(`MCP "${e}" erro: ${d}`)}}catch(l){return{ok:!1,observation:`MCP "${e}" falhou: ${l instanceof Error?l.message:String(l)}`}}}}}function Py(t,e){let o=[],n=new Set,r=new Map,s=new Map,i=new Set;for(let a of t){let c=o_(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>=My){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 ${My} (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 bB(t){if(Object.keys(t).length===0)return"";let o=JSON.stringify(t);return o.length<=200?o:`${o.slice(0,200)}\u2026`}var Oy,My,Ly,n_=S(()=>{"use strict";cd();Bn();Oy=2e4;My=128,Ly=1024});function i_(t,e){let o=new URL(s_);return t.trim().length>0&&o.searchParams.set("search",t.trim()),o.searchParams.set("limit",String(kB)),e!==void 0&&e.length>0&&o.searchParams.set("cursor",e),o.toString()}async function Iy(t,e,o){let n=t.trim(),r=[],s;for(let i=0;i<vB;i++){let a=i_(n,s),c;try{c=await e(a,o)}catch(f){return{ok:!1,query:n,reason:Iu(TB(f))}}if(!c.ok)return{ok:!1,query:n,reason:Iu(c.reason)};if(c.status<200||c.status>=300)return{ok:!1,query:n,reason:Iu(`HTTP ${c.status}`)};let l;try{l=JSON.parse(c.body)}catch{return{ok:!1,query:n,reason:Iu("resposta n\xE3o \xE9 JSON v\xE1lido")}}let d=c_(l);for(let f of d.servers)if(a_(f,n)&&r.push(f),r.length>=Ny)break;if(r.length>=Ny||(s=d.nextCursor,s===void 0||s.length===0))break}return{ok:!0,query:n,results:r}}function Iu(t){return`registro MCP indispon\xEDvel (${bi}): ${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 c_(t){if(!qn(t))return{servers:[]};let e=Array.isArray(t.servers)?t.servers:[],o=[];for(let s of e){let i=xB(s);i!==void 0&&o.push(i)}let n=qn(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 xB(t){if(!qn(t))return;let e=qn(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=SB(e);return{name:o,description:n,run:i,...r!==void 0?{title:r}:{},...s!==void 0?{version:s}:{}}}function SB(t){let e=[],o=Array.isArray(t.remotes)?t.remotes:[];for(let r of o)qn(r)&&typeof r.url=="string"&&e.push(r.url);let n=Array.isArray(t.packages)?t.packages:[];for(let r of n){if(!qn(r))continue;let s=wB(r);if(s!==void 0)return{...s,remoteUrls:e}}return{args:[],env:[],remoteUrls:e}}function wB(t){let e=as(t.registryType)??as(t.registry_name),o=as(t.identifier)??as(t.name);if(o===void 0)return;let n=as(t.version),r=as(t.runtimeHint),s=qn(t.transport)?as(t.transport.type):void 0,i=EB(t.environmentVariables),a=r_(t.runtimeArguments),c=r_(t.packageArguments),l=n!==void 0?`${o}@${n}`:o;return e==="npm"||r==="npx"?{command:"npx",args:AB(["-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 AB(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 r_(t){if(!Array.isArray(t))return[];let e=[];for(let o of t)qn(o)&&typeof o.value=="string"&&e.push(o.value);return e}function EB(t){if(!Array.isArray(t))return[];let e=[];for(let o of t)qn(o)&&typeof o.name=="string"&&o.name.length>0&&e.push({name:o.name,required:o.isRequired===!0});return e}function as(t){return typeof t=="string"&&t.trim().length>0?t.trim():void 0}function qn(t){return typeof t=="object"&&t!==null&&!Array.isArray(t)}function TB(t){return t instanceof Error?t.message:String(t)}var bi,s_,vB,kB,Ny,l_=S(()=>{"use strict";bi="registry.modelcontextprotocol.io",s_=`https://${bi}/v0/servers`,vB=5,kB=100,Ny=25});function u_(t){let{command:e,args:o}=t.run;if(e===void 0)return;let n=m_(t.name);return["aluy","mcp","add",d_(n),"--",e,...o.map(d_)].join(" ")}function m_(t){let o=(t.split("/").pop()??t).replace(/[^A-Za-z0-9_-]+/g,"-").replace(/^-+|-+$/g,"");return o.length>0?o:"server"}function d_(t){return/^[A-Za-z0-9_./@:+=-]+$/.test(t)?t:`'${t.replace(/'/g,"'\\''")}'`}function Dy(t){if(!t.ok)return`\u26A0 ${t.reason}
|
|
136
136
|
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(_B(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(`
|
|
137
137
|
`)}function _B(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(` ${RB(t.description,200)}`);let r=u_(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(`
|
|
138
|
-
`)}function RB(t,e){return t.length<=e?t:t.slice(0,e-1).trimEnd()+"\u2026"}var f_=S(()=>{"use strict"});var p_=S(()=>{"use strict";Nu();YT();VT();XT();JT();ZT();n_();cd();l_();f_()});function $y(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 h_(t,e){let o=$y(t),n=$y(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 Fy(t,e){return h_(t,e)===1}var g_=S(()=>{"use strict"});var By=S(()=>{"use strict"});var y_=S(()=>{"use strict";By()});var b_=S(()=>{"use strict"});var v_=S(()=>{"use strict"});var k_=S(()=>{"use strict"});var j=S(()=>{"use strict";gx();jx();eS();vw();$T();GT();p_();yy();mu();g_();By();y_();b_();v_();k_()});import{posix as XU}from"node:path";function JU(t){return XU.normalize(t)}function Jt(t){let e=JU(t);for(let o of QU)if(o.re.test(e))return o.deny?{kind:"deny",why:o.why}:{kind:"ask",why:o.why};return{kind:"allow"}}function rb(t){return Jt(t).kind==="allow"}var QU,xr=S(()=>{"use strict";QU=[{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 _b={};Bf(_b,{UserWorkflowsLoader:()=>_i,WORKFLOWS_DIRNAME:()=>Tb});import{homedir as IH}from"node:os";import{join as Eb}from"node:path";import{readdirSync as DH,readFileSync as $H,mkdirSync as FH,statSync as BH}from"node:fs";var UH,Tb,jH,HH,_i,om=S(()=>{"use strict";j();UH=448,Tb="workflows",jH=64*1024,HH=256,_i=class{dir;constructor(e={}){let o=e.baseDir??Eb(IH(),".aluy");this.dir=Eb(o,Tb)}get workflowsDir(){return this.dir}ensureDir(){try{FH(this.dir,{mode:UH,recursive:!0})}catch{}}load(){let e;try{e=DH(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>=HH)break;let a=this.readOne(i);if(a!==null){if(nc(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=Eb(this.dir,e);try{let n=BH(o);if(!n.isFile()||n.size>jH)return null;let r=$H(o,"utf8");return rc(e,r,"global")}catch{return null}}}});var Cb={};Bf(Cb,{PROJECT_WORKFLOWS_DIRNAMES:()=>Rb,ProjectWorkflowsLoader:()=>Ri});import{join as qH}from"node:path";import{readdirSync as WH,readFileSync as GH,statSync as zH}from"node:fs";var Rb,KH,YH,Ri,nm=S(()=>{"use strict";j();xr();Rb=[".claude/workflows",".aluy/workflows"],KH=64*1024,YH=256,Ri=class{workspace;constructor(e){this.workspace=e.workspace}load(){let e=new Set,o=[],n=[];for(let r of Rb){let s;try{s=this.workspace.resolveInside(r)}catch{continue}let i;try{i=WH(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>=YH)break;let l=this.readOne(r,s,c);if(l!==null){if(nc(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(Jt(r).kind!=="allow")return null;let s=qH(o,n);try{this.workspace.resolveInside(r);let i=zH(s);if(!i.isFile()||i.size>KH)return null;let a=GH(s,"utf8");return rc(n,a,"project")}catch{return null}}}});var Mn="1.0.0-rc.
|
|
138
|
+
`)}function RB(t,e){return t.length<=e?t:t.slice(0,e-1).trimEnd()+"\u2026"}var f_=S(()=>{"use strict"});var p_=S(()=>{"use strict";Nu();YT();VT();XT();JT();ZT();n_();cd();l_();f_()});function $y(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 h_(t,e){let o=$y(t),n=$y(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 Fy(t,e){return h_(t,e)===1}var g_=S(()=>{"use strict"});var By=S(()=>{"use strict"});var y_=S(()=>{"use strict";By()});var b_=S(()=>{"use strict"});var v_=S(()=>{"use strict"});var k_=S(()=>{"use strict"});var j=S(()=>{"use strict";gx();jx();eS();vw();$T();GT();p_();yy();mu();g_();By();y_();b_();v_();k_()});import{posix as XU}from"node:path";function JU(t){return XU.normalize(t)}function Jt(t){let e=JU(t);for(let o of QU)if(o.re.test(e))return o.deny?{kind:"deny",why:o.why}:{kind:"ask",why:o.why};return{kind:"allow"}}function rb(t){return Jt(t).kind==="allow"}var QU,xr=S(()=>{"use strict";QU=[{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 _b={};Bf(_b,{UserWorkflowsLoader:()=>_i,WORKFLOWS_DIRNAME:()=>Tb});import{homedir as IH}from"node:os";import{join as Eb}from"node:path";import{readdirSync as DH,readFileSync as $H,mkdirSync as FH,statSync as BH}from"node:fs";var UH,Tb,jH,HH,_i,om=S(()=>{"use strict";j();UH=448,Tb="workflows",jH=64*1024,HH=256,_i=class{dir;constructor(e={}){let o=e.baseDir??Eb(IH(),".aluy");this.dir=Eb(o,Tb)}get workflowsDir(){return this.dir}ensureDir(){try{FH(this.dir,{mode:UH,recursive:!0})}catch{}}load(){let e;try{e=DH(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>=HH)break;let a=this.readOne(i);if(a!==null){if(nc(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=Eb(this.dir,e);try{let n=BH(o);if(!n.isFile()||n.size>jH)return null;let r=$H(o,"utf8");return rc(e,r,"global")}catch{return null}}}});var Cb={};Bf(Cb,{PROJECT_WORKFLOWS_DIRNAMES:()=>Rb,ProjectWorkflowsLoader:()=>Ri});import{join as qH}from"node:path";import{readdirSync as WH,readFileSync as GH,statSync as zH}from"node:fs";var Rb,KH,YH,Ri,nm=S(()=>{"use strict";j();xr();Rb=[".claude/workflows",".aluy/workflows"],KH=64*1024,YH=256,Ri=class{workspace;constructor(e){this.workspace=e.workspace}load(){let e=new Set,o=[],n=[];for(let r of Rb){let s;try{s=this.workspace.resolveInside(r)}catch{continue}let i;try{i=WH(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>=YH)break;let l=this.readOne(r,s,c);if(l!==null){if(nc(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(Jt(r).kind!=="allow")return null;let s=qH(o,n);try{this.workspace.resolveInside(r);let i=zH(s);if(!i.isFile()||i.size>KH)return null;let a=GH(s,"utf8");return rc(n,a,"project")}catch{return null}}}});var Mn="1.0.0-rc.15";j();var x_=`aluy \u2014 agente de terminal que roda na sua m\xE1quina, com o seu provider de LLM
|
|
139
139
|
|
|
140
140
|
Uso:
|
|
141
141
|
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.15",
|
|
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",
|