@hiperplano/aluy-cli 1.0.0-rc.95 → 1.0.0-rc.96

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 L8=Object.create;var fy=Object.defineProperty;var P8=Object.getOwnPropertyDescriptor;var F8=Object.getOwnPropertyNames;var I8=Object.getPrototypeOf,N8=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 $8=(t,e)=>()=>{try{return e||t((e={exports:{}}).exports,e),e.exports}catch(o){throw e=0,o}},ft=(t,e)=>{for(var o in e)fy(t,o,{get:e[o],enumerable:!0})},B8=(t,e,o,n)=>{if(e&&typeof e=="object"||typeof e=="function")for(let r of F8(e))!N8.call(t,r)&&r!==o&&fy(t,r,{get:()=>e[r],enumerable:!(n=P8(e,r))||n.enumerable});return t};var U8=(t,e,o)=>(o=t!=null?L8(I8(t)):{},B8(e||!t||!t.__esModule?fy(o,"default",{value:t,enumerable:!0}):o,t));import{homedir as j8}from"node:os";import{join as H8}from"node:path";function nc(t=j8()){return H8(t,".aluy")}var jm=p(()=>{"use strict"});var rc,TC=p(()=>{"use strict";rc="1.0.0-rc.95"});function Or(t,e){return t.decide(e)}var mi=p(()=>{"use strict"});var Qn,Mr,Lr=p(()=>{"use strict";Qn="remember",Mr="recall"});var py,q8,xa,hy=p(()=>{"use strict";py=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}}},q8=200,xa=class{nodes=new Map;maxBoxes;now;constructor(e){this.maxBoxes=e?.maxBoxes??q8,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 py(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 Hm(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 RC(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"&&W8.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=RC(u,!1);if(typeof m=="string")return m;c.push(m)}r=c}}}if(o===void 0||o.trim()==="")return z8;let s=o.trim().slice(0,G8);return r?{title:s,status:n,substeps:r}:{title:s,status:n}}function K8(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=RC(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=Hm(o).length;return s>DC?{error:`update_plan: no m\xE1ximo ${DC} passos (recebidos ${s}).`}:{steps:o}}function Y8(t){let e=Hm(t),o=e.filter(r=>r.step.status==="completed").length,n=e.map(r=>`${" ".repeat(r.depth)}${OC[r.step.status]} ${r.step.title}`).join(`
2
+ var L8=Object.create;var fy=Object.defineProperty;var P8=Object.getOwnPropertyDescriptor;var F8=Object.getOwnPropertyNames;var I8=Object.getPrototypeOf,N8=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 $8=(t,e)=>()=>{try{return e||t((e={exports:{}}).exports,e),e.exports}catch(o){throw e=0,o}},ft=(t,e)=>{for(var o in e)fy(t,o,{get:e[o],enumerable:!0})},B8=(t,e,o,n)=>{if(e&&typeof e=="object"||typeof e=="function")for(let r of F8(e))!N8.call(t,r)&&r!==o&&fy(t,r,{get:()=>e[r],enumerable:!(n=P8(e,r))||n.enumerable});return t};var U8=(t,e,o)=>(o=t!=null?L8(I8(t)):{},B8(e||!t||!t.__esModule?fy(o,"default",{value:t,enumerable:!0}):o,t));import{homedir as j8}from"node:os";import{join as H8}from"node:path";function nc(t=j8()){return H8(t,".aluy")}var jm=p(()=>{"use strict"});var rc,TC=p(()=>{"use strict";rc="1.0.0-rc.96"});function Or(t,e){return t.decide(e)}var mi=p(()=>{"use strict"});var Qn,Mr,Lr=p(()=>{"use strict";Qn="remember",Mr="recall"});var py,q8,xa,hy=p(()=>{"use strict";py=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}}},q8=200,xa=class{nodes=new Map;maxBoxes;now;constructor(e){this.maxBoxes=e?.maxBoxes??q8,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 py(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 Hm(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 RC(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"&&W8.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=RC(u,!1);if(typeof m=="string")return m;c.push(m)}r=c}}}if(o===void 0||o.trim()==="")return z8;let s=o.trim().slice(0,G8);return r?{title:s,status:n,substeps:r}:{title:s,status:n}}function K8(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=RC(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=Hm(o).length;return s>DC?{error:`update_plan: no m\xE1ximo ${DC} passos (recebidos ${s}).`}:{steps:o}}function Y8(t){let e=Hm(t),o=e.filter(r=>r.step.status==="completed").length,n=e.map(r=>`${" ".repeat(r.depth)}${OC[r.step.status]} ${r.step.title}`).join(`
3
3
  `);return`plano (${o}/${e.length}):
4
4
  ${n}`}function X8(t,e){return e<0?"m\xE9dio":t===e?"curto":t>e?"longo":"m\xE9dio"}function J8(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??xa.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=X8(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 Q8(t,e){if(!e)return Y8(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=Hm(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?V8[m.horizon]:"",h=m?s(m.id):u,g=" ".repeat(h),b=OC[c.status];l.push(`${g}${d} ${b} ${c.title}`)}return l.join(`
5
5
  `)}var sc,W8,DC,G8,z8,OC,V8,_C,Z8,MC,qm=p(()=>{"use strict";hy();sc="update_plan";W8=new Set(["pending","in_progress","completed"]),DC=30,G8=120,z8="update_plan: cada passo precisa de um t\xEDtulo (texto) n\xE3o-vazio.";OC={pending:"\u2610",in_progress:"\u25B6",completed:"\u2611"};V8={longo:"[\u{1F4D0}]",m\u00E9dio:"[\u{1F4CB}]",curto:"[\u{1F4CC}]"};_C=Object.freeze({type:"string",enum:["pending","in_progress","completed"],description:"pending (a fazer) \xB7 in_progress (em curso) \xB7 completed (feito)."}),Z8=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:_C,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:_C},required:["title"],additionalProperties:!1}}},required:["title"],additionalProperties:!1}}},required:["steps"],additionalProperties:!1}),MC={name:sc,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:Z8,async run(t,e){let o=K8(t);return"error"in o?{ok:!1,observation:o.error}:(e.graph&&J8(o.steps,e.graph),e.plan&&e.plan.set(Hm(o.steps).map(r=>({title:r.step.title,status:r.step.status}))),{ok:!0,observation:Q8(o.steps,e.graph)})}}});function LC(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)?tH(s):void 0;if(typeof i=="string")return{error:i};let a,l=t.kind??t.type;if(typeof l=="string"&&eH.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 tH(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 oH(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 IR(t,e,o=Eu){let{older:n,recent:r}=dp(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=xe(un(),Hr),c=xe(l,Fn);Ze(l)&&Hp(Wp(),c)}catch{}t==="ollama"&&(await m9(),f9()),process.stderr.write(`
155
155
  verificando "${t}"\u2026 (alguns segundos; a pr\xF3xima etapa vem em seguida)
156
156
  `);let a=await cM(t,process.platform,!0);for(let l=0;l<c9&&!a;l++)await d9(u9),a=await cM(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 d9(t){return new Promise(e=>setTimeout(e,t))}async function m9(){for(let t of[Pn,Gp()])try{await(await fetch(`http://${ln}:${ir}/api/pull`,{method:"POST",headers:{"content-type":"application/json"},body:JSON.stringify({name:t,stream:!1})})).text()}catch{}}function f9(){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=qp(),n=["/usr/local/bin/ollama","/usr/bin/ollama","/opt/homebrew/bin/ollama",xe(e,".ollama","bin","ollama"),xe(un(),Ds,"bin","ollama")].find(i=>Ze(i));if(n===void 0)return;let r=xe(e,".local","bin");Ix(r,{recursive:!0});let s=xe(r,"ollama");try{if(sM(s)===sM(n))return;GG(s)}catch{}try{WG(n,s)}catch{}}catch{}}function p9(){try{return xo("python3",["-m","venv","--help"],{timeout:1e4}).status===0}catch{return!1}}function h9(){try{return xo("python3",["-m","pip","--version"],{timeout:1e4}).status===0}catch{return!1}}function g9(t){let e=[],o=[];if(t.has("ollama")&&(dM()||(e.push("zstd (extrair o Ollama)"),o.push("zstd")),mM()||(e.push("tar (extrair o Ollama)"),o.push("tar"))),t.has("mem0")||t.has("headroom")){let r=$x();r.ok?(p9()||(e.push("m\xF3dulo venv do Python (mem0/headroom criam um virtualenv)"),o.push("python3-venv")),h9()||(e.push("pip do Python (mem0/headroom instalam pacotes)"),o.push("python3-pip"))):(e.push(`python3 >= ${Tu} 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 pM(t,e,o){let n=t??"turbo",r=qr(e??{}),s=o?.useAgent!==!1,i=new Fx({...o?.platform?{platform:o.platform}:{},...s?{agentInstaller:l9}:{}});if(!s)for(let a of g9(r))process.stderr.write(a+`
157
- `);return i.provisionAll(n,r)}var uM,ol,VG,Fn,aM,Fx,lM,i9,c9,u9,Bx=p(()=>{"use strict";P();uM=".aluy",ol=448,VG=384;Fn="aluy-mem0-server.py";aM="application/vnd.ollama.image.model";Fx=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=xe(un(),Ds,"bin","ollama");return Ze(o)}case"mem0":{let o=xe(un(),Hr,"bin","python3");return Ze(o)&&qu(o)}case"headroom":{let o=xe(un(),_s,"bin","headroom");return Ze(o)}default:return!1}}async provision(e,o){let n=KG().uid;if(Xk(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 e9();case"mem0":return r9();case"headroom":return s9();default:return{target:e,hashOk:!1,installed:!1,message:`Alvo desconhecido: ${String(e)}`}}}async provisionAll(e,o){if(!_u(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}}},lM="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",i9="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. ";c9=24,u9=5e3});var dn,rl=p(()=>{"use strict";dn="1.0.0-rc.95"});var vM={};ft(vM,{HELP_TEXT:()=>gM,parseArgs:()=>Ux,suggestFlag:()=>x9,versionText:()=>yM});function ut(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 y9(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 yM(){return`aluy ${dn} (@hiperplano/aluy-cli-core ${rc})`}function k9(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 x9(t){let e,o=3;for(let n of bM){let r=k9(t,n);r<o&&(o=r,e=n)}return e}function S9(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===""||bM.has(s)||o.push(`--${s}`)}return o}function Ux(t){let e=t[0];if(e==="login"&&!t.includes("-h")&&!t.includes("--help")){let q=t.slice(1),ce=ut(q,"token"),vt=ut(q,"org"),qt=q.includes("--device"),Uo=ut(q,"provider"),_r=q.includes("--oauth");return{kind:"login",forceDeviceFlow:qt,...ce!==void 0?{token:ce}:{},...vt!==void 0?{org:vt}:{},...Uo!==void 0?{provider:Uo}:{},..._r?{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 q=t.includes("--deep")||t.includes("--test"),ce=t.includes("--json");return{kind:"doctor",deep:q,json:ce}}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 q=t.includes("--json"),ce=t.findIndex(qt=>qt==="--backend"||qt.startsWith("--backend=")),vt="both";if(ce!==-1){let Uo=(t[ce].includes("=")?t[ce].slice(10):t[ce+1]??"").trim().toLowerCase();Uo==="local"?vt="local":Uo==="broker"&&(vt="broker")}return{kind:"models",scope:vt,json:q,which:e==="providers"?"providers":"models"}}if(e==="telegram"&&!t.includes("-h")&&!t.includes("--help")){let q=t[1];if(q===void 0||!["login","logout","allow","deny","status"].includes(q))return{kind:"usage-error",message:"uso: aluy telegram <login|logout|allow|deny|status>",exitCode:2};let vt=t.slice(2);if(q==="login"){let qt=ut(vt,"token");return{kind:"telegram",sub:"login",...qt!==void 0?{token:qt}:{}}}if(q==="allow"||q==="deny"){let qt=vt.find(_r=>!_r.startsWith("-")),Uo=qt!==void 0&&/^-?\d+$/.test(qt)?Number(qt):void 0;return Uo===void 0?{kind:"usage-error",message:`uso: aluy telegram ${q} <chat-id> (um inteiro)`,exitCode:2}:{kind:"telegram",sub:q,chatId:Uo}}return{kind:"telegram",sub:q}}if(e==="mcp"&&t[1]==="search"&&!t.includes("-h")&&!t.includes("--help"))return{kind:"mcp-search",query:t.slice(2).filter(ce=>!ce.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:yM()};if(t.includes("-h")||t.includes("--help"))return{kind:"help",text:gM};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=ut(t,"tier"),h=ut(t,"lang"),g=ut(t,"max-tokens"),b=ut(t,"max-iterations"),y=ut(t,"max-output-tokens"),S=!(t.includes("--no-subagents")||t.includes("--no-subagent")),A=t.includes("--no-self-check")?"0":t.includes("--self-check")?"1":void 0,T=t.includes("--no-autocompact")?"off":ut(t,"autocompact-at"),O=t.includes("--quiet")?!0:void 0,N=t.includes("--cycle")?!0:void 0,G=ut(t,"cycles"),V=ut(t,"cycle-for"),z=ut(t,"backend"),B=ut(t,"local-provider"),X=ut(t,"local-model"),oe=ut(t,"local-auth"),ne=ut(t,"local-base-url"),M=ut(t,"model"),j=ut(t,"provider");if((t.includes("--provider")||t.some(q=>q.startsWith("--provider=")))&&(M===void 0||M.trim()===""))return{kind:"usage-error",message:"aluy: --provider exige --model (ex.: --provider <provider> --model <slug>)",exitCode:2};if((M===void 0||M.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 se=ut(t,"effort"),pe=t.includes("--effort")||t.some(q=>q.startsWith("--effort=")),ie;if(se!==void 0){if(se.trim()==="")return{kind:"usage-error",message:"aluy: --effort requer um valor (ex.: --effort low)",exitCode:2};if(se.length>32)return{kind:"usage-error",message:"aluy: --effort aceita no m\xE1ximo 32 caracteres",exitCode:2};ie=se}else if(pe)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(q=>q.startsWith("-p=")||q.startsWith("--print=")||q.startsWith("--exec=")),R=me?ut(t,"print",{allowDashValue:!0})??ut(t,"exec",{allowDashValue:!0})??y9(t,"p")??void 0:void 0,de=me?ut(t,"output-format"):void 0;if(de!==void 0&&!["text","json","stream-json"].includes(de.trim()))return{kind:"usage-error",message:`aluy: --output-format inv\xE1lido "${de}" (use text | json | stream-json)`,exitCode:2};let ae=t.includes("--new"),Y=t.includes("--continue"),Oe=t.indexOf("--resume"),yt=t.find(q=>q.startsWith("--resume=")),et=Oe>=0||yt!==void 0,Le;if(yt!==void 0)Le=yt.slice(9);else if(Oe>=0){let q=t[Oe+1];q!==void 0&&!q.startsWith("-")&&(Le=q)}let Rt=d!==void 0?t.indexOf("--tier")+1:-1,wt=h!==void 0&&!t.some(q=>q.startsWith("--lang="))?t.indexOf("--lang")+1:-1,Te=Le!==void 0&&yt===void 0?Oe+1:-1,rt=g!==void 0&&!t.some(q=>q.startsWith("--max-tokens="))?t.indexOf("--max-tokens")+1:-1,K=b!==void 0&&!t.some(q=>q.startsWith("--max-iterations="))?t.indexOf("--max-iterations")+1:-1,Ee=G!==void 0&&!t.some(q=>q.startsWith("--cycles="))?t.indexOf("--cycles")+1:-1,Fe=V!==void 0&&!t.some(q=>q.startsWith("--cycle-for="))?t.indexOf("--cycle-for")+1:-1,H=y!==void 0&&!t.some(q=>q.startsWith("--max-output-tokens="))?t.indexOf("--max-output-tokens")+1:-1,Ot=T!==void 0&&!t.includes("--no-autocompact")&&!t.some(q=>q.startsWith("--autocompact-at="))?t.indexOf("--autocompact-at")+1:-1,ds=z!==void 0&&!t.some(q=>q.startsWith("--backend="))?t.indexOf("--backend")+1:-1,Zo=(q,ce)=>ce!==void 0&&!t.some(vt=>vt.startsWith(`--${q}=`))?t.indexOf(`--${q}`)+1:-1,k=Zo("local-provider",B),jt=Zo("local-model",X),Tr=Zo("local-auth",oe),At=Zo("local-base-url",ne),en=M!==void 0&&!t.some(q=>q.startsWith("--model="))?t.indexOf("--model")+1:-1,ms=j!==void 0&&!t.some(q=>q.startsWith("--provider="))?t.indexOf("--provider")+1:-1,ci=ie!==void 0&&!t.some(q=>q.startsWith("--effort="))?t.indexOf("--effort")+1:-1,tn=de!==void 0&&!t.some(q=>q.startsWith("--output-format="))?t.indexOf("--output-format")+1:-1,En=R!==void 0&&!t.some(q=>q.startsWith("-p=")||q.startsWith("--print=")||q.startsWith("--exec="))?Math.max(t.indexOf("-p"),t.indexOf("--print"),t.indexOf("--exec"))+1:-1,on=t.find((q,ce)=>!q.startsWith("-")&&ce!==Rt&&ce!==wt&&ce!==ds&&ce!==k&&ce!==jt&&ce!==Tr&&ce!==At&&ce!==en&&ce!==ms&&ce!==ci&&ce!==tn&&ce!==En&&ce!==Te&&ce!==rt&&ce!==K&&ce!==H&&ce!==Ot&&ce!==Ee&&ce!==Fe),Bo=(R??on??"").trim();if(Bo!==""&&!/\s/.test(Bo)&&v9.has(Bo.toLowerCase()))return{kind:"usage-error",message:`aluy: "${Bo}" \xE9 um comando de SESS\xC3O, n\xE3o um objetivo. Use /${Bo} 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 "${Bo} o arquivo X"\`).`,exitCode:2};let Dr=Y?{kind:"continue"}:et?{kind:"resume",...Le!==void 0?{id:Le}:{}}:void 0,zn=new Set([Rt,wt,ds,k,jt,Tr,At,en,ms,ci,tn,En,Te,rt,K,H,Ot,Ee,Fe].filter(q=>q>=0));for(let q of b9){let ce=t.indexOf(q);ce>=0&&!t[ce].includes("=")&&zn.add(ce+1)}let Ht=S9(t,zn);return{kind:"launch",mode:s,unsafe:s==="unsafe",unsafeAliasUsed:n,...Ht.length>0?{unknownFlags:Ht}:{},dense:i,fresh:ae,subAgents:S,safeGlyphs:a,telegram:l,print:me,...c!==void 0?{split:c}:{},...u!==void 0?{fullscreen:u}:{},...m!==void 0?{budget:m}:{},...on!==void 0?{goal:on}:{},...d!==void 0?{tier:d}:{},...z!==void 0?{backend:z}:{},...B!==void 0?{localProvider:B}:{},...X!==void 0?{localModel:X}:{},...oe!==void 0?{localAuth:oe}:{},...ne!==void 0?{localBaseUrl:ne}:{},...M!==void 0?{model:M}:{},...j!==void 0?{provider:j}:{},...ie!==void 0?{effort:ie}:{},...R!==void 0?{printArg:R}:{},...de!==void 0?{outputFormat:de}:{},...h!==void 0?{lang:h}:{},...Dr!==void 0?{resume:Dr}:{},...g!==void 0?{maxTokens:g}:{},...b!==void 0?{maxIterations:b}:{},...y!==void 0?{maxOutputTokens:y}:{},...A!==void 0?{selfCheck:A}:{},...T!==void 0?{autoCompactAt:T}:{},...O!==void 0?{quiet:O}:{},...N!==void 0?{cycle:N}:{},...G!==void 0?{cycles:G}:{},...V!==void 0?{cycleFor:V}:{}}}var gM,bM,b9,v9,jx=p(()=>{"use strict";P();rl();gM=`aluy \u2014 agente de terminal que roda na sua m\xE1quina, com o seu provider de LLM
157
+ `);return i.provisionAll(n,r)}var uM,ol,VG,Fn,aM,Fx,lM,i9,c9,u9,Bx=p(()=>{"use strict";P();uM=".aluy",ol=448,VG=384;Fn="aluy-mem0-server.py";aM="application/vnd.ollama.image.model";Fx=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=xe(un(),Ds,"bin","ollama");return Ze(o)}case"mem0":{let o=xe(un(),Hr,"bin","python3");return Ze(o)&&qu(o)}case"headroom":{let o=xe(un(),_s,"bin","headroom");return Ze(o)}default:return!1}}async provision(e,o){let n=KG().uid;if(Xk(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 e9();case"mem0":return r9();case"headroom":return s9();default:return{target:e,hashOk:!1,installed:!1,message:`Alvo desconhecido: ${String(e)}`}}}async provisionAll(e,o){if(!_u(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}}},lM="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",i9="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. ";c9=24,u9=5e3});var dn,rl=p(()=>{"use strict";dn="1.0.0-rc.96"});var vM={};ft(vM,{HELP_TEXT:()=>gM,parseArgs:()=>Ux,suggestFlag:()=>x9,versionText:()=>yM});function ut(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 y9(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 yM(){return`aluy ${dn} (@hiperplano/aluy-cli-core ${rc})`}function k9(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 x9(t){let e,o=3;for(let n of bM){let r=k9(t,n);r<o&&(o=r,e=n)}return e}function S9(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===""||bM.has(s)||o.push(`--${s}`)}return o}function Ux(t){let e=t[0];if(e==="login"&&!t.includes("-h")&&!t.includes("--help")){let q=t.slice(1),ce=ut(q,"token"),vt=ut(q,"org"),qt=q.includes("--device"),Uo=ut(q,"provider"),_r=q.includes("--oauth");return{kind:"login",forceDeviceFlow:qt,...ce!==void 0?{token:ce}:{},...vt!==void 0?{org:vt}:{},...Uo!==void 0?{provider:Uo}:{},..._r?{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 q=t.includes("--deep")||t.includes("--test"),ce=t.includes("--json");return{kind:"doctor",deep:q,json:ce}}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 q=t.includes("--json"),ce=t.findIndex(qt=>qt==="--backend"||qt.startsWith("--backend=")),vt="both";if(ce!==-1){let Uo=(t[ce].includes("=")?t[ce].slice(10):t[ce+1]??"").trim().toLowerCase();Uo==="local"?vt="local":Uo==="broker"&&(vt="broker")}return{kind:"models",scope:vt,json:q,which:e==="providers"?"providers":"models"}}if(e==="telegram"&&!t.includes("-h")&&!t.includes("--help")){let q=t[1];if(q===void 0||!["login","logout","allow","deny","status"].includes(q))return{kind:"usage-error",message:"uso: aluy telegram <login|logout|allow|deny|status>",exitCode:2};let vt=t.slice(2);if(q==="login"){let qt=ut(vt,"token");return{kind:"telegram",sub:"login",...qt!==void 0?{token:qt}:{}}}if(q==="allow"||q==="deny"){let qt=vt.find(_r=>!_r.startsWith("-")),Uo=qt!==void 0&&/^-?\d+$/.test(qt)?Number(qt):void 0;return Uo===void 0?{kind:"usage-error",message:`uso: aluy telegram ${q} <chat-id> (um inteiro)`,exitCode:2}:{kind:"telegram",sub:q,chatId:Uo}}return{kind:"telegram",sub:q}}if(e==="mcp"&&t[1]==="search"&&!t.includes("-h")&&!t.includes("--help"))return{kind:"mcp-search",query:t.slice(2).filter(ce=>!ce.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:yM()};if(t.includes("-h")||t.includes("--help"))return{kind:"help",text:gM};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=ut(t,"tier"),h=ut(t,"lang"),g=ut(t,"max-tokens"),b=ut(t,"max-iterations"),y=ut(t,"max-output-tokens"),S=!(t.includes("--no-subagents")||t.includes("--no-subagent")),A=t.includes("--no-self-check")?"0":t.includes("--self-check")?"1":void 0,T=t.includes("--no-autocompact")?"off":ut(t,"autocompact-at"),O=t.includes("--quiet")?!0:void 0,N=t.includes("--cycle")?!0:void 0,G=ut(t,"cycles"),V=ut(t,"cycle-for"),z=ut(t,"backend"),B=ut(t,"local-provider"),X=ut(t,"local-model"),oe=ut(t,"local-auth"),ne=ut(t,"local-base-url"),M=ut(t,"model"),j=ut(t,"provider");if((t.includes("--provider")||t.some(q=>q.startsWith("--provider=")))&&(M===void 0||M.trim()===""))return{kind:"usage-error",message:"aluy: --provider exige --model (ex.: --provider <provider> --model <slug>)",exitCode:2};if((M===void 0||M.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 se=ut(t,"effort"),pe=t.includes("--effort")||t.some(q=>q.startsWith("--effort=")),ie;if(se!==void 0){if(se.trim()==="")return{kind:"usage-error",message:"aluy: --effort requer um valor (ex.: --effort low)",exitCode:2};if(se.length>32)return{kind:"usage-error",message:"aluy: --effort aceita no m\xE1ximo 32 caracteres",exitCode:2};ie=se}else if(pe)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(q=>q.startsWith("-p=")||q.startsWith("--print=")||q.startsWith("--exec=")),R=me?ut(t,"print",{allowDashValue:!0})??ut(t,"exec",{allowDashValue:!0})??y9(t,"p")??void 0:void 0,de=me?ut(t,"output-format"):void 0;if(de!==void 0&&!["text","json","stream-json"].includes(de.trim()))return{kind:"usage-error",message:`aluy: --output-format inv\xE1lido "${de}" (use text | json | stream-json)`,exitCode:2};let ae=t.includes("--new"),Y=t.includes("--continue"),Oe=t.indexOf("--resume"),yt=t.find(q=>q.startsWith("--resume=")),et=Oe>=0||yt!==void 0,Le;if(yt!==void 0)Le=yt.slice(9);else if(Oe>=0){let q=t[Oe+1];q!==void 0&&!q.startsWith("-")&&(Le=q)}let Rt=d!==void 0?t.indexOf("--tier")+1:-1,wt=h!==void 0&&!t.some(q=>q.startsWith("--lang="))?t.indexOf("--lang")+1:-1,Te=Le!==void 0&&yt===void 0?Oe+1:-1,rt=g!==void 0&&!t.some(q=>q.startsWith("--max-tokens="))?t.indexOf("--max-tokens")+1:-1,K=b!==void 0&&!t.some(q=>q.startsWith("--max-iterations="))?t.indexOf("--max-iterations")+1:-1,Ee=G!==void 0&&!t.some(q=>q.startsWith("--cycles="))?t.indexOf("--cycles")+1:-1,Fe=V!==void 0&&!t.some(q=>q.startsWith("--cycle-for="))?t.indexOf("--cycle-for")+1:-1,H=y!==void 0&&!t.some(q=>q.startsWith("--max-output-tokens="))?t.indexOf("--max-output-tokens")+1:-1,Ot=T!==void 0&&!t.includes("--no-autocompact")&&!t.some(q=>q.startsWith("--autocompact-at="))?t.indexOf("--autocompact-at")+1:-1,ds=z!==void 0&&!t.some(q=>q.startsWith("--backend="))?t.indexOf("--backend")+1:-1,Zo=(q,ce)=>ce!==void 0&&!t.some(vt=>vt.startsWith(`--${q}=`))?t.indexOf(`--${q}`)+1:-1,k=Zo("local-provider",B),jt=Zo("local-model",X),Tr=Zo("local-auth",oe),At=Zo("local-base-url",ne),en=M!==void 0&&!t.some(q=>q.startsWith("--model="))?t.indexOf("--model")+1:-1,ms=j!==void 0&&!t.some(q=>q.startsWith("--provider="))?t.indexOf("--provider")+1:-1,ci=ie!==void 0&&!t.some(q=>q.startsWith("--effort="))?t.indexOf("--effort")+1:-1,tn=de!==void 0&&!t.some(q=>q.startsWith("--output-format="))?t.indexOf("--output-format")+1:-1,En=R!==void 0&&!t.some(q=>q.startsWith("-p=")||q.startsWith("--print=")||q.startsWith("--exec="))?Math.max(t.indexOf("-p"),t.indexOf("--print"),t.indexOf("--exec"))+1:-1,on=t.find((q,ce)=>!q.startsWith("-")&&ce!==Rt&&ce!==wt&&ce!==ds&&ce!==k&&ce!==jt&&ce!==Tr&&ce!==At&&ce!==en&&ce!==ms&&ce!==ci&&ce!==tn&&ce!==En&&ce!==Te&&ce!==rt&&ce!==K&&ce!==H&&ce!==Ot&&ce!==Ee&&ce!==Fe),Bo=(R??on??"").trim();if(Bo!==""&&!/\s/.test(Bo)&&v9.has(Bo.toLowerCase()))return{kind:"usage-error",message:`aluy: "${Bo}" \xE9 um comando de SESS\xC3O, n\xE3o um objetivo. Use /${Bo} 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 "${Bo} o arquivo X"\`).`,exitCode:2};let Dr=Y?{kind:"continue"}:et?{kind:"resume",...Le!==void 0?{id:Le}:{}}:void 0,zn=new Set([Rt,wt,ds,k,jt,Tr,At,en,ms,ci,tn,En,Te,rt,K,H,Ot,Ee,Fe].filter(q=>q>=0));for(let q of b9){let ce=t.indexOf(q);ce>=0&&!t[ce].includes("=")&&zn.add(ce+1)}let Ht=S9(t,zn);return{kind:"launch",mode:s,unsafe:s==="unsafe",unsafeAliasUsed:n,...Ht.length>0?{unknownFlags:Ht}:{},dense:i,fresh:ae,subAgents:S,safeGlyphs:a,telegram:l,print:me,...c!==void 0?{split:c}:{},...u!==void 0?{fullscreen:u}:{},...m!==void 0?{budget:m}:{},...on!==void 0?{goal:on}:{},...d!==void 0?{tier:d}:{},...z!==void 0?{backend:z}:{},...B!==void 0?{localProvider:B}:{},...X!==void 0?{localModel:X}:{},...oe!==void 0?{localAuth:oe}:{},...ne!==void 0?{localBaseUrl:ne}:{},...M!==void 0?{model:M}:{},...j!==void 0?{provider:j}:{},...ie!==void 0?{effort:ie}:{},...R!==void 0?{printArg:R}:{},...de!==void 0?{outputFormat:de}:{},...h!==void 0?{lang:h}:{},...Dr!==void 0?{resume:Dr}:{},...g!==void 0?{maxTokens:g}:{},...b!==void 0?{maxIterations:b}:{},...y!==void 0?{maxOutputTokens:y}:{},...A!==void 0?{selfCheck:A}:{},...T!==void 0?{autoCompactAt:T}:{},...O!==void 0?{quiet:O}:{},...N!==void 0?{cycle:N}:{},...G!==void 0?{cycles:G}:{},...V!==void 0?{cycleFor:V}:{}}}var gM,bM,b9,v9,jx=p(()=>{"use strict";P();rl();gM=`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>]
@@ -700,7 +700,7 @@ ${o[s]}`).join(`
700
700
  `);return s=s.replace(/\n{3,}/g,`
701
701
 
702
702
  `).replace(/\n+$/,"")+`
703
- `,s}var wj=p(()=>{"use strict";P()});function nC(t,e){return e!==void 0&&e.trim()!==""?!0:t.some(o=>o.kind==="you"||o.kind==="aluy")}function Ej(t,e){if(!nC(e.blocks,e.label))return!1;try{return t.save(e)}catch{return!1}}function Poe(t){let e=new Date(t),o=n=>String(n).padStart(2,"0");return`${e.getFullYear()}-${o(e.getMonth()+1)}-${o(e.getDate())} ${o(e.getHours())}:${o(e.getMinutes())}`}function Foe(t){let e=Math.max(0,Math.floor(t/1e3));if(e<60)return"h\xE1 instantes";let o=Math.floor(e/60);if(o<60)return`h\xE1 ${o} min`;let n=Math.floor(o/60);return n<24?`h\xE1 ${n} h`:`h\xE1 ${Math.floor(n/24)} d`}function Aj(t,e){return`\u21BB retomar a conversa anterior (${t} ${t===1?"mensagem":"mensagens"}, ${Foe(e)})? [S/n] `}function Cj(t){if(t.length===0)return["nenhuma sess\xE3o salva ainda."];let e=["sess\xF5es salvas (retome com: aluy --resume <id>):",""];for(let o of t){let n=o.title??"(sem objetivo)";e.push(` ${o.id}`),e.push(` ${Poe(o.updatedAt)} \xB7 ${o.cwd} \xB7 ${o.blockCount} blocos`),e.push(` ${n}`)}return e}var rC=p(()=>{"use strict"});function Pm(t,e=Tj){let o=t.tier.trim();if(o!=="custom")return{tier:o};let n=t.model?.trim();if(n!==void 0&&n!==""){let r=t.provider?.trim();return{tier:"custom",model:n,...r!==void 0&&r!==""?{provider:r}:{}}}return{tier:e,warning:`sess\xE3o Custom anterior sem o modelo salvo \u2014 retomada no tier ${e}. Use /model p/ reescolher o modelo Custom.`}}function Dj(t,e=Tj){return Pm({tier:t.tier??"",...t.model!==void 0?{model:t.model}:{},...t.provider!==void 0?{provider:t.provider}:{}},e)}function Ioe(t,e,o){if(t===void 0)return{kind:"none"};if(t.kind==="continue"){let r=e.latestForCwd(o);if(r&&Rj(r.blocks)>0)return{kind:"resumed",record:r};for(let s of e.list()){if(s.cwd!==o||s.title===void 0)continue;let i=e.load(s.id);if(i)return{kind:"resumed",record:i}}return{kind:"none"}}if(t.id!==void 0&&t.id.trim()!==""){let r=t.id.trim(),s=e.load(r);if(s)return{kind:"resumed",record:s};let i=r.toLowerCase(),a=e.list().filter(l=>(l.label??"").trim().toLowerCase()===i);if(a.length===1){let l=e.load(a[0].id);if(l)return{kind:"resumed",record:l}}return a.length>1?{kind:"pick",choices:a}:{kind:"not-found",requestedId:r}}let n=e.list().filter(r=>r.title!==void 0||r.label!==void 0);return n.length>0?{kind:"pick",choices:n}:{kind:"none"}}function Noe(t){let e=0;for(let o of t)(o.kind==="you"||o.kind==="aluy")&&(e+=1);return e}function Rj(t){let e=0;for(let o of t)o.kind==="you"&&(e+=1);return e}function $oe(t,e,o,n,r=Date.now(),s=_j){if(t!==void 0||e)return{kind:"explicit"};let i=o.latestForCwd(n);if(!i)return{kind:"none"};let a=Math.max(0,r-i.updatedAt);if(a>s)return{kind:"none"};let l=Noe(i.blocks);return l===0?{kind:"none"}:Rj(i.blocks)===0?{kind:"none"}:{kind:"offer",record:i,ageMs:a,messageCount:l}}async function Oj(t){let e=Ioe(t.request,t.store,t.cwd);if(e.kind!=="none"||!t.isTty)return e;let o=$oe(t.request,t.fresh,t.store,t.cwd,t.now??Date.now(),t.windowMs??_j);if(o.kind!=="offer")return{kind:"none"};let n=!1;try{n=await t.promptYesNo(Aj(o.messageCount,o.ageMs))}catch{n=!1}return n?{kind:"resumed",record:o.record}:{kind:"none"}}var Tj,_j,Mj=p(()=>{"use strict";rC();Tj="aluy-flux";_j=1440*60*1e3});function Goe(t,e){let n=Math.max(1,Math.trunc(e))+Woe;return((Number.isFinite(t)?Math.trunc(t):0)*joe%n+n)%n}function zoe(t,e,o){let n=Goe(e,o),r=Number.isFinite(t)?Math.trunc(t):0,s=Math.abs(r-n);return s<=Hoe?2:s<=qoe?1:0}function Koe(t){return t===2?"accent":t===1?"accentMid":"accentDim"}function Yoe(){let t=Math.max(Sl.length,Pd.length),e=[];for(let o=0;o<t;o+=1)e.push(`${Sl[o]??""}${Boe}${Pd[o]??""}`);return e}function Pj(t,e=!0){let o=Yoe(),n=o.length,r=o.reduce((l,c)=>Math.max(l,c.length),0),s=(l,c)=>(o[l]?.[c]??" ")===Lj,i=l=>e?Koe(zoe(l,t,r)):"accent",a=[];for(let l=0;l<n+1;l+=1){let c=[];for(let u=0;u<r+1;u+=1)s(l,u)?c.push({role:i(u),char:Lj}):s(l-1,u-1)?c.push({role:"accentDim",char:Uoe}):c.push({role:null,char:" "});a.push(c)}return a}function Fj(t){let e=[];for(let o of t){let n=e[e.length-1];n&&n.role===o.role?n.text+=o.char:e.push({role:o.role,text:o.char})}return e}var Lj,Boe,Uoe,joe,Hoe,qoe,Woe,Ij=p(()=>{"use strict";Ki();Lj="\u2588",Boe=" ",Uoe="\u2592",joe=3,Hoe=1,qoe=4,Woe=8});function Voe(t,e=6){if(sC.length===0)return 0;let o=Number.isFinite(t)&&t>0?Math.floor(t):0,n=e>=1?Math.floor(e):1;return Math.floor(o/n)%sC.length}function Nj(t,e=6){return sC[Voe(t,e)]??""}var sC,$j=p(()=>{"use strict";sC=["aquecendo os neur\xF4nios","convencendo os el\xE9trons","alinhando os pixels","domando os bits","fazendo um cafezinho","acordando os hamsters","consultando os astros","embaralhando as ideias","afiando os l\xE1pis","respirando fundo","contando at\xE9 dez","calibrando o bom humor","procurando as chaves","desenrolando o fio","ajeitando as almofadas","apertando os parafusos"]});import"react";import{Box as Do,Text as Bj}from"ink";import{jsx as at,jsxs as zl}from"react/jsx-runtime";function Joe(t){let e=(t%iC+iC)%iC;return".".repeat(e)}function Uj(t){let e=Q(),o=t.columns,n=t.rows,r=t.frame??0,s=t.status??"carregando",i=t.tagline??Xoe,l=e.animate&&e.unicode&&o>=Fd?at(ene,{frame:r}):at(ns,{columns:o});return t.prompt!==void 0?zl(Do,{width:o,height:n,flexDirection:"column",alignItems:"center",justifyContent:"center",children:[l,at(Do,{paddingTop:1,children:at(one,{prompt:t.prompt,columns:o})})]}):zl(Do,{width:o,height:n,flexDirection:"column",alignItems:"center",justifyContent:"center",children:[l,at(Do,{paddingTop:1,children:at(Qoe,{text:i})}),at(Do,{paddingTop:1,children:at(tne,{status:s,frame:r})}),t.version!==void 0&&t.version!==""&&at(Do,{paddingTop:1,children:at(Zoe,{version:t.version})})]})}function Qoe(t){return at(Do,{children:at(f,{name:"accentDim",children:t.text})})}function Zoe(t){return zl(Do,{children:[at(f,{name:"fgDim",children:"Aluy CLI \xB7 "}),zl(f,{name:"depth",children:["v",t.version]})]})}function ene(t){let e=Q(),o=Pj(t.frame,e.animate);return at(Do,{flexDirection:"column",children:o.map((n,r)=>at(Do,{children:Fj(n).map((s,i)=>s.role===null?at(Bj,{children:s.text},i):at(f,{name:s.role,children:s.text},i))},r))})}function tne(t){let e=Q(),o=e.animate?Joe(t.frame):e.unicode?"\u2026":"...",n=t.status==="carregando"?Nj(e.animate?t.frame:0):t.status;return at(Do,{children:zl(f,{name:"fgDim",children:[n,o]})})}function one(t){let o=Q().role("accent").color,n=Math.max(Fd,Math.min(t.columns-6,56));return zl(Do,{flexDirection:"column",borderStyle:"round",...o!==void 0?{borderColor:o}:{},paddingX:2,paddingY:0,width:n,children:[at(Do,{paddingBottom:1,children:at(f,{name:"accent",children:t.prompt.title})}),t.prompt.body.map((r,s)=>at(Do,{children:at(Bj,{children:r})},s)),at(Do,{paddingTop:1,children:at(f,{name:"fgDim",children:t.prompt.options})})]})}var iC,Xoe,jj=p(()=>{"use strict";te();Ki();Ij();$j();iC=4,Xoe="agente de terminal"});function Kl(t,e){e&&t.write("\x1B[2J\x1B[3J\x1B[H")}var aC=p(()=>{"use strict"});import{useEffect as nne,useSyncExternalStore as qj}from"react";import{render as rne,useApp as sne,useInput as ine}from"ink";import{Fragment as fne,jsx as Fm}from"react/jsx-runtime";function Wj(t=process.env){let e=t.ALUY_SPLASH_MIN_MS;if(e!==void 0){let o=Number.parseInt(e,10);if(Number.isFinite(o)&&o>=0)return o}return 2e3}function lne(t){let o=t.trim().replace(/\s*\[[sSnNyY/]+\]\s*$/u,"").trim(),n=o.toLowerCase();return n.includes("yolo")?{title:"\u26A0 modo YOLO",body:lC(o),options:"[s] entrar em YOLO \xB7 [n] seguir normal"}:n.includes("retomar")?{title:"\u21BB retomar sess\xE3o",body:lC(o),options:"[s] retomar \xB7 [n] nova sess\xE3o"}:{title:"aluy",body:lC(o),options:"[s] sim \xB7 [n] n\xE3o"}}function lC(t){let e=t.split(`
703
+ `,s}var wj=p(()=>{"use strict";P()});function nC(t,e){return e!==void 0&&e.trim()!==""?!0:t.some(o=>o.kind==="you"||o.kind==="aluy")}function Ej(t,e){if(!nC(e.blocks,e.label))return!1;try{return t.save(e)}catch{return!1}}function Poe(t){let e=new Date(t),o=n=>String(n).padStart(2,"0");return`${e.getFullYear()}-${o(e.getMonth()+1)}-${o(e.getDate())} ${o(e.getHours())}:${o(e.getMinutes())}`}function Foe(t){let e=Math.max(0,Math.floor(t/1e3));if(e<60)return"h\xE1 instantes";let o=Math.floor(e/60);if(o<60)return`h\xE1 ${o} min`;let n=Math.floor(o/60);return n<24?`h\xE1 ${n} h`:`h\xE1 ${Math.floor(n/24)} d`}function Aj(t,e){return`\u21BB retomar a conversa anterior (${t} ${t===1?"mensagem":"mensagens"}, ${Foe(e)})? [S/n] `}function Cj(t){if(t.length===0)return["nenhuma sess\xE3o salva ainda."];let e=["sess\xF5es salvas (retome com: aluy --resume <id>):",""];for(let o of t){let n=o.title??"(sem objetivo)";e.push(` ${o.id}`),e.push(` ${Poe(o.updatedAt)} \xB7 ${o.cwd} \xB7 ${o.blockCount} blocos`),e.push(` ${n}`)}return e}var rC=p(()=>{"use strict"});function Pm(t,e=Tj){let o=t.tier.trim();if(o!=="custom")return{tier:o};let n=t.model?.trim();if(n!==void 0&&n!==""){let r=t.provider?.trim();return{tier:"custom",model:n,...r!==void 0&&r!==""?{provider:r}:{}}}return{tier:e,warning:`sess\xE3o Custom anterior sem o modelo salvo \u2014 retomada no tier ${e}. Use /model p/ reescolher o modelo Custom.`}}function Dj(t,e=Tj){return Pm({tier:t.tier??"",...t.model!==void 0?{model:t.model}:{},...t.provider!==void 0?{provider:t.provider}:{}},e)}function Ioe(t,e,o){if(t===void 0)return{kind:"none"};if(t.kind==="continue"){let r=e.latestForCwd(o);if(r&&Rj(r.blocks)>0)return{kind:"resumed",record:r};for(let s of e.list()){if(s.cwd!==o||s.title===void 0)continue;let i=e.load(s.id);if(i)return{kind:"resumed",record:i}}return{kind:"none"}}if(t.id!==void 0&&t.id.trim()!==""){let r=t.id.trim(),s=e.load(r);if(s)return{kind:"resumed",record:s};let i=r.toLowerCase(),a=e.list().filter(l=>(l.label??"").trim().toLowerCase()===i);if(a.length===1){let l=e.load(a[0].id);if(l)return{kind:"resumed",record:l}}return a.length>1?{kind:"pick",choices:a}:{kind:"not-found",requestedId:r}}let n=e.list().filter(r=>r.title!==void 0||r.label!==void 0);return n.length>0?{kind:"pick",choices:n}:{kind:"none"}}function Noe(t){let e=0;for(let o of t)(o.kind==="you"||o.kind==="aluy")&&(e+=1);return e}function Rj(t){let e=0;for(let o of t)o.kind==="you"&&(e+=1);return e}function $oe(t,e,o,n,r=Date.now(),s=_j){if(t!==void 0||e)return{kind:"explicit"};let i=o.latestForCwd(n);if(!i)return{kind:"none"};let a=Math.max(0,r-i.updatedAt);if(a>s)return{kind:"none"};let l=Noe(i.blocks);return l===0?{kind:"none"}:Rj(i.blocks)===0?{kind:"none"}:{kind:"offer",record:i,ageMs:a,messageCount:l}}async function Oj(t){let e=Ioe(t.request,t.store,t.cwd);if(e.kind!=="none"||!t.isTty)return e;let o=$oe(t.request,t.fresh,t.store,t.cwd,t.now??Date.now(),t.windowMs??_j);if(o.kind!=="offer")return{kind:"none"};let n=!1;try{n=await t.promptYesNo(Aj(o.messageCount,o.ageMs))}catch{n=!1}return n?{kind:"resumed",record:o.record}:{kind:"none"}}var Tj,_j,Mj=p(()=>{"use strict";rC();Tj="aluy-flux";_j=1440*60*1e3});function Goe(t,e){let n=Math.max(1,Math.trunc(e))+Woe;return((Number.isFinite(t)?Math.trunc(t):0)*joe%n+n)%n}function zoe(t,e,o){let n=Goe(e,o),r=Number.isFinite(t)?Math.trunc(t):0,s=Math.abs(r-n);return s<=Hoe?2:s<=qoe?1:0}function Koe(t){return t===2?"accent":t===1?"accentMid":"accentDim"}function Yoe(){let t=Math.max(Sl.length,Pd.length),e=[];for(let o=0;o<t;o+=1)e.push(`${Sl[o]??""}${Boe}${Pd[o]??""}`);return e}function Pj(t,e=!0){let o=Yoe(),n=o.length,r=o.reduce((l,c)=>Math.max(l,c.length),0),s=(l,c)=>(o[l]?.[c]??" ")===Lj,i=l=>e?Koe(zoe(l,t,r)):"accent",a=[];for(let l=0;l<n+1;l+=1){let c=[];for(let u=0;u<r+1;u+=1)s(l,u)?c.push({role:i(u),char:Lj}):s(l-1,u-1)?c.push({role:"depth",char:Uoe}):c.push({role:null,char:" "});a.push(c)}return a}function Fj(t){let e=[];for(let o of t){let n=e[e.length-1];n&&n.role===o.role?n.text+=o.char:e.push({role:o.role,text:o.char})}return e}var Lj,Boe,Uoe,joe,Hoe,qoe,Woe,Ij=p(()=>{"use strict";Ki();Lj="\u2588",Boe=" ",Uoe="\u2592",joe=3,Hoe=1,qoe=4,Woe=8});function Voe(t,e=6){if(sC.length===0)return 0;let o=Number.isFinite(t)&&t>0?Math.floor(t):0,n=e>=1?Math.floor(e):1;return Math.floor(o/n)%sC.length}function Nj(t,e=6){return sC[Voe(t,e)]??""}var sC,$j=p(()=>{"use strict";sC=["aquecendo os neur\xF4nios","convencendo os el\xE9trons","alinhando os pixels","domando os bits","fazendo um cafezinho","acordando os hamsters","consultando os astros","embaralhando as ideias","afiando os l\xE1pis","respirando fundo","contando at\xE9 dez","calibrando o bom humor","procurando as chaves","desenrolando o fio","ajeitando as almofadas","apertando os parafusos"]});import"react";import{Box as Do,Text as Bj}from"ink";import{jsx as at,jsxs as zl}from"react/jsx-runtime";function Joe(t){let e=(t%iC+iC)%iC;return".".repeat(e)}function Uj(t){let e=Q(),o=t.columns,n=t.rows,r=t.frame??0,s=t.status??"carregando",i=t.tagline??Xoe,l=e.animate&&e.unicode&&o>=Fd?at(ene,{frame:r}):at(ns,{columns:o});return t.prompt!==void 0?zl(Do,{width:o,height:n,flexDirection:"column",alignItems:"center",justifyContent:"center",children:[l,at(Do,{paddingTop:1,children:at(one,{prompt:t.prompt,columns:o})})]}):zl(Do,{width:o,height:n,flexDirection:"column",alignItems:"center",justifyContent:"center",children:[l,at(Do,{paddingTop:1,children:at(Qoe,{text:i})}),at(Do,{paddingTop:1,children:at(tne,{status:s,frame:r})}),t.version!==void 0&&t.version!==""&&at(Do,{paddingTop:1,children:at(Zoe,{version:t.version})})]})}function Qoe(t){return at(Do,{children:at(f,{name:"accentDim",children:t.text})})}function Zoe(t){return zl(Do,{children:[at(f,{name:"fgDim",children:"Aluy CLI \xB7 "}),zl(f,{name:"depth",children:["v",t.version]})]})}function ene(t){let e=Q(),o=Pj(t.frame,e.animate);return at(Do,{flexDirection:"column",children:o.map((n,r)=>at(Do,{children:Fj(n).map((s,i)=>s.role===null?at(Bj,{children:s.text},i):at(f,{name:s.role,children:s.text},i))},r))})}function tne(t){let e=Q(),o=e.animate?Joe(t.frame):e.unicode?"\u2026":"...",n=t.status==="carregando"?Nj(e.animate?t.frame:0):t.status;return at(Do,{children:zl(f,{name:"fgDim",children:[n,o]})})}function one(t){let o=Q().role("accent").color,n=Math.max(Fd,Math.min(t.columns-6,56));return zl(Do,{flexDirection:"column",borderStyle:"round",...o!==void 0?{borderColor:o}:{},paddingX:2,paddingY:0,width:n,children:[at(Do,{paddingBottom:1,children:at(f,{name:"accent",children:t.prompt.title})}),t.prompt.body.map((r,s)=>at(Do,{children:at(Bj,{children:r})},s)),at(Do,{paddingTop:1,children:at(f,{name:"fgDim",children:t.prompt.options})})]})}var iC,Xoe,jj=p(()=>{"use strict";te();Ki();Ij();$j();iC=4,Xoe="agente de terminal"});function Kl(t,e){e&&t.write("\x1B[2J\x1B[3J\x1B[H")}var aC=p(()=>{"use strict"});import{useEffect as nne,useSyncExternalStore as qj}from"react";import{render as rne,useApp as sne,useInput as ine}from"ink";import{Fragment as fne,jsx as Fm}from"react/jsx-runtime";function Wj(t=process.env){let e=t.ALUY_SPLASH_MIN_MS;if(e!==void 0){let o=Number.parseInt(e,10);if(Number.isFinite(o)&&o>=0)return o}return 2e3}function lne(t){let o=t.trim().replace(/\s*\[[sSnNyY/]+\]\s*$/u,"").trim(),n=o.toLowerCase();return n.includes("yolo")?{title:"\u26A0 modo YOLO",body:lC(o),options:"[s] entrar em YOLO \xB7 [n] seguir normal"}:n.includes("retomar")?{title:"\u21BB retomar sess\xE3o",body:lC(o),options:"[s] retomar \xB7 [n] nova sess\xE3o"}:{title:"aluy",body:lC(o),options:"[s] sim \xB7 [n] n\xE3o"}}function lC(t){let e=t.split(`
704
704
  `).map(o=>o.trimEnd());for(;e.length>1&&e[e.length-1]==="";)e.pop();return e}function Gj(t){let e=cne(),o=rne(Fm(zi,{theme:t.theme,children:Fm(une,{store:e})}),{stdout:t.stdout,exitOnCtrlC:!1});return new cC(e,o,t.stdout)}function cne(){let t={status:"carregando",prompt:void 0,resolve:null,done:!1},e=new Set;return{get:()=>t,set:o=>{t=o(t);for(let n of e)n()},subscribe:o=>(e.add(o),()=>e.delete(o))}}function une(t){let e=qj(t.store.subscribe,t.store.get,t.store.get),{exit:o}=sne(),n=e.prompt===void 0&&!e.done,r=xm({enabled:n,intervalMs:ane});return ine((s,i)=>{let a=t.store.get().resolve;if(!a)return;if(i.return)return a(!0);let l=s.toLowerCase();if(l==="s"||l==="y")return a(!0);if(l==="n"||i.escape||i.ctrl&&l==="c")return a(!1)}),nne(()=>{e.done&&o()},[e.done,o]),e.done?null:Fm(mne,{status:e.status,frame:r,...e.prompt!==void 0?{prompt:e.prompt}:{}})}function dne(t){return process.stdout.on("resize",t),()=>{process.stdout.off("resize",t)}}function Hj(){return`${process.stdout.columns??80}x${process.stdout.rows??24}`}function mne(t){let e=qj(dne,Hj,Hj),[o,n]=e.split("x"),r=Number(o)||80,s=Number(n)||24;return Fm(Uj,{columns:r,rows:s,status:t.status,frame:t.frame,version:dn,...t.prompt!==void 0?{prompt:t.prompt}:{}})}var ane,cC,zj=p(()=>{"use strict";te();CA();jj();aC();rl();ane=320;cC=class{constructor(e,o,n){this.store=e;this.instance=o;this.stdout=n}store;instance;stdout;setStatus(e){this.store.set(o=>({...o,status:e}))}promptYesNo=e=>new Promise(o=>{let n=lne(e),r=s=>{this.store.set(i=>({...i,prompt:void 0,resolve:null})),o(s)};this.store.set(s=>({...s,prompt:n,resolve:r}))});async finish(){this.store.set(e=>({...e,done:!0,prompt:void 0,resolve:null})),this.instance.rerender(Fm(fne,{})),this.instance.clear(),this.instance.unmount(),await new Promise(e=>setTimeout(e,50)),Kl(this.stdout,!0)}}});function Kj(t){if(t.isTTY!==!0||typeof t.resume!="function")return!1;try{return t.resume(),!0}catch{return!1}}var Yj=p(()=>{"use strict"});function hne(t){let e=t.lastIndexOf("\x1B");if(e===-1)return 0;let o=t.slice(e);if(o==="\x1B")return 1;if(o[1]!=="[")return 0;for(let n=2;n<o.length;n+=1){let r=o[n];if(!(r>="0"&&r<="9")&&!(r===";"||r===":"))return 0}return o.length}function gne(){let t="";return{feed:o=>{let n=t+o;t="",n=n.replace(pne,"");let r=hne(n);return r>0&&(t=n.slice(n.length-r),n=n.slice(0,n.length-r)),n},hasPending:()=>t!=="",takePending:()=>{let o=t;return t="",o}}}function Vj(t){let e=t;if(typeof e.read!="function")return()=>{};if(e[uC])return()=>{};let o=e.read,n=gne(),r="",s,i=()=>{s!==void 0&&(clearTimeout(s),s=void 0),n.hasPending()&&(s=setTimeout(()=>{s=void 0,r+=n.takePending(),e.emit?.("readable")},yne),s.unref?.())},a=function(l){let c=l===void 0?o.call(this):o.call(this,l),u=r;if(r="",c==null)return u!==""?u:c;let m=typeof c=="string"?c:String(c),d=u+n.feed(m);return i(),d};return e.read=a,e[uC]=!0,()=>{e.read===a&&(s!==void 0&&(clearTimeout(s),s=void 0),e.read=o,e[uC]=!1)}}var pne,yne,uC,Xj=p(()=>{"use strict";pne=new RegExp("\x1B\\[[0-9;:]*u","g");yne=75,uC=Symbol.for("aluy.csiUGuard.wrapped")});function bne(){return["---","name: exemplo","description: Agente de exemplo \u2014 revisa arquivos e sugere melhorias.","tools: read_file, grep","---","Voc\xEA \xE9 um revisor de c\xF3digo amig\xE1vel. Leia os arquivos indicados e aponte","melhorias de legibilidade, performance e seguran\xE7a. Seja conciso e objetivo.","N\xE3o invente problemas \u2014 aponte s\xF3 o que realmente pode melhorar.",""].join(`
705
705
  `)}function vne(){return["---","name: exemplo","description: Workflow de exemplo \u2014 analisa e melhora um arquivo.","---","1. analisar \u2014 Leia o arquivo alvo e identifique problemas de c\xF3digo, performance e seguran\xE7a.","2. melhorar \u2014 Corrija os problemas encontrados, um de cada vez.","3. verificar \u2014 Rode os testes e confirme que nada quebrou.",""].join(`
706
706
  `)}function kne(){return["---","summary: Analisa um arquivo e sugere melhorias de c\xF3digo.","---","Analise o arquivo $ARGUMENTS e sugira melhorias de legibilidade, performance e seguran\xE7a.","Seja conciso \u2014 foque no que realmente importa.",""].join(`
@@ -1,4 +1,4 @@
1
- var cN=Object.create;var Hp=Object.defineProperty;var uN=Object.getOwnPropertyDescriptor;var dN=Object.getOwnPropertyNames;var mN=Object.getPrototypeOf,fN=Object.prototype.hasOwnProperty;var w=(t,e,o)=>()=>{if(o)throw o[0];try{return t&&(e=t(t=0)),e}catch(n){throw o=[n],n}};var pN=(t,e)=>()=>{try{return e||t((e={exports:{}}).exports,e),e.exports}catch(o){throw e=0,o}},qp=(t,e)=>{for(var o in e)Hp(t,o,{get:e[o],enumerable:!0})},hN=(t,e,o,n)=>{if(e&&typeof e=="object"||typeof e=="function")for(let r of dN(e))!fN.call(t,r)&&r!==o&&Hp(t,r,{get:()=>e[r],enumerable:!(n=uN(e,r))||n.enumerable});return t};var gN=(t,e,o)=>(o=t!=null?cN(mN(t)):{},hN(e||!t||!t.__esModule?Hp(o,"default",{value:t,enumerable:!0}):o,t));var Ka,eE=w(()=>{"use strict";Ka="1.0.0-rc.95"});function Xn(t,e){return t.decide(e)}var ys=w(()=>{"use strict"});var En,Jn,Qn=w(()=>{"use strict";En="remember",Jn="recall"});var Wp,yN,wi,Gp=w(()=>{"use strict";Wp=class{id;horizon;label;parentId;children;dependencies;pinned;closed;createdAt;lastAccessedAt;accessCount;context;constructor(e,o,n,r,s){this.id=e,this.horizon=o,this.label=n,this.parentId=r,this.children=new Set,this.dependencies=new Set,this.pinned=!1,this.closed=!1,this.createdAt=s,this.lastAccessedAt=s,this.accessCount=0,this.context=[]}touch(e){this.lastAccessedAt=e,this.accessCount+=1}snapshot(){return{id:this.id,horizon:this.horizon,label:this.label,parentId:this.parentId,children:[...this.children],dependencies:[...this.dependencies],pinned:this.pinned,closed:this.closed,createdAt:this.createdAt,lastAccessedAt:this.lastAccessedAt,accessCount:this.accessCount,contextSize:this.context.length}}},yN=200,wi=class{nodes=new Map;maxBoxes;now;constructor(e){this.maxBoxes=e?.maxBoxes??yN,this.now=e?.clock??Date.now}static boxId(e,o){return`${e.toLowerCase().replace(/[^a-z0-9]+/g,"-").replace(/^-|-$/g,"").slice(0,60)}-${o.toString(36)}`}openBox(e,o,n,r){let s=this.nodes.get(e);if(s)return s.touch(this.now()),{box:s.snapshot(),created:!1};if(this.nodes.size>=this.maxBoxes&&(this.evictOne(),this.nodes.size>=this.maxBoxes))return null;let i=this.now(),a=new Wp(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 rd(t){let e=[];for(let o of t){e.push({step:o,depth:0});for(let n of o.substeps??[])e.push({step:n,depth:1})}return e}function nE(t,e){let o,n="pending",r;if(typeof t=="string")o=t;else if(t!==null&&typeof t=="object"){let i=t,a=i.title??i.step??i.text??i.name??i.content;if(typeof a=="string"&&(o=a),typeof i.status=="string"&&bN.has(i.status)&&(n=i.status),e){let 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=nE(u,!1);if(typeof m=="string")return m;c.push(m)}r=c}}}if(o===void 0||o.trim()==="")return kN;let s=o.trim().slice(0,vN);return r?{title:s,status:n,substeps:r}:{title:s,status:n}}function xN(t){let e=t.steps??t.plan??t.todos??t.items;if(!Array.isArray(e))return{error:'update_plan: passe "steps" como uma LISTA de passos (string ou {title,status}).'};if(e.length===0)return{error:"update_plan: a lista de passos est\xE1 vazia."};let o=[];for(let i of e){let a=nE(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=rd(o).length;return s>tE?{error:`update_plan: no m\xE1ximo ${tE} passos (recebidos ${s}).`}:{steps:o}}function SN(t){let e=rd(t),o=e.filter(r=>r.step.status==="completed").length,n=e.map(r=>`${" ".repeat(r.depth)}${rE[r.step.status]} ${r.step.title}`).join(`
1
+ var cN=Object.create;var Hp=Object.defineProperty;var uN=Object.getOwnPropertyDescriptor;var dN=Object.getOwnPropertyNames;var mN=Object.getPrototypeOf,fN=Object.prototype.hasOwnProperty;var w=(t,e,o)=>()=>{if(o)throw o[0];try{return t&&(e=t(t=0)),e}catch(n){throw o=[n],n}};var pN=(t,e)=>()=>{try{return e||t((e={exports:{}}).exports,e),e.exports}catch(o){throw e=0,o}},qp=(t,e)=>{for(var o in e)Hp(t,o,{get:e[o],enumerable:!0})},hN=(t,e,o,n)=>{if(e&&typeof e=="object"||typeof e=="function")for(let r of dN(e))!fN.call(t,r)&&r!==o&&Hp(t,r,{get:()=>e[r],enumerable:!(n=uN(e,r))||n.enumerable});return t};var gN=(t,e,o)=>(o=t!=null?cN(mN(t)):{},hN(e||!t||!t.__esModule?Hp(o,"default",{value:t,enumerable:!0}):o,t));var Ka,eE=w(()=>{"use strict";Ka="1.0.0-rc.96"});function Xn(t,e){return t.decide(e)}var ys=w(()=>{"use strict"});var En,Jn,Qn=w(()=>{"use strict";En="remember",Jn="recall"});var Wp,yN,wi,Gp=w(()=>{"use strict";Wp=class{id;horizon;label;parentId;children;dependencies;pinned;closed;createdAt;lastAccessedAt;accessCount;context;constructor(e,o,n,r,s){this.id=e,this.horizon=o,this.label=n,this.parentId=r,this.children=new Set,this.dependencies=new Set,this.pinned=!1,this.closed=!1,this.createdAt=s,this.lastAccessedAt=s,this.accessCount=0,this.context=[]}touch(e){this.lastAccessedAt=e,this.accessCount+=1}snapshot(){return{id:this.id,horizon:this.horizon,label:this.label,parentId:this.parentId,children:[...this.children],dependencies:[...this.dependencies],pinned:this.pinned,closed:this.closed,createdAt:this.createdAt,lastAccessedAt:this.lastAccessedAt,accessCount:this.accessCount,contextSize:this.context.length}}},yN=200,wi=class{nodes=new Map;maxBoxes;now;constructor(e){this.maxBoxes=e?.maxBoxes??yN,this.now=e?.clock??Date.now}static boxId(e,o){return`${e.toLowerCase().replace(/[^a-z0-9]+/g,"-").replace(/^-|-$/g,"").slice(0,60)}-${o.toString(36)}`}openBox(e,o,n,r){let s=this.nodes.get(e);if(s)return s.touch(this.now()),{box:s.snapshot(),created:!1};if(this.nodes.size>=this.maxBoxes&&(this.evictOne(),this.nodes.size>=this.maxBoxes))return null;let i=this.now(),a=new Wp(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 rd(t){let e=[];for(let o of t){e.push({step:o,depth:0});for(let n of o.substeps??[])e.push({step:n,depth:1})}return e}function nE(t,e){let o,n="pending",r;if(typeof t=="string")o=t;else if(t!==null&&typeof t=="object"){let i=t,a=i.title??i.step??i.text??i.name??i.content;if(typeof a=="string"&&(o=a),typeof i.status=="string"&&bN.has(i.status)&&(n=i.status),e){let 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=nE(u,!1);if(typeof m=="string")return m;c.push(m)}r=c}}}if(o===void 0||o.trim()==="")return kN;let s=o.trim().slice(0,vN);return r?{title:s,status:n,substeps:r}:{title:s,status:n}}function xN(t){let e=t.steps??t.plan??t.todos??t.items;if(!Array.isArray(e))return{error:'update_plan: passe "steps" como uma LISTA de passos (string ou {title,status}).'};if(e.length===0)return{error:"update_plan: a lista de passos est\xE1 vazia."};let o=[];for(let i of e){let a=nE(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=rd(o).length;return s>tE?{error:`update_plan: no m\xE1ximo ${tE} passos (recebidos ${s}).`}:{steps:o}}function SN(t){let e=rd(t),o=e.filter(r=>r.step.status==="completed").length,n=e.map(r=>`${" ".repeat(r.depth)}${rE[r.step.status]} ${r.step.title}`).join(`
2
2
  `);return`plano (${o}/${e.length}):
3
3
  ${n}`}function wN(t,e){return e<0?"m\xE9dio":t===e?"curto":t>e?"longo":"m\xE9dio"}function AN(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??wi.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=wN(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 CN(t,e){if(!e)return SN(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 p=s(d.parentId,new Set(u).add(c))+1;return r.set(c,p),p},i=rd(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?EN[m.horizon]:"",p=m?s(m.id):u,h=" ".repeat(p),y=rE[c.status];l.push(`${h}${d} ${y} ${c.title}`)}return l.join(`
4
4
  `)}var Ya,bN,tE,vN,kN,rE,EN,oE,DN,sE,sd=w(()=>{"use strict";Gp();Ya="update_plan";bN=new Set(["pending","in_progress","completed"]),tE=30,vN=120,kN="update_plan: cada passo precisa de um t\xEDtulo (texto) n\xE3o-vazio.";rE={pending:"\u2610",in_progress:"\u25B6",completed:"\u2611"};EN={longo:"[\u{1F4D0}]",m\u00E9dio:"[\u{1F4CB}]",curto:"[\u{1F4CC}]"};oE=Object.freeze({type:"string",enum:["pending","in_progress","completed"],description:"pending (a fazer) \xB7 in_progress (em curso) \xB7 completed (feito)."}),DN=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:oE,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:oE},required:["title"],additionalProperties:!1}}},required:["title"],additionalProperties:!1}}},required:["steps"],additionalProperties:!1}),sE={name:Ya,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:DN,async run(t,e){let o=xN(t);return"error"in o?{ok:!1,observation:o.error}:(e.graph&&AN(o.steps,e.graph),e.plan&&e.plan.set(rd(o.steps).map(r=>({title:r.step.title,status:r.step.status}))),{ok:!0,observation:CN(o.steps,e.graph)})}}});function iE(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)?_N(s):void 0;if(typeof i=="string")return{error:i};let a,l=t.kind??t.type;if(typeof l=="string"&&TN.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 _N(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 RN(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 r0(t,e,o=lc){let{older:n,recent:r}=Cm(t,o);if(n.length===
137
137
  \u2026[truncado: ${t.length-Hb} chars omitidos]`}function b2(t){return t.length<=Wb?t:`${t.slice(0,Wb)}\u2026`}function H0(t){let e=j0(t.server,t.descriptor.name),o=b2(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:U0(u),display:`${e}(${v2(i)})`}:{ok:!1,observation:U0(`MCP "${e}" erro: ${u}`)}}catch(c){return{ok:!1,observation:`MCP "${e}" falhou: ${c instanceof Error?c.message:String(c)}`}}}}}function Gb(t,e){let o=[],n=new Set,r=new Map,s=new Map,i=new Set;for(let a of t){let l=H0(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>=qb){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 ${qb} (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 v2(t){if(Object.keys(t).length===0)return"";let o=JSON.stringify(t);return o.length<=200?o:`${o.slice(0,200)}\u2026`}var Hb,qb,Wb,q0=w(()=>{"use strict";ld();nr();Hb=2e4;qb=128,Wb=1024});function z0(t,e){let o=new URL(G0);return t.trim().length>0&&o.searchParams.set("search",t.trim()),o.searchParams.set("limit",String(x2)),e!==void 0&&e.length>0&&o.searchParams.set("cursor",e),o.toString()}async function Kb(t,e,o){let n=t.trim(),r=[],s;for(let i=0;i<k2;i++){let a=z0(n,s),l;try{l=await e(a,o)}catch(m){return{ok:!1,query:n,reason:Fm(D2(m))}}if(!l.ok)return{ok:!1,query:n,reason:Fm(l.reason)};if(l.status<200||l.status>=300)return{ok:!1,query:n,reason:Fm(`HTTP ${l.status}`)};let c;try{c=JSON.parse(l.body)}catch{return{ok:!1,query:n,reason:Fm("resposta n\xE3o \xE9 JSON v\xE1lido")}}let u=Y0(c);for(let m of u.servers)if(K0(m,n)&&r.push(m),r.length>=zb)break;if(r.length>=zb||(s=u.nextCursor,s===void 0||s.length===0))break}return{ok:!0,query:n,results:r}}function Fm(t){return`registro MCP indispon\xEDvel (${Zi}): ${t}`}function K0(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 Y0(t){if(!ar(t))return{servers:[]};let e=Array.isArray(t.servers)?t.servers:[],o=[];for(let s of e){let i=S2(s);i!==void 0&&o.push(i)}let n=ar(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 S2(t){if(!ar(t))return;let e=ar(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=E2(e);return{name:o,description:n,run:i,...r!==void 0?{title:r}:{},...s!==void 0?{version:s}:{}}}function E2(t){let e=[],o=Array.isArray(t.remotes)?t.remotes:[];for(let r of o)ar(r)&&typeof r.url=="string"&&e.push(r.url);let n=Array.isArray(t.packages)?t.packages:[];for(let r of n){if(!ar(r))continue;let s=w2(r);if(s!==void 0)return{...s,remoteUrls:e}}return{args:[],env:[],remoteUrls:e}}function w2(t){let e=Ns(t.registryType)??Ns(t.registry_name),o=Ns(t.identifier)??Ns(t.name);if(o===void 0)return;let n=Ns(t.version),r=Ns(t.runtimeHint),s=ar(t.transport)?Ns(t.transport.type):void 0,i=C2(t.environmentVariables),a=W0(t.runtimeArguments),l=W0(t.packageArguments),c=n!==void 0?`${o}@${n}`:o;return e==="npm"||r==="npx"?{command:"npx",args:A2(["-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 A2(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 W0(t){if(!Array.isArray(t))return[];let e=[];for(let o of t)ar(o)&&typeof o.value=="string"&&e.push(o.value);return e}function C2(t){if(!Array.isArray(t))return[];let e=[];for(let o of t)ar(o)&&typeof o.name=="string"&&o.name.length>0&&e.push({name:o.name,required:o.isRequired===!0});return e}function Ns(t){return typeof t=="string"&&t.trim().length>0?t.trim():void 0}function ar(t){return typeof t=="object"&&t!==null&&!Array.isArray(t)}function D2(t){return t instanceof Error?t.message:String(t)}var Zi,G0,k2,x2,zb,V0=w(()=>{"use strict";Zi="registry.modelcontextprotocol.io",G0=`https://${Zi}/v0/servers`,k2=5,x2=100,zb=25});function J0(t){let{command:e,args:o}=t.run;if(e===void 0)return;let n=Q0(t.name);return["aluy","mcp","add",X0(n),"--",e,...o.map(X0)].join(" ")}function Q0(t){let o=(t.split("/").pop()??t).replace(/[^A-Za-z0-9_-]+/g,"-").replace(/^-+|-+$/g,"");return o.length>0?o:"server"}function X0(t){return/^[A-Za-z0-9_./@:+=-]+$/.test(t)?t:`'${t.replace(/'/g,"'\\''")}'`}function Yb(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(T2(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 T2(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(` ${_2(t.description,200)}`);let r=J0(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 _2(t,e){return t.length<=e?t:t.slice(0,e-1).trimEnd()+"\u2026"}var Z0=w(()=>{"use strict"});var eT=w(()=>{"use strict";Pm();P0();F0();I0();N0();B0();q0();ld();V0();Z0()});function Vb(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 tT(t,e){let o=Vb(t),n=Vb(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 Xb(t,e){return tT(t,e)===1}var oT=w(()=>{"use strict"});function Im(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 Jb=w(()=>{"use strict"});function Qb(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 Zb(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 gc,nT=w(()=>{"use strict";Jb();gc={id:"telegram",displayName:"Telegram",authIsForgeable:!1}});function ev(t){return typeof t=="number"&&Number.isFinite(t)?t:void 0}function ea(t){return typeof t=="object"&&t!==null?t:void 0}function tv(t,e){let o=ea(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=ea(s);if(!i)continue;let a=ev(i.update_id);a!==void 0&&a>r&&(r=a);let l=ea(i.message);if(!l)continue;let c=ea(l.chat),u=ev(c?.id);if(u===void 0||c?.type!=="private")continue;let m=ea(l.from),d=ev(m?.id)??u,p=m?.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=ea(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 rT=w(()=>{"use strict"});var yc,sT=w(()=>{"use strict";yc=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 ov(t){return`connector-${t}-token`}function bc(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 nv(t,e){let o=e.trim();return o.length<8?t:t.split(o).join("\xABREDACTED\xBB")}var iT=w(()=>{"use strict"});var B=w(()=>{"use strict";eE();EE();FE();eA();E0();Qy();O0();eT();_b();dm();oT();Jb();nT();rT();sT();iT()});import{posix as V8}from"node:path";function X8(t){return V8.normalize(t)}function mo(t){let e=X8(t);for(let o of J8)if(o.re.test(e))return o.deny?{kind:"deny",why:o.why}:{kind:"ask",why:o.why};return{kind:"allow"}}function xv(t){return mo(t).kind==="allow"}var J8,Gr=w(()=>{"use strict";J8=[{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 qv={};qp(qv,{UserWorkflowsLoader:()=>Vr,WORKFLOWS_DIRNAME:()=>Hv});import{homedir as I3}from"node:os";import{join as jv}from"node:path";import{readdirSync as N3,readFileSync as $3,mkdirSync as B3,statSync as U3}from"node:fs";var j3,Hv,H3,q3,Vr,of=w(()=>{"use strict";B();j3=448,Hv="workflows",H3=64*1024,q3=256,Vr=class{dir;constructor(e={}){let o=e.baseDir??jv(I3(),".aluy");this.dir=jv(o,Hv)}get workflowsDir(){return this.dir}ensureDir(){try{B3(this.dir,{mode:j3,recursive:!0})}catch{}}load(){let e;try{e=N3(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>=q3)break;let a=this.readOne(i);if(a!==null){if(Yl(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=jv(this.dir,e);try{let n=U3(o);if(!n.isFile()||n.size>H3)return null;let r=$3(o,"utf8");return Vl(e,r,"global")}catch{return null}}}});var Gv={};qp(Gv,{PROJECT_WORKFLOWS_DIRNAMES:()=>Wv,ProjectWorkflowsLoader:()=>Xr});import{join as W3}from"node:path";import{readdirSync as G3,readFileSync as z3,statSync as K3}from"node:fs";var Wv,Y3,V3,Xr,nf=w(()=>{"use strict";B();Gr();Wv=[".claude/workflows",".aluy/workflows"],Y3=64*1024,V3=256,Xr=class{workspace;constructor(e){this.workspace=e.workspace}load(){let e=new Set,o=[],n=[];for(let r of Wv){let s;try{s=this.workspace.resolveInside(r)}catch{continue}let i;try{i=G3(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>=V3)break;let c=this.readOne(r,s,l);if(c!==null){if(Yl(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(mo(r).kind!=="allow")return null;let s=W3(o,n);try{this.workspace.resolveInside(r);let i=K3(s);if(!i.isFile()||i.size>Y3)return null;let a=z3(s,"utf8");return Vl(n,a,"project")}catch{return null}}}});var YM=pN((Yye,KM)=>{KM.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 Zo="1.0.0-rc.95";B();var aT=`aluy \u2014 agente de terminal que roda na sua m\xE1quina, com o seu provider de LLM
140
+ `)}function _2(t,e){return t.length<=e?t:t.slice(0,e-1).trimEnd()+"\u2026"}var Z0=w(()=>{"use strict"});var eT=w(()=>{"use strict";Pm();P0();F0();I0();N0();B0();q0();ld();V0();Z0()});function Vb(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 tT(t,e){let o=Vb(t),n=Vb(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 Xb(t,e){return tT(t,e)===1}var oT=w(()=>{"use strict"});function Im(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 Jb=w(()=>{"use strict"});function Qb(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 Zb(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 gc,nT=w(()=>{"use strict";Jb();gc={id:"telegram",displayName:"Telegram",authIsForgeable:!1}});function ev(t){return typeof t=="number"&&Number.isFinite(t)?t:void 0}function ea(t){return typeof t=="object"&&t!==null?t:void 0}function tv(t,e){let o=ea(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=ea(s);if(!i)continue;let a=ev(i.update_id);a!==void 0&&a>r&&(r=a);let l=ea(i.message);if(!l)continue;let c=ea(l.chat),u=ev(c?.id);if(u===void 0||c?.type!=="private")continue;let m=ea(l.from),d=ev(m?.id)??u,p=m?.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=ea(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 rT=w(()=>{"use strict"});var yc,sT=w(()=>{"use strict";yc=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 ov(t){return`connector-${t}-token`}function bc(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 nv(t,e){let o=e.trim();return o.length<8?t:t.split(o).join("\xABREDACTED\xBB")}var iT=w(()=>{"use strict"});var B=w(()=>{"use strict";eE();EE();FE();eA();E0();Qy();O0();eT();_b();dm();oT();Jb();nT();rT();sT();iT()});import{posix as V8}from"node:path";function X8(t){return V8.normalize(t)}function mo(t){let e=X8(t);for(let o of J8)if(o.re.test(e))return o.deny?{kind:"deny",why:o.why}:{kind:"ask",why:o.why};return{kind:"allow"}}function xv(t){return mo(t).kind==="allow"}var J8,Gr=w(()=>{"use strict";J8=[{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 qv={};qp(qv,{UserWorkflowsLoader:()=>Vr,WORKFLOWS_DIRNAME:()=>Hv});import{homedir as I3}from"node:os";import{join as jv}from"node:path";import{readdirSync as N3,readFileSync as $3,mkdirSync as B3,statSync as U3}from"node:fs";var j3,Hv,H3,q3,Vr,of=w(()=>{"use strict";B();j3=448,Hv="workflows",H3=64*1024,q3=256,Vr=class{dir;constructor(e={}){let o=e.baseDir??jv(I3(),".aluy");this.dir=jv(o,Hv)}get workflowsDir(){return this.dir}ensureDir(){try{B3(this.dir,{mode:j3,recursive:!0})}catch{}}load(){let e;try{e=N3(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>=q3)break;let a=this.readOne(i);if(a!==null){if(Yl(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=jv(this.dir,e);try{let n=U3(o);if(!n.isFile()||n.size>H3)return null;let r=$3(o,"utf8");return Vl(e,r,"global")}catch{return null}}}});var Gv={};qp(Gv,{PROJECT_WORKFLOWS_DIRNAMES:()=>Wv,ProjectWorkflowsLoader:()=>Xr});import{join as W3}from"node:path";import{readdirSync as G3,readFileSync as z3,statSync as K3}from"node:fs";var Wv,Y3,V3,Xr,nf=w(()=>{"use strict";B();Gr();Wv=[".claude/workflows",".aluy/workflows"],Y3=64*1024,V3=256,Xr=class{workspace;constructor(e){this.workspace=e.workspace}load(){let e=new Set,o=[],n=[];for(let r of Wv){let s;try{s=this.workspace.resolveInside(r)}catch{continue}let i;try{i=G3(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>=V3)break;let c=this.readOne(r,s,l);if(c!==null){if(Yl(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(mo(r).kind!=="allow")return null;let s=W3(o,n);try{this.workspace.resolveInside(r);let i=K3(s);if(!i.isFile()||i.size>Y3)return null;let a=z3(s,"utf8");return Vl(n,a,"project")}catch{return null}}}});var YM=pN((Yye,KM)=>{KM.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 Zo="1.0.0-rc.96";B();var aT=`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>]
@@ -612,7 +612,7 @@ ${o[s]}`).join(`
612
612
  `);return s=s.replace(/\n{3,}/g,`
613
613
 
614
614
  `).replace(/\n+$/,"")+`
615
- `,s}function OS(t,e){return e!==void 0&&e.trim()!==""?!0:t.some(o=>o.kind==="you"||o.kind==="aluy")}function rI(t,e){if(!OS(e.blocks,e.label))return!1;try{return t.save(e)}catch{return!1}}function WK(t){let e=new Date(t),o=n=>String(n).padStart(2,"0");return`${e.getFullYear()}-${o(e.getMonth()+1)}-${o(e.getDate())} ${o(e.getHours())}:${o(e.getMinutes())}`}function GK(t){let e=Math.max(0,Math.floor(t/1e3));if(e<60)return"h\xE1 instantes";let o=Math.floor(e/60);if(o<60)return`h\xE1 ${o} min`;let n=Math.floor(o/60);return n<24?`h\xE1 ${n} h`:`h\xE1 ${Math.floor(n/24)} d`}function sI(t,e){return`\u21BB retomar a conversa anterior (${t} ${t===1?"mensagem":"mensagens"}, ${GK(e)})? [S/n] `}function iI(t){if(t.length===0)return["nenhuma sess\xE3o salva ainda."];let e=["sess\xF5es salvas (retome com: aluy --resume <id>):",""];for(let o of t){let n=o.title??"(sem objetivo)";e.push(` ${o.id}`),e.push(` ${WK(o.updatedAt)} \xB7 ${o.cwd} \xB7 ${o.blockCount} blocos`),e.push(` ${n}`)}return e}var aI="aluy-flux";function Xu(t,e=aI){let o=t.tier.trim();if(o!=="custom")return{tier:o};let n=t.model?.trim();if(n!==void 0&&n!==""){let r=t.provider?.trim();return{tier:"custom",model:n,...r!==void 0&&r!==""?{provider:r}:{}}}return{tier:e,warning:`sess\xE3o Custom anterior sem o modelo salvo \u2014 retomada no tier ${e}. Use /model p/ reescolher o modelo Custom.`}}function lI(t,e=aI){return Xu({tier:t.tier??"",...t.model!==void 0?{model:t.model}:{},...t.provider!==void 0?{provider:t.provider}:{}},e)}function zK(t,e,o){if(t===void 0)return{kind:"none"};if(t.kind==="continue"){let r=e.latestForCwd(o);if(r&&uI(r.blocks)>0)return{kind:"resumed",record:r};for(let s of e.list()){if(s.cwd!==o||s.title===void 0)continue;let i=e.load(s.id);if(i)return{kind:"resumed",record:i}}return{kind:"none"}}if(t.id!==void 0&&t.id.trim()!==""){let r=t.id.trim(),s=e.load(r);if(s)return{kind:"resumed",record:s};let i=r.toLowerCase(),a=e.list().filter(l=>(l.label??"").trim().toLowerCase()===i);if(a.length===1){let l=e.load(a[0].id);if(l)return{kind:"resumed",record:l}}return a.length>1?{kind:"pick",choices:a}:{kind:"not-found",requestedId:r}}let n=e.list().filter(r=>r.title!==void 0||r.label!==void 0);return n.length>0?{kind:"pick",choices:n}:{kind:"none"}}var cI=1440*60*1e3;function KK(t){let e=0;for(let o of t)(o.kind==="you"||o.kind==="aluy")&&(e+=1);return e}function uI(t){let e=0;for(let o of t)o.kind==="you"&&(e+=1);return e}function YK(t,e,o,n,r=Date.now(),s=cI){if(t!==void 0||e)return{kind:"explicit"};let i=o.latestForCwd(n);if(!i)return{kind:"none"};let a=Math.max(0,r-i.updatedAt);if(a>s)return{kind:"none"};let l=KK(i.blocks);return l===0?{kind:"none"}:uI(i.blocks)===0?{kind:"none"}:{kind:"offer",record:i,ageMs:a,messageCount:l}}async function dI(t){let e=zK(t.request,t.store,t.cwd);if(e.kind!=="none"||!t.isTty)return e;let o=YK(t.request,t.fresh,t.store,t.cwd,t.now??Date.now(),t.windowMs??cI);if(o.kind!=="offer")return{kind:"none"};let n=!1;try{n=await t.promptYesNo(sI(o.messageCount,o.ageMs))}catch{n=!1}return n?{kind:"resumed",record:o.record}:{kind:"none"}}import{useEffect as f5,useSyncExternalStore as vI}from"react";import{render as p5,useApp as h5,useInput as g5}from"ink";import"react";import{Box as so,Text as gI}from"ink";var mI="\u2588",VK=" ",XK="\u2592",JK=3,QK=1,ZK=4,e5=8;function t5(t,e){let n=Math.max(1,Math.trunc(e))+e5;return((Number.isFinite(t)?Math.trunc(t):0)*JK%n+n)%n}function o5(t,e,o){let n=t5(e,o),r=Number.isFinite(t)?Math.trunc(t):0,s=Math.abs(r-n);return s<=QK?2:s<=ZK?1:0}function n5(t){return t===2?"accent":t===1?"accentMid":"accentDim"}function r5(){let t=Math.max(da.length,nu.length),e=[];for(let o=0;o<t;o+=1)e.push(`${da[o]??""}${VK}${nu[o]??""}`);return e}function fI(t,e=!0){let o=r5(),n=o.length,r=o.reduce((l,c)=>Math.max(l,c.length),0),s=(l,c)=>(o[l]?.[c]??" ")===mI,i=l=>e?n5(o5(l,t,r)):"accent",a=[];for(let l=0;l<n+1;l+=1){let c=[];for(let u=0;u<r+1;u+=1)s(l,u)?c.push({role:i(u),char:mI}):s(l-1,u-1)?c.push({role:"accentDim",char:XK}):c.push({role:null,char:" "});a.push(c)}return a}function pI(t){let e=[];for(let o of t){let n=e[e.length-1];n&&n.role===o.role?n.text+=o.char:e.push({role:o.role,text:o.char})}return e}var MS=["aquecendo os neur\xF4nios","convencendo os el\xE9trons","alinhando os pixels","domando os bits","fazendo um cafezinho","acordando os hamsters","consultando os astros","embaralhando as ideias","afiando os l\xE1pis","respirando fundo","contando at\xE9 dez","calibrando o bom humor","procurando as chaves","desenrolando o fio","ajeitando as almofadas","apertando os parafusos"];function s5(t,e=6){if(MS.length===0)return 0;let o=Number.isFinite(t)&&t>0?Math.floor(t):0,n=e>=1?Math.floor(e):1;return Math.floor(o/n)%MS.length}function hI(t,e=6){return MS[s5(t,e)]??""}import{jsx as Ke,jsxs as Na}from"react/jsx-runtime";var LS=4,i5="agente de terminal";function a5(t){let e=(t%LS+LS)%LS;return".".repeat(e)}function yI(t){let e=z(),o=t.columns,n=t.rows,r=t.frame??0,s=t.status??"carregando",i=t.tagline??i5,l=e.animate&&e.unicode&&o>=ru?Ke(u5,{frame:r}):Ke(Xs,{columns:o});return t.prompt!==void 0?Na(so,{width:o,height:n,flexDirection:"column",alignItems:"center",justifyContent:"center",children:[l,Ke(so,{paddingTop:1,children:Ke(m5,{prompt:t.prompt,columns:o})})]}):Na(so,{width:o,height:n,flexDirection:"column",alignItems:"center",justifyContent:"center",children:[l,Ke(so,{paddingTop:1,children:Ke(l5,{text:i})}),Ke(so,{paddingTop:1,children:Ke(d5,{status:s,frame:r})}),t.version!==void 0&&t.version!==""&&Ke(so,{paddingTop:1,children:Ke(c5,{version:t.version})})]})}function l5(t){return Ke(so,{children:Ke(f,{name:"accentDim",children:t.text})})}function c5(t){return Na(so,{children:[Ke(f,{name:"fgDim",children:"Aluy CLI \xB7 "}),Na(f,{name:"depth",children:["v",t.version]})]})}function u5(t){let e=z(),o=fI(t.frame,e.animate);return Ke(so,{flexDirection:"column",children:o.map((n,r)=>Ke(so,{children:pI(n).map((s,i)=>s.role===null?Ke(gI,{children:s.text},i):Ke(f,{name:s.role,children:s.text},i))},r))})}function d5(t){let e=z(),o=e.animate?a5(t.frame):e.unicode?"\u2026":"...",n=t.status==="carregando"?hI(e.animate?t.frame:0):t.status;return Ke(so,{children:Na(f,{name:"fgDim",children:[n,o]})})}function m5(t){let o=z().role("accent").color,n=Math.max(ru,Math.min(t.columns-6,56));return Na(so,{flexDirection:"column",borderStyle:"round",...o!==void 0?{borderColor:o}:{},paddingX:2,paddingY:0,width:n,children:[Ke(so,{paddingBottom:1,children:Ke(f,{name:"accent",children:t.prompt.title})}),t.prompt.body.map((r,s)=>Ke(so,{children:Ke(gI,{children:r})},s)),Ke(so,{paddingTop:1,children:Ke(f,{name:"fgDim",children:t.prompt.options})})]})}function Ju(t,e){e&&t.write("\x1B[2J\x1B[3J\x1B[H")}import{Fragment as E5,jsx as Qu}from"react/jsx-runtime";var y5=320;function kI(t=process.env){let e=t.ALUY_SPLASH_MIN_MS;if(e!==void 0){let o=Number.parseInt(e,10);if(Number.isFinite(o)&&o>=0)return o}return 2e3}function b5(t){let o=t.trim().replace(/\s*\[[sSnNyY/]+\]\s*$/u,"").trim(),n=o.toLowerCase();return n.includes("yolo")?{title:"\u26A0 modo YOLO",body:PS(o),options:"[s] entrar em YOLO \xB7 [n] seguir normal"}:n.includes("retomar")?{title:"\u21BB retomar sess\xE3o",body:PS(o),options:"[s] retomar \xB7 [n] nova sess\xE3o"}:{title:"aluy",body:PS(o),options:"[s] sim \xB7 [n] n\xE3o"}}function PS(t){let e=t.split(`
615
+ `,s}function OS(t,e){return e!==void 0&&e.trim()!==""?!0:t.some(o=>o.kind==="you"||o.kind==="aluy")}function rI(t,e){if(!OS(e.blocks,e.label))return!1;try{return t.save(e)}catch{return!1}}function WK(t){let e=new Date(t),o=n=>String(n).padStart(2,"0");return`${e.getFullYear()}-${o(e.getMonth()+1)}-${o(e.getDate())} ${o(e.getHours())}:${o(e.getMinutes())}`}function GK(t){let e=Math.max(0,Math.floor(t/1e3));if(e<60)return"h\xE1 instantes";let o=Math.floor(e/60);if(o<60)return`h\xE1 ${o} min`;let n=Math.floor(o/60);return n<24?`h\xE1 ${n} h`:`h\xE1 ${Math.floor(n/24)} d`}function sI(t,e){return`\u21BB retomar a conversa anterior (${t} ${t===1?"mensagem":"mensagens"}, ${GK(e)})? [S/n] `}function iI(t){if(t.length===0)return["nenhuma sess\xE3o salva ainda."];let e=["sess\xF5es salvas (retome com: aluy --resume <id>):",""];for(let o of t){let n=o.title??"(sem objetivo)";e.push(` ${o.id}`),e.push(` ${WK(o.updatedAt)} \xB7 ${o.cwd} \xB7 ${o.blockCount} blocos`),e.push(` ${n}`)}return e}var aI="aluy-flux";function Xu(t,e=aI){let o=t.tier.trim();if(o!=="custom")return{tier:o};let n=t.model?.trim();if(n!==void 0&&n!==""){let r=t.provider?.trim();return{tier:"custom",model:n,...r!==void 0&&r!==""?{provider:r}:{}}}return{tier:e,warning:`sess\xE3o Custom anterior sem o modelo salvo \u2014 retomada no tier ${e}. Use /model p/ reescolher o modelo Custom.`}}function lI(t,e=aI){return Xu({tier:t.tier??"",...t.model!==void 0?{model:t.model}:{},...t.provider!==void 0?{provider:t.provider}:{}},e)}function zK(t,e,o){if(t===void 0)return{kind:"none"};if(t.kind==="continue"){let r=e.latestForCwd(o);if(r&&uI(r.blocks)>0)return{kind:"resumed",record:r};for(let s of e.list()){if(s.cwd!==o||s.title===void 0)continue;let i=e.load(s.id);if(i)return{kind:"resumed",record:i}}return{kind:"none"}}if(t.id!==void 0&&t.id.trim()!==""){let r=t.id.trim(),s=e.load(r);if(s)return{kind:"resumed",record:s};let i=r.toLowerCase(),a=e.list().filter(l=>(l.label??"").trim().toLowerCase()===i);if(a.length===1){let l=e.load(a[0].id);if(l)return{kind:"resumed",record:l}}return a.length>1?{kind:"pick",choices:a}:{kind:"not-found",requestedId:r}}let n=e.list().filter(r=>r.title!==void 0||r.label!==void 0);return n.length>0?{kind:"pick",choices:n}:{kind:"none"}}var cI=1440*60*1e3;function KK(t){let e=0;for(let o of t)(o.kind==="you"||o.kind==="aluy")&&(e+=1);return e}function uI(t){let e=0;for(let o of t)o.kind==="you"&&(e+=1);return e}function YK(t,e,o,n,r=Date.now(),s=cI){if(t!==void 0||e)return{kind:"explicit"};let i=o.latestForCwd(n);if(!i)return{kind:"none"};let a=Math.max(0,r-i.updatedAt);if(a>s)return{kind:"none"};let l=KK(i.blocks);return l===0?{kind:"none"}:uI(i.blocks)===0?{kind:"none"}:{kind:"offer",record:i,ageMs:a,messageCount:l}}async function dI(t){let e=zK(t.request,t.store,t.cwd);if(e.kind!=="none"||!t.isTty)return e;let o=YK(t.request,t.fresh,t.store,t.cwd,t.now??Date.now(),t.windowMs??cI);if(o.kind!=="offer")return{kind:"none"};let n=!1;try{n=await t.promptYesNo(sI(o.messageCount,o.ageMs))}catch{n=!1}return n?{kind:"resumed",record:o.record}:{kind:"none"}}import{useEffect as f5,useSyncExternalStore as vI}from"react";import{render as p5,useApp as h5,useInput as g5}from"ink";import"react";import{Box as so,Text as gI}from"ink";var mI="\u2588",VK=" ",XK="\u2592",JK=3,QK=1,ZK=4,e5=8;function t5(t,e){let n=Math.max(1,Math.trunc(e))+e5;return((Number.isFinite(t)?Math.trunc(t):0)*JK%n+n)%n}function o5(t,e,o){let n=t5(e,o),r=Number.isFinite(t)?Math.trunc(t):0,s=Math.abs(r-n);return s<=QK?2:s<=ZK?1:0}function n5(t){return t===2?"accent":t===1?"accentMid":"accentDim"}function r5(){let t=Math.max(da.length,nu.length),e=[];for(let o=0;o<t;o+=1)e.push(`${da[o]??""}${VK}${nu[o]??""}`);return e}function fI(t,e=!0){let o=r5(),n=o.length,r=o.reduce((l,c)=>Math.max(l,c.length),0),s=(l,c)=>(o[l]?.[c]??" ")===mI,i=l=>e?n5(o5(l,t,r)):"accent",a=[];for(let l=0;l<n+1;l+=1){let c=[];for(let u=0;u<r+1;u+=1)s(l,u)?c.push({role:i(u),char:mI}):s(l-1,u-1)?c.push({role:"depth",char:XK}):c.push({role:null,char:" "});a.push(c)}return a}function pI(t){let e=[];for(let o of t){let n=e[e.length-1];n&&n.role===o.role?n.text+=o.char:e.push({role:o.role,text:o.char})}return e}var MS=["aquecendo os neur\xF4nios","convencendo os el\xE9trons","alinhando os pixels","domando os bits","fazendo um cafezinho","acordando os hamsters","consultando os astros","embaralhando as ideias","afiando os l\xE1pis","respirando fundo","contando at\xE9 dez","calibrando o bom humor","procurando as chaves","desenrolando o fio","ajeitando as almofadas","apertando os parafusos"];function s5(t,e=6){if(MS.length===0)return 0;let o=Number.isFinite(t)&&t>0?Math.floor(t):0,n=e>=1?Math.floor(e):1;return Math.floor(o/n)%MS.length}function hI(t,e=6){return MS[s5(t,e)]??""}import{jsx as Ke,jsxs as Na}from"react/jsx-runtime";var LS=4,i5="agente de terminal";function a5(t){let e=(t%LS+LS)%LS;return".".repeat(e)}function yI(t){let e=z(),o=t.columns,n=t.rows,r=t.frame??0,s=t.status??"carregando",i=t.tagline??i5,l=e.animate&&e.unicode&&o>=ru?Ke(u5,{frame:r}):Ke(Xs,{columns:o});return t.prompt!==void 0?Na(so,{width:o,height:n,flexDirection:"column",alignItems:"center",justifyContent:"center",children:[l,Ke(so,{paddingTop:1,children:Ke(m5,{prompt:t.prompt,columns:o})})]}):Na(so,{width:o,height:n,flexDirection:"column",alignItems:"center",justifyContent:"center",children:[l,Ke(so,{paddingTop:1,children:Ke(l5,{text:i})}),Ke(so,{paddingTop:1,children:Ke(d5,{status:s,frame:r})}),t.version!==void 0&&t.version!==""&&Ke(so,{paddingTop:1,children:Ke(c5,{version:t.version})})]})}function l5(t){return Ke(so,{children:Ke(f,{name:"accentDim",children:t.text})})}function c5(t){return Na(so,{children:[Ke(f,{name:"fgDim",children:"Aluy CLI \xB7 "}),Na(f,{name:"depth",children:["v",t.version]})]})}function u5(t){let e=z(),o=fI(t.frame,e.animate);return Ke(so,{flexDirection:"column",children:o.map((n,r)=>Ke(so,{children:pI(n).map((s,i)=>s.role===null?Ke(gI,{children:s.text},i):Ke(f,{name:s.role,children:s.text},i))},r))})}function d5(t){let e=z(),o=e.animate?a5(t.frame):e.unicode?"\u2026":"...",n=t.status==="carregando"?hI(e.animate?t.frame:0):t.status;return Ke(so,{children:Na(f,{name:"fgDim",children:[n,o]})})}function m5(t){let o=z().role("accent").color,n=Math.max(ru,Math.min(t.columns-6,56));return Na(so,{flexDirection:"column",borderStyle:"round",...o!==void 0?{borderColor:o}:{},paddingX:2,paddingY:0,width:n,children:[Ke(so,{paddingBottom:1,children:Ke(f,{name:"accent",children:t.prompt.title})}),t.prompt.body.map((r,s)=>Ke(so,{children:Ke(gI,{children:r})},s)),Ke(so,{paddingTop:1,children:Ke(f,{name:"fgDim",children:t.prompt.options})})]})}function Ju(t,e){e&&t.write("\x1B[2J\x1B[3J\x1B[H")}import{Fragment as E5,jsx as Qu}from"react/jsx-runtime";var y5=320;function kI(t=process.env){let e=t.ALUY_SPLASH_MIN_MS;if(e!==void 0){let o=Number.parseInt(e,10);if(Number.isFinite(o)&&o>=0)return o}return 2e3}function b5(t){let o=t.trim().replace(/\s*\[[sSnNyY/]+\]\s*$/u,"").trim(),n=o.toLowerCase();return n.includes("yolo")?{title:"\u26A0 modo YOLO",body:PS(o),options:"[s] entrar em YOLO \xB7 [n] seguir normal"}:n.includes("retomar")?{title:"\u21BB retomar sess\xE3o",body:PS(o),options:"[s] retomar \xB7 [n] nova sess\xE3o"}:{title:"aluy",body:PS(o),options:"[s] sim \xB7 [n] n\xE3o"}}function PS(t){let e=t.split(`
616
616
  `).map(o=>o.trimEnd());for(;e.length>1&&e[e.length-1]==="";)e.pop();return e}function xI(t){let e=v5(),o=p5(Qu(ou,{theme:t.theme,children:Qu(k5,{store:e})}),{stdout:t.stdout,exitOnCtrlC:!1});return new FS(e,o,t.stdout)}var FS=class{constructor(e,o,n){this.store=e;this.instance=o;this.stdout=n}store;instance;stdout;setStatus(e){this.store.set(o=>({...o,status:e}))}promptYesNo=e=>new Promise(o=>{let n=b5(e),r=s=>{this.store.set(i=>({...i,prompt:void 0,resolve:null})),o(s)};this.store.set(s=>({...s,prompt:n,resolve:r}))});async finish(){this.store.set(e=>({...e,done:!0,prompt:void 0,resolve:null})),this.instance.rerender(Qu(E5,{})),this.instance.clear(),this.instance.unmount(),await new Promise(e=>setTimeout(e,50)),Ju(this.stdout,!0)}};function v5(){let t={status:"carregando",prompt:void 0,resolve:null,done:!1},e=new Set;return{get:()=>t,set:o=>{t=o(t);for(let n of e)n()},subscribe:o=>(e.add(o),()=>e.delete(o))}}function k5(t){let e=vI(t.store.subscribe,t.store.get,t.store.get),{exit:o}=h5(),n=e.prompt===void 0&&!e.done,r=Lu({enabled:n,intervalMs:y5});return g5((s,i)=>{let a=t.store.get().resolve;if(!a)return;if(i.return)return a(!0);let l=s.toLowerCase();if(l==="s"||l==="y")return a(!0);if(l==="n"||i.escape||i.ctrl&&l==="c")return a(!1)}),f5(()=>{e.done&&o()},[e.done,o]),e.done?null:Qu(S5,{status:e.status,frame:r,...e.prompt!==void 0?{prompt:e.prompt}:{}})}function x5(t){return process.stdout.on("resize",t),()=>{process.stdout.off("resize",t)}}function bI(){return`${process.stdout.columns??80}x${process.stdout.rows??24}`}function S5(t){let e=vI(x5,bI,bI),[o,n]=e.split("x"),r=Number(o)||80,s=Number(n)||24;return Qu(yI,{columns:r,rows:s,status:t.status,frame:t.frame,version:Zo,...t.prompt!==void 0?{prompt:t.prompt}:{}})}function SI(t){if(t.isTTY!==!0||typeof t.resume!="function")return!1;try{return t.resume(),!0}catch{return!1}}var w5=new RegExp("\x1B\\[[0-9;:]*u","g");function A5(t){let e=t.lastIndexOf("\x1B");if(e===-1)return 0;let o=t.slice(e);if(o==="\x1B")return 1;if(o[1]!=="[")return 0;for(let n=2;n<o.length;n+=1){let r=o[n];if(!(r>="0"&&r<="9")&&!(r===";"||r===":"))return 0}return o.length}function C5(){let t="";return{feed:o=>{let n=t+o;t="",n=n.replace(w5,"");let r=A5(n);return r>0&&(t=n.slice(n.length-r),n=n.slice(0,n.length-r)),n},hasPending:()=>t!=="",takePending:()=>{let o=t;return t="",o}}}var D5=75,IS=Symbol.for("aluy.csiUGuard.wrapped");function EI(t){let e=t;if(typeof e.read!="function")return()=>{};if(e[IS])return()=>{};let o=e.read,n=C5(),r="",s,i=()=>{s!==void 0&&(clearTimeout(s),s=void 0),n.hasPending()&&(s=setTimeout(()=>{s=void 0,r+=n.takePending(),e.emit?.("readable")},D5),s.unref?.())},a=function(l){let c=l===void 0?o.call(this):o.call(this,l),u=r;if(r="",c==null)return u!==""?u:c;let m=typeof c=="string"?c:String(c),d=u+n.feed(m);return i(),d};return e.read=a,e[IS]=!0,()=>{e.read===a&&(s!==void 0&&(clearTimeout(s),s=void 0),e.read=o,e[IS]=!1)}}B();B();var NS=".aluy",wI=`${NS}/agents/exemplo.md`,AI=`${NS}/workflows/exemplo.md`,CI=`${NS}/commands/exemplo.md`;function T5(){return["---","name: exemplo","description: Agente de exemplo \u2014 revisa arquivos e sugere melhorias.","tools: read_file, grep","---","Voc\xEA \xE9 um revisor de c\xF3digo amig\xE1vel. Leia os arquivos indicados e aponte","melhorias de legibilidade, performance e seguran\xE7a. Seja conciso e objetivo.","N\xE3o invente problemas \u2014 aponte s\xF3 o que realmente pode melhorar.",""].join(`
617
617
  `)}function _5(){return["---","name: exemplo","description: Workflow de exemplo \u2014 analisa e melhora um arquivo.","---","1. analisar \u2014 Leia o arquivo alvo e identifique problemas de c\xF3digo, performance e seguran\xE7a.","2. melhorar \u2014 Corrija os problemas encontrados, um de cada vez.","3. verificar \u2014 Rode os testes e confirme que nada quebrou.",""].join(`
618
618
  `)}function R5(){return["---","summary: Analisa um arquivo e sugere melhorias de c\xF3digo.","---","Analise o arquivo $ARGUMENTS e sugira melhorias de legibilidade, performance e seguran\xE7a.","Seja conciso \u2014 foque no que realmente importa.",""].join(`
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@hiperplano/aluy-cli",
3
- "version": "1.0.0-rc.95",
3
+ "version": "1.0.0-rc.96",
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",