@hiperplano/aluy-cli 1.0.0-rc.88 → 1.0.0-rc.89

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -1,5 +1,5 @@
1
1
  #!/usr/bin/env node
2
- var c8=Object.create;var ay=Object.defineProperty;var u8=Object.getOwnPropertyDescriptor;var d8=Object.getOwnPropertyNames;var m8=Object.getPrototypeOf,f8=Object.prototype.hasOwnProperty;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 p8=(t,e)=>()=>{try{return e||t((e={exports:{}}).exports,e),e.exports}catch(o){throw e=0,o}},ht=(t,e)=>{for(var o in e)ay(t,o,{get:e[o],enumerable:!0})},h8=(t,e,o,n)=>{if(e&&typeof e=="object"||typeof e=="function")for(let r of d8(e))!f8.call(t,r)&&r!==o&&ay(t,r,{get:()=>e[r],enumerable:!(n=u8(e,r))||n.enumerable});return t};var g8=(t,e,o)=>(o=t!=null?c8(m8(t)):{},h8(e||!t||!t.__esModule?ay(o,"default",{value:t,enumerable:!0}):o,t));import{homedir as y8}from"node:os";import{join as b8}from"node:path";function Vl(t=y8()){return b8(t,".aluy")}var Tm=p(()=>{"use strict"});var Xl,fC=p(()=>{"use strict";Xl="1.0.0-rc.88"});function _r(t,e){return t.decide(e)}var ai=p(()=>{"use strict"});var Gn,Rr,Or=p(()=>{"use strict";Gn="remember",Rr="recall"});var ly,v8,fa,cy=p(()=>{"use strict";ly=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}}},v8=200,fa=class{nodes=new Map;maxBoxes;now;constructor(e){this.maxBoxes=e?.maxBoxes??v8,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 ly(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 _m(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 gC(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"&&k8.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 u of l){let m=gC(u,!1);if(typeof m=="string")return m;c.push(m)}r=c}}}if(o===void 0||o.trim()==="")return S8;let s=o.trim().slice(0,x8);return r?{title:s,status:n,substeps:r}:{title:s,status:n}}function w8(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=gC(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(u=>({...u,title:r(u.title)}));o[i]=c!==void 0?{...a,title:l,substeps:c}:{...a,title:l}}let s=_m(o).length;return s>pC?{error:`update_plan: no m\xE1ximo ${pC} passos (recebidos ${s}).`}:{steps:o}}function E8(t){let e=_m(t),o=e.filter(r=>r.step.status==="completed").length,n=e.map(r=>`${" ".repeat(r.depth)}${yC[r.step.status]} ${r.step.title}`).join(`
2
+ var c8=Object.create;var ay=Object.defineProperty;var u8=Object.getOwnPropertyDescriptor;var d8=Object.getOwnPropertyNames;var m8=Object.getPrototypeOf,f8=Object.prototype.hasOwnProperty;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 p8=(t,e)=>()=>{try{return e||t((e={exports:{}}).exports,e),e.exports}catch(o){throw e=0,o}},ht=(t,e)=>{for(var o in e)ay(t,o,{get:e[o],enumerable:!0})},h8=(t,e,o,n)=>{if(e&&typeof e=="object"||typeof e=="function")for(let r of d8(e))!f8.call(t,r)&&r!==o&&ay(t,r,{get:()=>e[r],enumerable:!(n=u8(e,r))||n.enumerable});return t};var g8=(t,e,o)=>(o=t!=null?c8(m8(t)):{},h8(e||!t||!t.__esModule?ay(o,"default",{value:t,enumerable:!0}):o,t));import{homedir as y8}from"node:os";import{join as b8}from"node:path";function Vl(t=y8()){return b8(t,".aluy")}var Tm=p(()=>{"use strict"});var Xl,fC=p(()=>{"use strict";Xl="1.0.0-rc.89"});function _r(t,e){return t.decide(e)}var ai=p(()=>{"use strict"});var Gn,Rr,Or=p(()=>{"use strict";Gn="remember",Rr="recall"});var ly,v8,fa,cy=p(()=>{"use strict";ly=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}}},v8=200,fa=class{nodes=new Map;maxBoxes;now;constructor(e){this.maxBoxes=e?.maxBoxes??v8,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 ly(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 _m(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 gC(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"&&k8.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 u of l){let m=gC(u,!1);if(typeof m=="string")return m;c.push(m)}r=c}}}if(o===void 0||o.trim()==="")return S8;let s=o.trim().slice(0,x8);return r?{title:s,status:n,substeps:r}:{title:s,status:n}}function w8(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=gC(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(u=>({...u,title:r(u.title)}));o[i]=c!==void 0?{...a,title:l,substeps:c}:{...a,title:l}}let s=_m(o).length;return s>pC?{error:`update_plan: no m\xE1ximo ${pC} passos (recebidos ${s}).`}:{steps:o}}function E8(t){let e=_m(t),o=e.filter(r=>r.step.status==="completed").length,n=e.map(r=>`${" ".repeat(r.depth)}${yC[r.step.status]} ${r.step.title}`).join(`
3
3
  `);return`plano (${o}/${e.length}):
4
4
  ${n}`}function C8(t,e){return e<0?"m\xE9dio":t===e?"curto":t>e?"longo":"m\xE9dio"}function D8(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,u=o.get(i.title),m=u??fa.boxId(i.title,0);return u?(i.status!=="completed"&&e.isClosed(u)&&e.reopenBox(u),e.setHorizon(u,c),e.setParent(u,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=C8(a,n),c=r(i,null,l);for(let u of i.substeps??[])r(u,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 T8(t,e){if(!e)return E8(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,u=new Set)=>{let m=r.get(c);if(m!==void 0)return m;let d=n.get(c);if(!d||!d.parentId||u.has(c))return r.set(c,0),0;let h=s(d.parentId,new Set(u).add(c))+1;return r.set(c,h),h},i=_m(t),l=[`plano (${i.filter(c=>c.step.status==="completed").length}/${i.length}):`];for(let{step:c,depth:u}of i){let m=o.get(c.title),d=m?A8[m.horizon]:"",h=m?s(m.id):u,g=" ".repeat(h),b=yC[c.status];l.push(`${g}${d} ${b} ${c.title}`)}return l.join(`
5
5
  `)}var Jl,k8,pC,x8,S8,yC,A8,hC,_8,bC,Rm=p(()=>{"use strict";cy();Jl="update_plan";k8=new Set(["pending","in_progress","completed"]),pC=30,x8=120,S8="update_plan: cada passo precisa de um t\xEDtulo (texto) n\xE3o-vazio.";yC={pending:"\u2610",in_progress:"\u25B6",completed:"\u2611"};A8={longo:"[\u{1F4D0}]",m\u00E9dio:"[\u{1F4CB}]",curto:"[\u{1F4CC}]"};hC=Object.freeze({type:"string",enum:["pending","in_progress","completed"],description:"pending (a fazer) \xB7 in_progress (em curso) \xB7 completed (feito)."}),_8=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:hC,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:hC},required:["title"],additionalProperties:!1}}},required:["title"],additionalProperties:!1}}},required:["steps"],additionalProperties:!1}),bC={name:Jl,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:_8,async run(t,e){let o=w8(t);return"error"in o?{ok:!1,observation:o.error}:(e.graph&&D8(o.steps,e.graph),e.plan&&e.plan.set(_m(o.steps).map(r=>({title:r.step.title,status:r.step.status}))),{ok:!0,observation:T8(o.steps,e.graph)})}}});function vC(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)?O8(s):void 0;if(typeof i=="string")return{error:i};let a,l=t.kind??t.type;if(typeof l=="string"&&R8.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 O8(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 M8(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(`
@@ -154,7 +154,7 @@ ${t.trim()}`}}function kR(t,e,o=gu){let{older:n,recent:r}=Qf(t,o);if(n.length===
154
154
  `);let i=xo(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=ke(cn(),Ur),c=ke(l,Rn);et(l)&&_p(Op(),c)}catch{}t==="ollama"&&(await HG(),qG()),process.stderr.write(`
155
155
  verificando "${t}"\u2026 (alguns segundos; a pr\xF3xima etapa vem em seguida)
156
156
  `);let a=await zO(t,process.platform,!0);for(let l=0;l<BG&&!a;l++)await jG(UG),a=await zO(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 jG(t){return new Promise(e=>setTimeout(e,t))}async function HG(){for(let t of[_n,Mp()])try{await(await fetch(`http://${an}:${Zn}/api/pull`,{method:"POST",headers:{"content-type":"application/json"},body:JSON.stringify({name:t,stream:!1})})).text()}catch{}}function qG(){if(process.platform!=="win32")try{let t=xo("sh",["-lc","command -v ollama"],{encoding:"utf8",timeout:1e4});if(t.status===0&&(t.stdout??"").trim()!=="")return;let e=Rp(),n=["/usr/local/bin/ollama","/usr/bin/ollama","/opt/homebrew/bin/ollama",ke(e,".ollama","bin","ollama"),ke(cn(),Ss,"bin","ollama")].find(i=>et(i));if(n===void 0)return;let r=ke(e,".local","bin");Rx(r,{recursive:!0});let s=ke(r,"ollama");try{if(HO(s)===HO(n))return;xG(s)}catch{}try{kG(n,s)}catch{}}catch{}}function WG(){try{return xo("python3",["-m","venv","--help"],{timeout:1e4}).status===0}catch{return!1}}function GG(){try{return xo("python3",["-m","pip","--version"],{timeout:1e4}).status===0}catch{return!1}}function zG(t){let e=[],o=[];if(t.has("ollama")&&(YO()||(e.push("zstd (extrair o Ollama)"),o.push("zstd")),VO()||(e.push("tar (extrair o Ollama)"),o.push("tar"))),t.has("mem0")||t.has("headroom")){let r=Mx();r.ok?(WG()||(e.push("m\xF3dulo venv do Python (mem0/headroom criam um virtualenv)"),o.push("python3-venv")),GG()||(e.push("pip do Python (mem0/headroom instalam pacotes)"),o.push("python3-pip"))):(e.push(`python3 >= ${vu} 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 JO(t,e,o){let n=t??"turbo",r=jr(e??{}),s=o?.useAgent!==!1,i=new _x({...o?.platform?{platform:o.platform}:{},...s?{agentInstaller:$G}:{}});if(!s)for(let a of zG(r))process.stderr.write(a+`
157
- `);return i.provisionAll(n,r)}var KO,Ya,AG,Rn,WO,_x,GO,IG,BG,UG,Lx=p(()=>{"use strict";P();KO=".aluy",Ya=448,AG=384;Rn="aluy-mem0-server.py";WO="application/vnd.ollama.image.model";_x=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=ke(cn(),Ss,"bin","ollama");return et(o)}case"mem0":{let o=ke(cn(),Ur,"bin","python3");return et(o)&&Fu(o)}case"headroom":{let o=ke(cn(),ws,"bin","headroom");return et(o)}default:return!1}}async provision(e,o){let n=wG().uid;if(Wk(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 RG();case"mem0":return PG();case"headroom":return FG();default:return{target:e,hashOk:!1,installed:!1,message:`Alvo desconhecido: ${String(e)}`}}}async provisionAll(e,o){if(!xu(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(u){let m=u instanceof Error?u.message:String(u);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}}},GO="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",IG="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. ";BG=24,UG=5e3});var tr,Iu=p(()=>{"use strict";tr="1.0.0-rc.88"});var oM={};ht(oM,{HELP_TEXT:()=>ZO,parseArgs:()=>Px,suggestFlag:()=>JG,versionText:()=>eM});function dt(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 KG(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 eM(){return`aluy ${tr} (@hiperplano/aluy-cli-core ${Xl})`}function XG(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 JG(t){let e,o=3;for(let n of tM){let r=XG(t,n);r<o&&(o=r,e=n)}return e}function QG(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===""||tM.has(s)||o.push(`--${s}`)}return o}function Px(t){let e=t[0];if(e==="login"&&!t.includes("-h")&&!t.includes("--help")){let W=t.slice(1),pe=dt(W,"token"),ho=dt(W,"org"),Wt=W.includes("--device"),Ro=dt(W,"provider"),jn=W.includes("--oauth");return{kind:"login",forceDeviceFlow:Wt,...pe!==void 0?{token:pe}:{},...ho!==void 0?{org:ho}:{},...Ro!==void 0?{provider:Ro}:{},...jn?{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"),pe=t.includes("--json");return{kind:"doctor",deep:W,json:pe}}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"),pe=t.findIndex(Wt=>Wt==="--backend"||Wt.startsWith("--backend=")),ho="both";if(pe!==-1){let Ro=(t[pe].includes("=")?t[pe].slice(10):t[pe+1]??"").trim().toLowerCase();Ro==="local"?ho="local":Ro==="broker"&&(ho="broker")}return{kind:"models",scope:ho,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 ho=t.slice(2);if(W==="login"){let Wt=dt(ho,"token");return{kind:"telegram",sub:"login",...Wt!==void 0?{token:Wt}:{}}}if(W==="allow"||W==="deny"){let Wt=ho.find(jn=>!jn.startsWith("-")),Ro=Wt!==void 0&&/^-?\d+$/.test(Wt)?Number(Wt):void 0;return Ro===void 0?{kind:"usage-error",message:`uso: aluy telegram ${W} <chat-id> (um inteiro)`,exitCode:2}:{kind:"telegram",sub:W,chatId:Ro}}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(pe=>!pe.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:eM()};if(t.includes("-h")||t.includes("--help"))return{kind:"help",text:ZO};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("--telegram"),c=t.includes("--split")||t.includes("--view")?!0:void 0,u=t.includes("--fullscreen")||t.includes("--cockpit")?!0:void 0,m=t.includes("--no-budget")?!1:t.includes("--budget")?!0:void 0,d=dt(t,"tier"),h=dt(t,"lang"),g=dt(t,"max-tokens"),b=dt(t,"max-iterations"),y=dt(t,"max-output-tokens"),w=!(t.includes("--no-subagents")||t.includes("--no-subagent")),E=t.includes("--no-self-check")?"0":t.includes("--self-check")?"1":void 0,C=t.includes("--no-autocompact")?"off":dt(t,"autocompact-at"),M=t.includes("--quiet")?!0:void 0,B=t.includes("--cycle")?!0:void 0,q=dt(t,"cycles"),Y=dt(t,"cycle-for"),z=dt(t,"backend"),U=dt(t,"local-provider"),Z=dt(t,"local-model"),te=dt(t,"local-auth"),ee=dt(t,"local-base-url"),L=dt(t,"model"),j=dt(t,"provider");if((t.includes("--provider")||t.some(W=>W.startsWith("--provider=")))&&(L===void 0||L.trim()===""))return{kind:"usage-error",message:"aluy: --provider exige --model (ex.: --provider <provider> --model <slug>)",exitCode:2};if((L===void 0||L.trim()==="")&&d!==void 0&&d.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 le=dt(t,"effort"),he=t.includes("--effort")||t.some(W=>W.startsWith("--effort=")),se;if(le!==void 0){if(le.trim()==="")return{kind:"usage-error",message:"aluy: --effort requer um valor (ex.: --effort low)",exitCode:2};if(le.length>32)return{kind:"usage-error",message:"aluy: --effort aceita no m\xE1ximo 32 caracteres",exitCode:2};se=le}else if(he)return{kind:"usage-error",message:"aluy: --effort requer um valor (ex.: --effort low)",exitCode:2};let me=t.includes("-p")||t.includes("--print")||t.includes("--exec")||t.some(W=>W.startsWith("-p=")||W.startsWith("--print=")||W.startsWith("--exec=")),O=me?dt(t,"print",{allowDashValue:!0})??dt(t,"exec",{allowDashValue:!0})??KG(t,"p")??void 0:void 0,ue=me?dt(t,"output-format"):void 0;if(ue!==void 0&&!["text","json","stream-json"].includes(ue.trim()))return{kind:"usage-error",message:`aluy: --output-format inv\xE1lido "${ue}" (use text | json | stream-json)`,exitCode:2};let V=t.includes("--new"),ie=t.includes("--continue"),be=t.indexOf("--resume"),ct=t.find(W=>W.startsWith("--resume=")),Ce=be>=0||ct!==void 0,Xe;if(ct!==void 0)Xe=ct.slice(9);else if(be>=0){let W=t[be+1];W!==void 0&&!W.startsWith("-")&&(Xe=W)}let kt=d!==void 0?t.indexOf("--tier")+1:-1,vt=h!==void 0&&!t.some(W=>W.startsWith("--lang="))?t.indexOf("--lang")+1:-1,it=Xe!==void 0&&ct===void 0?be+1:-1,Rt=g!==void 0&&!t.some(W=>W.startsWith("--max-tokens="))?t.indexOf("--max-tokens")+1:-1,K=b!==void 0&&!t.some(W=>W.startsWith("--max-iterations="))?t.indexOf("--max-iterations")+1:-1,Se=q!==void 0&&!t.some(W=>W.startsWith("--cycles="))?t.indexOf("--cycles")+1:-1,Pe=Y!==void 0&&!t.some(W=>W.startsWith("--cycle-for="))?t.indexOf("--cycle-for")+1:-1,H=y!==void 0&&!t.some(W=>W.startsWith("--max-output-tokens="))?t.indexOf("--max-output-tokens")+1:-1,jt=C!==void 0&&!t.includes("--no-autocompact")&&!t.some(W=>W.startsWith("--autocompact-at="))?t.indexOf("--autocompact-at")+1:-1,_o=z!==void 0&&!t.some(W=>W.startsWith("--backend="))?t.indexOf("--backend")+1:-1,k=(W,pe)=>pe!==void 0&&!t.some(ho=>ho.startsWith(`--${W}=`))?t.indexOf(`--${W}`)+1:-1,po=k("local-provider",U),Ot=k("local-model",Z),xt=k("local-auth",te),as=k("local-base-url",ee),ls=L!==void 0&&!t.some(W=>W.startsWith("--model="))?t.indexOf("--model")+1:-1,wr=j!==void 0&&!t.some(W=>W.startsWith("--provider="))?t.indexOf("--provider")+1:-1,Er=se!==void 0&&!t.some(W=>W.startsWith("--effort="))?t.indexOf("--effort")+1:-1,Ht=ue!==void 0&&!t.some(W=>W.startsWith("--output-format="))?t.indexOf("--output-format")+1:-1,qt=O!==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,Zo=t.find((W,pe)=>!W.startsWith("-")&&pe!==kt&&pe!==vt&&pe!==_o&&pe!==po&&pe!==Ot&&pe!==xt&&pe!==as&&pe!==ls&&pe!==wr&&pe!==Er&&pe!==Ht&&pe!==qt&&pe!==it&&pe!==Rt&&pe!==K&&pe!==H&&pe!==jt&&pe!==Se&&pe!==Pe),jo=(O??Zo??"").trim();if(jo!==""&&!/\s/.test(jo)&&VG.has(jo.toLowerCase()))return{kind:"usage-error",message:`aluy: "${jo}" \xE9 um comando de SESS\xC3O, n\xE3o um objetivo. Use /${jo} DENTRO do aluy (rode \`aluy\` sem argumentos), ou veja \`aluy --help\`. Se voc\xEA quis MESMO um objetivo com essa palavra, d\xEA mais contexto (ex.: \`aluy "${jo} o arquivo X"\`).`,exitCode:2};let us=ie?{kind:"continue"}:Ce?{kind:"resume",...Xe!==void 0?{id:Xe}:{}}:void 0,xn=new Set([kt,vt,_o,po,Ot,xt,as,ls,wr,Er,Ht,qt,it,Rt,K,H,jt,Se,Pe].filter(W=>W>=0));for(let W of YG){let pe=t.indexOf(W);pe>=0&&!t[pe].includes("=")&&xn.add(pe+1)}let oi=QG(t,xn);return{kind:"launch",mode:s,unsafe:s==="unsafe",unsafeAliasUsed:n,...oi.length>0?{unknownFlags:oi}:{},dense:i,fresh:V,subAgents:w,safeGlyphs:a,telegram:l,print:me,...c!==void 0?{split:c}:{},...u!==void 0?{fullscreen:u}:{},...m!==void 0?{budget:m}:{},...Zo!==void 0?{goal:Zo}:{},...d!==void 0?{tier:d}:{},...z!==void 0?{backend:z}:{},...U!==void 0?{localProvider:U}:{},...Z!==void 0?{localModel:Z}:{},...te!==void 0?{localAuth:te}:{},...ee!==void 0?{localBaseUrl:ee}:{},...L!==void 0?{model:L}:{},...j!==void 0?{provider:j}:{},...se!==void 0?{effort:se}:{},...O!==void 0?{printArg:O}:{},...ue!==void 0?{outputFormat:ue}:{},...h!==void 0?{lang:h}:{},...us!==void 0?{resume:us}:{},...g!==void 0?{maxTokens:g}:{},...b!==void 0?{maxIterations:b}:{},...y!==void 0?{maxOutputTokens:y}:{},...E!==void 0?{selfCheck:E}:{},...C!==void 0?{autoCompactAt:C}:{},...M!==void 0?{quiet:M}:{},...B!==void 0?{cycle:B}:{},...q!==void 0?{cycles:q}:{},...Y!==void 0?{cycleFor:Y}:{}}}var ZO,tM,YG,VG,Fx=p(()=>{"use strict";P();Iu();ZO=`aluy \u2014 agente de terminal que roda na sua m\xE1quina, com o seu provider de LLM
157
+ `);return i.provisionAll(n,r)}var KO,Ya,AG,Rn,WO,_x,GO,IG,BG,UG,Lx=p(()=>{"use strict";P();KO=".aluy",Ya=448,AG=384;Rn="aluy-mem0-server.py";WO="application/vnd.ollama.image.model";_x=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=ke(cn(),Ss,"bin","ollama");return et(o)}case"mem0":{let o=ke(cn(),Ur,"bin","python3");return et(o)&&Fu(o)}case"headroom":{let o=ke(cn(),ws,"bin","headroom");return et(o)}default:return!1}}async provision(e,o){let n=wG().uid;if(Wk(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 RG();case"mem0":return PG();case"headroom":return FG();default:return{target:e,hashOk:!1,installed:!1,message:`Alvo desconhecido: ${String(e)}`}}}async provisionAll(e,o){if(!xu(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(u){let m=u instanceof Error?u.message:String(u);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}}},GO="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",IG="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. ";BG=24,UG=5e3});var tr,Iu=p(()=>{"use strict";tr="1.0.0-rc.89"});var oM={};ht(oM,{HELP_TEXT:()=>ZO,parseArgs:()=>Px,suggestFlag:()=>JG,versionText:()=>eM});function dt(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 KG(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 eM(){return`aluy ${tr} (@hiperplano/aluy-cli-core ${Xl})`}function XG(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 JG(t){let e,o=3;for(let n of tM){let r=XG(t,n);r<o&&(o=r,e=n)}return e}function QG(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===""||tM.has(s)||o.push(`--${s}`)}return o}function Px(t){let e=t[0];if(e==="login"&&!t.includes("-h")&&!t.includes("--help")){let W=t.slice(1),pe=dt(W,"token"),ho=dt(W,"org"),Wt=W.includes("--device"),Ro=dt(W,"provider"),jn=W.includes("--oauth");return{kind:"login",forceDeviceFlow:Wt,...pe!==void 0?{token:pe}:{},...ho!==void 0?{org:ho}:{},...Ro!==void 0?{provider:Ro}:{},...jn?{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"),pe=t.includes("--json");return{kind:"doctor",deep:W,json:pe}}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"),pe=t.findIndex(Wt=>Wt==="--backend"||Wt.startsWith("--backend=")),ho="both";if(pe!==-1){let Ro=(t[pe].includes("=")?t[pe].slice(10):t[pe+1]??"").trim().toLowerCase();Ro==="local"?ho="local":Ro==="broker"&&(ho="broker")}return{kind:"models",scope:ho,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 ho=t.slice(2);if(W==="login"){let Wt=dt(ho,"token");return{kind:"telegram",sub:"login",...Wt!==void 0?{token:Wt}:{}}}if(W==="allow"||W==="deny"){let Wt=ho.find(jn=>!jn.startsWith("-")),Ro=Wt!==void 0&&/^-?\d+$/.test(Wt)?Number(Wt):void 0;return Ro===void 0?{kind:"usage-error",message:`uso: aluy telegram ${W} <chat-id> (um inteiro)`,exitCode:2}:{kind:"telegram",sub:W,chatId:Ro}}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(pe=>!pe.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:eM()};if(t.includes("-h")||t.includes("--help"))return{kind:"help",text:ZO};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("--telegram"),c=t.includes("--split")||t.includes("--view")?!0:void 0,u=t.includes("--fullscreen")||t.includes("--cockpit")?!0:void 0,m=t.includes("--no-budget")?!1:t.includes("--budget")?!0:void 0,d=dt(t,"tier"),h=dt(t,"lang"),g=dt(t,"max-tokens"),b=dt(t,"max-iterations"),y=dt(t,"max-output-tokens"),w=!(t.includes("--no-subagents")||t.includes("--no-subagent")),E=t.includes("--no-self-check")?"0":t.includes("--self-check")?"1":void 0,C=t.includes("--no-autocompact")?"off":dt(t,"autocompact-at"),M=t.includes("--quiet")?!0:void 0,B=t.includes("--cycle")?!0:void 0,q=dt(t,"cycles"),Y=dt(t,"cycle-for"),z=dt(t,"backend"),U=dt(t,"local-provider"),Z=dt(t,"local-model"),te=dt(t,"local-auth"),ee=dt(t,"local-base-url"),L=dt(t,"model"),j=dt(t,"provider");if((t.includes("--provider")||t.some(W=>W.startsWith("--provider=")))&&(L===void 0||L.trim()===""))return{kind:"usage-error",message:"aluy: --provider exige --model (ex.: --provider <provider> --model <slug>)",exitCode:2};if((L===void 0||L.trim()==="")&&d!==void 0&&d.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 le=dt(t,"effort"),he=t.includes("--effort")||t.some(W=>W.startsWith("--effort=")),se;if(le!==void 0){if(le.trim()==="")return{kind:"usage-error",message:"aluy: --effort requer um valor (ex.: --effort low)",exitCode:2};if(le.length>32)return{kind:"usage-error",message:"aluy: --effort aceita no m\xE1ximo 32 caracteres",exitCode:2};se=le}else if(he)return{kind:"usage-error",message:"aluy: --effort requer um valor (ex.: --effort low)",exitCode:2};let me=t.includes("-p")||t.includes("--print")||t.includes("--exec")||t.some(W=>W.startsWith("-p=")||W.startsWith("--print=")||W.startsWith("--exec=")),O=me?dt(t,"print",{allowDashValue:!0})??dt(t,"exec",{allowDashValue:!0})??KG(t,"p")??void 0:void 0,ue=me?dt(t,"output-format"):void 0;if(ue!==void 0&&!["text","json","stream-json"].includes(ue.trim()))return{kind:"usage-error",message:`aluy: --output-format inv\xE1lido "${ue}" (use text | json | stream-json)`,exitCode:2};let V=t.includes("--new"),ie=t.includes("--continue"),be=t.indexOf("--resume"),ct=t.find(W=>W.startsWith("--resume=")),Ce=be>=0||ct!==void 0,Xe;if(ct!==void 0)Xe=ct.slice(9);else if(be>=0){let W=t[be+1];W!==void 0&&!W.startsWith("-")&&(Xe=W)}let kt=d!==void 0?t.indexOf("--tier")+1:-1,vt=h!==void 0&&!t.some(W=>W.startsWith("--lang="))?t.indexOf("--lang")+1:-1,it=Xe!==void 0&&ct===void 0?be+1:-1,Rt=g!==void 0&&!t.some(W=>W.startsWith("--max-tokens="))?t.indexOf("--max-tokens")+1:-1,K=b!==void 0&&!t.some(W=>W.startsWith("--max-iterations="))?t.indexOf("--max-iterations")+1:-1,Se=q!==void 0&&!t.some(W=>W.startsWith("--cycles="))?t.indexOf("--cycles")+1:-1,Pe=Y!==void 0&&!t.some(W=>W.startsWith("--cycle-for="))?t.indexOf("--cycle-for")+1:-1,H=y!==void 0&&!t.some(W=>W.startsWith("--max-output-tokens="))?t.indexOf("--max-output-tokens")+1:-1,jt=C!==void 0&&!t.includes("--no-autocompact")&&!t.some(W=>W.startsWith("--autocompact-at="))?t.indexOf("--autocompact-at")+1:-1,_o=z!==void 0&&!t.some(W=>W.startsWith("--backend="))?t.indexOf("--backend")+1:-1,k=(W,pe)=>pe!==void 0&&!t.some(ho=>ho.startsWith(`--${W}=`))?t.indexOf(`--${W}`)+1:-1,po=k("local-provider",U),Ot=k("local-model",Z),xt=k("local-auth",te),as=k("local-base-url",ee),ls=L!==void 0&&!t.some(W=>W.startsWith("--model="))?t.indexOf("--model")+1:-1,wr=j!==void 0&&!t.some(W=>W.startsWith("--provider="))?t.indexOf("--provider")+1:-1,Er=se!==void 0&&!t.some(W=>W.startsWith("--effort="))?t.indexOf("--effort")+1:-1,Ht=ue!==void 0&&!t.some(W=>W.startsWith("--output-format="))?t.indexOf("--output-format")+1:-1,qt=O!==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,Zo=t.find((W,pe)=>!W.startsWith("-")&&pe!==kt&&pe!==vt&&pe!==_o&&pe!==po&&pe!==Ot&&pe!==xt&&pe!==as&&pe!==ls&&pe!==wr&&pe!==Er&&pe!==Ht&&pe!==qt&&pe!==it&&pe!==Rt&&pe!==K&&pe!==H&&pe!==jt&&pe!==Se&&pe!==Pe),jo=(O??Zo??"").trim();if(jo!==""&&!/\s/.test(jo)&&VG.has(jo.toLowerCase()))return{kind:"usage-error",message:`aluy: "${jo}" \xE9 um comando de SESS\xC3O, n\xE3o um objetivo. Use /${jo} DENTRO do aluy (rode \`aluy\` sem argumentos), ou veja \`aluy --help\`. Se voc\xEA quis MESMO um objetivo com essa palavra, d\xEA mais contexto (ex.: \`aluy "${jo} o arquivo X"\`).`,exitCode:2};let us=ie?{kind:"continue"}:Ce?{kind:"resume",...Xe!==void 0?{id:Xe}:{}}:void 0,xn=new Set([kt,vt,_o,po,Ot,xt,as,ls,wr,Er,Ht,qt,it,Rt,K,H,jt,Se,Pe].filter(W=>W>=0));for(let W of YG){let pe=t.indexOf(W);pe>=0&&!t[pe].includes("=")&&xn.add(pe+1)}let oi=QG(t,xn);return{kind:"launch",mode:s,unsafe:s==="unsafe",unsafeAliasUsed:n,...oi.length>0?{unknownFlags:oi}:{},dense:i,fresh:V,subAgents:w,safeGlyphs:a,telegram:l,print:me,...c!==void 0?{split:c}:{},...u!==void 0?{fullscreen:u}:{},...m!==void 0?{budget:m}:{},...Zo!==void 0?{goal:Zo}:{},...d!==void 0?{tier:d}:{},...z!==void 0?{backend:z}:{},...U!==void 0?{localProvider:U}:{},...Z!==void 0?{localModel:Z}:{},...te!==void 0?{localAuth:te}:{},...ee!==void 0?{localBaseUrl:ee}:{},...L!==void 0?{model:L}:{},...j!==void 0?{provider:j}:{},...se!==void 0?{effort:se}:{},...O!==void 0?{printArg:O}:{},...ue!==void 0?{outputFormat:ue}:{},...h!==void 0?{lang:h}:{},...us!==void 0?{resume:us}:{},...g!==void 0?{maxTokens:g}:{},...b!==void 0?{maxIterations:b}:{},...y!==void 0?{maxOutputTokens:y}:{},...E!==void 0?{selfCheck:E}:{},...C!==void 0?{autoCompactAt:C}:{},...M!==void 0?{quiet:M}:{},...B!==void 0?{cycle:B}:{},...q!==void 0?{cycles:q}:{},...Y!==void 0?{cycleFor:Y}:{}}}var ZO,tM,YG,VG,Fx=p(()=>{"use strict";P();Iu();ZO=`aluy \u2014 agente de terminal que roda na sua m\xE1quina, com o seu provider de LLM
158
158
 
159
159
  Uso:
160
160
  aluy ["objetivo"] [--plan | --yolo] [--dense] [--tier <tier>] [--lang <pt-BR|en>]
@@ -492,9 +492,9 @@ ${Tn(w)}`}}catch(g){let b=u?`o proxy n\xE3o respondeu em ${m}ms (timeout)`:g ins
492
492
  `,r=`${this.file}.tmp-${process.pid}-${Date.now().toString(36)}`,s=a7(r,AS.O_CREAT|AS.O_EXCL|AS.O_WRONLY,p7);try{l7(s,n,0,"utf8")}finally{c7(s)}try{d7(r,this.file)}catch(i){try{m7(r)}catch{}throw i}}ensureDir(e){let o=sl(e),n=sl(o);vP(n)||bP(n,{recursive:!0});for(let r of[o,e])try{bP(r,{mode:f7})}catch(s){if(s.code!=="EEXIST")throw s}}}});import{writeFileSync as v7,rmSync as k7,readFileSync as x7,existsSync as S7}from"node:fs";var cd,ud,xP=p(()=>{"use strict";cd=class{workspace;constructor(e){this.workspace=e.workspace}async writeConfined(e,o){let n=this.workspace.resolveInside(e);return v7(n,o,"utf8"),n}async removeConfined(e){let o=this.workspace.resolveInside(e);return k7(o,{force:!0}),o}},ud=class{workspace;constructor(e){this.workspace=e.workspace}async readCurrent(e){let o;try{o=this.workspace.resolveInside(e)}catch{return}if(S7(o))return x7(o,"utf8")}}});function E7(t){if(t===void 0)return!1;let e=t.trim().toLowerCase();return e==="0"||e==="false"||e==="off"||e==="no"}function CS(t=process.env){let e=!E7(t.ALUY_NOTIFY),o=t.NO_COLOR===void 0;return{enabled:e,desktop:o}}var w7,SP,dd,DS=p(()=>{"use strict";w7="\x1B]9;",SP={attention:"Aluy precisa de voc\xEA",done:"Aluy \u2014 turno conclu\xEDdo"},dd=class{write;isTty;desktop;on;constructor(e){this.write=e.write,this.isTty=e.isTty??!1,this.desktop=e.desktop??!0,this.on=e.enabled??!0}get enabled(){return this.on&&this.isTty}setEnabled(e){this.on=e}notify(e){if(!this.enabled)return;let o=SP[e];try{this.write("\x07"),this.desktop&&this.write(`${w7}${o}\x07`)}catch{}}}});async function A7(t,e){let{workspace:o,fs:n}=e;try{o.resolveInside(t)}catch{return}if(No(t).kind!=="allow"||!await n.exists(t))return;let r;try{r=await n.readFile(t)}catch{return}return pf(r)}async function TS(t){let e=[];for(let r of wP){let s=await A7(r,t);s!==void 0&&e.push({filename:r,text:s})}if(e.length===0)return{sources:[]};if(e.length===1)return{instructions:e[0].text,sources:[e[0].filename]};let o=e.map(r=>`<!-- fonte: ${r.filename} -->
493
493
  ${r.text}`).join(`
494
494
 
495
- `),n=pf(o);return{...n!==void 0?{instructions:n}:{},sources:e.map(r=>r.filename)}}var Ni,wP,_S=p(()=>{"use strict";P();Ls();Ni="ALUY.md",wP=["ALUY.md","AGENT.md","AGENTS.md","CLAUDE.md"]});import{homedir as C7}from"node:os";import{join as RS,basename as D7}from"node:path";import{openSync as T7,writeSync as _7,closeSync as EP,mkdirSync as R7,renameSync as O7,unlinkSync as M7,constants as OS}from"node:fs";function I7(t,e){if(t===void 0||t.trim()==="")return e;let o=D7(t.trim());return o=o.replace(/[-/\\]/g,""),o===""||o==="."||o===".."?e:(/\.md$/i.test(o)||(o+=".md"),o)}function N7(t){return t.toISOString().replace(/[:.]/g,"-").replace(/-\d{3}Z$/,"Z")}var L7,P7,AP,F7,md,CP=p(()=>{"use strict";L7=448,P7=384,AP="exports",F7=(t,e,o)=>_7(t,e,o,e.length-o);md=class{base;now;writeChunk;constructor(e={}){this.base=RS(e.baseDir??RS(C7(),".aluy"),AP),this.now=e.now??(()=>new Date),this.writeChunk=e.writeChunk??F7}get dir(){return this.base}write(e,o={}){let n=`${(o.sessionId??"sessao").slice(0,40)}-${N7(this.now())}.md`,r=I7(o.fileName,n),s=RS(this.base,r),i=`${s}.${process.pid}.tmp`,a;try{R7(this.base,{recursive:!0,mode:L7}),a=T7(i,OS.O_CREAT|OS.O_EXCL|OS.O_WRONLY,P7);let l=Buffer.from(e,"utf8"),c=0;for(;c<l.length;){let u=this.writeChunk(a,l,c);if(u<=0)throw new Error(`escrita parou em ${c}/${l.length} bytes (writeSync devolveu ${u})`);c+=u}return EP(a),a=void 0,O7(i,s),{ok:!0,path:s}}catch(l){if(a!==void 0)try{EP(a)}catch{}try{M7(i)}catch{}return{ok:!1,error:`falha ao exportar: ${String(l)}`}}}}});function Dt(t){return typeof t=="string"}function DP(t){return typeof t=="number"&&Number.isInteger(t)&&t>=0}function B7(t){return Array.isArray(t)&&t.every(e=>typeof e=="string")}function U7(t){return t==="ok"||t==="warn"||t==="fail"?t:"warn"}function j7(t){if(typeof t!="object"||t===null)return null;let e=t;return!Dt(e.id)||!Dt(e.label)?null:{id:e.id,label:e.label,status:U7(e.status),...Dt(e.detail)?{detail:e.detail}:{},...Dt(e.fix)?{fix:e.fix}:{}}}function TP(t){if(typeof t!="object"||t===null)return null;let e=t,o=e.kind;if(typeof o!="string"||!$7.has(o))return null;switch(o){case"you":return Dt(e.text)?{kind:"you",text:e.text}:null;case"aluy":return Dt(e.text)?{kind:"aluy",text:e.text,streaming:!1}:null;case"tool":{if(!Dt(e.verb)||!Dt(e.target)||!Dt(e.result))return null;let n=e.status==="ok"||e.status==="err"?e.status:"err";return{kind:"tool",verb:e.verb,target:e.target,result:e.result,status:n,...Dt(e.output)?{output:e.output}:{},...Dt(e.verbGerund)?{verbGerund:e.verbGerund}:{},...DP(e.added)?{added:e.added}:{},...DP(e.removed)?{removed:e.removed}:{}}}case"deny":return Dt(e.verb)&&Dt(e.exact)?{kind:"deny",verb:e.verb,exact:e.exact}:null;case"bang":{if(!Dt(e.command))return null;let n=e.status==="ok"||e.status==="err"||e.status==="blocked"?e.status:"err";return{kind:"bang",command:e.command,status:n,...Dt(e.output)?{output:e.output}:{}}}case"broker-error":return Dt(e.message)?{kind:"broker-error",message:e.message,...typeof e.status=="number"?{status:e.status}:{}}:null;case"note":return Dt(e.title)&&B7(e.lines)?{kind:"note",title:e.title,lines:e.lines}:null;case"inject":return Dt(e.text)?{kind:"inject",text:e.text}:null;case"doctor":{if(!Array.isArray(e.checks))return null;let n=e.checks.map(j7).filter(r=>r!==null);return n.length===0?null:{kind:"doctor",checks:n,...Dt(e.summary)?{summary:e.summary}:{}}}default:return null}}function fh(t){if(!Array.isArray(t))return[];let e=[];for(let o of t){let n=TP(o);n&&e.push(n)}return e}function $i(t){let e=[];for(let o of t)switch(o.kind){case"you":e.push({role:"goal",text:o.text});break;case"aluy":o.text.trim()!==""&&e.push({role:"model",text:o.text});break;case"tool":{let n=[`${o.verb} ${o.target} \u2192 ${o.result||o.status}`];o.output&&n.push(o.output),e.push({role:"observation",toolName:MS,text:n.join(`
495
+ `),n=pf(o);return{...n!==void 0?{instructions:n}:{},sources:e.map(r=>r.filename)}}var Ni,wP,_S=p(()=>{"use strict";P();Ls();Ni="ALUY.md",wP=["ALUY.md","AGENT.md","AGENTS.md","CLAUDE.md"]});import{homedir as C7}from"node:os";import{join as RS,basename as D7}from"node:path";import{openSync as T7,writeSync as _7,closeSync as EP,mkdirSync as R7,renameSync as O7,unlinkSync as M7,constants as OS}from"node:fs";function I7(t,e){if(t===void 0||t.trim()==="")return e;let o=D7(t.trim());return o=o.replace(/[-/\\]/g,""),o===""||o==="."||o===".."?e:(/\.md$/i.test(o)||(o+=".md"),o)}function N7(t){return t.toISOString().replace(/[:.]/g,"-").replace(/-\d{3}Z$/,"Z")}var L7,P7,AP,F7,md,CP=p(()=>{"use strict";L7=448,P7=384,AP="exports",F7=(t,e,o)=>_7(t,e,o,e.length-o);md=class{base;now;writeChunk;constructor(e={}){this.base=RS(e.baseDir??RS(C7(),".aluy"),AP),this.now=e.now??(()=>new Date),this.writeChunk=e.writeChunk??F7}get dir(){return this.base}write(e,o={}){let n=`${(o.sessionId??"sessao").slice(0,40)}-${N7(this.now())}.md`,r=I7(o.fileName,n),s=RS(this.base,r),i=`${s}.${process.pid}.tmp`,a;try{R7(this.base,{recursive:!0,mode:L7}),a=T7(i,OS.O_CREAT|OS.O_EXCL|OS.O_WRONLY,P7);let l=Buffer.from(e,"utf8"),c=0;for(;c<l.length;){let u=this.writeChunk(a,l,c);if(u<=0)throw new Error(`escrita parou em ${c}/${l.length} bytes (writeSync devolveu ${u})`);c+=u}return EP(a),a=void 0,O7(i,s),{ok:!0,path:s}}catch(l){if(a!==void 0)try{EP(a)}catch{}try{M7(i)}catch{}return{ok:!1,error:`falha ao exportar: ${String(l)}`}}}}});function Dt(t){return typeof t=="string"}function DP(t){return typeof t=="number"&&Number.isInteger(t)&&t>=0}function B7(t){return Array.isArray(t)&&t.every(e=>typeof e=="string")}function U7(t){return t==="ok"||t==="warn"||t==="fail"?t:"warn"}function j7(t){if(typeof t!="object"||t===null)return null;let e=t;return!Dt(e.id)||!Dt(e.label)?null:{id:e.id,label:e.label,status:U7(e.status),...Dt(e.detail)?{detail:e.detail}:{},...Dt(e.fix)?{fix:e.fix}:{}}}function TP(t){if(typeof t!="object"||t===null)return null;let e=t,o=e.kind;if(typeof o!="string"||!$7.has(o))return null;switch(o){case"you":return Dt(e.text)?{kind:"you",text:e.text}:null;case"aluy":return Dt(e.text)?{kind:"aluy",text:e.text,streaming:!1}:null;case"tool":{if(!Dt(e.verb)||!Dt(e.target)||!Dt(e.result))return null;let n=e.status==="ok"||e.status==="err"?e.status:"err";return{kind:"tool",verb:e.verb,target:e.target,result:e.result,status:n,...Dt(e.output)?{output:e.output}:{},...Dt(e.verbGerund)?{verbGerund:e.verbGerund}:{},...DP(e.added)?{added:e.added}:{},...DP(e.removed)?{removed:e.removed}:{}}}case"deny":return Dt(e.verb)&&Dt(e.exact)?{kind:"deny",verb:e.verb,exact:e.exact}:null;case"bang":{if(!Dt(e.command))return null;let n=e.status==="ok"||e.status==="err"||e.status==="blocked"?e.status:"err";return{kind:"bang",command:e.command,status:n,...Dt(e.output)?{output:e.output}:{}}}case"broker-error":return Dt(e.message)?{kind:"broker-error",message:e.message,...typeof e.status=="number"?{status:e.status}:{}}:null;case"note":return Dt(e.title)&&B7(e.lines)?{kind:"note",title:e.title,lines:e.lines}:null;case"inject":return Dt(e.text)?{kind:"inject",text:e.text}:null;case"doctor":{if(!Array.isArray(e.checks))return null;let n=e.checks.map(j7).filter(r=>r!==null);return n.length===0?null:{kind:"doctor",checks:n,...Dt(e.summary)?{summary:e.summary}:{}}}default:return null}}function fh(t){if(!Array.isArray(t))return[];let e=[];for(let o of t){let n=TP(o);n&&e.push(n)}return e}function $i(t){let e=[];for(let o of t)switch(o.kind){case"you":e.push({role:"goal",text:o.text});break;case"inject":o.text.trim()!==""&&e.push({role:"goal",text:o.text});break;case"aluy":o.text.trim()!==""&&e.push({role:"model",text:o.text});break;case"tool":{let n=[`${o.verb} ${o.target} \u2192 ${o.result||o.status}`];o.output&&n.push(o.output),e.push({role:"observation",toolName:MS,text:n.join(`
496
496
  `)});break}case"bang":{let n=[`! ${o.command} (${o.status})`];o.output&&n.push(o.output),e.push({role:"observation",toolName:MS,text:n.join(`
497
- `)});break}case"broker-error":e.push({role:"observation",toolName:MS,text:`(${o.backend==="local"?"erro do provider local":"erro de broker"} anterior: ${o.message})`});break;case"note":case"deny":case"subagents":case"doctor":case"inject":break}return e}var $7,MS,LS=p(()=>{"use strict";$7=new Set(["you","aluy","tool","deny","bang","broker-error","note","inject","doctor"]);MS="sess\xE3o-anterior"});function W7(t){return t.kind==="tool"&&q7.has(t.verb)}function _P(t){let e=!1,o=t.map(n=>{if(n.kind==="tool"&&W7(n)){let r=Ze(n.result),s=n.output!==void 0?Ze(n.output):void 0,i=n.liveOutput!==void 0?Ze(n.liveOutput):void 0;return r===n.result&&s===n.output&&i===n.liveOutput?n:(e=!0,{...n,result:r,...s!==void 0?{output:s}:{},...i!==void 0?{liveOutput:i}:{}})}if(n.kind==="bang"){let r=vo(n.command);return r===n.command?n:(e=!0,{...n,command:r})}if(n.kind==="tool"&&H7.has(n.verb)){let r=vo(n.target);return r===n.target?n:(e=!0,{...n,target:r})}return n});return e?o:t}var H7,q7,RP=p(()=>{"use strict";P();H7=new Set(["bash","run_command"]),q7=new Set(["read","grep","attach","headroom_retrieve"])});import{homedir as G7}from"node:os";import{join as PS}from"node:path";import{randomBytes as z7}from"node:crypto";import{openSync as K7,writeSync as Y7,closeSync as OP,readFileSync as V7,readdirSync as MP,mkdirSync as X7,renameSync as J7,unlinkSync as LP,statSync as Q7,existsSync as Kye,constants as FS}from"node:fs";function iY(t,e){let o=[...t];return o.length>e?o.slice(0,e).join(""):t}function hh(t){if(typeof t!="string")return;let e="";for(let n of t){let r=n.codePointAt(0)??0;e+=r<32||r===127?" ":n}let o=e.replace(/\s+/g," ").trim();if(o!=="")return iY(o,sY)}function aY(t){for(let e of t)if(e.kind==="you"){let o=e.text.replace(/\s+/g," ").trim();if(o==="")return;let n=[...o];return n.length>60?n.slice(0,57).join("")+"\u2026":o}}var Z7,eY,PP,FP,tY,oY,IS,nY,rY,ph,sY,fd,IP=p(()=>{"use strict";LS();RP();Z7=448,eY=384,PP="sessions",FP=1,tY=720*60*60*1e3,oY=50,IS=8*1024*1024,nY=IS*8,rY=Math.floor(IS*.9),ph=/^[A-Za-z0-9_-]{1,128}$/,sY=64;fd=class{base;dir;now;createdAtCache=new Map;constructor(e={}){this.base=e.baseDir??PS(G7(),".aluy"),this.dir=PS(this.base,PP),this.now=e.now??(()=>Date.now())}get sessionsDir(){return this.dir}pathFor(e){return PS(this.dir,`${e}.json`)}save(e){if(!ph.test(e.id))return!1;try{let o=this.now(),n=this.resolveCreatedAt(e.id,o),r=e.tier==="custom"&&typeof e.model=="string"&&e.model.trim()!=="",s=r&&typeof e.provider=="string"&&e.provider.trim()!=="",i=hh(e.label),a=i!==void 0?hh(e.labelColor):void 0,l={id:e.id,version:FP,createdAt:n,updatedAt:o,cwd:e.cwd,tier:e.tier,...r?{model:e.model.trim()}:{},...s?{provider:e.provider.trim()}:{},...i!==void 0?{label:i}:{},...a!==void 0?{labelColor:a}:{}},c=this.fitBlocks(l,_P(fh(e.blocks))),u={...l,blocks:c};return this.writeAtomic(u),!0}catch{return!1}}resolveCreatedAt(e,o){let n=this.createdAtCache.get(e);if(n!==void 0)return n;let r=this.load(e)?.createdAt??o;return this.createdAtCache.set(e,r),r}load(e){if(!ph.test(e))return null;let o=this.pathFor(e),n,r=!1;try{let a=Q7(o);if(a.size>nY)return null;r=a.size>IS,n=V7(o,"utf8")}catch{return null}let s;try{s=JSON.parse(n)}catch{return null}let i=this.sanitizeRecord(s);if(i&&r){let{blocks:a,...l}=i,c=this.fitBlocks(l,a),u=a.length-c.length,m={kind:"note",title:"sess\xE3o grande \u2014 contexto antigo omitido no resume",lines:[`Esta sess\xE3o era grande demais p/ recarregar inteira; ${u} bloco(s) antigo(s) foram omitidos e a parte recente foi preservada.`,"O contexto restante ser\xE1 resumido automaticamente na pr\xF3xima intera\xE7\xE3o."]};i={...i,blocks:u>0?[m,...c]:c}}return i&&this.createdAtCache.set(i.id,i.createdAt),i}list(){let e;try{e=MP(this.dir)}catch{return[]}let o=[];for(let n of e){if(!n.endsWith(".json"))continue;let r=n.slice(0,-5),s=this.load(r);s&&o.push({id:s.id,createdAt:s.createdAt,updatedAt:s.updatedAt,cwd:s.cwd,tier:s.tier,...s.model!==void 0?{model:s.model}:{},...s.provider!==void 0?{provider:s.provider}:{},...s.label!==void 0?{label:s.label}:{},...s.labelColor!==void 0?{labelColor:s.labelColor}:{},blockCount:s.blocks.length,title:aY(s.blocks)})}return o.sort((n,r)=>r.updatedAt-n.updatedAt),o}latestForCwd(e){let o;try{o=MP(this.dir)}catch{return null}let n=null;for(let r of o){if(!r.endsWith(".json"))continue;let s=r.slice(0,-5),i=this.load(s);!i||i.cwd!==e||(n===null||i.updatedAt>n.updatedAt)&&(n=i)}return n}remove(e){if(ph.test(e)){this.createdAtCache.delete(e);try{LP(this.pathFor(e))}catch{}}}gc(e={}){let o=e.maxAgeMs??tY,n=e.maxCount??oY,r=this.list(),s=this.now()-o;r.forEach((i,a)=>{(i.updatedAt<s||a>=n)&&this.remove(i.id)})}sanitizeRecord(e){if(typeof e!="object"||e===null)return null;let o=e;if(typeof o.id!="string"||!ph.test(o.id)||!Array.isArray(o.blocks))return null;let n=typeof o.createdAt=="number"&&o.createdAt>=0?o.createdAt:0,r=typeof o.updatedAt=="number"&&o.updatedAt>=0?o.updatedAt:n,s=typeof o.cwd=="string"?o.cwd:"",i=typeof o.tier=="string"&&o.tier.trim()!==""?o.tier:"",a=typeof o.version=="number"?o.version:0,l=i==="custom"&&typeof o.model=="string"&&o.model.trim()!==""?o.model.trim():void 0,c=l!==void 0&&typeof o.provider=="string"&&o.provider.trim()!==""?o.provider.trim():void 0,u=hh(o.label),m=u!==void 0?hh(o.labelColor):void 0;return{id:o.id,version:a,createdAt:n,updatedAt:r,cwd:s,tier:i,...l!==void 0?{model:l}:{},...c!==void 0?{provider:c}:{},...u!==void 0?{label:u}:{},...m!==void 0?{labelColor:m}:{},blocks:fh(o.blocks)}}fitBlocks(e,o){let n=i=>Buffer.byteLength(JSON.stringify({...e,blocks:i})+`
497
+ `)});break}case"broker-error":e.push({role:"observation",toolName:MS,text:`(${o.backend==="local"?"erro do provider local":"erro de broker"} anterior: ${o.message})`});break;case"note":case"deny":case"subagents":case"doctor":break}return e}var $7,MS,LS=p(()=>{"use strict";$7=new Set(["you","aluy","tool","deny","bang","broker-error","note","inject","doctor"]);MS="sess\xE3o-anterior"});function W7(t){return t.kind==="tool"&&q7.has(t.verb)}function _P(t){let e=!1,o=t.map(n=>{if(n.kind==="tool"&&W7(n)){let r=Ze(n.result),s=n.output!==void 0?Ze(n.output):void 0,i=n.liveOutput!==void 0?Ze(n.liveOutput):void 0;return r===n.result&&s===n.output&&i===n.liveOutput?n:(e=!0,{...n,result:r,...s!==void 0?{output:s}:{},...i!==void 0?{liveOutput:i}:{}})}if(n.kind==="bang"){let r=vo(n.command);return r===n.command?n:(e=!0,{...n,command:r})}if(n.kind==="tool"&&H7.has(n.verb)){let r=vo(n.target);return r===n.target?n:(e=!0,{...n,target:r})}return n});return e?o:t}var H7,q7,RP=p(()=>{"use strict";P();H7=new Set(["bash","run_command"]),q7=new Set(["read","grep","attach","headroom_retrieve"])});import{homedir as G7}from"node:os";import{join as PS}from"node:path";import{randomBytes as z7}from"node:crypto";import{openSync as K7,writeSync as Y7,closeSync as OP,readFileSync as V7,readdirSync as MP,mkdirSync as X7,renameSync as J7,unlinkSync as LP,statSync as Q7,existsSync as Kye,constants as FS}from"node:fs";function iY(t,e){let o=[...t];return o.length>e?o.slice(0,e).join(""):t}function hh(t){if(typeof t!="string")return;let e="";for(let n of t){let r=n.codePointAt(0)??0;e+=r<32||r===127?" ":n}let o=e.replace(/\s+/g," ").trim();if(o!=="")return iY(o,sY)}function aY(t){for(let e of t)if(e.kind==="you"){let o=e.text.replace(/\s+/g," ").trim();if(o==="")return;let n=[...o];return n.length>60?n.slice(0,57).join("")+"\u2026":o}}var Z7,eY,PP,FP,tY,oY,IS,nY,rY,ph,sY,fd,IP=p(()=>{"use strict";LS();RP();Z7=448,eY=384,PP="sessions",FP=1,tY=720*60*60*1e3,oY=50,IS=8*1024*1024,nY=IS*8,rY=Math.floor(IS*.9),ph=/^[A-Za-z0-9_-]{1,128}$/,sY=64;fd=class{base;dir;now;createdAtCache=new Map;constructor(e={}){this.base=e.baseDir??PS(G7(),".aluy"),this.dir=PS(this.base,PP),this.now=e.now??(()=>Date.now())}get sessionsDir(){return this.dir}pathFor(e){return PS(this.dir,`${e}.json`)}save(e){if(!ph.test(e.id))return!1;try{let o=this.now(),n=this.resolveCreatedAt(e.id,o),r=e.tier==="custom"&&typeof e.model=="string"&&e.model.trim()!=="",s=r&&typeof e.provider=="string"&&e.provider.trim()!=="",i=hh(e.label),a=i!==void 0?hh(e.labelColor):void 0,l={id:e.id,version:FP,createdAt:n,updatedAt:o,cwd:e.cwd,tier:e.tier,...r?{model:e.model.trim()}:{},...s?{provider:e.provider.trim()}:{},...i!==void 0?{label:i}:{},...a!==void 0?{labelColor:a}:{}},c=this.fitBlocks(l,_P(fh(e.blocks))),u={...l,blocks:c};return this.writeAtomic(u),!0}catch{return!1}}resolveCreatedAt(e,o){let n=this.createdAtCache.get(e);if(n!==void 0)return n;let r=this.load(e)?.createdAt??o;return this.createdAtCache.set(e,r),r}load(e){if(!ph.test(e))return null;let o=this.pathFor(e),n,r=!1;try{let a=Q7(o);if(a.size>nY)return null;r=a.size>IS,n=V7(o,"utf8")}catch{return null}let s;try{s=JSON.parse(n)}catch{return null}let i=this.sanitizeRecord(s);if(i&&r){let{blocks:a,...l}=i,c=this.fitBlocks(l,a),u=a.length-c.length,m={kind:"note",title:"sess\xE3o grande \u2014 contexto antigo omitido no resume",lines:[`Esta sess\xE3o era grande demais p/ recarregar inteira; ${u} bloco(s) antigo(s) foram omitidos e a parte recente foi preservada.`,"O contexto restante ser\xE1 resumido automaticamente na pr\xF3xima intera\xE7\xE3o."]};i={...i,blocks:u>0?[m,...c]:c}}return i&&this.createdAtCache.set(i.id,i.createdAt),i}list(){let e;try{e=MP(this.dir)}catch{return[]}let o=[];for(let n of e){if(!n.endsWith(".json"))continue;let r=n.slice(0,-5),s=this.load(r);s&&o.push({id:s.id,createdAt:s.createdAt,updatedAt:s.updatedAt,cwd:s.cwd,tier:s.tier,...s.model!==void 0?{model:s.model}:{},...s.provider!==void 0?{provider:s.provider}:{},...s.label!==void 0?{label:s.label}:{},...s.labelColor!==void 0?{labelColor:s.labelColor}:{},blockCount:s.blocks.length,title:aY(s.blocks)})}return o.sort((n,r)=>r.updatedAt-n.updatedAt),o}latestForCwd(e){let o;try{o=MP(this.dir)}catch{return null}let n=null;for(let r of o){if(!r.endsWith(".json"))continue;let s=r.slice(0,-5),i=this.load(s);!i||i.cwd!==e||(n===null||i.updatedAt>n.updatedAt)&&(n=i)}return n}remove(e){if(ph.test(e)){this.createdAtCache.delete(e);try{LP(this.pathFor(e))}catch{}}}gc(e={}){let o=e.maxAgeMs??tY,n=e.maxCount??oY,r=this.list(),s=this.now()-o;r.forEach((i,a)=>{(i.updatedAt<s||a>=n)&&this.remove(i.id)})}sanitizeRecord(e){if(typeof e!="object"||e===null)return null;let o=e;if(typeof o.id!="string"||!ph.test(o.id)||!Array.isArray(o.blocks))return null;let n=typeof o.createdAt=="number"&&o.createdAt>=0?o.createdAt:0,r=typeof o.updatedAt=="number"&&o.updatedAt>=0?o.updatedAt:n,s=typeof o.cwd=="string"?o.cwd:"",i=typeof o.tier=="string"&&o.tier.trim()!==""?o.tier:"",a=typeof o.version=="number"?o.version:0,l=i==="custom"&&typeof o.model=="string"&&o.model.trim()!==""?o.model.trim():void 0,c=l!==void 0&&typeof o.provider=="string"&&o.provider.trim()!==""?o.provider.trim():void 0,u=hh(o.label),m=u!==void 0?hh(o.labelColor):void 0;return{id:o.id,version:a,createdAt:n,updatedAt:r,cwd:s,tier:i,...l!==void 0?{model:l}:{},...c!==void 0?{provider:c}:{},...u!==void 0?{label:u}:{},...m!==void 0?{labelColor:m}:{},blocks:fh(o.blocks)}}fitBlocks(e,o){let n=i=>Buffer.byteLength(JSON.stringify({...e,blocks:i})+`
498
498
  `,"utf8")<=rY;if(n(o))return o;let r=1,s=o.length;for(;r<s;){let i=r+s>>1;n(o.slice(i))?s=i:r=i+1}return o.slice(r)}writeAtomic(e){X7(this.dir,{recursive:!0,mode:Z7});let o=this.pathFor(e.id),n=`${o}.${process.pid}.${z7(6).toString("hex")}.tmp`,r=JSON.stringify(e)+`
499
499
  `,s;try{s=K7(n,FS.O_CREAT|FS.O_EXCL|FS.O_WRONLY,eY),Y7(s,r),OP(s),s=void 0,J7(n,o)}catch(i){if(s!==void 0)try{OP(s)}catch{}try{LP(n)}catch{}throw i}}}});import{homedir as lY}from"node:os";import{join as NS}from"node:path";import{readdirSync as cY,readFileSync as uY,mkdirSync as dY,statSync as mY}from"node:fs";var fY,NP,pY,hY,pd,$P=p(()=>{"use strict";P();fY=448,NP="commands",pY=64*1024,hY=256,pd=class{dir;constructor(e={}){let o=e.baseDir??NS(lY(),".aluy");this.dir=NS(o,NP)}get commandsDir(){return this.dir}ensureDir(){try{dY(this.dir,{mode:fY,recursive:!0})}catch{}}load(){let e;try{e=cY(this.dir,{withFileTypes:!0})}catch{return[]}let o=e.filter(s=>(s.isFile()||s.isSymbolicLink())&&s.name.toLowerCase().endsWith(".md")).map(s=>s.name).sort((s,i)=>s.localeCompare(i)),n=new Set,r=[];for(let s of o){if(r.length>=hY)break;let i=this.readOne(s);i&&(n.has(i.name)||(n.add(i.name),r.push(i)))}return r}readOne(e){let o=NS(this.dir,e);try{let n=mY(o);if(!n.isFile()||n.size>pY)return null;let r=uY(o,"utf8");return iu(e,r)}catch{return null}}}});import{join as gY}from"node:path";import{readdirSync as yY,readFileSync as bY,statSync as vY}from"node:fs";function $S(t,e){let o=new Map;for(let n of t)o.set(n.name,n);for(let n of e)o.set(n.name,n);return[...o.values()]}var BP,kY,xY,hd,UP=p(()=>{"use strict";P();Ls();BP=[".claude/commands",".aluy/commands"],kY=64*1024,xY=256,hd=class{workspace;constructor(e){this.workspace=e.workspace}load(){let e=new Set,o=[];for(let n of BP){let r;try{r=this.workspace.resolveInside(n)}catch{continue}let s;try{s=yY(r,{withFileTypes:!0})}catch{continue}let i=s.filter(a=>(a.isFile()||a.isSymbolicLink())&&a.name.toLowerCase().endsWith(".md")).map(a=>a.name).sort((a,l)=>a.localeCompare(l));for(let a of i){if(o.length>=xY)break;let l=this.readOne(n,r,a);l&&(e.has(l.name)||(e.add(l.name),o.push(l)))}}return o}readOne(e,o,n){let r=`${e}/${n}`;if(No(r).kind!=="allow")return null;let s=gY(o,n);try{this.workspace.resolveInside(r);let i=vY(s);if(!i.isFile()||i.size>kY)return null;let a=bY(s,"utf8");return iu(n,a)}catch{return null}}}});import{join as SY}from"node:path";import{readdirSync as wY,readFileSync as EY,statSync as AY}from"node:fs";var jP,CY,DY,Bi,BS=p(()=>{"use strict";P();Ls();jP=[".claude/agents",".aluy/agents"],CY=64*1024,DY=256,Bi=class{workspace;constructor(e){this.workspace=e.workspace}load(){let e=new Set,o=[],n=[];for(let r of jP){let s;try{s=this.workspace.resolveInside(r)}catch{continue}let i;try{i=wY(s,{withFileTypes:!0})}catch{continue}let a=i.filter(l=>(l.isFile()||l.isSymbolicLink())&&l.name.toLowerCase().endsWith(".md")).map(l=>l.name).sort((l,c)=>l.localeCompare(c));for(let l of a){if(o.length>=DY)break;let c=this.readOne(r,s,l);if(c!==null){if(Xc(c)){n.push(c);continue}e.has(c.name)||(e.add(c.name),o.push(c))}}}return{profiles:o,errors:n}}readOne(e,o,n){let r=`${e}/${n}`;if(No(r).kind!=="allow")return null;let s=SY(o,n);try{this.workspace.resolveInside(r);let i=AY(s);if(!i.isFile()||i.size>CY)return null;let a=EY(s,"utf8");return Jc(n,a,"project")}catch{return null}}}});var jS={};ht(jS,{UserWorkflowsLoader:()=>ir,WORKFLOWS_DIRNAME:()=>il});import{homedir as TY}from"node:os";import{join as US}from"node:path";import{readdirSync as _Y,readFileSync as RY,mkdirSync as OY,statSync as MY}from"node:fs";var LY,il,PY,FY,ir,gd=p(()=>{"use strict";P();LY=448,il="workflows",PY=64*1024,FY=256,ir=class{dir;constructor(e={}){let o=e.baseDir??US(TY(),".aluy");this.dir=US(o,il)}get workflowsDir(){return this.dir}ensureDir(){try{OY(this.dir,{mode:LY,recursive:!0})}catch{}}load(){let e;try{e=_Y(this.dir,{withFileTypes:!0})}catch{return{workflows:[],errors:[]}}let o=e.filter(i=>(i.isFile()||i.isSymbolicLink())&&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>=FY)break;let a=this.readOne(i);if(a!==null){if(ou(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=US(this.dir,e);try{let n=MY(o);if(!n.isFile()||n.size>PY)return null;let r=RY(o,"utf8");return nu(e,r,"global")}catch{return null}}}});var qS={};ht(qS,{PROJECT_WORKFLOWS_DIRNAMES:()=>HS,ProjectWorkflowsLoader:()=>ar});import{join as IY}from"node:path";import{readdirSync as NY,readFileSync as $Y,statSync as BY}from"node:fs";var HS,UY,jY,ar,yd=p(()=>{"use strict";P();Ls();HS=[".claude/workflows",".aluy/workflows"],UY=64*1024,jY=256,ar=class{workspace;constructor(e){this.workspace=e.workspace}load(){let e=new Set,o=[],n=[];for(let r of HS){let s;try{s=this.workspace.resolveInside(r)}catch{continue}let i;try{i=NY(s,{withFileTypes:!0})}catch{continue}let a=i.filter(l=>(l.isFile()||l.isSymbolicLink())&&l.name.toLowerCase().endsWith(".md")).map(l=>l.name).sort((l,c)=>l.localeCompare(c));for(let l of a){if(o.length>=jY)break;let c=this.readOne(r,s,l);if(c!==null){if(ou(c)){n.push(c);continue}e.has(c.name)||(e.add(c.name),o.push(c))}}}return{workflows:o,errors:n}}readOne(e,o,n){let r=`${e}/${n}`;if(No(r).kind!=="allow")return null;let s=IY(o,n);try{this.workspace.resolveInside(r);let i=BY(s);if(!i.isFile()||i.size>UY)return null;let a=$Y(s,"utf8");return nu(n,a,"project")}catch{return null}}}});import{homedir as HY}from"node:os";import{join as WS}from"node:path";import{readdirSync as qY,readFileSync as WY,mkdirSync as GY,statSync as zY}from"node:fs";var KY,bd,vd,YY,VY,Zr,gh=p(()=>{"use strict";P();KY=448,bd="skills",vd="SKILL.md",YY=256*1024,VY=256,Zr=class{dir;constructor(e={}){let o=e.baseDir??WS(HY(),".aluy");this.dir=WS(o,bd)}get skillsDir(){return this.dir}ensureDir(){try{GY(this.dir,{mode:KY,recursive:!0})}catch{}}load(){let e;try{e=qY(this.dir,{withFileTypes:!0})}catch{return{skills:[],errors:[]}}let o=e.filter(i=>i.isDirectory()).map(i=>i.name).sort((i,a)=>i.localeCompare(a)),n=new Set,r=[],s=[];for(let i of o){if(r.length>=VY)break;let a=this.readOne(i);if(a!==null){if(Zc(a)){s.push(a);continue}n.has(a.name)||(n.add(a.name),r.push(a))}}return{skills:r,errors:s}}readOne(e){let o=WS(this.dir,e,vd);try{let n=zY(o);if(!n.isFile()||n.size>YY)return null;let r=WY(o,"utf8");return eu(e,r,"global")}catch{return null}}}});import{join as XY}from"node:path";import{readdirSync as JY,readFileSync as QY,statSync as ZY}from"node:fs";var HP,e5,t5,es,GS=p(()=>{"use strict";P();gh();HP=[".claude/skills",".aluy/skills"],e5=256*1024,t5=256,es=class{workspace;constructor(e){this.workspace=e.workspace}load(){let e=new Set,o=[],n=[];for(let r of HP){let s;try{s=this.workspace.resolveInside(r)}catch{continue}let i;try{i=JY(s,{withFileTypes:!0})}catch{continue}let a=i.filter(l=>l.isDirectory()).map(l=>l.name).sort((l,c)=>l.localeCompare(c));for(let l of a){if(o.length>=t5)break;let c=this.readOne(r,s,l);if(c!==null){if(Zc(c)){n.push(c);continue}e.has(c.name)||(e.add(c.name),o.push(c))}}}return{skills:o,errors:n}}readOne(e,o,n){let r=`${e}/${n}/${vd}`,s=XY(o,n,vd);try{this.workspace.resolveInside(r);let i=ZY(s);if(!i.isFile()||i.size>e5)return null;let a=QY(s,"utf8");return eu(n,a,"project")}catch{return null}}}});import{homedir as o5}from"node:os";import{join as zS}from"node:path";import{readFileSync as n5,statSync as r5}from"node:fs";var qP,s5,i5,kd,WP=p(()=>{"use strict";P();qP="hooks.json",s5="settings.json",i5=256*1024,kd=class{file;claudeProjectFile;constructor(e={}){let o=e.baseDir??zS(o5(),".aluy");this.file=zS(o,qP),e.workspaceRoot!==void 0&&(this.claudeProjectFile=zS(e.workspaceRoot,".claude",s5))}get configPath(){return this.file}load(){let e=Zv(this.readJson(this.file));if(this.claudeProjectFile===void 0)return e;let o=tk(this.readJson(this.claudeProjectFile));return ok(e,o)}readJson(e){let o;try{let n=r5(e);if(!n.isFile()||n.size>i5)return;o=n5(e,"utf8")}catch{return}try{return JSON.parse(o)}catch{return}}}});var xd=p(()=>{"use strict";Za();JL();ah();eP();rP();lP();uh();Fs();yP();Vx();iS();kP();xP();DS();_S();ko();CP();IP();LS();$P();UP();Gp();BS();gd();yd();gh();GS();WP()});function Sd(t,e){let o=t.toLowerCase(),n=e.toLowerCase();if(o==="")return{score:0,matched:[]};let r=[],s=0,i=0,a=-1,l=e.lastIndexOf("/")+1;for(let u=0;u<o.length;u++){let m=o[u],d=n.indexOf(m,s);if(d===-1)return null;r.push(d),a>=0&&d===a+1?i+=5:i+=1,d>=l&&(i+=2);let h=d>0?e[d-1]:"/";(h==="/"||h==="-"||h==="_"||h===".")&&(i+=3),a=d,s=d+1}let c=(r[r.length-1]??0)-(r[0]??0);return i-=c*.1,i-=e.length*.01,{score:i,matched:r}}function KS(t,e){let o=t.trim();if(o==="")return e.map(r=>({path:r,score:0,matched:[]}));let n=[];for(let r of e){let s=Sd(o,r);s&&n.push({path:r,score:s.score,matched:s.matched})}return n.sort((r,s)=>s.score-r.score||r.path.length-s.path.length||r.path.localeCompare(s.path)),n}var YS=p(()=>{"use strict"});function l5(t){return t.replace(/\\ /g," ")}function c5(t){return t.includes("/")?!0:/\.[A-Za-z0-9]+$/.test(t)}function u5(t){let e=t.replace(/\.+$/,"");return{token:e,trimmed:t.length-e.length}}function Ui(t){let e=[];for(let o of t.matchAll(a5)){let n=o[1],r=o[4],s=o[2]??o[3]??r,{token:i,trimmed:a}=r!==void 0?u5(s):{token:s,trimmed:0},l=l5(i);if(!c5(l))continue;let c=(o.index??0)+o[0].indexOf(n);e.push({path:l,start:c,end:c+n.length-a})}return e}function VS(t,e){if(e.length===0)return t;let o=t;for(let n of[...e].sort((r,s)=>s.start-r.start))o=o.slice(0,n.start)+o.slice(n.end);return o.replace(/\s{2,}/g," ").trim()}var a5,GP=p(()=>{"use strict";a5=/(?:^|\s)(@(?:"([^"]+)"|'([^']+)'|((?:[\p{L}\p{N}._/-]|\\ )+)))/gu});function yh(t){let e=t.lastIndexOf("@");if(e<0)return null;let o=e>0?t[e-1]:" ";if(o!==" "&&o!==`
500
500
  `&&o!==" ")return null;let n=t.slice(e+1);return/\s/.test(n)?null:{at:e,query:n}}function XS(t){let e=yh(t);return e?t.slice(0,e.at).replace(/\s+$/,""):t}var zP=p(()=>{"use strict"});import{relative as d5,sep as m5,isAbsolute as f5}from"node:path";var KP,p5,wd,YP=p(()=>{"use strict";P();Ls();ih();KP=16e3,p5=5*1024*1024,wd=class{workspace;fs;maxChars;sniffBytes;constructor(e){this.workspace=e.workspace,this.fs=e.fs,this.maxChars=e.maxChars??KP,this.sniffBytes=e.sniffBytes??p5}async attach(e,o={}){let n=e,r;try{r=this.workspace.resolveInside(e)}catch{return{kind:"rejected",path:n,reason:"caminho fora do workspace \u2014 recusado (o @ s\xF3 acessa a raiz do projeto)."}}let s=d5(this.workspace.root,r).split(m5).join("/");if(s===""||s.startsWith("..")||f5(s))return{kind:"rejected",path:n,reason:"caminho inv\xE1lido p/ o workspace."};let i=No(s);if(i.kind==="deny")return{kind:"rejected",path:s,reason:`bloqueado: ${i.why} \u2014 esse tipo de arquivo nunca \xE9 anexado ao contexto.`};if(i.kind==="ask"&&o.confirmSensitive!==!0)return{kind:"rejected",path:s,reason:`sens\xEDvel: ${i.why} \u2014 confirme explicitamente p/ anexar (fora do picker por padr\xE3o).`};try{if(await XL(r,this.sniffBytes))return{kind:"rejected",path:s,reason:"arquivo bin\xE1rio \u2014 n\xE3o anexado (conte\xFAdo n\xE3o \xE9 texto; evita lixo no contexto)."}}catch{}let a;try{a=await this.fs.readFile(s)}catch{return{kind:"rejected",path:s,reason:"n\xE3o foi poss\xEDvel ler o arquivo (sumiu/ileg\xEDvel)."}}let l=!1;return a.length>this.maxChars&&(a=a.slice(0,this.maxChars)+`
@@ -1,4 +1,4 @@
1
- var HI=Object.create;var Ip=Object.defineProperty;var qI=Object.getOwnPropertyDescriptor;var WI=Object.getOwnPropertyNames;var GI=Object.getPrototypeOf,zI=Object.prototype.hasOwnProperty;var E=(t,e,o)=>()=>{if(o)throw o[0];try{return t&&(e=t(t=0)),e}catch(n){throw o=[n],n}};var KI=(t,e)=>()=>{try{return e||t((e={exports:{}}).exports,e),e.exports}catch(o){throw e=0,o}},Np=(t,e)=>{for(var o in e)Ip(t,o,{get:e[o],enumerable:!0})},YI=(t,e,o,n)=>{if(e&&typeof e=="object"||typeof e=="function")for(let r of WI(e))!zI.call(t,r)&&r!==o&&Ip(t,r,{get:()=>e[r],enumerable:!(n=qI(e,r))||n.enumerable});return t};var VI=(t,e,o)=>(o=t!=null?HI(GI(t)):{},YI(e||!t||!t.__esModule?Ip(o,"default",{value:t,enumerable:!0}):o,t));var Ua,HS=E(()=>{"use strict";Ua="1.0.0-rc.88"});function Yn(t,e){return t.decide(e)}var ms=E(()=>{"use strict"});var gn,Vn,Xn=E(()=>{"use strict";gn="remember",Vn="recall"});var $p,XI,gi,Bp=E(()=>{"use strict";$p=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}}},XI=200,gi=class{nodes=new Map;maxBoxes;now;constructor(e){this.maxBoxes=e?.maxBoxes??XI,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 $p(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 Gu(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 GS(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"&&JI.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 u of l){let f=GS(u,!1);if(typeof f=="string")return f;c.push(f)}r=c}}}if(o===void 0||o.trim()==="")return ZI;let s=o.trim().slice(0,QI);return r?{title:s,status:n,substeps:r}:{title:s,status:n}}function eN(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=GS(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(u=>({...u,title:r(u.title)}));o[i]=c!==void 0?{...a,title:l,substeps:c}:{...a,title:l}}let s=Gu(o).length;return s>qS?{error:`update_plan: no m\xE1ximo ${qS} passos (recebidos ${s}).`}:{steps:o}}function tN(t){let e=Gu(t),o=e.filter(r=>r.step.status==="completed").length,n=e.map(r=>`${" ".repeat(r.depth)}${zS[r.step.status]} ${r.step.title}`).join(`
1
+ var HI=Object.create;var Ip=Object.defineProperty;var qI=Object.getOwnPropertyDescriptor;var WI=Object.getOwnPropertyNames;var GI=Object.getPrototypeOf,zI=Object.prototype.hasOwnProperty;var E=(t,e,o)=>()=>{if(o)throw o[0];try{return t&&(e=t(t=0)),e}catch(n){throw o=[n],n}};var KI=(t,e)=>()=>{try{return e||t((e={exports:{}}).exports,e),e.exports}catch(o){throw e=0,o}},Np=(t,e)=>{for(var o in e)Ip(t,o,{get:e[o],enumerable:!0})},YI=(t,e,o,n)=>{if(e&&typeof e=="object"||typeof e=="function")for(let r of WI(e))!zI.call(t,r)&&r!==o&&Ip(t,r,{get:()=>e[r],enumerable:!(n=qI(e,r))||n.enumerable});return t};var VI=(t,e,o)=>(o=t!=null?HI(GI(t)):{},YI(e||!t||!t.__esModule?Ip(o,"default",{value:t,enumerable:!0}):o,t));var Ua,HS=E(()=>{"use strict";Ua="1.0.0-rc.89"});function Yn(t,e){return t.decide(e)}var ms=E(()=>{"use strict"});var gn,Vn,Xn=E(()=>{"use strict";gn="remember",Vn="recall"});var $p,XI,gi,Bp=E(()=>{"use strict";$p=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}}},XI=200,gi=class{nodes=new Map;maxBoxes;now;constructor(e){this.maxBoxes=e?.maxBoxes??XI,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 $p(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 Gu(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 GS(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"&&JI.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 u of l){let f=GS(u,!1);if(typeof f=="string")return f;c.push(f)}r=c}}}if(o===void 0||o.trim()==="")return ZI;let s=o.trim().slice(0,QI);return r?{title:s,status:n,substeps:r}:{title:s,status:n}}function eN(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=GS(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(u=>({...u,title:r(u.title)}));o[i]=c!==void 0?{...a,title:l,substeps:c}:{...a,title:l}}let s=Gu(o).length;return s>qS?{error:`update_plan: no m\xE1ximo ${qS} passos (recebidos ${s}).`}:{steps:o}}function tN(t){let e=Gu(t),o=e.filter(r=>r.step.status==="completed").length,n=e.map(r=>`${" ".repeat(r.depth)}${zS[r.step.status]} ${r.step.title}`).join(`
2
2
  `);return`plano (${o}/${e.length}):
3
3
  ${n}`}function nN(t,e){return e<0?"m\xE9dio":t===e?"curto":t>e?"longo":"m\xE9dio"}function rN(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,u=o.get(i.title),f=u??gi.boxId(i.title,0);return u?(i.status!=="completed"&&e.isClosed(u)&&e.reopenBox(u),e.setHorizon(u,c),e.setParent(u,a)):e.openBox(f,c,i.title,a),i.status==="completed"&&!e.isClosed(f)&&e.closeBox(f),o.set(i.title,f),f};t.forEach((i,a)=>{let l=nN(a,n),c=r(i,null,l);for(let u of i.substeps??[])r(u,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 sN(t,e){if(!e)return tN(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,u=new Set)=>{let f=r.get(c);if(f!==void 0)return f;let d=n.get(c);if(!d||!d.parentId||u.has(c))return r.set(c,0),0;let p=s(d.parentId,new Set(u).add(c))+1;return r.set(c,p),p},i=Gu(t),l=[`plano (${i.filter(c=>c.step.status==="completed").length}/${i.length}):`];for(let{step:c,depth:u}of i){let f=o.get(c.title),d=f?oN[f.horizon]:"",p=f?s(f.id):u,h=" ".repeat(p),y=zS[c.status];l.push(`${h}${d} ${y} ${c.title}`)}return l.join(`
4
4
  `)}var ja,JI,qS,QI,ZI,zS,oN,WS,iN,KS,zu=E(()=>{"use strict";Bp();ja="update_plan";JI=new Set(["pending","in_progress","completed"]),qS=30,QI=120,ZI="update_plan: cada passo precisa de um t\xEDtulo (texto) n\xE3o-vazio.";zS={pending:"\u2610",in_progress:"\u25B6",completed:"\u2611"};oN={longo:"[\u{1F4D0}]",m\u00E9dio:"[\u{1F4CB}]",curto:"[\u{1F4CC}]"};WS=Object.freeze({type:"string",enum:["pending","in_progress","completed"],description:"pending (a fazer) \xB7 in_progress (em curso) \xB7 completed (feito)."}),iN=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:WS,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:WS},required:["title"],additionalProperties:!1}}},required:["title"],additionalProperties:!1}}},required:["steps"],additionalProperties:!1}),KS={name:ja,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:iN,async run(t,e){let o=eN(t);return"error"in o?{ok:!1,observation:o.error}:(e.graph&&rN(o.steps,e.graph),e.plan&&e.plan.set(Gu(o.steps).map(r=>({title:r.step.title,status:r.step.status}))),{ok:!0,observation:sN(o.steps,e.graph)})}}});function YS(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)?lN(s):void 0;if(typeof i=="string")return{error:i};let a,l=t.kind??t.type;if(typeof l=="string"&&aN.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 lN(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 cN(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 WD(t,e,o=tc){let{older:n,recent:r}=fm(t,o);if(n.length===
137
137
  \u2026[truncado: ${t.length-Ib} chars omitidos]`}function JU(t){return t.length<=$b?t:`${t.slice(0,$b)}\u2026`}function T0(t){let e=D0(t.server,t.descriptor.name),o=JU(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,l){try{let c=await t.transport.callTool(t.descriptor.name,i,l?.signal),u=He(c.content);return c.ok?{ok:!0,observation:C0(u),display:`${e}(${QU(i)})`}:{ok:!1,observation:C0(`MCP "${e}" erro: ${u}`)}}catch(c){return{ok:!1,observation:`MCP "${e}" falhou: ${c instanceof Error?c.message:String(c)}`}}}}}function Bb(t,e){let o=[],n=new Set,r=new Map,s=new Map,i=new Set;for(let a of t){let l=T0(a);if(n.has(l.name))continue;n.add(l.name);let c=a.server;s.set(c,(s.get(c)??0)+1);let u=r.get(c)??0;if(u>=Nb){i.add(c);continue}r.set(c,u+1),o.push(l)}if(e)for(let a of i){let l=s.get(a)??0;e(`server MCP "${a}" exp\xF4s ${l} tools; usando as primeiras ${Nb} (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 QU(t){if(Object.keys(t).length===0)return"";let o=JSON.stringify(t);return o.length<=200?o:`${o.slice(0,200)}\u2026`}var Ib,Nb,$b,_0=E(()=>{"use strict";Vu();tr();Ib=2e4;Nb=128,$b=1024});function M0(t,e){let o=new URL(O0);return t.trim().length>0&&o.searchParams.set("search",t.trim()),o.searchParams.set("limit",String(e2)),e!==void 0&&e.length>0&&o.searchParams.set("cursor",e),o.toString()}async function jb(t,e,o){let n=t.trim(),r=[],s;for(let i=0;i<ZU;i++){let a=M0(n,s),l;try{l=await e(a,o)}catch(f){return{ok:!1,query:n,reason:Sm(i2(f))}}if(!l.ok)return{ok:!1,query:n,reason:Sm(l.reason)};if(l.status<200||l.status>=300)return{ok:!1,query:n,reason:Sm(`HTTP ${l.status}`)};let c;try{c=JSON.parse(l.body)}catch{return{ok:!1,query:n,reason:Sm("resposta n\xE3o \xE9 JSON v\xE1lido")}}let u=P0(c);for(let f of u.servers)if(L0(f,n)&&r.push(f),r.length>=Ub)break;if(r.length>=Ub||(s=u.nextCursor,s===void 0||s.length===0))break}return{ok:!0,query:n,results:r}}function Sm(t){return`registro MCP indispon\xEDvel (${Gi}): ${t}`}function L0(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 P0(t){if(!sr(t))return{servers:[]};let e=Array.isArray(t.servers)?t.servers:[],o=[];for(let s of e){let i=t2(s);i!==void 0&&o.push(i)}let n=sr(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 t2(t){if(!sr(t))return;let e=sr(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=o2(e);return{name:o,description:n,run:i,...r!==void 0?{title:r}:{},...s!==void 0?{version:s}:{}}}function o2(t){let e=[],o=Array.isArray(t.remotes)?t.remotes:[];for(let r of o)sr(r)&&typeof r.url=="string"&&e.push(r.url);let n=Array.isArray(t.packages)?t.packages:[];for(let r of n){if(!sr(r))continue;let s=n2(r);if(s!==void 0)return{...s,remoteUrls:e}}return{args:[],env:[],remoteUrls:e}}function n2(t){let e=Ms(t.registryType)??Ms(t.registry_name),o=Ms(t.identifier)??Ms(t.name);if(o===void 0)return;let n=Ms(t.version),r=Ms(t.runtimeHint),s=sr(t.transport)?Ms(t.transport.type):void 0,i=s2(t.environmentVariables),a=R0(t.runtimeArguments),l=R0(t.packageArguments),c=n!==void 0?`${o}@${n}`:o;return e==="npm"||r==="npx"?{command:"npx",args:r2(["-y",...a,c,...l]),env:i,...s!==void 0?{transport:s}:{}}:e==="pypi"||r==="uvx"||r==="uv"?{command:"uvx",args:[...a,o,...l],env:i,...s!==void 0?{transport:s}:{}}:e==="oci"||r==="docker"?{command:"docker",args:["run","-i","--rm",...a,c,...l],env:i,...s!==void 0?{transport:s}:{}}:{args:[c],env:i,...s!==void 0?{transport:s}:{}}}function r2(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 R0(t){if(!Array.isArray(t))return[];let e=[];for(let o of t)sr(o)&&typeof o.value=="string"&&e.push(o.value);return e}function s2(t){if(!Array.isArray(t))return[];let e=[];for(let o of t)sr(o)&&typeof o.name=="string"&&o.name.length>0&&e.push({name:o.name,required:o.isRequired===!0});return e}function Ms(t){return typeof t=="string"&&t.trim().length>0?t.trim():void 0}function sr(t){return typeof t=="object"&&t!==null&&!Array.isArray(t)}function i2(t){return t instanceof Error?t.message:String(t)}var Gi,O0,ZU,e2,Ub,F0=E(()=>{"use strict";Gi="registry.modelcontextprotocol.io",O0=`https://${Gi}/v0/servers`,ZU=5,e2=100,Ub=25});function N0(t){let{command:e,args:o}=t.run;if(e===void 0)return;let n=$0(t.name);return["aluy","mcp","add",I0(n),"--",e,...o.map(I0)].join(" ")}function $0(t){let o=(t.split("/").pop()??t).replace(/[^A-Za-z0-9_-]+/g,"-").replace(/^-+|-+$/g,"");return o.length>0?o:"server"}function I0(t){return/^[A-Za-z0-9_./@:+=-]+$/.test(t)?t:`'${t.replace(/'/g,"'\\''")}'`}function Hb(t){if(!t.ok)return`\u26A0 ${t.reason}
138
138
  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(a2(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(`
139
139
  `)}function a2(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(` ${l2(t.description,200)}`);let r=N0(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(`
140
- `)}function l2(t,e){return t.length<=e?t:t.slice(0,e-1).trimEnd()+"\u2026"}var B0=E(()=>{"use strict"});var U0=E(()=>{"use strict";xm();k0();x0();S0();E0();A0();_0();Vu();F0();B0()});function qb(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 j0(t,e){let o=qb(t),n=qb(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 l=typeof i=="number",c=typeof a=="number";return l&&c?i<a?-1:1:l?-1:c?1:i<a?-1:1}return 0}function Wb(t,e){return j0(t,e)===1}var H0=E(()=>{"use strict"});function Em(t,e,o){if(e.size===0)return{kind:"discard",reason:"allowlist vazia (default fechado)"};if(!e.has(t.conversation))return{kind:"discard",reason:`canal ${t.conversation} n\xE3o-allowlistado`};if(t.senderIsBot===!0)return{kind:"discard",reason:"remetente \xE9 bot (anti-loop, TC-6)"};let n=t.content.trim();if(n==="")return{kind:"discard",reason:"mensagem sem conte\xFAdo"};if(o.authIsForgeable)return{kind:"data",text:n};if(t.provenance.kind==="third-party-relayed")return{kind:"data",text:n};let r=t.provenance.embeddedThirdParty?.trim();return r?{kind:"instruction",text:n,forwardedData:r}:{kind:"instruction",text:n}}var Gb=E(()=>{"use strict"});function zb(t){let e;if(t.forwarded===!0)e={kind:"third-party-relayed"};else{let o=(t.quotedText??"").trim();e=o?{kind:"author-direct",embeddedThirdParty:o}:{kind:"author-direct"}}return{content:t.text,sender:String(t.fromId),conversation:String(t.chatId),provenance:e,...t.isBot===!0?{senderIsBot:!0}:{}}}function Kb(t){let e=new Set;for(let o of t)typeof o=="number"&&Number.isFinite(o)&&Number.isInteger(o)&&e.add(o);return e}var cc,q0=E(()=>{"use strict";Gb();cc={id:"telegram",displayName:"Telegram",authIsForgeable:!1}});function Yb(t){return typeof t=="number"&&Number.isFinite(t)?t:void 0}function zi(t){return typeof t=="object"&&t!==null?t:void 0}function Vb(t,e){let o=zi(t);if(!o||o.ok!==!0||!Array.isArray(o.result))return{updates:[],nextOffset:e};let n=[],r=e-1;for(let s of o.result){let i=zi(s);if(!i)continue;let a=Yb(i.update_id);a!==void 0&&a>r&&(r=a);let l=zi(i.message);if(!l)continue;let c=zi(l.chat),u=Yb(c?.id);if(u===void 0||c?.type!=="private")continue;let f=zi(l.from),d=Yb(f?.id)??u,p=f?.is_bot===!0,h=typeof l.text=="string"?l.text:"",y=l.forward_origin!==void 0||l.forward_from!==void 0||l.forward_from_chat!==void 0||l.forward_sender_name!==void 0||l.forward_date!==void 0,g=(()=>{let S=zi(l.quote)?.text;return typeof S=="string"&&S.trim()!==""?S:void 0})();n.push({chatId:u,fromId:d,text:h,...y?{forwarded:!0}:{},...g!==void 0?{quotedText:g}:{},...p?{isBot:!0}:{}})}return{updates:n,nextOffset:r+1}}var W0=E(()=>{"use strict"});var uc,G0=E(()=>{"use strict";uc=class{maxPerWindow;windowMs;stamps=[];constructor(e,o){this.maxPerWindow=e,this.windowMs=o}tryConsume(e){let o=e-this.windowMs;for(;this.stamps.length>0&&this.stamps[0]<=o;)this.stamps.shift();return this.stamps.length>=this.maxPerWindow?!1:(this.stamps.push(e),!0)}get used(){return this.stamps.length}}});function Xb(t){return`connector-${t}-token`}function dc(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)`}function Jb(t,e){let o=e.trim();return o.length<8?t:t.split(o).join("\xABREDACTED\xBB")}var z0=E(()=>{"use strict"});var N=E(()=>{"use strict";HS();dE();EE();Hw();c0();zy();y0();U0();Eb();Qd();H0();Gb();q0();W0();G0();z0()});import{posix as T8}from"node:path";function _8(t){return T8.normalize(t)}function po(t){let e=_8(t);for(let o of R8)if(o.re.test(e))return o.deny?{kind:"deny",why:o.why}:{kind:"ask",why:o.why};return{kind:"allow"}}function hv(t){return po(t).kind==="allow"}var R8,Br=E(()=>{"use strict";R8=[{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 Nv={};Np(Nv,{UserWorkflowsLoader:()=>qr,WORKFLOWS_DIRNAME:()=>Iv});import{homedir as h3}from"node:os";import{join as Fv}from"node:path";import{readdirSync as g3,readFileSync as y3,mkdirSync as b3,statSync as v3}from"node:fs";var k3,Iv,x3,S3,qr,qm=E(()=>{"use strict";N();k3=448,Iv="workflows",x3=64*1024,S3=256,qr=class{dir;constructor(e={}){let o=e.baseDir??Fv(h3(),".aluy");this.dir=Fv(o,Iv)}get workflowsDir(){return this.dir}ensureDir(){try{b3(this.dir,{mode:k3,recursive:!0})}catch{}}load(){let e;try{e=g3(this.dir,{withFileTypes:!0})}catch{return{workflows:[],errors:[]}}let o=e.filter(i=>(i.isFile()||i.isSymbolicLink())&&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>=S3)break;let a=this.readOne(i);if(a!==null){if(jl(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=Fv(this.dir,e);try{let n=v3(o);if(!n.isFile()||n.size>x3)return null;let r=y3(o,"utf8");return Hl(e,r,"global")}catch{return null}}}});var Bv={};Np(Bv,{PROJECT_WORKFLOWS_DIRNAMES:()=>$v,ProjectWorkflowsLoader:()=>Wr});import{join as E3}from"node:path";import{readdirSync as w3,readFileSync as A3,statSync as C3}from"node:fs";var $v,D3,T3,Wr,Wm=E(()=>{"use strict";N();Br();$v=[".claude/workflows",".aluy/workflows"],D3=64*1024,T3=256,Wr=class{workspace;constructor(e){this.workspace=e.workspace}load(){let e=new Set,o=[],n=[];for(let r of $v){let s;try{s=this.workspace.resolveInside(r)}catch{continue}let i;try{i=w3(s,{withFileTypes:!0})}catch{continue}let a=i.filter(l=>(l.isFile()||l.isSymbolicLink())&&l.name.toLowerCase().endsWith(".md")).map(l=>l.name).sort((l,c)=>l.localeCompare(c));for(let l of a){if(o.length>=T3)break;let c=this.readOne(r,s,l);if(c!==null){if(jl(c)){n.push(c);continue}e.has(c.name)||(e.add(c.name),o.push(c))}}}return{workflows:o,errors:n}}readOne(e,o,n){let r=`${e}/${n}`;if(po(r).kind!=="allow")return null;let s=E3(o,n);try{this.workspace.resolveInside(r);let i=C3(s);if(!i.isFile()||i.size>D3)return null;let a=A3(s,"utf8");return Hl(n,a,"project")}catch{return null}}}});var OM=KI((eye,RM)=>{RM.exports=()=>/[#*0-9]\uFE0F?\u20E3|[\xA9\xAE\u203C\u2049\u2122\u2139\u2194-\u2199\u21A9\u21AA\u231A\u231B\u2328\u23CF\u23ED-\u23EF\u23F1\u23F2\u23F8-\u23FA\u24C2\u25AA\u25AB\u25B6\u25C0\u25FB\u25FC\u25FE\u2600-\u2604\u260E\u2611\u2614\u2615\u2618\u2620\u2622\u2623\u2626\u262A\u262E\u262F\u2638-\u263A\u2640\u2642\u2648-\u2653\u265F\u2660\u2663\u2665\u2666\u2668\u267B\u267E\u267F\u2692\u2694-\u2697\u2699\u269B\u269C\u26A0\u26A7\u26AA\u26B0\u26B1\u26BD\u26BE\u26C4\u26C8\u26CF\u26D1\u26E9\u26F0-\u26F5\u26F7\u26F8\u26FA\u2702\u2708\u2709\u270F\u2712\u2714\u2716\u271D\u2721\u2733\u2734\u2744\u2747\u2757\u2763\u27A1\u2934\u2935\u2B05-\u2B07\u2B1B\u2B1C\u2B55\u3030\u303D\u3297\u3299]\uFE0F?|[\u261D\u270C\u270D](?:\uD83C[\uDFFB-\uDFFF]|\uFE0F)?|[\u270A\u270B](?:\uD83C[\uDFFB-\uDFFF])?|[\u23E9-\u23EC\u23F0\u23F3\u25FD\u2693\u26A1\u26AB\u26C5\u26CE\u26D4\u26EA\u26FD\u2705\u2728\u274C\u274E\u2753-\u2755\u2795-\u2797\u27B0\u27BF\u2B50]|\u26D3\uFE0F?(?:\u200D\uD83D\uDCA5)?|\u26F9(?:\uD83C[\uDFFB-\uDFFF]|\uFE0F)?(?:\u200D[\u2640\u2642]\uFE0F?)?|\u2764\uFE0F?(?:\u200D(?:\uD83D\uDD25|\uD83E\uDE79))?|\uD83C(?:[\uDC04\uDD70\uDD71\uDD7E\uDD7F\uDE02\uDE37\uDF21\uDF24-\uDF2C\uDF36\uDF7D\uDF96\uDF97\uDF99-\uDF9B\uDF9E\uDF9F\uDFCD\uDFCE\uDFD4-\uDFDF\uDFF5\uDFF7]\uFE0F?|[\uDF85\uDFC2\uDFC7](?:\uD83C[\uDFFB-\uDFFF])?|[\uDFC4\uDFCA](?:\uD83C[\uDFFB-\uDFFF])?(?:\u200D[\u2640\u2642]\uFE0F?)?|[\uDFCB\uDFCC](?:\uD83C[\uDFFB-\uDFFF]|\uFE0F)?(?:\u200D[\u2640\u2642]\uFE0F?)?|[\uDCCF\uDD8E\uDD91-\uDD9A\uDE01\uDE1A\uDE2F\uDE32-\uDE36\uDE38-\uDE3A\uDE50\uDE51\uDF00-\uDF20\uDF2D-\uDF35\uDF37-\uDF43\uDF45-\uDF4A\uDF4C-\uDF7C\uDF7E-\uDF84\uDF86-\uDF93\uDFA0-\uDFC1\uDFC5\uDFC6\uDFC8\uDFC9\uDFCF-\uDFD3\uDFE0-\uDFF0\uDFF8-\uDFFF]|\uDDE6\uD83C[\uDDE8-\uDDEC\uDDEE\uDDF1\uDDF2\uDDF4\uDDF6-\uDDFA\uDDFC\uDDFD\uDDFF]|\uDDE7\uD83C[\uDDE6\uDDE7\uDDE9-\uDDEF\uDDF1-\uDDF4\uDDF6-\uDDF9\uDDFB\uDDFC\uDDFE\uDDFF]|\uDDE8\uD83C[\uDDE6\uDDE8\uDDE9\uDDEB-\uDDEE\uDDF0-\uDDF7\uDDFA-\uDDFF]|\uDDE9\uD83C[\uDDEA\uDDEC\uDDEF\uDDF0\uDDF2\uDDF4\uDDFF]|\uDDEA\uD83C[\uDDE6\uDDE8\uDDEA\uDDEC\uDDED\uDDF7-\uDDFA]|\uDDEB\uD83C[\uDDEE-\uDDF0\uDDF2\uDDF4\uDDF7]|\uDDEC\uD83C[\uDDE6\uDDE7\uDDE9-\uDDEE\uDDF1-\uDDF3\uDDF5-\uDDFA\uDDFC\uDDFE]|\uDDED\uD83C[\uDDF0\uDDF2\uDDF3\uDDF7\uDDF9\uDDFA]|\uDDEE\uD83C[\uDDE8-\uDDEA\uDDF1-\uDDF4\uDDF6-\uDDF9]|\uDDEF\uD83C[\uDDEA\uDDF2\uDDF4\uDDF5]|\uDDF0\uD83C[\uDDEA\uDDEC-\uDDEE\uDDF2\uDDF3\uDDF5\uDDF7\uDDFC\uDDFE\uDDFF]|\uDDF1\uD83C[\uDDE6-\uDDE8\uDDEE\uDDF0\uDDF7-\uDDFB\uDDFE]|\uDDF2\uD83C[\uDDE6\uDDE8-\uDDED\uDDF0-\uDDFF]|\uDDF3\uD83C[\uDDE6\uDDE8\uDDEA-\uDDEC\uDDEE\uDDF1\uDDF4\uDDF5\uDDF7\uDDFA\uDDFF]|\uDDF4\uD83C\uDDF2|\uDDF5\uD83C[\uDDE6\uDDEA-\uDDED\uDDF0-\uDDF3\uDDF7-\uDDF9\uDDFC\uDDFE]|\uDDF6\uD83C\uDDE6|\uDDF7\uD83C[\uDDEA\uDDF4\uDDF8\uDDFA\uDDFC]|\uDDF8\uD83C[\uDDE6-\uDDEA\uDDEC-\uDDF4\uDDF7-\uDDF9\uDDFB\uDDFD-\uDDFF]|\uDDF9\uD83C[\uDDE6\uDDE8\uDDE9\uDDEB-\uDDED\uDDEF-\uDDF4\uDDF7\uDDF9\uDDFB\uDDFC\uDDFF]|\uDDFA\uD83C[\uDDE6\uDDEC\uDDF2\uDDF3\uDDF8\uDDFE\uDDFF]|\uDDFB\uD83C[\uDDE6\uDDE8\uDDEA\uDDEC\uDDEE\uDDF3\uDDFA]|\uDDFC\uD83C[\uDDEB\uDDF8]|\uDDFD\uD83C\uDDF0|\uDDFE\uD83C[\uDDEA\uDDF9]|\uDDFF\uD83C[\uDDE6\uDDF2\uDDFC]|\uDF44(?:\u200D\uD83D\uDFEB)?|\uDF4B(?:\u200D\uD83D\uDFE9)?|\uDFC3(?:\uD83C[\uDFFB-\uDFFF])?(?:\u200D(?:[\u2640\u2642]\uFE0F?(?:\u200D\u27A1\uFE0F?)?|\u27A1\uFE0F?))?|\uDFF3\uFE0F?(?:\u200D(?:\u26A7\uFE0F?|\uD83C\uDF08))?|\uDFF4(?:\u200D\u2620\uFE0F?|\uDB40\uDC67\uDB40\uDC62\uDB40(?:\uDC65\uDB40\uDC6E\uDB40\uDC67|\uDC73\uDB40\uDC63\uDB40\uDC74|\uDC77\uDB40\uDC6C\uDB40\uDC73)\uDB40\uDC7F)?)|\uD83D(?:[\uDC3F\uDCFD\uDD49\uDD4A\uDD6F\uDD70\uDD73\uDD76-\uDD79\uDD87\uDD8A-\uDD8D\uDDA5\uDDA8\uDDB1\uDDB2\uDDBC\uDDC2-\uDDC4\uDDD1-\uDDD3\uDDDC-\uDDDE\uDDE1\uDDE3\uDDE8\uDDEF\uDDF3\uDDFA\uDECB\uDECD-\uDECF\uDEE0-\uDEE5\uDEE9\uDEF0\uDEF3]\uFE0F?|[\uDC42\uDC43\uDC46-\uDC50\uDC66\uDC67\uDC6B-\uDC6D\uDC72\uDC74-\uDC76\uDC78\uDC7C\uDC83\uDC85\uDC8F\uDC91\uDCAA\uDD7A\uDD95\uDD96\uDE4C\uDE4F\uDEC0\uDECC](?:\uD83C[\uDFFB-\uDFFF])?|[\uDC6E-\uDC71\uDC73\uDC77\uDC81\uDC82\uDC86\uDC87\uDE45-\uDE47\uDE4B\uDE4D\uDE4E\uDEA3\uDEB4\uDEB5](?:\uD83C[\uDFFB-\uDFFF])?(?:\u200D[\u2640\u2642]\uFE0F?)?|[\uDD74\uDD90](?:\uD83C[\uDFFB-\uDFFF]|\uFE0F)?|[\uDC00-\uDC07\uDC09-\uDC14\uDC16-\uDC25\uDC27-\uDC3A\uDC3C-\uDC3E\uDC40\uDC44\uDC45\uDC51-\uDC65\uDC6A\uDC79-\uDC7B\uDC7D-\uDC80\uDC84\uDC88-\uDC8E\uDC90\uDC92-\uDCA9\uDCAB-\uDCFC\uDCFF-\uDD3D\uDD4B-\uDD4E\uDD50-\uDD67\uDDA4\uDDFB-\uDE2D\uDE2F-\uDE34\uDE37-\uDE41\uDE43\uDE44\uDE48-\uDE4A\uDE80-\uDEA2\uDEA4-\uDEB3\uDEB7-\uDEBF\uDEC1-\uDEC5\uDED0-\uDED2\uDED5-\uDED8\uDEDC-\uDEDF\uDEEB\uDEEC\uDEF4-\uDEFC\uDFE0-\uDFEB\uDFF0]|\uDC08(?:\u200D\u2B1B)?|\uDC15(?:\u200D\uD83E\uDDBA)?|\uDC26(?:\u200D(?:\u2B1B|\uD83D\uDD25))?|\uDC3B(?:\u200D\u2744\uFE0F?)?|\uDC41\uFE0F?(?:\u200D\uD83D\uDDE8\uFE0F?)?|\uDC68(?:\u200D(?:[\u2695\u2696\u2708]\uFE0F?|\u2764\uFE0F?\u200D\uD83D(?:\uDC8B\u200D\uD83D)?\uDC68|\uD83C[\uDF3E\uDF73\uDF7C\uDF93\uDFA4\uDFA8\uDFEB\uDFED]|\uD83D(?:[\uDC68\uDC69]\u200D\uD83D(?:\uDC66(?:\u200D\uD83D\uDC66)?|\uDC67(?:\u200D\uD83D[\uDC66\uDC67])?)|[\uDCBB\uDCBC\uDD27\uDD2C\uDE80\uDE92]|\uDC66(?:\u200D\uD83D\uDC66)?|\uDC67(?:\u200D\uD83D[\uDC66\uDC67])?)|\uD83E(?:[\uDDAF\uDDBC\uDDBD](?:\u200D\u27A1\uFE0F?)?|[\uDDB0-\uDDB3]))|\uD83C(?:\uDFFB(?:\u200D(?:[\u2695\u2696\u2708]\uFE0F?|\u2764\uFE0F?\u200D\uD83D(?:\uDC8B\u200D\uD83D)?\uDC68\uD83C[\uDFFB-\uDFFF]|\uD83C[\uDF3E\uDF73\uDF7C\uDF93\uDFA4\uDFA8\uDFEB\uDFED]|\uD83D(?:[\uDCBB\uDCBC\uDD27\uDD2C\uDE80\uDE92]|\uDC30\u200D\uD83D\uDC68\uD83C[\uDFFC-\uDFFF])|\uD83E(?:[\uDD1D\uDEEF]\u200D\uD83D\uDC68\uD83C[\uDFFC-\uDFFF]|[\uDDAF\uDDBC\uDDBD](?:\u200D\u27A1\uFE0F?)?|[\uDDB0-\uDDB3])))?|\uDFFC(?:\u200D(?:[\u2695\u2696\u2708]\uFE0F?|\u2764\uFE0F?\u200D\uD83D(?:\uDC8B\u200D\uD83D)?\uDC68\uD83C[\uDFFB-\uDFFF]|\uD83C[\uDF3E\uDF73\uDF7C\uDF93\uDFA4\uDFA8\uDFEB\uDFED]|\uD83D(?:[\uDCBB\uDCBC\uDD27\uDD2C\uDE80\uDE92]|\uDC30\u200D\uD83D\uDC68\uD83C[\uDFFB\uDFFD-\uDFFF])|\uD83E(?:[\uDD1D\uDEEF]\u200D\uD83D\uDC68\uD83C[\uDFFB\uDFFD-\uDFFF]|[\uDDAF\uDDBC\uDDBD](?:\u200D\u27A1\uFE0F?)?|[\uDDB0-\uDDB3])))?|\uDFFD(?:\u200D(?:[\u2695\u2696\u2708]\uFE0F?|\u2764\uFE0F?\u200D\uD83D(?:\uDC8B\u200D\uD83D)?\uDC68\uD83C[\uDFFB-\uDFFF]|\uD83C[\uDF3E\uDF73\uDF7C\uDF93\uDFA4\uDFA8\uDFEB\uDFED]|\uD83D(?:[\uDCBB\uDCBC\uDD27\uDD2C\uDE80\uDE92]|\uDC30\u200D\uD83D\uDC68\uD83C[\uDFFB\uDFFC\uDFFE\uDFFF])|\uD83E(?:[\uDD1D\uDEEF]\u200D\uD83D\uDC68\uD83C[\uDFFB\uDFFC\uDFFE\uDFFF]|[\uDDAF\uDDBC\uDDBD](?:\u200D\u27A1\uFE0F?)?|[\uDDB0-\uDDB3])))?|\uDFFE(?:\u200D(?:[\u2695\u2696\u2708]\uFE0F?|\u2764\uFE0F?\u200D\uD83D(?:\uDC8B\u200D\uD83D)?\uDC68\uD83C[\uDFFB-\uDFFF]|\uD83C[\uDF3E\uDF73\uDF7C\uDF93\uDFA4\uDFA8\uDFEB\uDFED]|\uD83D(?:[\uDCBB\uDCBC\uDD27\uDD2C\uDE80\uDE92]|\uDC30\u200D\uD83D\uDC68\uD83C[\uDFFB-\uDFFD\uDFFF])|\uD83E(?:[\uDD1D\uDEEF]\u200D\uD83D\uDC68\uD83C[\uDFFB-\uDFFD\uDFFF]|[\uDDAF\uDDBC\uDDBD](?:\u200D\u27A1\uFE0F?)?|[\uDDB0-\uDDB3])))?|\uDFFF(?:\u200D(?:[\u2695\u2696\u2708]\uFE0F?|\u2764\uFE0F?\u200D\uD83D(?:\uDC8B\u200D\uD83D)?\uDC68\uD83C[\uDFFB-\uDFFF]|\uD83C[\uDF3E\uDF73\uDF7C\uDF93\uDFA4\uDFA8\uDFEB\uDFED]|\uD83D(?:[\uDCBB\uDCBC\uDD27\uDD2C\uDE80\uDE92]|\uDC30\u200D\uD83D\uDC68\uD83C[\uDFFB-\uDFFE])|\uD83E(?:[\uDD1D\uDEEF]\u200D\uD83D\uDC68\uD83C[\uDFFB-\uDFFE]|[\uDDAF\uDDBC\uDDBD](?:\u200D\u27A1\uFE0F?)?|[\uDDB0-\uDDB3])))?))?|\uDC69(?:\u200D(?:[\u2695\u2696\u2708]\uFE0F?|\u2764\uFE0F?\u200D\uD83D(?:\uDC8B\u200D\uD83D)?[\uDC68\uDC69]|\uD83C[\uDF3E\uDF73\uDF7C\uDF93\uDFA4\uDFA8\uDFEB\uDFED]|\uD83D(?:[\uDCBB\uDCBC\uDD27\uDD2C\uDE80\uDE92]|\uDC66(?:\u200D\uD83D\uDC66)?|\uDC67(?:\u200D\uD83D[\uDC66\uDC67])?|\uDC69\u200D\uD83D(?:\uDC66(?:\u200D\uD83D\uDC66)?|\uDC67(?:\u200D\uD83D[\uDC66\uDC67])?))|\uD83E(?:[\uDDAF\uDDBC\uDDBD](?:\u200D\u27A1\uFE0F?)?|[\uDDB0-\uDDB3]))|\uD83C(?:\uDFFB(?:\u200D(?:[\u2695\u2696\u2708]\uFE0F?|\u2764\uFE0F?\u200D\uD83D(?:[\uDC68\uDC69]|\uDC8B\u200D\uD83D[\uDC68\uDC69])\uD83C[\uDFFB-\uDFFF]|\uD83C[\uDF3E\uDF73\uDF7C\uDF93\uDFA4\uDFA8\uDFEB\uDFED]|\uD83D(?:[\uDCBB\uDCBC\uDD27\uDD2C\uDE80\uDE92]|\uDC30\u200D\uD83D\uDC69\uD83C[\uDFFC-\uDFFF])|\uD83E(?:[\uDDAF\uDDBC\uDDBD](?:\u200D\u27A1\uFE0F?)?|[\uDDB0-\uDDB3]|\uDD1D\u200D\uD83D[\uDC68\uDC69]\uD83C[\uDFFC-\uDFFF]|\uDEEF\u200D\uD83D\uDC69\uD83C[\uDFFC-\uDFFF])))?|\uDFFC(?:\u200D(?:[\u2695\u2696\u2708]\uFE0F?|\u2764\uFE0F?\u200D\uD83D(?:[\uDC68\uDC69]|\uDC8B\u200D\uD83D[\uDC68\uDC69])\uD83C[\uDFFB-\uDFFF]|\uD83C[\uDF3E\uDF73\uDF7C\uDF93\uDFA4\uDFA8\uDFEB\uDFED]|\uD83D(?:[\uDCBB\uDCBC\uDD27\uDD2C\uDE80\uDE92]|\uDC30\u200D\uD83D\uDC69\uD83C[\uDFFB\uDFFD-\uDFFF])|\uD83E(?:[\uDDAF\uDDBC\uDDBD](?:\u200D\u27A1\uFE0F?)?|[\uDDB0-\uDDB3]|\uDD1D\u200D\uD83D[\uDC68\uDC69]\uD83C[\uDFFB\uDFFD-\uDFFF]|\uDEEF\u200D\uD83D\uDC69\uD83C[\uDFFB\uDFFD-\uDFFF])))?|\uDFFD(?:\u200D(?:[\u2695\u2696\u2708]\uFE0F?|\u2764\uFE0F?\u200D\uD83D(?:[\uDC68\uDC69]|\uDC8B\u200D\uD83D[\uDC68\uDC69])\uD83C[\uDFFB-\uDFFF]|\uD83C[\uDF3E\uDF73\uDF7C\uDF93\uDFA4\uDFA8\uDFEB\uDFED]|\uD83D(?:[\uDCBB\uDCBC\uDD27\uDD2C\uDE80\uDE92]|\uDC30\u200D\uD83D\uDC69\uD83C[\uDFFB\uDFFC\uDFFE\uDFFF])|\uD83E(?:[\uDDAF\uDDBC\uDDBD](?:\u200D\u27A1\uFE0F?)?|[\uDDB0-\uDDB3]|\uDD1D\u200D\uD83D[\uDC68\uDC69]\uD83C[\uDFFB\uDFFC\uDFFE\uDFFF]|\uDEEF\u200D\uD83D\uDC69\uD83C[\uDFFB\uDFFC\uDFFE\uDFFF])))?|\uDFFE(?:\u200D(?:[\u2695\u2696\u2708]\uFE0F?|\u2764\uFE0F?\u200D\uD83D(?:[\uDC68\uDC69]|\uDC8B\u200D\uD83D[\uDC68\uDC69])\uD83C[\uDFFB-\uDFFF]|\uD83C[\uDF3E\uDF73\uDF7C\uDF93\uDFA4\uDFA8\uDFEB\uDFED]|\uD83D(?:[\uDCBB\uDCBC\uDD27\uDD2C\uDE80\uDE92]|\uDC30\u200D\uD83D\uDC69\uD83C[\uDFFB-\uDFFD\uDFFF])|\uD83E(?:[\uDDAF\uDDBC\uDDBD](?:\u200D\u27A1\uFE0F?)?|[\uDDB0-\uDDB3]|\uDD1D\u200D\uD83D[\uDC68\uDC69]\uD83C[\uDFFB-\uDFFD\uDFFF]|\uDEEF\u200D\uD83D\uDC69\uD83C[\uDFFB-\uDFFD\uDFFF])))?|\uDFFF(?:\u200D(?:[\u2695\u2696\u2708]\uFE0F?|\u2764\uFE0F?\u200D\uD83D(?:[\uDC68\uDC69]|\uDC8B\u200D\uD83D[\uDC68\uDC69])\uD83C[\uDFFB-\uDFFF]|\uD83C[\uDF3E\uDF73\uDF7C\uDF93\uDFA4\uDFA8\uDFEB\uDFED]|\uD83D(?:[\uDCBB\uDCBC\uDD27\uDD2C\uDE80\uDE92]|\uDC30\u200D\uD83D\uDC69\uD83C[\uDFFB-\uDFFE])|\uD83E(?:[\uDDAF\uDDBC\uDDBD](?:\u200D\u27A1\uFE0F?)?|[\uDDB0-\uDDB3]|\uDD1D\u200D\uD83D[\uDC68\uDC69]\uD83C[\uDFFB-\uDFFE]|\uDEEF\u200D\uD83D\uDC69\uD83C[\uDFFB-\uDFFE])))?))?|\uDD75(?:\uD83C[\uDFFB-\uDFFF]|\uFE0F)?(?:\u200D[\u2640\u2642]\uFE0F?)?|\uDE2E(?:\u200D\uD83D\uDCA8)?|\uDE35(?:\u200D\uD83D\uDCAB)?|\uDE36(?:\u200D\uD83C\uDF2B\uFE0F?)?|\uDE42(?:\u200D[\u2194\u2195]\uFE0F?)?|\uDEB6(?:\uD83C[\uDFFB-\uDFFF])?(?:\u200D(?:[\u2640\u2642]\uFE0F?(?:\u200D\u27A1\uFE0F?)?|\u27A1\uFE0F?))?)|\uD83E(?:[\uDD0C\uDD0F\uDD18-\uDD1F\uDD30-\uDD34\uDD36\uDD77\uDDB5\uDDB6\uDDBB\uDDD2\uDDD3\uDDD5\uDEC3-\uDEC5\uDEF0\uDEF2-\uDEF8](?:\uD83C[\uDFFB-\uDFFF])?|[\uDD26\uDD35\uDD37-\uDD39\uDD3C-\uDD3E\uDDB8\uDDB9\uDDCD\uDDCF\uDDD4\uDDD6-\uDDDD](?:\uD83C[\uDFFB-\uDFFF])?(?:\u200D[\u2640\u2642]\uFE0F?)?|[\uDDDE\uDDDF](?:\u200D[\u2640\u2642]\uFE0F?)?|[\uDD0D\uDD0E\uDD10-\uDD17\uDD20-\uDD25\uDD27-\uDD2F\uDD3A\uDD3F-\uDD45\uDD47-\uDD76\uDD78-\uDDB4\uDDB7\uDDBA\uDDBC-\uDDCC\uDDD0\uDDE0-\uDDFF\uDE70-\uDE7C\uDE80-\uDE8A\uDE8E-\uDEC2\uDEC6\uDEC8\uDECD-\uDEDC\uDEDF-\uDEEA\uDEEF]|\uDDCE(?:\uD83C[\uDFFB-\uDFFF])?(?:\u200D(?:[\u2640\u2642]\uFE0F?(?:\u200D\u27A1\uFE0F?)?|\u27A1\uFE0F?))?|\uDDD1(?:\u200D(?:[\u2695\u2696\u2708]\uFE0F?|\uD83C[\uDF3E\uDF73\uDF7C\uDF84\uDF93\uDFA4\uDFA8\uDFEB\uDFED]|\uD83D[\uDCBB\uDCBC\uDD27\uDD2C\uDE80\uDE92]|\uD83E(?:[\uDDAF\uDDBC\uDDBD](?:\u200D\u27A1\uFE0F?)?|[\uDDB0-\uDDB3\uDE70]|\uDD1D\u200D\uD83E\uDDD1|\uDDD1\u200D\uD83E\uDDD2(?:\u200D\uD83E\uDDD2)?|\uDDD2(?:\u200D\uD83E\uDDD2)?))|\uD83C(?:\uDFFB(?:\u200D(?:[\u2695\u2696\u2708]\uFE0F?|\u2764\uFE0F?\u200D(?:\uD83D\uDC8B\u200D)?\uD83E\uDDD1\uD83C[\uDFFC-\uDFFF]|\uD83C[\uDF3E\uDF73\uDF7C\uDF84\uDF93\uDFA4\uDFA8\uDFEB\uDFED]|\uD83D(?:[\uDCBB\uDCBC\uDD27\uDD2C\uDE80\uDE92]|\uDC30\u200D\uD83E\uDDD1\uD83C[\uDFFC-\uDFFF])|\uD83E(?:[\uDDAF\uDDBC\uDDBD](?:\u200D\u27A1\uFE0F?)?|[\uDDB0-\uDDB3\uDE70]|\uDD1D\u200D\uD83E\uDDD1\uD83C[\uDFFB-\uDFFF]|\uDEEF\u200D\uD83E\uDDD1\uD83C[\uDFFC-\uDFFF])))?|\uDFFC(?:\u200D(?:[\u2695\u2696\u2708]\uFE0F?|\u2764\uFE0F?\u200D(?:\uD83D\uDC8B\u200D)?\uD83E\uDDD1\uD83C[\uDFFB\uDFFD-\uDFFF]|\uD83C[\uDF3E\uDF73\uDF7C\uDF84\uDF93\uDFA4\uDFA8\uDFEB\uDFED]|\uD83D(?:[\uDCBB\uDCBC\uDD27\uDD2C\uDE80\uDE92]|\uDC30\u200D\uD83E\uDDD1\uD83C[\uDFFB\uDFFD-\uDFFF])|\uD83E(?:[\uDDAF\uDDBC\uDDBD](?:\u200D\u27A1\uFE0F?)?|[\uDDB0-\uDDB3\uDE70]|\uDD1D\u200D\uD83E\uDDD1\uD83C[\uDFFB-\uDFFF]|\uDEEF\u200D\uD83E\uDDD1\uD83C[\uDFFB\uDFFD-\uDFFF])))?|\uDFFD(?:\u200D(?:[\u2695\u2696\u2708]\uFE0F?|\u2764\uFE0F?\u200D(?:\uD83D\uDC8B\u200D)?\uD83E\uDDD1\uD83C[\uDFFB\uDFFC\uDFFE\uDFFF]|\uD83C[\uDF3E\uDF73\uDF7C\uDF84\uDF93\uDFA4\uDFA8\uDFEB\uDFED]|\uD83D(?:[\uDCBB\uDCBC\uDD27\uDD2C\uDE80\uDE92]|\uDC30\u200D\uD83E\uDDD1\uD83C[\uDFFB\uDFFC\uDFFE\uDFFF])|\uD83E(?:[\uDDAF\uDDBC\uDDBD](?:\u200D\u27A1\uFE0F?)?|[\uDDB0-\uDDB3\uDE70]|\uDD1D\u200D\uD83E\uDDD1\uD83C[\uDFFB-\uDFFF]|\uDEEF\u200D\uD83E\uDDD1\uD83C[\uDFFB\uDFFC\uDFFE\uDFFF])))?|\uDFFE(?:\u200D(?:[\u2695\u2696\u2708]\uFE0F?|\u2764\uFE0F?\u200D(?:\uD83D\uDC8B\u200D)?\uD83E\uDDD1\uD83C[\uDFFB-\uDFFD\uDFFF]|\uD83C[\uDF3E\uDF73\uDF7C\uDF84\uDF93\uDFA4\uDFA8\uDFEB\uDFED]|\uD83D(?:[\uDCBB\uDCBC\uDD27\uDD2C\uDE80\uDE92]|\uDC30\u200D\uD83E\uDDD1\uD83C[\uDFFB-\uDFFD\uDFFF])|\uD83E(?:[\uDDAF\uDDBC\uDDBD](?:\u200D\u27A1\uFE0F?)?|[\uDDB0-\uDDB3\uDE70]|\uDD1D\u200D\uD83E\uDDD1\uD83C[\uDFFB-\uDFFF]|\uDEEF\u200D\uD83E\uDDD1\uD83C[\uDFFB-\uDFFD\uDFFF])))?|\uDFFF(?:\u200D(?:[\u2695\u2696\u2708]\uFE0F?|\u2764\uFE0F?\u200D(?:\uD83D\uDC8B\u200D)?\uD83E\uDDD1\uD83C[\uDFFB-\uDFFE]|\uD83C[\uDF3E\uDF73\uDF7C\uDF84\uDF93\uDFA4\uDFA8\uDFEB\uDFED]|\uD83D(?:[\uDCBB\uDCBC\uDD27\uDD2C\uDE80\uDE92]|\uDC30\u200D\uD83E\uDDD1\uD83C[\uDFFB-\uDFFE])|\uD83E(?:[\uDDAF\uDDBC\uDDBD](?:\u200D\u27A1\uFE0F?)?|[\uDDB0-\uDDB3\uDE70]|\uDD1D\u200D\uD83E\uDDD1\uD83C[\uDFFB-\uDFFF]|\uDEEF\u200D\uD83E\uDDD1\uD83C[\uDFFB-\uDFFE])))?))?|\uDEF1(?:\uD83C(?:\uDFFB(?:\u200D\uD83E\uDEF2\uD83C[\uDFFC-\uDFFF])?|\uDFFC(?:\u200D\uD83E\uDEF2\uD83C[\uDFFB\uDFFD-\uDFFF])?|\uDFFD(?:\u200D\uD83E\uDEF2\uD83C[\uDFFB\uDFFC\uDFFE\uDFFF])?|\uDFFE(?:\u200D\uD83E\uDEF2\uD83C[\uDFFB-\uDFFD\uDFFF])?|\uDFFF(?:\u200D\uD83E\uDEF2\uD83C[\uDFFB-\uDFFE])?))?)/g});var Kn="1.0.0-rc.88";N();var K0=`aluy \u2014 agente de terminal que roda na sua m\xE1quina, com o seu provider de LLM
140
+ `)}function l2(t,e){return t.length<=e?t:t.slice(0,e-1).trimEnd()+"\u2026"}var B0=E(()=>{"use strict"});var U0=E(()=>{"use strict";xm();k0();x0();S0();E0();A0();_0();Vu();F0();B0()});function qb(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 j0(t,e){let o=qb(t),n=qb(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 l=typeof i=="number",c=typeof a=="number";return l&&c?i<a?-1:1:l?-1:c?1:i<a?-1:1}return 0}function Wb(t,e){return j0(t,e)===1}var H0=E(()=>{"use strict"});function Em(t,e,o){if(e.size===0)return{kind:"discard",reason:"allowlist vazia (default fechado)"};if(!e.has(t.conversation))return{kind:"discard",reason:`canal ${t.conversation} n\xE3o-allowlistado`};if(t.senderIsBot===!0)return{kind:"discard",reason:"remetente \xE9 bot (anti-loop, TC-6)"};let n=t.content.trim();if(n==="")return{kind:"discard",reason:"mensagem sem conte\xFAdo"};if(o.authIsForgeable)return{kind:"data",text:n};if(t.provenance.kind==="third-party-relayed")return{kind:"data",text:n};let r=t.provenance.embeddedThirdParty?.trim();return r?{kind:"instruction",text:n,forwardedData:r}:{kind:"instruction",text:n}}var Gb=E(()=>{"use strict"});function zb(t){let e;if(t.forwarded===!0)e={kind:"third-party-relayed"};else{let o=(t.quotedText??"").trim();e=o?{kind:"author-direct",embeddedThirdParty:o}:{kind:"author-direct"}}return{content:t.text,sender:String(t.fromId),conversation:String(t.chatId),provenance:e,...t.isBot===!0?{senderIsBot:!0}:{}}}function Kb(t){let e=new Set;for(let o of t)typeof o=="number"&&Number.isFinite(o)&&Number.isInteger(o)&&e.add(o);return e}var cc,q0=E(()=>{"use strict";Gb();cc={id:"telegram",displayName:"Telegram",authIsForgeable:!1}});function Yb(t){return typeof t=="number"&&Number.isFinite(t)?t:void 0}function zi(t){return typeof t=="object"&&t!==null?t:void 0}function Vb(t,e){let o=zi(t);if(!o||o.ok!==!0||!Array.isArray(o.result))return{updates:[],nextOffset:e};let n=[],r=e-1;for(let s of o.result){let i=zi(s);if(!i)continue;let a=Yb(i.update_id);a!==void 0&&a>r&&(r=a);let l=zi(i.message);if(!l)continue;let c=zi(l.chat),u=Yb(c?.id);if(u===void 0||c?.type!=="private")continue;let f=zi(l.from),d=Yb(f?.id)??u,p=f?.is_bot===!0,h=typeof l.text=="string"?l.text:"",y=l.forward_origin!==void 0||l.forward_from!==void 0||l.forward_from_chat!==void 0||l.forward_sender_name!==void 0||l.forward_date!==void 0,g=(()=>{let S=zi(l.quote)?.text;return typeof S=="string"&&S.trim()!==""?S:void 0})();n.push({chatId:u,fromId:d,text:h,...y?{forwarded:!0}:{},...g!==void 0?{quotedText:g}:{},...p?{isBot:!0}:{}})}return{updates:n,nextOffset:r+1}}var W0=E(()=>{"use strict"});var uc,G0=E(()=>{"use strict";uc=class{maxPerWindow;windowMs;stamps=[];constructor(e,o){this.maxPerWindow=e,this.windowMs=o}tryConsume(e){let o=e-this.windowMs;for(;this.stamps.length>0&&this.stamps[0]<=o;)this.stamps.shift();return this.stamps.length>=this.maxPerWindow?!1:(this.stamps.push(e),!0)}get used(){return this.stamps.length}}});function Xb(t){return`connector-${t}-token`}function dc(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)`}function Jb(t,e){let o=e.trim();return o.length<8?t:t.split(o).join("\xABREDACTED\xBB")}var z0=E(()=>{"use strict"});var N=E(()=>{"use strict";HS();dE();EE();Hw();c0();zy();y0();U0();Eb();Qd();H0();Gb();q0();W0();G0();z0()});import{posix as T8}from"node:path";function _8(t){return T8.normalize(t)}function po(t){let e=_8(t);for(let o of R8)if(o.re.test(e))return o.deny?{kind:"deny",why:o.why}:{kind:"ask",why:o.why};return{kind:"allow"}}function hv(t){return po(t).kind==="allow"}var R8,Br=E(()=>{"use strict";R8=[{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 Nv={};Np(Nv,{UserWorkflowsLoader:()=>qr,WORKFLOWS_DIRNAME:()=>Iv});import{homedir as h3}from"node:os";import{join as Fv}from"node:path";import{readdirSync as g3,readFileSync as y3,mkdirSync as b3,statSync as v3}from"node:fs";var k3,Iv,x3,S3,qr,qm=E(()=>{"use strict";N();k3=448,Iv="workflows",x3=64*1024,S3=256,qr=class{dir;constructor(e={}){let o=e.baseDir??Fv(h3(),".aluy");this.dir=Fv(o,Iv)}get workflowsDir(){return this.dir}ensureDir(){try{b3(this.dir,{mode:k3,recursive:!0})}catch{}}load(){let e;try{e=g3(this.dir,{withFileTypes:!0})}catch{return{workflows:[],errors:[]}}let o=e.filter(i=>(i.isFile()||i.isSymbolicLink())&&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>=S3)break;let a=this.readOne(i);if(a!==null){if(jl(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=Fv(this.dir,e);try{let n=v3(o);if(!n.isFile()||n.size>x3)return null;let r=y3(o,"utf8");return Hl(e,r,"global")}catch{return null}}}});var Bv={};Np(Bv,{PROJECT_WORKFLOWS_DIRNAMES:()=>$v,ProjectWorkflowsLoader:()=>Wr});import{join as E3}from"node:path";import{readdirSync as w3,readFileSync as A3,statSync as C3}from"node:fs";var $v,D3,T3,Wr,Wm=E(()=>{"use strict";N();Br();$v=[".claude/workflows",".aluy/workflows"],D3=64*1024,T3=256,Wr=class{workspace;constructor(e){this.workspace=e.workspace}load(){let e=new Set,o=[],n=[];for(let r of $v){let s;try{s=this.workspace.resolveInside(r)}catch{continue}let i;try{i=w3(s,{withFileTypes:!0})}catch{continue}let a=i.filter(l=>(l.isFile()||l.isSymbolicLink())&&l.name.toLowerCase().endsWith(".md")).map(l=>l.name).sort((l,c)=>l.localeCompare(c));for(let l of a){if(o.length>=T3)break;let c=this.readOne(r,s,l);if(c!==null){if(jl(c)){n.push(c);continue}e.has(c.name)||(e.add(c.name),o.push(c))}}}return{workflows:o,errors:n}}readOne(e,o,n){let r=`${e}/${n}`;if(po(r).kind!=="allow")return null;let s=E3(o,n);try{this.workspace.resolveInside(r);let i=C3(s);if(!i.isFile()||i.size>D3)return null;let a=A3(s,"utf8");return Hl(n,a,"project")}catch{return null}}}});var OM=KI((eye,RM)=>{RM.exports=()=>/[#*0-9]\uFE0F?\u20E3|[\xA9\xAE\u203C\u2049\u2122\u2139\u2194-\u2199\u21A9\u21AA\u231A\u231B\u2328\u23CF\u23ED-\u23EF\u23F1\u23F2\u23F8-\u23FA\u24C2\u25AA\u25AB\u25B6\u25C0\u25FB\u25FC\u25FE\u2600-\u2604\u260E\u2611\u2614\u2615\u2618\u2620\u2622\u2623\u2626\u262A\u262E\u262F\u2638-\u263A\u2640\u2642\u2648-\u2653\u265F\u2660\u2663\u2665\u2666\u2668\u267B\u267E\u267F\u2692\u2694-\u2697\u2699\u269B\u269C\u26A0\u26A7\u26AA\u26B0\u26B1\u26BD\u26BE\u26C4\u26C8\u26CF\u26D1\u26E9\u26F0-\u26F5\u26F7\u26F8\u26FA\u2702\u2708\u2709\u270F\u2712\u2714\u2716\u271D\u2721\u2733\u2734\u2744\u2747\u2757\u2763\u27A1\u2934\u2935\u2B05-\u2B07\u2B1B\u2B1C\u2B55\u3030\u303D\u3297\u3299]\uFE0F?|[\u261D\u270C\u270D](?:\uD83C[\uDFFB-\uDFFF]|\uFE0F)?|[\u270A\u270B](?:\uD83C[\uDFFB-\uDFFF])?|[\u23E9-\u23EC\u23F0\u23F3\u25FD\u2693\u26A1\u26AB\u26C5\u26CE\u26D4\u26EA\u26FD\u2705\u2728\u274C\u274E\u2753-\u2755\u2795-\u2797\u27B0\u27BF\u2B50]|\u26D3\uFE0F?(?:\u200D\uD83D\uDCA5)?|\u26F9(?:\uD83C[\uDFFB-\uDFFF]|\uFE0F)?(?:\u200D[\u2640\u2642]\uFE0F?)?|\u2764\uFE0F?(?:\u200D(?:\uD83D\uDD25|\uD83E\uDE79))?|\uD83C(?:[\uDC04\uDD70\uDD71\uDD7E\uDD7F\uDE02\uDE37\uDF21\uDF24-\uDF2C\uDF36\uDF7D\uDF96\uDF97\uDF99-\uDF9B\uDF9E\uDF9F\uDFCD\uDFCE\uDFD4-\uDFDF\uDFF5\uDFF7]\uFE0F?|[\uDF85\uDFC2\uDFC7](?:\uD83C[\uDFFB-\uDFFF])?|[\uDFC4\uDFCA](?:\uD83C[\uDFFB-\uDFFF])?(?:\u200D[\u2640\u2642]\uFE0F?)?|[\uDFCB\uDFCC](?:\uD83C[\uDFFB-\uDFFF]|\uFE0F)?(?:\u200D[\u2640\u2642]\uFE0F?)?|[\uDCCF\uDD8E\uDD91-\uDD9A\uDE01\uDE1A\uDE2F\uDE32-\uDE36\uDE38-\uDE3A\uDE50\uDE51\uDF00-\uDF20\uDF2D-\uDF35\uDF37-\uDF43\uDF45-\uDF4A\uDF4C-\uDF7C\uDF7E-\uDF84\uDF86-\uDF93\uDFA0-\uDFC1\uDFC5\uDFC6\uDFC8\uDFC9\uDFCF-\uDFD3\uDFE0-\uDFF0\uDFF8-\uDFFF]|\uDDE6\uD83C[\uDDE8-\uDDEC\uDDEE\uDDF1\uDDF2\uDDF4\uDDF6-\uDDFA\uDDFC\uDDFD\uDDFF]|\uDDE7\uD83C[\uDDE6\uDDE7\uDDE9-\uDDEF\uDDF1-\uDDF4\uDDF6-\uDDF9\uDDFB\uDDFC\uDDFE\uDDFF]|\uDDE8\uD83C[\uDDE6\uDDE8\uDDE9\uDDEB-\uDDEE\uDDF0-\uDDF7\uDDFA-\uDDFF]|\uDDE9\uD83C[\uDDEA\uDDEC\uDDEF\uDDF0\uDDF2\uDDF4\uDDFF]|\uDDEA\uD83C[\uDDE6\uDDE8\uDDEA\uDDEC\uDDED\uDDF7-\uDDFA]|\uDDEB\uD83C[\uDDEE-\uDDF0\uDDF2\uDDF4\uDDF7]|\uDDEC\uD83C[\uDDE6\uDDE7\uDDE9-\uDDEE\uDDF1-\uDDF3\uDDF5-\uDDFA\uDDFC\uDDFE]|\uDDED\uD83C[\uDDF0\uDDF2\uDDF3\uDDF7\uDDF9\uDDFA]|\uDDEE\uD83C[\uDDE8-\uDDEA\uDDF1-\uDDF4\uDDF6-\uDDF9]|\uDDEF\uD83C[\uDDEA\uDDF2\uDDF4\uDDF5]|\uDDF0\uD83C[\uDDEA\uDDEC-\uDDEE\uDDF2\uDDF3\uDDF5\uDDF7\uDDFC\uDDFE\uDDFF]|\uDDF1\uD83C[\uDDE6-\uDDE8\uDDEE\uDDF0\uDDF7-\uDDFB\uDDFE]|\uDDF2\uD83C[\uDDE6\uDDE8-\uDDED\uDDF0-\uDDFF]|\uDDF3\uD83C[\uDDE6\uDDE8\uDDEA-\uDDEC\uDDEE\uDDF1\uDDF4\uDDF5\uDDF7\uDDFA\uDDFF]|\uDDF4\uD83C\uDDF2|\uDDF5\uD83C[\uDDE6\uDDEA-\uDDED\uDDF0-\uDDF3\uDDF7-\uDDF9\uDDFC\uDDFE]|\uDDF6\uD83C\uDDE6|\uDDF7\uD83C[\uDDEA\uDDF4\uDDF8\uDDFA\uDDFC]|\uDDF8\uD83C[\uDDE6-\uDDEA\uDDEC-\uDDF4\uDDF7-\uDDF9\uDDFB\uDDFD-\uDDFF]|\uDDF9\uD83C[\uDDE6\uDDE8\uDDE9\uDDEB-\uDDED\uDDEF-\uDDF4\uDDF7\uDDF9\uDDFB\uDDFC\uDDFF]|\uDDFA\uD83C[\uDDE6\uDDEC\uDDF2\uDDF3\uDDF8\uDDFE\uDDFF]|\uDDFB\uD83C[\uDDE6\uDDE8\uDDEA\uDDEC\uDDEE\uDDF3\uDDFA]|\uDDFC\uD83C[\uDDEB\uDDF8]|\uDDFD\uD83C\uDDF0|\uDDFE\uD83C[\uDDEA\uDDF9]|\uDDFF\uD83C[\uDDE6\uDDF2\uDDFC]|\uDF44(?:\u200D\uD83D\uDFEB)?|\uDF4B(?:\u200D\uD83D\uDFE9)?|\uDFC3(?:\uD83C[\uDFFB-\uDFFF])?(?:\u200D(?:[\u2640\u2642]\uFE0F?(?:\u200D\u27A1\uFE0F?)?|\u27A1\uFE0F?))?|\uDFF3\uFE0F?(?:\u200D(?:\u26A7\uFE0F?|\uD83C\uDF08))?|\uDFF4(?:\u200D\u2620\uFE0F?|\uDB40\uDC67\uDB40\uDC62\uDB40(?:\uDC65\uDB40\uDC6E\uDB40\uDC67|\uDC73\uDB40\uDC63\uDB40\uDC74|\uDC77\uDB40\uDC6C\uDB40\uDC73)\uDB40\uDC7F)?)|\uD83D(?:[\uDC3F\uDCFD\uDD49\uDD4A\uDD6F\uDD70\uDD73\uDD76-\uDD79\uDD87\uDD8A-\uDD8D\uDDA5\uDDA8\uDDB1\uDDB2\uDDBC\uDDC2-\uDDC4\uDDD1-\uDDD3\uDDDC-\uDDDE\uDDE1\uDDE3\uDDE8\uDDEF\uDDF3\uDDFA\uDECB\uDECD-\uDECF\uDEE0-\uDEE5\uDEE9\uDEF0\uDEF3]\uFE0F?|[\uDC42\uDC43\uDC46-\uDC50\uDC66\uDC67\uDC6B-\uDC6D\uDC72\uDC74-\uDC76\uDC78\uDC7C\uDC83\uDC85\uDC8F\uDC91\uDCAA\uDD7A\uDD95\uDD96\uDE4C\uDE4F\uDEC0\uDECC](?:\uD83C[\uDFFB-\uDFFF])?|[\uDC6E-\uDC71\uDC73\uDC77\uDC81\uDC82\uDC86\uDC87\uDE45-\uDE47\uDE4B\uDE4D\uDE4E\uDEA3\uDEB4\uDEB5](?:\uD83C[\uDFFB-\uDFFF])?(?:\u200D[\u2640\u2642]\uFE0F?)?|[\uDD74\uDD90](?:\uD83C[\uDFFB-\uDFFF]|\uFE0F)?|[\uDC00-\uDC07\uDC09-\uDC14\uDC16-\uDC25\uDC27-\uDC3A\uDC3C-\uDC3E\uDC40\uDC44\uDC45\uDC51-\uDC65\uDC6A\uDC79-\uDC7B\uDC7D-\uDC80\uDC84\uDC88-\uDC8E\uDC90\uDC92-\uDCA9\uDCAB-\uDCFC\uDCFF-\uDD3D\uDD4B-\uDD4E\uDD50-\uDD67\uDDA4\uDDFB-\uDE2D\uDE2F-\uDE34\uDE37-\uDE41\uDE43\uDE44\uDE48-\uDE4A\uDE80-\uDEA2\uDEA4-\uDEB3\uDEB7-\uDEBF\uDEC1-\uDEC5\uDED0-\uDED2\uDED5-\uDED8\uDEDC-\uDEDF\uDEEB\uDEEC\uDEF4-\uDEFC\uDFE0-\uDFEB\uDFF0]|\uDC08(?:\u200D\u2B1B)?|\uDC15(?:\u200D\uD83E\uDDBA)?|\uDC26(?:\u200D(?:\u2B1B|\uD83D\uDD25))?|\uDC3B(?:\u200D\u2744\uFE0F?)?|\uDC41\uFE0F?(?:\u200D\uD83D\uDDE8\uFE0F?)?|\uDC68(?:\u200D(?:[\u2695\u2696\u2708]\uFE0F?|\u2764\uFE0F?\u200D\uD83D(?:\uDC8B\u200D\uD83D)?\uDC68|\uD83C[\uDF3E\uDF73\uDF7C\uDF93\uDFA4\uDFA8\uDFEB\uDFED]|\uD83D(?:[\uDC68\uDC69]\u200D\uD83D(?:\uDC66(?:\u200D\uD83D\uDC66)?|\uDC67(?:\u200D\uD83D[\uDC66\uDC67])?)|[\uDCBB\uDCBC\uDD27\uDD2C\uDE80\uDE92]|\uDC66(?:\u200D\uD83D\uDC66)?|\uDC67(?:\u200D\uD83D[\uDC66\uDC67])?)|\uD83E(?:[\uDDAF\uDDBC\uDDBD](?:\u200D\u27A1\uFE0F?)?|[\uDDB0-\uDDB3]))|\uD83C(?:\uDFFB(?:\u200D(?:[\u2695\u2696\u2708]\uFE0F?|\u2764\uFE0F?\u200D\uD83D(?:\uDC8B\u200D\uD83D)?\uDC68\uD83C[\uDFFB-\uDFFF]|\uD83C[\uDF3E\uDF73\uDF7C\uDF93\uDFA4\uDFA8\uDFEB\uDFED]|\uD83D(?:[\uDCBB\uDCBC\uDD27\uDD2C\uDE80\uDE92]|\uDC30\u200D\uD83D\uDC68\uD83C[\uDFFC-\uDFFF])|\uD83E(?:[\uDD1D\uDEEF]\u200D\uD83D\uDC68\uD83C[\uDFFC-\uDFFF]|[\uDDAF\uDDBC\uDDBD](?:\u200D\u27A1\uFE0F?)?|[\uDDB0-\uDDB3])))?|\uDFFC(?:\u200D(?:[\u2695\u2696\u2708]\uFE0F?|\u2764\uFE0F?\u200D\uD83D(?:\uDC8B\u200D\uD83D)?\uDC68\uD83C[\uDFFB-\uDFFF]|\uD83C[\uDF3E\uDF73\uDF7C\uDF93\uDFA4\uDFA8\uDFEB\uDFED]|\uD83D(?:[\uDCBB\uDCBC\uDD27\uDD2C\uDE80\uDE92]|\uDC30\u200D\uD83D\uDC68\uD83C[\uDFFB\uDFFD-\uDFFF])|\uD83E(?:[\uDD1D\uDEEF]\u200D\uD83D\uDC68\uD83C[\uDFFB\uDFFD-\uDFFF]|[\uDDAF\uDDBC\uDDBD](?:\u200D\u27A1\uFE0F?)?|[\uDDB0-\uDDB3])))?|\uDFFD(?:\u200D(?:[\u2695\u2696\u2708]\uFE0F?|\u2764\uFE0F?\u200D\uD83D(?:\uDC8B\u200D\uD83D)?\uDC68\uD83C[\uDFFB-\uDFFF]|\uD83C[\uDF3E\uDF73\uDF7C\uDF93\uDFA4\uDFA8\uDFEB\uDFED]|\uD83D(?:[\uDCBB\uDCBC\uDD27\uDD2C\uDE80\uDE92]|\uDC30\u200D\uD83D\uDC68\uD83C[\uDFFB\uDFFC\uDFFE\uDFFF])|\uD83E(?:[\uDD1D\uDEEF]\u200D\uD83D\uDC68\uD83C[\uDFFB\uDFFC\uDFFE\uDFFF]|[\uDDAF\uDDBC\uDDBD](?:\u200D\u27A1\uFE0F?)?|[\uDDB0-\uDDB3])))?|\uDFFE(?:\u200D(?:[\u2695\u2696\u2708]\uFE0F?|\u2764\uFE0F?\u200D\uD83D(?:\uDC8B\u200D\uD83D)?\uDC68\uD83C[\uDFFB-\uDFFF]|\uD83C[\uDF3E\uDF73\uDF7C\uDF93\uDFA4\uDFA8\uDFEB\uDFED]|\uD83D(?:[\uDCBB\uDCBC\uDD27\uDD2C\uDE80\uDE92]|\uDC30\u200D\uD83D\uDC68\uD83C[\uDFFB-\uDFFD\uDFFF])|\uD83E(?:[\uDD1D\uDEEF]\u200D\uD83D\uDC68\uD83C[\uDFFB-\uDFFD\uDFFF]|[\uDDAF\uDDBC\uDDBD](?:\u200D\u27A1\uFE0F?)?|[\uDDB0-\uDDB3])))?|\uDFFF(?:\u200D(?:[\u2695\u2696\u2708]\uFE0F?|\u2764\uFE0F?\u200D\uD83D(?:\uDC8B\u200D\uD83D)?\uDC68\uD83C[\uDFFB-\uDFFF]|\uD83C[\uDF3E\uDF73\uDF7C\uDF93\uDFA4\uDFA8\uDFEB\uDFED]|\uD83D(?:[\uDCBB\uDCBC\uDD27\uDD2C\uDE80\uDE92]|\uDC30\u200D\uD83D\uDC68\uD83C[\uDFFB-\uDFFE])|\uD83E(?:[\uDD1D\uDEEF]\u200D\uD83D\uDC68\uD83C[\uDFFB-\uDFFE]|[\uDDAF\uDDBC\uDDBD](?:\u200D\u27A1\uFE0F?)?|[\uDDB0-\uDDB3])))?))?|\uDC69(?:\u200D(?:[\u2695\u2696\u2708]\uFE0F?|\u2764\uFE0F?\u200D\uD83D(?:\uDC8B\u200D\uD83D)?[\uDC68\uDC69]|\uD83C[\uDF3E\uDF73\uDF7C\uDF93\uDFA4\uDFA8\uDFEB\uDFED]|\uD83D(?:[\uDCBB\uDCBC\uDD27\uDD2C\uDE80\uDE92]|\uDC66(?:\u200D\uD83D\uDC66)?|\uDC67(?:\u200D\uD83D[\uDC66\uDC67])?|\uDC69\u200D\uD83D(?:\uDC66(?:\u200D\uD83D\uDC66)?|\uDC67(?:\u200D\uD83D[\uDC66\uDC67])?))|\uD83E(?:[\uDDAF\uDDBC\uDDBD](?:\u200D\u27A1\uFE0F?)?|[\uDDB0-\uDDB3]))|\uD83C(?:\uDFFB(?:\u200D(?:[\u2695\u2696\u2708]\uFE0F?|\u2764\uFE0F?\u200D\uD83D(?:[\uDC68\uDC69]|\uDC8B\u200D\uD83D[\uDC68\uDC69])\uD83C[\uDFFB-\uDFFF]|\uD83C[\uDF3E\uDF73\uDF7C\uDF93\uDFA4\uDFA8\uDFEB\uDFED]|\uD83D(?:[\uDCBB\uDCBC\uDD27\uDD2C\uDE80\uDE92]|\uDC30\u200D\uD83D\uDC69\uD83C[\uDFFC-\uDFFF])|\uD83E(?:[\uDDAF\uDDBC\uDDBD](?:\u200D\u27A1\uFE0F?)?|[\uDDB0-\uDDB3]|\uDD1D\u200D\uD83D[\uDC68\uDC69]\uD83C[\uDFFC-\uDFFF]|\uDEEF\u200D\uD83D\uDC69\uD83C[\uDFFC-\uDFFF])))?|\uDFFC(?:\u200D(?:[\u2695\u2696\u2708]\uFE0F?|\u2764\uFE0F?\u200D\uD83D(?:[\uDC68\uDC69]|\uDC8B\u200D\uD83D[\uDC68\uDC69])\uD83C[\uDFFB-\uDFFF]|\uD83C[\uDF3E\uDF73\uDF7C\uDF93\uDFA4\uDFA8\uDFEB\uDFED]|\uD83D(?:[\uDCBB\uDCBC\uDD27\uDD2C\uDE80\uDE92]|\uDC30\u200D\uD83D\uDC69\uD83C[\uDFFB\uDFFD-\uDFFF])|\uD83E(?:[\uDDAF\uDDBC\uDDBD](?:\u200D\u27A1\uFE0F?)?|[\uDDB0-\uDDB3]|\uDD1D\u200D\uD83D[\uDC68\uDC69]\uD83C[\uDFFB\uDFFD-\uDFFF]|\uDEEF\u200D\uD83D\uDC69\uD83C[\uDFFB\uDFFD-\uDFFF])))?|\uDFFD(?:\u200D(?:[\u2695\u2696\u2708]\uFE0F?|\u2764\uFE0F?\u200D\uD83D(?:[\uDC68\uDC69]|\uDC8B\u200D\uD83D[\uDC68\uDC69])\uD83C[\uDFFB-\uDFFF]|\uD83C[\uDF3E\uDF73\uDF7C\uDF93\uDFA4\uDFA8\uDFEB\uDFED]|\uD83D(?:[\uDCBB\uDCBC\uDD27\uDD2C\uDE80\uDE92]|\uDC30\u200D\uD83D\uDC69\uD83C[\uDFFB\uDFFC\uDFFE\uDFFF])|\uD83E(?:[\uDDAF\uDDBC\uDDBD](?:\u200D\u27A1\uFE0F?)?|[\uDDB0-\uDDB3]|\uDD1D\u200D\uD83D[\uDC68\uDC69]\uD83C[\uDFFB\uDFFC\uDFFE\uDFFF]|\uDEEF\u200D\uD83D\uDC69\uD83C[\uDFFB\uDFFC\uDFFE\uDFFF])))?|\uDFFE(?:\u200D(?:[\u2695\u2696\u2708]\uFE0F?|\u2764\uFE0F?\u200D\uD83D(?:[\uDC68\uDC69]|\uDC8B\u200D\uD83D[\uDC68\uDC69])\uD83C[\uDFFB-\uDFFF]|\uD83C[\uDF3E\uDF73\uDF7C\uDF93\uDFA4\uDFA8\uDFEB\uDFED]|\uD83D(?:[\uDCBB\uDCBC\uDD27\uDD2C\uDE80\uDE92]|\uDC30\u200D\uD83D\uDC69\uD83C[\uDFFB-\uDFFD\uDFFF])|\uD83E(?:[\uDDAF\uDDBC\uDDBD](?:\u200D\u27A1\uFE0F?)?|[\uDDB0-\uDDB3]|\uDD1D\u200D\uD83D[\uDC68\uDC69]\uD83C[\uDFFB-\uDFFD\uDFFF]|\uDEEF\u200D\uD83D\uDC69\uD83C[\uDFFB-\uDFFD\uDFFF])))?|\uDFFF(?:\u200D(?:[\u2695\u2696\u2708]\uFE0F?|\u2764\uFE0F?\u200D\uD83D(?:[\uDC68\uDC69]|\uDC8B\u200D\uD83D[\uDC68\uDC69])\uD83C[\uDFFB-\uDFFF]|\uD83C[\uDF3E\uDF73\uDF7C\uDF93\uDFA4\uDFA8\uDFEB\uDFED]|\uD83D(?:[\uDCBB\uDCBC\uDD27\uDD2C\uDE80\uDE92]|\uDC30\u200D\uD83D\uDC69\uD83C[\uDFFB-\uDFFE])|\uD83E(?:[\uDDAF\uDDBC\uDDBD](?:\u200D\u27A1\uFE0F?)?|[\uDDB0-\uDDB3]|\uDD1D\u200D\uD83D[\uDC68\uDC69]\uD83C[\uDFFB-\uDFFE]|\uDEEF\u200D\uD83D\uDC69\uD83C[\uDFFB-\uDFFE])))?))?|\uDD75(?:\uD83C[\uDFFB-\uDFFF]|\uFE0F)?(?:\u200D[\u2640\u2642]\uFE0F?)?|\uDE2E(?:\u200D\uD83D\uDCA8)?|\uDE35(?:\u200D\uD83D\uDCAB)?|\uDE36(?:\u200D\uD83C\uDF2B\uFE0F?)?|\uDE42(?:\u200D[\u2194\u2195]\uFE0F?)?|\uDEB6(?:\uD83C[\uDFFB-\uDFFF])?(?:\u200D(?:[\u2640\u2642]\uFE0F?(?:\u200D\u27A1\uFE0F?)?|\u27A1\uFE0F?))?)|\uD83E(?:[\uDD0C\uDD0F\uDD18-\uDD1F\uDD30-\uDD34\uDD36\uDD77\uDDB5\uDDB6\uDDBB\uDDD2\uDDD3\uDDD5\uDEC3-\uDEC5\uDEF0\uDEF2-\uDEF8](?:\uD83C[\uDFFB-\uDFFF])?|[\uDD26\uDD35\uDD37-\uDD39\uDD3C-\uDD3E\uDDB8\uDDB9\uDDCD\uDDCF\uDDD4\uDDD6-\uDDDD](?:\uD83C[\uDFFB-\uDFFF])?(?:\u200D[\u2640\u2642]\uFE0F?)?|[\uDDDE\uDDDF](?:\u200D[\u2640\u2642]\uFE0F?)?|[\uDD0D\uDD0E\uDD10-\uDD17\uDD20-\uDD25\uDD27-\uDD2F\uDD3A\uDD3F-\uDD45\uDD47-\uDD76\uDD78-\uDDB4\uDDB7\uDDBA\uDDBC-\uDDCC\uDDD0\uDDE0-\uDDFF\uDE70-\uDE7C\uDE80-\uDE8A\uDE8E-\uDEC2\uDEC6\uDEC8\uDECD-\uDEDC\uDEDF-\uDEEA\uDEEF]|\uDDCE(?:\uD83C[\uDFFB-\uDFFF])?(?:\u200D(?:[\u2640\u2642]\uFE0F?(?:\u200D\u27A1\uFE0F?)?|\u27A1\uFE0F?))?|\uDDD1(?:\u200D(?:[\u2695\u2696\u2708]\uFE0F?|\uD83C[\uDF3E\uDF73\uDF7C\uDF84\uDF93\uDFA4\uDFA8\uDFEB\uDFED]|\uD83D[\uDCBB\uDCBC\uDD27\uDD2C\uDE80\uDE92]|\uD83E(?:[\uDDAF\uDDBC\uDDBD](?:\u200D\u27A1\uFE0F?)?|[\uDDB0-\uDDB3\uDE70]|\uDD1D\u200D\uD83E\uDDD1|\uDDD1\u200D\uD83E\uDDD2(?:\u200D\uD83E\uDDD2)?|\uDDD2(?:\u200D\uD83E\uDDD2)?))|\uD83C(?:\uDFFB(?:\u200D(?:[\u2695\u2696\u2708]\uFE0F?|\u2764\uFE0F?\u200D(?:\uD83D\uDC8B\u200D)?\uD83E\uDDD1\uD83C[\uDFFC-\uDFFF]|\uD83C[\uDF3E\uDF73\uDF7C\uDF84\uDF93\uDFA4\uDFA8\uDFEB\uDFED]|\uD83D(?:[\uDCBB\uDCBC\uDD27\uDD2C\uDE80\uDE92]|\uDC30\u200D\uD83E\uDDD1\uD83C[\uDFFC-\uDFFF])|\uD83E(?:[\uDDAF\uDDBC\uDDBD](?:\u200D\u27A1\uFE0F?)?|[\uDDB0-\uDDB3\uDE70]|\uDD1D\u200D\uD83E\uDDD1\uD83C[\uDFFB-\uDFFF]|\uDEEF\u200D\uD83E\uDDD1\uD83C[\uDFFC-\uDFFF])))?|\uDFFC(?:\u200D(?:[\u2695\u2696\u2708]\uFE0F?|\u2764\uFE0F?\u200D(?:\uD83D\uDC8B\u200D)?\uD83E\uDDD1\uD83C[\uDFFB\uDFFD-\uDFFF]|\uD83C[\uDF3E\uDF73\uDF7C\uDF84\uDF93\uDFA4\uDFA8\uDFEB\uDFED]|\uD83D(?:[\uDCBB\uDCBC\uDD27\uDD2C\uDE80\uDE92]|\uDC30\u200D\uD83E\uDDD1\uD83C[\uDFFB\uDFFD-\uDFFF])|\uD83E(?:[\uDDAF\uDDBC\uDDBD](?:\u200D\u27A1\uFE0F?)?|[\uDDB0-\uDDB3\uDE70]|\uDD1D\u200D\uD83E\uDDD1\uD83C[\uDFFB-\uDFFF]|\uDEEF\u200D\uD83E\uDDD1\uD83C[\uDFFB\uDFFD-\uDFFF])))?|\uDFFD(?:\u200D(?:[\u2695\u2696\u2708]\uFE0F?|\u2764\uFE0F?\u200D(?:\uD83D\uDC8B\u200D)?\uD83E\uDDD1\uD83C[\uDFFB\uDFFC\uDFFE\uDFFF]|\uD83C[\uDF3E\uDF73\uDF7C\uDF84\uDF93\uDFA4\uDFA8\uDFEB\uDFED]|\uD83D(?:[\uDCBB\uDCBC\uDD27\uDD2C\uDE80\uDE92]|\uDC30\u200D\uD83E\uDDD1\uD83C[\uDFFB\uDFFC\uDFFE\uDFFF])|\uD83E(?:[\uDDAF\uDDBC\uDDBD](?:\u200D\u27A1\uFE0F?)?|[\uDDB0-\uDDB3\uDE70]|\uDD1D\u200D\uD83E\uDDD1\uD83C[\uDFFB-\uDFFF]|\uDEEF\u200D\uD83E\uDDD1\uD83C[\uDFFB\uDFFC\uDFFE\uDFFF])))?|\uDFFE(?:\u200D(?:[\u2695\u2696\u2708]\uFE0F?|\u2764\uFE0F?\u200D(?:\uD83D\uDC8B\u200D)?\uD83E\uDDD1\uD83C[\uDFFB-\uDFFD\uDFFF]|\uD83C[\uDF3E\uDF73\uDF7C\uDF84\uDF93\uDFA4\uDFA8\uDFEB\uDFED]|\uD83D(?:[\uDCBB\uDCBC\uDD27\uDD2C\uDE80\uDE92]|\uDC30\u200D\uD83E\uDDD1\uD83C[\uDFFB-\uDFFD\uDFFF])|\uD83E(?:[\uDDAF\uDDBC\uDDBD](?:\u200D\u27A1\uFE0F?)?|[\uDDB0-\uDDB3\uDE70]|\uDD1D\u200D\uD83E\uDDD1\uD83C[\uDFFB-\uDFFF]|\uDEEF\u200D\uD83E\uDDD1\uD83C[\uDFFB-\uDFFD\uDFFF])))?|\uDFFF(?:\u200D(?:[\u2695\u2696\u2708]\uFE0F?|\u2764\uFE0F?\u200D(?:\uD83D\uDC8B\u200D)?\uD83E\uDDD1\uD83C[\uDFFB-\uDFFE]|\uD83C[\uDF3E\uDF73\uDF7C\uDF84\uDF93\uDFA4\uDFA8\uDFEB\uDFED]|\uD83D(?:[\uDCBB\uDCBC\uDD27\uDD2C\uDE80\uDE92]|\uDC30\u200D\uD83E\uDDD1\uD83C[\uDFFB-\uDFFE])|\uD83E(?:[\uDDAF\uDDBC\uDDBD](?:\u200D\u27A1\uFE0F?)?|[\uDDB0-\uDDB3\uDE70]|\uDD1D\u200D\uD83E\uDDD1\uD83C[\uDFFB-\uDFFF]|\uDEEF\u200D\uD83E\uDDD1\uD83C[\uDFFB-\uDFFE])))?))?|\uDEF1(?:\uD83C(?:\uDFFB(?:\u200D\uD83E\uDEF2\uD83C[\uDFFC-\uDFFF])?|\uDFFC(?:\u200D\uD83E\uDEF2\uD83C[\uDFFB\uDFFD-\uDFFF])?|\uDFFD(?:\u200D\uD83E\uDEF2\uD83C[\uDFFB\uDFFC\uDFFE\uDFFF])?|\uDFFE(?:\u200D\uD83E\uDEF2\uD83C[\uDFFB-\uDFFD\uDFFF])?|\uDFFF(?:\u200D\uD83E\uDEF2\uD83C[\uDFFB-\uDFFE])?))?)/g});var Kn="1.0.0-rc.89";N();var K0=`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>]
@@ -451,9 +451,9 @@ ${Zo(S)}`}}catch(h){let y=u?`o proxy n\xE3o respondeu em ${f}ms (timeout)`:h ins
451
451
  ${r.text}`).join(`
452
452
 
453
453
  `),n=_d(o);return{...n!==void 0?{instructions:n}:{},sources:e.map(r=>r.filename)}}async function O8(t){return HT(Ur,t)}import{homedir as N8}from"node:os";import{join as r_}from"node:path";import{randomBytes as $8}from"node:crypto";import{openSync as B8,writeSync as U8,closeSync as s_,readFileSync as j8,mkdirSync as H8,renameSync as q8,unlinkSync as W8,constants as xv}from"node:fs";var Im={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"}},Nm={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"}},qT={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"}},WT={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"}},GT={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"}},zT={fg:{},fgDim:{dimColor:!0},accent:{bold:!0},accentDim:{bold:!0},danger:{bold:!0,inverse:!0},success:{},depth:{}};var KT={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"},YT={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"},VT={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:"."},XT=["\u280B","\u2819","\u2839","\u2838","\u283C","\u2834","\u2826","\u2827","\u2807","\u280F"],JT=["-","\\","|","/"],QT={topLeft:"\u256D",topRight:"\u256E",bottomLeft:"\u2570",bottomRight:"\u256F",horizontal:"\u2500",vertical:"\u2502",teeLeft:"\u251C",teeRight:"\u2524"},ZT={topLeft:"+",topRight:"+",bottomLeft:"+",bottomRight:"+",horizontal:"-",vertical:"|",teeLeft:"+",teeRight:"+"};var Tc=[{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"}],Qi=Tc.map(t=>t.name);function e_(t){return Qi.includes(t.trim().toLowerCase())}function $m(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)%Tc.length;return Tc[n].name}function t_(t,e,o){let n=t.trim().toLowerCase(),r=Tc.find(s=>s.name===n)??Tc.find(s=>s.name===$m(n));return e==="mono"?{bold:!0}:e==="truecolor"?{color:o==="light"?r.lightHex:r.darkHex,bold:!0}:{color:r.ansi,bold:!0}}function Bm(t){return t!==void 0&&t!==""&&t!=="0"&&t.toLowerCase()!=="false"}function M8(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 L8(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 P8(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!(Bm(t.ALUY_ASCII)||o&&!o.includes("utf"))}function F8(t,e){return e!==void 0?e:Bm(t.ALUY_SAFE_GLYPHS)}function I8(t,e,o){return t==="mono"?zT:t==="truecolor"?o??(e==="light"?Nm:Im):e==="light"?WT:qT}function wn(t={}){let e=t.env??process.env,o=M8(e),n=L8(e,t.theme),r=P8(e),s=r&&F8(e,t.safeGlyphs),i=t.density??(Bm(e.ALUY_DENSITY)&&e.ALUY_DENSITY==="compact"?"compact":"comfortable"),a=t.animate??!Bm(e.ALUY_NO_ANIM),l=I8(o,n,t.truecolorPalette),c=r?s?YT:KT:VT;return{colorMode:o,brightness:n,unicode:r,safeGlyphs:s,density:i,animate:a,role:p=>l[p],sessionColor:p=>t_(p,o,n),glyph:p=>c[p],aluyMark:r?"\u039B":"/\\",spinnerFrames:r&&!s?XT:JT,box:r?QT:ZT}}var Ao=[{name:"aluy-dark",label:"Aluy Dark",brightness:"dark",summary:"escuro neutro (default) \u2014 fundo quase-preto, accent \xE2mbar",bg:"#070707",palette:Im},{name:"aluy-light",label:"Aluy Light",brightness:"light",summary:"claro creme \u2014 fundo --stone-50, accent \xE2mbar escurecido (AA)",bg:"#F4ECDC",palette:Nm},{name:"aluy-slate",label:"Aluy Slate",brightness:"dark",summary:"terra escura WARM \u2014 fundo --stone-950, accent \xE2mbar",bg:"#0E0C09",palette:GT}],vv="aluy-dark";function jr(t){return Ao.find(e=>e.name===t)}function mr(t){let e=t.trim().toLowerCase();if(e==="")return;let o=Ao.find(r=>r.name===e);if(o)return o;let n=Ao.find(r=>r.name===`aluy-${e}`);return n||Ao.find(r=>r.label.toLowerCase()===e)}function Is(t){return t==="light"?"aluy-light":"aluy-dark"}function o_(t,e={}){let o=jr(t)??jr(vv);return wn({...e,theme:o.brightness,truecolorPalette:o.palette})}var An="pt-BR",Io=[{code:"pt-BR",label:"Portugu\xEAs (Brasil)",summary:"idioma padr\xE3o da TUI"},{code:"en",label:"English",summary:"English interface (opt-in)"}];function Ns(t){return Io.find(e=>e.code===t)}function Hr(t){let e=t.trim().toLowerCase();if(e==="")return;let o=Io.find(n=>n.code.toLowerCase()===e);if(o)return o;if(e==="pt"||e==="pt_br"||e==="br"||e==="portugu\xEAs"||e==="portugues")return Ns("pt-BR");if(e==="en"||e==="en_us"||e==="english"||e==="ingl\xEAs"||e==="ingles")return Ns("en")}function n_(t){let e=(t.LC_ALL??t.LC_MESSAGES??t.LANG??"").trim().toLowerCase();if(e==="")return An;let o=e.split(".")[0].split("@")[0].replace("_","-");return o==="c"||o==="posix"?An:o==="en"||o.startsWith("en-")?"en":An}function kv(t,e,o){if(t!==void 0&&t.trim()!==""){let n=Hr(t);if(n)return n.code}return e!==void 0?e:n_(o)}N();var G8=448,z8=384,Rc="config.json",K8=new Set(["openai-compat","anthropic","gemini"]);function i_(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 Y8(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 V8(t){return typeof t=="number"&&Number.isInteger(t)&&t>=1&&t<=65535}function Sv(t){if(typeof t!="object"||t===null)return;let e=t,o={};return Y8(e.host)&&(o.host=e.host.trim()),V8(e.port)&&(o.port=e.port),o.host!==void 0||o.port!==void 0?o:void 0}function X8(t){if(typeof t!="object"||t===null)return;let e=t,o=a=>typeof a=="number"&&Number.isInteger(a)&&a>0?a:void 0,n={},r=o(e.maxTokens),s=o(e.maxOutputTokens),i=o(e.maxIterations);return r!==void 0&&(n.maxTokens=r),s!==void 0&&(n.maxOutputTokens=s),i!==void 0&&(n.maxIterations=i),Object.keys(n).length>0?n:void 0}function J8(t){if(typeof t!="object"||t===null)return;let e=t,o={};return typeof e.window=="number"&&Number.isInteger(e.window)&&e.window>0&&(o.window=e.window),typeof e.autocompactAt=="number"&&Number.isFinite(e.autocompactAt)?o.autocompactAt=e.autocompactAt:typeof e.autocompactAt=="string"&&e.autocompactAt.trim()!==""&&(o.autocompactAt=e.autocompactAt.trim()),typeof e.autocompactMax=="number"&&Number.isInteger(e.autocompactMax)&&e.autocompactMax>0&&(o.autocompactMax=e.autocompactMax),Object.keys(o).length>0?o:void 0}function Q8(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 Z8(t){if(typeof t!="object"||t===null)return;let e=t,o={},n=Sv(e.ollama),r=Sv(e.mem0),s=Sv(e.headroom);return n&&(o.ollama=n),r&&(o.mem0=r),s&&(o.headroom=s),Object.keys(o).length>0?o:void 0}function eH(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===""||!K8.has(a))continue;let l=i_(n.auth),c=i_(n.models),u={id:r,wireFormat:a,baseUrl:s,defaultModel:i,...typeof n.label=="string"&&n.label.trim()?{label:n.label.trim()}:{},...l?{auth:l}:{},...c?{models:c}:{}};e.push(u)}return e.length>0?e:void 0}var tH=128;function _c(t){if(typeof t!="string")return!1;let e=t.trim();return e===""||e.length>tH?!1:!/[\u0000-\u001F\u007F]/.test(e)}function a_(t){if(typeof t!="object"||t===null)return{};let e=t,o={};if(typeof e.theme=="string"){let l=jr(e.theme);l&&(o.theme=l.name)}if(_c(e.tier)&&(o.tier=e.tier.trim()),o.tier==="custom"&&_c(e.model)&&(o.model=e.model.trim()),typeof e.splitView=="boolean"&&(o.splitView=e.splitView),typeof e.lang=="string"){let l=Ns(e.lang);l&&(o.lang=l.code)}if(typeof e.fullscreen=="boolean"&&(o.fullscreen=e.fullscreen),(e.backend==="broker"||e.backend==="local")&&(o.backend=e.backend),_c(e.localProvider)&&(o.localProvider=e.localProvider.trim()),_c(e.localModel)&&(o.localModel=e.localModel.trim()),(e.localAuth==="apikey"||e.localAuth==="oauth"||e.localAuth==="none")&&(o.localAuth=e.localAuth),_c(e.localBaseUrl)&&(o.localBaseUrl=e.localBaseUrl.trim()),typeof e.localBudget=="boolean"&&(o.localBudget=e.localBudget),typeof e.rooms=="object"&&e.rooms!==null){let l=e.rooms;if(typeof l.backend=="string"){let c=l.backend.trim().toLowerCase();c.length>0&&c.length<=32&&(o.rooms={backend:c})}}if((e.profile==="turbo"||e.profile==="leve")&&(o.profile=e.profile),typeof e.embedder=="string"&&kb(e.embedder.trim())!==void 0&&(o.embedder=e.embedder.trim()),typeof e.recallMinScore=="number"&&Number.isFinite(e.recallMinScore)&&e.recallMinScore>=0&&e.recallMinScore<=1&&(o.recallMinScore=e.recallMinScore),typeof e.sidecarToggles=="object"&&e.sidecarToggles!==null){let l=e.sidecarToggles,c={};typeof l.ollama=="boolean"&&(c.ollama=l.ollama),typeof l.mem0=="boolean"&&(c.mem0=l.mem0),typeof l.headroom=="boolean"&&(c.headroom=l.headroom),Object.keys(c).length>0&&(o.sidecarToggles=c)}let n=eH(e.providers);n&&(o.providers=n);let r=Z8(e.services);r&&(o.services=r);let s=Q8(e.connectors);s&&(o.connectors=s);let i=X8(e.limits);i&&(o.limits=i);let a=J8(e.context);return a&&(o.context=a),o}function Zi(t){return t.connectors?.telegram?.allowlist??[]}function l_(t,e){let o=Zi(t);return o.includes(e)?o:[...o,e]}function c_(t,e){return Zi(t).filter(o=>o!==e)}var No=class{base;file;constructor(e={}){this.base=e.baseDir??r_(N8(),".aluy"),this.file=r_(this.base,Rc)}get configPath(){return this.file}load(){let e;try{e=j8(this.file,"utf8")}catch{return{}}let o;try{o=JSON.parse(e)}catch{return{}}return a_(o)}save(e){try{let o=a_({...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){H8(this.base,{recursive:!0,mode:G8});let o=`${this.file}.${process.pid}.${$8(6).toString("hex")}.tmp`,n=JSON.stringify(e,null,2)+`
454
- `,r;try{r=B8(o,xv.O_CREAT|xv.O_EXCL|xv.O_WRONLY,z8),U8(r,n),s_(r),r=void 0,q8(o,this.file)}catch(s){if(r!==void 0)try{s_(r)}catch{}try{W8(o)}catch{}throw s}}};function Ev(t,e,o){return t!==void 0&&t.trim()!==""?t.trim():e.tier!==void 0&&e.tier.trim()!==""?e.tier.trim():o}function oH(t){return t.theme}function u_(t){return t.lang}function wv(t,e){return t===!0?!0:e.splitView??!1}function Av(t,e){return t===!0?!0:e.fullscreen??!1}import{homedir as nH}from"node:os";import{join as Cv,basename as rH}from"node:path";import{openSync as sH,writeSync as iH,closeSync as d_,mkdirSync as aH,renameSync as lH,unlinkSync as cH,constants as Dv}from"node:fs";var uH=448,dH=384,m_="exports",mH=(t,e,o)=>iH(t,e,o,e.length-o);function fH(t,e){if(t===void 0||t.trim()==="")return e;let o=rH(t.trim());return o=o.replace(/[-/\\]/g,""),o===""||o==="."||o===".."?e:(/\.md$/i.test(o)||(o+=".md"),o)}function pH(t){return t.toISOString().replace(/[:.]/g,"-").replace(/-\d{3}Z$/,"Z")}var Oc=class{base;now;writeChunk;constructor(e={}){this.base=Cv(e.baseDir??Cv(nH(),".aluy"),m_),this.now=e.now??(()=>new Date),this.writeChunk=e.writeChunk??mH}get dir(){return this.base}write(e,o={}){let n=`${(o.sessionId??"sessao").slice(0,40)}-${pH(this.now())}.md`,r=fH(o.fileName,n),s=Cv(this.base,r),i=`${s}.${process.pid}.tmp`,a;try{aH(this.base,{recursive:!0,mode:uH}),a=sH(i,Dv.O_CREAT|Dv.O_EXCL|Dv.O_WRONLY,dH);let l=Buffer.from(e,"utf8"),c=0;for(;c<l.length;){let u=this.writeChunk(a,l,c);if(u<=0)throw new Error(`escrita parou em ${c}/${l.length} bytes (writeSync devolveu ${u})`);c+=u}return d_(a),a=void 0,lH(i,s),{ok:!0,path:s}}catch(l){if(a!==void 0)try{d_(a)}catch{}try{cH(i)}catch{}return{ok:!1,error:`falha ao exportar: ${String(l)}`}}}};function hH(t,e,o={}){return t.write(e,o)}import{homedir as EH}from"node:os";import{join as _v}from"node:path";import{randomBytes as wH}from"node:crypto";import{openSync as AH,writeSync as CH,closeSync as g_,readFileSync as DH,readdirSync as y_,mkdirSync as TH,renameSync as _H,unlinkSync as b_,statSync as RH,existsSync as sie,constants as Rv}from"node:fs";var gH=new Set(["you","aluy","tool","deny","bang","broker-error","note","inject","doctor"]);function ut(t){return typeof t=="string"}function f_(t){return typeof t=="number"&&Number.isInteger(t)&&t>=0}function yH(t){return Array.isArray(t)&&t.every(e=>typeof e=="string")}function bH(t){return t==="ok"||t==="warn"||t==="fail"?t:"warn"}function vH(t){if(typeof t!="object"||t===null)return null;let e=t;return!ut(e.id)||!ut(e.label)?null:{id:e.id,label:e.label,status:bH(e.status),...ut(e.detail)?{detail:e.detail}:{},...ut(e.fix)?{fix:e.fix}:{}}}function p_(t){if(typeof t!="object"||t===null)return null;let e=t,o=e.kind;if(typeof o!="string"||!gH.has(o))return null;switch(o){case"you":return ut(e.text)?{kind:"you",text:e.text}:null;case"aluy":return ut(e.text)?{kind:"aluy",text:e.text,streaming:!1}:null;case"tool":{if(!ut(e.verb)||!ut(e.target)||!ut(e.result))return null;let n=e.status==="ok"||e.status==="err"?e.status:"err";return{kind:"tool",verb:e.verb,target:e.target,result:e.result,status:n,...ut(e.output)?{output:e.output}:{},...ut(e.verbGerund)?{verbGerund:e.verbGerund}:{},...f_(e.added)?{added:e.added}:{},...f_(e.removed)?{removed:e.removed}:{}}}case"deny":return ut(e.verb)&&ut(e.exact)?{kind:"deny",verb:e.verb,exact:e.exact}:null;case"bang":{if(!ut(e.command))return null;let n=e.status==="ok"||e.status==="err"||e.status==="blocked"?e.status:"err";return{kind:"bang",command:e.command,status:n,...ut(e.output)?{output:e.output}:{}}}case"broker-error":return ut(e.message)?{kind:"broker-error",message:e.message,...typeof e.status=="number"?{status:e.status}:{}}:null;case"note":return ut(e.title)&&yH(e.lines)?{kind:"note",title:e.title,lines:e.lines}:null;case"inject":return ut(e.text)?{kind:"inject",text:e.text}:null;case"doctor":{if(!Array.isArray(e.checks))return null;let n=e.checks.map(vH).filter(r=>r!==null);return n.length===0?null:{kind:"doctor",checks:n,...ut(e.summary)?{summary:e.summary}:{}}}default:return null}}function Um(t){if(!Array.isArray(t))return[];let e=[];for(let o of t){let n=p_(o);n&&e.push(n)}return e}var Tv="sess\xE3o-anterior";function $s(t){let e=[];for(let o of t)switch(o.kind){case"you":e.push({role:"goal",text:o.text});break;case"aluy":o.text.trim()!==""&&e.push({role:"model",text:o.text});break;case"tool":{let n=[`${o.verb} ${o.target} \u2192 ${o.result||o.status}`];o.output&&n.push(o.output),e.push({role:"observation",toolName:Tv,text:n.join(`
454
+ `,r;try{r=B8(o,xv.O_CREAT|xv.O_EXCL|xv.O_WRONLY,z8),U8(r,n),s_(r),r=void 0,q8(o,this.file)}catch(s){if(r!==void 0)try{s_(r)}catch{}try{W8(o)}catch{}throw s}}};function Ev(t,e,o){return t!==void 0&&t.trim()!==""?t.trim():e.tier!==void 0&&e.tier.trim()!==""?e.tier.trim():o}function oH(t){return t.theme}function u_(t){return t.lang}function wv(t,e){return t===!0?!0:e.splitView??!1}function Av(t,e){return t===!0?!0:e.fullscreen??!1}import{homedir as nH}from"node:os";import{join as Cv,basename as rH}from"node:path";import{openSync as sH,writeSync as iH,closeSync as d_,mkdirSync as aH,renameSync as lH,unlinkSync as cH,constants as Dv}from"node:fs";var uH=448,dH=384,m_="exports",mH=(t,e,o)=>iH(t,e,o,e.length-o);function fH(t,e){if(t===void 0||t.trim()==="")return e;let o=rH(t.trim());return o=o.replace(/[-/\\]/g,""),o===""||o==="."||o===".."?e:(/\.md$/i.test(o)||(o+=".md"),o)}function pH(t){return t.toISOString().replace(/[:.]/g,"-").replace(/-\d{3}Z$/,"Z")}var Oc=class{base;now;writeChunk;constructor(e={}){this.base=Cv(e.baseDir??Cv(nH(),".aluy"),m_),this.now=e.now??(()=>new Date),this.writeChunk=e.writeChunk??mH}get dir(){return this.base}write(e,o={}){let n=`${(o.sessionId??"sessao").slice(0,40)}-${pH(this.now())}.md`,r=fH(o.fileName,n),s=Cv(this.base,r),i=`${s}.${process.pid}.tmp`,a;try{aH(this.base,{recursive:!0,mode:uH}),a=sH(i,Dv.O_CREAT|Dv.O_EXCL|Dv.O_WRONLY,dH);let l=Buffer.from(e,"utf8"),c=0;for(;c<l.length;){let u=this.writeChunk(a,l,c);if(u<=0)throw new Error(`escrita parou em ${c}/${l.length} bytes (writeSync devolveu ${u})`);c+=u}return d_(a),a=void 0,lH(i,s),{ok:!0,path:s}}catch(l){if(a!==void 0)try{d_(a)}catch{}try{cH(i)}catch{}return{ok:!1,error:`falha ao exportar: ${String(l)}`}}}};function hH(t,e,o={}){return t.write(e,o)}import{homedir as EH}from"node:os";import{join as _v}from"node:path";import{randomBytes as wH}from"node:crypto";import{openSync as AH,writeSync as CH,closeSync as g_,readFileSync as DH,readdirSync as y_,mkdirSync as TH,renameSync as _H,unlinkSync as b_,statSync as RH,existsSync as sie,constants as Rv}from"node:fs";var gH=new Set(["you","aluy","tool","deny","bang","broker-error","note","inject","doctor"]);function ut(t){return typeof t=="string"}function f_(t){return typeof t=="number"&&Number.isInteger(t)&&t>=0}function yH(t){return Array.isArray(t)&&t.every(e=>typeof e=="string")}function bH(t){return t==="ok"||t==="warn"||t==="fail"?t:"warn"}function vH(t){if(typeof t!="object"||t===null)return null;let e=t;return!ut(e.id)||!ut(e.label)?null:{id:e.id,label:e.label,status:bH(e.status),...ut(e.detail)?{detail:e.detail}:{},...ut(e.fix)?{fix:e.fix}:{}}}function p_(t){if(typeof t!="object"||t===null)return null;let e=t,o=e.kind;if(typeof o!="string"||!gH.has(o))return null;switch(o){case"you":return ut(e.text)?{kind:"you",text:e.text}:null;case"aluy":return ut(e.text)?{kind:"aluy",text:e.text,streaming:!1}:null;case"tool":{if(!ut(e.verb)||!ut(e.target)||!ut(e.result))return null;let n=e.status==="ok"||e.status==="err"?e.status:"err";return{kind:"tool",verb:e.verb,target:e.target,result:e.result,status:n,...ut(e.output)?{output:e.output}:{},...ut(e.verbGerund)?{verbGerund:e.verbGerund}:{},...f_(e.added)?{added:e.added}:{},...f_(e.removed)?{removed:e.removed}:{}}}case"deny":return ut(e.verb)&&ut(e.exact)?{kind:"deny",verb:e.verb,exact:e.exact}:null;case"bang":{if(!ut(e.command))return null;let n=e.status==="ok"||e.status==="err"||e.status==="blocked"?e.status:"err";return{kind:"bang",command:e.command,status:n,...ut(e.output)?{output:e.output}:{}}}case"broker-error":return ut(e.message)?{kind:"broker-error",message:e.message,...typeof e.status=="number"?{status:e.status}:{}}:null;case"note":return ut(e.title)&&yH(e.lines)?{kind:"note",title:e.title,lines:e.lines}:null;case"inject":return ut(e.text)?{kind:"inject",text:e.text}:null;case"doctor":{if(!Array.isArray(e.checks))return null;let n=e.checks.map(vH).filter(r=>r!==null);return n.length===0?null:{kind:"doctor",checks:n,...ut(e.summary)?{summary:e.summary}:{}}}default:return null}}function Um(t){if(!Array.isArray(t))return[];let e=[];for(let o of t){let n=p_(o);n&&e.push(n)}return e}var Tv="sess\xE3o-anterior";function $s(t){let e=[];for(let o of t)switch(o.kind){case"you":e.push({role:"goal",text:o.text});break;case"inject":o.text.trim()!==""&&e.push({role:"goal",text:o.text});break;case"aluy":o.text.trim()!==""&&e.push({role:"model",text:o.text});break;case"tool":{let n=[`${o.verb} ${o.target} \u2192 ${o.result||o.status}`];o.output&&n.push(o.output),e.push({role:"observation",toolName:Tv,text:n.join(`
455
455
  `)});break}case"bang":{let n=[`! ${o.command} (${o.status})`];o.output&&n.push(o.output),e.push({role:"observation",toolName:Tv,text:n.join(`
456
- `)});break}case"broker-error":e.push({role:"observation",toolName:Tv,text:`(${o.backend==="local"?"erro do provider local":"erro de broker"} anterior: ${o.message})`});break;case"note":case"deny":case"subagents":case"doctor":case"inject":break}return e}N();var kH=new Set(["bash","run_command"]),xH=new Set(["read","grep","attach","headroom_retrieve"]);function SH(t){return t.kind==="tool"&&xH.has(t.verb)}function h_(t){let e=!1,o=t.map(n=>{if(n.kind==="tool"&&SH(n)){let r=He(n.result),s=n.output!==void 0?He(n.output):void 0,i=n.liveOutput!==void 0?He(n.liveOutput):void 0;return r===n.result&&s===n.output&&i===n.liveOutput?n:(e=!0,{...n,result:r,...s!==void 0?{output:s}:{},...i!==void 0?{liveOutput:i}:{}})}if(n.kind==="bang"){let r=Jt(n.command);return r===n.command?n:(e=!0,{...n,command:r})}if(n.kind==="tool"&&kH.has(n.verb)){let r=Jt(n.target);return r===n.target?n:(e=!0,{...n,target:r})}return n});return e?o:t}var OH=448,MH=384,v_="sessions",k_=1,LH=720*60*60*1e3,PH=50,Ov=8*1024*1024,FH=Ov*8,IH=Math.floor(Ov*.9),jm=/^[A-Za-z0-9_-]{1,128}$/,NH=64;function $H(t,e){let o=[...t];return o.length>e?o.slice(0,e).join(""):t}function Hm(t){if(typeof t!="string")return;let e="";for(let n of t){let r=n.codePointAt(0)??0;e+=r<32||r===127?" ":n}let o=e.replace(/\s+/g," ").trim();if(o!=="")return $H(o,NH)}function BH(t){for(let e of t)if(e.kind==="you"){let o=e.text.replace(/\s+/g," ").trim();if(o==="")return;let n=[...o];return n.length>60?n.slice(0,57).join("")+"\u2026":o}}var Mc=class{base;dir;now;createdAtCache=new Map;constructor(e={}){this.base=e.baseDir??_v(EH(),".aluy"),this.dir=_v(this.base,v_),this.now=e.now??(()=>Date.now())}get sessionsDir(){return this.dir}pathFor(e){return _v(this.dir,`${e}.json`)}save(e){if(!jm.test(e.id))return!1;try{let o=this.now(),n=this.resolveCreatedAt(e.id,o),r=e.tier==="custom"&&typeof e.model=="string"&&e.model.trim()!=="",s=r&&typeof e.provider=="string"&&e.provider.trim()!=="",i=Hm(e.label),a=i!==void 0?Hm(e.labelColor):void 0,l={id:e.id,version:k_,createdAt:n,updatedAt:o,cwd:e.cwd,tier:e.tier,...r?{model:e.model.trim()}:{},...s?{provider:e.provider.trim()}:{},...i!==void 0?{label:i}:{},...a!==void 0?{labelColor:a}:{}},c=this.fitBlocks(l,h_(Um(e.blocks))),u={...l,blocks:c};return this.writeAtomic(u),!0}catch{return!1}}resolveCreatedAt(e,o){let n=this.createdAtCache.get(e);if(n!==void 0)return n;let r=this.load(e)?.createdAt??o;return this.createdAtCache.set(e,r),r}load(e){if(!jm.test(e))return null;let o=this.pathFor(e),n,r=!1;try{let a=RH(o);if(a.size>FH)return null;r=a.size>Ov,n=DH(o,"utf8")}catch{return null}let s;try{s=JSON.parse(n)}catch{return null}let i=this.sanitizeRecord(s);if(i&&r){let{blocks:a,...l}=i,c=this.fitBlocks(l,a),u=a.length-c.length,f={kind:"note",title:"sess\xE3o grande \u2014 contexto antigo omitido no resume",lines:[`Esta sess\xE3o era grande demais p/ recarregar inteira; ${u} bloco(s) antigo(s) foram omitidos e a parte recente foi preservada.`,"O contexto restante ser\xE1 resumido automaticamente na pr\xF3xima intera\xE7\xE3o."]};i={...i,blocks:u>0?[f,...c]:c}}return i&&this.createdAtCache.set(i.id,i.createdAt),i}list(){let e;try{e=y_(this.dir)}catch{return[]}let o=[];for(let n of e){if(!n.endsWith(".json"))continue;let r=n.slice(0,-5),s=this.load(r);s&&o.push({id:s.id,createdAt:s.createdAt,updatedAt:s.updatedAt,cwd:s.cwd,tier:s.tier,...s.model!==void 0?{model:s.model}:{},...s.provider!==void 0?{provider:s.provider}:{},...s.label!==void 0?{label:s.label}:{},...s.labelColor!==void 0?{labelColor:s.labelColor}:{},blockCount:s.blocks.length,title:BH(s.blocks)})}return o.sort((n,r)=>r.updatedAt-n.updatedAt),o}latestForCwd(e){let o;try{o=y_(this.dir)}catch{return null}let n=null;for(let r of o){if(!r.endsWith(".json"))continue;let s=r.slice(0,-5),i=this.load(s);!i||i.cwd!==e||(n===null||i.updatedAt>n.updatedAt)&&(n=i)}return n}remove(e){if(jm.test(e)){this.createdAtCache.delete(e);try{b_(this.pathFor(e))}catch{}}}gc(e={}){let o=e.maxAgeMs??LH,n=e.maxCount??PH,r=this.list(),s=this.now()-o;r.forEach((i,a)=>{(i.updatedAt<s||a>=n)&&this.remove(i.id)})}sanitizeRecord(e){if(typeof e!="object"||e===null)return null;let o=e;if(typeof o.id!="string"||!jm.test(o.id)||!Array.isArray(o.blocks))return null;let n=typeof o.createdAt=="number"&&o.createdAt>=0?o.createdAt:0,r=typeof o.updatedAt=="number"&&o.updatedAt>=0?o.updatedAt:n,s=typeof o.cwd=="string"?o.cwd:"",i=typeof o.tier=="string"&&o.tier.trim()!==""?o.tier:"",a=typeof o.version=="number"?o.version:0,l=i==="custom"&&typeof o.model=="string"&&o.model.trim()!==""?o.model.trim():void 0,c=l!==void 0&&typeof o.provider=="string"&&o.provider.trim()!==""?o.provider.trim():void 0,u=Hm(o.label),f=u!==void 0?Hm(o.labelColor):void 0;return{id:o.id,version:a,createdAt:n,updatedAt:r,cwd:s,tier:i,...l!==void 0?{model:l}:{},...c!==void 0?{provider:c}:{},...u!==void 0?{label:u}:{},...f!==void 0?{labelColor:f}:{},blocks:Um(o.blocks)}}fitBlocks(e,o){let n=i=>Buffer.byteLength(JSON.stringify({...e,blocks:i})+`
456
+ `)});break}case"broker-error":e.push({role:"observation",toolName:Tv,text:`(${o.backend==="local"?"erro do provider local":"erro de broker"} anterior: ${o.message})`});break;case"note":case"deny":case"subagents":case"doctor":break}return e}N();var kH=new Set(["bash","run_command"]),xH=new Set(["read","grep","attach","headroom_retrieve"]);function SH(t){return t.kind==="tool"&&xH.has(t.verb)}function h_(t){let e=!1,o=t.map(n=>{if(n.kind==="tool"&&SH(n)){let r=He(n.result),s=n.output!==void 0?He(n.output):void 0,i=n.liveOutput!==void 0?He(n.liveOutput):void 0;return r===n.result&&s===n.output&&i===n.liveOutput?n:(e=!0,{...n,result:r,...s!==void 0?{output:s}:{},...i!==void 0?{liveOutput:i}:{}})}if(n.kind==="bang"){let r=Jt(n.command);return r===n.command?n:(e=!0,{...n,command:r})}if(n.kind==="tool"&&kH.has(n.verb)){let r=Jt(n.target);return r===n.target?n:(e=!0,{...n,target:r})}return n});return e?o:t}var OH=448,MH=384,v_="sessions",k_=1,LH=720*60*60*1e3,PH=50,Ov=8*1024*1024,FH=Ov*8,IH=Math.floor(Ov*.9),jm=/^[A-Za-z0-9_-]{1,128}$/,NH=64;function $H(t,e){let o=[...t];return o.length>e?o.slice(0,e).join(""):t}function Hm(t){if(typeof t!="string")return;let e="";for(let n of t){let r=n.codePointAt(0)??0;e+=r<32||r===127?" ":n}let o=e.replace(/\s+/g," ").trim();if(o!=="")return $H(o,NH)}function BH(t){for(let e of t)if(e.kind==="you"){let o=e.text.replace(/\s+/g," ").trim();if(o==="")return;let n=[...o];return n.length>60?n.slice(0,57).join("")+"\u2026":o}}var Mc=class{base;dir;now;createdAtCache=new Map;constructor(e={}){this.base=e.baseDir??_v(EH(),".aluy"),this.dir=_v(this.base,v_),this.now=e.now??(()=>Date.now())}get sessionsDir(){return this.dir}pathFor(e){return _v(this.dir,`${e}.json`)}save(e){if(!jm.test(e.id))return!1;try{let o=this.now(),n=this.resolveCreatedAt(e.id,o),r=e.tier==="custom"&&typeof e.model=="string"&&e.model.trim()!=="",s=r&&typeof e.provider=="string"&&e.provider.trim()!=="",i=Hm(e.label),a=i!==void 0?Hm(e.labelColor):void 0,l={id:e.id,version:k_,createdAt:n,updatedAt:o,cwd:e.cwd,tier:e.tier,...r?{model:e.model.trim()}:{},...s?{provider:e.provider.trim()}:{},...i!==void 0?{label:i}:{},...a!==void 0?{labelColor:a}:{}},c=this.fitBlocks(l,h_(Um(e.blocks))),u={...l,blocks:c};return this.writeAtomic(u),!0}catch{return!1}}resolveCreatedAt(e,o){let n=this.createdAtCache.get(e);if(n!==void 0)return n;let r=this.load(e)?.createdAt??o;return this.createdAtCache.set(e,r),r}load(e){if(!jm.test(e))return null;let o=this.pathFor(e),n,r=!1;try{let a=RH(o);if(a.size>FH)return null;r=a.size>Ov,n=DH(o,"utf8")}catch{return null}let s;try{s=JSON.parse(n)}catch{return null}let i=this.sanitizeRecord(s);if(i&&r){let{blocks:a,...l}=i,c=this.fitBlocks(l,a),u=a.length-c.length,f={kind:"note",title:"sess\xE3o grande \u2014 contexto antigo omitido no resume",lines:[`Esta sess\xE3o era grande demais p/ recarregar inteira; ${u} bloco(s) antigo(s) foram omitidos e a parte recente foi preservada.`,"O contexto restante ser\xE1 resumido automaticamente na pr\xF3xima intera\xE7\xE3o."]};i={...i,blocks:u>0?[f,...c]:c}}return i&&this.createdAtCache.set(i.id,i.createdAt),i}list(){let e;try{e=y_(this.dir)}catch{return[]}let o=[];for(let n of e){if(!n.endsWith(".json"))continue;let r=n.slice(0,-5),s=this.load(r);s&&o.push({id:s.id,createdAt:s.createdAt,updatedAt:s.updatedAt,cwd:s.cwd,tier:s.tier,...s.model!==void 0?{model:s.model}:{},...s.provider!==void 0?{provider:s.provider}:{},...s.label!==void 0?{label:s.label}:{},...s.labelColor!==void 0?{labelColor:s.labelColor}:{},blockCount:s.blocks.length,title:BH(s.blocks)})}return o.sort((n,r)=>r.updatedAt-n.updatedAt),o}latestForCwd(e){let o;try{o=y_(this.dir)}catch{return null}let n=null;for(let r of o){if(!r.endsWith(".json"))continue;let s=r.slice(0,-5),i=this.load(s);!i||i.cwd!==e||(n===null||i.updatedAt>n.updatedAt)&&(n=i)}return n}remove(e){if(jm.test(e)){this.createdAtCache.delete(e);try{b_(this.pathFor(e))}catch{}}}gc(e={}){let o=e.maxAgeMs??LH,n=e.maxCount??PH,r=this.list(),s=this.now()-o;r.forEach((i,a)=>{(i.updatedAt<s||a>=n)&&this.remove(i.id)})}sanitizeRecord(e){if(typeof e!="object"||e===null)return null;let o=e;if(typeof o.id!="string"||!jm.test(o.id)||!Array.isArray(o.blocks))return null;let n=typeof o.createdAt=="number"&&o.createdAt>=0?o.createdAt:0,r=typeof o.updatedAt=="number"&&o.updatedAt>=0?o.updatedAt:n,s=typeof o.cwd=="string"?o.cwd:"",i=typeof o.tier=="string"&&o.tier.trim()!==""?o.tier:"",a=typeof o.version=="number"?o.version:0,l=i==="custom"&&typeof o.model=="string"&&o.model.trim()!==""?o.model.trim():void 0,c=l!==void 0&&typeof o.provider=="string"&&o.provider.trim()!==""?o.provider.trim():void 0,u=Hm(o.label),f=u!==void 0?Hm(o.labelColor):void 0;return{id:o.id,version:a,createdAt:n,updatedAt:r,cwd:s,tier:i,...l!==void 0?{model:l}:{},...c!==void 0?{provider:c}:{},...u!==void 0?{label:u}:{},...f!==void 0?{labelColor:f}:{},blocks:Um(o.blocks)}}fitBlocks(e,o){let n=i=>Buffer.byteLength(JSON.stringify({...e,blocks:i})+`
457
457
  `,"utf8")<=IH;if(n(o))return o;let r=1,s=o.length;for(;r<s;){let i=r+s>>1;n(o.slice(i))?s=i:r=i+1}return o.slice(r)}writeAtomic(e){TH(this.dir,{recursive:!0,mode:OH});let o=this.pathFor(e.id),n=`${o}.${process.pid}.${wH(6).toString("hex")}.tmp`,r=JSON.stringify(e)+`
458
458
  `,s;try{s=AH(n,Rv.O_CREAT|Rv.O_EXCL|Rv.O_WRONLY,MH),CH(s,r),g_(s),s=void 0,_H(n,o)}catch(i){if(s!==void 0)try{g_(s)}catch{}try{b_(n)}catch{}throw i}}};function UH(t){return t.list().length>0}N();import{homedir as jH}from"node:os";import{join as Mv}from"node:path";import{readdirSync as HH,readFileSync as qH,mkdirSync as WH,statSync as GH}from"node:fs";var zH=448,x_="commands",KH=64*1024,YH=256,Lc=class{dir;constructor(e={}){let o=e.baseDir??Mv(jH(),".aluy");this.dir=Mv(o,x_)}get commandsDir(){return this.dir}ensureDir(){try{WH(this.dir,{mode:zH,recursive:!0})}catch{}}load(){let e;try{e=HH(this.dir,{withFileTypes:!0})}catch{return[]}let o=e.filter(s=>(s.isFile()||s.isSymbolicLink())&&s.name.toLowerCase().endsWith(".md")).map(s=>s.name).sort((s,i)=>s.localeCompare(i)),n=new Set,r=[];for(let s of o){if(r.length>=YH)break;let i=this.readOne(s);i&&(n.has(i.name)||(n.add(i.name),r.push(i)))}return r}readOne(e){let o=Mv(this.dir,e);try{let n=GH(o);if(!n.isFile()||n.size>KH)return null;let r=qH(o,"utf8");return Wl(e,r)}catch{return null}}};N();Br();import{join as VH}from"node:path";import{readdirSync as XH,readFileSync as JH,statSync as QH}from"node:fs";var S_=[".claude/commands",".aluy/commands"],ZH=64*1024,e3=256,Pc=class{workspace;constructor(e){this.workspace=e.workspace}load(){let e=new Set,o=[];for(let n of S_){let r;try{r=this.workspace.resolveInside(n)}catch{continue}let s;try{s=XH(r,{withFileTypes:!0})}catch{continue}let i=s.filter(a=>(a.isFile()||a.isSymbolicLink())&&a.name.toLowerCase().endsWith(".md")).map(a=>a.name).sort((a,l)=>a.localeCompare(l));for(let a of i){if(o.length>=e3)break;let l=this.readOne(n,r,a);l&&(e.has(l.name)||(e.add(l.name),o.push(l)))}}return o}readOne(e,o,n){let r=`${e}/${n}`;if(po(r).kind!=="allow")return null;let s=VH(o,n);try{this.workspace.resolveInside(r);let i=QH(s);if(!i.isFile()||i.size>ZH)return null;let a=JH(s,"utf8");return Wl(n,a)}catch{return null}}};function Lv(t,e){let o=new Map;for(let n of t)o.set(n.name,n);for(let n of e)o.set(n.name,n);return[...o.values()]}N();import{homedir as t3}from"node:os";import{join as Pv}from"node:path";import{readdirSync as o3,readFileSync as n3,mkdirSync as r3,statSync as s3}from"node:fs";var i3=448,E_="agents",a3=64*1024,l3=256,Bs=class{dir;constructor(e={}){let o=e.baseDir??Pv(t3(),".aluy");this.dir=Pv(o,E_)}get agentsDir(){return this.dir}ensureDir(){try{r3(this.dir,{mode:i3,recursive:!0})}catch{}}load(){let e;try{e=o3(this.dir,{withFileTypes:!0})}catch{return{profiles:[],errors:[]}}let o=e.filter(i=>(i.isFile()||i.isSymbolicLink())&&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>=l3)break;let a=this.readOne(i);if(a!==null){if(Nl(a)){s.push(a);continue}n.has(a.name)||(n.add(a.name),r.push(a))}}return{profiles:r,errors:s}}readOne(e){let o=Pv(this.dir,e);try{let n=s3(o);if(!n.isFile()||n.size>a3)return null;let r=n3(o,"utf8");return $l(e,r,"global")}catch{return null}}};N();Br();import{join as c3}from"node:path";import{readdirSync as u3,readFileSync as d3,statSync as m3}from"node:fs";var w_=[".claude/agents",".aluy/agents"],f3=64*1024,p3=256,Fc=class{workspace;constructor(e){this.workspace=e.workspace}load(){let e=new Set,o=[],n=[];for(let r of w_){let s;try{s=this.workspace.resolveInside(r)}catch{continue}let i;try{i=u3(s,{withFileTypes:!0})}catch{continue}let a=i.filter(l=>(l.isFile()||l.isSymbolicLink())&&l.name.toLowerCase().endsWith(".md")).map(l=>l.name).sort((l,c)=>l.localeCompare(c));for(let l of a){if(o.length>=p3)break;let c=this.readOne(r,s,l);if(c!==null){if(Nl(c)){n.push(c);continue}e.has(c.name)||(e.add(c.name),o.push(c))}}}return{profiles:o,errors:n}}readOne(e,o,n){let r=`${e}/${n}`;if(po(r).kind!=="allow")return null;let s=c3(o,n);try{this.workspace.resolveInside(r);let i=m3(s);if(!i.isFile()||i.size>f3)return null;let a=d3(s,"utf8");return $l(n,a,"project")}catch{return null}}};qm();Wm();N();import{homedir as _3}from"node:os";import{join as Uv}from"node:path";import{readdirSync as R3,readFileSync as O3,mkdirSync as M3,statSync as L3}from"node:fs";var P3=448,A_="skills",Ic="SKILL.md",F3=256*1024,I3=256,Us=class{dir;constructor(e={}){let o=e.baseDir??Uv(_3(),".aluy");this.dir=Uv(o,A_)}get skillsDir(){return this.dir}ensureDir(){try{M3(this.dir,{mode:P3,recursive:!0})}catch{}}load(){let e;try{e=R3(this.dir,{withFileTypes:!0})}catch{return{skills:[],errors:[]}}let o=e.filter(i=>i.isDirectory()).map(i=>i.name).sort((i,a)=>i.localeCompare(a)),n=new Set,r=[],s=[];for(let i of o){if(r.length>=I3)break;let a=this.readOne(i);if(a!==null){if(Bl(a)){s.push(a);continue}n.has(a.name)||(n.add(a.name),r.push(a))}}return{skills:r,errors:s}}readOne(e){let o=Uv(this.dir,e,Ic);try{let n=L3(o);if(!n.isFile()||n.size>F3)return null;let r=O3(o,"utf8");return Ul(e,r,"global")}catch{return null}}};N();import{join as N3}from"node:path";import{readdirSync as $3,readFileSync as B3,statSync as U3}from"node:fs";var C_=[".claude/skills",".aluy/skills"],j3=256*1024,H3=256,js=class{workspace;constructor(e){this.workspace=e.workspace}load(){let e=new Set,o=[],n=[];for(let r of C_){let s;try{s=this.workspace.resolveInside(r)}catch{continue}let i;try{i=$3(s,{withFileTypes:!0})}catch{continue}let a=i.filter(l=>l.isDirectory()).map(l=>l.name).sort((l,c)=>l.localeCompare(c));for(let l of a){if(o.length>=H3)break;let c=this.readOne(r,s,l);if(c!==null){if(Bl(c)){n.push(c);continue}e.has(c.name)||(e.add(c.name),o.push(c))}}}return{skills:o,errors:n}}readOne(e,o,n){let r=`${e}/${n}/${Ic}`,s=N3(o,n,Ic);try{this.workspace.resolveInside(r);let i=U3(s);if(!i.isFile()||i.size>j3)return null;let a=B3(s,"utf8");return Ul(n,a,"project")}catch{return null}}};N();import{homedir as q3}from"node:os";import{join as jv}from"node:path";import{readFileSync as W3,statSync as G3}from"node:fs";var D_="hooks.json",z3="settings.json",K3=256*1024,Nc=class{file;claudeProjectFile;constructor(e={}){let o=e.baseDir??jv(q3(),".aluy");this.file=jv(o,D_),e.workspaceRoot!==void 0&&(this.claudeProjectFile=jv(e.workspaceRoot,".claude",z3))}get configPath(){return this.file}load(){let e=Ly(this.readJson(this.file));if(this.claudeProjectFile===void 0)return e;let o=Fy(this.readJson(this.claudeProjectFile));return Iy(e,o)}readJson(e){let o;try{let n=G3(e);if(!n.isFile()||n.size>K3)return;o=W3(e,"utf8")}catch{return}try{return JSON.parse(o)}catch{return}}};Br();function $c(t,e){let o=t.toLowerCase(),n=e.toLowerCase();if(o==="")return{score:0,matched:[]};let r=[],s=0,i=0,a=-1,l=e.lastIndexOf("/")+1;for(let u=0;u<o.length;u++){let f=o[u],d=n.indexOf(f,s);if(d===-1)return null;r.push(d),a>=0&&d===a+1?i+=5:i+=1,d>=l&&(i+=2);let p=d>0?e[d-1]:"/";(p==="/"||p==="-"||p==="_"||p===".")&&(i+=3),a=d,s=d+1}let c=(r[r.length-1]??0)-(r[0]??0);return i-=c*.1,i-=e.length*.01,{score:i,matched:r}}function Hv(t,e){let o=t.trim();if(o==="")return e.map(r=>({path:r,score:0,matched:[]}));let n=[];for(let r of e){let s=$c(o,r);s&&n.push({path:r,score:s.score,matched:s.matched})}return n.sort((r,s)=>s.score-r.score||r.path.length-s.path.length||r.path.localeCompare(s.path)),n}var Y3=/(?:^|\s)(@(?:"([^"]+)"|'([^']+)'|((?:[\p{L}\p{N}._/-]|\\ )+)))/gu;function V3(t){return t.replace(/\\ /g," ")}function X3(t){return t.includes("/")?!0:/\.[A-Za-z0-9]+$/.test(t)}function J3(t){let e=t.replace(/\.+$/,"");return{token:e,trimmed:t.length-e.length}}function Hs(t){let e=[];for(let o of t.matchAll(Y3)){let n=o[1],r=o[4],s=o[2]??o[3]??r,{token:i,trimmed:a}=r!==void 0?J3(s):{token:s,trimmed:0},l=V3(i);if(!X3(l))continue;let c=(o.index??0)+o[0].indexOf(n);e.push({path:l,start:c,end:c+n.length-a})}return e}function qv(t,e){if(e.length===0)return t;let o=t;for(let n of[...e].sort((r,s)=>s.start-r.start))o=o.slice(0,n.start)+o.slice(n.end);return o.replace(/\s{2,}/g," ").trim()}function Gm(t){let e=t.lastIndexOf("@");if(e<0)return null;let o=e>0?t[e-1]:" ";if(o!==" "&&o!==`
459
459
  `&&o!==" ")return null;let n=t.slice(e+1);return/\s/.test(n)?null:{at:e,query:n}}function Wv(t){let e=Gm(t);return e?t.slice(0,e.at).replace(/\s+$/,""):t}N();Br();import{relative as Q3,sep as Z3,isAbsolute as eq}from"node:path";var T_=16e3,tq=5*1024*1024,Bc=class{workspace;fs;maxChars;sniffBytes;constructor(e){this.workspace=e.workspace,this.fs=e.fs,this.maxChars=e.maxChars??T_,this.sniffBytes=e.sniffBytes??tq}async attach(e,o={}){let n=e,r;try{r=this.workspace.resolveInside(e)}catch{return{kind:"rejected",path:n,reason:"caminho fora do workspace \u2014 recusado (o @ s\xF3 acessa a raiz do projeto)."}}let s=Q3(this.workspace.root,r).split(Z3).join("/");if(s===""||s.startsWith("..")||eq(s))return{kind:"rejected",path:n,reason:"caminho inv\xE1lido p/ o workspace."};let i=po(s);if(i.kind==="deny")return{kind:"rejected",path:s,reason:`bloqueado: ${i.why} \u2014 esse tipo de arquivo nunca \xE9 anexado ao contexto.`};if(i.kind==="ask"&&o.confirmSensitive!==!0)return{kind:"rejected",path:s,reason:`sens\xEDvel: ${i.why} \u2014 confirme explicitamente p/ anexar (fora do picker por padr\xE3o).`};try{if(await uT(r,this.sniffBytes))return{kind:"rejected",path:s,reason:"arquivo bin\xE1rio \u2014 n\xE3o anexado (conte\xFAdo n\xE3o \xE9 texto; evita lixo no contexto)."}}catch{}let a;try{a=await this.fs.readFile(s)}catch{return{kind:"rejected",path:s,reason:"n\xE3o foi poss\xEDvel ler o arquivo (sumiu/ileg\xEDvel)."}}let l=!1;return a.length>this.maxChars&&(a=a.slice(0,this.maxChars)+`
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@hiperplano/aluy-cli",
3
- "version": "1.0.0-rc.88",
3
+ "version": "1.0.0-rc.89",
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",